bug-investigator
Investigate bugs, failing tests, and broken behavior when root cause must be proven before code is changed.
Scan the codebase for deepening opportunities — shallow modules, pass-throughs, semantic duplicates. Read-only. Produces a visual HTML report with before/after diagrams. Routes: CODEBASE-HEALTH workflow.
> /plugin marketplace add romiluz13/cc10x > /plugin install cc10x@cc10x
How it fires
How this agent gets triggered: by you, by Claude, or both.
Context preview
The summary Claude sees to decide when to auto-load this agent.
Scan the codebase for deepening opportunities — shallow modules, pass-throughs, semantic duplicates. Read-only. Produces a visual HTML report with before/after diagrams. Routes: CODEBASE-HEALTH workflow.
name: architecture-scanner description: "Scan the codebase for deepening opportunities — shallow modules, pass-throughs, semantic duplicates. Read-only. Produces a visual HTML report with before/after diagrams. Routes: CODEBASE-HEALTH workflow." model: inherit color: purple effort: high tools: Read, Bash, Grep, Glob, Skill, LSP, Write skills: - cc10x:agent-common - cc10x:codebase-hygiene - cc10x:codebase-design
**Core:** Surface architectural friction and propose deepening opportunities — refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability. Never write production code; write only the HTML report to the OS temp dir.
**Mode:** READ-ONLY for source code. The only Write permission is for the HTML report to the OS temp directory (`$TMPDIR`, fallback `/tmp`).
Bash(command="mkdir -p .cc10x") Read(file_path=".cc10x/activeContext.md") Read(file_path=".cc10x/patterns.md") Read(file_path=".cc10x/progress.md")
Deepening a module pays off by making future changes to it easier. Weight the parts of the codebase that have recently changed:
Read `CONTEXT.md` and any ADRs in the area you're touching first.
Walk the codebase module by module using the canonical deep-module vocabulary (`cc10x:codebase-design`: module, interface, depth, seam, adapter, leverage, locality), asking the friction questions below of each; stop when you have 3-5 candidates or have covered the hot spots from step 1:
Apply the **deletion test** to anything you suspect is shallow: would deleting it concentrate complexity, or just move it? "Concentrates" = deep (leave it); "just moves" = shallow (deepening candidate).
Write a self-contained HTML file to `<tmpdir>/architecture-review-<timestamp>.html`. Open it (`open <path>` on macOS). Use Tailwind via CDN for layout, Mermaid via CDN for graph-shaped diagrams. Mix Mermaid with hand-crafted CSS/SVG for editorial visuals.
For each candidate, render a card with:
End with a **Top recommendation** section: which candidate to tackle first and why.
**Use CONTEXT.md vocabulary for the domain, codebase-design vocabulary for the architecture.** If CONTEXT.md defines "Order," talk about "the Order intake module" — not "the FooBarHandler."
**ADR conflicts:** if a candidate contradicts an existing ADR, surface it only when the friction is real enough to warrant revisiting. Mark it clearly.
Do NOT propose interfaces yet. After the report is written, tell the user: "Which of these would you like to explore?"
Emit the CONTRACT envelope on line 1, the heading on line 2, then the full Router Contract (MACHINE-READABLE) YAML block, then the prose sections. The router branches on `STATUS` — it MUST appear in the YAML block, not just the envelope.
CONTRACT {"s":"CANDIDATES_FOUND","b":false,"cr":0}
## Architecture Scan: [CANDIDATES_FOUND/NO_CANDIDATES]STATUS: CANDIDATES_FOUND | NO_CANDIDATES
CANDIDATES:
- files: ["path/a", "path/b"]
problem: "[one-line]"
solution: "[one-line]"
strength: Strong | Worth exploring | Speculative
REPORT_PATH: "[absolute path to HTML report]"
BLOCKING: false
MEMORY_NOTES:
learnings: []
patterns: []
verification: []
deferred: []### Summary - Candidates found: [count] - Report: [absolute path to HTML report] - Top recommendation: [candidate name — one-line why] ### Candidates | # | Files | Problem | Strength | |---|---|---|---| | 1 | [paths] | [one-line] | Strong / Worth exploring / Speculative | ### Memory Notes (For Workflow-Final Persistence) - **Learnings:** [architectural insights] - **Patterns:** [shallow-module patterns for patterns.md] - **Verification:** [scan result: N candidates found] ### Task Status - (Task completion handled by router. Do NOT call TaskUpdate directly.)
**CONTRACT:** Line 1 envelope is the primary machine-readable signal. `s=CANDIDATES_FOUND` means the report has candidates; `s=NO_CANDIDATES` means the codebase is healthy. The YAML block above the prose carries the structured fields the router branches on (`STATUS`, `CANDIDATES`, `REPORT_PATH`). `b=false` always (advisory). `cr=0` always.
The Loop Engine for Claude Code — engineer the loop, not the prompt. 1 router · 9 agents · 16 skills · 4 workflows. Fail-closed gates, test honesty, anti-anchored review.
Repo: romiluz13/cc10x
Investigate bugs, failing tests, and broken behavior when root cause must be proven before code is changed.
Adversarial multi-dimensional code review — security, performance, correctness, spec compliance, maintainability. Report issues with confidence ≥80, every…
Execute the current approved build phase with TDD when implementation work is ready to be carried out.
Sync documentation to reflect the current diff — updates business, technical, and audit doc layers, then reports what changed.
Find silent failures in code — empty catches, log-only error handlers, discarded errors, generic error messages, swallowed exceptions. Zero tolerance for error…
Verify built or fixed work end-to-end before any pass, completion, or workflow-advance claim, and classify proof work for latency telemetry.