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.

Skip the map

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 one ft-ui-ux-design, and a design document for people goes to one ft-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 one ft-ops and keeps the approvals and design choices. It runs five command-line scripts through Bash: lane-status.py, vault-note.py, artifact-registry.py, session-audit.py and janitor.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-fix or bugfix-agent, and a behaviour-preserving cleanup goes to refactor-agent. When you launch it yourself, end the prompt with Resets: handled, and relaunch a fresh one on CONTEXT_RESET.
    Skills
    • obsidian-knowledge-vault Reads and writes the team's shared Obsidian vault: search at the start of a task, one note at the end.
    • cwmp-xml Writes, parses, validates and debugs CWMP XML, the TR-069 SOAP messages.
    • oma-lwm2m-expert OMA LwM2M protocol expert: data model, transports, security modes, bootstrap, FOTA and SOTA.
    • code-review Bundled. Invoked on the working-tree diff on the lightweight review path.
    • impeccable shape plans states, flows and edge cases at Stage 3. audit and critique run read-only at Stage 7.
    • find-animation-opportunities Read-only. Decides where a feature animates, and what must not, at Stage 3.
    • pick-ui-library Informs the choice before a new UI library is proposed to the user.
    • review-animations An 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, including CANNOT_REPRODUCE and EXTERNAL_GAP, sweeps for siblings and adds a guard against the bug class. A feature-sized change goes to ft-developer as SCOPE_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.
    Skills
    • ft-java-standards The Java and Spring Boot backend standard: packages, naming, DI, immutable DTOs, logging, tests, the DB contract and security.
    • ft-angular-standards The Angular and TypeScript frontend standard: feature folders, naming, DI, RxJS and NgRx, logging, tests and security.
    • ft-python-standards The Python standard: ruff, mypy and uv, layout, types, logging, pytest, Flask surfaces and security.
    • obsidian-knowledge-vault Reads 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 a file:line and 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 to ft-developer, and a bug goes to bugfix-agent.
    Skills
    • ft-java-standards The Java and Spring Boot backend standard: packages, naming, DI, immutable DTOs, logging, tests, the DB contract and security.
    • ft-angular-standards The Angular and TypeScript frontend standard: feature folders, naming, DI, RxJS and NgRx, logging, tests and security.
    • ft-python-standards The Python standard: ruff, mypy and uv, layout, types, logging, pytest, Flask surfaces and security.
    • improve-animations Read-only, when installed. Supplies the prioritized worklist when the area is UI motion.
    • impeccable distill and extract, when the area is UI complexity or duplication.
  • ft-fix-hostHosts ONE /ft-fix run for the main loop, on a 1-hour cache.Its first action is to invoke the skill ft-fix with 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 a general-purpose agent 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.
    Skills
    • ft-fix Quality-gated bug fixing through bugfix-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 sonnet and 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. design writes the UX spec and the visual direction for a new screen, a new flow, a restyle or a redesign. change edits the presentation of an existing UI inside the product's design system, with its component tests, and checks it in a browser. review critiques an existing screen read-only. Business logic, data and API changes go to the stack's coding agent, and the Visual/UX lens of verifier reviews its diff.
    Skills
    • impeccable States, accessibility, layout and copy: shape, critique, audit, harden, polish, distill.
    • emil-design-eng A property owner, loaded when its property is in play.
    • improve-animations A property owner, loaded when its property is in play.
    • find-animation-opportunities A property owner, loaded when its property is in play.
    • animate A property owner, loaded when its property is in play.
    • review-animations On any motion diff, before reporting.
    • animation-vocabulary Names the motion in the motion plan.
    • apple-design Gestures.
    • design-taste-frontend Direction. In an existing enterprise UI it runs only with --keep palette,type, or its app-screen run.
    • dataviz A property owner, loaded when its property is in play.
    • ft-angular-standards The Angular and TypeScript frontend standard, loaded before editing Angular code.
  • ft-sddWrites a design document for people. A rule of main-rules.md sends 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 .docx and PDF downloads. The Audience: line of the brief picks the variant: overview for QA and product managers, which is the default, or technical for 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 of ft-developer, a letter or a deck.
    Skills
    • friendly-branded-docs Builds Word documents, letters and decks from the approved Friendly templates, then checks and renders them.
    • technical-writing House style, banned constructions and sourcing.
    • artifact-diagramming Loaded when it writes a document.
    • documentation-writer Diátaxis, when it writes a document.
    • writing-design-docs Decision boxes and completeness checks, for the technical variant only.
    • doc-coauthoring Its 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-acs and ft-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-developer gives it a self-contained brief, or bugfix-agent does at its delegation threshold. When an orchestrator dispatched it, turn-guard.py saves its final report under the run's units directory.
    Skills
    • ft-java-standards The 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, the oneiot-ui frontend and the ft-common library. 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-developer gives it a self-contained brief, or bugfix-agent does at its delegation threshold. When an orchestrator dispatched it, turn-guard.py saves its final report under the run's units directory.
    Skills
    • ft-angular-standards The Angular and TypeScript frontend standard: feature folders, naming, DI, RxJS and NgRx, logging, tests and security.
    • emil-design-eng For motion.
    • animate When building a new animation from scratch.
    • apple-design For gesture-driven work: drag, swipe, sheets, springs, momentum.
    • animation-vocabulary When the motion language of the brief is vague.
    • review-animations Run over any motion diff before reporting.
    • impeccable When the brief names them, the Refine passes on its own diff: harden for edge states, polish as 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-developer gives it a self-contained brief, or bugfix-agent does at its delegation threshold. When an orchestrator dispatched it, turn-guard.py saves its final report under the run's units directory.
    Skills
    • ft-python-standards The 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.py saves its final report under the run's units directory.
    Skills
    • emil-design-eng For motion.
    • animate When building a new animation from scratch.
    • apple-design For gesture-driven work: drag, swipe, sheets, springs, momentum.
    • animation-vocabulary When the motion language of the brief is vague.
    • review-animations Run over any motion diff before reporting.
    • impeccable When the brief names them, the Refine passes on its own diff: harden for edge states, polish as the final pass.

Docs leaf

  • ft-doc-writer-agentWrites the documentation of a change. tr-doc-writer only 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-developer invokes it.
    Skills
    • technical-writing House style, banned constructions and the sourcing rule.
    • documentation-writer Diátaxis: each page, or each section of a mixed page, is one mode.
    • doc-coauthoring Its Reader Testing stage only.
    • writing-design-docs Decision boxes and completeness checks, only for an architecture or design page.
    • ft-guide-page Writes 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_EVIDENCE or NEEDS_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.
    Skills
    • review-animations On 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-review and does not replace it.
    Skills
    • ft-java-standards The Java and Spring Boot backend standard: packages, naming, DI, immutable DTOs, logging, tests, the DB contract and security.
    • ft-angular-standards The Angular and TypeScript frontend standard: feature folders, naming, DI, RxJS and NgRx, logging, tests and security.
    • ft-python-standards The 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.md as session context. It never blocks, and sub-agents do not pay for these rules.It fires on startup, resume, clear and compact, so the rules come back after a compact. It also adds ~/.claude/main-rules.local.md when that file exists. CLAUDE.md reaches 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 separate PostToolUse entry 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-developer or bugfix-agent sends the dispatch, and the lane cap and major_route apply to the main loop. A SendMessage to 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 PreToolUse and on PostToolUse.A refresh brief lists its inputs in a Refresh-inputs: line. The hook fingerprints them on PreToolUse and records the fingerprint on PostToolUse, 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, add Refresh-inputs:, or add Refresh: 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: and Bounds: lines, a stated budget, an artifact reference and, for an implementer, a writes: 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, and deploy/evals/delegation-gate.md states why it stays off. To use it anyway, copy it and brief-schema.json to ~/.claude/hooks/ and add the PreToolUse entry yourself.

PreToolUseBash

  • checkout-guard.pyDenies Maven and git writes of a sub-agent in a guarded checkout, a pgrep -f wait loop with no deadline, a bare timer wait, and git stash. It also notes to a sub-agent that its Monitor events 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 as sleep 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 of git stash, use a worktree on the base commit, a commit or git rebase --autostash, or a WIP commit. FT_PGREP_WAIT=0 turns off the loop denial, and FT_TIMER_WAIT=0 turns 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=0 turns that denial off. A run_in_background wait loop with no deadline is denied to every agent and the main loop. FT_BG_WAIT_GUARD=0 turns that denial off. The same until or while loop in the foreground is denied too, because the harness moves it to the background at its timeout. FT_FG_DEADLINE_GUARD=0 turns that denial off. A run_in_background command whose cat, tee, read or similar reader has no input is denied with the command closed on </dev/null. FT_BG_STDIN_GUARD=0 turns that denial off. Each wait denial ends with the wait card of four forms. For the main loop only, it also notes the third git, gh, ssh or scp call within 10 minutes above about 200K of context, and it points to one ft-ops agent. FT_MAIN_OPS_NUDGE=0 turns 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 -fdxq in 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-verify and history rewrites. It runs from the frontmatter of four agents.It also blocks a blanket git add, git reset --hard, git clean -f and push --force, and it holds with -C <dir> or -c <k=v> before the subcommand. The four agents are bugfix-agent, refactor-agent, ft-fix-host and ft-ops. A plain push of the vault passes, because the vault canon requires it. The agent ft-ops has two narrow exceptions: a preview push and, with --allow-work-push, a push of one commit to a work branch, gh pr create with --head, and gh 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>. trivial allows three code edits once per session, other allows none, and ft-dev, ft-fix or ft-refactor allows none until the pipeline is dispatched. Tests, docs and the scratchpad are not gated. Phases that CLAUDE.md only 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 Write or 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 with Reuse:, and retry.
  • verify-gate.pyBlocks the end of a session that changed code with fewer than two different verifier lenses. It fires on PreToolUse and on Stop.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 different verifier lenses in parallel, one lens per invocation, and report Verified (diff): <lens> <verdict>. After a REFUTED verdict, 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 .md file, or another prose file whose name holds a word such as plan, handoff, spec or findings. 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 UserPromptSubmit it 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 in rules/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 .js edit 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 commands list, show and backfill then give the arguments of a new Artifact call. The script cannot call Artifact, 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-host hand-back with no reviewer dispatch and no reviewers: line up to 3 times, and the same for an ft-developer hand-back that claims delivery with no review of its own.It reads the agent's own transcript: background jobs, monitors, worktrees, agent-browser sessions, detached processes and child agents. A hand-back passes when the report names each live thing in a live: <kind> <id> · <what> · <next step> line. At the stop it sends SIGTERM to 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 logs floor=1, a pass under the floor floor=open. FT_OWNERSHIP=0 turns it off, FT_REVIEWER_FLOOR=0 turns off only the floor, and FT_OWNERSHIP_KILL=0 turns 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-agent and ft-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, and price-gate.py tells 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 /compact into the session's Terminal.app tab.It acts only when TERM_PROGRAM is Apple_Terminal, at most once per 600 s, and only after 30 s without keyboard or mouse input. It types nothing into a turn that lane-nudge.py blocked less than 60 s ago. No setting reaches the main loop alone, and autoCompactWindow stays at 600K for the sub-agents. FT_MAIN_COMPACT=0, or the file main-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 as backlog empty, inside the one-hour gap, for sub-agents and on any error. The lane cap FT_MAX_LANES is another number: it counts top-level orchestrators only and can deny the launch that the nudge asks for. FT_LANE_NUDGE=0 turns it off. A second branch prints a health notice, at most once every 300 seconds, for lanes that are UNSEEN, ENDED, FROZEN or FROZEN?, with at most 10 lines. FT_LANE_HEALTH=0 turns that part off.
  • verify-gate.py

Through Bashcopied, not registered

  • decide.pyAsks Jev and prints DECIDED <option> or UNSURE <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 answers UNSURE, 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 within or over-bound verdict. With --journal it 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 on PLAN_INVALIDATED.
  • diff-router.pyClassifies the changed files and chooses the verifier lenses. It never drops a core lens.It matches paths and diff lines against a rule table, not meaning. It writes a route manifest under routes/, and the pipelines cite it as route:<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 record today, so the store stays empty until someone runs the command. The replay reaches you only through delegation-gate.py, which is not installed, so nothing replays a verdict today. FT_EVIDENCE_CACHE=off turns 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 --session and --project name. It counts with the code of lane-nudge.py, so its header shows the number that the nudge uses. A STATE column shows run, wait, UNSEEN, ENDED, FROZEN or FROZEN?, 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 --apply changes 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 --json it 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 1ft-developer asks decide.py --kind grade first. DECIDED is the grade. After UNSURE it grades by itself, source self.The options are architecture-led, TDD-led and simple-addition. A simple-addition run that outgrows its budget still returns PLAN_INVALIDATED and is graded up. In the shadow runs, Jev's grade agreed with the agent on 35 of 38 questions.
  • tier, effort, split, sliceft-developer or bugfix-agent makes one call per planning step, for all units. The answer becomes the Pick: line. After UNSURE the source is self.The presets choose the model (haiku, sonnet, opus), the effort (low, medium, high), split or keep, and slice or leaves. A pick with no question asked is a defect, and price-gate.py refuses it. The only override raises the answer, by a cited signal, as override: <signal>. One question gets one answer: a reworded second ask is not allowed. After UNSURE on the effort, the asker uses medium.
  • --ask, test adversaryThe test adversary leaves opus only on a DECIDED answer to a custom --ask. UNSURE keeps opus.The question uses --ask "<question>" with one --option per choice, and the output reports it under the kind custom. The Pick: line needs the source jev, and price-gate.py requires a decide.py call 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. UNSURE means 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 the ft-developer Stage 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 gateprice-gate.py asks for a main-loop launch of ft-developer past approval, of a bugfix-agent with no MAJOR or CRITICAL, and of refactor-agent. UNSURE gives sonnet and the dispatch's own effort.The run preset chooses sonnet or opus, and the effort preset chooses the effort, over a flags-only descriptor of the brief. ft-developer gets one answer per journal, and bugfix-agent and refactor-agent get one answer for the whole run. Each result goes to tier-ab.jsonl.
  • recheck, the gateprice-gate.py asks for a judgment-lens verifier re-check, not Security and not CRITICAL. UNSURE keeps opus.The recheck preset chooses sonnet or opus for a lens that re-checks its own objections. The re-check runs on sonnet only when Jev decides sonnet, and tier-ab.jsonl logs it with its objection IDs.

Jev

  • Jev, over OpenRouterThe external decision model. It answers a cost-only choice with DECIDED <option> or UNSURE <why>, and the pipeline never depends on it. It never decides verification depth, an approval or a verdict.Its default model is typesafe/jev-1.13, and the endpoint is fixed in the script. An answer under the confidence floor is UNSURE: 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.py right after the rules sync, and again with --check.The second run is the verification pass of every run and of --doctor (-Doctor on Windows). SKIP_ECONOMY=1 leaves 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 -next agents, entry skills and rules from ~/.claude, and touches nothing else. It is idempotent: each item prints one ok, dry-run, MISSING or WARN line. An unreadable settings.json stops it with exit 2 and leaves settings.json and CLAUDE.md untouched. 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 sets CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS to 30, PONYTAIL_SUBAGENT_MATCHER to a pattern that matches no agent, and autoCompactWindow to 600000, and it keeps your own values. An entry that already runs the same hook stays as it is, except that a price-gate.py timeout under 15 s is raised, because a timed-out hook lets the dispatch through unpriced. It turns the claude-mem plugin off only on your y or ASSUME_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 as CLAUDE.md.bak-<timestamp>. Put your own rules below the end marker. --check reports MISSING when the block is absent or differs from the template.
  • main-rules.mdThe rules of the main loop alone. An optional main-rules.local.md is yours.The installer copies it from deploy/templates/claude-md/main-rules.md and overwrites it when it differs from the toolkit copy. It never writes main-rules.local.md. main-rules.py delivers 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 returns SCOPE_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 ## HANDOFF block to the run journal.
  • verification-routing.mdHolds the rosters and the mandatory core of the lenses. Economy never changes them.The core is Correctness, Security and API-contract, or Requirements-coverage, Security and API-contract at checkpoint D. It is emitted unconditionally for each checkpoint. diff-router.py plan --drop-lens on a core lens exits 2, and no gate rule denies a core-lens dispatch. The port-lane profile is the one named exception for ft-acs-qa port lanes. It keeps Correctness and 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.py reads.The installers do not copy it. To use the gate, copy this file and delegation-gate.py to ~/.claude/hooks/, then add the PreToolUse entry yourself.
  • route-schema.jsonThe rules that diff-router.py reads. 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.py reads.

~/.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.py adds a tag with 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.py saw, allowed or blocked.
  • lane-ended.jsonThe time a top-level lane ended for good. price-gate.py reads 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.py gives a coding leaf, one entry for each agent.
  • main-compact.jsonThe time of the last /compact of main-compact.py, per session.
  • main-compact-offThe file that turns main-compact.py off.
  • lane-nudge.jsonThe time of the last nudge and the active hold for each session. The file lane-nudge-off turns the hook off.
  • lane-nudge-block.jsonThe session and the time of the last block, written before the block prints. main-compact.py reads 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.py and their audit log.
  • evidence/The packs and verdicts of evidence-store.py.

~/.config/ft-ai-toolkit

  • openrouter.keyJev's key, which decide.py reads. The installer checks its presence and mode 600 only. Without it the answer is UNSURE.decide.py reads OPENROUTER_API_KEY first and this file second, and FT_DECIDE_KEY_FILE moves 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.py guards, one per line. The installer never writes it.# starts a comment and ~ is expanded, and FT_GUARDED_CHECKOUTS can list more. The checked commands are mvn, mvnw, mvn-slot.sh and the git writes, in the starting directory, after a cd in the same command, or under git -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.py refuses 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

  1. A coding agent calls Bash with a Maven command. Before the call runs, Claude Code matches the event and the matcher, and gives the call to the hooks.
  2. checkout-guard.py reads the list of guarded checkouts. This command runs inside one.
  3. The hook denies the call. The denial is born here. The agent receives the text of the hook, and the command did not run.
  4. The agent does what the text names. It starts the command with cd /abs/worktree && and sends it again.
  5. A worktree under .claude/worktrees/ passes. The hook says nothing, and the call runs.

A dispatch and its hand-back

  1. ft-developer sends a coding agent. The Agent call goes to price-gate.py first.
  2. 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.
  3. ft-developer adds the lines and sends the dispatch again.
  4. No failure, so the sub-agent starts.
  5. The leaf finishes and stops. SubagentStop runs turn-guard.py.
  6. turn-guard.py saves the final report of the coding leaf under the run's units directory.
  7. The hand-back: the final report of the sub-agent reaches its caller.
  8. ft-developer calls unit-check.py, which compares the delivered size and the new files with the pick.
  9. unit-check.py appends the result to the journal in the same command.

A turn end while waiting

  1. 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.
  2. Without the guard the orchestrator restarts from its journal.
  3. With the guard: the same turn end goes to turn-guard.py first, on SubagentStop.
  4. The guard logs the turn end.
  5. The guard blocks that one turn end, once, and tells the agent how to wait. The agent keeps its run.
  6. The agent starts one background command with a deadline (run_in_background: true) and ends the turn.
  7. The command completes, and its completion wakes the agent. The run continues.

A stop with fewer lanes than the target

  1. The main loop ends a turn with lanes 5/25. Stop runs lane-nudge.py, which counts 3 running background agents in the transcript.
  2. It reads its state. A nudge less than 1 hour ago, or a hold such as backlog empty, keeps the hook silent.
  3. Otherwise it writes the block marker first, then prints the block.
  4. It blocks the stop once, with fixed text. The text asks for the next backlog items, or for one line: backlog empty.
  5. main-compact.py runs on the same Stop, reads the marker and types no /compact into the continued turn.
  6. The main loop runs lane-status.py to see the same count and the agents that are silent.
  7. The main loop starts a lane. price-gate.py can still deny it at the lane cap, which counts top-level orchestrators only.

Asking Jev

  1. ft-developer has its unit table. It makes one call for all units: decide.py --kind tier,effort,split.
  2. decide.py refuses a secret-like or too large payload. Only facts about the choice leave the machine.
  3. It reads the key. Without a key the answer is UNSURE no-key, and the pipeline runs on.
  4. It sends the state to Jev.
  5. Jev answers DECIDED sonnet (0.93), or UNSURE when it cannot separate the options.
  6. decide.py logs the question and the answer.
  7. A confident answer becomes Pick: sonnet/medium with source jev. After UNSURE the orchestrator decides by the tables, source self.
  8. The dispatch carries the line. The gate checks that it is valid, equals the call and follows a real decide.py call.
  9. Allowed. A self pick of opus, or a Jev opus under 0.9, runs on sonnet.

A checkpoint review

  1. diff-router.py plan classifies the changed files and chooses the lenses, with a cited reason for each.
  2. 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.
  3. Each lens goes out as its own dispatch. A judgment lens on a cheaper model is denied.
  4. The gate allows the lens. It prices a reviewer and never removes one.
  5. 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, one ft-ui-ux-design or one ft-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 line Pipeline: ft-fix.
  • An orchestrator sends the verifier lenses of a checkpoint and reads their verdicts.
  • An orchestrator sends the test adversary before the diff checkpoint.
  • ft-developer sends the checklist audit.
  • An orchestrator delegates the docs of a change.
  • Every Agent, Task or SendMessage call goes through price-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.py reads every Agent or Task brief.
  • Every Bash call of every agent goes through these three hooks. The agent receives a denial as text.
  • These four agents declare git-safety-check.sh in their frontmatter.
  • If you installed it, graph-search-augment.py adds context to a code search or a whole-file read.
  • If you installed it, user-visible-gate.py adds 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 Bash call that no hook denies runs.
  • An agent calls a tool. The completion of a background command wakes the agent that started it.
  • turn-guard.py reads 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.py saves its final report.
  • turn-guard.py saves the final report of a coding leaf under the run's units directory.
  • turn-guard.py logs every orchestrator turn end it saw.
  • turn-guard.py stamps the time a top-level lane ended for good.
  • price-gate.py reads the stamp and tells the main loop at its next dispatch to refill its lanes.
  • price-gate.py loads turn-guard.py to count the running lanes for the lane cap.
  • price-gate.py logs every swap and A/B arm.
  • price-gate.py keeps the "already said" state of its main-loop context note.
  • checkout-guard.py reads the list of guarded checkouts.
  • checkout-guard.py keeps the "already said" state of its context note to a bugfix-agent.
  • checkout-guard.py keeps the "already said" state of its context note to a coding leaf.
  • main-compact.py types /compact into the Terminal.app tab of the main loop.
  • main-compact.py records its last /compact and stops when the off file exists.
  • lane-nudge.py reads the turn end of the main loop on Stop and blocks it once when fewer agents run than the target.
  • lane-nudge.py records its last nudge and any hold, and writes the block marker before it prints the block.
  • main-compact.py reads the marker and types nothing for 60 seconds after a block.
  • The nudge asks the main loop to start lanes, and price-gate.py can deny a launch at the lane cap.
  • lane-status.py imports the counting code of lane-nudge.py, so both show the same count.
  • The main loop runs these five commands through Bash, and main-rules.md names them.
  • Through the skill obsidian-knowledge-vault, these agents write a vault note with one call.
  • vault-note.py reads the optional file of secret values and refuses a note that holds one.
  • After the Artifact tool publishes, artifact-registry.py records the link on PostToolUse.
  • artifact-registry.py appends one line for each published artifact.
  • main-rules.py gives its text to the main thread only, at session start.
  • main-rules.py reads main-rules.md and, when present, main-rules.local.md.
  • settings.json registers these twelve hooks on their events.
  • Both installers call economy.py.
  • economy.py and the installers copy these hooks to ~/.claude/hooks/. The hooks with a dashed border stay in the repository.
  • economy.py writes the settings entries, the CLAUDE.md block and main-rules.md.
  • economy.py checks only that the key file exists with mode 600.
  • CLAUDE.md reaches every agent on every turn.
  • ft-developer and bugfix-agent work by these four rule files.
  • ft-fix-host prices its lenses by tiering.md and waits by context.md.
  • These agents follow delegation-contract.md.
  • ft-developer asks for the grade at Stage 1.
  • The two dispatchers that price-gate.py prices 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.py asks Jev itself, through decide.py loaded in-process.
  • Every question goes through decide.py.
  • The answer becomes the Pick: line. price-gate.py checks that the line is valid, equals the call and follows a real decide.py call.
  • decide.py sends the state to Jev and gets back a decision, or UNSURE, in which case the asker decides.
  • decide.py logs every question and answer.
  • decide.py reads the key.
  • The orchestrator calls unit-check.py after each unit.
  • unit-check.py appends its result line to the journal.
  • The pipelines call diff-router.py plan at a checkpoint.
  • diff-router.py reads route-schema.json and writes a route manifest.
  • If you installed it, delegation-gate.py reads brief-schema.json, replays a verdict from evidence-store.py and checks a cited route.
  • evidence-store.py reads 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.

A denied call did not run

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 withHookWhen it firesWhat to do
price-gate (tiering.md §1, §1a, §3, §5):price-gate.pyA 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.pyYou 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 …` incheckout-guard.pyA 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.pyAny 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 conditioncheckout-guard.pyAny 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 laneslane-nudge.pyThe 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 forbiddencheckout-guard.pyAny 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 heredocheredoc-guard.pyA 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: blockedencoded-exec-guard.pyA 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 pushgit-safety-check.shAn 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.pyAn 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.pyYou 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 governThe optional hooks of the hook catalogueYou 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
price-gate (tiering.md §1, §1a, §3, §5): no `model` on the dispatch; no `effort` on the dispatch; no `Size:` line in the brief; no `Raise:` line in the brief; no valid `Pick: <model>/<effort> — <model source>/<effort source>` line (sources jev | self | override; a self adds `(unsure: <which>)`, an override `: <cited signal>`). Fix the dispatch and send it again; the spawn was not paid for. Add these, filling the <placeholders> (model and effort go on the call itself): On the Agent call: `model: <opus|sonnet|haiku>` and `effort: <low|medium|high|xhigh>`. Size: files <n> · lines ~<n> (<= ~400 lines and 10 files; or `atomic: <why>`) Raise: the work turns out to need something this brief did not name — no precedent to copy · concurrency, transactions or caching · a security or auth surface · a contract, protocol or schema change · another module · behaviour the brief cannot state? Stop and return TIER_RAISE: <model> — <cited signal>; do not work around it. Pick: <model>/<effort> — jev/jev (after a decide.py call; a `self` adds `(unsure: <tier|model|effort>)`, an `override` adds `: <cited signal>`; an earlier instance's answer: `(recorded: <journal path>)`)
Real outputCaptured by running 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).
Agent Bash call
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.
Real outputCaptured by running 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.py does this when the context is large, when a coding brief has no Touch: line, and when a lane has stopped.
  • Change it

    price-gate.py can allow a dispatch and run it on another model. Its text then reads price-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.
Every hook fails open

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. 1

    Send

    The main loop or an orchestrator sends the dispatch. The sender decides which checks apply.

    Sender
  2. 2

    Check

    price-gate.py runs all its checks. It does not stop at the first failure.

    Automatic
  3. 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

    When ft-developer or bugfix-agent sends a coding agent, ft-ui-ux-design or a reviewer, the call needs a model and an effort. A coding brief also needs the Size:, Raise: and Pick: lines. A Size: line over 500 lines or 12 files is denied, unless it says atomic.
  • 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, except fable in a session the owner granted. The text prints model: opus and effort: high for you to paste.
  • Brief shape

    Nothing checks it today. The hook delegation-gate.py would, and it is not installed, by the owner's ruling of 2026-11-03. Brief gates lists its rules.
The harness never changes which reviews run

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.

Without the guard

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.

With the guard

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 Monitor is 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
turn-guard: you ended the turn waiting, but no child agent of yours is running, so this end of turn forces your hand-back. A report a child already delivered is in your context - act on it now. A job, CI run or demo step is waited for by ONE background command that ends with it (run_in_background: true), then end the turn. If your work is done, deliver your full report. Canon: context.md section 1, 'Do not wake up to wait'.
Real outputCaptured by running 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.

WorkGoes toRefused instead, and by what
A feature, a parity or config change with a design in itft-developer (/ft-dev): stages, checkpoint D, the approval gate, units, checkpoint FNone
A MAJOR or CRITICAL bug/ft-fix, hosted by ONE ft-fix-host when the main loop keeps its context smallA 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 itbugfix-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 cleanuprefactor-agent (/ft-refactor)None
UI/UX work on an existing screen with no new data or logicONE 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, demoONE ft-opsprice-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 researchA general-purpose or Explore agent on sonnetThe 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 a price-gate.py timeout under 15 seconds.
  • Settings values

    The step sets autoCompactWindow to 600000 and CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS to 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 and ft-sdd.
  • The Jev key

    The step checks that ~/.config/ft-ai-toolkit/openrouter.key exists with mode 600. It never reads, writes or prints the key.
Write your own rules below the end marker

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.

bash
deploy/scripts/install.sh --doctor
bash
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.

Every hook, gate and fileAgent Harness Reference
Model, effort and costDispatch Economy
The decision modelDecision model (Jev)
The pipelinesQuality Pipelines
Look up a hook: Hook catalogue