manage-issue-analyze
Issue Analyze
Usage
$manage-issue-analyze "ISS-20260401-001"
$manage-issue-analyze "ISS-20260401-001 --depth deep"
$manage-issue-analyze "ISS-20260401-001 --tool qwen --depth standard"
Flags:
<ISS-ID>— Issue ID inISS-XXXXXXXX-NNNformat (required)--tool gemini|qwen— CLI tool for analysis (default: gemini)--depth standard|deep—standarduses keyword grep;deepspawns a semantic explore agent (default: standard)
State files: .workflow/issues/issues.jsonl (read + write)
Overview
Sequential 4-step pipeline: load issue → gather codebase context → run CLI analysis → attach analysis record. The CLI analysis step invokes maestro delegate --to gemini --mode analysis to produce a structured root-cause record written back into issues.jsonl. This is the first step in the issue resolution workflow: analyze → plan → execute.
Load Issue → Gather Context → CLI Analysis → Attach Record
(validate) (grep / agent) (gemini/qwen) (apply_patch)
Implementation
Step 1: Load and Validate Issue
functions.update_plan({
explanation: "Starting issue analysis",
plan: [
{ step: "Load and validate issue", status: "in_progress" },
{ step: "Gather codebase context", status: "pending" },
{ step: "Run CLI analysis", status: "pending" },
{ step: "Attach analysis record", status: "pending" }
]
})
Read .workflow/issues/issues.jsonl line by line. Find the row where id == <ISS-ID>. Validate:
- ISS-ID matches format
ISS-[0-9]{8}-[0-9]{3} - Row found in file
- Parse fields:
id,title,description,status,context,related_files
If status is not open or registered, emit W001 but continue.
Step 2: Gather Codebase Context
Standard depth (default):
- Grep key terms from
issue.title+issue.descriptionacrosssrc/**(-C 3) - If
issue.related_filesis set, read those files directly - Collect file:line references into
contextSummary
Deep depth:
spawn_agent({
task_name: "ctx-explore",
fork_turns: "none",
message: `## TASK ASSIGNMENT
### MANDATORY FIRST STEPS
1. Read: ~/.codex/agents/cli-explore-agent.md
---
Goal: Gather codebase context for issue root-cause analysis.
Issue: <issue.title>
Description: <issue.description>
TASK: Find all code paths, functions, and modules related to this issue.
Identify: affected locations (file:line), caller/callee chains, data flow, existing error handling.
EXPECTED: JSON with: affected_files [{file, line, snippet, relevance}], related_modules, error_handling_gaps, test_coverage_gaps.
`
})
const ctxResult = wait_agent({ timeout_ms: 600000 })
close_agent({ target: "ctx-explore" })
functions.update_plan({
explanation: "Context gathered",
plan: [
{ step: "Load and validate issue", status: "completed" },
{ step: "Gather codebase context", status: "completed" },
{ step: "Run CLI analysis", status: "in_progress" },
{ step: "Attach analysis record", status: "pending" }
]
})
Step 3: Run CLI Analysis
Prompt safety:
issue.titleandcontextSummarymay contain quotes or shell-special characters. Write the full prompt to a temp file first and reference it via$(cat ...)to avoid shell injection.
// Build prompt, write to temp file to avoid shell injection
const promptContent = `PURPOSE: Root cause analysis for issue; identify exact cause, impact scope, fix direction; success = actionable record with file:line evidence.
Issue: ${issue.id} — ${issue.title}
TASK: Trace failure path | Map affected components | Assess blast radius | Define fix direction
MODE: analysis
CONTEXT: @src/**/* | Memory: ${contextSummary}
EXPECTED: JSON: root_cause (string), affected_files (string[]), impact_scope (low|medium|high|critical), fix_direction (string), confidence (low|medium|high)
CONSTRAINTS: Evidence required — file:line for each claim`
Write(`/tmp/iss-analyze-${issue.id}.txt`, promptContent)
functions.exec_command({
cmd: `maestro delegate "$(cat /tmp/iss-analyze-${issue.id}.txt)" --to ${tool} --mode analysis`,
workdir: "."
})
Parse CLI output into analysis object:
{
"root_cause": "...",
"affected_files": ["src/foo.ts:42"],
"impact_scope": "medium",
"fix_direction": "...",
"analyzed_at": "<ISO>",
"tool": "<tool>",
"depth": "<depth>",
"confidence": "medium"
}
Step 4: Attach Analysis Record and Report
// Read issues.jsonl, update the matching line in-place
const historyEntry = { action: "analyzed", at: new Date().toISOString(), by: "manage-issue-analyze", summary: `Root cause: ${analysis.root_cause}` }
const raw = Read('.workflow/issues/issues.jsonl')
const updated = raw.split('\n')
.filter(l => l.trim())
.map(l => {
const row = JSON.parse(l)
if (row.id !== issueId) return l
row.analysis = analysis
row.issue_history = [...(row.issue_history || []), historyEntry]
return JSON.stringify(row)
})
.join('\n') + '\n'
Write('.workflow/issues/issues.jsonl', updated)
functions.update_plan({
explanation: "Analysis complete",
plan: [
{ step: "Load and validate issue", status: "completed" },
{ step: "Gather codebase context", status: "completed" },
{ step: "Run CLI analysis", status: "completed" },
{ step: "Attach analysis record", status: "completed" }
]
})
Display:
=== ANALYSIS COMPLETE ===
Issue: <ISS-ID>: <title>
Root Cause: <root_cause>
Impact: <impact_scope>
Confidence: <confidence>
Affected: <N> files
Next: $manage-issue-plan "<ISS-ID>"
Error Handling
| Code | Severity | Condition | Recovery |
|---|---|---|---|
| E001 | error | No ISS-ID provided | Display usage hint with format example |
| E002 | error | ISS-ID format invalid | Show correct format ISS-XXXXXXXX-NNN |
| E003 | error | ISS-ID not found in issues.jsonl | Suggest $manage-issue "list" |
| E004 | error | CLI analysis returned no parseable result | Retry with different --tool; report partial |
| W001 | warning | Issue status is not open/registered | Warn, allow analysis to continue |
Core Rules
- Start immediately: First action is
update_planthen issue load — no preamble - Validate before analysis: Never run CLI without a valid loaded issue
- Evidence required: Analysis record must cite file:line — no speculative root causes
- Deep agent lifecycle: If deep spawned an agent, always
close_agentbefore Step 3 - Append-only history: Append to
issue_history, never overwrite existing entries
- Note:
spawn_agent/wait_agent/close_agentare Codex v4 built-in orchestration functions — they do not need to be listed inallowed-tools
- Preserve existing fields: Patch only
analysis+issue_history— all other fields unchanged - Next-step routing: Always display
$manage-issue-plan "<ISS-ID>"at the end
More from catlog22/maestro-flow
spec-map
Analyze codebase with 4 parallel mapper agents via CSV wave pipeline. Produces .workflow/codebase/ documents for tech-stack, architecture, features, and cross-cutting concerns.
1manage-codebase-rebuild
Full codebase documentation rebuild via CSV wave pipeline. Spawns 5 parallel doc generator agents to scan project and produce complete .workflow/codebase/ documentation set. Replaces manage-codebase-rebuild command.
1maestro-quick
Fast-track single task execution with workflow guarantees — analyze, plan, execute in one pass
1quality-sync
Sync codebase docs after code changes -- traces git diff through component/feature/requirement layers
1maestro-roadmap
Lightweight roadmap generation via 2-wave CSV pipeline. Wave 1 runs parallel requirement analysis agents (scope, risk, dependency). Wave 2 runs roadmap assembly agent producing roadmap.md with phases, milestones, and success criteria. Replaces maestro-roadmap command.
1manage-memory
Manage memory entries across workflow and system stores (list, search, view, edit, delete, prune)
1