Claude Code Infrastructure Review
What We Built
From 95 random plugins to a cognitive system.
A day-by-day inventory of everything built, customized, and installed
with Claude Code from day one.
Manos Somarakis & Claude Code
February 13 – March 9, 2026
~100+ sessions · 25 days · 1 MacBook Air M1
Section 1: What You Get Out of the Box
Claude Code ships as a CLI tool. You install it, authenticate, and you're dropped into a conversation with Claude in your terminal. Here's what exists on a fresh installation:
The Starting Point
- An empty
~/.claude/ directory with settings.json
- No hooks, no skills, no rules, no memory files
- No MCP servers beyond what the tool ships with
- No domain knowledge, no routing intelligence, no learning
- Claude picks tools based on description competition — whoever's description matches best wins
- Every session starts from absolute zero — no memory of what worked yesterday, what you prefer, or what you're working on
- No cross-machine sync, no dashboards, no health monitoring
- No customization of the session lifecycle — sessions start and stop without ceremony
What This Became
- 6 memory layers (L0–L6) with persistent cross-session state
- 12 MCP servers, 11 lifecycle hooks, 14 hand-built skills
- Self-learning pipeline that observes, analyzes, promotes patterns, and auto-generates skills
- 4 domain knowledge bases with ~54MB of curated Greek law
- Cross-machine sync between two Macs via custom MCP server
- A Game Boy RPG that doubles as a law firm website
- 5 research papers on agent architecture
- Health monitoring, crisis dashboard, automated log rotation
This isn't about making Claude Code "better" in the abstract. Every change solved a specific problem encountered during daily legal practice and infrastructure work. Nothing was built speculatively — everything was built because something broke, something was missing, or something could be automated.
Section 2: What This Is Now
A numbers-driven inventory of the current system, as of March 9, 2026.
817
Memory Observations
12,919
RAG Chunks
8,178
Semantic Edges
60+
Capabilities
12
MCP Servers
11
Lifecycle Hooks
29
Skills (14+9+6)
5
Research Papers
Memory Architecture (6 Layers)
L0 Context Window Direct access, per-message, compaction-vulnerable
L1 MEMORY.md Auto-injected every session, manually maintained
L2 claude-mem 817 observations + 644 vectors + 1,098 semantic links (FTS5 + BM25)
L3 Obsidian Vault Deprecated — replaced by domain KB + RAG
L4 RAG Pipeline 12,919 chunks, 8,178 edges, BGE-M3 1024-dim, hybrid search
L5 Domain Knowledge 54MB of curated Greek law (.md files — the "Newtonian Fallback")
L6 NotebookLM Source-grounded Q&A via Gemini (zero-hallucination answers)
MCP Servers (12)
| Server | Purpose | Type |
| claude-mem-search | FTS5 search + save_memory + observations | Custom (Node) |
| duo-mcp | Cross-machine messaging (Air↔Mini via SSH) | Custom (Node) |
| osascript-bridge | macOS automation bridge | Custom (Node) |
| knowledge-engine | Cortex routing engine + graph traversal | Custom (Node) |
| sequential-thinking | Multi-step reasoning scratchpad | npx |
| google-workspace | Gmail + Calendar (142 tools) | uvx |
| playwright | Browser automation + testing | npx |
| apple-mcp | Apple services integration | npx |
| pdf-tools | PDF manipulation | uvx |
| everything-search | Full-text file search | uvx |
| notebooklm | Source-grounded Q&A via Playwright | npx |
| gov-gr | Greek government APIs (Diavgeia, AFM, Cadastre) | Custom (Python) |
Hooks (11 across full lifecycle)
| Event | Script | What It Does |
| SessionStart | session-start.sh | 13-step boot: health checks, inject state, rotate logs, recompile registry |
| UserPromptSubmit | prompt-router.sh | Domain triage, skill routing, exit detection, forced evaluation |
| PreToolUse:Read | pre-flight-read.sh | Token budget enforcement |
| PreToolUse:Write | pre-write-check.sh | Safety gate before file writes |
| PreToolUse:Bash | bash-lint.sh | Command validation — warns when Bash used instead of proper tools |
| PreToolUse:* | suggest-compact.sh | Strategic compaction suggestions |
| PostToolUse:* | observe.sh + HTTP serve.py | Dual-write observation capture for learning loop |
| PostToolUse:* | validate-output.sh | Output validation (<200ms) |
| PreCompact | pre-compact.sh | Context preservation before auto-compaction |
| Stop | assess-stop.sh + session-stop.sh | Quality assessment + cleanup |
| InstructionsLoaded | instructions-loaded.sh | Registry recompile + canary logging |
Skills (14 active + 9 auto-generated + 6 archived)
| Skill | Category | Description |
| legal-translation | Legal (PROTECTED) | Certified Greek law translation per N.4194/2013, hand-tuned |
| immigration | Legal | Hybrid skill→agent, 18 triggers, 12-file progressive-disclosure KB |
| law | Legal | FEK fetcher + law lookup — 3 eras (1938–present), 28 seeded laws |
| /bye | Lifecycle | Session closure + harvest pipeline (v2.1) — observation capture, archive, dual-write |
| /fork | Lifecycle | Session forking — branching conversations with handoff documents |
| /fresh | Lifecycle | Staleness detection for session state |
| /know | Knowledge | Personal knowledge engine — packet management + graph traversal |
| strategic-compact | Lifecycle | Suggests compaction at logical phase transitions |
| continuous-learning-v2 | System | Self-improving: observe→analyze→promote→auto-generate skills |
| instinct-status | System | Learning loop diagnostics |
| /council | Meta | Multi-perspective deliberation — 5-domain panel, Phase 0 efficiency screen |
| somarakis-brand | Web | Brand voice for somarakis.com |
| greek-lawyer-seo | Web | SEO strategy for Greek lawyer site |
| astro-site-builder | Web | Astro 5 conventions for somarakis.com |
Domain Knowledge Bases
| KB | Files | Coverage |
| Citizenship | 15 .md files | Naturalization, PEGP exam, dual citizenship, loss/acquisition |
| Immigration | 11 .md files | Residence permits (N.5038/2023), Golden Visa, Blue Card, family reunification |
| Tiresias | 12 .md files | Credit data (ΣΑΥ/ΣΣΧ), rights, remedies, case-law |
| Antallaxima | 8 .md files | Exchangeable properties, grant-deeds, buyback, cadastre, usucaption |
Legal Calculators & Tools (in mysolon.cjs)
All instant, offline, no API dependency:
| Tool | What It Computes |
| prothesmies | Legal deadlines with court holidays, Easter calc, suspension periods |
| klironomiko | Inheritance portions (statutory shares, forced heirship) |
| olografos | Holographic will validity checks |
| yperimerias | Default interest (ΑΚ 346, commercial, court-awarded, per-era rates) |
| grammatia | Court fees, notarial fees, retention calculations (200+ entries) |
| municipality | 277 Greek municipalities — fuzzy search |
| rent | CPI-based lease adjustment (rates through Jan 2026) |
| afm / holidays / epitokia | Tax ID validation, holiday calendar, interest rates |
Gov-gr MCP Server (4 tools shipped)
Python FastMCP server connecting to Greek government APIs:
| Tool | Source API | Notes |
| Diavgeia search | diavgeia.gov.gr | Search government decisions by keyword, org, date |
| Diavgeia detail | diavgeia.gov.gr | Full decision text + metadata |
| AFM lookup | GSIS SOAP (WSSE) | Tax registry queries — required Ειδικοί Κωδικοί, not TaxisNet |
| Cadastre | ESRI REST | Property lookup by KAEK — 60s timeout, exact match only |
FEK Pipeline (Law Fetching)
Downloads and extracts Greek laws from 1938 to present via ET.gr:
- Modern era (≥2006):
pdftotext — clean extraction
- Middle era (1996–2005): Latin-1→CP1253 encoding fix
- Old era (<1996): OCR via
ocrmypdf -l ell
- 28 seeded laws in index, auto-growing on use
- Caching at
~/.local/share/greek-law/ — download once, use forever
Other Infrastructure
| System | Description |
| Crisis Dashboard | Catppuccin Mocha PWA — 7 panels, dual-tier polling, OSINT feeds, anomaly detection |
| Agent Dashboard | 5-panel observability — tool calls, agent spawns, errors, timing |
| Healthcheck | 60/60 PASS — functional tests (not just existence checks) |
| Log Rotation | Automated: observations >500 lines, debug/ >7 days, session archives by month |
| Security | Injection detection (5 regex patterns), secret scanning, XML memory trust boundaries |
| Duo (Cross-Machine) | Air↔Mini messaging via SSH relay (~130ms), file locking, auto-expire |
| Nomimon | 1,832-line Game Boy RPG — buildings=legal services, NPCs=FAQs, creatures=capabilities |
Section 3: How We Got Here
Day-by-day changelog of what was built, what broke, and why each change was made. Grouped by phase. For the full narrative with wrong turns and course corrections, see EVOLUTION.md (365 lines, Acts 0–12).
Phase 0 — The Plugin Jungle
Early February 2026
Infra 95 Plugins, Zero System
Started with Claude Code's plugin ecosystem. Installed 95+ plugins, 14 MCP servers. Docker helpers, Kubernetes managers, Terraform — none relevant to a Greek lawyer. One plugin alone (claude-octopus) injected ~4,000 tokens per session for a persona system requiring binaries that weren't installed.
The question that started everything: "I have all these tools. How does Claude know which one to use?" It didn't.
Existence ≠ function. Having 95 plugins installed is not the same as having a system.
— EVOLUTION.md, Act 0
Phase 1 — The Port (Feb 13–18)
Feb 13
Infra Searched for Routing Infrastructure
Nothing. Blank slate — no registries, no routing, no MCP servers configured in Claude Code.
Feb 17
Infra Reverse-Engineered Cowork Cortex (26 files)
Documented the full architecture from a previous Claude Desktop prototype. Designed a 4-Layer Memory Stack with Cortex as Layer 4: the intelligent router.
Feb 18
Infra First Install — Cortex v1.0.0
Three skills, seven commands, one MCP server. First gotcha: plugin cache existed on disk, but Cortex was NOT registered. Cache ≠ active.
Phase 2 — The Big Pivot (Feb 20)
Feb 20
Infra Passive Over Active Routing
The most significant architectural decision. Three options evaluated: Pure MCP, Pure hooks, Hybrid. The hybrid won on paper. But during implementation, three Cowork features were permanently scrapped: MCP bridge scanner (too complex), LLM calls in routing hot path (latency killer), context budget management (unnecessary). Bet: Claude Code's native description matching is good enough. That bet won.
Feb 20
Recovery First Registry Breakdown
Registry had never been compiled. Database was empty. MEMORY.md claimed 163 capabilities — actual count: 39. Two Cortex MCP servers running simultaneously. Zero routing decisions recorded. Lesson: audit before building.
Phase 3 — Building the Foundation (Feb 20–28)
Feb 20–24
Infra Observer Built (Half-Working)
Learning loop's PostToolUse observer logged tool calls to observations.jsonl. Accumulated thousands of observations. But: observer config set to enabled: false, 41.7% duplicate entries, all instinct directories empty. The analysis pipeline was open — data flowed in and collected. Nothing evolved.
Feb 22
Infra System Storage Cleanup + WGS Genomics
Cataloged 50+ Dante Labs WGS PDFs. Created genomic profile memory file. iCloud stub handling documented.
Feb 24
Infra Terminal Setup + MCP Consolidation + Security
MCP servers consolidated (5→3). Permissions cleanup (87→49 plugins). Google OAuth rotation. Obsidian API key rotation. 18 agents launched for research synthesis. Settings.json deny list: 13 dangerous command patterns. 5 skills installed from community. Hooks enabled. Registry expanded 39→53.
Feb 24
Legal Immigration Law KB Phase 0
PDFs organized. KB structure created at legal-kb/immigration/. Registry: 367 lines, all 12+ permit types mapped. Blue Card requirements fully documented. N.5275/2026 amendments: all 44 changes mapped.
Feb 24
Infra RAG Pipeline Research
Evaluated 20+ existing MCP RAG servers. None satisfied all constraints: DOCX + Greek + hybrid search + local-only + MCP. Decision: build custom. Embedding model journey: nomic-embed → BGE-M3 (1024-dim, best multilingual).
Feb 25
Research OpenClaw Analysis (100K+ stars)
Analyzed OpenClaw (675K LOC TypeScript). Adopted: injection detection (5 regexes), XML memory wrapping, temporal decay formula, detect-secrets baseline. Deferred: progressive disclosure, auto-capture triggers, embedding cache.
Feb 25
Research The Neuroscience Connection Discovered
Reading Buschman et al. (2025). Realized: the system already built for practical reasons mapped to known brain architecture. Cortex routing = thalamic relay. Domain rules = gain control suppression. Agent delegation = dynamic routing. Convergent evolution — same constraints produce same solutions.
Feb 26
Infra Learning Loop Actually Closes
Deep audit of analyze.py (495 lines, 14 functions). Found why patterns never promoted: error confidence capped at 0.8 (line 214), promotion gate at 0.9 — mathematical impossibility. Fixed: caps raised, clustering implemented, auto_evolve activated. First auto-promotion: tool chain patterns promoted to generated-rules.md.
Feb 26
Infra Master Plan Created
After 82+ sessions of organic growth: 5 memory layers, 12 MCP servers, 6 hooks, 36 plugins, RAG at 49%, broken hooks, auto_evolve: false. Created evolution master plan: ~38 hours across 12–15 sessions, 5 B-phase planning + 5 C-phase implementation. Key pivot: all planning must complete before any implementation begins.
Feb 26–28
Infra Memory Architecture Overhaul (ChromaDB → sqlite-vec)
ChromaDB stored thousands of embeddings — none used by search. Every search went through FTS5 only. Replaced with sqlite-vec: same SQLite file, 1024-dim BGE-M3, semantic KNN linking, temporal decay per collection. ChromaDB: thousands of embeddings deleted.
Feb 27
Legal Μπλουσάι Ανταίτηση — First Real Legal Work
Drafted counter-petition for child communication rights. v1 was over-lawyered. User correction → v2: lean style. Key lesson: αίτηση = brief facts + request. Legal analysis goes in προτάσεις.
Feb 28
Infra Full Skills/Rules/Cortex Audit
4 parallel agents audited token efficiency. Always-loaded rules: ~990 tokens/session saved. 5 skills trimmed 58–78%. 6 Cowork-era entries killed. .gitignore expanded — git staging had 2,400+ file noise.
Phase 4 — Crisis Mode (Mar 1–3)
Mar 1
Infra Crisis Ops Build
Backend scripts (OSINT feeds, sitrep auto-updater, session protection, cron manager). Crisis dashboard GUI (Catppuccin Mocha, 7 panels). Terminal & Shell 9-phase setup (12 CLI tools, starship, tmux, Atuin). Ollama 0.17.x MLX Metal crash on M1 Air — SIGABRT. All local inference broken.
Mar 2, 2:29 AM
Recovery The Crash That Changed Everything
macOS OOM killed 4 concurrent Claude Code sessions. 4 × ~1.5GB = ~6GB on 8GB M1 Air. Healthcheck reported 51/51 PASS while three critical systems were non-functional. "You have existence checks, not functional tests." Data casualty: Munich trip photos unrecoverable. Non-destructive rules codified from this crash (5 rules now in CLAUDE.md).
Mar 2
Recovery Recovery Blueprint (7 Phases, Single Session)
All 7 phases executed: DCIM verified, CLAUDE.md restructured, claude-mem search shim verified, PreCompact fixed, 300-token forced-eval snippet deployed, Synergatis agent created, memory-guard built. 55/57 PASS.
Mar 2–3
Legal LIDL Union + Duo MCP + Mysolon
LIDL workers' union authorization drafted. Duo MCP built (cross-machine messaging, SSH relay, 6 tools). Mysolon Phase 0+1: 12 legal calculators (deadlines, inheritance, wills, interest, court fees, municipalities, rent). All tested with real legal inputs.
Mar 3
Legal Grammatia KB + Case Management
Grammatia KB complete (9 files, verified through ν.5221/2025). Mysolon full codebase cloned + analyzed. Greek legal tech ecosystem scan. Non-destructive rules codified.
The crashes were the best audits. The system that exists today is the sum of everything that broke.
— EVOLUTION.md, closing
Phase 5 — Architecture & Papers (Mar 4–6)
Mar 4
Infra Cortex v0.1.0 Shipped
Working cortex init CLI, 4-tool MCP server, 3 installable hooks, starter registry. Competitive intelligence: 18 "Cortex" projects mapped. ZEP/Graphiti deep dive. 35 stealable ideas harvested. 3 expert evaluations.
Mar 4
Legal Κατσούλη 52 ΚΠΔ Appeal (Full Draft)
6 swarm agents for legislation + case law + templates. 7 defects found in prosecutor's reasoning. Complete appeal written (7 grounds, 55 paragraphs). Corrected: παράβολο 300€→250€, Art 362 REPEALED by N.5090/2024.
Mar 4
Research Model+Effort Audit + Agent Delegation
46-task classification: Opus 35%, Sonnet 54%, Haiku 11%. 65% of tasks didn't need Opus. 19 delegation case studies, 4 forensic deep dives. Key finding: synthesis through re-derivation — orchestrator uses agent output as raw material (9:1 compression).
Mar 5
Creative WGS Portfolio App
3.7MB single-file SPA: 9-tab interface, 238 drugs, 145 variants, 17 PGx genes, 8 organ deep-dives, Cmd+K search, emergency mode, 6 print modes. All 61 WGS source files represented.
Mar 5
Infra 8 Infrastructure Workstreams
Subagent detection, reliability scoring, agent delegation patterns, memory provenance, MCP pinning, output validation, session-scoped hook disable, agent dashboard. 12 files modified, 5 new files. Team of 3 agents.
Mar 6
Infra SYSTEM_MANUAL + /bye v2.1 + Exit Protocol
Built living infrastructure manual (S1–S12, ~250 lines). /bye v2.1.0 shipped: fast mode, dual-write, harvest pipeline. Exit protocol in prompt-router.sh: auto-detects "bye", "done", "τέλος" → injects closure instructions.
Mar 6
Research Papers #1–3 + mcpx Design
Paper #1: The Newtonian Fallback (.md as circuit breaker). Paper #2: mcpx — self-provisioning tool management. Paper #3: Convergent Evolution (neuroscience → agent architecture). Also: 6-expert council debate for mcpx design (10 rounds).
Mar 6
Legal Immigration KB Phase 3 + Specialist Agent
PEGP aligned to ΥΑ 10802/2025. N5038 comprehensive (472 lines). Practical guides (509 lines). Hybrid skill→agent built. Full KB: ~70K tokens with progressive disclosure.
Phase 6 — Expansion & Papers (Mar 7–9)
Mar 7
Legal Tiresias KB (Credit Data)
12 files: overview, legislation, retention, rights, remedies, case-law, practical guide, forms, contact. Source: office DOCX (18 sections) + PDFs + web research. ~638 lines, ~40K tokens. Routing: Category E (E1–E8) added.
Mar 7
Research Paper #4 — Elements of a Theory of Everything
The capstone paper. 4 constraints (bounded attention, unreliable memory, variable environment, continuity imperative) are substrate-independent → convergence across neuroscience, biology, ecology, game design, software agents. 8-layer universal architecture. 6 testable predictions.
Mar 7
Creative Nomimon v0.3–v0.4 (Game Boy RPG)
5-sprint overhaul: 1,371→1,832 lines. 4 seeded grass, brick walls, sine water, building facades. Player face/bob/shadow, NPC bodies, 12 agent emblems. Web Audio (15 SFX + BGM). Minimap, NPC patrol, party swap, day/night cycle, 6 legal collectibles. Save v3 backward-compat.
Mar 7
Creative Somarakis Brand v2.1
Pivoted from cinematic 5-scene scroll to substance-backed depth. 4 brand documents produced. Emotional target: CURIOSITY. "ew, sounds desperate" — the 5-scene approach was performing curiosity instead of creating it.
Mar 8
Infra NotebookLM Integration
MCP server installed (Playwright-based). Triple knowledge stack defined: claude-mem (L2) + knowledge-engine (L4) + NotebookLM (L6, zero-hallucination). Podcast automator installed (FastAPI + Playwright).
Mar 8
Creative Leonardo Tsaousi Website
Single-file prototype for economist friend: parallax, cursor glow, scroll reveals, 3D card tilt, floating equations, ticker. 3 essays, 1 featured long piece, 6 research notes. Playfair Display + Inter + JetBrains Mono.
Mar 9
Legal Greek Law Tools v1.0 + Antallaxima KB
fek-fetch.sh (3 eras, caching, agent-callable) + lib-common.sh + law-index.json (28 laws) + /law skill. 3-agent review found+fixed 6 bugs. Antallaxima KB: 8 files on exchangeable properties, grant-deeds, buyback, usucaption.
Mar 9
Infra gov-gr MCP Server (4 Tools)
Python FastMCP. Session 1: Diavgeia (2 tools). Session 2: Cadastre (ESRI REST, 60s timeout) + AFM (GSIS SOAP, WSSE, Ειδικοί Κωδικοί, Keychain). Discovered data.gov.gr/datasets/gov-et-laws for law→FEK mapping.
Mar 9
Infra RAG 100% + Skilled Agents Pipeline
Vectors: 12,919/12,919 (100%). rag_traverse tool added. Skill synthesis pipeline in analyze.py: detect candidates → synthesize skills → crystallize agents. Auto-generated skills go to skills/auto/. Paper #5: Skilled Agents research paper.
Mar 9
Infra CC Features Integration + Ecosystem Briefing
9 features analyzed, 4 applied (MCP wildcards, includeGitInstructions, HTTP observe, InstructionsLoaded). Agent Skills spec alignment: 13/13 skills compatible. Dual-write observation system deployed.
Appendix: By the Numbers
| Category | Count | Status |
| Total sessions | 100+ | Over 25 days |
| Memory observations (claude-mem) | 817 | Active, FTS5 + BM25 |
| RAG chunks (vectorized) | 12,919 | 100% embedded |
| Semantic edges | 8,178 | Bidirectional KNN |
| MCP servers | 12 | 8 standard + 4 custom |
| Lifecycle hooks | 11 | All active |
| Skills (hand-built) | 14 | Active |
| Skills (auto-generated) | 9 | Active |
| Skills (archived) | 6 | In .archive/ |
| Registered capabilities | 60+ | Confidence-scored routing |
| Domain KB files | 46 | 4 practice areas |
| Domain KB size | ~54 MB | Curated Greek law |
| Legal calculators | 10 | Instant, offline |
| Gov-gr API tools | 4 | Shipped (7 planned) |
| Laws in FEK index | 28 | Auto-growing |
| Research papers | 5 | Published (MD/HTML/PDF/DOCX) |
| Healthcheck tests | 60 | 60 PASS, 0 FAIL |
| Nomimon game lines | 1,832 | Playable Game Boy RPG |
| Agents (specialist) | 2 | Immigration, Synergatis |
| Dashboards | 2 | Crisis PWA + Agent observability |
| Cron jobs | 2 | OSINT feeds + sitrep (*/30) |
| Cross-machine sync | 1 | Duo MCP (Air↔Mini, ~130ms) |
| Git commits (~/.claude) | 50+ | Version-controlled infra |
The Five Meta-Patterns
1. Existence checks masquerading as functional tests.
ChromaDB "working" but unused. Healthcheck passing while 3 systems broken. Observer "running" but never evolving. The system consistently accumulated the appearance of functionality before the reality of it.
2. Organic growth followed by consolidation crisis.
82+ sessions of additive work created extraordinary breadth and significant debt. The evolution master plan was the consolidation response. The system had to be planned after being built.
3. Plans survived crashes; execution didn't.
Every crashed session had a plan file on disk. Recovery protocol: read plan + execute, no re-planning. Persistent state on disk is the only reliable thing.
4. The AuDHD hyperfocus trap.
Session overreach was consistent: 4 crashed sessions each had 3–5 major tasks running concurrently. "The overreach is hyperfocus-within-scope. Fix the plumbing before adding more fixtures."
5. Convergent evolution with neuroscience.
The brain metaphor wasn't imposed — it was discovered. Same constraints (limited working memory, need for context routing, value of not starting from scratch) produce the same solutions whether you're a primate prefrontal cortex or a CLI tool managing 14 MCP servers.
Every wrong turn taught something. The crashes were the best audits. The system that exists today is the sum of everything that broke.
— EVOLUTION.md