Agent Harness
The harness surrounds the toolkit's agents: a route for each kind of work, hooks that check every call, command-line scripts that report on the work, and files that the installers write into ~/.claude. A hook is a script that Claude Code runs before or after a tool call, and a hook can deny the call. Watch a scenario, or click an element to read what it does. If a hook denied your call, go to the lookup.
Main loop
- main loopThe Claude Code session in which you talk to the orchestrators. It decides and approves but does not do the work.It sends code work through the orchestrators: features with
/ft-dev, bugs with/ft-fix, cleanup with/ft-refactor. UI or UX work on an existing screen goes to oneft-ui-ux-design, and a design document for people goes to oneft-sdd. A lane is one running top-level orchestrator. The main loop keeps the number of running lanes that the owner last asked for, and it starts the next backlog item when a lane ends. Over about 200K of context it hands operational batches to oneft-opsand keeps the approvals and design choices. It runs five command-line scripts throughBash:lane-status.py,vault-note.py,artifact-registry.py,session-audit.pyandjanitor.py.
Orchestrators
- ft-developerRuns a feature through
/ft-dev: stages, checkpoint D, the approval gate, units, checkpoint F.It takes a feature, an idea, a JIRA ticket or a research prompt, on any repository and language of Friendly Technologies. It delivers code, tests and documentation together, and it delegates all of them to the leaves. No production code starts before its explicit approval gate. A bug goes to/ft-fixorbugfix-agent, and a behaviour-preserving cleanup goes torefactor-agent. When you launch it yourself, end the prompt withResets: handled, and relaunch a fresh one onCONTEXT_RESET.Skillsobsidian-knowledge-vaultReads and writes the team's shared Obsidian vault: search at the start of a task, one note at the end.cwmp-xmlWrites, parses, validates and debugs CWMP XML, the TR-069 SOAP messages.oma-lwm2m-expertOMA LwM2M protocol expert: data model, transports, security modes, bootstrap, FOTA and SOTA.code-reviewBundled. Invoked on the working-tree diff on the lightweight review path.impeccableshapeplans states, flows and edge cases at Stage 3.auditandcritiquerun read-only at Stage 7.find-animation-opportunitiesRead-only. Decides where a feature animates, and what must not, at Stage 3.pick-ui-libraryInforms the choice before a new UI library is proposed to the user.review-animationsAn independent pass at Stage 7 when the diff contains motion.
- bugfix-agentFixes a bug. A MINOR bug comes here directly. A MAJOR or CRITICAL bug comes through
/ft-fix.It writes a failing test that reproduces the bug before the first edit of production code, then proves the root cause. Each run classifies its outcome, includingCANNOT_REPRODUCEandEXTERNAL_GAP, sweeps for siblings and adds a guard against the bug class. A feature-sized change goes toft-developerasSCOPE_IS_FEATURE. A small change with no design choice in it also comes here, as MINOR. It never pushes and never opens a pull request.Skillsft-java-standardsThe Java and Spring Boot backend standard: packages, naming, DI, immutable DTOs, logging, tests, the DB contract and security.ft-angular-standardsThe Angular and TypeScript frontend standard: feature folders, naming, DI, RxJS and NgRx, logging, tests and security.ft-python-standardsThe Python standard: ruff, mypy and uv, layout, types, logging, pytest, Flask surfaces and security.obsidian-knowledge-vaultReads and writes the team's shared Obsidian vault: search at the start of a task, one note at the end.
- refactor-agentRuns a behaviour-preserving cleanup through
/ft-refactor.It pins the current behaviour with a green test net before the first edit, and the behaviour must stay provably unchanged. It has three modes: targeted, audit-driven and standard-violation. Each smell it names carries afile:lineand a threshold from the design principles, or the label of a judgment call. It refactors in small verified steps and ends with a consistency sweep and a full-suite gate. A behaviour change goes toft-developer, and a bug goes tobugfix-agent.Skillsft-java-standardsThe Java and Spring Boot backend standard: packages, naming, DI, immutable DTOs, logging, tests, the DB contract and security.ft-angular-standardsThe Angular and TypeScript frontend standard: feature folders, naming, DI, RxJS and NgRx, logging, tests and security.ft-python-standardsThe Python standard: ruff, mypy and uv, layout, types, logging, pytest, Flask surfaces and security.improve-animationsRead-only, when installed. Supplies the prioritized worklist when the area is UI motion.impeccabledistillandextract, when the area is UI complexity or duplication.
- ft-fix-hostHosts ONE
/ft-fixrun for the main loop, on a 1-hour cache.Its first action is to invoke the skillft-fixwith the bug brief, and it then acts as the orchestrator of that skill for one MAJOR or CRITICAL bug. The cache lasts across the long waits on lens rounds, which is why it replaces ageneral-purposeagent as a host. There is no human in its session: a question ends its run and comes first in its report. It is not for a MINOR bug or a feature.Skillsft-fixQuality-gated bug fixing throughbugfix-agent, with parallel adversarial verification of the fix plan and of the final diff.
One job from the main loop
- ft-opsRuns ONE operational batch on
sonnetand a 1-hour cache, and brings every design choice back.It handles rebases, merges and cherry-picks of reviewed branches, integration batches, pull requests and CI waits, gates, releases and tags, and build-pool, host and demo housekeeping. It resolves a conflict itself only when the conflict is mechanical, such as adjacent hunks, imports or a version bump. When both sides changed behaviour, a contract or the intent of a test, it stops and hands back both sides. It is not for code changes, a status page refresh or read-only research. - ft-ui-ux-designWrites presentation. It routes each design property to its skill and never reviews its own diff.It has three modes.
designwrites the UX spec and the visual direction for a new screen, a new flow, a restyle or a redesign.changeedits the presentation of an existing UI inside the product's design system, with its component tests, and checks it in a browser.reviewcritiques an existing screen read-only. Business logic, data and API changes go to the stack's coding agent, and the Visual/UX lens ofverifierreviews its diff.SkillsimpeccableStates, accessibility, layout and copy:shape,critique,audit,harden,polish,distill.emil-design-engA property owner, loaded when its property is in play.improve-animationsA property owner, loaded when its property is in play.find-animation-opportunitiesA property owner, loaded when its property is in play.animateA property owner, loaded when its property is in play.review-animationsOn any motion diff, before reporting.animation-vocabularyNames the motion in the motion plan.apple-designGestures.design-taste-frontendDirection. In an existing enterprise UI it runs only with--keep palette,type, or its app-screen run.datavizA property owner, loaded when its property is in play.ft-angular-standardsThe Angular and TypeScript frontend standard, loaded before editing Angular code.
- ft-sddWrites a design document for people. A rule of
main-rules.mdsends this work here.It writes one Software Design Description as a Word file in the approved Friendly template, and it publishes the document as an artifact of real text, with.docxand PDF downloads. TheAudience:line of the brief picks the variant:overviewfor QA and product managers, which is the default, ortechnicalfor developers and architects. Facts come only from code, run journals and vault notes, and each claim is checked in code or tagged unverified. It is read-only on the repository. It is not for Antora product docs, the working SDD offt-developer, a letter or a deck.Skillsfriendly-branded-docsBuilds Word documents, letters and decks from the approved Friendly templates, then checks and renders them.technical-writingHouse style, banned constructions and sourcing.artifact-diagrammingLoaded when it writes a document.documentation-writerDiátaxis, when it writes a document.writing-design-docsDecision boxes and completeness checks, for the technical variant only.doc-coauthoringIts Refinement and Reader Testing stages only.
Coding leaves
- ft-java-coding-agentWrites Java code and its tests under its stack standard.It works on the Java and Spring Boot backends, such as
ft-acsandft-device-network-service, for every supported protocol. It detects the build and test commands and the conventions from the repository. It always delivers production code and its tests in the same pass.ft-developergives it a self-contained brief, orbugfix-agentdoes at its delegation threshold. When an orchestrator dispatched it,turn-guard.pysaves its final report under the run's units directory.Skillsft-java-standardsThe Java and Spring Boot backend standard: packages, naming, DI, immutable DTOs, logging, tests, the DB contract and security.
- ft-angular-coding-agentWrites Angular code and its tests under its stack standard.It works on the Angular and TypeScript frontends:
angular-ui, theoneiot-uifrontend and theft-commonlibrary. It detects the build and test commands and the conventions from the repository. It always delivers production code and its tests in the same pass.ft-developergives it a self-contained brief, orbugfix-agentdoes at its delegation threshold. When an orchestrator dispatched it,turn-guard.pysaves its final report under the run's units directory.Skillsft-angular-standardsThe Angular and TypeScript frontend standard: feature folders, naming, DI, RxJS and NgRx, logging, tests and security.emil-design-engFor motion.animateWhen building a new animation from scratch.apple-designFor gesture-driven work: drag, swipe, sheets, springs, momentum.animation-vocabularyWhen the motion language of the brief is vague.review-animationsRun over any motion diff before reporting.impeccableWhen the brief names them, the Refine passes on its own diff:hardenfor edge states,polishas the final pass.
- ft-python-coding-agentWrites Python code and its tests under its stack standard.It works on the internal tooling estate,
ft-internal-tools, and on the agent platform,ft-agent-platform-local. It detects the build, test and lint commands and the shape of the repository. It always delivers production code and its tests in the same pass.ft-developergives it a self-contained brief, orbugfix-agentdoes at its delegation threshold. When an orchestrator dispatched it,turn-guard.pysaves its final report under the run's units directory.Skillsft-python-standardsThe Python standard: ruff, mypy and uv, layout, types, logging, pytest, Flask surfaces and security.
- ft-coding-agentWrites code for every other stack and infers the conventions from the repository.It handles the stacks with no dedicated agent, such as Go, Rust, Node and TypeScript, shell tooling and mixed repositories. It follows the neighbouring code, not an authoritative standard, and it declares that absence in every report. A brief that routes Java, Angular or Python work to it gets
BLOCKED, with the name of the correct agent. It always delivers production code and its tests in the same pass. When an orchestrator dispatched it,turn-guard.pysaves its final report under the run's units directory.Skillsemil-design-engFor motion.animateWhen building a new animation from scratch.apple-designFor gesture-driven work: drag, swipe, sheets, springs, momentum.animation-vocabularyWhen the motion language of the brief is vague.review-animationsRun over any motion diff before reporting.impeccableWhen the brief names them, the Refine passes on its own diff:hardenfor edge states,polishas the final pass.
Docs leaf
- ft-doc-writer-agentWrites the documentation of a change.
tr-doc-writeronly redirects to it.It writes and updates AsciiDoc for the Antora portal of any Friendly Technologies product, and it detects the docs root, the product and the protocol scope. It is the only AI agent that writes documentation, and it hands no page, section, diagram or final edit to another agent. Other agents may give it verified facts.ft-developerinvokes it.Skillstechnical-writingHouse style, banned constructions and the sourcing rule.documentation-writerDiátaxis: each page, or each section of a mixed page, is one mode.doc-coauthoringIts Reader Testing stage only.writing-design-docsDecision boxes and completeness checks, only for an architecture or design page.ft-guide-pageWrites a designed Antora guide page from a ready kit of scenes, and holds the choice between a guide page and a plain page.
Reviewers
- verifierRefutes a plan or a diff, one lens per dispatch. Economy prices a reviewer and never removes one.It gathers its evidence from scratch and returns
SOUND,REFUTED,NEEDS_EVIDENCEorNEEDS_HUMAN. It reviews a fix plan at bugfix checkpoint 1, a design at feature checkpoint D and a final diff at checkpoints 2 and F. It is read-only outside a dedicated worktree, and only the executor role runs tests, inside its own worktree. The Visual/UX lens drives the running product in a browser on a user-visible diff.Skillsreview-animationsOn the Visual/UX lens, run over the flow when installed.
- ft-test-adversaryAttacks the delivered tests before the diff checkpoint.After the fix author reports green, it tries to prove that the delivered tests are not enough. It checks the honest-RED evidence, negative assertions, regression guards, seam composition, emulator leniency and whether the tests actually ran. It is read-only on production code and runs nothing itself: it audits the execution evidence. It returns the missing or weak tests as precise briefs, and the orchestrator sends them to the fix author.
- ft-architecture-auditAudits a diff against the written standard, as a checklist.It is read-only and works on any Friendly Technologies repository. It detects the stack and loads the matching standard. It checks boundaries, naming, DI, DTO immutability, structured logging, tests, the DB contract and protocol-spec conformance, and it reports each violation with its
file:line. Use it before a merge, in a code review or on demand. It complements the bundled/code-reviewand does not replace it.Skillsft-java-standardsThe Java and Spring Boot backend standard: packages, naming, DI, immutable DTOs, logging, tests, the DB contract and security.ft-angular-standardsThe Angular and TypeScript frontend standard: feature folders, naming, DI, RxJS and NgRx, logging, tests and security.ft-python-standardsThe Python standard: ruff, mypy and uv, layout, types, logging, pytest, Flask surfaces and security.
SessionStart
- main-rules.pyGives the main loop the text of
main-rules.mdas session context. It never blocks, and sub-agents do not pay for these rules.It fires onstartup,resume,clearandcompact, so the rules come back after a compact. It also adds~/.claude/main-rules.local.mdwhen that file exists.CLAUDE.mdreaches every agent on every turn, and session-start context reaches the main thread only. A missing file gives no context, and the session starts. A separatePostToolUseentry with one command records the session's recurring cron jobs, so a resume can list the lost ones.
UserPromptSubmit
PreToolUseAgent|Task|SendMessage
- price-gate.pyRefuses a dispatch that is not priced. It runs all its checks and lists every failure in one text, with lines to paste.It checks the model, the effort, the lane cap, the unit size, the route rules and the context-reset lines. The pricing checks apply when
ft-developerorbugfix-agentsends the dispatch, and the lane cap andmajor_routeapply to the main loop. ASendMessageto a leaf that holds more than 200K tokens of context is denied with the recipe for a fresh dispatch. An unpriced dispatch is paid for before anyone can object. If it blocks you, read the text: it names the rule, so add the missing lines or take the named route. - refresh-gate.pySkips a refresh dispatch whose declared inputs did not change. It runs on
PreToolUseand onPostToolUse.A refresh brief lists its inputs in aRefresh-inputs:line. The hook fingerprints them onPreToolUseand records the fingerprint onPostToolUse, only when the launch succeeded. An unchanged refresh is denied with the time of the last one. A refresh brief with no inputs is denied once for each key. If it blocks you, addRefresh-inputs:, or addRefresh: force. It fails open on every other path. - delegation-gate.pyWould check the structure of a brief before the dispatch. Not installed, by the owner's ruling of 2026-11-03.Its rules R1 to R10 require
Context:,DoD:andBounds:lines, a stated budget, an artifact reference and, for an implementer, awrites:set. They also deny a pasted transcript, a pasted diff and a repeat dispatch over an unchanged tree. It judges structure, not content. One denial lists every violation: fix them in one pass, or record--override "<reason>"for one dispatch. As shipped it denies about half of real dispatches, anddeploy/evals/delegation-gate.mdstates why it stays off. To use it anyway, copy it andbrief-schema.jsonto~/.claude/hooks/and add thePreToolUseentry yourself.
PreToolUseBash
- checkout-guard.pyDenies Maven and git writes of a sub-agent in a guarded checkout, a
pgrep -fwait loop with no deadline, a bare timer wait, andgit stash. It also notes to a sub-agent that itsMonitorevents wake its parent.The checkout check applies to a sub-agent only, and the other denials apply to every agent and to the main loop. A command that only waits on a timer, such assleep 240, is denied because the wait ends whether or not the awaited event happened. A loop that checks a job passes. The Bash working directory resets to your main checkout after every call, all linked worktrees share the stash stack, and two shells that wait on one pattern never end. If it blocks you, work in a worktree under.claude/worktrees/and give the wait loop a deadline. In place ofgit stash, use a worktree on the base commit, a commit orgit rebase --autostash, or a WIP commit.FT_PGREP_WAIT=0turns off the loop denial, andFT_TIMER_WAIT=0turns off the timer denial. A sub-agent on the 1-hour prompt cache is also denied a second foreground wait loop of 60 seconds or more within 15 minutes of its last one, a wait that brings its foreground waits in that window to 60 seconds or more, and an identical wait command within 5 seconds. The denial gives the background form.FT_FG_WAIT_GUARD=0turns that denial off. Arun_in_backgroundwait loop with no deadline is denied to every agent and the main loop.FT_BG_WAIT_GUARD=0turns that denial off. The sameuntilorwhileloop in the foreground is denied too, because the harness moves it to the background at its timeout.FT_FG_DEADLINE_GUARD=0turns that denial off. Arun_in_backgroundcommand whosecat,tee,reador similar reader has no input is denied with the command closed on</dev/null.FT_BG_STDIN_GUARD=0turns that denial off. Each wait denial ends with the wait card of four forms. For the main loop only, it also notes the thirdgit,gh,sshorscpcall within 10 minutes above about 200K of context, and it points to oneft-opsagent.FT_MAIN_OPS_NUDGE=0turns that note off. - heredoc-guard.pyDenies an unquoted heredoc whose text holds backticks. Bash runs the backticks.A backticked command can destroy files: one journal append ran
git clean -fdxqin the main checkout. If it blocks you, quote the delimiter, as in<<'EOF', and send the call again. - encoded-exec-guard.pyDenies a decoded payload that runs in an interpreter, such as
echo X | base64 -d | bash, locally or inside an ssh command.The permission reviewer cannot read what an encoded command runs. If it blocks you, send the plain script: copy the file with scp or rsync, or pass it as a quoted heredoc. Decoding to a file or to stdout stays allowed. - git-safety-check.shBlocks push, a pull request,
--no-verifyand history rewrites. It runs from the frontmatter of four agents.It also blocks a blanketgit add,git reset --hard,git clean -fandpush --force, and it holds with-C <dir>or-c <k=v>before the subcommand. The four agents arebugfix-agent,refactor-agent,ft-fix-hostandft-ops. A plain push of the vault passes, because the vault canon requires it. The agentft-opshas two narrow exceptions: a preview push and, with--allow-work-push, a push of one commit to a work branch,gh pr createwith--head, andgh run rerun. Protected branches, force, delete and chaining stay refused. The rules of no push, no pull request and no history rewrite need a check in code, not only in a prompt. An agent cannot satisfy this hook: do the operation yourself, with your consent, outside the agent's Bash call.
PreToolUseBash|Read
- graph-search-augment.pyNever blocks. Adds the code graph's context to a code search or a whole-file read.It adds the context to a shell code search, and the map of the file to a whole-file read of a code file. It needs
~/.local/bin/codebase-memory-mcp. A whole-file read costs about 13.6 KB, and the graph's map costs under 1 KB. There is nothing to satisfy: read a line range after the map.
PreToolUsewrites, reads, Skill
- phase-gate.pyDenies an implementation write in the main loop until you record a route.Record the route with
python3 ~/.claude/hooks/phase-gate.py --route <route>.trivialallows three code edits once per session,otherallows none, andft-dev,ft-fixorft-refactorallows none until the pipeline is dispatched. Tests, docs and the scratchpad are not gated. Phases thatCLAUDE.mdonly declares mandatory do not run by themselves: seven such phases fired twice in 14 days. - reuse-gate.pyDenies once per moment until you answer the reuse check.It fires at two moments: when you leave plan mode, and when you create a new code file through
Writeor the shell. It skips tests, migrations, scratch and build trees. Searching costs minutes, and removing a written duplicate costs a refactor. Search the graph and the repository, state one line that starts withReuse:, and retry. - verify-gate.pyBlocks the end of a session that changed code with fewer than two different
verifierlenses. It fires onPreToolUseand onStop.It also blocks when code changed after the last lens, and it denies a code write while a design artifact is unverified. It blocks at most twice per session. A change reviewed only by its author is not reviewed. Dispatch two differentverifierlenses in parallel, one lens per invocation, and reportVerified (diff): <lens> <verdict>. After aREFUTEDverdict, fix it or record why it does not hold. - durability-gate.pyDenies once per path a durable-looking note written under the scratchpad or
/tmp.A note looks durable when it is a.mdfile, or another prose file whose name holds a word such asplan,handoff,specorfindings. The scratchpad does not survive a reboot. Write the note where it lives: the repository docs directory, the vault, the memory directory or the run journal. For a real throwaway, say so in one line and retry. - design-gate.pyDenies the first edit to a user-facing file until the session names the design owner. On
UserPromptSubmitit gives a hint.You can also say in one line that no design property applies. A prompt that names a design property gets the owner as a hint. Before this hook, nothing executed the routing table inrules/ux/design-skill-routing.md. If it blocks you, dispatch the owner skill from the table, or state which properties are in play and why none applies. - rules-loader.pyDenies a write once per item until the session has seen the rule modules that match the file.It covers the rule modules whose
paths:match the file, and the stack's standard skill. It names them with their sizes and does not paste them, because a.jsedit matches about 64 KB of modules. Read the modules you touch, dispatch the named standard skill, and retry. - context-guard.pyDenies once a full-page capture, a transcript read and a re-read of the same bytes.A new range or a changed file is not a re-read, and the re-read denials stop at 10 per session. Images and transcript reads fill the context: one session spent 52% of its context on images and ended early. Capture the viewport or an element, ask for a new range, or say in one line why you need the same bytes again.
The call
- the tool runsAn agent's call: a command, a dispatch or a message. When no hook denies it, the call runs. A denied call did not run.
PostToolUse
- artifact-registry.pyNever blocks. Records the link of each published artifact. As a command it lists and shows them.After a publish it appends one JSON line to
artifacts.jsonl, mode 0600, because the file holds share links. After an account switch an old link returns 404. The commandslist,showandbackfillthen give the arguments of a newArtifactcall. The script cannot callArtifact, and it cannot restore a local file that a reboot removed. - user-visible-gate.pyNever blocks. Adds a pointer to the user-visible Definition of Done after an edit that a person can read.It adds the pointer for up to three files per session. A file-type trigger misses a controller that writes a sentence, so the hook looks for text that reads like a sentence. Apply the Definition of Done that it points to.
SubagentStop
- ownership-check.pyFinds what a sub-agent left running. It denies a hand-back once that leaves live things unnamed, and at the stop it ends the unnamed wait commands. It refuses an
ft-fix-hosthand-back with no reviewer dispatch and noreviewers:line up to 3 times, and the same for anft-developerhand-back that claims delivery with no review of its own.It reads the agent's own transcript: background jobs, monitors, worktrees,agent-browsersessions, detached processes and child agents. A hand-back passes when the report names each live thing in alive: <kind> <id> · <what> · <next step>line. At the stop it sendsSIGTERMto an undeclared wait shell of the harness and to its direct children, and it writes a record. A wait command with#, a backtick,<<or a line continuation is not recognised as a wait, so declare it. It never blocks the stop. A floor refusal logsfloor=1, a pass under the floorfloor=open.FT_OWNERSHIP=0turns it off,FT_REVIEWER_FLOOR=0turns off only the floor, andFT_OWNERSHIP_KILL=0turns off only the kill. - turn-guard.pyBlocks once a turn end with nothing running, for four orchestrators. It also saves the final report of a coding leaf.It runs only for
ft-developer,bugfix-agent,refactor-agentandft-fix-host. The harness turns such a turn end into a forced hand-back, and the lane is lost. It lets the turn end when a child or one of the agent's own background commands is running, after its one block, and after the report. When a top-level lane ends for good, it stamps the session, andprice-gate.pytells the main loop to refill its lanes. If it blocks you, follow the instruction in the block.
Stop
- main-compact.pyNever blocks. At 300K tokens of the main loop it types
/compactinto the session's Terminal.app tab.It acts only whenTERM_PROGRAMisApple_Terminal, at most once per 600 s, and only after 30 s without keyboard or mouse input. It types nothing into a turn thatlane-nudge.pyblocked less than 60 s ago. No setting reaches the main loop alone, andautoCompactWindowstays at 600K for the sub-agents.FT_MAIN_COMPACT=0, or the filemain-compact-off, turns it off. - lane-nudge.pyBlocks the stop of the main loop once when fewer background agents run than its status line says. At most once an hour for each session.The main loop ends a turn with a status line such as
lanes 14/25. The hook counts the running background agents in the transcript, helpers included, and compares the count with the target. It stays silent after a hold such asbacklog empty, inside the one-hour gap, for sub-agents and on any error. The lane capFT_MAX_LANESis another number: it counts top-level orchestrators only and can deny the launch that the nudge asks for.FT_LANE_NUDGE=0turns it off. A second branch prints a health notice, at most once every 300 seconds, for lanes that areUNSEEN,ENDED,FROZENorFROZEN?, with at most 10 lines.FT_LANE_HEALTH=0turns that part off. - verify-gate.py
Through Bashcopied, not registered
- decide.pyAsks Jev and prints
DECIDED <option>orUNSURE <why>. It always exits 0.Each call stops after 8 seconds, and after one unreachable answer the script skips the remaining states of the command. It refuses a payload over 4000 characters (too-large) and the obvious secret shapes (secret-like). An enumerable choice costs less to ask than to deliberate. It never blocks: without the key it answersUNSURE, and the caller decides. - unit-check.pyThe orchestrator calls it after each unit. It compares the delivered size and the new files with the pick and journals the result.It prints the zone status, the diff size, the new files, the paths that look like a new surface and a
withinorover-boundverdict. With--journalit appends the one-line result. It is read-only on the repository. One command replaces three to five bookkeeping turns per unit. It never blocks: read the verdict line and decide onPLAN_INVALIDATED. - diff-router.pyClassifies the changed files and chooses the
verifierlenses. It never drops a core lens.It matches paths and diff lines against a rule table, not meaning. It writes a route manifest underroutes/, and the pipelines cite it asroute:<hash>. Exit 1 means that a conservative default fired every routed lens, exit 2 a refused override, and exit 3 no diff to route. It cannot make a lens run, and it does not check that the orchestrator obeyed the route. - evidence-store.pyStores evidence packs and recorded verdicts, and replays a verdict only for an identical key.A pack is addressed by a hash of its bytes, and a verdict by a key over contracts, diff, task, lens, role, pack and test state. It never replays a failed, partial or non-independent verdict. The script cannot record a verdict by itself, and no pipeline calls its
verdict recordtoday, so the store stays empty until someone runs the command. The replay reaches you only throughdelegation-gate.py, which is not installed, so nothing replays a verdict today.FT_EVIDENCE_CACHE=offturns off replay only. - lane-status.pyA command. Prints the running sub-agents of a session and how long each has been silent.It reads the newest session of the current project, or the one that
--sessionand--projectname. It counts with the code oflane-nudge.py, so its header shows the number that the nudge uses. ASTATEcolumn showsrun,wait,UNSEEN,ENDED,FROZENorFROZEN?, and--report <agent id>prints a report that never reached you. It is read-only, uses no network and exits with 2 when it finds no session. - janitor.pyA command. Finds merged worktrees, orphaned processes and dead waits that finished lanes left. Dry run by default.Only
--applychanges anything. It removes a worktree only when it is merged, clean, idle and owned by no live lane, and it never forces. It keeps a wait that its agent declared in the last 24 hours. Its pool mode runs from your machine only and needs~/.claude/mvn-slot.sh, which this repository does not ship. On Windows it keeps every worktree. - vault-note.pyA command. Writes a note into the team vault with its hub entry, commit and push.It refuses a bad argument, a missing section, Cyrillic text and a secret pattern, and a refusal writes nothing. It pulls before it writes, takes a lock, and pushes again once after a rejected push. The vault is
--vault, else$FT_VAULT_PATH. The exit codes are 0, 1, 2, 3, 4, 5 and 130. - session-audit.pyA command. Prints cost, mechanical errors, waits and vault work over the last transcripts.The default window is the last 3 days in UTC. It is read-only and offline, and its costs are notional list prices. With
--jsonit prints counts and never a description or raw text, because transcripts hold credentials. A bad date exits with 2.
Asks Jevwhere Jev is asked
- grade, Stage 1
ft-developerasksdecide.py --kind gradefirst.DECIDEDis the grade. AfterUNSUREit grades by itself, sourceself.The options arearchitecture-led,TDD-ledandsimple-addition. A simple-addition run that outgrows its budget still returnsPLAN_INVALIDATEDand is graded up. In the shadow runs, Jev's grade agreed with the agent on 35 of 38 questions. - tier, effort, split, slice
ft-developerorbugfix-agentmakes one call per planning step, for all units. The answer becomes thePick:line. AfterUNSUREthe source isself.The presets choose the model (haiku,sonnet,opus), the effort (low,medium,high),splitorkeep, andsliceorleaves. A pick with no question asked is a defect, andprice-gate.pyrefuses it. The only override raises the answer, by a cited signal, asoverride: <signal>. One question gets one answer: a reworded second ask is not allowed. AfterUNSUREon the effort, the asker usesmedium. - --ask, test adversaryThe test adversary leaves
opusonly on aDECIDEDanswer to a custom--ask.UNSUREkeepsopus.The question uses--ask "<question>"with one--optionper choice, and the output reports it under the kindcustom. ThePick:line needs the sourcejev, andprice-gate.pyrequires adecide.pycall in the dispatcher's transcript or a(recorded: <journal path>)note. - skill ft-decideA main-loop session or a dispatcher asks on any cost-only choice among options it can enumerate.
UNSUREmeans the asker decides.The worst case of a wrong pick must be cost or rework, never a skipped check. It is not for a person's decisions (approvals, requirements, permissions), not for anything that sets verification depth, except theft-developerStage 1 grade, and not for review verdicts. A call takes a median of 349 ms and costs about $0.000027, and it is not anchored on the reasoning already spent. One question gets one answer. - run + effort, the gate
price-gate.pyasks for a main-loop launch offt-developerpast approval, of abugfix-agentwith no MAJOR or CRITICAL, and ofrefactor-agent.UNSUREgivessonnetand the dispatch's own effort.Therunpreset choosessonnetoropus, and theeffortpreset chooses the effort, over a flags-only descriptor of the brief.ft-developergets one answer per journal, andbugfix-agentandrefactor-agentget one answer for the whole run. Each result goes totier-ab.jsonl. - recheck, the gate
price-gate.pyasks for a judgment-lensverifierre-check, not Security and not CRITICAL.UNSUREkeepsopus.Therecheckpreset choosessonnetoropusfor a lens that re-checks its own objections. The re-check runs onsonnetonly when Jev decidessonnet, andtier-ab.jsonllogs it with its objection IDs.
Jev
- Jev, over OpenRouterThe external decision model. It answers a cost-only choice with
DECIDED <option>orUNSURE <why>, and the pipeline never depends on it. It never decides verification depth, an approval or a verdict.Its default model istypesafe/jev-1.13, and the endpoint is fixed in the script. An answer under the confidence floor isUNSURE: the floor is 0.8, and 0.7 for the effort. The state, the question and the option criteria leave the machine, so pass facts only, and never code, credentials, hostnames or customer data. Jev is optional: without a key, the orchestrator decides every choice.
Installers
- install.sh, .ps1Both installers run
economy.pyright after the rules sync, and again with--check.The second run is the verification pass of every run and of--doctor(-Doctoron Windows).SKIP_ECONOMY=1leaves the step out, and out of the verification. The install commands and options are on the Deployment page. - economy.pyThe install step: it wires the hooks into
~/.claude. One implementation and two thin callers.It first removes the toolkit's own superseded-nextagents, entry skills and rules from~/.claude, and touches nothing else. It is idempotent: each item prints oneok,dry-run,MISSINGorWARNline. An unreadablesettings.jsonstops it with exit 2 and leavessettings.jsonandCLAUDE.mduntouched. It needs Python 3. Without Python 3 the step warns and is skipped.
~/.claude
- settings.jsonRegisters eleven hooks on their events, sets the concurrency and compact values, and allows
diff-router.py plan.It also setsCLAUDE_CODE_MAX_CONCURRENT_SUBAGENTSto 30,PONYTAIL_SUBAGENT_MATCHERto a pattern that matches no agent, andautoCompactWindowto 600000, and it keeps your own values. An entry that already runs the same hook stays as it is, except that aprice-gate.pytimeout under 15 s is raised, because a timed-out hook lets the dispatch through unpriced. It turns theclaude-memplugin off only on youryorASSUME_YES=1, and it never turns it back on. - CLAUDE.mdClaude Code delivers it to the main loop and to every agent on every turn. The installer writes one block between two markers.Each run replaces the text between the markers, and nothing outside them changes. Lines inside the markers that are not in the template give a
WARN, and the previous file is saved asCLAUDE.md.bak-<timestamp>. Put your own rules below the end marker.--checkreportsMISSINGwhen the block is absent or differs from the template. - main-rules.mdThe rules of the main loop alone. An optional
main-rules.local.mdis yours.The installer copies it fromdeploy/templates/claude-md/main-rules.mdand overwrites it when it differs from the toolkit copy. It never writesmain-rules.local.md.main-rules.pydelivers both at session start. The rules cover the routes for code work, the lanes, the hand-off of operational batches, auditing before fixing and the four command-line scripts.
~/.claude/rules/agents
- tiering.mdThe canon for model and effort per dispatch, escalation, unit size and who decides.
- context.mdThe orchestrator's own context: one sanctioned reset, and where knowledge is written.
- delegation-contract.mdThe shared contract of a brief: an evidence pack, a measurable DoD, a write scope and four bounds.A brief is an evidence pack: a goal, references and a declared budget, and never the parent transcript. The definition of done is an artifact at a path, a command with its outcome, or a
file:line. The brief's file list is the write boundary, and a needed edit outside it returnsSCOPE_BREACH. The bounds are rounds, agent-runs, turns and wall-clock minutes, and a receiver at a bound stops and returns what is proven. Any stop that is not a completed run writes a## HANDOFFblock to the run journal. - verification-routing.mdHolds the rosters and the mandatory core of the lenses. Economy never changes them.The core is
Correctness,SecurityandAPI-contract, orRequirements-coverage,SecurityandAPI-contractat checkpoint D. It is emitted unconditionally for each checkpoint.diff-router.py plan --drop-lenson a core lens exits 2, and no gate rule denies a core-lens dispatch. The port-lane profile is the one named exception forft-acs-qaport lanes. It keepsCorrectnessand is not a general relaxation. See the port-lane profile. Economy never removes the last independent reviewer.
Policy, beside the hooks
- brief-schema.jsonThe rules that
delegation-gate.pyreads.The installers do not copy it. To use the gate, copy this file anddelegation-gate.pyto~/.claude/hooks/, then add thePreToolUseentry yourself. - route-schema.jsonThe rules that
diff-router.pyreads. It refuses to route without this file.It holds the change classes, the path rules, the content rules and the map from risk to lens, so changing the policy means editing this file. Both installers copy it, and a missing source stops the install. - evidence-schema.jsonThe layout that
evidence-store.pyreads.
~/.local/state/ft-ai-toolkit
- tier-ab.jsonlEvery swap and A/B arm of
price-gate.py, with the dispatch's description and tool-use id. - decisions.jsonlEvery Jev question and answer of
decide.py.Each line holds the state, the options, the probabilities, the result, the confidence, the cost, the routed model and the latency. A refused payload is stored as<withheld: secret-like>or<withheld: too-large>.price-gate.pyadds atagwith the id of the dispatch. Read the log to tune the confidence floor. A failure to write the log never costs a decision. - turn-guard.logEvery orchestrator turn end that
turn-guard.pysaw, allowed or blocked. - lane-ended.jsonThe time a top-level lane ended for good.
price-gate.pyreads it to remind the main loop to refill its lanes. - main-ctx.jsonThe "already said" state of the main-loop context note of
price-gate.py. - bugfix-note.jsonThe "already said" state of the context note of
checkout-guard.py. - leaf-note.jsonThe "already said" state of the context note that
checkout-guard.pygives a coding leaf, one entry for each agent. - main-compact.jsonThe time of the last
/compactofmain-compact.py, per session. - main-compact-offThe file that turns
main-compact.pyoff. - lane-nudge.jsonThe time of the last nudge and the active hold for each session. The file
lane-nudge-offturns the hook off. - lane-nudge-block.jsonThe session and the time of the last block, written before the block prints.
main-compact.pyreads it. - artifacts.jsonlOne line for each published artifact, written by
artifact-registry.py. Mode 0600, because it holds share links. - run/The run journals and packs that the orchestrators write, and the saved reports of the coding leaves.
- routes/The route manifests of
diff-router.pyand their audit log. - evidence/The packs and verdicts of
evidence-store.py.
~/.config/ft-ai-toolkit
- openrouter.keyJev's key, which
decide.pyreads. The installer checks its presence and mode 600 only. Without it the answer isUNSURE.decide.pyreadsOPENROUTER_API_KEYfirst and this file second, andFT_DECIDE_KEY_FILEmoves the file. The key must be one that OpenRouter accepts for the decisions endpoint, with access to the model. Windows has no mode 600, so keep the file in your own profile folder there. The key never goes into a repository, a prompt, a brief, a note or a log. - guarded-checkoutsThe checkouts that
checkout-guard.pyguards, one per line. The installer never writes it.#starts a comment and~is expanded, andFT_GUARDED_CHECKOUTScan list more. The checked commands aremvn,mvnw,mvn-slot.shand the git writes, in the starting directory, after acdin the same command, or undergit -C. A worktree under.claude/worktrees/passes, and so does a path that the hook cannot resolve. With no checkout listed, this check allows every command. - vault-secret-valuesAn optional file of secrets, one per line, mode 0600, which
vault-note.pyrefuses to write into a note. The installer never writes it.The scan of shapes cannot tell a pair of ordinary words from a user name and a password, so this file lists the values. Never write an ordinary word into it: a value matches anywhere in the text. Without the file the scan checks shapes only, and the success line says so.
A solid border: installed, or called by the pipelines. A dashed border: shipped in the repository, and you install it by hand. Each line is a real connection.
A call denied and resent
- A coding agent calls
Bashwith a Maven command. Before the call runs, Claude Code matches the event and the matcher, and gives the call to the hooks. checkout-guard.pyreads the list of guarded checkouts. This command runs inside one.- The hook denies the call. The denial is born here. The agent receives the text of the hook, and the command did not run.
- The agent does what the text names. It starts the command with
cd /abs/worktree &&and sends it again. - A worktree under
.claude/worktrees/passes. The hook says nothing, and the call runs.
A dispatch and its hand-back
ft-developersends a coding agent. TheAgentcall goes toprice-gate.pyfirst.- The hook runs all its checks and does not stop at the first failure. One text lists every failure, with lines to paste. The spawn was not paid for.
ft-developeradds the lines and sends the dispatch again.- No failure, so the sub-agent starts.
- The leaf finishes and stops.
SubagentStoprunsturn-guard.py. turn-guard.pysaves the final report of the coding leaf under the run's units directory.- The hand-back: the final report of the sub-agent reaches its caller.
ft-developercallsunit-check.py, which compares the delivered size and the new files with the pick.unit-check.pyappends the result to the journal in the same command.
A turn end while waiting
- Without the guard: the agent ends a turn with plain text and nothing runs. The harness forces a hand-back, and the orchestrator hands back half done. The lane is lost.
- Without the guard the orchestrator restarts from its journal.
- With the guard: the same turn end goes to
turn-guard.pyfirst, onSubagentStop. - The guard logs the turn end.
- The guard blocks that one turn end, once, and tells the agent how to wait. The agent keeps its run.
- The agent starts one background command with a deadline (
run_in_background: true) and ends the turn. - The command completes, and its completion wakes the agent. The run continues.
A stop with fewer lanes than the target
- The main loop ends a turn with
lanes 5/25.Stoprunslane-nudge.py, which counts 3 running background agents in the transcript. - It reads its state. A nudge less than 1 hour ago, or a hold such as
backlog empty, keeps the hook silent. - Otherwise it writes the block marker first, then prints the block.
- It blocks the stop once, with fixed text. The text asks for the next backlog items, or for one line:
backlog empty. main-compact.pyruns on the sameStop, reads the marker and types no/compactinto the continued turn.- The main loop runs
lane-status.pyto see the same count and the agents that are silent. - The main loop starts a lane.
price-gate.pycan still deny it at the lane cap, which counts top-level orchestrators only.
Asking Jev
ft-developerhas its unit table. It makes one call for all units:decide.py --kind tier,effort,split.decide.pyrefuses a secret-like or too large payload. Only facts about the choice leave the machine.- It reads the key. Without a key the answer is
UNSURE no-key, and the pipeline runs on. - It sends the state to Jev.
- Jev answers
DECIDED sonnet (0.93), orUNSUREwhen it cannot separate the options. decide.pylogs the question and the answer.- A confident answer becomes
Pick: sonnet/mediumwith sourcejev. AfterUNSUREthe orchestrator decides by the tables, sourceself. - The dispatch carries the line. The gate checks that it is valid, equals the call and follows a real
decide.pycall. - Allowed. A
selfpick ofopus, or a Jevopusunder 0.9, runs onsonnet.
A checkpoint review
diff-router.py planclassifies the changed files and chooses the lenses, with a cited reason for each.- It writes a route manifest. The pipeline cites it as
route:<hash>. The mandatory core is always in it, except under the one named port-lane profile. - Each lens goes out as its own dispatch. A judgment lens on a cheaper model is denied.
- The gate allows the lens. It prices a reviewer and never removes one.
- The lens hands back its verdict to the orchestrator.
How the parts connect
- The main loop launches an orchestrator, and the orchestrator hands back to it. A hand-back is the final report of a sub-agent to its caller.
- The main loop sends one
ft-ops, oneft-ui-ux-designor oneft-sdd. - For a purely mechanical edit the main loop sends the stack's coding agent.
- An orchestrator sends a coding leaf, and the leaf hands back its report.
- An orchestrator sends a presentation unit to
ft-ui-ux-design. - The host sends
bugfix-agent, with the linePipeline: ft-fix. - An orchestrator sends the
verifierlenses of a checkpoint and reads their verdicts. - An orchestrator sends the test adversary before the diff checkpoint.
ft-developersends the checklist audit.- An orchestrator delegates the docs of a change.
- Every
Agent,TaskorSendMessagecall goes throughprice-gate.py. A denial goes back to the sender as one text. An allowed dispatch starts the sub-agent. - If you installed it,
delegation-gate.pyreads everyAgentorTaskbrief. - Every
Bashcall of every agent goes through these three hooks. The agent receives a denial as text. - These four agents declare
git-safety-check.shin their frontmatter. - If you installed it,
graph-search-augment.pyadds context to a code search or a whole-file read. - If you installed it,
user-visible-gate.pyadds its pointer after an edit. - If you installed them, these seven hooks read the calls of the main loop and ignore a call from a sub-agent.
- A
Bashcall that no hook denies runs. - An agent calls a tool. The completion of a background command wakes the agent that started it.
turn-guard.pyreads the turn end of these four orchestrators and blocks a bare one once, with the instruction to follow.- When a coding leaf stops,
turn-guard.pysaves its final report. turn-guard.pysaves the final report of a coding leaf under the run's units directory.turn-guard.pylogs every orchestrator turn end it saw.turn-guard.pystamps the time a top-level lane ended for good.price-gate.pyreads the stamp and tells the main loop at its next dispatch to refill its lanes.price-gate.pyloadsturn-guard.pyto count the running lanes for the lane cap.price-gate.pylogs every swap and A/B arm.price-gate.pykeeps the "already said" state of its main-loop context note.checkout-guard.pyreads the list of guarded checkouts.checkout-guard.pykeeps the "already said" state of its context note to abugfix-agent.checkout-guard.pykeeps the "already said" state of its context note to a coding leaf.main-compact.pytypes/compactinto the Terminal.app tab of the main loop.main-compact.pyrecords its last/compactand stops when the off file exists.lane-nudge.pyreads the turn end of the main loop onStopand blocks it once when fewer agents run than the target.lane-nudge.pyrecords its last nudge and any hold, and writes the block marker before it prints the block.main-compact.pyreads the marker and types nothing for 60 seconds after a block.- The nudge asks the main loop to start lanes, and
price-gate.pycan deny a launch at the lane cap. lane-status.pyimports the counting code oflane-nudge.py, so both show the same count.- The main loop runs these five commands through
Bash, andmain-rules.mdnames them. - Through the skill
obsidian-knowledge-vault, these agents write a vault note with one call. vault-note.pyreads the optional file of secret values and refuses a note that holds one.- After the
Artifacttool publishes,artifact-registry.pyrecords the link onPostToolUse. artifact-registry.pyappends one line for each published artifact.main-rules.pygives its text to the main thread only, at session start.main-rules.pyreadsmain-rules.mdand, when present,main-rules.local.md.settings.jsonregisters these twelve hooks on their events.- Both installers call
economy.py. economy.pyand the installers copy these hooks to~/.claude/hooks/. The hooks with a dashed border stay in the repository.economy.pywrites the settings entries, theCLAUDE.mdblock andmain-rules.md.economy.pychecks only that the key file exists with mode 600.CLAUDE.mdreaches every agent on every turn.ft-developerandbugfix-agentwork by these four rule files.ft-fix-hostprices its lenses bytiering.mdand waits bycontext.md.- These agents follow
delegation-contract.md. ft-developerasks for the grade at Stage 1.- The two dispatchers that
price-gate.pyprices ask per planning step. - The sender of the test adversary asks before it sends a cheaper model.
- The skill names main-loop sessions and the dispatchers as its users.
price-gate.pyasks Jev itself, throughdecide.pyloaded in-process.- Every question goes through
decide.py. - The answer becomes the
Pick:line.price-gate.pychecks that the line is valid, equals the call and follows a realdecide.pycall. decide.pysends the state to Jev and gets back a decision, orUNSURE, in which case the asker decides.decide.pylogs every question and answer.decide.pyreads the key.- The orchestrator calls
unit-check.pyafter each unit. unit-check.pyappends its result line to the journal.- The pipelines call
diff-router.py planat a checkpoint. diff-router.pyreadsroute-schema.jsonand writes a route manifest.- If you installed it,
delegation-gate.pyreadsbrief-schema.json, replays a verdict fromevidence-store.pyand checks a cited route. evidence-store.pyreads its schema and writes packs and verdicts.- The orchestrators write their run journals and packs.
A hook denied your call
Open the lookup and find the first words of the denial text. They name the hook and the next step.
The text starts with the name of the hook. Read the whole text, do what it names, then send the call again. A dispatch that price-gate denies was not paid for.
The lookup: every denial text, by its first words
| The text starts with | Hook | When it fires | What to do |
|---|---|---|---|
price-gate (tiering.md §1, §1a, §3, §5): | price-gate.py | A dispatch breaks a pricing, route or lane rule. A lane is one running top-level orchestrator. | Read every item. Add the lines that the text prints under "Add these", or take the route that it names. Send the dispatch again. |
price-gate (tiering.md §2): | price-gate.py | You continue a leaf sub-agent with a message, and it holds more than about 200K tokens of context. | Do not continue it. Dispatch a fresh agent of the same kind with only the delta, as the text says. The message was not sent. |
checkout-guard: a Maven run in or checkout-guard: `git …` in | checkout-guard.py | A sub-agent runs Maven or a git write inside a checkout that is listed in ~/.config/ft-ai-toolkit/guarded-checkouts. | Start the command with cd /abs/worktree &&, or use git -C <worktree>. If the brief names no worktree, stop and ask for one. |
checkout-guard: a wait loop on `pgrep -f` | checkout-guard.py | Any agent, or the main loop, waits in a loop on pgrep -f with no deadline. | Give the wait a deadline. The text prints the idiom. Run a wait over about 4 minutes in the background. |
checkout-guard: a wait on a timer with no condition | checkout-guard.py | Any agent, or the main loop, runs a command whose only purpose is to wait on a timer, such as sleep 240. | Wait on the job: its process id, a done marker or a log line, with a deadline. If a child or a background command of yours runs, end the turn. |
lane-nudge: your last status line says lanes | lane-nudge.py | The main loop ends a turn while fewer background agents run than the target of its status line. It fires once an hour at most. | Start the next backlog items. If you cannot, say in one line backlog empty or backlog waits on <event or owner decision>. |
checkout-guard: `git stash` is forbidden | checkout-guard.py | Any agent, or the main loop, runs git stash in any form but list and show. | Use one of the replacements in the text: a worktree on the base commit, a commit or git rebase --autostash, or a WIP commit. |
heredoc-guard: blocked an UNQUOTED heredoc | heredoc-guard.py | A shell command has a heredoc with backticks in it and an unquoted delimiter. | Quote the delimiter: <<'EOF'. Without the quotes, bash runs the backticks. |
encoded-exec-guard: blocked | encoded-exec-guard.py | A shell command pipes or substitutes decoded output (base64 -d, openssl base64 -d, xxd -r) into an interpreter such as bash, python or eval. | Send the plain script: scp or rsync the file, or use a quoted heredoc. Decoding to a file is allowed. |
git-safety hook: blocked a push | git-safety-check.sh | An agent runs push, a pull request, --no-verify, a blanket git add, reset --hard or clean -f. The agents bugfix-agent, refactor-agent, ft-fix-host and ft-ops declare it. | The agent cannot satisfy it. Do the operation yourself, with your consent, outside the agent's Bash call. |
turn-guard: | turn-guard.py | An orchestrator ends a turn with nothing running. See the turn end. | Follow the instruction in the text. Wait in the background with a deadline, act on a report that has arrived, or deliver the report. |
Delegation contract: | delegation-gate.py | You installed this hook by hand, and a brief breaks one of its rules. | Fix every item that the text lists, in one pass. For one deliberate exception, run the --override command that the text prints. |
Phase gate:, Reuse gate:, Verification gate:, Durability gate:, Context guard:, Design gate:, Canon governs or Rule modules also govern | The optional hooks of the hook catalogue | You installed the hook by hand. It has install code c: no installer registers it. | The text says what to do. The catalogue lists the reason and the step for each hook. |
Two real denials
The first terminal shows a dispatch that a coding sub-agent would receive from ft-developer with a bare brief. The hook lists every missing item in one text. The second terminal shows a push from an agent.
price-gate.py on a made-up dispatch of ft-java-coding-agent from ft-developer. The hook returns the text as a deny reason. In the Pick: line, jev, self and override name who chose the model. Jev is the decision model on Decision model (Jev).git push origin main
git-safety hook: blocked a push / PR / history-rewrite / blanket-add / --no-verify operation (FT agent canon). If genuinely needed, do it explicitly with the user's consent — not from an agent Bash call.
git-safety-check.sh on this command. The hook exits with code 2 and writes the text to stderr.What a hook can do to a call
A hook answers each call in one of four ways. Most calls get the fourth.
Deny it
The call does not run. The agent receives the text of the hook. At the end of a turn the same step is a block.Add a note
The call runs. The hook adds text to the context of the agent.price-gate.pydoes this when the context is large, when a coding brief has noTouch:line, and when a lane has stopped.Change it
price-gate.pycan allow a dispatch and run it on another model. Its text then readsprice-gate (<check>): this dispatch runs on <model>/<effort>.Say nothing
The hook has no rule for this call. The call runs as if the hook did not exist.
When a hook has an internal error, it exits without a decision and denies nothing. A price-gate.py that runs out of time also lets the dispatch through unpriced. For this reason the installer sets its timeout to 15 seconds and raises a lower value.
How a hook says deny
A PreToolUse hook has two forms. price-gate.py and checkout-guard.py print JSON with permissionDecision: deny and a permissionDecisionReason, and exit with code 0. heredoc-guard.py, encoded-exec-guard.py and git-safety-check.sh exit with code 2 and write the text to stderr. A SubagentStop hook such as turn-guard.py prints JSON with decision: block and a reason. The agent reads the text in every form.
The event, the matcher and the timeout of each installed hook are in Hooks at a glance. The full list of 26 scripts is in the Hook catalogue.
One dispatch, one text
A dispatch is a call of the Agent tool. price-gate.py runs every check and lists every failure in one denial.
- 1
Send
The main loop or an orchestrator sends the dispatch. The sender decides which checks apply.
Sender - 2
Check
Automaticprice-gate.pyruns all its checks. It does not stop at the first failure. - 3
Deny or pass
One failure or more: one text lists them all, with lines to paste. No failure: the sub-agent starts.
Automatic
Price
Whenft-developerorbugfix-agentsends a coding agent,ft-ui-ux-designor a reviewer, the call needs a model and an effort. A coding brief also needs theSize:,Raise:andPick:lines. ASize:line over 500 lines or 12 files is denied, unless it saysatomic.Route and lane
When the main loop sends the dispatch, a MAJOR or CRITICAL bug must go through/ft-fix. A new orchestrator is denied while 6 are running. The routes list the other refusals.Review role
A judgment lens or the test adversary on a cheaper model is denied, exceptfablein a session the owner granted. The text printsmodel: opusandeffort: highfor you to paste.Brief shape
Nothing checks it today. The hookdelegation-gate.pywould, and it is not installed, by the owner's ruling of 2026-11-03. Brief gates lists its rules.
The rosters, the mandatory core and the gates stay in verification-routing.md and in the pipelines. Economy prices a reviewer and never removes one, except under the one named port-lane profile. The lane cap is a setting: FT_MAX_LANES sets it, and the default is 6.
When an agent ends its turn while it waits
turn-guard.py blocks that one turn end, once, and says what to do instead.
The lane is lost
A hand-back is the final report of a sub-agent to its caller. A background sub-agent ends a turn with plain text. No child agent and no own background command runs. The harness forces a hand-back, and the orchestrator hands back half done. It restarts from its journal.
The run continues
The guard blocks the turn end and tells the agent how to wait. The agent keeps its run. The guard runs only for ft-developer, bugfix-agent, refactor-agent and ft-fix-host.
Blocked onceThe agent waits in the wrong way
- A child agent went idle, an armed
Monitoris the only wait, or the turn ended on words such as "waiting". - Wait with one background command that has a deadline, and end the turn. Its completion wakes you. If the work is done, deliver the report.
turn-guard.py on a made-up stop event of ft-developer with the last message "Waiting for the CI run to finish."The three situations, the cases in which the guard lets the turn end, and the log are in The turn guard.
Which route a kind of work takes
The main loop is the Claude Code session in which you talk to the orchestrators. It decides and approves but does not do the work.
A lane is one running top-level orchestrator. The main loop routes by kind of work.
| Work | Goes to | Refused instead, and by what |
|---|---|---|
| A feature, a parity or config change with a design in it | ft-developer (/ft-dev): stages, checkpoint D, the approval gate, units, checkpoint F | None |
| A MAJOR or CRITICAL bug | /ft-fix, hosted by ONE ft-fix-host when the main loop keeps its context small | A bare bugfix-agent (price-gate.py, major_route). A general-purpose host (price-gate.py, host_route). |
| A MINOR bug, or a small change with no design choice in it | bugfix-agent with MINOR in the brief, or the stack's coding agent for a purely mechanical edit. A small addition that follows an existing pattern goes to /ft-dev as simple-addition: see Quality Pipelines, Choosing the entry point. | None |
| A behaviour-preserving cleanup | refactor-agent (/ft-refactor) | None |
| UI/UX work on an existing screen with no new data or logic | ONE ft-ui-ux-design. Mode: review is a critique. Mode: design is a design. Mode: change is a build of one unit within the size cap, which price-gate.py checks. A larger build, a redesign, and a UI change with new data or a new flow go to /ft-dev with the approved UX spec (evidence §73). | None |
| An operational batch: merges, PRs, CI, releases, pool, demo | ONE ft-ops | price-gate.py refuses a general-purpose ops batch, or a rebase sent as a MINOR bug (ops_route). It refuses ft-ops on opus (ops_opus). It refuses a bugfix or coding lane that merges 3+ branches (integ_batch). |
| A design document for people (a "What changed" for QA and product, or a Software Design Description) | ONE ft-sdd. Audience: overview is the default. Mode: repair with the Artifact: URL fixes one (SDD for QA and Product (ft-sdd)). | A fork or a general-purpose writer (a rule of main-rules.md, not a hook) |
| A status page refresh, or read-only research | A general-purpose or Explore agent on sonnet | The same agent on opus without an Opus: line (price-gate.py, ops_opus) |
Below the orchestrators, the leaves write code and the reviewers refute it. The other pieces of the harness are in Routes of the reference. evidence §N cites section N of the file named in Evidence.
What the installer changes
The installers apply the harness in one step, and keep your own values.
Hook scripts
The step copies the scripts to~/.claude/hooks/. It overwrites a copy that differs from the toolkit copy.Hook entries
The step adds 8 entries to~/.claude/settings.json. It leaves alone an event that already runs the same script. It raises aprice-gate.pytimeout under 15 seconds.Settings values
The step setsautoCompactWindowto 600000 andCLAUDE_CODE_MAX_CONCURRENT_SUBAGENTSto 30 only when you have not set them.The CLAUDE.md block
The step replaces the text between two markers in~/.claude/CLAUDE.md. It touches nothing outside the markers.Agent cache
The agent sync sets a 1-hour prompt cache in the frontmatter of the orchestrators, the hosting and operations agents, the coding agents andft-sdd.The Jev key
The step checks that~/.config/ft-ai-toolkit/openrouter.keyexists with mode 600. It never reads, writes or prints the key.
The installer replaces the block between the markers on every run. If a line inside the markers is not in the template, it prints a WARN line and saves the old file as CLAUDE.md.bak-<timestamp>. Then it replaces the block.
Check the step, or leave it out
The install commands and options are on Deployment & Usage. On Windows use .\deploy\scripts\install.ps1 -Doctor for the first command.
deploy/scripts/install.sh --doctor
SKIP_ECONOMY=1 deploy/scripts/install.sh
The first command verifies only. Its economy line reads "economy hooks, settings.json wiring, CLAUDE.md block". The second command installs everything except the economy step, and leaves it out of the verification too. The step needs Python 3. Without it the step warns and is skipped. The exact file list, the settings entries and the markers are in What the installer changes.
Questions about denials
The questions that readers ask after the first denial.
Can I skip a denial?
The text names the replacement. Use it. The git-safety hook cannot be satisfied by an agent: do the operation yourself. If you registered delegation-gate.py by hand, you can record one exception with --override "<reason>".
Why did a call go through that I expected to be denied?
Every hook fails open. The optional hooks of the catalogue are not installed. The checkout check of checkout-guard.py sees only a sub-agent, and only in a checkout that you list in ~/.config/ft-ai-toolkit/guarded-checkouts.
Why is the main loop denied and a sub-agent not, or the reverse?
The lane cap and the MAJOR route rule apply to the main loop. The pricing checks apply to dispatches from ft-developer and bugfix-agent. Seven optional hooks ignore a call from a sub-agent. The stash and wait-loop checks apply to everyone.
Does the installer overwrite my settings?
No, with three exceptions. It replaces the block between the CLAUDE.md markers. It raises a price-gate.py timeout under 15 seconds. It disables the plugin claude-mem@thedotmack only after your y, or ASSUME_YES=1.
Where is a hook that I cannot find in settings.json?
The hook git-safety-check.sh runs from the frontmatter of four agents. The hooks decide.py, unit-check.py, diff-router.py and evidence-store.py are copied but not registered. The pipelines call them through Bash. So are the commands lane-status.py, vault-note.py, session-audit.py and janitor.py, which you or the main loop run.
Related pages
The tables, the model rules and the pipelines live on their own pages.