| English | 日本語 | 简体中文 |
This guide explains how to create and customize TAKT workflows.
A workflow is a YAML file that defines a sequence of steps executed by AI agents. Each step specifies:
builtins/~/.takt/workflows/ — User workflows (override builtins with the same name)takt eject <workflow> to copy a builtin to the project’s .takt/workflows/ for customization. Add --global to copy it to ~/.takt/workflows/ insteadTo organize the workflow selection UI into categories, configure workflow_categories.
See the Configuration Guide for details.
Use takt workflow init <name> to create a new custom workflow scaffold in .takt/workflows/ (or ~/.takt/workflows/ with --global).
--template minimal: generates a self-contained scaffold with generic step routing--template faceted: generates a workflow plus local persona/instruction facet filesAfter editing the generated files, run takt workflow doctor <name or path> to validate references, routing targets, and unreachable steps before executing the workflow.
name: my-workflow
description: Optional description
max_steps: 10
initial_step: first-step # Optional, defaults to the first step
all_steps:
rules:
- findings-handling
- ref: careful-findings
position: before_instruction
# Section maps (key → file path relative to workflow YAML directory)
personas:
planner: ../facets/personas/planner.md
coder: ../facets/personas/coder.md
reviewer: ../facets/personas/architecture-reviewer.md
policies:
coding: ../facets/policies/coding.md
review: ../facets/policies/review.md
knowledge:
architecture: ../facets/knowledge/architecture.md
instructions:
plan: ../facets/instructions/plan.md
implement: ../facets/instructions/implement.md
report_formats:
plan: ../facets/output-contracts/plan.md
steps:
- name: step-name
session_key: shared-coder # Optional explicit session key for this step
persona: coder # Persona key (references personas map)
persona_name: coder # Display name (optional, does not affect provider_routing.personas)
tags: [implementation, edit] # Provider routing tags (optional)
policy: coding # Policy key (single or array)
knowledge: architecture # Knowledge key (single or array)
instruction: implement # Instruction key (references instructions map)
edit: true # Whether the step can edit files
required_permission_mode: edit # Minimum permission: readonly, edit, or full
capabilities: edit # Optional capability preset
rules:
- condition: "Implementation complete"
next: next-step
- condition: "Cannot proceed"
next: ABORT
output_contracts: # Report file configuration
report:
- name: 00-plan.md
format: plan # References report_formats map
quality_gates: # Agent-step quality gates for step completion
- "Review the implementation before finishing" # AI directive
- type: command # Machine-executed command gate
name: quality-check
run_at: before_report # Run after work and before reporting
command: "./.takt/quality-gates/check.sh"
covers: ["npm test -- fixtures.test.ts"]
guidance: "Check generated fixtures if this gate fails"
cwd: "."
timeout_ms: 300000
To write instructions directly in a step instead of referencing a file, replace instruction: implement above with:
instruction: |
Your instructions here with {variables}
Steps reference section maps by key name (e.g., persona: coder), not by file path. Paths in section maps are resolved relative to the workflow YAML file’s directory.
Section maps are optional. Facets can be referenced directly by bare name (e.g., persona: coder without a personas map entry); bare names are resolved through the facet layers in priority order — project .takt/facets/<type>/, then global ~/.takt/facets/<type>/, then bundled builtins/{lang}/facets/<type>/. Use a section map only when you need a custom alias or an explicit file path.
instruction accepts either one scalar value or a non-empty ordered array. Each array item may be a facet key/path or inline text; items are resolved in place and joined with \n\n---\n\n, preserving an explicit boundary between elements. In a callable workflow, an array item may also be { $param: name } for an instruction facet_ref or facet_ref[] parameter. A facet_ref[] value is spliced at that position without changing the surrounding order. The scalar form keeps its existing behavior.
For policy and knowledge, facets with identical content after $param substitution and include / extends expansion are included only once: the first occurrence is kept, preserving order. This applies regardless of reference names, paths, or whether the content comes from a file or an inline definition. References to the same real path are both retained when their source layers resolve include / extends differently and produce different content. Repeated instruction entries and repeated `` directives within a facet are preserved.
all_steps.rules)Declare rules that apply to every agent step in the workflow under all_steps.rules. Each entry is either a rule reference or an object with ref and the optional position: before_instruction. An omitted position places the rule after the automatic execution rules; before_instruction places it immediately before the step’s Instructions section.
Rule files are Markdown files named <ref>.md under workflows/rules/. They resolve in project .takt/workflows/rules/, then global ~/.takt/workflows/rules/, then the bundled builtin directory. The applicability notice and rule heading are rendered once per prompt. These rules apply only to Phase 1 agent instructions, not output reports, status routing, or companion reviewers. A called workflow inherits its parent’s rules additively before its own all_steps.rules. When parent and child rules have identical ref, position, and resolved content, the parent occurrence wins and the rule is applied only once. Rules sharing a ref but differing in position or content are not deduplicated.
Rule files must not contain the required-output heading or {report:...} references; invalid content fails workflow loading and identifies the referenced file. Omitting all_steps preserves the existing prompt. Future workflow-wide declarations belong under all_steps; unknown root-level keys remain invalid.
Put exactly one step object in a root-level <name>.yaml or <name>.yml file under a steps/ directory, then reference it with uses. uses is supported on top-level agent and workflow_call steps, parallel parents, and parallel sub-steps. The loader expands it before workflow schema validation, so runtime, doctor, and previews use the same ordinary step.
steps:
- name: final-gate
uses: final-gate
rules:
- condition: COMPLETE
next: COMPLETE
For example, .takt/steps/final-gate.yaml can contain:
kind: workflow_call
call: supervisor-final-gate
Every concrete workflow step that declares uses, including a parallel sub-step, must declare its own non-empty rule specification. A non-parallel fragment caller uses a rules array; a parallel fragment caller uses the rule tree described below. A fragment cannot declare rules at its root or on any parallel sub-step. This keeps routing owned by the workflow that knows the destination step names; fragment-to-fragment uses is exempt until a concrete workflow calls the chain. The loader does not copy, inherit, or synthesize fallback rules.
Step fragments may declare required typed parameters in root-level params, and each uses caller binds them with with. Facet parameters use type: facet_ref or facet_ref[] with facet_kind: policy, knowledge, instruction, persona, or report_format. Workflow target parameters use type: workflow_ref without facet_kind. A fragment that receives a dynamic facet pool name may use type: facet_pool_ref without facet_kind. Companion parameters are currently supported only by callable workflows, not by step-fragment params; a fragment can still contain a literal non-empty companion selection. Defaults and optional parameters are not supported in fragments.
Use { $param: name } in the field that matches its declaration: policy, knowledge, persona, instruction, output_contracts.report[].format, workflow_call.call, or dynamic_facets.pool for step-fragment parameters; callable workflow parameters additionally support a normal agent or Team Leader step’s companion. A companion_ref[] value expands to fixed companion names. An empty array omits the companion field itself and rejects any remaining unquoted companion.* state reference. This keeps a generic wrapper companion-free without allowing a literal empty companion or an invalid companion-dependent route. Companion names are checked by the normal definition loader, so unknown references fail during loading. A facet_ref or facet_ref[] parameter may also be an item within a policy or knowledge list; list values are spliced in place while preserving order, and an empty facet_ref[] contributes no item. A facet_pool_ref is a scalar key in the containing callable workflow’s top-level facet_pools map, not a policy or knowledge facet. Callable workflow parameters can be passed as direct workflow_call.args; the four fragment parameter types above can also be passed in a nested fragment caller’s with. Nested fragments use lexical scope and cannot capture an outer parameter implicitly: pass it explicitly as with: { child_param: { $param: outer_param } }. A callable workflow parameter may be passed the same way and is resolved after fragment expansion. The resolver rejects unknown or missing bindings, cardinality or kind mismatches, undeclared references, and parameter references in unsupported fields. It consumes params and with before schema validation, preserves and expands a workflow_call fragment’s own args, and applies ordinary caller overlays after parameter expansion.
When a fragment resolves to a parallel step, the caller supplies a strict rule tree instead of a plain array. self contains the parallel parent’s non-empty rule array, and parallel maps every explicit, unique final child name to a non-empty rule array. Child rule trees are invalid because workflow parallel steps cannot be nested. The mapping must list all children exactly once and cannot contain unknown children. The loader applies the tree after fragment expansion and converts it to ordinary per-step rules arrays before schema validation.
For example, a callable workflow can select a child-local implementation pool through a fragment without copying the fragment’s step definition:
subworkflow:
callable: true
params:
implementation_pool:
type: facet_pool_ref
default: coding-facets
facet_pools:
coding-facets:
candidates:
- id: backend
description: Handle backend changes
knowledge: backend
steps:
- name: implement
uses: implementation-step
with:
implementation_pool:
$param: implementation_pool
dynamic_facets:
pool:
$param: implementation_pool
facet_pool_ref arguments and defaults must be scalar names of pools declared by the callable child. A missing required argument, a list value, an unknown pool name, or an unresolved/undeclared $param in dynamic_facets.pool fails during loading before an agent or selector starts. The loader does not fall back to another pool or to all candidates.
steps:
- name: reviewers
uses: reviewers
rules:
self:
- condition: all("approved")
next: COMPLETE
parallel:
architecture:
- condition: approved
- condition: needs_fix
security:
- condition: approved
- condition: needs_fix
The caller overrides fragment fields. Objects are deep-merged; arrays such as parallel are replaced as a whole, except that a caller rule tree is a resolver-only routing overlay and does not replace fragment-owned parallel structure. Names resolve in this order: caller name, fragment name, then the final name in uses. YAML key order does not change runtime behavior; examples use name, uses, other fields, then rules for readability. Fragments may reference other fragments, but circular references fail. Bare names resolve project, global, then the selected language’s builtin steps/; package workflows check package-local steps/ first, and @owner/repo/name selects a repertoire package. Each lookup uses the first matching .yaml before .yml; nested bare references continue from the layer that supplied their parent fragment, rather than restarting at higher-priority layers. A workflow may expand at most 64 nested fragments and 512 references in total; each fragment must be a readable regular file no larger than 1 MiB. Unknown references, malformed scoped references, non-object fragments, unreadable files, circular references, size-limit violations, absolute paths, traversal, nested paths, a symlinked steps/ root, symlink targets outside a steps/ root, and a resolved system step are configuration errors. A project-trusted workflow also cannot receive a workflow_call or allow_git_commit: true from a non-project fragment. A caller may explicitly override fragment-provided allow_git_commit with false.
persona_name is only a display name. provider_routing.personas in config matches the raw persona key, while provider_routing.tags matches the optional tags array in the order written on the step. Later tags override earlier tags for the same provider/model/provider_options leaf.
session_key is supported on normal agent steps and parallel sub-steps. It is not supported on system steps, workflow-call steps, loop-monitor judges, or parallel parent steps because those entries do not own a resumable agent session. Use it when multiple agent steps share a persona but must keep separate sessions, or when different agent steps must intentionally share one session. The effective runtime key is session_key and the resolved provider encoded as a JSON tuple, for example ["shared-coder","claude-sdk"] (claude uses the same SDK key). When session_key is omitted, TAKT uses the persona key, or the step name when no persona is set. Empty strings and whitespace-only values are rejected during workflow validation.
String quality_gates remain AI completion directives and are injected into agent step prompts. type: command gates run inside the worktree after an agent step completes and pass only when the command exits with code 0. Workflow YAML command gates require workflow_command_gates.custom_scripts: true in config. On failure, TAKT feeds command metadata, cwd, exit code or timeout/output-limit details, and the private output log path back into the same agent step. Sanitized stdout and stderr are available only in that local private log and are not inserted into agent feedback. system and workflow_call steps do not accept quality_gates.
Set run_at: before_report to run a command after the work phase (Phase 1) and before reporting and rule judgment. On failure, TAKT skips report generation and provides the exit code or other failure details and any available log reference to the next work attempt of the same step. On success, TAKT saves the execution record and includes it in the report-generation input. For a parallel step, configure the gate on the individual sub-step. Parallel parents and arpeggio steps do not support this setting. Shared workflow_overrides.quality_gates entries with run_at: before_report apply only to supported agent steps, including parallel children.
Phase 1 tells the agent which completion checks TAKT handles. The gate executes only its command. For run_at: before_report, use the optional covers list to identify commands that the gate already performs, for example through a wrapper. Each entry must be a non-blank string. The agent leaves a check to TAKT only when both its command (command or a covers entry) and working directory match. The prompt shows cwd relative to the worktree root. If omitted, it is . (the root). When a wrapper checks a different directory, use a covers command that identifies the target from the gate’s cwd, such as npm --prefix packages/api test. The agent runs any other required verification. Commands mentioned only in guidance do not count as covered. The agent can still run targeted tests or reproduce failures while working.
The optional guidance must be a non-blank string. TAKT includes it in the initial notice and in the failing check’s diagnostic. Braces in covers and guidance are literal. Otherwise identical gates run once. For covers and guidance separately, TAKT uses the first supplied value in merge order: global config, project config, then workflow YAML. Coverage lists are not combined. An explicit empty list declares no additional covered commands.
| Variable | Description |
|---|---|
{task} |
Original user request (auto-injected if not in template) |
{iteration} |
Workflow-wide turn count (total steps executed) |
{max_steps} |
Maximum steps allowed |
{step_iteration} |
Per-step iteration count (how many times THIS step has run) |
{previous_response} |
Previous step’s output (auto-injected if not in template) |
{user_inputs} |
Additional user inputs during workflow (auto-injected if not in template) |
{report_dir} |
Report directory path (e.g., .takt/runs/20250126-143052-task-summary/reports) |
{report:filename} |
Inline report content using the report reference lookup |
{report_history:filename} |
Oldest-first fixed-path list for the declared history: {previous: N}; no historical bodies |
{review_scope} |
TAKT-computed list of files changed by this task |
What {review_scope} covers depends on where the run came from.
takt --pr N): the PR diff range base...head is added on top of the working-tree computation. --pr pulls in PR review comments and fixes them, so the working tree changes within the same run and both belong to the review scope. If the diff range is not available locally, the text says so and lists the local changes only.When the working directory is not a Git repository, or no change is detected, it resolves to text stating that fact rather than to an empty string. Lists longer than 200 files are truncated with the remaining count stated. Builtin general-purpose reviewers receive this variable automatically through the shared findings-handling workflow rule.
The base commit is taken from the merge-base against the first existing ref among refs/takt/pr-base/<branch>, refs/takt/base/<branch>, and the detected default branch, combined with the branch entry point recorded in the reflog; the newer of the two is used. In environments where no base ref survives and the reflog holds no branch entry point — for example a resume run that clones an existing branch directly — the base cannot be determined and committed changes are left out of the list. That limitation is stated explicitly in the rendered text.
Note:
{task},{previous_response}, and{user_inputs}are auto-injected into instructions. You only need explicit placeholders if you want to control their position in the template.
For a report selected by the step’s input_reports, {report:filename} uses that declared producer’s completed report. Other report references search the current workflow namespace first, then the resume snapshot’s exact mapping for the consumer and reference name (when available), then the immediate parent, further ancestors, and finally the run’s reports root. The first matching scope wins for those other references: a report in a nearer scope shadows one of the same name farther away. Sibling and descendant workflow namespaces are never searched.
Parent and ancestor reports, including the run root, are read-only references. Reports are always written to the current workflow’s own reportDir; resolving a parent reference does not change the write destination. If no report exists, the reference becomes an explicit missing-report sentence. Invalid paths, reserved names, symlinks, and non-missing I/O errors remain errors.
Report content referenced by a step’s Phase 1 instruction is also passed to its Phase 2 report generation. A reference missing in Phase 1 remains a missing-report notice in Phase 2; it is not reread or replaced there.
takt workflow doctor also checks callable workflow instructions using their own preceding producers and ancestors’ reports available before each call. Known caller contexts are checked separately; a missing producer is reported with the consuming step, reference name, and call path. Unknown callers and resume snapshots are not assumed to produce reports.
Rules define how each step routes to the next step. The instruction builder auto-injects status output rules so agents know what tags to output.
rules:
- condition: "Implementation complete"
next: review
command_gates: required
- condition: "Cannot proceed"
next: ABORT
command_gates: skip
appendix: |
Explain what is blocking progress.
| Type | Syntax | Description |
|---|---|---|
| Semantic label | approved |
The status judge selects one deduplicated label once |
| State predicate | when(...) |
Evaluates workflow state deterministically |
| Aggregate | all("X") / any("X") |
Aggregates parallel sub-step results |
| Combined | approved && when(...) |
Requires both the selected label and state predicate |
| Aggregate + state | all("X") && when(...) / any("X") && when(...) |
Requires the aggregate result and state predicate |
Rules are evaluated in YAML order. The first matching rule is selected; no rule-type priority or fallback transition applies. If no rule matches, the workflow aborts with rule_no_match.
next ValuesCOMPLETE — End workflow successfullyABORT — End workflow with failureappendixThe optional appendix field provides a template for additional AI output when that rule is matched. Useful for structured error reporting or requesting specific information.
interactive_onlyA rule with interactive_only: true is only considered during interactive execution. In non-interactive runs (e.g. --pipeline or takt run), the rule is skipped as if it were not declared, and evaluation continues with the remaining rules. Use it for transitions that require a human, such as a rule that waits for user input.
command_gatescommand_gates controls command gates that omit run_at. required runs those gates after rule resolution and applies the transition after they succeed. skip applies the transition immediately. Omitting the field is equivalent to required. Gates with run_at: before_report run before the rule is selected.
TAKT supports seven step types — Normal, Parallel, Dynamic Parallel, Arpeggio, Team Leader, Workflow Call, and System. Pick by the structure your step needs.
A single agent executes the step. This is the default and matches all the earlier examples.
Sub-steps execute concurrently, and the parent aggregates sub-step matches via all() / any():
- name: reviewers
parallel:
- name: arch-review
session_key: arch-review
persona: architecture-reviewer
policy: review
knowledge: architecture
edit: false
rules:
- condition: approved
- condition: needs_fix
instruction: review-arch
- name: security-review
session_key: security-review
persona: security-reviewer
policy: review
edit: false
rules:
- condition: approved
- condition: needs_fix
instruction: review-security
rules:
- condition: all("approved")
next: COMPLETE
- condition: any("needs_fix")
next: fix
all("X"): true if ALL sub-steps matched condition Xany("X"): true if ANY sub-steps matched condition Xrules define possible outcomes; next is optional (parent handles routing)description that explains what the step does.promotionconcurrency: <N> (minimum 1) to bound how many sub-steps run at the same time; without it, all sub-steps start togetherparallel may instead define a fixed set and a selectable pool. TAKT runs an internal selector when the step is entered; it is not a workflow step and cannot create agents or change the workflow. The selector runs with read-only permission and cannot modify or write files. Providers that honor the tool allowlist permit only Read, Glob, and Grep. It uses the resolved runtime profile in a fresh session and returns a TAKT-owned structured output contract.
- name: reviewers
parallel:
fixed:
- name: architecture
persona: architecture-reviewer
instruction: Review architecture
rules: [{ condition: approved }]
pool:
- name: frontend
persona: frontend-reviewer
description: Review frontend and UI changes
selection_hint: Select when changes affect user-facing behavior or presentation
instruction: Review frontend
rules: [{ condition: approved }]
- name: backend
persona: backend-reviewer
description: Review API and persistence changes
instruction: Review backend
rules: [{ condition: approved }]
selection:
mode: replace
rules:
- condition: all("approved")
next: COMPLETE
pool must be non-empty and every candidate must have a non-empty description that explains its role.selection_hint when a candidate’s role alone does not make clear when to select it. This optional field is allowed only on pool candidates and must be a non-empty string when specified. The selector uses both description and selection_hint. Existing YAML without selection_hint continues to use only description for selection. Setting selection_hint on any other step or sub-step causes a load-time error.fixed or pool item that declares uses owns its rules at that call site. The referenced fragment must not define them.fixed always runs. The selector can select only expanded pool step names, and execution follows YAML order.replace (the default) replaces a previous pool selection on a new round. cumulative retains every pool item selected in earlier rounds. In replace mode, a retry with an unresolved before-report gate keeps the previous selection so that the affected child can run its gate again.all() and any() aggregate only the fixed and selected pool items of the current round. Dynamic parallel rejects position-dependent aggregate expressions.pool is missing or empty, a pool description is empty, a fragment cannot expand, an expanded name is duplicated, a fixed/pool item is not an agent sub-step, selection.mode is not replace or cumulative, or an aggregate label is not defined by every candidate. Selector execution also fails before reviewer startup when the provider is unresolved, its strict output is invalid, or fixed plus selected pool items is empty. Resume points containing the removed dynamic selection fields are not supported.selection.reports), the changed file paths against HEAD, candidate IDs with description (role) and selection_hint (selection criteria, when specified), the previous selection for cumulative, and whether this is an initial entry or a new round. The selector resolves report references through the current workflow scope, exact resume snapshot, and parent workflow scope before passing the resulting paths. It is configured with a tool allowlist of Read, Glob, and Grep for reading referenced files and reports; providers that honor the allowlist permit only those tools. Its output must be a completed JSON object with only selected_ids and rationale; non-arrays, non-string IDs, duplicate IDs, and extra properties are rejected.HEAD; .takt/runs/ paths are excluded. Report references are resolved through the existing report-reference rules before they are passed as paths; report contents are read by the selector when needed.HEAD and are not guaranteed to remain in later selector path lists; prior reports remain available through their report references. A non-Git directory or an unavailable Git command produces an empty changed-path list or fails according to the Git boundary.replace cannot contribute stale reports or findings to the current round.A normal agent step, or an agent sub-step under parallel, can dynamically select additional policy and knowledge facets from a validated candidate pool right before its main agent runs. This keeps the fixed facets the step already declares and adds only the facets the current situation requires — for example, selecting a transaction-correctness policy only after a review surfaces transaction-boundary concerns.
Define a pool under the top-level facet_pools map, then reference it from a step with dynamic_facets. Pools can be defined inline in the workflow or as external resource files.
dynamic_facets.max_selected is optional. When specified, it limits the number of selected candidates; when omitted, the selector may select up to every candidate in the pool. This does not add an all-candidate fallback when selector execution fails.
dynamic_facets.pool may also use { $param: implementation_pool } when the containing callable workflow declares implementation_pool with type: facet_pool_ref. The value is resolved before dynamic-facet validation and must name a pool in that callable workflow’s top-level facet_pools map. An unset required parameter, a list or other non-scalar value, an unknown pool, or an unexpanded parameter reference fails before an agent or selector starts.
An inline pool lives in the workflow YAML. Its candidate policy / knowledge references resolve through the same workflow-local facet namespace as ordinary steps: the workflow policies / knowledge section maps and bare facet lookup both work.
name: backend-fix
policies:
transaction-correctness: ../facets/policies/transaction-correctness.md
backward-compatibility: ../facets/policies/backward-compatibility.md
knowledge:
backend-api: ../facets/knowledge/backend-api.md
database-transaction: ../facets/knowledge/database-transaction.md
facet_pools:
fix:
candidates:
- id: backend
description: Handle API, repository, and server-side implementation
knowledge: backend-api
- id: transaction
description: Handle transaction boundaries, rollback, and concurrency control
policy: transaction-correctness
knowledge: database-transaction
- id: backward-compatibility
description: Preserve compatibility of public APIs and schemas
policy: backward-compatibility
steps:
- name: fix
persona: coder
policy: [coding, testing]
knowledge: architecture
dynamic_facets:
pool: fix
max_selected: 4
instruction: fix
edit: true
rules:
- condition: Fix complete
next: review
dynamic_facets is also valid on a static parallel child and on a dynamic parallel fixed or pool entry. For a dynamic parallel step, participant selection runs first; the facet selector runs only for the selected children. For a static parallel step, each dynamic child runs its own facet selector independently.
facet_pools:
security-review:
candidates:
- id: web
description: Review HTTP and browser security boundaries
knowledge: [security-web, security-api]
- id: cli
description: Review command-line and local process boundaries
knowledge: security-local
steps:
- name: reviewers
parallel:
pool:
- name: security-review
description: Review security for the selected system
persona: security-reviewer
knowledge: security
dynamic_facets:
pool: security-review
max_selected: 1
instruction: review-security
rules: [{ condition: approved }]
selection:
mode: replace
rules:
- condition: all("approved")
next: COMPLETE
The selected knowledge or policy is added to the child’s fixed facets. An empty selection keeps the fixed facets unchanged. All applicable facet selectors complete before any parallel child starts. An invalid pool reference, candidate ID, or max_selected stops the workflow without starting that child or any sibling under the same parallel parent. Within one uninterrupted run, the parent parallel frame and occurrence keep child selections independent. A process resume starts with empty run-local selection state and invokes the participant and child facet selectors again.
For nested callable workflows, keep pool selection at the owning top-level workflow. When a shared workflow accepts an open workflow_ref, do not add a pool argument to every possible target: an undeclared callable argument is rejected. Instead, let the top-level workflow select a narrow adapter that binds the facet_pool_ref only when it calls the suite that consumes it. The consuming suite declares the accepted external pools, so unknown references still fail while loading that boundary without widening unrelated callable contracts.
A workflow can reference a named external pool resource with uses instead of defining the pool inline. External pools are self-contained: candidate facet references resolve only against the pool file’s own policies / knowledge section maps, resolved relative to the pool file’s directory. An external pool never captures the caller workflow’s same-named aliases, and the caller cannot merge or override the pool’s candidates or section maps.
facet_pools:
fix:
uses: implementation-fix
steps:
- name: fix
persona: coder
policy: [coding, testing]
knowledge: architecture
dynamic_facets:
pool: fix
max_selected: 4
instruction: fix
edit: true
rules:
- condition: Fix complete
next: review
The referenced facet-pools/implementation-fix.yaml defines exactly one pool resource:
policies:
transaction-correctness: ../facets/policies/transaction-correctness.md
backward-compatibility: ../facets/policies/backward-compatibility.md
knowledge:
backend-api: ../facets/knowledge/backend-api.md
database-transaction: ../facets/knowledge/database-transaction.md
candidates:
- id: backend
description: Handle API, repository, and server-side implementation
knowledge: backend-api
- id: transaction
description: Handle transaction boundaries, rollback, and concurrency control
policy: transaction-correctness
knowledge: database-transaction
- id: backward-compatibility
description: Preserve compatibility of public APIs and schemas
policy: backward-compatibility
External pool files do not accept nested uses, params, or $param; mixing uses with inline policies, knowledge, or candidates in a single pool entry fails loading.
Named pools are discovered with the same layering as step fragments:
facet-pools/ (for workflows provided by a repertoire package).takt/facet-pools/$TAKT_CONFIG_DIR/facet-pools/builtins/<lang>/facet-pools/builtins/facet-pools/Bare names resolve the first matching <name>.yaml before <name>.yml in each layer. @owner/repo/name selects a repertoire package explicitly. Absolute paths, directory traversal, nested paths, root-escaping symlinks, non-regular files, unreadable files, and oversize files are rejected. Provenance and dependency resources are tracked so doctor, preview, eject, and repertoire install / remove can follow them.
Every candidate in a pool shares the same shape:
- id: transaction
description: Handle transaction boundaries and rollback
policy:
- transaction-correctness
knowledge:
- database-transaction
id is non-empty and unique within the pool.description is a non-empty string.policy and knowledge are each a scalar or a non-empty array.policy or knowledge is required.requires, conflicts_with, and exclusive groups are not introduced in the MVP.When a step with dynamic_facets is entered, TAKT runs an internal selector before the main agent starts. The selector is not a workflow step, cannot create agents or change the workflow, and uses the resolved runtime profile in a fresh session. It runs with read-only permission and cannot modify or write files. Providers that honor the tool allowlist permit only Read, Glob, and Grep.
The selector receives at least:
git diff HEAD)Candidate facet bodies are not sent separately to the selector. The selector receives the target-agent prompt inline, resolves the referenced reports through the current workflow scope, exact resume snapshot, and parent workflow scope, and is configured with a tool allowlist of Read, Glob, and Grep for reading the referenced files and reports; providers that honor the allowlist permit only those tools. It returns only candidate IDs and a rationale against a strict structured output schema (additionalProperties: false, selected_ids as a unique array whose items are an enum of the pool’s candidate IDs, plus a required rationale string). Pool-external IDs, duplicate IDs, and selections exceeding a specified max_selected are rejected. Selector failure stops the run before the main agent starts; there is no implicit fallback to all candidates or to an empty selection. The selector itself is not subject to dynamic facet selection or auto routing.
The selector provider is resolved through #1136’s provider.targets.internal_agents.selector in runtime.yaml. When left unspecified, the runtime’s normal default is used.
Fixed facets stay in the existing step fields. The effective facets are:
effective policy = fixed policy + selected dynamic policy
effective knowledge = fixed knowledge + selected dynamic knowledge
persona, instruction, provider, permission, MCP, tools, or output contracts.Each re-entry into the same step as a new round re-runs the selector and replaces the previous dynamic selection; there is no cumulative mode.
round 1: selects frontend
round 2: selects transaction
round 2 effective facets:
fixed + transaction
The round-1 frontend facet does not leak into round 2.
ResolvedFacetPool, so the execution layer never branches on whether a pool was inline or external. External pool files are not re-read during execution.The MVP does not hot-swap facets mid-execution. If the required expertise changes during a run, the next time the step is reached a new selection is made.
Loading fails before execution when any of these hold:
facet_pools schema is invalidpolicy nor knowledgeuses is combined with inline fieldsuses, params, or $paramdynamic_facets.pool is unknownmax_selected is invalid or exceeds the candidate countdynamic_facets is declared on a non-agent step or a parallel parentSelector execution fails before the main agent starts when:
selected_ids is not an arraymax_selected is exceededThere is no implicit fallback.
Both selector forms accept optional persona guidance and required instruction guidance:
steps:
- name: fix
dynamic_facets:
pool: implementation
selector:
persona: facet-selector
instruction: select-implement-facets
- name: reviewers
parallel:
fixed: []
pool:
- name: backend
persona: backend-reviewer
description: Review backend changes
instruction: Review the backend
rules: [{ condition: approved }]
selection:
mode: replace
selector:
persona: reviewer-selector
instruction: select-reviewers
selector.instruction is required whenever a selector is configured; persona is optional. The selector guidance only describes how to select facet or participant IDs. TAKT retains responsibility for the evidence references, read-only structured execution and tools, structured output contract, candidate validation, selection mode, and disabled permission bypass. A selector cannot change the selected agent’s persona, instruction, provider, permissions, tools, MCP configuration, or output contract.
The selector guidance references the workflow’s existing persona and instruction resources. Unknown selector keys, an empty selector, a selector without instruction, or an unresolved persona/instruction reference fails during schema or workflow validation with the configuration path. A raw $param reference is valid only after callable argument expansion; an unexpanded reference in a non-callable workflow is rejected.
facet-pools/, and package-local / scoped pools resolve through the same lookup order as step fragments.takt eject <workflow> copies referenced external pools and the facets they depend on, using the existing collision handling and priority for existing user files.takt workflow doctor validates pools, candidates, and facet references.takt workflow inspect <workflow> shows the dynamic pool name, candidate IDs, referenced facets, and source.Iterate over a data source (CSV, JSON, etc.) and apply the same step template to each row with bounded concurrency:
- name: batch-process
persona: coder
arpeggio:
source: csv
source_path: ./data/items.csv
batch_size: 5
concurrency: 3
template: ./templates/process.txt
max_retries: 2
retry_delay_ms: 1000
merge:
strategy: concat
separator: "\n---\n"
output_path: ./output/result.txt
rules:
- condition: "Processing complete"
next: COMPLETE
Useful for batch-applying the same operation to many inputs (file lists, issue lists, generated test cases, etc.).
merge.strategy is concat (the default) or custom. concat joins the per-row results with the optional separator and does not accept inline_js or file. custom requires either inline_js (an inline JavaScript merge function) or file (a path to a merge script); declaring custom without one of them, or combining concat with either, fails workflow loading.
The agent acts as a leader: it decomposes the task into independent sub-parts at runtime and dispatches each part to a worker agent:
- name: implement
team_leader:
max_concurrency: 2
initial_max_parts: 2
timeout_ms: 600000
part_tags: [coding]
part_persona: coder
part_edit: true
part_permission_mode: edit
part_allowed_tools: [Read, Glob, Grep, Edit, Write, Bash]
instruction: |
Decompose this task into independent subtasks.
rules:
- condition: "All parts completed"
next: review
Useful for breaking one large task into independent units that can run in parallel without you having to know the unit boundaries up-front.
team_leader.persona optionally sets the persona for the leader agent itself (resolved like a step persona and used as the provider-routing persona key); when omitted, the step’s own persona applies.
max_concurrency controls how many independent parts run at the same time. Both max_concurrency and the compatibility key max_parts accept at most 3; a larger value fails workflow loading. When neither is set, the default is 3. When specified, initial_max_parts limits only the first decomposition batch. There is no total-part limit for the workflow step; the Team Leader adds batches until it decides no additional work is required or stops returning new unique parts. The scheduler requests a new batch only after every part in the current batch completes, so parts in one batch must never depend on each other; verification that needs implementation results belongs in a later batch. With fail_on_part_error: true, a generated-part failure can still lead the Team Leader to plan and run new recovery parts; it then ends the step with an error. When omitted, the leader can continue according to its normal recovery flow. The older max_parts key is still accepted as the compatibility name for max_concurrency. refill_threshold is a compatibility key and may only be omitted or set to 0; non-zero values fail workflow loading because incremental refill conflicts with the batch barrier. part_tags sets provider routing tags on generated part steps. When omitted, parts inherit the parent step’s tags. Empty and whitespace-only tags are invalid. part_tags is resolved through normal provider_routing.tags, so tag routing takes priority over persona routing from part_persona.
inspect_tools restricts the parent Team Leader task decomposition and additional-part decision phases to read-only inspection tools (read, glob, grep). Invalid tool names fail workflow loading. It does not affect generated child parts; child part tools remain controlled separately by part_allowed_tools. When omitted, the engine defaults to read, glob, and grep for providers that support allowedTools (Claude-family providers and OpenCode); an explicit value overrides the default. Providers that cannot restrict tools (such as Codex) leave the leader’s allowedTools unset and the leader still gets read-only guidance because its execution environment is read-capable. An explicit non-empty inspect_tools value on a provider that does not support Team Leader inspection tools fails at runtime with a clear error.
A step invokes another workflow by name. The child workflow runs in the same run; its outcome routes back via the parent’s rules:
- name: peer-review
kind: workflow_call
call: peer-review
args:
impl_knowledge: cqrs-es
rules:
- condition: approved
next: COMPLETE
- condition: needs_fix
next: fix
The called workflow can declare subworkflow.params so the parent passes values via args (e.g. impl_knowledge or fix_knowledge) to customize the child without duplicating step definitions. See Workflow-level Configuration for subworkflow declaration.
workflow_call rules only accept COMPLETE, ABORT, or a semantic return label the child declares. A child workflow lists its labels in subworkflow.returns (e.g. returns: [approved, needs_fix]; the reserved results COMPLETE / ABORT cannot be listed), and a child step’s rule ends the subworkflow with a label via return: instead of next:. The parent’s rules then route on that label, as approved / needs_fix do above.
If a child workflow aborts due to an iteration limit, a transition to ABORT, blocked, an execution error, or another non-interrupt reason, and no parent ABORT rule matches, the parent aborts with the child’s reason and failing step. An iteration limit or another child abort reason is preserved instead of being replaced with rule_no_match. A matching ABORT rule still follows its explicit branch. An interrupt, however, is handled as an interruption of the parent itself: the abort kind remains interrupt, and the recorded step is the parent’s current step. Interrupts take precedence over ABORT rules. This also applies to workflow_call steps expanded through uses: and calls within parallel steps.
A workflow_call step does not accept provider, model, provider-options, or routing
overrides. The child inherits the already-resolved runtime context from its parent; configure
provider targets, profiles, options, and routing in runtime.yaml.
max_steps is a budget owned by the root workflow and shared by every descendant. A workflow_call is a control node and does not consume that budget or select a provider/model of its own. Executable steps in the root and descendant workflows consume iterations. For example, plan → workflow_call(implement → review) → supervise consumes four iterations, so extracting implement and review into a callable workflow does not require increasing max_steps. Nested calls follow the same rule. The call lifecycle remains visible in session logs and traces with a call invocation number and the complete call stack.
A workflow_call step may also declare scalar vars for execution context that is not a facet reference. Strings, finite numbers, and booleans are inherited through nested workflow calls; a nested call overrides a key by declaring it again. Agent instruction facets read a value with {var:name}. A missing value renders as unspecified, so an instruction can define a safe fallback explicitly.
- name: follow-up-review
kind: workflow_call
call: peer-review-suite
vars:
review_mode: follow_up
rules:
- condition: COMPLETE
next: COMPLETE
A system step is executed by the TAKT engine itself — no agent runs. Declare it with kind: system (or the shorthand mode: system; declaring both is a configuration error). System steps cannot declare agent fields such as persona, instruction, provider, structured_output, output_contracts, or quality_gates. See src/core/models/workflow-system-schemas.ts for the full schema. The builtin auto-improvement-loop workflow (builtins/en/workflows/auto-improvement-loop.yaml) is the reference example: it routes between PR handling, issue-driven planning, and fresh improvement planning using only system steps and planner agent steps.
system_inputs reads engine-provided context or executes a fixed command and binds each entry to a name via as. Available types: task_context, branch_context, pr_context, issue_context, task_queue_context, pr_list, pr_selection, issue_list, issue_selection, pr_status, pr_ci_failure, command (pr_list / pr_selection accept a where filter, which must match between the two). The command type requires permission; see Fixed command inputs. Bindings must be unique within the step. Bound values drive when() rules as context.<step>.<binding>... and can be referenced from later agent instructions with {context:step.binding.field}:
- name: route_context
mode: system
system_inputs:
- type: task_queue_context
source: current_project
as: active_queue
exclude_current_task: true
- type: pr_selection
source: current_project
as: selected_pr
rules:
- condition: when(context.route_context.active_queue.pending_count > 0)
next: wait_before_next_scan
- condition: when(context.route_context.selected_pr.exists == true)
next: plan_from_existing_pr
type: command executes a shell command fixed in the workflow. The permission below defaults to disabled. An explicit project value overrides global; when absent, the global value applies. This permission is independent of workflow_command_gates.custom_scripts. Unauthorized workflows fail during loading.
Separate clones use the original project configuration. Permission is resolved for each run and shared by root and child workflows; wait does not reload it. See the configuration guide.
When a pipeline or interactive session checks out a PR in the current directory, it resolves permission before switching branches. The interactive session retains that permission for the directory, including after switching to an Issue. A project setting added by the PR alone does not grant permission.
workflow_system_commands:
custom_scripts: true
name: approval-command
steps:
- name: check
kind: system
system_inputs:
- type: command
as: approval
command: node scripts/check-approval.mjs
timeout_ms: 1000
output: json
wait:
until: when(context.check.approval.json.ready == true)
interval_ms: 1000
max_retries: 30
on_timeout: ABORT
rules:
- condition: when(context.approval.json.status == "approved")
next: consume
- condition: when(true)
next: ABORT
- name: consume
instruction: "Approval: {context:check.approval.json.status}"
rules:
- condition: when(true)
next: COMPLETE
timeout_ms is required: an integer from 1 through 2147483647, with no default or unlimited setting. output: json is optional. YAML cannot set cwd; commands run in the task execution directory (the clone for a worktree task). Pipeline and interactive modes behave identically. Command effects are not supported.
Results expose exit_code (null if no exit code is available), timed_out, stdout, and stderr. json is present only when requested, exit code is 0, no timeout occurred, and stdout parses as JSON. Nonzero exits and timeouts are results for rules. Combined stdout and stderr exceeding 65536 bytes, a spawn failure, or invalid JSON on a successful JSON command fails the step before effects or rules run.
During condition evaluation, current command bindings also support context.approval...; an existing step scope with the same name takes precedence. Persisted contexts and later instructions use the full context.check.approval... scope.
TAKT does not expand command placeholders or append arguments. TAKT_PREVIOUS_RESPONSE_FILE points to the immediately previous response body, or an empty file when absent. TAKT_PREVIOUS_STRUCTURED_OUTPUT_FILE is set only when that same response has structured output. Scripts read and validate these private files. Files remain under the run context as run artifacts. The environment contains only the command gate base allowlist plus these two file paths.
No inactivity timeout applies. On POSIX, timeout or cancellation sends SIGTERM to the process group, followed by SIGKILL after 100ms if needed. On Windows, it force-terminates the process tree with taskkill /T /F and waits for taskkill to complete. Each wait check reruns the command with a fresh timeout_ms deadline and the same previous response. A subsequent system step sees the previous system response. JSON from an older attempt is not retained. Existing wait.max_retries, on_timeout, step counting, loop_monitors, and agent session continuation rules apply.
effects executes engine-side actions: commit_and_push, caccia, enqueue_task, comment_pr, sync_with_root, resolve_conflicts_with_ai, merge_pr, close_pr. Each effect type may appear at most once per step, and results route via when(effect.<step>.<type>.<field>):
- name: prepare_merge
mode: system
effects:
- type: sync_with_root
pr: "{context:route_context.selected_pr.number}"
rules:
- condition: when(effect.prepare_merge.sync_with_root.success == true)
next: merge_pr
- condition: when(effect.prepare_merge.sync_with_root.conflicted == true)
next: resolve_conflicts
A merge_pr effect can supply head_sha as a template reference to the verified commit. The PR clone HEAD must equal that SHA. TAKT asks GitHub to merge that same SHA.
delay_before_ms waits the given number of milliseconds before the step executes — useful for polling loops such as wait_before_next_scan in the builtin workflow.
System steps pair with agent-step structured_output. An agent step declares structured_output: { schema_ref: <name> }, where <name> references the top-level schemas: map, and its validated output is available to rules as when(structured.<step>.<field> ...) and to effects as {structured:step.field}. structured_output itself belongs on agent steps, not system steps.
Steps can generate report files in the report directory. These are separate examples.
To reference a format in the report_formats map:
output_contracts:
report:
- name: 00-plan.md
format: plan
To define the format inline:
output_contracts:
report:
- name: 00-plan.md
format: |
# Plan
...
To produce multiple reports:
output_contracts:
report:
- name: 01-scope.md
format: scope
- name: 02-decisions.md
format: decisions
Phase 2 uses the provider’s existing readonly settings to read only the evidence needed for the report. The current Phase 1 execution record is saved as masked JSONL and passed by path and byte size. Long strings span multiple lines so the agent can search and read nearby evidence. Phase 2 must not modify files, run tests or builds, start new investigations, or add findings, judgments, or plans. Reports distinguish checks performed in Phase 1 from material read in Phase 2. TAKT saves the final response body to the report file. Phase 3 remains tool-free.
Every report entry requires name and format. Two optional fields refine behavior:
use_judge (default true) — whether the report is fed into the Phase 3 status judgment. Set use_judge: false for reports that should be written but not used as judgment evidence. A step whose rules need judgment must keep at least one use_judge report.order — a report-format facet reference (resolved like format) whose content replaces the default report-writing instruction in Phase 2. Use it when the agent needs custom directions for producing the report beyond the format template itself.An agent step, workflow_call, or parallel parent/sub-step can declare report inputs from another step in the same workflow:
- name: follow-up-review
input_reports:
from_step: remediation
reports: [fix-plan.md, fix-report.md]
persona: reviewer
instruction: |
Review the completed repair against this plan:
{report:fix-plan.md}
And this result:
{report:fix-report.md}
reports: all selects all reports produced by the source’s completed execution, including selected parallel reviewers and nested calls. An explicit list selects those public report file names and rejects missing or ambiguous matches. {report:filename} inserts a selected report’s body at that position, even when another report with the same name exists in the consumer’s local or ancestor scope. If reports: all selects several reports with that name, a single {report:filename} is ambiguous and fails. Selected reports without a placeholder are appended to the agent’s Phase 1 instruction. Names selected across declared producers must be unique, including reports: all and optional unrun sources; doctor and runtime reject ambiguous declarations even without a placeholder. A workflow_call passes the same selected inputs to its child agents, including through nested calls. A parallel parent’s declaration applies to its children unless a child declares its own inputs. A missing, incomplete, or unrelated report fails the step; TAKT does not search neighboring report directories. Use optional_if_unrun: true only when a valid route reaches the consumer before its source has executed. Before the source runs, its contracted report names are reserved, so {report:filename} cannot fall back to an unrelated local or ancestor report of the same name. Once the source starts, its reports are required.
fallback_from_step selects a completed report from another step with the same report contract only while from_step has not run. An incomplete or missing report after the primary source starts still fails. previous_only: true with the consumer’s own step as from_step selects the latest completed report before the current execution. It marks an absent previous version as unavailable. previous_only requires explicit report names and cannot be combined with fallback_from_step or optional_if_unrun.
Multiple producers can be declared as a nonempty array. The single-object form remains supported. Each entry independently applies optional_if_unrun and history:
input_reports:
- from_step: remediation
reports: [fix-plan.md, fix-report.md]
history: {previous: 2}
- from_step: adjudicate
reports: [review-resolution.md]
optional_if_unrun: true
{report:filename} inserts at most 8,000 UTF-16 code units of the current body. Longer bodies include an omission notice and the exact immutable version path for reading the remainder. The immutable path and execution identity of completed reports are supplied regardless of body length. This code constant also applies to automatically appended current reports; it is not configurable in YAML.
history: {previous: N} selects up to N completed executions before the current execution from the same producer and execution lineage. N is a nonnegative safe integer; zero selects no previous executions. {report_history:filename} inserts an oldest-first list, never past bodies. Every row gives the execution identity, order, completion status, producer, and immutable version path. Plans and reports from the same execution share its identity. All selected rows are supplied, with no additional list limit. Insufficient history, incomplete executions, and missing reports are identified; gaps are not filled with unrelated or older versions. Parallel execution, nested calls, and resume preserve these identities and versions. Old runs without execution records have unavailable history; timestamps are not used to infer it. Unreferenced declared history is appended automatically.
A completed public report from an old run without execution records still supplies its body. TAKT marks the original completed execution version and ID as unavailable. A path created for a long body is labeled as a snapshot for this input, separate from a version fixed by the original execution.
Inputs requesting history also include current execution records. Start and completion orders use a counter shared by the execution lineage. Alongside the call execution identity, each report’s actual producer has its own start and completion orders, allowing comparison of verification start against repair completion. Missing orders are marked unavailable.
loop_monitors[].judge.input_reports accepts the same forms and history options. Every from_step must belong to that monitor’s cycle; doctor and runtime reject outside sources. A judge with declared inputs receives Report Directory, current bodies, and history using the same expansion rules. A judge without the declaration keeps its existing input.
Workflow promotion only advances the ladder selected by runtime.yaml. Each entry must be the
strict {at: N} shape; provider, model, provider-options, and condition fields are rejected at
load time. The matching count selects the next stage from the runtime target’s ladder.
steps:
- name: review
persona: reviewer
promotion:
- at: 3
- at: 6
Define the provider/model/options for each stage in runtime.yaml, not in the workflow.
Promotion is not supported on parallel sub-steps.
| Option | Default | Description |
|---|---|---|
description |
- | Free-form description of what the step does. Optional for normal steps, workflow_call, and static parallel sub-steps. Required for dynamic parallel pool candidates and passed to the selector as the candidate’s role |
selection_hint |
- | Optional field allowed only on dynamic parallel pool candidates. Describes selection criteria when the candidate’s role alone does not make clear when to select it. The selector uses both description and selection_hint. Setting it on any other step or sub-step causes a load-time error |
persona |
- | Persona key (section map, or bare facet name resolved project → user → builtin) or file path |
persona_name |
- | Display name for logs and prompts. It does not affect provider_routing.personas |
session_key |
- | Explicit session key for normal agent steps and parallel sub-steps. The resolved provider is appended to the runtime key; empty and whitespace-only values are invalid |
session |
continue |
Session handling for normal agent steps and parallel sub-steps. continue resumes the saved persona session, including in worktree clones within the same run for the same provider and model. Sessions are isolated from other clones and the project root. A new attempt in an existing clone through retry, requeue, or instruct starts each persona fresh, then resumes its new session on later steps. Provider fallback does not resume saved sessions. refresh starts without resuming, and compact resumes then asks the provider to compact before Phase 1. compact runs only before Phase 1, not before report or status phases. Providers without a compaction capability continue unchanged. If compaction fails, Phase 1 does not run and the saved session is discarded |
requires_user_input |
false |
Marks a normal agent step as capable of waiting for user input. System steps, workflow-call steps, and parallel parent steps cannot set it. A step with requires_user_input: true requires interactive mode and a user input handler before the agent runs; otherwise the workflow aborts without executing that agent. The actual wait is triggered only by a matching rule with requires_user_input: true |
tags |
- | Ordered provider routing tags matched against provider_routing.tags in config |
policy |
- | Policy key or array of keys (section map, or bare facet name resolved project → user → builtin) |
knowledge |
- | Knowledge key or array of keys (section map, or bare facet name resolved project → user → builtin) |
instruction |
- | An instruction key, inline text, or a non-empty ordered array of them. Facet references resolve through the section map or, for bare names, project → user → builtin |
edit |
- | Whether the step can edit project files (true/false). With TAKT-managed Codex permissions, explicit false prevents writes in Phase 1 while network_access independently controls network access |
companion |
- | Run companion reviewers for a normal agent or Team Leader step using their resolved runtime profiles (see Companion reviewers) |
completion_retry |
- | Opt into bounded review completeness checks with an object containing the required retry_instruction facet and optional retry bounds |
pass_previous_response |
true |
Pass previous step’s output to {previous_response} |
capabilities |
- | Capability preset name or list. Resolves allowed tools, network access, sandbox, and skills; it does not select a provider or model |
mcp_servers |
- | Per-step MCP server configuration (stdio / HTTP / SSE) |
allow_git_commit |
false |
Allow git add / commit / push in step instructions. Default prohibits these so each PR represents one task |
required_permission_mode |
- | Required minimum permission mode: readonly, edit, or full |
output_contracts |
- | Report file configuration (name, format) |
quality_gates |
- | Agent-step completion gates. String entries are AI instructions; type: command entries are executed after step completion and feed failures back into the same agent step |
completion_retry is an explicit object-only opt-in. Omit the field to disable it. The object requires retry_instruction, an instruction facet that tells the reviewer how to close gaps without changing the scope or authority of its original instruction; min_retry is an optional non-negative integer bounded by 4, while max_retry is an optional non-negative integer. When max_retry is omitted, it defaults to the internal ceiling of 4 (min_retry defaults to 0): after min_retry has been satisfied, the completion judge can stop the episode early by returning complete: true, and incomplete results are retried up to that ceiling. An explicitly supplied max_retry takes precedence and may be any non-negative integer, including values above 4. true, false, strings, an empty object, and unsupported fields such as mode are rejected. Each successful reviewer response is checked by a fresh completion judge against the actual original reviewer instruction, task, scope, evidence, and report, using the judge’s resolved runtime profile. Reviewer retries continue the same reviewer session. Judge unavailability stops the episode immediately regardless of min_retry, while reviewer retry failures continue only while retry budget remains. On a terminal failure, TAKT preserves the latest valid reviewer response and emits an advisory Phase 2 diagnostic. When an incomplete decision reaches the retry ceiling, the max_retry_reached diagnostic retains the remaining missingObligations.
review_completion remains accepted as a deprecated alias. Do not specify it together with completion_retry.
Provider and model are not workflow fields. Runtime profiles and routing in runtime.yaml supply
them; CLI/env overrides remain available. A workflow that writes these removed fields fails at the
load boundary with a migration hint.
The effective tool list may be narrower than configured. When edit: false, or when a step has output_contracts and does not set edit: true, TAKT removes file-editing tools from provider_options.*.allowed_tools before calling the provider. For Claude-family providers, comma-separated entries are normalized into atomic tool specs first, and tools are judged by the canonical tool name before (. Edit, Write, Apply_Patch, and Patch are removed; Bash and Bash(...) remain available. OpenCode likewise removes editing tools such as edit and write while retaining bash. Pi’s default tools for edit: false and readonly mode include bash, but not edit or write. The same read-only filtering applies to team_leader.part_allowed_tools when the part’s effective edit setting is false, such as part_edit: false or inherited edit: false.
The Pi provider maps generic Read, Glob, Grep, Edit, Write, and Bash names to Pi SDK tools. Pi does not support TAKT MCP servers or structured output; step-level MCP settings are dropped, while session-level MCP settings require a provider that supports them. max_turns is ignored for Pi calls.
With TAKT-managed Codex permissions, an explicit edit: false prevents writes in Phase 1 regardless of the resolved permission mode. With network_access: true, TAKT passes a read-only permission profile that enables network access; otherwise it uses the read-only sandbox. With permission_control: codex, Codex’s own settings determine both permissions, even with edit: false. Each team leader part (via part_edit or inherited edit), parallel sub-step, and step within a workflow_call child workflow uses its own effective edit setting. Phase 2 and TAKT internal calls running with strict-readonly (such as isolated structured calls) remain managed by TAKT even with delegated permissions. Without readonly_permission_base, they use the read-only sandbox and disable network access; with it, TAKT uses a permission profile that extends the base with read-only filesystem access and network disabled. Common permission resolution and other providers keep their existing behavior. See Codex permission control.
TAKT-managed Codex calls also pass --ignore-rules for writable steps and for new and resumed sessions, so user or project execpolicy .rules cannot bypass the configured sandbox. Delegated Codex calls retain those rules except in Phase 2 and TAKT internal calls running with strict-readonly (such as isolated structured calls), which always disable them and prohibit writes and network access. A selected config_profile continues to apply alongside --ignore-rules in Phase 2 and these internal calls. When readonly_permission_base is set, TAKT also omits --sandbox.
Top-level workflow fields that control overall execution behavior.
max_stepsThe iteration budget for the run: a positive integer, or infinite for workflows that are meant to run as endless loops (e.g. the builtin auto-improvement-loop). The budget is owned by the root workflow and shared by every workflow called from it; callable subworkflows may not declare their own max_steps.
max_steps: infinite
schemasA map from structured_output.schema_ref keys to structured-output schema names. Each name resolves to <name>.json in project .takt/schemas/, then ~/.takt/schemas/, then the bundled schemas/ directory. A schema_ref that is not in the map is used directly as the schema name.
schemas:
followup-task: followup-task
pr-followup-task: pr-followup-task
auto_routing, provider/model defaults, provider options, and routing are not workflow YAML
fields. Provider/model/options and routing are owned by runtime.yaml (with the existing
config.yaml legacy mode and CLI/env overrides preserved). rate_limit_fallback remains a
legacy config.yaml setting and is not a workflow YAML field. Workflow capabilities remains
the only provider option surface in workflow YAML.
workflow_config.provider, workflow_config.model, workflow_config.provider_options, step
provider, model, provider_options, loop_monitors.judge provider settings, and
workflow_call.overrides are rejected. Move execution settings to runtime.yaml. The
workflow_config.runtime.prepare process-preparation block remains supported.
capabilitiescapabilities names one or more provider-options presets that grant a step its abilities: tool allowlists, network access, sandbox, and skills. It is the reference-only form of provider_options — the value is a preset name (or a list of names), never an inline options block, and only capability leaves (allowed_tools / network_access / sandbox / skills) are accepted. A preset carrying a quality or machine leaf (effort, base_url, guards, …) fails fast at load time; those belong in runtime.yaml.
The key is available at the workflow top level (the default for every step), on a step, and on a parallel sub-step. A step’s own capabilities replaces the workflow default rather than merging with it. A list merges its entries left to right, so a later name wins on a leaf both declare:
capabilities: readonly
steps:
- name: implement
capabilities: [edit, enable-skills]
Presets resolve exactly like provider_options.extends (project → global → builtins, with repertoire package scoping). The bundled presets are readonly (read, search, shell, and web lookup plus network access), edit (readonly plus file creation and editing), and enable-skills (Codex repo/user skills). An unresolved name fails fast. system and workflow_call steps reject capabilities.
repository_identityrepository_identity: true names the project’s repository for gh and glab in a task that runs in a clone (worktree: true), which has no origin remote for them to read. TAKT passes GH_REPO or GITLAB_REPO to this workflow’s agent steps, command quality gates, and system command inputs; no remote and no credential is added.
repository_identity: true
It is off by default, so a workflow that does not operate on the repository gets nothing. Each workflow decides for itself: a called workflow neither inherits the caller’s declaration nor loses its own. Nothing is named for a task that runs in the project root, and a variable you set yourself is never overridden. The variables, the host rules, and the GitHub / GitLab detection are in Repository identity in clones.
workflow_config.runtimeRuntime prepare scripts that run before workflow execution. Builtin presets node / gradle are always allowed. Custom script paths require workflow_runtime_prepare.custom_scripts: true in config.
workflow_config:
runtime:
prepare: [node, gradle, ./custom-script.sh]
The node / gradle presets isolate caches and temporary directories but do not install runtimes or select their versions. A custom script can pass environment variables, including PATH, to subsequent provider executions by writing KEY=value or export KEY=value to stdout.
If required verification remains impossible because of an environmental constraint that task-scope code changes cannot resolve, builtin supervise workflows abort with BLOCKED instead of treating the missing verification as an implementation defect and returning to a fix loop.
loop_monitorsDetect cyclic patterns between steps (e.g. review → fix → review repeating indefinitely) and let an AI judge whether progress is being made:
loop_monitors:
- cycle: [review, fix]
ignore_steps: [verify]
threshold: 3
judge:
persona: supervisor
instruction: "Evaluate if the fix loop is making progress..."
rules:
- condition: "Progress is being made"
next: fix
- condition: "No progress"
next: ABORT
ignore_steps excludes intermediate steps from cycle matching. Use it when a logical cycle has optional verification or retry steps; an ignored step cannot also appear in cycle.
loop_monitors.judge does not accept provider, model, or provider-options settings. It uses the
runtime target provider.targets.internal_agents.loop-judge when configured, otherwise the normal
runtime routing and triggering-step fallback.
Loop-monitor judges always use a fresh provider session. session_key is therefore not accepted on loop_monitors.judge.
Rate-limit fallback is also configured in runtime.yaml (or the existing global/project
config.yaml legacy mode), never in workflow YAML.
subworkflowDeclare a workflow as a subworkflow that accepts parameters from a parent’s workflow_call. Subworkflows are not selectable from the workflow UI.
subworkflow:
callable: true
visibility: internal
params:
impl_knowledge:
type: facet_ref[]
facet_kind: knowledge
default: []
supervisor_persona:
type: facet_ref
facet_kind: persona
default: supervisor
reviewer_suite:
type: workflow_ref
default: peer-review-suite-base
Builtin callable workflows should omit max_steps because the root workflow owns the budget for the complete call tree. Keep max_steps on the standalone root wrapper when the shared implementation also needs a direct entry point; the callable child is intended to be entered through workflow_call.
Callable workflow facet parameters use facet_ref or facet_ref[] and one of the five facet_kind values: policy, knowledge, instruction, persona, or report_format. A workflow_ref parameter identifies a callable workflow and omits facet_kind; it may be used as call: { $param: reviewer_suite }. A facet_pool_ref parameter also omits facet_kind and identifies a scalar key in the callable child’s top-level facet_pools map; it may be used as dynamic_facets.pool: { $param: implementation_pool }. A companion_ref[] parameter likewise omits facet_kind and supplies fixed companions through companion: { $param: implementation_companions } on a normal agent or Team Leader step. An empty array omits companion and rejects any remaining unquoted companion.* state reference; literal empty companion selections remain invalid. Defaults are optional. A facet_ref[] argument or default may be empty, which is useful for optional additions. In policy and knowledge, scalar or list parameters can be mixed with fixed references; list values are flattened at their position while preserving the field’s written order. Parameters can also be forwarded through workflow_call.args. For facet_pool_ref, a missing required argument, a list value, an unknown child-local pool, or an unexpanded $param fails before execution; there is no implicit pool fallback. For companion_ref[], a non-array argument, an undeclared parameter, or an unknown companion definition fails before execution.
For instruction, a non-empty ordered array may mix facet refs and inline text; facet_ref / facet_ref[] parameters can be array items, and facet_ref[] values are flattened at their position before the resolved elements are joined with \n\n---\n\n.
name: simple-impl
max_steps: 5
personas:
coder: ../facets/personas/coder.md
steps:
- name: implement
persona: coder
edit: true
required_permission_mode: edit
capabilities: edit
rules:
- condition: Implementation complete
next: COMPLETE
- condition: Cannot proceed
next: ABORT
instruction: |
Implement the requested changes.
name: with-review
max_steps: 10
personas:
coder: ../facets/personas/coder.md
reviewer: ../facets/personas/architecture-reviewer.md
steps:
- name: implement
persona: coder
edit: true
required_permission_mode: edit
capabilities: edit
rules:
- condition: Implementation complete
next: review
- condition: Cannot proceed
next: ABORT
instruction: |
Implement the requested changes.
- name: review
persona: reviewer
edit: false
capabilities: readonly
rules:
- condition: Approved
next: COMPLETE
- condition: Needs fix
next: implement
instruction: |
Review the implementation for code quality and best practices.
personas:
planner: ../facets/personas/planner.md
coder: ../facets/personas/coder.md
steps:
- name: analyze
persona: planner
edit: false
capabilities: readonly
rules:
- condition: Analysis complete
next: implement
instruction: |
Analyze this request and create a plan.
- name: implement
persona: coder
edit: true
pass_previous_response: true
required_permission_mode: edit
capabilities: edit
rules:
- condition: Implementation complete
next: COMPLETE
instruction: |
Implement based on this analysis:
{previous_response}
Add companion to an agent or Team Leader step for read-only reviewers. A list names fixed reviewers; the object form combines fixed reviewers, a candidate pool, and an optional moderator. At most three reviewers run together. Enable them with companion.enabled: true in runtime.yaml.
- name: implement
persona: coder
companion:
fixed: [security-reviewer]
pool: [design-reviewer, frontend-reviewer]
moderator: adjudicator
rules:
- condition: implementation complete
next: final-review
Set the review timing with companion.review_mode in global or project runtime.yaml. The default, completion, reviews the implementer’s response before the workflow advances. live reviews changes and commits during execution, after a quiet period or forced interval, and at completion.
Set how fixes proceed with companion.fix_policy. The default, single, gives the implementer at most one opportunity to fix accepted findings without reviewing that fix again. loop repeats review and fixes until no new findings are accepted; it has no round limit. The implementer can decline a finding with an explanation. Neither setting can be overridden per step.
In a Team Leader step, each part is reviewed after its response, followed by a review of the whole Team. With single, accepted Team findings lead to at most one correction batch. With loop, Team review and corrections repeat until no new findings are accepted.
Companion findings and failures are advisory. Ordinary conditions and Phase 3 determine workflow routing; rules cannot refer to companion.* state. A configured moderator decides whether to accept each submitted finding. Accepted findings are recorded in .takt/runs/{run}/companion/{step}/{companion}.jsonl. If a fix follow-up encounters an ordinary provider error, the step continues with the last successful implementer response. A user interruption stops execution.
Companion definitions resolve from .takt/companions/, ~/.takt/companions/, then builtins/{language}/companions/. They accept name, description, facet references (persona, policy, knowledge, instruction), and a positive integer interval_ms up to 2,147,483,647.
edit: false for review steps to prevent reviewers from modifying code. When delegating permission control to Codex, also disable writes in Codex itself.takt eject <workflow> and editing it.During PR fixes and merges, TAKT matches the wait target against the head SHA after a push. It also passes the clone’s latest head SHA to merge with --match-head-commit, so a different commit is not merged if the PR head changes after CI. See the GitHub CLI manual for that option.
Set source: current_pr on a pr_status input to get the PR’s number, headSha, ci.finished, ci.passed, mergeable, mergeStateStatus, reviewDecision, and merged values. ci.finished remains false until all checks and status contexts settle. CheckRun SUCCESS, NEUTRAL, and SKIPPED, and StatusContext SUCCESS, count as passing. TAKT waits when there are no checks yet.
A PR status fetch times out after 15 seconds. A timed-out fetch during wait counts toward max_retries and is followed by another attempt. CLI failures or invalid responses are errors.
- name: wait_ci
mode: system
system_inputs:
- type: pr_status
source: current_pr
as: status
wait:
until: 'when(context.wait_ci.status.ci.finished == true)'
interval_ms: 15000
max_retries: 120
on_timeout: comment_timeout
rules:
- condition: when(true)
next: evaluate
Use wait on a system step. until is a when(...) condition, and on_timeout names the next step if retries run out. TAKT fetches the status immediately, then defaults to another fetch every 15 seconds for up to 120 retries. The intervals total 30 minutes, plus fetch time. Set interval_ms to a positive integer up to 2,147,483,647, and max_retries to a nonnegative integer. When the condition succeeds, TAKT runs the effect once; after the limit, it follows on_timeout. wait also works with system inputs other than CI.
The commit_and_push effect accepts pr, commits changes in the PR clone, and pushes to the head remote. It creates no commit when nothing changed and returns success: false with error on failure. sync_with_root and resolve_conflicts_with_ai use the same clone.
The merge command checks fork threats before starting the workflow, whether a PR number is given or discovered. It skips that check for a same-repository PR. When a threat is detected or cannot be assessed, TAKT comments with the reason and does not start the workflow. Git fetch and push and provider tools use the normal configuration.
merge-review runs review and the Caccia effect and comments on the PR with CI results and its assessment. merge-review-fix synchronizes and runs review-fix after every AI conflict resolution, on both initial synchronization and resynchronization. A clean sync skips the full review. Both paths then push changes, run the Caccia effect, check CI and review state, and merge. An aborted review stops the merge and is reported in a comment. CI failures enter the recovery process described below.
The default takt merge workflow, merge-review-fix-simple, synchronizes the PR with its base branch. A clean sync skips the full review and proceeds to push; every AI conflict resolution calls review-fix-simple, on both initial synchronization and resynchronization. After gathering context, one read-only reviewer uses facets suited to the changes. Separate steps adjudicate findings, plan and apply fixes, verify completion, and review again. The review path also completes the final requirement check before joining the shared flow: push changes, run the Caccia effect, check CI and GitHub review and mergeability on its returned head, then merge. An aborted child workflow stops the merge and produces a PR comment. CI failures enter the recovery process described below. Select merge-review-fix for parallel specialist reviews.
After synchronization, merge-prepare and merge-review-fix-simple review the entire cumulative PR diff and incoming base-branch changes. They fix only incorrect conflict resolution and defects caused by combining the two sides, including defects in non-conflicted files. Pre-existing issues unrelated to synchronization are recorded with reasons and carried forward without triggering fix planning, implementation, or rejection at the final check. Clean synchronization still skips the full review, and normal development review and adjudication criteria remain unchanged.
merge-review-ci is opt-in. Its first system step reads the existing pr_status and requires both ci.finished and ci.passed before calling merge-review through workflow_call. Success follows the existing definition, including SUCCESS, NEUTRAL and SKIPPED. Pending, failed or absent checks end COMPLETE without review, Caccia or evaluation comments. This initial check does not wait or retry and adds no configuration or CLI options.
takt merge 123 --workflow merge-review-ci
takt merge --workflow merge-review-ci
takt merge --workflow merge-review-ci --include-forks
For review and comments without code changes, commits, pushes or merges, use the existing .takt/config.yaml setting:
caccia:
enabled: false
After the gate, the existing merge-review owns review, Caccia, its later CI check, evaluation and TAKT evaluation: approved={true|false}. {reason} comments. Its COMPLETE or ABORT result is preserved. Fork selection and the threat check before the workflow remain unchanged: bulk runs exclude forks unless included, while an explicit number bypasses selection conditions but still runs the threat check. Rejection keeps the existing stop comment. merge-review, merge-review-fix and merge-review-fix-simple retain their direct execution behavior and defaults.
merge-review-fix and merge-review-fix-simple resynchronize with the base branch when CI completes and the PR is CONFLICTING, resolving conflicts when needed. On both initial synchronization and resynchronization, a clean sync skips the full review and continues through push → Caccia → CI on the new HEAD → merge evaluation. Every AI conflict resolution is followed by review and fixes before push. A PR that is only BEHIND proceeds to the existing review and merge conditions without resynchronization. The limit is max(2, runtime concurrency - 1): two resynchronizations at concurrency 2 or 3, and three at concurrency 4. Initial synchronization does not count. Runtime concurrency, including a CLI --concurrency override, is saved with the task and retained by Requeue and Retry. If the PR is still conflicting at the limit, TAKT comments with the reason and ends ABORT without merging. Resynchronization preserves the CI fix and rerun budgets already used.
Before rerunning, TAKT fetches the current PR HEAD and rejects evidence for a different HEAD. If the HEAD changes after a rerun is accepted, recovery leaves the wait immediately, preserves the original HEAD’s failed checks and logs, and comments with the HEAD mismatch before aborting. pr_status system inputs always expose rerunHeadChanged and rerunHeadChangeReason; ordinary polling returns false and an empty reason. Run identity, repository and attempt checks still apply.
comment_pr accepts optional body_format: plain_text. It encloses the entire interpolated body in a code block whose backtick delimiter is longer than any backtick sequence in the body. CI recovery stop and push-failure comments use this format so check/job names, investigation summaries and errors remain literal text. Without this option the body is passed through as Markdown.
For recovery, pr_ci_failure takes source: current_pr and a full head_sha state reference. It returns number, headSha, complete, failed checks with run/attempt/job identifiers and log contents, unavailable reasons, fixRounds, rerunCount, and scalar details for comments. A job cancelled mid-execution in the same failed run with empty --log-failed output stays in checks with cancelledBySibling: true and does not count as missing evidence only when it has no failed steps (every step concluded as success, cancelled, skipped, or neutral), a failed sibling job’s completion timestamp falls between this job’s start and completion times, the job’s Check Run annotations confirm a fail-fast cancellation, and a failure log was collected for that sibling; any other cancellation whose cause cannot be verified remains in unavailable. Failed checks with no Actions log, such as commit statuses and third-party checks, are listed in external; they remain failed, but do not make the other checks’ evidence incomplete. complete is false when evidence that should exist is listed in unavailable, or when no Actions check is left to judge. The rerun_ci effect takes pr and a full failure reference. It requires complete evidence and an external investigation verdict, deduplicates failed runs, and reruns failed jobs once. Its rerun result stores the PR, HEAD and previous attempts; pass its full reference as pr_status.rerun_from to wait for newer attempts. Before the rerun step executes, this optional reference leaves ordinary polling in place. Fix and rerun counters belong to the same workflow execution.
On GitHub, the effect checks unresolved threads started by coderabbitai after verifying the starting head. If no matching threads exist, it returns skipped with skipReason: no_review_threads without waiting for a review. The merge workflow continues to wait_ci, which waits for CI on the returned head. With matching threads, the existing review loop runs. Standalone takt caccia and automatic post-PR Caccia retain their initial review waits.
The built-in merge and review workflows set pr_status.recheck_caccia_from to the name of the Caccia step. When Caccia succeeded or skipped with no_review_threads, this input checks for unresolved threads again after CI passes for the same head and the PR can proceed. If hasLateCodeRabbitReviewThreads is true, the workflow returns to Caccia and waits for CI on the new head if Caccia pushes a fix.
If a recheck times out, the workflow retries within the existing CI wait limit. If the PR head changes during the thread lookup, the workflow fetches the PR status again. A status response that still reports the old head also consumes a CI wait retry.
The effect requires a matching isolated PR execution context from takt merge or an enqueue_task mode: from_pr task. pr accepts a positive integer or a full template reference; it cannot be an embedded string. The effect reads the existing caccia.enabled, wait_timeout_ms, max_iterations, and workflow settings. Disabled or unset configuration skips the CodeRabbit review wait. Standalone takt caccia <PR> remains available regardless of enabled.
Before execution on GitHub, the effect compares the PR head with the clone’s starting HEAD. On a mismatch it fetches PR details every 2 seconds for up to 60 seconds, including fetch time. Inconsistent head observations within a PR details fetch also trigger a retry within the same deadline. It continues only when the expected SHA matches; a mismatch at the deadline returns an error containing the expected SHA and the last observed SHA. If the last observation was inconsistent, both conflicting SHAs are included. PR identity changes, other fetch errors including authentication failures, and cancellation fail immediately. When execution metadata and a push recorder are present, the same check runs before recording a skip, so disabled or unset configuration may still wait for GitHub head propagation. This fixed wait is separate from the review wait controlled by wait_timeout_ms. It does not apply to non-GitHub skip checks or head verification after execution.
- name: caccia
mode: system
effects:
- type: caccia
pr: "{context:identify.pr.number}"
rules:
- condition: when(effect.caccia.caccia.success == false)
next: error_comment
- condition: when(effect.caccia.caccia.outcome == "limit")
next: limit_comment
- condition: when(true)
next: wait_ci
Normal results include success: true, failed: false, outcome (success, skipped, or limit), headSha, unresolvedCount, skipReason, and reason. Unused reason fields are null. Read them through effect.<step>.caccia.* in conditions or {effect:<step>.caccia.<field>} in templates. Skip reasons are config_disabled, github_unavailable, no_review_threads, initial_review_unavailable, review_rate_limited, and review_skipped. Failures return success: false, failed: true, and error; no head is guaranteed on failure. Check failure before reading normal fields.
After a repair push, the same clone is synchronized with a verified fast-forward. CI should compare PR status head with effect.caccia.caccia.headSha; merge uses the clone’s current head as its expected SHA. Historical push effect results remain unchanged.
GitLab also provides MR details and CI status, so skipped with github_unavailable continues to CI on the returned head. Merge methods and head constraints remain unsupported; merge_pr fails when either is supplied.
The merge builtins execute Caccia explicitly: merge-review runs review → caccia → wait_ci → evaluation comment, while merge-review-fix and merge-review-fix-simple run sync → commit_and_push → caccia → wait_ci → merge_pr. When AI resolves conflicts, review and fixes run before commit_and_push on both initial synchronization and resynchronization. success and skipped continue to CI on the returned head. limit comments with the unresolved thread count and ends ABORT without merging. An effect error comments with error and ends ABORT. Git push itself does not start Caccia. Automatic post-PR Caccia follows the enablement, exclusion, and ordering rules in the configuration reference.
merge-review-fix and merge-review-fix-simple investigate every completed CI failure using failed checks, run/attempt/job references, log contents, the cumulative PR diff and related code. Repository defects (including flaky tests and failures also present on main) receive a root fix and read-only review, followed by push → Caccia → CI, for at most two rounds. Only an evidenced external cause permits one CI rerun, independently of the fix budget, including after both fix rounds. The workflow waits for the new attempt on the same HEAD and rechecks all checks and existing merge conditions. Missing evidence, a defect after both fix rounds, a rejected fix or a failed rerun stops recovery with a PR comment containing the counts, last failed checks and references, and investigation summary, then ABORT. Investigation and fix reports remain in the run. No CI recovery runs when CI succeeds on the first attempt; CI timeout ends ABORT with unresolved work, and merge-review remains comment-only. GitHub Actions log/rerun permission failures and unsupported providers are reported explicitly.