|
| 1 | +# Harmonize Agentic Operation |
| 2 | + |
| 3 | +Improve alignment between architecture documentation and generated agentic operations. |
| 4 | + |
| 5 | +This command orchestrates the positive feedback loop between architecture documentation in this repository and agentic operations for acting on the Galaxy codebase. The goal is to make commands as sharp and intelligent as possible while being completely generated from architecture documentation. |
| 6 | + |
| 7 | +## Usage |
| 8 | + |
| 9 | +``` |
| 10 | +/harmonize <existing-command-path> <topic-id> <operation-name> |
| 11 | +``` |
| 12 | + |
| 13 | +## Arguments |
| 14 | + |
| 15 | +- **existing-command-path**: Path to current slash command (e.g., `~/.claude/commands/review-di.md`) |
| 16 | +- **topic-id**: Topic in this repo (e.g., `dependency-injection`) |
| 17 | +- **operation-name**: Operation from metadata.yaml (e.g., `review-di`) |
| 18 | + |
| 19 | +## Your Task |
| 20 | + |
| 21 | +### Phase 1: Load and Analyze |
| 22 | + |
| 23 | +1. **Read the existing command** from the supplied path |
| 24 | +2. **Read topic content**: `topics/<topic>/metadata.yaml` and `topics/<topic>/content.yaml` |
| 25 | +3. **Read the operation's prompt** from metadata.yaml |
| 26 | +4. **Create directory** `topics/<topic>/harmonize/` if needed |
| 27 | +5. **Write analysis** to `topics/<topic>/harmonize/<op>_analysis.md`: |
| 28 | + |
| 29 | +```markdown |
| 30 | +# Harmonization Analysis: <operation-name> |
| 31 | + |
| 32 | +## Information in Command NOT in Docs |
| 33 | + |
| 34 | +<!-- List specific patterns, examples, guidance present in command but missing from content.yaml --> |
| 35 | + |
| 36 | +- [ ] ... |
| 37 | + |
| 38 | +## Information in Docs NOT in Command |
| 39 | + |
| 40 | +<!-- List architectural content from content.yaml not reflected in the command --> |
| 41 | + |
| 42 | +- [ ] ... |
| 43 | + |
| 44 | +## Gaps in Operation Prompt |
| 45 | + |
| 46 | +<!-- What does the prompt ask for that the docs can't provide? --> |
| 47 | + |
| 48 | +- [ ] ... |
| 49 | +``` |
| 50 | + |
| 51 | +### Phase 2: Generate Fresh Command |
| 52 | + |
| 53 | +Launch a **subagent** to generate a fresh command in isolation: |
| 54 | + |
| 55 | +``` |
| 56 | +Use the Task tool with: |
| 57 | +- subagent_type: "general-purpose" |
| 58 | +- prompt: | |
| 59 | + Run the /generate-agentic-op skill with arguments: <topic-id> <operation-name> |
| 60 | +
|
| 61 | + This will read topics/<topic>/metadata.yaml and content.yaml, then generate |
| 62 | + a command to generated_agentic_operations/commands/<topic>-<op>.md |
| 63 | +
|
| 64 | + Return the path to the generated file when complete. |
| 65 | +``` |
| 66 | + |
| 67 | +**Why a subagent?** The generation task should reason fresh from the documentation without being influenced by knowledge of the existing command or harmonization goals. This isolation ensures we see what the docs *actually* produce. |
| 68 | + |
| 69 | +After the subagent completes, read the generated file at `generated_agentic_operations/commands/<topic>-<op>.md` for Phase 3 comparison. |
| 70 | + |
| 71 | +### Phase 3: Compare Commands |
| 72 | + |
| 73 | +Read both commands and append a comparison section to the analysis file: |
| 74 | + |
| 75 | +```markdown |
| 76 | +## Command Comparison |
| 77 | + |
| 78 | +| Dimension | Original | Generated | Winner | |
| 79 | +|-----------|----------|-----------|--------| |
| 80 | +| Specificity of code patterns | ... | ... | ... | |
| 81 | +| Coverage of anti-patterns | ... | ... | ... | |
| 82 | +| Actionability of guidance | ... | ... | ... | |
| 83 | +| Use of related_code_paths | ... | ... | ... | |
| 84 | +| Alignment with docs | ... | ... | ... | |
| 85 | + |
| 86 | +## Key Differences |
| 87 | + |
| 88 | +1. ... |
| 89 | +2. ... |
| 90 | +3. ... |
| 91 | +``` |
| 92 | + |
| 93 | +### Phase 4: Generate Recommendations |
| 94 | + |
| 95 | +Write recommendations to `topics/<topic>/harmonize/<op>_recommendations.md`. |
| 96 | + |
| 97 | +Split into two categories - this separation is critical: |
| 98 | + |
| 99 | +```markdown |
| 100 | +# Harmonization Recommendations: <operation-name> |
| 101 | + |
| 102 | +## Documentation Improvements |
| 103 | + |
| 104 | +<!-- Changes to content.yaml to add missing reference info --> |
| 105 | +<!-- These become the source of truth that commands are generated from --> |
| 106 | + |
| 107 | +1. Add prose block about X |
| 108 | +2. Expand slide Y to include Z pattern |
| 109 | +3. Add agent-context block for anti-patterns |
| 110 | +4. Add example code showing pattern W |
| 111 | + |
| 112 | +## Prompt Improvements |
| 113 | + |
| 114 | +<!-- Changes to metadata.yaml operation prompt --> |
| 115 | +<!-- NOT content duplication - prompts should reference docs, not repeat them --> |
| 116 | +<!-- Focus on: how to interact with agent, prods to pull specific info from docs --> |
| 117 | + |
| 118 | +1. Add instruction to consult related_code_paths for examples |
| 119 | +2. Add TODO marker for agent to extract patterns from docs |
| 120 | +3. Refine scope/focus of the operation |
| 121 | +4. Clarify input format expectations |
| 122 | +``` |
| 123 | + |
| 124 | +### Phase 5: Summary |
| 125 | + |
| 126 | +Output a brief summary to the user: |
| 127 | +- What gaps were found |
| 128 | +- Key differences between original and generated commands |
| 129 | +- Top 3 actionable recommendations |
| 130 | +- Paths to created artifacts |
| 131 | + |
| 132 | +## Important Notes |
| 133 | + |
| 134 | +- **Documentation is source of truth** - prompts should reference docs, not duplicate content |
| 135 | +- **Create concrete artifacts** - don't just think, write files |
| 136 | +- **Isolation matters** - Phase 2 subagent must not see the existing command |
| 137 | +- **Prompt changes are about interaction** - how to guide the agent to use docs, not what to embed |
| 138 | +- If prose content is too verbose for slides, suggest prose blocks or agent-context blocks |
0 commit comments