-
Notifications
You must be signed in to change notification settings - Fork 9
feat(ralph-specum): auto-discover and invoke skills on start #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
bca1f0e
ee629c5
39487fe
626116f
a4f451e
d078d86
8f7116a
87b2c77
cc55d5f
d20c7a5
1af86ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -36,9 +36,42 @@ Read `${CLAUDE_PLUGIN_ROOT}/references/intent-classification.md` and follow the | |||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ### Quick Mode Check | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| If `--quick` flag detected in $ARGUMENTS, skip to **Step 5: Quick Mode Flow**. | ||||||||||||||||||||||||||||||
| If `--quick` flag detected in $ARGUMENTS, skip to **Step 6: Quick Mode Flow**. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ## Step 3: Skill Discovery Pass 1 | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| > **Normal mode only** -- quick mode skips to Step 6 and never reaches this step. Quick mode gets its own Pass 1 in quick-mode.md. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Scan all skill files and match against the goal text: | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| 1. Read each `${CLAUDE_PLUGIN_ROOT}/skills/*/SKILL.md` file's YAML frontmatter (`name`, `description` fields) | ||||||||||||||||||||||||||||||
| - If a SKILL.md is unreadable (file error, permissions): skip that skill, log warning | ||||||||||||||||||||||||||||||
| - If a SKILL.md has no `description` field in frontmatter: skip that skill, log "no description" | ||||||||||||||||||||||||||||||
| 2. Determine **context text**: the goal text only (from Step 2) | ||||||||||||||||||||||||||||||
| 3. Tokenize both context text and each skill's `description` using these rules: | ||||||||||||||||||||||||||||||
| a. Lowercase the entire string | ||||||||||||||||||||||||||||||
| b. Replace hyphens with spaces ("brainstorming-style" -> "brainstorming style") | ||||||||||||||||||||||||||||||
| c. Strip all punctuation (parentheses, commas, periods, colons, quotes, brackets, etc.) | ||||||||||||||||||||||||||||||
| d. Split on whitespace into word tokens | ||||||||||||||||||||||||||||||
| e. Remove stopwords: a, an, the, to, for, with, and, or, in, on, by, is, be, that, this, of, it, should, used, when, asks, needs, about | ||||||||||||||||||||||||||||||
| 4. Count word overlap between context tokens and description tokens | ||||||||||||||||||||||||||||||
| 5. If overlap >= 2 AND skill not already in `discoveredSkills` with `invoked: true`: | ||||||||||||||||||||||||||||||
| - Invoke: `Skill({ skill: "ralph-specum:<name>" })` | ||||||||||||||||||||||||||||||
| - On success: add `{ name, matchedAt: "start", invoked: true }` to `discoveredSkills` | ||||||||||||||||||||||||||||||
| - On failure: set `invoked: false` -- add `{ name, matchedAt: "start", invoked: false }`, log warning, continue | ||||||||||||||||||||||||||||||
| 6. If no skills match across all scanned skills: log `- No skills matched` | ||||||||||||||||||||||||||||||
| 7. Update `.ralph-state.json` with updated `discoveredSkills` array | ||||||||||||||||||||||||||||||
| 8. Append a `## Skill Discovery` section to `.progress.md` with match details per skill: | ||||||||||||||||||||||||||||||
| ```markdown | ||||||||||||||||||||||||||||||
| ## Skill Discovery | ||||||||||||||||||||||||||||||
| - **<skill-name>**: matched (keywords: <overlapping words>) | ||||||||||||||||||||||||||||||
| - **<skill-name>**: no match | ||||||||||||||||||||||||||||||
| - **<skill-name>**: skipped (unreadable) | ||||||||||||||||||||||||||||||
| - **<skill-name>**: skipped (no description) | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
| If no skills match: `- No skills matched` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ## Step 3: Scan Existing Specs | ||||||||||||||||||||||||||||||
| ## Step 4: Scan Existing Specs | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Read `${CLAUDE_PLUGIN_ROOT}/references/spec-scanner.md` and follow the scanning algorithm and index hint logic. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
@@ -48,7 +81,7 @@ Read `${CLAUDE_PLUGIN_ROOT}/references/spec-scanner.md` and follow the scanning | |||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| **Summary**: Scans ./specs/ directory (and all configured specs_dirs) for related specs using keyword matching. Displays related specs with relevance scores. Shows index hint if codebase indexing not yet done. Stores relatedSpecs in .ralph-state.json for use during interview. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ## Step 4: Route to Action | ||||||||||||||||||||||||||||||
| ## Step 5: Route to Action | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Based on detection logic from Step 2: | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
@@ -97,14 +130,48 @@ Continuing... | |||||||||||||||||||||||||||||
| "phase": "research", "taskIndex": 0, "totalTasks": 0, | ||||||||||||||||||||||||||||||
| "taskIteration": 1, "maxTaskIterations": 5, | ||||||||||||||||||||||||||||||
| "globalIteration": 1, "maxGlobalIterations": 100, | ||||||||||||||||||||||||||||||
| "commitSpec": true, "quickMode": false | ||||||||||||||||||||||||||||||
| "commitSpec": true, "quickMode": false, | ||||||||||||||||||||||||||||||
| "discoveredSkills": [] | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
| 8. Create `.progress.md` with goal | ||||||||||||||||||||||||||||||
| 9. Update Spec Index: `./plugins/ralph-specum/hooks/scripts/update-spec-index.sh --quiet` | ||||||||||||||||||||||||||||||
| 10. **Goal Interview** -- Read `${CLAUDE_PLUGIN_ROOT}/references/goal-interview.md` and follow brainstorming dialogue | ||||||||||||||||||||||||||||||
| 11. **Team Research Phase** -- Read `${CLAUDE_PLUGIN_ROOT}/references/parallel-research.md` and follow the dispatch pattern | ||||||||||||||||||||||||||||||
| 12. **STOP** -- After merge and state update (awaitingApproval=true), display walkthrough and wait for user | ||||||||||||||||||||||||||||||
| 12. **Skill Discovery Pass 2 (Post-Research Retry)** -- Re-scan skills with enriched context after research completes: | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ### Skill Discovery Pass 2 | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Scan all skill files and match against goal + research context: | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| 1. Read each `${CLAUDE_PLUGIN_ROOT}/skills/*/SKILL.md` file's YAML frontmatter (`name`, `description` fields) | ||||||||||||||||||||||||||||||
| - If a SKILL.md is unreadable (file error, permissions): skip that skill, log warning | ||||||||||||||||||||||||||||||
| - If a SKILL.md has no `description` field in frontmatter: skip that skill, log "no description" | ||||||||||||||||||||||||||||||
| 2. Determine **context text**: goal text + the **Executive Summary** section from `research.md` | ||||||||||||||||||||||||||||||
| 3. Tokenize both context text and each skill's `description` using these rules: | ||||||||||||||||||||||||||||||
| a. Lowercase the entire string | ||||||||||||||||||||||||||||||
| b. Replace hyphens with spaces ("brainstorming-style" -> "brainstorming style") | ||||||||||||||||||||||||||||||
| c. Strip all punctuation (parentheses, commas, periods, colons, quotes, brackets, etc.) | ||||||||||||||||||||||||||||||
| d. Split on whitespace into word tokens | ||||||||||||||||||||||||||||||
| e. Remove stopwords: a, an, the, to, for, with, and, or, in, on, by, is, be, that, this, of, it, should, used, when, asks, needs, about | ||||||||||||||||||||||||||||||
| 4. Count word overlap between context tokens and description tokens | ||||||||||||||||||||||||||||||
| 5. If overlap >= 2 AND skill not already in `discoveredSkills` with `invoked: true`: | ||||||||||||||||||||||||||||||
| - Invoke: `Skill({ skill: "ralph-specum:<name>" })` | ||||||||||||||||||||||||||||||
| - On success: add `{ name, matchedAt: "post-research", invoked: true }` to `discoveredSkills` | ||||||||||||||||||||||||||||||
| - On failure: set `invoked: false` -- add `{ name, matchedAt: "post-research", invoked: false }`, log warning, continue | ||||||||||||||||||||||||||||||
| 6. If no skills match across all scanned skills: log `- No skills matched` | ||||||||||||||||||||||||||||||
| 7. Update `.ralph-state.json` with updated `discoveredSkills` array | ||||||||||||||||||||||||||||||
| 8. Append a `### Post-Research Retry` subsection to `.progress.md` under `## Skill Discovery`: | ||||||||||||||||||||||||||||||
| ```markdown | ||||||||||||||||||||||||||||||
| ### Post-Research Retry | ||||||||||||||||||||||||||||||
| - **<skill-name>**: matched (keywords: <overlapping words>) | ||||||||||||||||||||||||||||||
| - **<skill-name>**: no match (already invoked) | ||||||||||||||||||||||||||||||
| - **<skill-name>**: skipped (unreadable) | ||||||||||||||||||||||||||||||
| - **<skill-name>**: skipped (no description) | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
| If no new skills match: `- No new skills matched` | ||||||||||||||||||||||||||||||
|
Comment on lines
+162
to
+172
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pass 2 "no match" log instruction disagrees with the template. Line 162 instructs to log 🛠️ Proposed fix- 6. If no skills match across all scanned skills: log `- No skills matched`
+ 6. If no new skills match across all scanned skills: log `- No new skills matched`📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| 13. **STOP** -- After merge and state update (awaitingApproval=true), display walkthrough and wait for user | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ### Research Walkthrough (Normal Mode Only) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
@@ -133,7 +200,7 @@ Then STOP. Output: `-> Next: Run /ralph-specum:requirements` | |||||||||||||||||||||||||||||
| End response immediately. | ||||||||||||||||||||||||||||||
| </mandatory> | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ## Step 5: Quick Mode Flow | ||||||||||||||||||||||||||||||
| ## Step 6: Quick Mode Flow | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Read `${CLAUDE_PLUGIN_ROOT}/references/quick-mode.md` and follow the full quick mode execution sequence. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -72,29 +72,93 @@ Validation Sequence: | |||||||||||||||||||||||||||||
| taskIndex: 0, totalTasks: 0, taskIteration: 1, | ||||||||||||||||||||||||||||||
| maxTaskIterations: 5, globalIteration: 1, | ||||||||||||||||||||||||||||||
| maxGlobalIterations: 100, commitSpec: $commitSpec, | ||||||||||||||||||||||||||||||
| quickMode: true } | ||||||||||||||||||||||||||||||
| quickMode: true, discoveredSkills: [] } | ||||||||||||||||||||||||||||||
| 6. Write .progress.md with original goal | ||||||||||||||||||||||||||||||
| 7. Update .current-spec (bare name or full path) | ||||||||||||||||||||||||||||||
| 8. Update Spec Index: ./plugins/ralph-specum/hooks/scripts/update-spec-index.sh --quiet | ||||||||||||||||||||||||||||||
| 9. Goal Type Detection: | ||||||||||||||||||||||||||||||
| - Classify as "fix" or "add" using regex indicators | ||||||||||||||||||||||||||||||
| - Fix: fix|resolve|debug|broken|failing|error|bug|crash|issue|not working | ||||||||||||||||||||||||||||||
| - Add: add|create|build|implement|new|enable|introduce (default) | ||||||||||||||||||||||||||||||
| - For fix goals: run reproduction, document BEFORE state | ||||||||||||||||||||||||||||||
| 10. Research Phase: run Team Research flow (skip walkthrough), clear awaitingApproval | ||||||||||||||||||||||||||||||
| 11. Requirements Phase: delegate to product-manager with Quick Mode Directive, review loop | ||||||||||||||||||||||||||||||
| 12. Design Phase: delegate to architect-reviewer with Quick Mode Directive, review loop | ||||||||||||||||||||||||||||||
| 13. Tasks Phase: delegate to task-planner with Quick Mode Directive, review loop | ||||||||||||||||||||||||||||||
| 14. Transition to Execution: | ||||||||||||||||||||||||||||||
| 9. Skill Discovery Pass 1: scan skills, match against goal text, invoke matches | ||||||||||||||||||||||||||||||
| 10. Goal Type Detection: | ||||||||||||||||||||||||||||||
| - Classify as "fix" or "add" using regex indicators | ||||||||||||||||||||||||||||||
| - Fix: fix|resolve|debug|broken|failing|error|bug|crash|issue|not working | ||||||||||||||||||||||||||||||
| - Add: add|create|build|implement|new|enable|introduce (default) | ||||||||||||||||||||||||||||||
| - For fix goals: run reproduction, document BEFORE state | ||||||||||||||||||||||||||||||
| 11. Research Phase: run Team Research flow (skip walkthrough), clear awaitingApproval | ||||||||||||||||||||||||||||||
| 12. Skill Discovery Pass 2: re-scan skills using goal + research Executive Summary, invoke new matches | ||||||||||||||||||||||||||||||
| 13. Requirements Phase: delegate to product-manager with Quick Mode Directive, review loop | ||||||||||||||||||||||||||||||
| 14. Design Phase: delegate to architect-reviewer with Quick Mode Directive, review loop | ||||||||||||||||||||||||||||||
| 15. Tasks Phase: delegate to task-planner with Quick Mode Directive, review loop | ||||||||||||||||||||||||||||||
| 16. Transition to Execution: | ||||||||||||||||||||||||||||||
| - Count total tasks (number of `- [ ]` checkboxes) | ||||||||||||||||||||||||||||||
| - Update state: phase="execution", totalTasks=<count>, taskIndex=0 | ||||||||||||||||||||||||||||||
| - If commitSpec: stage, commit, push spec files | ||||||||||||||||||||||||||||||
| 15. Invoke spec-executor for task 1 | ||||||||||||||||||||||||||||||
| 17. Invoke spec-executor for task 1 | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ## Step 9: Skill Discovery Pass 1 | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Scan all skill files and match against the goal text: | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| 1. Read each `${CLAUDE_PLUGIN_ROOT}/skills/*/SKILL.md` file's YAML frontmatter (`name`, `description` fields) | ||||||||||||||||||||||||||||||
| - If a SKILL.md is unreadable (file error, permissions): skip that skill, log warning | ||||||||||||||||||||||||||||||
| - If a SKILL.md has no `description` field in frontmatter: skip that skill, log "no description" | ||||||||||||||||||||||||||||||
| 2. Determine **context text**: the goal text only (from step 1) | ||||||||||||||||||||||||||||||
| 3. Tokenize both context text and each skill's `description` using these rules: | ||||||||||||||||||||||||||||||
| a. Lowercase the entire string | ||||||||||||||||||||||||||||||
| b. Replace hyphens with spaces ("brainstorming-style" -> "brainstorming style") | ||||||||||||||||||||||||||||||
| c. Strip all punctuation (parentheses, commas, periods, colons, quotes, brackets, etc.) | ||||||||||||||||||||||||||||||
| d. Split on whitespace into word tokens | ||||||||||||||||||||||||||||||
| e. Remove stopwords: a, an, the, to, for, with, and, or, in, on, by, is, be, that, this, of, it, should, used, when, asks, needs, about | ||||||||||||||||||||||||||||||
| 4. Count word overlap between context tokens and description tokens | ||||||||||||||||||||||||||||||
| 5. If overlap >= 2 AND skill not already in `discoveredSkills` with `invoked: true`: | ||||||||||||||||||||||||||||||
| - Invoke: `Skill({ skill: "ralph-specum:<name>" })` | ||||||||||||||||||||||||||||||
| - On success: add `{ name, matchedAt: "start", invoked: true }` to `discoveredSkills` | ||||||||||||||||||||||||||||||
| - On failure: set `invoked: false` -- add `{ name, matchedAt: "start", invoked: false }`, log warning, continue | ||||||||||||||||||||||||||||||
| 6. If no skills match across all scanned skills: log `- No skills matched` | ||||||||||||||||||||||||||||||
| 7. Update `.ralph-state.json` with updated `discoveredSkills` array | ||||||||||||||||||||||||||||||
| 8. Append a `## Skill Discovery` section to `.progress.md` with match details per skill: | ||||||||||||||||||||||||||||||
| ```markdown | ||||||||||||||||||||||||||||||
| ## Skill Discovery | ||||||||||||||||||||||||||||||
| - **<skill-name>**: matched (keywords: <overlapping words>) | ||||||||||||||||||||||||||||||
| - **<skill-name>**: no match | ||||||||||||||||||||||||||||||
| - **<skill-name>**: skipped (unreadable) | ||||||||||||||||||||||||||||||
| - **<skill-name>**: skipped (no description) | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
| If no skills match: `- No skills matched` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ## Step 12: Skill Discovery Pass 2 (Post-Research Retry) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Re-scan skills with enriched context after research completes: | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| 1. Read each `${CLAUDE_PLUGIN_ROOT}/skills/*/SKILL.md` file's YAML frontmatter (`name`, `description` fields) | ||||||||||||||||||||||||||||||
| - If a SKILL.md is unreadable (file error, permissions): skip that skill, log warning | ||||||||||||||||||||||||||||||
| - If a SKILL.md has no `description` field in frontmatter: skip that skill, log "no description" | ||||||||||||||||||||||||||||||
| 2. Determine **context text**: goal text + the **Executive Summary** section from `research.md` | ||||||||||||||||||||||||||||||
| 3. Tokenize both context text and each skill's `description` using these rules: | ||||||||||||||||||||||||||||||
| a. Lowercase the entire string | ||||||||||||||||||||||||||||||
| b. Replace hyphens with spaces ("brainstorming-style" -> "brainstorming style") | ||||||||||||||||||||||||||||||
| c. Strip all punctuation (parentheses, commas, periods, colons, quotes, brackets, etc.) | ||||||||||||||||||||||||||||||
| d. Split on whitespace into word tokens | ||||||||||||||||||||||||||||||
| e. Remove stopwords: a, an, the, to, for, with, and, or, in, on, by, is, be, that, this, of, it, should, used, when, asks, needs, about | ||||||||||||||||||||||||||||||
| 4. Count word overlap between context tokens and description tokens | ||||||||||||||||||||||||||||||
| 5. If overlap >= 2 AND skill not already in `discoveredSkills` with `invoked: true`: | ||||||||||||||||||||||||||||||
| - Invoke: `Skill({ skill: "ralph-specum:<name>" })` | ||||||||||||||||||||||||||||||
| - On success: add `{ name, matchedAt: "post-research", invoked: true }` to `discoveredSkills` | ||||||||||||||||||||||||||||||
| - On failure: set `invoked: false` -- add `{ name, matchedAt: "post-research", invoked: false }`, log warning, continue | ||||||||||||||||||||||||||||||
| 6. If no skills match across all scanned skills: log `- No skills matched` | ||||||||||||||||||||||||||||||
| 7. Update `.ralph-state.json` with updated `discoveredSkills` array | ||||||||||||||||||||||||||||||
| 8. Append a `### Post-Research Retry` subsection to `.progress.md` under `## Skill Discovery`: | ||||||||||||||||||||||||||||||
| ```markdown | ||||||||||||||||||||||||||||||
| ### Post-Research Retry | ||||||||||||||||||||||||||||||
| - **<skill-name>**: matched (keywords: <overlapping words>) | ||||||||||||||||||||||||||||||
| - **<skill-name>**: no match (already invoked) | ||||||||||||||||||||||||||||||
| - **<skill-name>**: skipped (unreadable) | ||||||||||||||||||||||||||||||
| - **<skill-name>**: skipped (no description) | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
| If no new skills match: `- No new skills matched` | ||||||||||||||||||||||||||||||
|
Comment on lines
+147
to
+157
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pass 2 "no match" log message is inconsistent between the instruction and the template. Line 147 says to log 🛠️ Proposed fix-6. If no skills match across all scanned skills: log `- No skills matched`
+6. If no new skills match across all scanned skills: log `- No new skills matched`📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ## Quick Mode Directive | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Each agent delegation in steps 10-13 includes this directive in the Task prompt: | ||||||||||||||||||||||||||||||
| Each agent delegation in steps 11-15 includes this directive in the Task prompt: | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ```text | ||||||||||||||||||||||||||||||
| Quick Mode Context: | ||||||||||||||||||||||||||||||
|
|
@@ -109,7 +173,7 @@ Running in quick mode with no user feedback. You MUST: | |||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ## Quick Mode Review Loop (Per Artifact) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| After each phase agent returns in steps 11-13, run spec-reviewer to validate: | ||||||||||||||||||||||||||||||
| After each phase agent returns in steps 13-15, run spec-reviewer to validate: | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ```text | ||||||||||||||||||||||||||||||
| Set iteration = 1 | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pass 1 discoveries are overwritten by state initialization in the normal-mode New Flow.
The execution order is:
discoveredSkillsto.ralph-state.json(Step 3.7), but.ralph-state.jsondoesn't exist yet for a brand-new spec..ralph-state.jsonfrom scratch with"discoveredSkills": [], silently discarding whatever Pass 1 recorded.discoveredSkills: [](no Pass 1 records), bypassing deduplication and potentially re-invoking the same skills a second time.This is in contrast to Quick Mode (
quick-mode.md) which correctly initializes state before running Pass 1 (Step 5 → Step 9).The root fix is to move Pass 1 to inside the New Flow, after state initialization (i.e., between current New Flow steps 7 and 8), matching the Quick Mode pattern. Alternatively, New Flow step 7 should explicitly merge rather than reset
discoveredSkillsif any were already accumulated.Note: This bug only affects normal mode + new spec. Resume flow is unaffected since state already exists and is updated correctly at Step 3.7.
🛠️ Sketch of the fix (New Flow reordering)
Move the discovery block out of Step 3 and into the New Flow section:
Then inside "### New Flow", after the current step 7 (state init) and before step 8 (create .progress.md):
7. Initialize `.ralph-state.json`: { ..., "discoveredSkills": [] } +7a. **Skill Discovery Pass 1** -- scan skills, match against goal text, invoke matches + [full Pass 1 instructions, state write now safe since file was just created] 8. Create `.progress.md` with goalAlso update the Quick Mode Check note in Step 2 accordingly.
🤖 Prompt for AI Agents