cc10x Router
Runtime contract only. The router runs trust-first orchestration: route intent, hydrate workflow state, write workflow artifacts, execute the task graph, validate agent output, and fail closed on ambiguity, skipped work, or missing persistence.
1. Intent Routing
A keyword hit only NOMINATES a row; the request's primary deliverable DECIDES the route (e.g. "triage incoming issues" contains issue but its deliverable is triage, so it routes TRIAGE, not DEBUG). When the primary-deliverable test genuinely holds for more than one row, the lower Priority number wins.
| Priority |
Signal |
Keywords |
Workflow |
Chain |
| 1 |
ERROR |
error, bug, fix, broken, crash, fail, debug, troubleshoot, issue |
DEBUG |
bug-investigator -> code-reviewer -> integration-verifier |
| 2 |
PLAN |
plan, design, architect, roadmap, strategy, spec, brainstorm |
PLAN |
exploration -> planner -> bounded fresh review loop |
| 3 |
REVIEW |
review, audit, analyze, assess, "is this good" |
REVIEW |
code-reviewer |
| 4 |
ORIENT |
zoom out, explain, understand, "how does X work", unfamiliar, "map this", "walk me through", "where is", "what does this do" |
ORIENT |
advisory orientation (no agents) |
| 5 |
TRIAGE |
triage, "incoming issues", "look at #", "triage #" |
TRIAGE |
triage-agent → optional exploration → agent-ready brief |
| 6 |
CODEBASE-HEALTH |
"codebase health", "improve architecture", "deepening", "ball of mud", "shallow modules", "architecture audit" |
CODEBASE-HEALTH |
architecture-scanner → HTML report → human picks → exploration (grilling) → feeds PLAN |
| 7 |
DEFAULT |
Everything else |
BUILD |
component-builder → [code-reviewer ‖ failure-hunter] → integration-verifier |
Rules:
- Planning runs through the CC10x PLAN workflow so it gains orchestration state, workflow artifacts, intent contracts, and the bounded fresh review. Native plan mode (EnterPlanMode) is not a substitute for that, but it is not forbidden: if the user invokes it, treat the plan it produces as an input the PLAN workflow ingests (record it as the
plan_file and run the fresh-review gate over it) rather than discarding it. Default to the CC10x PLAN workflow for "plan", "design", "architect", "brainstorm" requests.
- ERROR always wins over BUILD, but route on the PRIMARY DELIVERABLE, not the first keyword hit: "add a dark-mode toggle and fix the button alignment" is a BUILD whose scope includes a small fix, not a DEBUG. Use DEBUG when diagnosing/repairing broken behavior IS the deliverable; use BUILD when the deliverable is new/changed functionality that happens to mention fixing something along the way.
- REVIEW is advisory only. Never let REVIEW create code-changing tasks.
- ORIENT is read-only and advisory. It precedes DEFAULT/BUILD: a "help me understand this code" request must never fall through to BUILD and spawn a write builder. ORIENT spawns NO write agents and creates NO phase graph. If the user follows an orientation with a change request, re-route the new request (BUILD/DEBUG/PLAN) from scratch.
- TRIAGE is advisory-only. It categorizes, verifies, and writes agent-ready briefs for incoming issues/PRs. It never writes code. A triaged issue routes to BUILD or DEBUG only on a fresh user request — TRIAGE never auto-routes into a code-writing workflow. Category and wontfix decisions are high-blast-radius: stop for human input (do not auto-decide). Primary-deliverable rule: TRIAGE applies only when triage/categorization/briefing IS the deliverable (the request contains
triage or incoming issues or look at # / triage #). A request that mentions a bug/issue/feature but asks to implement/fix/change it is BUILD or DEBUG — the primary deliverable is the change, not the triage. Do not route to TRIAGE unless the user explicitly asks to triage.
- CODEBASE-HEALTH is advisory-only upkeep. It surfaces deepening candidates and grills the chosen one. It never writes code. A chosen candidate routes to PLAN only on a fresh user request. The scanner writes a single HTML report to the OS temp dir (not the repo). Primary-deliverable rule: CODEBASE-HEALTH applies only when discovery/advice IS the deliverable (the request contains
codebase health, improve architecture, deepening, ball of mud, shallow modules, or architecture audit). A request that asks to refactor/fix/change specific code is BUILD — the primary deliverable is the change, not the audit.
- BUILD uses a complexity gradient (see
references/build-workflow.md): trivial scope (1-2 files, single change, one testable outcome, no cross-module wiring) runs a reduced builder → verifier → memory graph; everything else, and all planned work, runs the full builder → [reviewer || hunter] → verifier → doc-sync → memory chain. The reviewer and hunter run in parallel (two read-only agents in the same message) and the router merges their findings before verifier handoff. The builder escalates trivial → full on any scope increase. The router is still the sole entry point for every BUILD — the gradient scales the graph to the work, it does not bypass routing.
- Before execution, output one line:
-> {WORKFLOW} workflow (signals: {matched keywords})
ORIENT move (read-only)
Triggered when the user wants to understand existing code, not change it ("zoom out", "explain", "how does X work", "I'm unfamiliar with", "map this", "walk me through", "where is X", "what does this do"). The router answers inline — no TaskCreate, no NEW workflow artifact, no phase graph, no write agents. (Edge case: if an artifact was pre-created before routing resolved — §2a permits early creation with workflow_type: pending — set its workflow_type to ORIENT and phase_cursor to orient, record the close in status_history, and create no phase graph. That is the only reason ORIENT/orient appear in the artifact enums.)
Orientation procedure:
- Map the relevant modules/files for the named subject (use
localViewStructure / localFindFiles / localSearchCode to locate, read only the slices needed to explain).
- Trace ONE layer up: callers and dependents of the focal symbols via LSP call-hierarchy (
lspCallHierarchy) and references (lspFindReferences); run localSearchCode first to get the exact lineHint before any LSP call.
- Explain in the project's OWN vocabulary (names, terms, domain glossary from the code), not generic CS abstractions.
- Stop at understanding. Do not propose or apply edits. If a change is clearly implied, end by offering to route it (BUILD/DEBUG/PLAN) — do not start it.
Distinguish from REVIEW: REVIEW judges quality ("is this good", audit); ORIENT only explains structure and flow. When both could match, prefer ORIENT for "help me understand", REVIEW for "tell me what's wrong".
2. Memory Load And Template Validation
Always run this before routing or resuming:
1. Bash("mkdir -p .cc10x")
2. Read(".cc10x/activeContext.md")
3. Read(".cc10x/patterns.md")
4. Read(".cc10x/progress.md")
Do not parallelize step 1 with reads — the reads assume the directory exists.
If a memory file is missing:
- Create it using the
cc10x:memory-and-handoff template.
- Read it before continuing.
Required sections:
| File |
Required Sections |
activeContext.md |
## Current Focus, ## Recent Changes, ## Next Steps, ## Decisions, ## Learnings, ## References, ## Blockers, ## Session Settings, ## Last Updated |
progress.md |
## Current Workflow, ## Tasks, ## Completed, ## Verification, ## Last Updated |
patterns.md |
## User Standards, ## Common Gotchas, ## Project SKILL_HINTS, ## Last Updated |
Auto-heal rule:
- Insert missing sections before
## Last Updated.
- After every
Edit(...), immediately Read(...) and verify the new section exists.
JUST_GO:
- Read
activeContext.md ## Session Settings.
- If
AUTO_PROCEED: true, set JUST_GO=true.
- While
JUST_GO=true, auto-default AskUserQuestion gates to the recommended option EXCEPT: REVERT, failure-stop gates, destructive finishing options (auto-pick Keep as-is; never merge/push/discard), and plans with unresolved Open Decisions (BUILD may not start). Log each auto-choice in ## Decisions.
Trust rule:
JUST_GO never overrides explicit user/project standards, open plan decisions, or failure-stop gates.
- If a plan still has unresolved
Open Decisions, BUILD may not start, even in JUST_GO.
2a. Workflow Artifact And Hook Policy
Core law:
- Durable router state lives under
.cc10x/workflows/{workflow_uuid}.json
- Companion event log lives under
.cc10x/workflows/{workflow_uuid}.events.jsonl
- Router-owned gates still include
plan_trust_gate, phase_exit_gate, failure_stop_gate, memory_sync_gate, and skill_precedence_gate
Mandatory reference read:
- Before workflow creation, artifact mutation, hook policy changes, or resume logic that depends on artifact fields, immediately read
references/workflow-artifact-and-hook-policy.md.
- That reference contains the verbatim artifact schema, event log contract, hook policy, and gate wording extracted from the prior router monolith. Treat it as load-bearing orchestration law, not optional background.
3. Task Metadata Contract
Every CC10X task description starts with normalized metadata lines:
wf:{workflow_uuid}
kind:{workflow|agent|remfix|memory|reverify|research}
origin:{router|component-builder|bug-investigator|code-reviewer|integration-verifier|planner}
phase:{build|build-implement|build-review|build-hunt|build-verify|build-doc-sync|build-finish|debug|debug-investigate|debug-review|debug-verify|review|review-audit|plan|plan-create|plan-review-gap-1|plan-review-gap-2|triage|codebase-health|memory-finalize|re-review|re-hunt|re-verify|re-plan|research-web|research-github}
plan:{path|N/A}
scope:{ALL_ISSUES|CRITICAL_ONLY|N/A}
reason:{short reason or N/A}
Rules:
- ALL SEVEN metadata lines (
wf:, kind:, origin:, phase:, plan:, scope:, reason:) are present on EVERY CC10X task — use N/A where a field does not apply. The TaskCompleted hook audits exactly this invariant; the task-graph templates already satisfy it.
wf: always carries the generated workflow_uuid (wf-<ts>-<hex>), never a Claude TaskCreate task id. This aligns with the hard rule "never treat stored task IDs as durable truth across workflows."
- Router must generate
workflow_uuid before TaskCreate() and use it from the first write.
kind: drives resume, routing, and counting logic.
origin: on a kind:remfix task names the agent whose findings triggered the fix (never N/A there).
plan: carries the real plan path on workflow, agent, reverify, and memory tasks when a plan exists.
reason: carries a meaningful short reason (not N/A) on remediation and research tasks.
- The router must never depend on loose prose when metadata can answer the question.
4. Resume And Hydration
After memory load:
TaskList()
Hydration rules:
- Find active parent workflow tasks by subject prefix
CC10X BUILD:, CC10X DEBUG:, CC10X REVIEW:, CC10X PLAN:.
- If more than one active workflow exists, scope by the current conversation and matching
wf: markers. Do not resume a workflow you cannot scope confidently.
- Reconstruct runnable tasks from
TaskList() and TaskGet() using wf: + kind: + phase:. Do not rely on stored task IDs for correctness.
- Read and write only the
.cc10x/ state namespace (memory .cc10x/*.md, workflows .cc10x/workflows/*). Ignore any legacy version-segmented layout such as .cc10x/v10/* or .claude/cc10x/* left over from older installs during hydration.
[cc10x-internal] memory_task_id in activeContext.md is only a transient optimization. If it is missing, stale, or points to a different wf:, ignore it and reconstruct the memory task from the current workflow scope. [EASY TO MISS: stale memory_task_id is the #1 cause of cross-workflow pollution]
- Never use an unscoped fallback like "first pending Memory Update task". [EASY TO MISS: unscoped lookups silently pick up orphan tasks from prior workflows]
Resume algorithm:
- If
.cc10x/stop-state.json or .cc10x/precompact-state.json exists (written by the Stop/PreCompact hooks), read it as a HINT for which wf: and phase_cursor were live when the session last ended. It is a hint only — task metadata and the workflow artifact stay authoritative; discard the hint on any mismatch.
- Identify the active parent workflow.
- Extract
workflow_uuid from the wf: line.
- Read all CC10X tasks whose descriptions contain that
wf:.
- Derive runnable tasks from
status and blockedBy.
- Reconstruct the memory task as the unique pending/in_progress
kind:memory task in the same wf:.
Scope-decision resume:
- Before normal routing, check
activeContext.md ## Decisions for a live marker:
[SCOPE-DECISION-PENDING: wf:{workflow_uuid} reason:{...}]
- If present, treat the current user reply as the answer to that pending BUILD scope gate:
critical only -> create the pending REM-FIX with scope:CRITICAL_ONLY
all issues -> create the pending REM-FIX with scope:ALL_ISSUES
- anything else -> ask again with the same two options and stop
- After consuming a valid answer:
- remove the pending marker from
## Decisions
- create the scoped REM-FIX
- block downstream re-review / verifier tasks as normal
- stop after task creation so the next turn resumes from task state, not from repeated prose parsing
- [EASY TO MISS: When persisting user decisions, use the user's exact words. Paraphrasing introduces drift that compounds across resume cycles.]
Safety rules:
- If a task list is shared across sessions, always scope by
wf: before resuming.
- If a task has
status=in_progress and unresolved blockers, treat it as waiting on remediation, not as a free-running orphan.
- If a task has
status=in_progress and no blockers, ask the user whether to resume, delete, or mark complete.
- If legacy tasks exist with subjects starting
BUILD:, DEBUG:, REVIEW:, or PLAN: without the CC10X prefix, ask whether to resume the legacy workflow or start a fresh CC10X workflow.
5. Workflow Preparation
Shared preparation
Before creating a new workflow:
- Read
activeContext.md ## References to discover Plan, Design, and prior Research files.
- Read
activeContext.md ## Decisions for prior planner/build clarifications.
- Read
progress.md ## Current Workflow and ## Tasks for pending work that should resume instead of duplicating.
- Read the latest
.cc10x/workflows/*.json artifact if one exists for the current conversation.
Intent Readiness Gate (MANDATORY before PLAN or BUILD):
Before dispatching to planner or builder, verify the intent contract meets three conditions:
- Context-bounded: The full intent (goal + constraints + acceptance criteria) fits within the agent's prompt scaffold without truncation. If the intent requires loading more than 5 source files to be understood, decompose first (switch to PLAN).
- Contradiction-free: No acceptance criterion contradicts a stated constraint or non-goal. If contradictions exist, halt and persist
pending_gate="intent_contradiction".
- Sufficiently specific: Every acceptance criterion maps to at least one verifiable scenario. If a criterion is unverifiable ("make it better" without a metric), halt and ask for specificity.
Router-owned interface fields:
plan_mode: direct | execution_plan | decision_rfc
verification_rigor: standard | critical_path
checkpoint_type: none | human_verify | decision | human_action
proof_status: passed | gaps_found | human_needed
BUILD preparation
- Before any BUILD-specific readiness decision or child-task creation, immediately read
references/build-workflow.md.
- Use the
### BUILD preparation and ### BUILD task graph blocks in that file as the canonical BUILD law.
DEBUG preparation
- Before any DEBUG-specific readiness decision or child-task creation, immediately read
references/debug-workflow.md.
- Use the
### DEBUG preparation and ### DEBUG task graph blocks in that file as the canonical DEBUG law.
REVIEW preparation
- Before any REVIEW-specific readiness decision or child-task creation, immediately read
references/review-workflow.md.
- Use the
### REVIEW preparation and ### REVIEW task graph blocks in that file as the canonical REVIEW law.
PLAN preparation
- Before any PLAN-specific readiness decision or child-task creation, immediately read
references/plan-workflow.md.
- Use the
### PLAN preparation and ### PLAN task graph blocks in that file as the canonical PLAN law.
- If planner clarification, review-loop findings, or plan remediation rules trigger later in the workflow, also read
references/remediation-and-research.md before continuing.
6. Workflow Task Graphs
Parent workflow creation
Use this pattern for every new workflow:
- Generate a stable workflow UUID before
TaskCreate():
workflow_uuid = "wf-" + UTC timestamp + "-" + 8 hex chars
- Create the parent workflow task with that UUID from the first write:
TaskCreate({
subject: "CC10X {WORKFLOW}: {summary}",
description: "wf:{workflow_uuid}\nkind:workflow\norigin:router\nphase:{build|debug|review|plan}\nplan:{plan_file or 'N/A'}\nscope:N/A\nreason:User request\n\nUser request: {request}\nChain: {chain description}",
activeForm: "{workflow active form}"
})
- Immediately create the workflow artifact and event log. Do NOT hand-type the artifact JSON. Copy the canonical skeleton, then substitute only the live fields:
Bash(command="mkdir -p .cc10x/workflows && cp \"${CLAUDE_PLUGIN_ROOT}/skills/cc10x-router/references/workflow-artifact.skeleton.json\" .cc10x/workflows/{workflow_uuid}.json")
Then Edit the copied file, replacing each placeholder token with the live value (the skeleton ships every required key already populated with safe defaults — you only fill these):
__WORKFLOW_UUID__ → {workflow_uuid} (appears twice: workflow_uuid and workflow_id)
__WORKFLOW_TYPE__ → {WORKFLOW} (BUILD | DEBUG | REVIEW | PLAN | ORIENT | TRIAGE | CODEBASE-HEALTH) — if routing (§5) has not yet determined the workflow type, use pending and update it after §5 resolves. Never hardcode BUILD before routing completes. The artifact may be created before routing (to capture state early), but workflow_type must reflect the actual routed type after §5.
__USER_REQUEST__ → the user request (JSON-escape quotes/newlines)
__PHASE__ → {build|debug|review|plan|orient|triage|codebase-health}
__ISO_TIMESTAMP__ → the current UTC ISO timestamp (appears 3×: status_history[0].ts, created_at, updated_at)
Use Edit(replace_all=true) for __WORKFLOW_UUID__ and __ISO_TIMESTAMP__ since each repeats. Then write the event log:
Write(
file_path=".cc10x/workflows/{workflow_uuid}.events.jsonl",
content="{\"ts\":\"{iso_timestamp}\",\"wf\":\"{workflow_uuid}\",\"event\":\"workflow_started\",\"phase\":\"{build|debug|review|plan}\",\"task_id\":\"{parent_task_id}\",\"agent\":\"router\",\"decision\":\"start\",\"reason\":\"User request\"}\n"
)
Read-back gate (MANDATORY before any child TaskCreate): Read(".cc10x/workflows/{workflow_uuid}.json") and confirm (a) it parses as JSON, (b) workflow_uuid equals the generated UUID, and (c) no __PLACEHOLDER__ tokens remain. If any check fails, fix the file and re-read before proceeding. The PostToolUse artifact guard also validates this write in block mode and will reject a malformed or key-missing artifact — but the router must not rely on the guard alone; confirm the read-back first.
Only create child tasks after the workflow artifact exists and the read-back passes.
BUILD task graph
- See
references/build-workflow.md and apply its ### BUILD task graph block verbatim before creating BUILD child tasks.
DEBUG task graph
- See
references/debug-workflow.md and apply its ### DEBUG task graph block verbatim before creating DEBUG child tasks.
REVIEW task graph
- See
references/review-workflow.md and apply its ### REVIEW task graph block verbatim before creating REVIEW child tasks.
PLAN task graph
- See
references/plan-workflow.md and apply its ### PLAN task graph block verbatim before creating PLAN child tasks.
Marker rules
- BUILD writes
[BUILD-START: wf:{workflow_uuid}]
- DEBUG writes
[DEBUG-RESET: wf:{workflow_uuid}]
- PLAN writes
[PLAN-START: wf:{workflow_uuid}]
7. Dispatcher And Agent Prompt Contract
Explicit dispatcher
| Task Phase / Kind |
Agent |
build-implement |
cc10x:component-builder |
debug-investigate |
cc10x:bug-investigator |
build-review, debug-review, review-audit, re-review |
cc10x:code-reviewer |
build-hunt, re-hunt |
cc10x:failure-hunter |
build-verify, debug-verify, re-verify |
cc10x:integration-verifier |
plan-create, re-plan |
cc10x:planner |
plan-review-gap-1, plan-review-gap-2 |
cc10x:plan-gap-reviewer |
research-web |
cc10x:researcher |
research-github |
cc10x:researcher |
triage |
cc10x:triage-agent |
codebase-health |
cc10x:architecture-scanner |
kind:remfix + origin:bug-investigator |
cc10x:bug-investigator |
build-doc-sync |
cc10x:doc-syncer |
kind:remfix + origin:code-reviewer / origin:integration-verifier / origin:router |
cc10x:component-builder |
Per-role model-tier policy
Model selection comes from agent frontmatter; the router cannot set it per dispatch. Two live rules: (1) never edit a gating agent's (code-reviewer, integration-verifier, plan-gap-reviewer) frontmatter below mid-tier — the cheapest tier rubber-stamps; (2) never downgrade a gating role to save tokens, including under JUST_GO.
ADVISORY — for humans tuning frontmatter; the router cannot act on this table at dispatch time. Tiers are abstract: cheap (small/fast), standard (mid), capable (frontier).
| Role / phase |
Recommended tier |
Why |
component-builder on trivial scope, transcription/mechanical builds (rote wiring, single-change, codegen-from-spec) |
cheap |
Mechanical execution against an explicit spec; little judgment. |
doc-syncer |
cheap |
Mechanical diff-driven doc edits. |
component-builder on multi-file / cross-module integration |
standard |
Real wiring decisions across files; needs coherence. |
code-reviewer |
standard (FLOOR) |
Judgment under adversarial intent; see reviewer floor below. |
bug-investigator |
standard |
Hypothesis search; escalate to capable on a stubborn root cause. |
planner, plan-gap-reviewer |
capable |
Architecture and decomposition; cheap planning poisons the whole chain. |
integration-verifier (final phase, REVERT authority) |
capable |
Last line before "done"; must not miss scenario gaps. |
researcher |
standard |
Retrieval + synthesis. |
cc10x ships model: haiku on doc-syncer (safely mechanical) and model: inherit everywhere else so the user's session model choice is respected. Never claim a tier was applied when the mechanism cannot apply it. Turn-count dominates price — a capable model that one-shots a phase is cheaper than a cheap model that loops three times re-reading state and re-trying. When a role tends to iterate (planner, verifier, stubborn investigation), prefer the higher tier even though its per-token cost is greater: fewer turns wins.
Prompt scaffold for every agent
## Task Context
- Task ID: {task_id}
- Parent Workflow ID: {workflow_uuid}
- Task Phase: {phase}
- Plan File: {plan_file or 'None'}
- Workflow Scope: wf:{workflow_uuid}
- Workflow Artifact: .cc10x/workflows/{workflow_uuid}.json
## User Request
{request}
## Requirements
{clarified requirements or 'See plan/design files'}
## Memory Summary
{brief activeContext summary}
## Project Patterns
{User Standards + Common Gotchas, trimmed if needed}
## Domain Context
{If UBIQUITOUS_LANGUAGE.md, DOMAIN_GLOSSARY.md, docs/domain/*.md, or project-context.md exist, include content. Otherwise omit section.}
## SKILL_HINTS
{router-detected skill list or "None"}
Anti-anchoring exception: for adversarial read-only dispatches (code-reviewer, plan-gap-reviewer) OMIT ## Memory Summary — it carries the implementer's own narrative (decisions, learnings) and anchors the auditor. Keep ## Project Patterns (user standards and gotchas are neutral law, not author narrative). Approved decisions the reviewer genuinely needs travel via ## Pre-Answered Requirements / ## Intent Contract, never via the memory summary.
Optional sections:
## Pre-Answered Requirements for BUILD when router already gathered decisions.
## Intent Contract when a plan or design already defined goal, constraints, acceptance criteria, and named scenarios.
## Research Files only when at least one research file exists.
## Research Quality only when at least one research result exists.
## Design File only for planner.
## Planning Review Findings only for re-plan.
## Original User Request only for plan-gap-reviewer.
## Approved Context Files only for plan-gap-reviewer.
## Previous Agent Findings only for integration-verifier and only after a review phase ran.
Prompt assembly rule
- Every routed prompt must be self-contained from the workflow artifact, approved files, and the current task contract.
- Do not rely on prior chat turns or completed-phase narrative when the same fact already exists in the workflow artifact, plan, design, or research files.
- Include only the current-phase objective, live blockers, approved decisions, and directly relevant evidence. Omit unrelated completed-phase detail.
- Anti-pre-judging guard (adversarial dispatches only): before dispatching
code-reviewer, failure-hunter, or plan-gap-reviewer, grep the drafted prompt against the SELF-CHECK BLOCKLIST in references/workflow-artifact-and-hook-policy.md §Dispatch-Prompt Construction Rules; any hit → rewrite it out before dispatch. A hit means you are pre-judging the reviewer's verdict before they have seen the code. The router knows the plan, the intent contract, and the approved decisions — that knowledge can unknowingly inject bias ("the plan chose approach X, so don't flag Y"). Reviewers must form their own opinion from the diff. State approved decisions as neutral facts ("approach X was approved for reason Z"), never as instructions to suppress findings.
Deterministic skill hints
Router is the only authority allowed to load internal CC10X skills.
Agents may not self-activate frontend or architecture.
Include cc10x:frontend only when the request, changed files, plan, or design targets UI/frontend work. The skill has two modes: authoring (build UI with patterns) and critique (score built UI). Router selects mode via dispatch context.
Include cc10x:architecture only for multi-component, API, schema, auth, or integration-heavy work.
Include cc10x:research only when planner or investigator receives ## Research Files.
Include cc10x:exploration only on an explicit de-risk/spike intent ("spike", "try out", "what should this look like", "prototype", "throwaway") — never as the default for a real build. The skill has two modes: design (brainstorm a design) and spike (throwaway prototype). Absorbing a spike's answer is a fresh gated BUILD, not promotion.
Include cc10x:codebase-hygiene only when (a) the code-reviewer is asked for a reuse/consolidation audit or the request targets semantic duplication, OR (b) the request targets retrofitting/deepening shallow modules in EXISTING code (not greenfield architecture, which stays cc10x:architecture). The skill has two modes: duplicate detection and module deepening.
Include cc10x:mcp-cli only when a researcher needs a one-off MCP capability that is not already mounted.
Include cc10x:code-review only when a human/external reviewer's feedback (pasted PR comments, review notes, "can you change X") must be acted on — it governs verify-before-agreeing in the MAIN session, not the internal reviewer→router→fix loop.
Include cc10x:memory-and-handoff only when work is being handed to a coworker, a different tool, or a fresh non-cc10x session.
Include project/domain skills only from patterns.md ## Project SKILL_HINTS.
Skill precedence is strict:
- explicit user prompt
- project
CLAUDE.md / repo standards / user standards
- approved plan and design docs
- domain-specific external skills
- internal CC10X skills
- model heuristics
Previous Agent Findings handoff
When invoking integration-verifier, build and pass the ## Previous Agent Findings section per the Verifier findings handoff law in §13 — read results.reviewer and results.hunter from the workflow artifact and use the exact template defined there (single source). DEBUG skips the hunter.
Task metrics and timing telemetry
- Timing telemetry is measurement only. It must never bypass gates, phase exit, or remediation rules.
- After
TaskGet() / TaskList(), if Claude Code exposes task duration metrics, persist them into:
telemetry.workflow_wall_clock_seconds
telemetry.agent_wall_clock_seconds.{agent}
- If task metrics are unavailable, keep
task_metrics_available="unknown" and continue. Missing telemetry is never a reason to advance or block a workflow.
- When
integration-verifier reports a ### Timing & Workload section, persist:
telemetry.verifier.phase_exit_proof_runs
telemetry.verifier.extended_audit_runs
telemetry.verifier.workload_seconds
- Use telemetry to explain latency. Do not use it to auto-reduce verification scope.
8. Post-Agent Validation
Read-only contracts
Primary signal:
- Line 1:
CONTRACT {"s":"...","b":...,"cr":...}
Fallback heading on line 2:
## Review: Approve|Changes Requested
## Verification: PASS|FAIL
## Planning Review: Pass|Findings
Verdict extraction:
- Try the envelope on line 1.
- If envelope is missing or malformed, scan the first 5 lines for the heading.
- Extract
CRITICAL_ISSUES from ### Critical Issues.
- If the line-1 envelope AND the first-5-lines fallback heading are both absent, or any required contract field is missing, run inline verification rather than approving.
- Detect
SELF_REMEDIATED from task state:
- If the task remains
in_progress and blockedBy is non-empty after the agent stops, treat it as self-remediated.
- For integration-verifier, parse scenario accounting:
SCENARIOS_TOTAL
SCENARIOS_PASSED
SCENARIOS_FAILED
- Fail validation if those counts do not reconcile with the evidence array.
- Fail validation if any scenario omits explicit
Expected or Actual evidence.
Read-only structured intent fields:
REMEDIATION_NEEDED: true|false
REMEDIATION_REASON: ...
REMEDIATION_SCOPE_REQUESTED: N/A|CRITICAL_ONLY|ALL_ISSUES
REVERT_RECOMMENDED: true|false
PLANNING_REVIEW_STATUS: PASS|FINDINGS
BLOCKING_FINDINGS_COUNT: [number]
REPLAN_NEEDED: true|false
REPLAN_REASON: ...
Compatibility rule:
- Accept legacy self-healed blocked task behavior during migration.
- Prefer the new structured remediation fields over task-state inference when both exist.
Write-agent YAML contracts
For write agents, parse the final fenced YAML block under ### Router Contract (MACHINE-READABLE).
Before post-agent validation, read references/workflow-artifact-and-hook-policy.md §contracts for the per-agent required-field table and the contract-override pass conditions.
If the YAML block is missing or malformed:
- Treat the task as invalid output.
- Do not continue the workflow based on prose alone.
- Re-run inline verification and fail safe.
Inline exploration handoff
After Skill(skill="cc10x:exploration"), parse the fenced YAML block under
### Brainstorming Handoff (MACHINE-READABLE).
Required field:
If present:
- persist it into workflow artifact
design_file
- pass it to planner as
## Design File
- do not require
activeContext.md to be updated first
Contract overrides
- Before treating any agent
STATUS/verdict as a pass, read references/workflow-artifact-and-hook-policy.md §contracts and apply the per-agent contract-override pass conditions verbatim (the STATUS=PASS/FIXED/APPROVE/PLAN_CREATED/COMPLETE gates, plus the reviewer rubber-stamp fallback).
Convergence rule:
- If evidence is incomplete, contradictory, or missing for a required pass path, do not advance the workflow.
- Set the workflow artifact
quality.convergence_state to needs_iteration and stop on the appropriate remediation or clarification gate instead of treating the task as good enough.
9. Remediation And Workflow Rules
- When remediation, scope resolution, review-to-build escalation, planner clarification, investigation continuation, or the verifier REVERT gate is in play, immediately read
references/remediation-and-research.md.
- Use the
## 9. Remediation And Workflow Rules block there as canonical router law.
10. Research (Trigger, Quality, Files)
- Research (trigger, quality, files): whenever research is triggered (including research task creation), consumed, summarized, or handed to planner/investigator, read
references/remediation-and-research.md and apply its ## 10. Research Orchestration, ## Research Quality, and ## Research Files blocks.
11. Re-Review Loop
- See
references/remediation-and-research.md and apply its ## 11. Re-Review Loop block whenever a kind:remfix task completes.
11b. Loop Discipline (Vocabulary)
The harness is a loop engine. These concepts govern how the loop runs:
| Concept |
Meaning |
| Trigger |
The event that starts or resumes a loop iteration — user request, agent completion, checkpoint resolution. Every loop iteration has exactly one trigger. |
| Checkpoint |
A point where the loop pauses for human input. Only on irreversible actions, real scope changes, or input only the user can provide. Checkpoints are NOT for narration or "want me to continue?" prompts. |
| Push right |
Defer checkpoints as far as possible — do maximal work before involving the human. The loop should never stop on a promise or plan when it could act. If the next step is reversible and follows from the original request, proceed without asking. |
| Brief |
The decision-ready summary the loop produces when pausing. Not raw output, not a diary — the one thing the human needs to decide next. Outcome first, supporting detail second. |
| Cycle |
One complete plan → build → verify → learn iteration. The circuit breaker pauses the loop for a human checkpoint at the 3rd remediation cycle (single definition: references/remediation-and-research.md); cycles beyond 3 run only on explicit user go-ahead. |
| Convergence |
The loop's quality signal — when quality.convergence_state transitions from needs_iteration to converged, the loop is complete. Never declare convergence on prose alone. |
Autonomous mode: When the user sets a goal that spans multiple iterations (e.g., /goal or explicit "do this end-to-end"), the loop runs without checkpointing for reversible actions. The user is not watching in real time and cannot answer questions mid-task. Before ending a turn, check the last paragraph — if it is a plan, analysis, question, list of next steps, or a promise about work not yet done, do that work now with tool calls. End the turn only when the task is complete or blocked on input only the user can provide.
12. Chain Execution Loop
1. TaskList()
2. Select tasks in the active `wf:` where:
- status is pending or in_progress
- blockedBy is empty or all blockers are completed
3. If the runnable task kind is memory:
- execute inline in the main context
- persist workflow artifact results + Memory Notes from the task description
- append `memory_finalized` to `.cc10x/workflows/{wf}.events.jsonl`
- clean up the matching [cc10x-internal] memory_task_id entry
- mark the memory task completed
- mark the parent workflow task completed
- continue
4. Otherwise, map each runnable task through the dispatcher table.
5. Mark each task in_progress before invoking its agent. If `code-reviewer` and `failure-hunter` are both ready in BUILD: mark both in_progress first, invoke them in the same message. They are read-only and safe to parallelize.
- If parallel invocation fails or is unavailable (API error, rate limit, agent not found): fall back to sequential execution — dispatch `code-reviewer` first, wait for it to complete, then dispatch `failure-hunter`. Do NOT substitute the hunter with a different agent (e.g., bug-investigator). Do NOT skip the hunter. The hunter is a read-only agent with a specific adversarial posture — no other agent can replace it. Never block a workflow because parallelism is unavailable. Log `event=parallel_fallback` in the workflow event log.
6. After each agent returns:
- capture memory payload immediately
- validate output
- persist task-state side effects
- if BUILD review and hunt are both complete for the current phase, write one router-owned merged findings summary into the existing workflow results before verifier handoff
- apply workflow rules
- for BUILD, run `phase_exit_gate`; if the current phase is not complete, persist `phase_status={partial|blocked}` and stop
- never advance to the next phase or workflow step on apology prose alone
- if two agents in the same phase return contradictory verdicts (e.g., reviewer approves but verifier fails on the same evidence), treat the blocking verdict as authoritative (FAIL over PASS, CHANGES_REQUESTED over APPROVE); never average or reconcile the signals. Log the contradiction in `status_history`.
- **Cross-reviewer agreement promotion:** if `code-reviewer` and `failure-hunter` independently flag the SAME finding (same file:line, same defect, raised from different passes), that is stronger signal than either alone — promote the merged finding's confidence by one tier (80→90, or mark it `cross-confirmed` in the merged findings summary). Agreement between two mutually-blind reviewers is independent confirmation; use it. Promotion never overrides the quote-the-line gate — a finding without a verbatim `file:line` quote cannot be promoted, only demoted.
- doc-syncer `STATUS=SKIPPED` is a passing state; advance to Memory Update immediately
- doc-syncer STATUS=PARTIAL: soft pass; advance to Memory Update; persist doc_sync_partial=true in workflow artifact results.doc_syncer for user review
7. Repeat until all tasks in the active `wf:` are completed.
After every agent completion
- Capture memory payload FIRST — before the pre-check, validation, or any task-state mutation (compaction can fire between agent return and parse; an uncaptured payload is lost).
- READ-ONLY agents: extract
### Memory Notes (For Workflow-Final Persistence) immediately after return.
- WRITE agents: extract
MEMORY_NOTES from YAML immediately after return.
- Pre-check before processing agent output:
- Did the agent address the assigned scope (not a subset or superset)?
- Did tests, builds, or checks referenced in the contract actually run (not merely described)?
- Is follow-up work needed that the agent did not self-remediate?
If any answer is "no" or "unknown", treat as incomplete and apply the fallback validation path below.
TaskGet({ taskId }) or TaskList() to verify final t
…(truncated)
1---2name: cc10x-router3description: THE ONLY ENTRY POINT FOR CC10X. Activate this skill for build, debug, review, and plan requests. Use when the user asks to implement, fix, review, plan, test, refactor, or continue code work. Trigger keywords: build, implement, create, write, add, review, audit, debug, fix, error, bug, broken, plan, design, architect, spec, brainstorm, test, refactor, optimize, update, change, research, cc10x, c10x. CRITICAL: Route and execute immediately. Do not stop at describing capabilities.4---5
6# cc10x Router
7
8**Runtime contract only.** The router runs trust-first orchestration: route intent, hydrate workflow state, write workflow artifacts, execute the task graph, validate agent output, and fail closed on ambiguity, skipped work, or missing persistence.
9
10## 1. Intent Routing
11
12A keyword hit only NOMINATES a row; the request's primary deliverable DECIDES the route (e.g. "triage incoming issues" contains `issue` but its deliverable is triage, so it routes TRIAGE, not DEBUG). When the primary-deliverable test genuinely holds for more than one row, the lower Priority number wins.
13
14| Priority | Signal | Keywords | Workflow | Chain |
15| ---------- | -------- | ---------- | ---------- | ------- |
16| 1 | ERROR | error, bug, fix, broken, crash, fail, debug, troubleshoot, issue | DEBUG | bug-investigator -> code-reviewer -> integration-verifier |
17| 2 | PLAN | plan, design, architect, roadmap, strategy, spec, brainstorm | PLAN | exploration -> planner -> bounded fresh review loop |
18| 3 | REVIEW | review, audit, analyze, assess, "is this good" | REVIEW | code-reviewer |
19| 4 | ORIENT | zoom out, explain, understand, "how does X work", unfamiliar, "map this", "walk me through", "where is", "what does this do" | ORIENT | advisory orientation (no agents) |
20| 5 | TRIAGE | triage, "incoming issues", "look at #", "triage #" | TRIAGE | triage-agent → optional exploration → agent-ready brief |
21| 6 | CODEBASE-HEALTH | "codebase health", "improve architecture", "deepening", "ball of mud", "shallow modules", "architecture audit" | CODEBASE-HEALTH | architecture-scanner → HTML report → human picks → exploration (grilling) → feeds PLAN |
22| 7 | DEFAULT | Everything else | BUILD | component-builder → [code-reviewer ‖ failure-hunter] → integration-verifier |
23
24Rules:
25
26- Planning runs through the CC10x PLAN workflow so it gains orchestration state, workflow artifacts, intent contracts, and the bounded fresh review. Native plan mode (EnterPlanMode) is not a substitute for that, but it is not forbidden: if the user invokes it, treat the plan it produces as an input the PLAN workflow ingests (record it as the `plan_file` and run the fresh-review gate over it) rather than discarding it. Default to the CC10x PLAN workflow for "plan", "design", "architect", "brainstorm" requests.
27- ERROR always wins over BUILD, but route on the PRIMARY DELIVERABLE, not the first keyword hit: "add a dark-mode toggle and fix the button alignment" is a BUILD whose scope includes a small fix, not a DEBUG. Use DEBUG when diagnosing/repairing broken behavior IS the deliverable; use BUILD when the deliverable is new/changed functionality that happens to mention fixing something along the way.
28- REVIEW is advisory only. Never let REVIEW create code-changing tasks.
29- ORIENT is read-only and advisory. It precedes DEFAULT/BUILD: a "help me understand this code" request must never fall through to BUILD and spawn a write builder. ORIENT spawns NO write agents and creates NO phase graph. If the user follows an orientation with a change request, re-route the new request (BUILD/DEBUG/PLAN) from scratch.
30- TRIAGE is advisory-only. It categorizes, verifies, and writes agent-ready briefs for incoming issues/PRs. It never writes code. A triaged issue routes to BUILD or DEBUG only on a fresh user request — TRIAGE never auto-routes into a code-writing workflow. Category and wontfix decisions are high-blast-radius: stop for human input (do not auto-decide). **Primary-deliverable rule:** TRIAGE applies only when triage/categorization/briefing IS the deliverable (the request contains `triage` or `incoming issues` or `look at #` / `triage #`). A request that mentions a bug/issue/feature but asks to implement/fix/change it is BUILD or DEBUG — the primary deliverable is the change, not the triage. Do not route to TRIAGE unless the user explicitly asks to triage.
31- CODEBASE-HEALTH is advisory-only upkeep. It surfaces deepening candidates and grills the chosen one. It never writes code. A chosen candidate routes to PLAN only on a fresh user request. The scanner writes a single HTML report to the OS temp dir (not the repo). **Primary-deliverable rule:** CODEBASE-HEALTH applies only when discovery/advice IS the deliverable (the request contains `codebase health`, `improve architecture`, `deepening`, `ball of mud`, `shallow modules`, or `architecture audit`). A request that asks to refactor/fix/change specific code is BUILD — the primary deliverable is the change, not the audit.
32- BUILD uses a complexity gradient (see `references/build-workflow.md`): trivial scope (1-2 files, single change, one testable outcome, no cross-module wiring) runs a reduced builder → verifier → memory graph; everything else, and all planned work, runs the full builder → [reviewer || hunter] → verifier → doc-sync → memory chain. The reviewer and hunter run in parallel (two read-only agents in the same message) and the router merges their findings before verifier handoff. The builder escalates trivial → full on any scope increase. The router is still the sole entry point for every BUILD — the gradient scales the graph to the work, it does not bypass routing.
33- Before execution, output one line: `-> {WORKFLOW} workflow (signals: {matched keywords})`
34
35### ORIENT move (read-only)
36
37Triggered when the user wants to understand existing code, not change it ("zoom out", "explain", "how does X work", "I'm unfamiliar with", "map this", "walk me through", "where is X", "what does this do"). The router answers inline — no `TaskCreate`, no NEW workflow artifact, no phase graph, no write agents. (Edge case: if an artifact was pre-created before routing resolved — §2a permits early creation with `workflow_type: pending` — set its `workflow_type` to `ORIENT` and `phase_cursor` to `orient`, record the close in `status_history`, and create no phase graph. That is the only reason `ORIENT`/`orient` appear in the artifact enums.)
38
39Orientation procedure:
40
411. Map the relevant modules/files for the named subject (use `localViewStructure` / `localFindFiles` / `localSearchCode` to locate, read only the slices needed to explain).
422. Trace ONE layer up: callers and dependents of the focal symbols via LSP call-hierarchy (`lspCallHierarchy`) and references (`lspFindReferences`); run `localSearchCode` first to get the exact `lineHint` before any LSP call.
433. Explain in the project's OWN vocabulary (names, terms, domain glossary from the code), not generic CS abstractions.
444. Stop at understanding. Do not propose or apply edits. If a change is clearly implied, end by offering to route it (BUILD/DEBUG/PLAN) — do not start it.
45
46Distinguish from REVIEW: REVIEW judges quality ("is this good", audit); ORIENT only explains structure and flow. When both could match, prefer ORIENT for "help me understand", REVIEW for "tell me what's wrong".
47
48## 2. Memory Load And Template Validation
49
50Always run this before routing or resuming:
51
52```text
531. Bash("mkdir -p .cc10x")
542. Read(".cc10x/activeContext.md")
553. Read(".cc10x/patterns.md")
564. Read(".cc10x/progress.md")
57```
58
59Do not parallelize step 1 with reads — the reads assume the directory exists.
60
61If a memory file is missing:
62
63- Create it using the `cc10x:memory-and-handoff` template.
64- Read it before continuing.
65
66Required sections:
67
68| File | Required Sections |
69| ------ | ------------------- |
70| `activeContext.md` | `## Current Focus`, `## Recent Changes`, `## Next Steps`, `## Decisions`, `## Learnings`, `## References`, `## Blockers`, `## Session Settings`, `## Last Updated` |
71| `progress.md` | `## Current Workflow`, `## Tasks`, `## Completed`, `## Verification`, `## Last Updated` |
72| `patterns.md` | `## User Standards`, `## Common Gotchas`, `## Project SKILL_HINTS`, `## Last Updated` |
73
74Auto-heal rule:
75
76- Insert missing sections before `## Last Updated`.
77- After every `Edit(...)`, immediately `Read(...)` and verify the new section exists.
78
79JUST_GO:
80
81- Read `activeContext.md ## Session Settings`.
82- If `AUTO_PROCEED: true`, set `JUST_GO=true`.
83- While `JUST_GO=true`, auto-default AskUserQuestion gates to the recommended option EXCEPT: REVERT, failure-stop gates, destructive finishing options (auto-pick `Keep as-is`; never merge/push/discard), and plans with unresolved Open Decisions (BUILD may not start). Log each auto-choice in `## Decisions`.
84
85Trust rule:
86
87- `JUST_GO` never overrides explicit user/project standards, open plan decisions, or failure-stop gates.
88- If a plan still has unresolved `Open Decisions`, BUILD may not start, even in `JUST_GO`.
89
90## 2a. Workflow Artifact And Hook Policy
91
92Core law:
93
94- Durable router state lives under `.cc10x/workflows/{workflow_uuid}.json`
95- Companion event log lives under `.cc10x/workflows/{workflow_uuid}.events.jsonl`
96- Router-owned gates still include `plan_trust_gate`, `phase_exit_gate`, `failure_stop_gate`, `memory_sync_gate`, and `skill_precedence_gate`
97
98Mandatory reference read:
99
100- Before workflow creation, artifact mutation, hook policy changes, or resume logic that depends on artifact fields, immediately read `references/workflow-artifact-and-hook-policy.md`.
101- That reference contains the verbatim artifact schema, event log contract, hook policy, and gate wording extracted from the prior router monolith. Treat it as load-bearing orchestration law, not optional background.
102
103## 3. Task Metadata Contract
104
105Every CC10X task description starts with normalized metadata lines:
106
107```text
108wf:{workflow_uuid}
109kind:{workflow|agent|remfix|memory|reverify|research}
110origin:{router|component-builder|bug-investigator|code-reviewer|integration-verifier|planner}
111phase:{build|build-implement|build-review|build-hunt|build-verify|build-doc-sync|build-finish|debug|debug-investigate|debug-review|debug-verify|review|review-audit|plan|plan-create|plan-review-gap-1|plan-review-gap-2|triage|codebase-health|memory-finalize|re-review|re-hunt|re-verify|re-plan|research-web|research-github}
112plan:{path|N/A}
113scope:{ALL_ISSUES|CRITICAL_ONLY|N/A}
114reason:{short reason or N/A}
115```
116
117Rules:
118
119- ALL SEVEN metadata lines (`wf:`, `kind:`, `origin:`, `phase:`, `plan:`, `scope:`, `reason:`) are present on EVERY CC10X task — use `N/A` where a field does not apply. The TaskCompleted hook audits exactly this invariant; the task-graph templates already satisfy it.
120- `wf:` always carries the generated `workflow_uuid` (`wf-<ts>-<hex>`), never a Claude `TaskCreate` task id. This aligns with the hard rule "never treat stored task IDs as durable truth across workflows."
121- Router must generate `workflow_uuid` before `TaskCreate()` and use it from the first write.
122- `kind:` drives resume, routing, and counting logic.
123- `origin:` on a `kind:remfix` task names the agent whose findings triggered the fix (never `N/A` there).
124- `plan:` carries the real plan path on workflow, agent, reverify, and memory tasks when a plan exists.
125- `reason:` carries a meaningful short reason (not `N/A`) on remediation and research tasks.
126- The router must never depend on loose prose when metadata can answer the question.
127
128## 4. Resume And Hydration
129
130After memory load:
131
132```text
133TaskList()
134```
135
136Hydration rules:
137
138- Find active parent workflow tasks by subject prefix `CC10X BUILD:`, `CC10X DEBUG:`, `CC10X REVIEW:`, `CC10X PLAN:`.
139- If more than one active workflow exists, scope by the current conversation and matching `wf:` markers. Do not resume a workflow you cannot scope confidently.
140- Reconstruct runnable tasks from `TaskList()` and `TaskGet()` using `wf:` + `kind:` + `phase:`. Do not rely on stored task IDs for correctness.
141- Read and write only the `.cc10x/` state namespace (memory `.cc10x/*.md`, workflows `.cc10x/workflows/*`). Ignore any legacy version-segmented layout such as `.cc10x/v10/*` or `.claude/cc10x/*` left over from older installs during hydration.
142- `[cc10x-internal] memory_task_id` in `activeContext.md` is only a transient optimization. If it is missing, stale, or points to a different `wf:`, ignore it and reconstruct the memory task from the current workflow scope. [EASY TO MISS: stale memory_task_id is the #1 cause of cross-workflow pollution]
143- Never use an unscoped fallback like "first pending Memory Update task". [EASY TO MISS: unscoped lookups silently pick up orphan tasks from prior workflows]
144
145Resume algorithm:
146
1470. If `.cc10x/stop-state.json` or `.cc10x/precompact-state.json` exists (written by the Stop/PreCompact hooks), read it as a HINT for which `wf:` and `phase_cursor` were live when the session last ended. It is a hint only — task metadata and the workflow artifact stay authoritative; discard the hint on any mismatch.
1481. Identify the active parent workflow.
1492. Extract `workflow_uuid` from the `wf:` line.
1503. Read all CC10X tasks whose descriptions contain that `wf:`.
1514. Derive runnable tasks from `status` and `blockedBy`.
1525. Reconstruct the memory task as the unique pending/in_progress `kind:memory` task in the same `wf:`.
153
154Scope-decision resume:
155
156- Before normal routing, check `activeContext.md ## Decisions` for a live marker:
157 - `[SCOPE-DECISION-PENDING: wf:{workflow_uuid} reason:{...}]`
158- If present, treat the current user reply as the answer to that pending BUILD scope gate:
159 - `critical only` -> create the pending REM-FIX with `scope:CRITICAL_ONLY`
160 - `all issues` -> create the pending REM-FIX with `scope:ALL_ISSUES`
161 - anything else -> ask again with the same two options and stop
162- After consuming a valid answer:
163 - remove the pending marker from `## Decisions`
164 - create the scoped REM-FIX
165 - block downstream re-review / verifier tasks as normal
166 - stop after task creation so the next turn resumes from task state, not from repeated prose parsing
167 - [EASY TO MISS: When persisting user decisions, use the user's exact words. Paraphrasing introduces drift that compounds across resume cycles.]
168
169Safety rules:
170
171- If a task list is shared across sessions, always scope by `wf:` before resuming.
172- If a task has `status=in_progress` and unresolved blockers, treat it as waiting on remediation, not as a free-running orphan.
173- If a task has `status=in_progress` and no blockers, ask the user whether to resume, delete, or mark complete.
174- If legacy tasks exist with subjects starting `BUILD:`, `DEBUG:`, `REVIEW:`, or `PLAN:` without the `CC10X` prefix, ask whether to resume the legacy workflow or start a fresh CC10X workflow.
175
176## 5. Workflow Preparation
177
178### Shared preparation
179
180Before creating a new workflow:
181
182- Read `activeContext.md ## References` to discover `Plan`, `Design`, and prior `Research` files.
183- Read `activeContext.md ## Decisions` for prior planner/build clarifications.
184- Read `progress.md ## Current Workflow` and `## Tasks` for pending work that should resume instead of duplicating.
185- Read the latest `.cc10x/workflows/*.json` artifact if one exists for the current conversation.
186
187**Intent Readiness Gate (MANDATORY before PLAN or BUILD):**
188Before dispatching to planner or builder, verify the intent contract meets three conditions:
189
1901. **Context-bounded:** The full intent (goal + constraints + acceptance criteria) fits within the agent's prompt scaffold without truncation. If the intent requires loading more than 5 source files to be understood, decompose first (switch to PLAN).
1912. **Contradiction-free:** No acceptance criterion contradicts a stated constraint or non-goal. If contradictions exist, halt and persist `pending_gate="intent_contradiction"`.
1923. **Sufficiently specific:** Every acceptance criterion maps to at least one verifiable scenario. If a criterion is unverifiable ("make it better" without a metric), halt and ask for specificity.
193
194Router-owned interface fields:
195
196- `plan_mode`: `direct` | `execution_plan` | `decision_rfc`
197- `verification_rigor`: `standard` | `critical_path`
198- `checkpoint_type`: `none` | `human_verify` | `decision` | `human_action`
199- `proof_status`: `passed` | `gaps_found` | `human_needed`
200
201### BUILD preparation
202
203- Before any BUILD-specific readiness decision or child-task creation, immediately read `references/build-workflow.md`.
204- Use the `### BUILD preparation` and `### BUILD task graph` blocks in that file as the canonical BUILD law.
205
206### DEBUG preparation
207
208- Before any DEBUG-specific readiness decision or child-task creation, immediately read `references/debug-workflow.md`.
209- Use the `### DEBUG preparation` and `### DEBUG task graph` blocks in that file as the canonical DEBUG law.
210
211### REVIEW preparation
212
213- Before any REVIEW-specific readiness decision or child-task creation, immediately read `references/review-workflow.md`.
214- Use the `### REVIEW preparation` and `### REVIEW task graph` blocks in that file as the canonical REVIEW law.
215
216### PLAN preparation
217
218- Before any PLAN-specific readiness decision or child-task creation, immediately read `references/plan-workflow.md`.
219- Use the `### PLAN preparation` and `### PLAN task graph` blocks in that file as the canonical PLAN law.
220- If planner clarification, review-loop findings, or plan remediation rules trigger later in the workflow, also read `references/remediation-and-research.md` before continuing.
221
222## 6. Workflow Task Graphs
223
224### Parent workflow creation
225
226Use this pattern for every new workflow:
227
2281. Generate a stable workflow UUID before `TaskCreate()`:
229
230```text
231workflow_uuid = "wf-" + UTC timestamp + "-" + 8 hex chars
232```
233
2341. Create the parent workflow task with that UUID from the first write:
235
236```text
237TaskCreate({
238 subject: "CC10X {WORKFLOW}: {summary}",
239 description: "wf:{workflow_uuid}\nkind:workflow\norigin:router\nphase:{build|debug|review|plan}\nplan:{plan_file or 'N/A'}\nscope:N/A\nreason:User request\n\nUser request: {request}\nChain: {chain description}",
240 activeForm: "{workflow active form}"
241})
242```
243
2441. Immediately create the workflow artifact and event log. **Do NOT hand-type the artifact JSON.** Copy the canonical skeleton, then substitute only the live fields:
245
246```text
247Bash(command="mkdir -p .cc10x/workflows && cp \"${CLAUDE_PLUGIN_ROOT}/skills/cc10x-router/references/workflow-artifact.skeleton.json\" .cc10x/workflows/{workflow_uuid}.json")
248```
249
250Then `Edit` the copied file, replacing each placeholder token with the live value (the skeleton ships every required key already populated with safe defaults — you only fill these):
251
252- `__WORKFLOW_UUID__` → `{workflow_uuid}` (appears twice: `workflow_uuid` and `workflow_id`)
253- `__WORKFLOW_TYPE__` → `{WORKFLOW}` (BUILD | DEBUG | REVIEW | PLAN | ORIENT | TRIAGE | CODEBASE-HEALTH) — **if routing (§5) has not yet determined the workflow type, use `pending` and update it after §5 resolves.** Never hardcode BUILD before routing completes. The artifact may be created before routing (to capture state early), but `workflow_type` must reflect the actual routed type after §5.
254- `__USER_REQUEST__` → the user request (JSON-escape quotes/newlines)
255- `__PHASE__` → `{build|debug|review|plan|orient|triage|codebase-health}`
256- `__ISO_TIMESTAMP__` → the current UTC ISO timestamp (appears 3×: `status_history[0].ts`, `created_at`, `updated_at`)
257
258Use `Edit(replace_all=true)` for `__WORKFLOW_UUID__` and `__ISO_TIMESTAMP__` since each repeats. Then write the event log:
259
260```text
261Write(
262 file_path=".cc10x/workflows/{workflow_uuid}.events.jsonl",
263 content="{\"ts\":\"{iso_timestamp}\",\"wf\":\"{workflow_uuid}\",\"event\":\"workflow_started\",\"phase\":\"{build|debug|review|plan}\",\"task_id\":\"{parent_task_id}\",\"agent\":\"router\",\"decision\":\"start\",\"reason\":\"User request\"}\n"
264)
265```
266
267**Read-back gate (MANDATORY before any child `TaskCreate`):** `Read(".cc10x/workflows/{workflow_uuid}.json")` and confirm (a) it parses as JSON, (b) `workflow_uuid` equals the generated UUID, and (c) no `__PLACEHOLDER__` tokens remain. If any check fails, fix the file and re-read before proceeding. The PostToolUse artifact guard also validates this write in `block` mode and will reject a malformed or key-missing artifact — but the router must not rely on the guard alone; confirm the read-back first.
268
269Only create child tasks after the workflow artifact exists and the read-back passes.
270
271### BUILD task graph
272
273- See `references/build-workflow.md` and apply its `### BUILD task graph` block verbatim before creating BUILD child tasks.
274
275### DEBUG task graph
276
277- See `references/debug-workflow.md` and apply its `### DEBUG task graph` block verbatim before creating DEBUG child tasks.
278
279### REVIEW task graph
280
281- See `references/review-workflow.md` and apply its `### REVIEW task graph` block verbatim before creating REVIEW child tasks.
282
283### PLAN task graph
284
285- See `references/plan-workflow.md` and apply its `### PLAN task graph` block verbatim before creating PLAN child tasks.
286
287### Marker rules
288
289- BUILD writes `[BUILD-START: wf:{workflow_uuid}]`
290- DEBUG writes `[DEBUG-RESET: wf:{workflow_uuid}]`
291- PLAN writes `[PLAN-START: wf:{workflow_uuid}]`
292
293## 7. Dispatcher And Agent Prompt Contract
294
295### Explicit dispatcher
296
297| Task Phase / Kind | Agent |
298| ------------------- | ------- |
299| `build-implement` | `cc10x:component-builder` |
300| `debug-investigate` | `cc10x:bug-investigator` |
301| `build-review`, `debug-review`, `review-audit`, `re-review` | `cc10x:code-reviewer` |
302| `build-hunt`, `re-hunt` | `cc10x:failure-hunter` |
303| `build-verify`, `debug-verify`, `re-verify` | `cc10x:integration-verifier` |
304| `plan-create`, `re-plan` | `cc10x:planner` |
305| `plan-review-gap-1`, `plan-review-gap-2` | `cc10x:plan-gap-reviewer` |
306| `research-web` | `cc10x:researcher` |
307| `research-github` | `cc10x:researcher` |
308| `triage` | `cc10x:triage-agent` |
309| `codebase-health` | `cc10x:architecture-scanner` |
310| `kind:remfix` + `origin:bug-investigator` | `cc10x:bug-investigator` |
311| `build-doc-sync` | `cc10x:doc-syncer` |
312| `kind:remfix` + `origin:code-reviewer` / `origin:integration-verifier` / `origin:router` | `cc10x:component-builder` |
313
314### Per-role model-tier policy
315
316Model selection comes from agent frontmatter; the router cannot set it per dispatch. Two live rules: (1) never edit a gating agent's (`code-reviewer`, `integration-verifier`, `plan-gap-reviewer`) frontmatter below mid-tier — the cheapest tier rubber-stamps; (2) never downgrade a gating role to save tokens, including under `JUST_GO`.
317
318ADVISORY — for humans tuning frontmatter; the router cannot act on this table at dispatch time. Tiers are abstract: `cheap` (small/fast), `standard` (mid), `capable` (frontier).
319
320| Role / phase | Recommended tier | Why |
321| -------------- | ------------------ | ----- |
322| `component-builder` on trivial scope, transcription/mechanical builds (rote wiring, single-change, codegen-from-spec) | cheap | Mechanical execution against an explicit spec; little judgment. |
323| `doc-syncer` | cheap | Mechanical diff-driven doc edits. |
324| `component-builder` on multi-file / cross-module integration | standard | Real wiring decisions across files; needs coherence. |
325| `code-reviewer` | standard (FLOOR) | Judgment under adversarial intent; see reviewer floor below. |
326| `bug-investigator` | standard | Hypothesis search; escalate to capable on a stubborn root cause. |
327| `planner`, `plan-gap-reviewer` | capable | Architecture and decomposition; cheap planning poisons the whole chain. |
328| `integration-verifier` (final phase, REVERT authority) | capable | Last line before "done"; must not miss scenario gaps. |
329| `researcher` | standard | Retrieval + synthesis. |
330
331cc10x ships `model: haiku` on `doc-syncer` (safely mechanical) and `model: inherit` everywhere else so the user's session model choice is respected. Never claim a tier was applied when the mechanism cannot apply it. Turn-count dominates price — a capable model that one-shots a phase is cheaper than a cheap model that loops three times re-reading state and re-trying. When a role tends to iterate (planner, verifier, stubborn investigation), prefer the higher tier even though its per-token cost is greater: fewer turns wins.
332
333### Prompt scaffold for every agent
334
335```text
336## Task Context
337- Task ID: {task_id}
338- Parent Workflow ID: {workflow_uuid}
339- Task Phase: {phase}
340- Plan File: {plan_file or 'None'}
341- Workflow Scope: wf:{workflow_uuid}
342- Workflow Artifact: .cc10x/workflows/{workflow_uuid}.json
343
344## User Request
345{request}
346
347## Requirements
348{clarified requirements or 'See plan/design files'}
349
350## Memory Summary
351{brief activeContext summary}
352
353## Project Patterns
354{User Standards + Common Gotchas, trimmed if needed}
355
356## Domain Context
357{If UBIQUITOUS_LANGUAGE.md, DOMAIN_GLOSSARY.md, docs/domain/*.md, or project-context.md exist, include content. Otherwise omit section.}
358
359## SKILL_HINTS
360{router-detected skill list or "None"}
361```
362
363Anti-anchoring exception: for adversarial read-only dispatches (`code-reviewer`, `plan-gap-reviewer`) OMIT `## Memory Summary` — it carries the implementer's own narrative (decisions, learnings) and anchors the auditor. Keep `## Project Patterns` (user standards and gotchas are neutral law, not author narrative). Approved decisions the reviewer genuinely needs travel via `## Pre-Answered Requirements` / `## Intent Contract`, never via the memory summary.
364
365Optional sections:
366
367- `## Pre-Answered Requirements` for BUILD when router already gathered decisions.
368- `## Intent Contract` when a plan or design already defined goal, constraints, acceptance criteria, and named scenarios.
369- `## Research Files` only when at least one research file exists.
370- `## Research Quality` only when at least one research result exists.
371- `## Design File` only for planner.
372- `## Planning Review Findings` only for `re-plan`.
373- `## Original User Request` only for `plan-gap-reviewer`.
374- `## Approved Context Files` only for `plan-gap-reviewer`.
375- `## Previous Agent Findings` only for integration-verifier and only after a review phase ran.
376
377### Prompt assembly rule
378
379- Every routed prompt must be self-contained from the workflow artifact, approved files, and the current task contract.
380- Do not rely on prior chat turns or completed-phase narrative when the same fact already exists in the workflow artifact, plan, design, or research files.
381- Include only the current-phase objective, live blockers, approved decisions, and directly relevant evidence. Omit unrelated completed-phase detail.
382- **Anti-pre-judging guard (adversarial dispatches only):** before dispatching `code-reviewer`, `failure-hunter`, or `plan-gap-reviewer`, grep the drafted prompt against the SELF-CHECK BLOCKLIST in `references/workflow-artifact-and-hook-policy.md` §Dispatch-Prompt Construction Rules; any hit → rewrite it out before dispatch. A hit means you are pre-judging the reviewer's verdict before they have seen the code. The router knows the plan, the intent contract, and the approved decisions — that knowledge can unknowingly inject bias ("the plan chose approach X, so don't flag Y"). Reviewers must form their own opinion from the diff. State approved decisions as neutral facts ("approach X was approved for reason Z"), never as instructions to suppress findings.
383
384### Deterministic skill hints
385
386- Router is the only authority allowed to load internal CC10X skills.
387- Agents may not self-activate `frontend` or `architecture`.
388- Include `cc10x:frontend` only when the request, changed files, plan, or design targets UI/frontend work. The skill has two modes: authoring (build UI with patterns) and critique (score built UI). Router selects mode via dispatch context.
389- Include `cc10x:architecture` only for multi-component, API, schema, auth, or integration-heavy work.
390- Include `cc10x:research` only when planner or investigator receives `## Research Files`.
391- Include `cc10x:exploration` only on an explicit de-risk/spike intent ("spike", "try out", "what should this look like", "prototype", "throwaway") — never as the default for a real build. The skill has two modes: design (brainstorm a design) and spike (throwaway prototype). Absorbing a spike's answer is a fresh gated BUILD, not promotion.
392- Include `cc10x:codebase-hygiene` only when (a) the code-reviewer is asked for a reuse/consolidation audit or the request targets semantic duplication, OR (b) the request targets retrofitting/deepening shallow modules in EXISTING code (not greenfield architecture, which stays `cc10x:architecture`). The skill has two modes: duplicate detection and module deepening.
393- Include `cc10x:mcp-cli` only when a researcher needs a one-off MCP capability that is not already mounted.
394- Include `cc10x:code-review` only when a human/external reviewer's feedback (pasted PR comments, review notes, "can you change X") must be acted on — it governs verify-before-agreeing in the MAIN session, not the internal reviewer→router→fix loop.
395- Include `cc10x:memory-and-handoff` only when work is being handed to a coworker, a different tool, or a fresh non-cc10x session.
396- Include project/domain skills only from `patterns.md ## Project SKILL_HINTS`.
397
398- Skill precedence is strict:
399 1. explicit user prompt
400 2. project `CLAUDE.md` / repo standards / user standards
401 3. approved plan and design docs
402 4. domain-specific external skills
403 5. internal CC10X skills
404 6. model heuristics
405
406### Previous Agent Findings handoff
407
408When invoking `integration-verifier`, build and pass the `## Previous Agent Findings` section per the **Verifier findings handoff** law in §13 — read `results.reviewer` and `results.hunter` from the workflow artifact and use the exact template defined there (single source). DEBUG skips the hunter.
409
410### Task metrics and timing telemetry
411
412- Timing telemetry is measurement only. It must never bypass gates, phase exit, or remediation rules.
413- After `TaskGet()` / `TaskList()`, if Claude Code exposes task duration metrics, persist them into:
414 - `telemetry.workflow_wall_clock_seconds`
415 - `telemetry.agent_wall_clock_seconds.{agent}`
416- If task metrics are unavailable, keep `task_metrics_available="unknown"` and continue. Missing telemetry is never a reason to advance or block a workflow.
417- When `integration-verifier` reports a `### Timing & Workload` section, persist:
418 - `telemetry.verifier.phase_exit_proof_runs`
419 - `telemetry.verifier.extended_audit_runs`
420 - `telemetry.verifier.workload_seconds`
421- Use telemetry to explain latency. Do not use it to auto-reduce verification scope.
422
423## 8. Post-Agent Validation
424
425### Read-only contracts
426
427Primary signal:
428
429- Line 1: `CONTRACT {"s":"...","b":...,"cr":...}`
430
431Fallback heading on line 2:
432
433- `## Review: Approve|Changes Requested`
434- `## Verification: PASS|FAIL`
435- `## Planning Review: Pass|Findings`
436
437Verdict extraction:
438
4391. Try the envelope on line 1.
4402. If envelope is missing or malformed, scan the first 5 lines for the heading.
4413. Extract `CRITICAL_ISSUES` from `### Critical Issues`.
4424. If the line-1 envelope AND the first-5-lines fallback heading are both absent, or any required contract field is missing, run inline verification rather than approving.
4435. Detect `SELF_REMEDIATED` from task state:
444 - If the task remains `in_progress` and `blockedBy` is non-empty after the agent stops, treat it as self-remediated.
4456. For integration-verifier, parse scenario accounting:
446 - `SCENARIOS_TOTAL`
447 - `SCENARIOS_PASSED`
448 - `SCENARIOS_FAILED`
449 - Fail validation if those counts do not reconcile with the evidence array.
450 - Fail validation if any scenario omits explicit `Expected` or `Actual` evidence.
451
452Read-only structured intent fields:
453
454- `REMEDIATION_NEEDED: true|false`
455- `REMEDIATION_REASON: ...`
456- `REMEDIATION_SCOPE_REQUESTED: N/A|CRITICAL_ONLY|ALL_ISSUES`
457- `REVERT_RECOMMENDED: true|false`
458- `PLANNING_REVIEW_STATUS: PASS|FINDINGS`
459- `BLOCKING_FINDINGS_COUNT: [number]`
460- `REPLAN_NEEDED: true|false`
461- `REPLAN_REASON: ...`
462
463Compatibility rule:
464
465- Accept legacy self-healed blocked task behavior during migration.
466- Prefer the new structured remediation fields over task-state inference when both exist.
467
468### Write-agent YAML contracts
469
470For write agents, parse the final fenced YAML block under `### Router Contract (MACHINE-READABLE)`.
471
472Before post-agent validation, read `references/workflow-artifact-and-hook-policy.md` §contracts for the per-agent required-field table and the contract-override pass conditions.
473
474If the YAML block is missing or malformed:
475
476- Treat the task as invalid output.
477- Do not continue the workflow based on prose alone.
478- Re-run inline verification and fail safe.
479
480### Inline exploration handoff
481
482After `Skill(skill="cc10x:exploration")`, parse the fenced YAML block under
483`### Brainstorming Handoff (MACHINE-READABLE)`.
484
485Required field:
486
487- `DESIGN_FILE`
488
489If present:
490
491- persist it into workflow artifact `design_file`
492- pass it to planner as `## Design File`
493- do not require `activeContext.md` to be updated first
494
495### Contract overrides
496
497- Before treating any agent `STATUS`/verdict as a pass, read `references/workflow-artifact-and-hook-policy.md` §contracts and apply the per-agent contract-override pass conditions verbatim (the `STATUS=PASS`/`FIXED`/`APPROVE`/`PLAN_CREATED`/`COMPLETE` gates, plus the reviewer rubber-stamp fallback).
498
499Convergence rule:
500
501- If evidence is incomplete, contradictory, or missing for a required pass path, do not advance the workflow.
502- Set the workflow artifact `quality.convergence_state` to `needs_iteration` and stop on the appropriate remediation or clarification gate instead of treating the task as good enough.
503
504## 9. Remediation And Workflow Rules
505
506- When remediation, scope resolution, review-to-build escalation, planner clarification, investigation continuation, or the verifier REVERT gate is in play, immediately read `references/remediation-and-research.md`.
507- Use the `## 9. Remediation And Workflow Rules` block there as canonical router law.
508
509## 10. Research (Trigger, Quality, Files)
510
511- **Research (trigger, quality, files):** whenever research is triggered (including research task creation), consumed, summarized, or handed to planner/investigator, read `references/remediation-and-research.md` and apply its `## 10. Research Orchestration`, `## Research Quality`, and `## Research Files` blocks.
512
513## 11. Re-Review Loop
514
515- See `references/remediation-and-research.md` and apply its `## 11. Re-Review Loop` block whenever a `kind:remfix` task completes.
516
517## 11b. Loop Discipline (Vocabulary)
518
519The harness is a loop engine. These concepts govern how the loop runs:
520
521| Concept | Meaning |
522| --------- | --------- |
523| **Trigger** | The event that starts or resumes a loop iteration — user request, agent completion, checkpoint resolution. Every loop iteration has exactly one trigger. |
524| **Checkpoint** | A point where the loop pauses for human input. Only on irreversible actions, real scope changes, or input only the user can provide. Checkpoints are NOT for narration or "want me to continue?" prompts. |
525| **Push right** | Defer checkpoints as far as possible — do maximal work before involving the human. The loop should never stop on a promise or plan when it could act. If the next step is reversible and follows from the original request, proceed without asking. |
526| **Brief** | The decision-ready summary the loop produces when pausing. Not raw output, not a diary — the one thing the human needs to decide next. Outcome first, supporting detail second. |
527| **Cycle** | One complete plan → build → verify → learn iteration. The circuit breaker pauses the loop for a human checkpoint at the 3rd remediation cycle (single definition: `references/remediation-and-research.md`); cycles beyond 3 run only on explicit user go-ahead. |
528| **Convergence** | The loop's quality signal — when `quality.convergence_state` transitions from `needs_iteration` to `converged`, the loop is complete. Never declare convergence on prose alone. |
529
530**Autonomous mode:** When the user sets a goal that spans multiple iterations (e.g., `/goal` or explicit "do this end-to-end"), the loop runs without checkpointing for reversible actions. The user is not watching in real time and cannot answer questions mid-task. Before ending a turn, check the last paragraph — if it is a plan, analysis, question, list of next steps, or a promise about work not yet done, do that work now with tool calls. End the turn only when the task is complete or blocked on input only the user can provide.
531
532## 12. Chain Execution Loop
533
534```text
5351. TaskList()
5362. Select tasks in the active `wf:` where:
537 - status is pending or in_progress
538 - blockedBy is empty or all blockers are completed
5393. If the runnable task kind is memory:
540 - execute inline in the main context
541 - persist workflow artifact results + Memory Notes from the task description
542 - append `memory_finalized` to `.cc10x/workflows/{wf}.events.jsonl`
543 - clean up the matching [cc10x-internal] memory_task_id entry
544 - mark the memory task completed
545 - mark the parent workflow task completed
546 - continue
5474. Otherwise, map each runnable task through the dispatcher table.
5485. Mark each task in_progress before invoking its agent. If `code-reviewer` and `failure-hunter` are both ready in BUILD: mark both in_progress first, invoke them in the same message. They are read-only and safe to parallelize.
549 - If parallel invocation fails or is unavailable (API error, rate limit, agent not found): fall back to sequential execution — dispatch `code-reviewer` first, wait for it to complete, then dispatch `failure-hunter`. Do NOT substitute the hunter with a different agent (e.g., bug-investigator). Do NOT skip the hunter. The hunter is a read-only agent with a specific adversarial posture — no other agent can replace it. Never block a workflow because parallelism is unavailable. Log `event=parallel_fallback` in the workflow event log.
5506. After each agent returns:
551 - capture memory payload immediately
552 - validate output
553 - persist task-state side effects
554 - if BUILD review and hunt are both complete for the current phase, write one router-owned merged findings summary into the existing workflow results before verifier handoff
555 - apply workflow rules
556 - for BUILD, run `phase_exit_gate`; if the current phase is not complete, persist `phase_status={partial|blocked}` and stop
557 - never advance to the next phase or workflow step on apology prose alone
558 - if two agents in the same phase return contradictory verdicts (e.g., reviewer approves but verifier fails on the same evidence), treat the blocking verdict as authoritative (FAIL over PASS, CHANGES_REQUESTED over APPROVE); never average or reconcile the signals. Log the contradiction in `status_history`.
559 - **Cross-reviewer agreement promotion:** if `code-reviewer` and `failure-hunter` independently flag the SAME finding (same file:line, same defect, raised from different passes), that is stronger signal than either alone — promote the merged finding's confidence by one tier (80→90, or mark it `cross-confirmed` in the merged findings summary). Agreement between two mutually-blind reviewers is independent confirmation; use it. Promotion never overrides the quote-the-line gate — a finding without a verbatim `file:line` quote cannot be promoted, only demoted.
560 - doc-syncer `STATUS=SKIPPED` is a passing state; advance to Memory Update immediately
561 - doc-syncer STATUS=PARTIAL: soft pass; advance to Memory Update; persist doc_sync_partial=true in workflow artifact results.doc_syncer for user review
5627. Repeat until all tasks in the active `wf:` are completed.
563```
564
565### After every agent completion
566
5670. Capture memory payload FIRST — before the pre-check, validation, or any task-state mutation (compaction can fire between agent return and parse; an uncaptured payload is lost).
568 - READ-ONLY agents: extract `### Memory Notes (For Workflow-Final Persistence)` immediately after return.
569 - WRITE agents: extract `MEMORY_NOTES` from YAML immediately after return.
5701. Pre-check before processing agent output:
571 - Did the agent address the assigned scope (not a subset or superset)?
572 - Did tests, builds, or checks referenced in the contract actually run (not merely described)?
573 - Is follow-up work needed that the agent did not self-remediate?
574 If any answer is "no" or "unknown", treat as incomplete and apply the fallback validation path below.
5752. `TaskGet({ taskId })` or `TaskList()` to verify final t
576
577…(truncated)