One person, several AI agents, and a process that does not take the agent's word for anything: written blueprint before build, hooks that block instead of advise, gates that read evidence files not summaries, a different model for review, and a sentinel that watches every system after it ships. Every failure the sentinel or a gate catches becomes a row with a root cause. No closure without a second pair of eyes.
Two lanes, one closed loop. The build lane turns a requirement into a delivered, reviewed system. The run lane watches it in production, turns every failure into a tracked row, and feeds the learning back into the rules the next build runs under.
One paragraph from the client or from me. No number, no path — the factory allocates the project, its repo and its phase file.
Domain research, options, explicit out-of-scope list. Prior learnings for this domain are injected automatically.
Measurable spec, contracts, task decomposition. Reviewed by a second model until it scores ≥95 or is sent back.
RED → GREEN per file. Code is written by external code workers; the orchestrator validates, never types the spec out itself.
Hooks block bad actions before they run. done_gate reads the test file the run wrote — a "done" claim without it is a BLOCK.
Security gate, quality gate, a different model tries to break it, visual UAT in a real browser.
Branch → PR → merge. Merging is the deploy. Nothing reaches production unless the exact commit is already on online main.
Every registered system reports errors to the sentinel; uptime and API health are polled every 10 s with a watchdog over the pollers.
New error pattern or a spike over threshold → Telegram / email / webhook, with the source name so I know which system.
Every defect becomes a row in the tracker with kind, severity, source and state. A bullet has an opinion; a row has a state.
Root cause and the new requirement it implies are fields, not prose. Symptom-only fixes are rejected at the gate.
The database refuses closure unless verified_by ≠ resolved_by and a TEST or REPRO evidence row exists.
Resolution, verification command, fix commit and a full audit timeline stay on the row forever.
Recurring patterns enter the learning catalogue; the worst become invariants and hooks. The next requirement starts under stricter rules.
A rule written in a markdown file is still just a sentence the model has to remember three hours into a run. These five mechanisms make the rule true whether the model remembers it or not. Long-form write-up →
Machine-wide invariants every agent inherits: no destructive delete, tests must actually execute, never edit a test to make it pass, verify before claiming, no secret value in any output.
How a kind of work is done — security, DB ops, integration tests, design tokens, observability, UAT — loaded automatically when the task matches. Each check is a shell command with an exit code.
Run in code, outside the conversation, and can block a tool call before it happens: deploys that skip preflight, test tampering, issue lists written as files, spawns without a watchdog.
A phase is done when the artefact exists and the test file says 0 failed — not when the agent says so. False-done, revert-and-refix and skipped-phase are blocking rules.
The model that writes never approves. Claude orchestrates and validates, Codex reviews and tries to break, Kimi runs QC gates, a local model is the PMO gatekeeper between phases.
# what a prompt looks like from the inside — a hook classified this very task and # injected the three failure patterns most likely to recur, before I typed a line UserPromptSubmit → §7.3 auto-watchdog · classified=NEW_PROJECT · top-3 prior issues from catalog: [R1] false 'done' claim — recurred 4× in similar tasks [R9] wrong scope/project targeted — recurred 2× in similar tasks [R3] mobile/browser compat broken — recurred 2× in similar tasks # and what a closed row looks like in the database itself (query run 2026-08-31) $ sqlite3 factory.db "select resolved_by, verified_by, verification_method from issue_tracker where ref='P39-0005'" p39-plist-fix-sonnet-subagent | claude-opus-5-orchestrator | Independent re-run, not self-reported: … pytest = 3 passed; RED/GREEN probe reverting cli.py = 2 failed, restore = 3 passed
Nothing here is exotic — plain text files in ~/.claude/, wired into Claude Code's own extension points. What matters is how they are used: the global file is a thin router that stays in context, detail is loaded on demand, enforcement runs in shell, and memory persists across sessions.
~/.claude/ # applies to EVERY project on the machine ├── CLAUDE.md # v2.8.0 · 560 lines · thin router, versioned, changelog │ INV-0.001 … INV-9 # 11 invariants (BLOCK on violation) │ §0.4 … §0.15 # 12 policies: scope, deploy, claims, issues-as-rows… │ §7 task intake # keyword → task class → skills auto-route │ ORCHESTRATOR ROLE LOCK # orchestrate · validate · git — delegate the rest ├── dac/ # 10 detail files, ~1,400 lines, loaded ON DEMAND │ 0_policies 1_invariants 1_5_audit_protocol 2_agent_modes │ 3_ccp 4_mcp 6_email 7_task_intake 8_orchestrator_spawn 9_external_llms ├── settings.json # hooks wired to 4 events (see table) ├── hooks/ # 18 shell scripts · exit 2 = the call is blocked ├── skills/ # 25 skills — each check is bash + exit code └── projects/<repo>/memory/ # 103 memory files for the factory alone feedback 49 · project 38 · reference 8 · user 1 <repo>/CLAUDE.md # adds, never replaces. Points at global by VERSION; # preflight P-06 FAILS the build if the two drift.
| event | hook → what it does, mechanically |
| UserPromptSubmit | classifies the task, queries the learning catalogue, injects the top-3 recurring failures for this task class; arms a watchdog; emits a heartbeat to the Tower |
| PreToolUse · Bash | guard_deploy_scope — blocks rm, blocks any production deploy unless the exact commit is on online main with a clean tree; fails closed |
| PreToolUse · Write/Edit | guard_test_integrity — refuses edits that weaken a test to make it pass · guard_issue_docs — refuses ISSUES.md / BUGS.md files: defects are rows |
| PreToolUse · Agent/Bash | guard_spawn_ledger — records every sub-agent / external CLI spawn so an unwatched one surfaces in preflight |
| Stop | runs the evidence gate on what the turn claims it finished; a "done" with no test output is a BLOCK verdict, and BLOCK is final |
| PostCompact | re-injects the governance context after the conversation is compacted — the rule survives the model's memory loss |
The Tower reads the same SQLite database the agents write to. Projects, the issue tracker with RCA and evidence, which CLIs are alive right now, which domains and sites are up — and a live link to Pehredaar.





Pehredaar ("the one who keeps watch") is a daemon that polls every registered source — uptime, API health, and each application's own error webhook — persists events in SQLite WAL, fingerprints them, and alerts the moment a new pattern surfaces or a known one spikes. Its issues flow into the Tower as rows, so a production error and a build defect live in the same ledger.



Every rule in my global setup has a WHY block with a dated incident behind it. Nothing below was designed on a whiteboard; it was paid for. This is the clearest picture of how I actually work: a problem, its real root cause, and the mechanism that makes it structurally hard to repeat.
Its excuse: "delegation seemed unavailable". It was not — the operator said "use your sub-agents" and four spawned instantly. A bug in its own checker survived its own review and was caught only when a sub-agent refused to work around it.
Each had verified its own fix. Each was wrong. A fixer checking its own fix is not verification — and prose issue lists in markdown files were never reconciled by anything.
The deploy guard checked the target — project mapping, payload size, secret scan — but never whether the commit was merged and pushed. Unpushed work would have passed every check.
The process existed, so pgrep said it was running. It had produced zero bytes for half an hour.
Building the Eagle Tailors walkthrough for this page, I changed a PIN on one VPS and the live app still rejected it — the API runs on a different host than the one I'd assumed.
A bespoke men's tailor trading since 1968. Two different problems, two systems on one domain — the public site at / and the staff web app behind /dashboard — both built and shipped through the loop above.
| what was wrong | A 58-year-old tailoring house with no web presence; new customers arrived by word of mouth only, and could not even find the phone number. |
| what we built | A bilingual (English / Hindi) site whose only job is to convert to a WhatsApp or a call. Lead events fire into analytics; front-end and back-end errors report to Pehredaar — a broken button is found by the sentinel, not by a customer. |
| what was wrong | Every customer's measurements live in yearly ledger books, found by flipping pages. A regular customer on the phone means minutes of searching; a lost page means re-measuring; two "Sharma ji"s means guesswork. |
| what we built | A staff app (6-digit PIN) that photographs each bill and indexes it: customers with multiple phone numbers, ledger books by year, bills, measurements per bill, payments and pending balance, bill and customer photos — with an audit log of every change and soft-delete so nothing is ever truly lost. Search by phone, folio or name in seconds. |
| the principle | "This system never replaces your book. It only helps you find it faster." The paper workflow stays exactly as the tailor knows it; the app is the index, not the master. |
| what's next | Free Hindi + English OCR over bill photos to auto-extract fields, duplicate detection with merge, and bulk digitisation of the old books. |





Captured live on 2026-08-31 with the demo owner login (PIN reset for this walkthrough). Counters read 2 customers / 1 bill because this is a seeded demo tenant — no real customer records are shown.

A Vedic astrology platform. I am not an astrologer. The question was whether the loop above could carry a domain I had to learn from scratch — with a practising astrologer as the acceptance tester, not me.
| how the "training" actually worked | Not machine-learning on a black box, and — checked in the code today — no LLM anywhere in the calculation path. The classical rules were codified into 11 machine-readable rule tables (762 entries: yogas, dasha effects, nakshatra predictions, ascendant profiles, transit vedhas, disease rules…) and 61 deterministic calculation engines over Swiss Ephemeris. AI did the heavy lifting in building it — reading texts, encoding rules, writing tests — but a prediction on the site is reproducible arithmetic, not a model's opinion. |
| acceptance by a human expert | A working astrologer reviewed output in rounds; round two (09 Apr 2026) alone raised 12 concrete defects — date formats, a missing nakshatra pada, chart alignment against the desktop software they trust. Each became a tracked item, was fixed, and was re-checked by them, not by me. |
| size | 260 API endpoints · 1,871 test functions in 67 files · 1,402 commits · Jhora-style charts, Lal Kitab, Panchang, numerology, PDF reports. |
| watched | Site, API health and application errors are three separate Pehredaar sources. The August outage rows in the register above are this system. |
A hobby project that got serious. A warehouse full of autonomous mobile robots is expensive to get wrong, so I am building the twin first: a simulated fleet you can plan, drive, break and replay before a single real robot moves. No client, no deadline — it is where I test what the loop can carry, and it is the largest thing it has carried so far. It is not finished, which is exactly why it belongs on this page.
| scope | Fleet simulation with physics-backed sensors (Gazebo LiDAR, occlusion filters) · path planning and traffic control with node reservations · model-predictive motion control in C++ · a pick-station state machine · a gRPC bridge between the C++ core and a Python service layer · a browser control room with teleoperation (joystick, gamepad, click-to-pose, e-stop) · multi-tenant SaaS shell with migrations and a replay engine. |
| how we are doing | 107 commits since 2 April 2026 · roughly 4,600 automated test cases across Python, C++ and TypeScript · a container running a 13-robot fleet locally · teleoperation layer audited three times by three different models before it was accepted. Status lives in one PROJECT_STATUS.md that every other document defers to — the project's own "single source of truth" rule. |
| the problem we are on right now | Robots on the 2D map still teleport between server updates instead of gliding. CSS transitions on 5 Hz updates were not enough; the fix is client-side interpolation between frames. I flagged it three times myself while watching the map — so it is logged as a defect, not argued with. |
| honestly not done | A 50-robot / 100-user load test · OPC UA integration · ISO 3691-4 documentation · a certified warehouse-management connector · security audit. Core platform is self-assessed at ~97%; the enterprise edge is where the remaining work is. |
The scarce skill is not writing the first draft — it is knowing which claims in the draft are false, and building the machinery that catches them before a client does.
So the memory lives in rules, hooks and a database. What the model forgets three hours in, the hook still enforces; what the team learnt last month, the next prompt is told.
Explicit requirements, independent inspection and root-cause analysis are not process theatre where I come from — they are how nothing gets hurt. The factory is that discipline, automated.
not shownThe registry holds 55 projects. This page shows the two I chose to explain in full and one in progress; client platforms under NDA are deliberately absent.
I don't know your data yet — that is step 1. What I do know is how to make an agent on top of it that you can trust, and that stays trustworthy after delivery.
Sit with the people who own the data; write down what gets asked, what a wrong answer costs, and what is out of scope.
Anything with a fixed right answer becomes rules or lookups the agent cannot improvise; the model only handles the fuzzy parts.
A written spec of what the agent must answer, how it refuses, and how it will be tested — reviewed by a second model before any code.
Every answer is checked against a known-good answer; "it seems to work" is not accepted.
A different model tries to break it, and a human on the client side signs off.
Every wrong answer becomes a tracked row with a root cause, and the fix tightens the rules for the next version.
The opposite — it is what lets me move at sprint pace without the two things that actually eat a delivery: rework, and finding out in production. The rigor is automated and parallel, so it costs wall-clock time close to zero.
Agents run in parallel, and the gates are shell checks that run in code — there is no human review queue to wait in. The slow parts of delivery are rework and production incidents; catching a defect at a gate in minutes is what prevents both. Governance buys velocity, it doesn't spend it.
The rules, skills and gates are plain text files committed to the repo — a project layer that only adds to the global one. A new engineer inherits the same guardrails on day one; the process is the onboarding. Nothing here depends on me being in the room.
A throwaway prototype and a production payment path do not get the same gates. Which checks run is chosen by each project's profile, so the weight matches the risk — heavy where a wrong answer costs money, light where it is a demo. Fast when fast is safe.
Every system I currently run is watched, every caught failure is a row with a cause, every fix is verified by someone who did not write it, and every learning tightens the rules the next build runs under. Today that loop runs across the projects above. The direction is to close it fully — so the estate governs and repairs itself, and the human's job is judgement, not babysitting.
Pehredaar Sentinel: from "alert me" to "propose a tested repair" — with an independent verifier and a human veto before anything touches production.
The catalogue already votes on recurring failures across four models. Next: automatic promotion of a repeated pattern into a hook, with the evidence attached.
A tailor's ledgers, a Vedic astrology engine, a robot fleet in a warehouse — the domain changes, the loop does not. That is the bet: the process, not my prior knowledge of the field, is what makes the output trustworthy.