Compare commits
1 Commits
bead/nixos
...
bead/nixos
| Author | SHA1 | Date | |
|---|---|---|---|
| ec47c4bb4f |
317
home/roles/development/skills/beads_batch_research_plan.md
Normal file
317
home/roles/development/skills/beads_batch_research_plan.md
Normal file
@@ -0,0 +1,317 @@
|
|||||||
|
---
|
||||||
|
description: Batch research and planning for multiple beads with interactive question review
|
||||||
|
model: opus
|
||||||
|
---
|
||||||
|
|
||||||
|
# Beads Batch Research+Plan
|
||||||
|
|
||||||
|
This skill automates the common workflow of:
|
||||||
|
1. Running /beads_research in parallel for multiple beads
|
||||||
|
2. Presenting open questions interactively for user input (bead-by-bead)
|
||||||
|
3. Running /beads_plan for all researched beads (plus any spawned from splits)
|
||||||
|
|
||||||
|
## When to Use
|
||||||
|
|
||||||
|
- You have multiple beads ready for work
|
||||||
|
- You want to research and plan them efficiently before implementation
|
||||||
|
- You prefer to batch your question-answering rather than context-switching between skills
|
||||||
|
|
||||||
|
## Phase 1: Selection
|
||||||
|
|
||||||
|
1. **Get ready beads**: Run `bd ready --limit=20` to list beads with no blockers
|
||||||
|
|
||||||
|
2. **Filter already-researched beads**:
|
||||||
|
For each ready bead, check if it already has research:
|
||||||
|
```bash
|
||||||
|
ls thoughts/beads-{bead-id}/research.md 2>/dev/null
|
||||||
|
```
|
||||||
|
|
||||||
|
Categorize beads:
|
||||||
|
- **Needs research**: No `research.md` exists
|
||||||
|
- **Has research, needs plan**: `research.md` exists but no `plan.md`
|
||||||
|
- **Already planned**: Both `research.md` and `plan.md` exist
|
||||||
|
|
||||||
|
3. **Present selection**:
|
||||||
|
```
|
||||||
|
Ready beads available for batch research+plan:
|
||||||
|
|
||||||
|
NEEDS RESEARCH:
|
||||||
|
- {bead-id}: {title} (type: {type})
|
||||||
|
- ...
|
||||||
|
|
||||||
|
HAS RESEARCH (plan only):
|
||||||
|
- {bead-id}: {title} (type: {type})
|
||||||
|
- ...
|
||||||
|
|
||||||
|
ALREADY PLANNED (skip):
|
||||||
|
- {bead-id}: {title}
|
||||||
|
|
||||||
|
Which beads would you like to process?
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Use AskUserQuestion** with `multiSelect: true`:
|
||||||
|
- Include bead ID and title for each option
|
||||||
|
- Separate options by category
|
||||||
|
- Allow selection across categories
|
||||||
|
|
||||||
|
## Phase 2: Parallel Research
|
||||||
|
|
||||||
|
For each selected bead that NEEDS RESEARCH, launch a research subagent.
|
||||||
|
|
||||||
|
### Subagent Instructions Template
|
||||||
|
|
||||||
|
```
|
||||||
|
Research bead [BEAD_ID]: [BEAD_TITLE]
|
||||||
|
|
||||||
|
1. **Load bead context**:
|
||||||
|
```bash
|
||||||
|
bd show [BEAD_ID]
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Create artifact directory**:
|
||||||
|
```bash
|
||||||
|
mkdir -p thoughts/beads-[BEAD_ID]
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Conduct research** following beads_research.md patterns:
|
||||||
|
- Analyze and decompose the research question
|
||||||
|
- Spawn parallel sub-agent tasks (codebase-locator, codebase-analyzer, etc.)
|
||||||
|
- Synthesize findings
|
||||||
|
|
||||||
|
4. **Write research document** to `thoughts/beads-[BEAD_ID]/research.md`:
|
||||||
|
- Include frontmatter with metadata
|
||||||
|
- Document findings with file:line references
|
||||||
|
- **CRITICAL**: Include "## Open Questions" section listing any unresolved items
|
||||||
|
|
||||||
|
5. **Return summary**:
|
||||||
|
- Research status (complete/partial)
|
||||||
|
- Number of open questions
|
||||||
|
- Key findings summary (2-3 bullet points)
|
||||||
|
- List of open questions verbatim
|
||||||
|
```
|
||||||
|
|
||||||
|
### Launching Subagents
|
||||||
|
|
||||||
|
Use `subagent_type: "opus"` for research subagents (matches beads_research model setting).
|
||||||
|
|
||||||
|
Launch ALL research subagents in a single message for parallel execution:
|
||||||
|
```
|
||||||
|
<Task calls for each selected bead needing research - all in one message>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Collecting Results
|
||||||
|
|
||||||
|
Wait for ALL research subagents to complete. Collect:
|
||||||
|
- Bead ID
|
||||||
|
- Research status
|
||||||
|
- Open questions list
|
||||||
|
- Any errors encountered
|
||||||
|
|
||||||
|
## Phase 3: Interactive Question Review
|
||||||
|
|
||||||
|
Present each bead's open questions sequentially for user input.
|
||||||
|
|
||||||
|
### For Each Bead (in order):
|
||||||
|
|
||||||
|
1. **Present research summary**:
|
||||||
|
```
|
||||||
|
## Bead {N}/{total}: {bead-id} - {title}
|
||||||
|
|
||||||
|
Research complete. Key findings:
|
||||||
|
- {finding 1}
|
||||||
|
- {finding 2}
|
||||||
|
|
||||||
|
Open questions requiring your input:
|
||||||
|
1. {question 1}
|
||||||
|
2. {question 2}
|
||||||
|
|
||||||
|
Additionally:
|
||||||
|
- Should this bead be split into multiple beads? (y/n)
|
||||||
|
- If split, describe the split:
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Collect user responses**:
|
||||||
|
- Answers to open questions
|
||||||
|
- Split decision (yes/no)
|
||||||
|
- If split: new bead titles and how to divide the work
|
||||||
|
|
||||||
|
3. **Handle splits**:
|
||||||
|
If user indicates a split:
|
||||||
|
```bash
|
||||||
|
# Create new beads for split work
|
||||||
|
bd create --title="{split title 1}" --type={type} --priority={priority} \
|
||||||
|
--description="{description based on user input}"
|
||||||
|
|
||||||
|
# Update original bead if scope narrowed
|
||||||
|
bd update {original-bead-id} --description="{updated description}"
|
||||||
|
```
|
||||||
|
|
||||||
|
Track new bead IDs for inclusion in planning phase.
|
||||||
|
|
||||||
|
4. **Update research document**:
|
||||||
|
Append user answers to `thoughts/beads-{id}/research.md`:
|
||||||
|
```markdown
|
||||||
|
## User Clarifications [{timestamp}]
|
||||||
|
|
||||||
|
Q: {question 1}
|
||||||
|
A: {user answer 1}
|
||||||
|
|
||||||
|
Q: {question 2}
|
||||||
|
A: {user answer 2}
|
||||||
|
|
||||||
|
## Bead Splits
|
||||||
|
{If split: description of split and new bead IDs}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Progress Tracking
|
||||||
|
|
||||||
|
After each bead's questions are answered, confirm before moving to next:
|
||||||
|
```
|
||||||
|
Questions answered for {bead-id}. {N-1} beads remaining.
|
||||||
|
Continue to next bead? (y/n)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Beads with No Questions
|
||||||
|
|
||||||
|
If a bead's research had no open questions:
|
||||||
|
```
|
||||||
|
## Bead {N}/{total}: {bead-id} - {title}
|
||||||
|
|
||||||
|
Research complete with no open questions.
|
||||||
|
|
||||||
|
Key findings:
|
||||||
|
- {finding 1}
|
||||||
|
- {finding 2}
|
||||||
|
|
||||||
|
Should this bead be split? (y/n)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Phase 4: Parallel Planning
|
||||||
|
|
||||||
|
After all questions answered, launch planning subagents for all beads.
|
||||||
|
|
||||||
|
### Beads to Plan
|
||||||
|
|
||||||
|
Include:
|
||||||
|
- Original beads that were researched
|
||||||
|
- Beads that had existing research (from selection phase)
|
||||||
|
- New beads spawned from splits
|
||||||
|
|
||||||
|
### Subagent Instructions Template
|
||||||
|
|
||||||
|
```
|
||||||
|
Create implementation plan for bead [BEAD_ID]: [BEAD_TITLE]
|
||||||
|
|
||||||
|
1. **Load context**:
|
||||||
|
```bash
|
||||||
|
bd show [BEAD_ID]
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Read research** (it exists and has user clarifications):
|
||||||
|
Read `thoughts/beads-[BEAD_ID]/research.md` FULLY
|
||||||
|
|
||||||
|
3. **Create plan** following beads_plan.md patterns:
|
||||||
|
- Context gathering via sub-agents
|
||||||
|
- Design approach based on research findings and user clarifications
|
||||||
|
- **Skip interactive questions** - they were already answered in research review
|
||||||
|
|
||||||
|
4. **Write plan** to `thoughts/beads-[BEAD_ID]/plan.md`:
|
||||||
|
- Full plan structure with phases
|
||||||
|
- Success criteria (automated and manual)
|
||||||
|
- References to research document
|
||||||
|
|
||||||
|
5. **Update bead**:
|
||||||
|
```bash
|
||||||
|
bd update [BEAD_ID] --notes="Plan created: thoughts/beads-[BEAD_ID]/plan.md"
|
||||||
|
```
|
||||||
|
|
||||||
|
6. **Return summary**:
|
||||||
|
- Plan status (complete/failed)
|
||||||
|
- Number of phases
|
||||||
|
- Estimated complexity (small/medium/large)
|
||||||
|
- Any issues encountered
|
||||||
|
```
|
||||||
|
|
||||||
|
### Launching Subagents
|
||||||
|
|
||||||
|
Use `subagent_type: "opus"` for planning subagents (matches beads_plan model setting).
|
||||||
|
|
||||||
|
Launch ALL planning subagents in a single message:
|
||||||
|
```
|
||||||
|
<Task calls for each bead to plan - all in one message>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Handling Beads Without Research
|
||||||
|
|
||||||
|
For beads that had existing research but user didn't review questions:
|
||||||
|
- Planning subagent reads existing research
|
||||||
|
- If research has unresolved open questions, subagent should flag this in its return
|
||||||
|
|
||||||
|
## Phase 5: Summary
|
||||||
|
|
||||||
|
After all planning completes, present final summary.
|
||||||
|
|
||||||
|
### Summary Format
|
||||||
|
|
||||||
|
```
|
||||||
|
## Batch Research+Plan Complete
|
||||||
|
|
||||||
|
### Successfully Processed:
|
||||||
|
| Bead | Title | Research | Plan | Phases | Complexity |
|
||||||
|
|------|-------|----------|------|--------|------------|
|
||||||
|
| {id} | {title} | Complete | Complete | 3 | medium |
|
||||||
|
| {id} | {title} | Complete | Complete | 2 | small |
|
||||||
|
|
||||||
|
### New Beads (from splits):
|
||||||
|
| Bead | Title | Parent | Status |
|
||||||
|
|------|-------|--------|--------|
|
||||||
|
| {new-id} | {title} | {parent-id} | Planned |
|
||||||
|
|
||||||
|
### Failed:
|
||||||
|
| Bead | Title | Phase Failed | Error |
|
||||||
|
|------|-------|--------------|-------|
|
||||||
|
| {id} | {title} | Research | Timeout |
|
||||||
|
|
||||||
|
### Next Steps:
|
||||||
|
1. Review plans at `thoughts/beads-{id}/plan.md`
|
||||||
|
2. Run `/parallel_beads` to implement all planned beads
|
||||||
|
3. Or run `/beads_implement {id}` for individual implementation
|
||||||
|
|
||||||
|
### Artifacts Created:
|
||||||
|
- Research: thoughts/beads-{id}/research.md (x{N} files)
|
||||||
|
- Plans: thoughts/beads-{id}/plan.md (x{N} files)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Error Handling
|
||||||
|
|
||||||
|
### Research Subagent Failure
|
||||||
|
- Log the failure with bead ID and error
|
||||||
|
- Continue with other beads
|
||||||
|
- Exclude failed beads from question review and planning
|
||||||
|
- Report in final summary
|
||||||
|
|
||||||
|
### Planning Subagent Failure
|
||||||
|
- Log the failure with bead ID and error
|
||||||
|
- Research still valid - can retry planning manually
|
||||||
|
- Report in final summary
|
||||||
|
|
||||||
|
### User Cancellation During Question Review
|
||||||
|
- Save progress to bead notes
|
||||||
|
- Report which beads were completed
|
||||||
|
- User can resume with remaining beads in new session
|
||||||
|
|
||||||
|
### Split Bead Creation Failure
|
||||||
|
- Report error but continue with original bead
|
||||||
|
- User can manually create split beads later
|
||||||
|
|
||||||
|
## Resource Limits
|
||||||
|
|
||||||
|
- Maximum concurrent research subagents: 5
|
||||||
|
- Maximum concurrent planning subagents: 5
|
||||||
|
- If more beads selected, process in batches
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
- This skill is designed for the "research+plan before implementation" workflow
|
||||||
|
- Pairs well with `/parallel_beads` for subsequent implementation
|
||||||
|
- Run `/reconcile_beads` after implementation PRs merge
|
||||||
@@ -54,8 +54,6 @@ When this command is invoked:
|
|||||||
- Read `thoughts/beads-{bead-id}/plan.md` FULLY
|
- Read `thoughts/beads-{bead-id}/plan.md` FULLY
|
||||||
- Check for any existing checkmarks (- [x]) indicating partial progress
|
- Check for any existing checkmarks (- [x]) indicating partial progress
|
||||||
- Read any research at `thoughts/beads-{bead-id}/research.md`
|
- Read any research at `thoughts/beads-{bead-id}/research.md`
|
||||||
- If plan's Success Criteria references contribution guidelines (e.g., "Per CONTRIBUTING.md:"),
|
|
||||||
verify the original CONTRIBUTING.md still exists and requirements are current
|
|
||||||
|
|
||||||
5. **Mark bead in progress** (if not already):
|
5. **Mark bead in progress** (if not already):
|
||||||
```bash
|
```bash
|
||||||
@@ -129,10 +127,6 @@ All phases completed and automated verification passed:
|
|||||||
- {List manual verification items from plan}
|
- {List manual verification items from plan}
|
||||||
|
|
||||||
Let me know when manual testing is complete so I can close the bead.
|
Let me know when manual testing is complete so I can close the bead.
|
||||||
|
|
||||||
**Contribution guidelines compliance:**
|
|
||||||
- {List any contribution guideline requirements that were part of Success Criteria}
|
|
||||||
- {Note if any requirements could not be automated and need manual review}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
**STOP HERE and wait for user confirmation.**
|
**STOP HERE and wait for user confirmation.**
|
||||||
|
|||||||
@@ -51,32 +51,13 @@ When this command is invoked:
|
|||||||
- Any linked tickets or docs
|
- Any linked tickets or docs
|
||||||
- Use Read tool WITHOUT limit/offset
|
- Use Read tool WITHOUT limit/offset
|
||||||
|
|
||||||
2. **Check for contribution guidelines**:
|
2. **Spawn initial research tasks**:
|
||||||
|
|
||||||
```bash
|
|
||||||
# Check standard locations for contribution guidelines
|
|
||||||
for f in CONTRIBUTING.md .github/CONTRIBUTING.md docs/CONTRIBUTING.md; do
|
|
||||||
if [ -f "$f" ]; then
|
|
||||||
echo "Found: $f"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
```
|
|
||||||
|
|
||||||
If found:
|
|
||||||
- Read the file fully
|
|
||||||
- Extract actionable requirements (testing, code style, documentation, PR conventions)
|
|
||||||
- These requirements MUST be incorporated into the plan's Success Criteria
|
|
||||||
|
|
||||||
If not found, note "No contribution guidelines found" and proceed.
|
|
||||||
|
|
||||||
3. **Spawn initial research tasks**:
|
|
||||||
- **codebase-locator**: Find all files related to the task
|
- **codebase-locator**: Find all files related to the task
|
||||||
- **codebase-analyzer**: Understand current implementation
|
- **codebase-analyzer**: Understand current implementation
|
||||||
- **codebase-pattern-finder**: Find similar features to model after
|
- **codebase-pattern-finder**: Find similar features to model after
|
||||||
- **thoughts-locator**: Find any existing plans or decisions
|
- **thoughts-locator**: Find any existing plans or decisions
|
||||||
|
|
||||||
4. **Read all files identified by research**:
|
3. **Read all files identified by research**:
|
||||||
- Read them FULLY into main context
|
- Read them FULLY into main context
|
||||||
- Cross-reference with requirements
|
- Cross-reference with requirements
|
||||||
|
|
||||||
@@ -292,12 +273,6 @@ Always separate into two categories:
|
|||||||
- Performance under real conditions
|
- Performance under real conditions
|
||||||
- Edge cases hard to automate
|
- Edge cases hard to automate
|
||||||
|
|
||||||
**From Contribution Guidelines** (if CONTRIBUTING.md exists):
|
|
||||||
- Include any testing requirements specified in guidelines
|
|
||||||
- Include any code style/linting requirements
|
|
||||||
- Include any documentation requirements
|
|
||||||
- Reference the guideline: "Per CONTRIBUTING.md: {requirement}"
|
|
||||||
|
|
||||||
## Example Invocation
|
## Example Invocation
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -51,18 +51,6 @@ When this command is invoked:
|
|||||||
- Use the Read tool WITHOUT limit/offset parameters
|
- Use the Read tool WITHOUT limit/offset parameters
|
||||||
- Read these files yourself in the main context before spawning sub-tasks
|
- Read these files yourself in the main context before spawning sub-tasks
|
||||||
|
|
||||||
### Step 1.5: Check for contribution guidelines
|
|
||||||
|
|
||||||
Before spawning sub-agents, check if the repository has contribution guidelines:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
for f in CONTRIBUTING.md .github/CONTRIBUTING.md docs/CONTRIBUTING.md; do
|
|
||||||
if [ -f "$f" ]; then echo "Found: $f"; break; fi
|
|
||||||
done
|
|
||||||
```
|
|
||||||
|
|
||||||
If found, read the file and note key requirements. These should be included in the research document under a "## Contribution Guidelines" section if relevant to the research question.
|
|
||||||
|
|
||||||
### Step 2: Analyze and decompose the research question
|
### Step 2: Analyze and decompose the research question
|
||||||
- Break down the query into composable research areas
|
- Break down the query into composable research areas
|
||||||
- Identify specific components, patterns, or concepts to investigate
|
- Identify specific components, patterns, or concepts to investigate
|
||||||
@@ -155,10 +143,6 @@ status: complete
|
|||||||
## Architecture Documentation
|
## Architecture Documentation
|
||||||
{Current patterns, conventions found in codebase}
|
{Current patterns, conventions found in codebase}
|
||||||
|
|
||||||
## Contribution Guidelines
|
|
||||||
{If CONTRIBUTING.md exists, summarize key requirements relevant to the research topic}
|
|
||||||
{If no guidelines found, omit this section}
|
|
||||||
|
|
||||||
## Historical Context (from thoughts/)
|
## Historical Context (from thoughts/)
|
||||||
{Relevant insights from thoughts/ with references}
|
{Relevant insights from thoughts/ with references}
|
||||||
|
|
||||||
|
|||||||
@@ -68,12 +68,10 @@ Work on bead [BEAD_ID]: [BEAD_TITLE]
|
|||||||
- Read the plan and find the "Automated Verification" section
|
- Read the plan and find the "Automated Verification" section
|
||||||
- Extract each verification command (lines starting with `- [ ]` followed by a command)
|
- Extract each verification command (lines starting with `- [ ]` followed by a command)
|
||||||
- Example: `- [ ] Tests pass: \`make test\`` → extract `make test`
|
- Example: `- [ ] Tests pass: \`make test\`` → extract `make test`
|
||||||
- Note any "Per CONTRIBUTING.md:" requirements for additional validation
|
|
||||||
- If no plan exists, use best-effort validation:
|
- If no plan exists, use best-effort validation:
|
||||||
- Check if `Makefile` exists → try `make test` and `make lint`
|
- Check if `Makefile` exists → try `make test` and `make lint`
|
||||||
- Check if `flake.nix` exists → try `nix flake check`
|
- Check if `flake.nix` exists → try `nix flake check`
|
||||||
- Check if `package.json` exists → try `npm test`
|
- Check if `package.json` exists → try `npm test`
|
||||||
- **Check for CONTRIBUTING.md** → read and extract testing/linting requirements
|
|
||||||
- If none found, note "No validation criteria found"
|
- If none found, note "No validation criteria found"
|
||||||
|
|
||||||
4. **Implement the changes**:
|
4. **Implement the changes**:
|
||||||
|
|||||||
Reference in New Issue
Block a user