manage-issue-execute
Issue Execute
Usage
$manage-issue-execute "ISS-20260401-001"
$manage-issue-execute "ISS-20260401-001 --dry-run"
$manage-issue-execute "ISS-20260401-001 --executor codex"
$manage-issue-execute "ISS-20260401-001 --executor gemini"
Flags:
<ISS-ID>— Issue ID inISS-XXXXXXXX-NNNformat (required)--executor claude-code|codex|gemini— Execution agent (default: claude-code)--dry-run— Preview constructed prompt and steps without executing
State files: .workflow/issues/issues.jsonl (read + write)
Overview
Sequential 4-step pipeline with conditional dispatch: load issue → dry-run check → detect mode → execute + update. Server-UP path posts to the orchestration API; Server-DOWN path invokes maestro delegate directly. This is the third step in the issue resolution workflow: analyze → plan → execute.
Load Issue → [dry-run?] → Detect Mode → Dispatch → Update Status
(+ solution (display server UP POST (apply_patch)
required) + stop) / DOWN / cli
Implementation
Step 1: Load Issue and Validate Solution
functions.update_plan({
explanation: "Starting issue execution",
plan: [
{ step: "Load issue and validate solution", status: "in_progress" },
{ step: "Detect dispatch mode", status: "pending" },
{ step: "Execute solution", status: "pending" },
{ step: "Update issue status", status: "pending" }
]
})
Read .workflow/issues/issues.jsonl, find row where id == <ISS-ID>. Validate:
- ISS-ID format
ISS-[0-9]{8}-[0-9]{3} - Row exists in file
issue.solutionis non-null (E002 if missing — runmanage-issue-planfirst)
If --dry-run: display the full constructed prompt and each step from issue.solution.steps, then stop.
Step 2: Detect Dispatch Mode
// Read port from config (falls back to MAESTRO_PORT env var, then 3000)
const configPort = (() => {
try { return JSON.parse(Read('.workflow/config.json'))?.server?.port } catch { return null }
})()
const port = configPort || functions.exec_command({ cmd: "echo ${MAESTRO_PORT:-3000}", workdir: "." }).stdout.trim()
const healthCheck = functions.exec_command({
cmd: `curl -s -o /dev/null -w '%{http_code}' http://localhost:${port}/health`,
workdir: "."
})
const serverUp = healthCheck.stdout.trim() === "200"
| Mode | Condition | Action |
|---|---|---|
| Server UP | HTTP 200 from /health | POST to /api/execution/dispatch |
| Server DOWN | Any other result | Direct maestro delegate execution |
functions.update_plan({
explanation: `Dispatch mode: ${serverUp ? "server" : "cli"}`,
plan: [
{ step: "Load issue and validate solution", status: "completed" },
{ step: "Detect dispatch mode", status: "completed" },
{ step: "Execute solution", status: "in_progress" },
{ step: "Update issue status", status: "pending" }
]
})
Step 3: Execute Solution
Build the execution prompt from issue.solution:
PURPOSE: Implement solution for '${issue.title}'.
TASK: ${solution.steps.map(s => `${s.order}. ${s.description} in ${s.file}`).join(' | ')}
MODE: write
CONTEXT: @src/**/* | Memory: Approach: ${solution.approach}
${issue.analysis ? `Root cause: ${issue.analysis.root_cause}` : ''}
EXPECTED: All steps implemented, all verification criteria met: ${solution.verification.join('; ')}
CONSTRAINTS: Only modify files listed in steps | No scope creep
Server UP:
// Write payload to temp file to avoid shell injection from prompt content
const payload = JSON.stringify({ issue_id: issue.id, executor, prompt: execPrompt })
Write(`/tmp/iss-exec-${issue.id}.json`, payload)
functions.exec_command({
cmd: `curl -X POST http://localhost:${port}/api/execution/dispatch \
-H 'Content-Type: application/json' \
-d @/tmp/iss-exec-${issue.id}.json`,
workdir: "."
})
Server DOWN:
// Write prompt to temp file to avoid shell injection
Write(`/tmp/iss-exec-${issue.id}.txt`, execPrompt)
functions.exec_command({
cmd: `maestro delegate "$(cat /tmp/iss-exec-${issue.id}.txt)" --to ${executor === 'codex' ? 'codex' : 'claude'} --mode write`,
workdir: "."
})
Set issue status to in_progress before dispatching via apply_patch.
Step 4: Update Issue Status and Report
On success:
// Read issues.jsonl, update the matching line in-place
const historyEntry = { action: "executed", at: new Date().toISOString(), by: "manage-issue-execute", executor, summary: `Solution executed via ${serverUp ? "server" : "cli"}` }
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.status = "resolved"
row.issue_history = [...(row.issue_history || []), historyEntry]
return JSON.stringify(row)
})
.join('\n') + '\n'
Write('.workflow/issues/issues.jsonl', updated)
functions.update_plan({
explanation: "Execution complete",
plan: [
{ step: "Load issue and validate solution", status: "completed" },
{ step: "Detect dispatch mode", status: "completed" },
{ step: "Execute solution", status: "completed" },
{ step: "Update issue status", status: "completed" }
]
})
Display next-step routing:
=== EXECUTION COMPLETE ===
Issue: <ISS-ID>: <title>
Executor: <executor>
Mode: <server|cli>
Status: resolved
Next steps:
Close: $manage-issue "close <ISS-ID> --resolution fixed"
Verify: $maestro-verify "<phase>"
Debug: $quality-debug "<failure description>" (if issues found)
Error Handling
| Code | Severity | Condition | Recovery |
|---|---|---|---|
| E001 | error | No ISS-ID provided | Display usage hint |
| E002 | error | No solution record on issue | Run $manage-issue-plan "<ISS-ID>" first |
| E003 | error | ISS-ID not found in issues.jsonl | Suggest $manage-issue "list" |
| E004 | error | Server dispatch or CLI execution failed | Log error, revert status to open, display failure details |
Core Rules
- Solution required: Never dispatch without a valid
issue.solutionrecord - Dry-run first:
--dry-runalways stops after displaying prompt — no execution - Status before dispatch: Set status to
in_progressbefore dispatching,resolvedon success,openon failure - Revert on failure: If dispatch fails, revert issue status to
openvia apply_patch - Preserve history: Append to
issue_history, never overwrite existing entries - Next-step routing: Always display all three options (close / verify / debug) 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