name: cc10x-router description: | 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.
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
Route using the first matching signal:
| 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 | brainstorming -> 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 | DEFAULT | Everything else | BUILD | component-builder -> [code-reviewer |
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_fileand 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.
- 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.
- 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 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 workflow artifact, no phase graph, no write agents.
Orientation procedure:
- Map the relevant modules/files for the named subject (use
localViewStructure/localFindFiles/localSearchCodeto 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); runlocalSearchCodefirst to get the exactlineHintbefore 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.
If a memory file is missing:
- Create it using the
cc10x:session-memorytemplate. - 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(...), immediatelyRead(...)and verify the new section exists.
JUST_GO:
- Read
activeContext.md ## Session Settings. - If
AUTO_PROCEED: true, setJUST_GO=true. - While
JUST_GO=true, auto-default all non-REVERT AskUserQuestion gates to the recommended option and log the choice in## Decisions.
Trust rule:
JUST_GOnever 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 inJUST_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, andskill_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|silent-failure-hunter|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|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:
wf:is mandatory on every child task.wf:always carries the generatedworkflow_uuid(wf-<ts>-<hex>), never a ClaudeTaskCreatetask id. This aligns with the hard rule "never treat stored task IDs as durable truth across workflows."- Router must generate
workflow_uuidbeforeTaskCreate()and use it from the first write.wf:PENDING_SELFis not used. kind:is mandatory and drives resume, routing, and counting logic.origin:is mandatory on everykind:remfixtask.plan:is required on workflow, agent, reverify, and memory tasks.reason:is required 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()andTaskGet()usingwf:+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_idinactiveContext.mdis only a transient optimization. If it is missing, stale, or points to a differentwf:, 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:
- Identify the active parent workflow.
- Extract
workflow_uuidfrom thewf:line. - Read all CC10X tasks whose descriptions contain that
wf:. - Derive runnable tasks from
statusandblockedBy. - Reconstruct the memory task as the unique pending/in_progress
kind:memorytask in the samewf:.
Scope-decision resume:
- Before normal routing, check
activeContext.md ## Decisionsfor 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 withscope:CRITICAL_ONLYall issues-> create the pending REM-FIX withscope: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 / re-hunt / 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.]
- remove the pending marker from
Safety rules:
- If a task list is shared across sessions, always scope by
wf:before resuming. - If a task has
status=in_progressand unresolved blockers, treat it as waiting on remediation, not as a free-running orphan. - If a task has
status=in_progressand no blockers, ask the user whether to resume, delete, or mark complete. - If legacy tasks exist with subjects starting
BUILD:,DEBUG:,REVIEW:, orPLAN:without theCC10Xprefix, 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 ## Referencesto discoverPlan,Design, and priorResearchfiles. - Read
activeContext.md ## Decisionsfor prior planner/build clarifications. - Read
progress.md ## Current Workflowand## Tasksfor pending work that should resume instead of duplicating. - Read the latest
.cc10x/workflows/*.jsonartifact 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_rfcverification_rigor:standard|critical_pathcheckpoint_type:none|human_verify|decision|human_actionproof_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 preparationand### BUILD task graphblocks 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 preparationand### DEBUG task graphblocks 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 preparationand### REVIEW task graphblocks 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 preparationand### PLAN task graphblocks 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.mdbefore 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_uuidandworkflow_id)__WORKFLOW_TYPE__→{WORKFLOW}(BUILD | DEBUG | REVIEW | PLAN)__USER_REQUEST__→ the user request (JSON-escape quotes/newlines)__PHASE__→{build|debug|review|plan}__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.mdand apply its### BUILD task graphblock verbatim before creating BUILD child tasks.
DEBUG task graph
- See
references/debug-workflow.mdand apply its### DEBUG task graphblock verbatim before creating DEBUG child tasks.
REVIEW task graph
- See
references/review-workflow.mdand apply its### REVIEW task graphblock verbatim before creating REVIEW child tasks.
PLAN task graph
- See
references/plan-workflow.mdand apply its### PLAN task graphblock verbatim before creating PLAN child tasks.
Research tasks
- When a workflow explicitly triggers research task creation, immediately read
references/remediation-and-research.md. - Use the
## 10. Research Orchestration,## Research Quality, and## Research Filesblocks there before creating or consuming research 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:silent-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:web-researcher |
research-github |
cc10x:github-researcher |
kind:remfix + origin:bug-investigator |
cc10x:bug-investigator |
build-doc-sync |
cc10x:doc-syncer |
kind:remfix + `origin:code-reviewer |
silent-failure-hunter |
Per-role model-tier policy
The router dispatches a full agent chain per phase. Match the model tier to the role's cognitive load instead of inheriting the session model for everything. Tiers are abstract: cheap (small/fast), standard (mid), capable (frontier). Resolve each to the concrete model id the host exposes at dispatch time.
| 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, silent-failure-hunter |
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. |
web-researcher, github-researcher |
standard | Retrieval + synthesis. |
HARD rule — always specify the model explicitly. Omitting the model makes the agent inherit the expensive session model, which silently overpays for mechanical builders and reviewers. Every Agent(...) dispatch sets the model from this table; no implicit inheritance.
Reviewer FLOOR — never run a verifier or reviewer (code-reviewer, silent-failure-hunter, integration-verifier, plan-gap-reviewer) on the cheapest tier. The cheapest tier rubber-stamps. Mid-tier is the floor for anything that gates quality; bump UP, never below.
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. Under JUST_GO, still apply this policy — never silently downgrade a gating role to save tokens.
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"}
Optional sections:
## Pre-Answered Requirementsfor BUILD when router already gathered decisions.## Intent Contractwhen a plan or design already defined goal, constraints, acceptance criteria, and named scenarios.## Research Filesonly when at least one research file exists.## Research Qualityonly when at least one research result exists.## Design Fileonly for planner.## Planning Review Findingsonly forre-plan.## Original User Requestonly forplan-gap-reviewer.## Approved Context Filesonly forplan-gap-reviewer.## Previous Agent Findingsonly for integration-verifier and only after review/hunt phases.
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.
Deterministic skill hints
- Router is the only authority allowed to load internal CC10X skills.
- Agents may not self-activate
frontend-patternsorarchitecture-patterns. - Include
cc10x:frontend-patternsonly when the request, changed files, plan, or design clearly targets UI/frontend work. - Include
cc10x:architecture-patternsonly for multi-component, API, schema, auth, or integration-heavy work. - Include
cc10x:researchonly when planner or investigator receives## Research Files. - Include
cc10x:prototypingonly 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. Absorbing a spike's answer is a fresh gated BUILD, not promotion. - Include
cc10x:finding-duplicate-functionsonly when the code-reviewer is asked for a reuse/consolidation audit or the request explicitly targets semantic duplication. - Include
cc10x:mcp-clionly when a researcher needs a one-off MCP capability that is not already mounted. - Include
cc10x:receiving-code-reviewonly 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:codebase-deepeningonly when the request targets retrofitting/deepening shallow modules in EXISTING code (not greenfield architecture, which stayscc10x:architecture-patterns). - Include
cc10x:frontend-design-critiqueonly when reviewing the visual/UX QUALITY of built UI (scoring/slop-check) — distinct fromcc10x:frontend-patterns(authoring guidance). - Include
cc10x:handoff-packageonly 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-eval-harnessandauthoring-cc10x-guidanceare maintainer-time meta-skills (loaded when authoring/changing cc10x itself), not routed into normal build/debug/review/plan workflows.- 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, pass:
## Previous Agent Findings
### Code Reviewer
**Verdict:** {Approve|Changes Requested}
**Critical Issues:**
{reviewer critical issues or "None"}
### Silent Failure Hunter
**Critical Issues:**
{hunter critical issues or "None / not in this workflow"}
DEBUG skips hunter findings.
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_secondstelemetry.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-verifierreports a### Timing & Workloadsection, persist:telemetry.verifier.phase_exit_proof_runstelemetry.verifier.extended_audit_runstelemetry.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## Error Handling Audit: CLEAN|ISSUES_FOUND## 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_ISSUESfrom### Critical Issues. - If output is too short or malformed, run inline verification rather than blindly approving.
- Detect
SELF_REMEDIATEDfrom task state:- If the task remains
in_progressandblockedByis non-empty after the agent stops, treat it as self-remediated.
- If the task remains
- For integration-verifier, parse scenario accounting:
SCENARIOS_TOTALSCENARIOS_PASSEDSCENARIOS_FAILED- Fail validation if those counts do not reconcile with the evidence array.
- Fail validation if any scenario omits explicit
ExpectedorActualevidence.
Read-only structured intent fields:
REMEDIATION_NEEDED: true|falseREMEDIATION_REASON: ...REMEDIATION_SCOPE_REQUESTED: N/A|CRITICAL_ONLY|ALL_ISSUESREVERT_RECOMMENDED: true|falsePLANNING_REVIEW_STATUS: PASS|FINDINGSBLOCKING_FINDINGS_COUNT: [number]REPLAN_NEEDED: true|falseREPLAN_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 brainstorming handoff
After Skill(skill="cc10x:brainstorming"), parse the fenced YAML block under
### Brainstorming Handoff (MACHINE-READABLE).
Required field:
DESIGN_FILE
If present:
- persist it into workflow artifact
design_file - pass it to planner as
## Design File - do not require
activeContext.mdto be updated first
Contract overrides
- Before treating any agent
STATUS/verdict as a pass, readreferences/workflow-artifact-and-hook-policy.md§contracts and apply the per-agent contract-override pass conditions verbatim (theSTATUS=PASS/FIXED/APPROVE/CLEAN/PLAN_CREATED/COMPLETEgates, plus the reviewer/hunter rubber-stamp fallbacks).
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_statetoneeds_iterationand 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 Rulesblock there as canonical router law.
10. Research Orchestration
- See
references/remediation-and-research.mdand apply its## 10. Research Orchestration,## Research Quality, and## Research Filesblocks whenever research is triggered or consumed.
Research Quality
- See
references/remediation-and-research.mdand apply its## Research Qualityblock whenever research quality must be summarized or persisted.
Research Files
- See
references/remediation-and-research.mdand apply its## Research Filesblock whenever research file paths are handed to planner or investigator.
11. Re-Review Loop
- See
references/remediation-and-research.mdand apply its## 11. Re-Review Loopblock whenever akind:remfixtask completes.
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. If `code-reviewer` and `silent-failure-hunter` are both ready in BUILD:
- mark both in_progress first
- invoke them in the same message
- If parallel invocation fails or is unavailable (API error, rate limit): fall back to sequential execution (reviewer first, then hunter). 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 stricter verdict as authoritative and do not average or reconcile the signals. Log the contradiction in `status_history`.
- 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
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.
- Capture memory payload first, before validation or task-state mutation.
- READ-ONLY agents: extract
### Memory Notes (For Workflow-Final Persistence)immediately after return. - WRITE agents: extract
MEMORY_NOTESfrom YAML immediately after return.
- READ-ONLY agents: extract
TaskGet({ taskId })orTaskList()to verify final task state.- WRITE agents:
- They should already have called
TaskUpdate(status="completed"). - Parse YAML before continuing.
- They should already have called
- READ-ONLY agents:
- Router owns completion fallback for read-only tasks.
- If the task is still not completed after agent return, router applies fallback
TaskUpdate(status="completed"). - Blockers or findings may change workflow routing, but they never transfer orchestration ownership back to the read-only agent.
- Memory payload was already captured in step 0:
- READ-ONLY agents: append extracted notes to the memory task description.
- WRITE agents: append deferred or supplemental payload needed by the memory task.
- Update
.cc10x/workflows/{workflow_uuid}.jsonwith:- intent contract fields from planner output when available
- task ids
- phase status
- phase cursor changes only after
phase_exit_gatepasses - structured agent results
- scenario evidence grouped by agent
- plan/design/research file paths
- capabilities and chosen research backend path when applicable
- research quality and round metadata when applicable
- telemetry:
- task metrics duration when available
- loop counters
- verifier workload classification when present
- quality/convergence state
- status_history and remediation_history entries when decisions change workflow state
- pending gate if waiting on user input
- Persist
[cc10x-internal] memory_task_id: {memory_task_id} wf:{workflow_uuid}only if it matches the active workflow.
Verifier findings handoff
Before invoking integration-verifier in BUILD:
- Read
results.reviewerandresults.hunterfrom the workflow artifact. - Build
## Previous Agent Findingsexactly in the format verifier expects. - Never invoke verifier without that section when review/hunt already ran.
Inline no-subagent execution (FALLBACK — not the default)
The default execution model is per-phase subagent dispatch: every phase runs in a fresh-context agent via the dispatcher (§7), and that remains the default whenever the Task/Agent primitive is available AND the work is separable. The fallback below is a bounded degrade mode, NOT a shortcut to reach for when dispatch feels heavy. Prefer subagents. Only enter inline mode on one of the two triggers, and record which one in status_history.
Enter inline mode when EITHER trigger holds:
- Primitive unavailable (graceful degrade): the host harness does not expose the Task/Agent primitive (no
Agent(...)dispatch path, orTaskCreate/TaskListare absent). Without it the router cannot spawn phase agents at all; rather than be inoperative, it executes the plan itself. - Tightly-coupled work (anti-thrash): the phases are so coupled that isolated phase agents would thrash — they cannot share in-flight state (e.g. a builder and its verifier must observe the same uncommitted in-memory/scratch state, or a phase boundary cannot be expressed as a self-contained scaffold without re-deriving most of the prior phase). Splitting such work across isolated agents loses the shared state at every handoff. When the §5 Intent Readiness Gate shows the phases cannot be cleanly decomposed into self-contained scaffolds, that is this trigger.
What changes vs. default: the ROUTER executes each phase's work inline, in the main session, instead of spawning the phase agent. Walk the same task graph in the same order the dispatcher would. Lose the subagent isolation — KEEP every gate.
What does NOT change (the gates stay fail-closed):
- Run
phase_exit_gateat each phase boundary exactly as in the default loop step 6 — if the phase is not complete, persistphase_status={partial|blocked}and stop. No phase advances on prose. - Persist structured results into the workflow artifact, including
results.baselineand the per-phase results the spawned agent would have written. The artifact remains the source of truth; do not rely on conversation narrative. - Compute the clean-baseline diff the same way: record the baseline before the build phase, and at verification diff the working tree against it so the verifier checks only this workflow's changes.
- Run an inline verification pass in place of spawning
integration-verifier: the router itself applies the integration-verifier's checks (run the scenarios, captureExpected/Actualevidence per scenario, reconcileSCENARIOS_TOTAL/PASSED/FAILED, and honor the REVERT authority) and writes the same scenario-accounting into the artifact that §8 post-agent validation would parse. The point is to lose the subagent, not the verification — incomplete or contradictory evidence still setsquality.convergence_state=needs_iterationand stops on the remediation gate. - All §14 hard rules still bind: never report pass/fixed/complete without confirming the verification evidence, never exceed the 3-cycle remediation limit without a human checkpoint, fail closed on ambiguity or skipped work.
The cost — be disciplined about it: inline mode forfeits fresh-context isolation. The router now carries the build, review, hunt, and verify context in one session, so context can bleed across phases (the very pollution subagents prevent). Counter it: between phases, re-ground from the workflow artifact rather than from earlier turns; include only the current-phase objective and live evidence when reasoning about a phase; treat completed-phase narrative as stale. If the session context grows large enough to threaten this discipline, prefer returning to subagent dispatch over pushing further inline.
Mode bookkeeping: persist execution_mode="inline_fallback" and inline_fallback_reason={primitive_unavailable|tightly_coupled} in the workflow artifact, and log an event=inline_fallback_entered entry in .cc10x/workflows/{wf}.events.jsonl. If the primitive becomes available again and the remaining work is separable, the router MAY resume default subagent dispatch for later phases; log event=inline_fallback_exited.
13. Memory Finalization
The memory task executes inline only. Never spawn it as a sub-agent.
The memory task:
- Reads the workflow artifact plus its own description payload, not conversation history.
- Persists learnings to:
activeContext.md ## Learningspatterns.md ## Common Gotchasprogress.md ## Verification
- Writes deferred items as
[Deferred]: ...underpatterns.md ## Common Gotchas. - Replaces
progress.md ## Taskswith the active workflow snapshot. - Keeps only the most recent 10 items in
progress.md ## Completed. - Removes the matching
[cc10x-internal] memory_task_idline fromactiveContext.md ## References. - If any artifact or memory write fails, stop immediately. Never advance the workflow after a failed persistence write.
For PLAN:
- Ensure
- Plan: {plan_file}remains correct inactiveContext.md ## References. - Ensure
- Design: {design_file}remains correct inactiveContext.md ## Referenceswhen a design exists. - If a plan exists, record
Plan saved: {plan_file}inactiveContext.md ## Recent Changes. - If a plan exists, set
activeContext.md ## Next Stepsto1. Execute plan: {plan_file}unless the workflow ended in clarification-needed state.
For DEBUG:
- Preserve the latest
[DEBUG-RESET: wf:{workflow_uuid}]section in## Recent Changesand summarize the final result beneath it.
14. Hard Rules
- Router must run in the main Claude Code session, never inside a sub-agent.
- Router is the only orchestration state owner. Agents may propose remediation or next actions, but only the router creates, blocks, unblocks, reuses, or completes orchestration tasks.
- Never stop after one agent if the workflow chain has more runnable tasks.
- Never rely on prose when
wf:,kind:,origin:,phase:, orscope:can answer the question. - Never use an unscoped task lookup in critical paths.
- Never treat stored task IDs as durable truth across workflows.
- Never spawn Memory Update as a sub-agent.
- Never create
CC10X TODO:tasks. Non-blocking discoveries go into**Deferred:**memory notes. - Never let REVIEW create implementation tasks without an explicit router/user transition into BUILD.
- Never report a workflow outcome (pass, fixed, complete) to the user without first confirming the verification evidence that supports that claim. "I believe it works" is not evidence. [EASY TO MISS: "I ran the tests and they passed" without showing command output, exit codes, or scenario evidence is also not evidence. Require concrete proof artifacts, not agent assertions.]
- Never let a remediation loop run more than 3 cycles without a human checkpoint. Drift accumulates silently in long chains.
- Only parallelize agents whose file-write surfaces do not overlap. Reviewer and hunter are read-only and safe to parallelize. Two write agents on overlapping files must be serialized. [EASY TO MISS: Each parallel agent must have a distinct phase value and unique task description. Identical prompts cause agents to duplicate work or silently clobber each other's output.]
- Agents must never inherit raw conversation context. They receive only the structured scaffold from the dispatcher. Leaking conversation history into agent prompts causes scope pollution and non-reproducible behavior.
- Maintain professional objectivity in all routing decisions. Do not rationalize a failing workflow as "close enough" or downgrade critical findings to avoid remediation. The router exists to enforce quality, not to please.
DIFF_DRIVEN_DOCS: skipin Session Settings disables doc-syncer for projects that manage documentation separately; when present, skipbuild-doc-synctask creation and block Memory Update onverifier_task_iddirectly.- Agents must never read another agent's or skill's ORCHESTRATION STATE (workflow artifacts, another agent's contract, router-internal task bookkeeping). Cross-agent orchestration knowledge flows exclusively through router-mediated scaffolds and workflow artifacts. Reading a shared pattern/reference doc for domain guidance is fine; inheriting another agent's live state is not.
- Native plan mode (EnterPlanMode) is not the planning substrate — the CC10x PLAN workflow is, because it carries orchestration state, workflow artifacts, intent contracts, and the bounded fresh review. But a plan the user produced via native plan mode is an acceptable input: ingest it as the
plan_fileand run the fresh-review gate over it rather than rejecting it outright. - Workspace isolation and branch finishing are router-owned, optional, and gated — never auto-run. At BUILD/PLAN start the router MAY offer worktree isolation, deferring to a native worktree primitive (e.g. EnterWorktree) when one exists and skipping silently when none does — cc10x never hard-requires git worktrees. After the final phase verifies PASS, the router MAY offer a finishing menu (merge / open-PR / keep / discard) via a single AskUserQuestion; it must never execute a destructive git operation (merge into a base branch, branch delete, force-push, discard) without the user's explicit menu choice, and JUST_GO auto-defaults this gate to the non-destructive
keep as-isoption. Both offers are skipped forbuild_scope=trivial. See references/build-workflow.md### BUILD-DONE finishing (optional)for the canonical wording. - A terse imperative specifies the GOAL, not the METHOD. "just add the endpoint", "quickly fix X", "simply wire Y" name a destination; they do NOT waive
phase_exit_gate, the TDD/verifier chain, the complexity gradient's trivial→full escalation, or any governing workflow. Terseness lowers ceremony, never rigor. Treat "just"/"quickly"/"simply" as urgency cues, not as permission to skip routing or gates. - Route-and-load the governing workflow BEFORE asking clarifications or exploring. The workflow reference (
references/build-workflow.md,references/debug-workflow.md,references/review-workflow.md,references/plan-workflow.md) tells you HOW to ask and what readiness it needs; do not freelance clarifying questions or broad exploration ahead of loading it.
Capability-offer interaction principle
Optional, cost-bearing capabilities (worktree isolation, research accelerators / web+github researchers, the BUILD-DONE finishing menu) are offered under restraint:
- Offer only when warranted by the actual task, never reflexively.
- Put the offer in its OWN message — just the offer, nothing else bundled in — so it is easy to decline without derailing the work.
- Be honest about cost: name that the capability is token-/cost-intensive or slower when it is.
- NEVER re-offer a capability once the user has declined it, unless the user raises it again themselves. A declined offer is a closed decision for the rest of the session.