Skill Index

maestro-flow/

maestro-amend

community[command]

Generate overlays to fix workflow command deficiencies

$/plugin install maestro-flow

details

<purpose> Signal-driven overlay generator — collect workflow deficiency signals from multiple sources, diagnose which commands need amendment, batch-generate targeted overlays. All amendments use overlay system (`~/.maestro/overlays/*.json`) — non-invasive, idempotent, survives reinstall.

Differs from /maestro-overlay (single explicit intent). This command discovers what needs amending by analyzing workflow artifacts. </purpose>

<required_reading> @/.maestro/workflows/overlays.md @/.maestro/cli-tools.json </required_reading>

<context> $ARGUMENTS — optional description and/or source flags.

Signal sources:

FlagSourceCollects
--from-verify <dir>verification.jsonWorkflow gaps from verify failures
--from-review <dir>review.jsonProcess deficiencies from code review
--from-session <id>Session artifactsProblems during workflow execution
--from-issues ISS-xxx,...issues.jsonlIssues tracing to command deficiency
--scanAuto-scan .workflow/Discover all workflow-related signals
(positional text)User descriptionDirect observation

Multiple combinable. No flags + no description → interactive (scan + AskUserQuestion).

Control: --dry-run (preview, don't install), -y (skip confirmations)

CLI targeting: "cli": "claude" (default, patches .claude/commands/), "codex" (patches .codex/skills/), "both" (both paths)

Output: ~/.maestro/overlays/amend-{slug}.json + optional ~/.maestro/overlays/docs/amend-{slug}.md </context>

<state_machine>

<states> S_COLLECT — 收集信号(从 flags / scan / description) PERSIST: — S_DIAGNOSE — 映射信号到命令补丁 PERSIST: — S_GROUP — 分组、规划 overlay 粒度 PERSIST: — S_PREVIEW — 展示注入点地图、用户确认 PERSIST: — S_DRAFT — 生成 overlay JSON PERSIST: overlay files S_INSTALL — 安装 overlay PERSIST: command files S_REPORT — 报告摘要 + post-patch routing PERSIST: — </states> <transitions>

S_COLLECT: → S_DIAGNOSE WHEN: signals found DO: A_COLLECT_SIGNALS → ERROR(E001) WHEN: no signals from any source

S_DIAGNOSE: → S_GROUP WHEN: command deficiencies identified DO: A_DIAGNOSE_SIGNALS → ERROR(E003) WHEN: all signals are code bugs (not command gaps)

S_GROUP: → S_PREVIEW DO: A_GROUP_OVERLAYS

S_PREVIEW: → S_DRAFT WHEN: user confirms "Apply all" or selects patches → S_PREVIEW WHEN: user selects "Edit" DO: modify signal target/section → END WHEN: user cancels

S_DRAFT: → S_INSTALL WHEN: not --dry-run DO: A_DRAFT_OVERLAYS → END WHEN: --dry-run DO: display JSON + section map preview

S_INSTALL: → S_REPORT DO: A_INSTALL_OVERLAYS (maestro overlay add, retry max 2 on validation failure)

S_REPORT: → END DO: display summary (signals collected/applied/skipped, overlay details, skipped code-bug routing)

</transitions> <actions>

A_COLLECT_SIGNALS

If source flags: extract signals from each specified source. If --scan or interactive: scan .workflow/ for:

  • verification.json → must_have_failures, anti_patterns (filter for command gap direction)
  • review.json → findings tagged "process" or "workflow"
  • debug understanding.md → root causes with workflow/command cause_type
  • issues.jsonl → status=open AND tags include "workflow"/"command"
  • execution summaries → plan deviations suggesting missing command step

If only description: parse for affected command(s), what's missing, expected behavior.

A_DIAGNOSE_SIGNALS

Per signal, determine:

  • signal_id, source, description, target_command, target_section, patch_mode, fix_direction, severity

Section mapping:

Signal patternSectionMode
Missing pre-check/gateexecutionprepend
Missing post-step/verificationexecutionappend
Missing reading/contextrequired_reading / deferred_readingappend
Incomplete success criteriasuccess_criteriaappend
Missing error handlingerror_codesappend
Scope/context gapcontextappend
Entirely new concern(new section)new-section

Read pristine source from $PKG_ROOT/.claude/commands/<name>.md to confirm section. Classify: command deficiency → proceed; code bug → skip (suggest /maestro-quick).

A_GROUP_OVERLAYS

Group by target command + section (merge same command+section). Granularity: 1-2 signals → patch-{command}-{slug}.json; 3+ cross-command → amend-{slug}.json. Read target commands to verify sections exist, check existing overlays.

Display section map with injection points per target command.

A_DRAFT_OVERLAYS

Build overlay JSON per schema: name, description, targets[], cli, priority (60), enabled, patches[{section, mode, content}]. Content rules: heading includes (patch: SIG-NNN), concise, supplementary doc to ~/.maestro/overlays/docs/ if >10 lines.

A_INSTALL_OVERLAYS

maestro overlay add ~/.maestro/overlays/amend-{slug}.json

On validation failure: fix JSON, retry (max 2).

</actions>

</state_machine>

<error_codes>

CodeConditionRecovery
E001No signals from any sourceVerify artifact paths or provide description
E002Signal source path invalid or unreadableCheck --from-* path; ensure artifact exists
E003All signals are code bugs, not command gapsUse /maestro-quick or /maestro-plan --gaps
E004Overlay validation failed after 2 retriesReview JSON manually
W001Some signals skipped (code bugs)Route to appropriate fix command
W002Target command has >= 3 existing overlaysConsider consolidating
</error_codes>

<success_criteria>

  • Signals classified: command deficiency vs code bug
  • Pristine command sources read to verify injection points
  • Section map with injection points confirmed by user
  • Overlay JSON installed successfully; command files contain overlay markers
  • Skipped code-bug signals routed to alternatives </success_criteria>

technical

github
catlog22/maestro-flow
stars
340
license
unspecified
contributors
1
last commit
2026-05-25T02:58:12Z
file
.claude/commands/maestro-amend.md

related