Jin's Architecture Gate: Approve the Plan, Not the Diff
Reviewing a plan instead of a diff cuts the review cost that keeps coding agents out of production, and the whitelist turns drift control from a model's good behavior into a tool-enforced rule. This is a workflow change that could make agents safe enough for production repos.
Coding agents like Codex, OpenCode, and Claude Code produce large diffs that get expensive to review and risky to merge, and models drift by adding unrequested features or touching unauthorized files. Jin reframes the review step: instead of reviewing a diff, you review an architecture proposal. A planner turns the request into a JSON document with tasks, acceptance criteria, and structural ops, all referencing a persistent ledger of the codebase at L0 (package/directory), L1 (module), and facet (responsibility) levels.
The ledger is not for display; it's a boundary constraint. During implementation the model can only modify files that the approved proposal whitelists; out-of-bounds access is rejected at the tool layer. Context is symbol-level: LSP symbol positions pull only 40 lines around each relevant symbol, not whole files, and existing LSP errors/warnings in target files are appended as known issues to fix. Implementation runs the project's own test, typecheck, and lint tools, feeds failures back for one self-repair round, then re-runs, and finally re-scans the codebase to verify the approved architecture nodes actually landed.
Versioning uses WAL versions for replay and diff, and a git stash checkpoint lets you undo a round without touching HEAD. Context compaction offers local trim, LLM summarization, and an auto mode that falls back gracefully. The comparison table sums it up: OpenCode/Codex review diffs, rely on model discipline for drift, and leave git rollback to you; Jin reviews the proposal, enforces the whitelist, and closes the loop with checks. It's aimed at mid-to-large multi-module projects with real architecture boundaries; for one-off scripts, a plain Claude Code is faster.
The human job shifts from diff reviewer to intent approver, a different cognitive task; the safety of the system hinges on how carefully that intent is stated, not on the model's code discipline.
Acceptance criteria are natural language, so the model still judges intent; the gate is only as reliable as the model's interpretation of those criteria, not a formal proof.
The self-repair loop is bounded to one attempt and can only fix failures the automated checks catch; semantic drift that passes tests still slips through.
Symbol-level context is a transferable technique: it uses LSP positions to solve the token-waste problem of whole-file contexts, and any agent tool could adopt it.
Switching the review target from a few hundred lines of diff to an architecture proposal, and letting implementation touch only whitelisted files — that step I accept. The bigger the diff, the more expensive the review, and that's always been the biggest hurdle for agents going into production. But writing acceptance in natural language and having the model check against it item by item — that step I don't accept. The model is both the player and the referee; the guarantee of intent alignment ultimately still depends on it approving itself. The only things that can truly serve as a safety net are the run_checks you wrote and the consistency rescan: tests, type checks, whether the ledger nodes are in place — those are the hard guarantees. Natural-language acceptance can only be a hint, not an acceptance. In your current setup, when acceptance fails, does it kick the work back for a redo, or does it just log a warning and let it pass?
In the previous version, it recorded the architecture deviation and you could choose to update the architecture or re-implement it. The current version has strengthened the gate; you can only write content that corresponds to nodes under the approved architecture. Go try it and you'll see.