| name | analyze |
| description | Use when deep investigation is needed — project structure, requirement gaps, or root cause diagnosis. Supports --delegate. |
| argument-hint | [--delegate] [investigation target or question] |
Deep Analysis & Investigation
You are the Analyze orchestrator. Agent protocols provide the investigation methodology —
you execute them and record output. Never generate findings without an agent protocol.
| Argument | Mode |
|----------|------|
| `` | Self-execute on current host (default) |
| `--delegate` | Delegate to the other host (Codex when current is Claude, Claude when current is Codex; current host comes from SessionStart `Current host:`) |
| `--delegate ` | Same with prompt |
Strip the --delegate flag before passing the prompt to the execution path.
</Argument_Routing>
Phase 1 — Create Analysis File
Write CORAL_PROJECT/analysis/{YYYY-MM-DD}-{topic}.md with header:
# Analysis: {topic}
Date: {YYYY-MM-DD}
Question: {user's original request}
- Topic: 2-4 word kebab-case (e.g.,
auth-flow-gaps, ci-pipeline-root-cause)
- Collision: same date + topic → append
-2, -3
Phase 2 — Investigation Steps
For each step in the table below, in order:
- Evaluate — check "Needed when" against the user's request AND prior findings. Skip if unneeded.
- Scope — determine target files/modules. Never run unscoped. If a step discovers new facets, carry them into subsequent step evaluation.
- Execute — run via active mode (see Mode below).
- Post-process — apply quality gates:
- Verify CRITICAL/HIGH file:line references (Read cited location, drop incorrect)
- Drop speculative findings without code evidence. Findings about unchanged code: downgrade and move to
### Peripheral Findings
- Tag provenance (code trace / test behavior / git history / inference / assumption). Assumption-only → downgrade one level
- Record finding flow: "N initial → M after gates → K verified [code: X, inference: Y, assumption: Z]"
- Append — write under the step's output section heading.
Wait for each step's result before evaluating the next. At least one step must run.
Mode
Self-execute (default): Spawn Agent({ subagent_type: "coral:<agent>", prompt: "--deep " + prompt }).
Wait for the agent to return its findings.
You (the executor) post-process and append the result to the file after each step completes.
Delegate (--delegate): run coral-cli <other-host> <role_name> -i "<--deep prompt>" --work-dir "<work_dir>" -d where <other-host> is the non-current host (Codex if current is Claude; Claude if current is Codex)
with scope, work_dir, and analysis file content so far.
Run one step at a time — do NOT launch steps in parallel. Each step's output informs
the next step's scope and "Needed when" evaluation.
Each step is a fresh call (no session continuity — each agent has a different role).
After each launch: capture job from Job <job> <launchState> (session <session>), then run coral-cli wait jobs <job> --embed → the terminal output always includes Result path: <path>; read that path for the full artifact and treat inline preview text as optional convenience.
On error, abort the chain and report the error.
You (the executor) post-process and append the result to the file after each step completes.
Steps
| Step | Agent file | Needed when | Output section |
|---|
| 1 — Project Scan | coral:scanner | Project structure, architecture, dependencies, or systemic process issues are relevant | ## Scan Report |
| 2 — Gap Analysis | coral:gap-finder | Requirement gaps, acceptance criteria, API contracts, or scope risks — from the user's request OR gaps discovered in Step 1 | ## Gap Analysis |
| 3 — Root Cause Diagnosis | coral:debugger | Bugs, errors, crashes, or unexpected behavior — from the user's request OR symptoms surfaced in prior steps | ## Root Cause Diagnosis |
Phase 3 — Synthesis Review
Always runs. Read the full analysis file, then:
- Finding flow summary — counts per step: initial → filtered → verified
- Thematic grouping (≥2 steps) — group related findings across steps into 2-4 themes. Do NOT restate findings step-by-step. Single step: skip grouping.
- Unanswered aspects — parts of the user's question no step addressed
- Cross-step consistency (≥2 steps) — contradictions or reinforcements
Synthesis is meta-verification of existing findings — do NOT re-run agent investigation.
If issues found: investigate directly, append under ## Synthesis Review.
If clean: append only the finding flow summary.
Phase 4 — Present
Show the saved file path, then summarize key findings inline.
<Error_Policy>
If an agent file cannot be read, report the error to the user. Do not fall back to inline analysis.
</Error_Policy>