opencode-bonfire 1.4.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -10
- package/files/agent/writer.md +127 -0
- package/files/command/bonfire-configure.md +49 -4
- package/files/command/bonfire-document.md +61 -134
- package/files/command/bonfire-review-pr.md +45 -91
- package/files/command/bonfire-spec.md +68 -226
- package/files/command/bonfire-strategic.md +166 -0
- package/files/opencode.json +0 -3
- package/package.json +1 -1
- package/files/agent/doc-writer.md +0 -120
- package/files/agent/spec-writer.md +0 -142
- package/files/command/bonfire-git-strategy.md +0 -91
- package/files/command/bonfire-handoff.md +0 -168
- package/files/command/bonfire-poc.md +0 -332
- package/files/command/bonfire-prd.md +0 -332
- package/files/command/bonfire-rfc.md +0 -267
- package/files/skill/handoff-awareness/SKILL.md +0 -64
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Create strategic documents (RFC, PRD, POC)
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Create Strategic Document
|
|
6
|
+
|
|
7
|
+
Create a strategic document of type **$1** for **$2**.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Document Type Detection
|
|
12
|
+
|
|
13
|
+
Parse $ARGUMENTS:
|
|
14
|
+
- First word: document type (rfc, prd, poc)
|
|
15
|
+
- Remaining: topic/subject
|
|
16
|
+
|
|
17
|
+
Examples:
|
|
18
|
+
- `/bonfire-strategic rfc authentication` → RFC about authentication
|
|
19
|
+
- `/bonfire-strategic prd dark-mode` → PRD about dark mode feature
|
|
20
|
+
- `/bonfire-strategic poc acme-corp` → POC plan for Acme Corp
|
|
21
|
+
|
|
22
|
+
If type not recognized or missing, ask user to specify.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Supported Types
|
|
27
|
+
|
|
28
|
+
| Type | Full Name | Use Case |
|
|
29
|
+
|------|-----------|----------|
|
|
30
|
+
| `rfc` | Request for Comments | Technical decisions, architecture proposals |
|
|
31
|
+
| `prd` | Product Requirements Document | Product specs, feature definitions |
|
|
32
|
+
| `poc` | Proof of Concept Plan | Customer evaluations, technical validations |
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Shared Flow
|
|
37
|
+
|
|
38
|
+
All document types follow the same research → interview → write pattern:
|
|
39
|
+
|
|
40
|
+
### Phase 1: Research (Subagent)
|
|
41
|
+
|
|
42
|
+
**Progress**: Tell the user "Researching codebase for context..."
|
|
43
|
+
|
|
44
|
+
Use the Task tool to invoke the **codebase-explorer** agent.
|
|
45
|
+
|
|
46
|
+
Research questions vary by type:
|
|
47
|
+
|
|
48
|
+
**RFC**: Prior art, architecture, constraints, stakeholders
|
|
49
|
+
**PRD**: Related features, user flows, data model, technical constraints
|
|
50
|
+
**POC**: Relevant features, integration points, configuration, limitations
|
|
51
|
+
|
|
52
|
+
**Wait for findings** before proceeding.
|
|
53
|
+
|
|
54
|
+
### Phase 2: Interview (Main Context)
|
|
55
|
+
|
|
56
|
+
**Progress**: Tell the user "Starting interview..."
|
|
57
|
+
|
|
58
|
+
Interview rounds vary by type:
|
|
59
|
+
|
|
60
|
+
**RFC** (3 rounds):
|
|
61
|
+
1. Problem definition
|
|
62
|
+
2. Proposed solutions
|
|
63
|
+
3. Logistics & scope
|
|
64
|
+
|
|
65
|
+
**PRD** (4 rounds):
|
|
66
|
+
1. Problem & opportunity
|
|
67
|
+
2. Target users
|
|
68
|
+
3. Requirements & metrics
|
|
69
|
+
4. Scope
|
|
70
|
+
|
|
71
|
+
**POC** (4 rounds):
|
|
72
|
+
1. Customer context
|
|
73
|
+
2. Goals & success criteria
|
|
74
|
+
3. Scope & timeline
|
|
75
|
+
4. Risks & responsibilities
|
|
76
|
+
|
|
77
|
+
Use the question tool with informed questions based on research.
|
|
78
|
+
|
|
79
|
+
### Phase 3: Write (Subagent)
|
|
80
|
+
|
|
81
|
+
**Progress**: Tell the user "Writing document..."
|
|
82
|
+
|
|
83
|
+
Use the Task tool to invoke the **writer** agent.
|
|
84
|
+
|
|
85
|
+
Provide:
|
|
86
|
+
- Document type
|
|
87
|
+
- Research findings
|
|
88
|
+
- Interview Q&A
|
|
89
|
+
- Output path
|
|
90
|
+
- Template structure (type-specific)
|
|
91
|
+
|
|
92
|
+
### Phase 4: Verify & Confirm
|
|
93
|
+
|
|
94
|
+
Verify required sections are present (4 key sections per type).
|
|
95
|
+
|
|
96
|
+
If incomplete, offer: proceed / retry / abort.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Type-Specific Details
|
|
101
|
+
|
|
102
|
+
### RFC (Request for Comments)
|
|
103
|
+
|
|
104
|
+
**Interview rounds**:
|
|
105
|
+
- Round 1: Problem definition (what problems, who experiences, evidence)
|
|
106
|
+
- Round 2: Proposed solutions (approach, alternatives, tradeoffs)
|
|
107
|
+
- Round 3: Logistics (reviewers, scope, timeline)
|
|
108
|
+
|
|
109
|
+
**Required sections**:
|
|
110
|
+
- `## Abstract`
|
|
111
|
+
- `## Problems We Need To Solve`
|
|
112
|
+
- `## Proposed Solution`
|
|
113
|
+
- `## Alternatives Considered`
|
|
114
|
+
|
|
115
|
+
**Naming**: `rfc-<topic>.md` or `rfc-<issue-id>-<topic>.md`
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
### PRD (Product Requirements Document)
|
|
120
|
+
|
|
121
|
+
**Interview rounds**:
|
|
122
|
+
- Round 1: Problem & opportunity (pain points, why now, business case)
|
|
123
|
+
- Round 2: Target users (primary/secondary audiences, plan gating)
|
|
124
|
+
- Round 3: Requirements & metrics (must-haves, success metrics)
|
|
125
|
+
- Round 4: Scope (in/out of scope, dependencies)
|
|
126
|
+
|
|
127
|
+
**Required sections**:
|
|
128
|
+
- `## 2. Problem`
|
|
129
|
+
- `## 5. Goals & Success Metrics`
|
|
130
|
+
- `## 6. Product Requirements`
|
|
131
|
+
- `## 9. Scope`
|
|
132
|
+
|
|
133
|
+
**Naming**: `prd-<feature>.md` or `prd-<issue-id>-<feature>.md`
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
### POC (Proof of Concept Plan)
|
|
138
|
+
|
|
139
|
+
**Interview rounds**:
|
|
140
|
+
- Round 1: Customer context (who, current state, why evaluating)
|
|
141
|
+
- Round 2: Goals & success criteria (what to prove, measurable outcomes)
|
|
142
|
+
- Round 3: Scope & timeline (in/out scope, dates, deadlines)
|
|
143
|
+
- Round 4: Risks & responsibilities (ownership, assumptions, risks)
|
|
144
|
+
|
|
145
|
+
**Required sections**:
|
|
146
|
+
- `## 2. Goals`
|
|
147
|
+
- `## 3. Success Criteria`
|
|
148
|
+
- `## 4. Scope`
|
|
149
|
+
- `## 5. Plan & Timeline`
|
|
150
|
+
|
|
151
|
+
**Naming**: `poc-<customer>.md` or `poc-<issue-id>-<customer>.md`
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## File Locations
|
|
156
|
+
|
|
157
|
+
- **Config**: `<git-root>/.bonfire/config.json` contains `docsLocation`
|
|
158
|
+
- **Default**: `.bonfire/docs/` if not configured
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Post-Write
|
|
163
|
+
|
|
164
|
+
1. **Verify** document has required sections
|
|
165
|
+
2. **Link** to session context in `<git-root>/.bonfire/index.md`
|
|
166
|
+
3. **Confirm** with user and offer next steps
|
package/files/opencode.json
CHANGED
package/package.json
CHANGED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Synthesizes research findings into reference documentation
|
|
3
|
-
mode: subagent
|
|
4
|
-
hidden: true
|
|
5
|
-
temperature: 0.1
|
|
6
|
-
maxSteps: 25
|
|
7
|
-
tools:
|
|
8
|
-
bash: false
|
|
9
|
-
glob: false
|
|
10
|
-
grep: false
|
|
11
|
-
todowrite: false
|
|
12
|
-
todoread: false
|
|
13
|
-
permission:
|
|
14
|
-
task:
|
|
15
|
-
"*": deny
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
You are a technical documentation writer. Given research findings about a codebase topic, produce clear, useful reference documentation.
|
|
19
|
-
|
|
20
|
-
## Input Format
|
|
21
|
-
|
|
22
|
-
You'll receive a structured prompt with these sections:
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
## Research Findings
|
|
26
|
-
|
|
27
|
-
<structured markdown from codebase-explorer>
|
|
28
|
-
|
|
29
|
-
## Doc Metadata
|
|
30
|
-
|
|
31
|
-
- **Topic**: <what to document>
|
|
32
|
-
- **Output Path**: </absolute/path/to/doc.md>
|
|
33
|
-
- **Date**: <YYYY-MM-DD>
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
All sections are required. Write the documentation to the exact path specified in Output Path.
|
|
37
|
-
|
|
38
|
-
**Mapping findings to doc sections:**
|
|
39
|
-
- Architecture/Patterns → Architecture, How It Works
|
|
40
|
-
- Key Files → Key Files table
|
|
41
|
-
- Flow → How It Works (step-by-step)
|
|
42
|
-
- Gotchas → Gotchas section
|
|
43
|
-
- Constraints → noted throughout where relevant
|
|
44
|
-
|
|
45
|
-
## Output
|
|
46
|
-
|
|
47
|
-
Write a complete documentation file to the specified path. The doc must be:
|
|
48
|
-
- **Clear** - Understandable by someone new to the codebase
|
|
49
|
-
- **Grounded** - Based on discovered patterns, not assumptions
|
|
50
|
-
- **Useful** - Answers "how does this work?" and "where do I look?"
|
|
51
|
-
|
|
52
|
-
## Doc Template
|
|
53
|
-
|
|
54
|
-
```markdown
|
|
55
|
-
# [TOPIC]
|
|
56
|
-
|
|
57
|
-
## Overview
|
|
58
|
-
|
|
59
|
-
[What this is, why it exists, when you'd interact with it]
|
|
60
|
-
|
|
61
|
-
## Architecture
|
|
62
|
-
|
|
63
|
-
[How it's structured - components, layers, key relationships]
|
|
64
|
-
|
|
65
|
-
```mermaid
|
|
66
|
-
flowchart TD
|
|
67
|
-
A[Component A] --> B[Component B]
|
|
68
|
-
B --> C[Component C]
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
## Key Files
|
|
72
|
-
|
|
73
|
-
| File | Purpose |
|
|
74
|
-
|------|---------|
|
|
75
|
-
| `path/to/file.ts` | [What it does] |
|
|
76
|
-
| `path/to/other.ts` | [What it does] |
|
|
77
|
-
|
|
78
|
-
## How It Works
|
|
79
|
-
|
|
80
|
-
[Step-by-step flow, data transformations, control flow]
|
|
81
|
-
|
|
82
|
-
1. **Step one**: [What happens]
|
|
83
|
-
2. **Step two**: [What happens]
|
|
84
|
-
3. **Step three**: [What happens]
|
|
85
|
-
|
|
86
|
-
## Usage Examples
|
|
87
|
-
|
|
88
|
-
[Code examples, CLI commands, common operations]
|
|
89
|
-
|
|
90
|
-
```typescript
|
|
91
|
-
// Example usage
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
## Gotchas
|
|
95
|
-
|
|
96
|
-
- **[Issue]**: [Why it matters, how to avoid]
|
|
97
|
-
- **[Edge case]**: [What to watch out for]
|
|
98
|
-
|
|
99
|
-
## Related
|
|
100
|
-
|
|
101
|
-
- [Related doc](other-doc.md)
|
|
102
|
-
- [Code reference]: `path/to/file.ts`
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
## Rules
|
|
106
|
-
|
|
107
|
-
1. **Ground in research** - Reference actual files and patterns discovered
|
|
108
|
-
2. **Be specific** - Use real file paths, not placeholders
|
|
109
|
-
3. **Don't invent** - If something wasn't in findings, don't guess
|
|
110
|
-
4. **Keep it scannable** - Headers, tables, and lists over prose
|
|
111
|
-
5. **Include code paths** - Always show where to look in the codebase
|
|
112
|
-
|
|
113
|
-
## Quality Checklist
|
|
114
|
-
|
|
115
|
-
Before finishing, verify:
|
|
116
|
-
- [ ] Overview explains what and why
|
|
117
|
-
- [ ] Key files table has real paths from research
|
|
118
|
-
- [ ] How It Works section is step-by-step
|
|
119
|
-
- [ ] Gotchas from research are captured
|
|
120
|
-
- [ ] Mermaid diagram accurately reflects architecture (if included)
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Synthesizes research findings and interview answers into implementation specs
|
|
3
|
-
mode: subagent
|
|
4
|
-
hidden: true
|
|
5
|
-
temperature: 0.1
|
|
6
|
-
maxSteps: 25
|
|
7
|
-
tools:
|
|
8
|
-
bash: false
|
|
9
|
-
glob: false
|
|
10
|
-
grep: false
|
|
11
|
-
todowrite: false
|
|
12
|
-
todoread: false
|
|
13
|
-
permission:
|
|
14
|
-
task:
|
|
15
|
-
"*": deny
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
You are a technical specification writer. Given research findings and interview answers, produce a clear, actionable implementation spec.
|
|
19
|
-
|
|
20
|
-
## Input Format
|
|
21
|
-
|
|
22
|
-
You'll receive a structured prompt with these sections:
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
## Research Findings
|
|
26
|
-
|
|
27
|
-
<structured markdown from codebase-explorer>
|
|
28
|
-
|
|
29
|
-
## Interview Q&A
|
|
30
|
-
|
|
31
|
-
### Core Decisions
|
|
32
|
-
**Q**: <question about fundamental approach>
|
|
33
|
-
**A**: <user's answer>
|
|
34
|
-
|
|
35
|
-
### Edge Cases & Tradeoffs
|
|
36
|
-
**Q**: <question about error handling, edge cases>
|
|
37
|
-
**A**: <user's answer>
|
|
38
|
-
|
|
39
|
-
### Scope & Boundaries
|
|
40
|
-
**Q**: <question about what's in/out of scope>
|
|
41
|
-
**A**: <user's answer>
|
|
42
|
-
|
|
43
|
-
## Spec Metadata
|
|
44
|
-
|
|
45
|
-
- **Topic**: <feature or task name>
|
|
46
|
-
- **Issue**: <issue ID or N/A>
|
|
47
|
-
- **Output Path**: </absolute/path/to/spec.md>
|
|
48
|
-
- **Date**: <YYYY-MM-DD>
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
All sections are required. Write the spec to the exact path specified in Output Path.
|
|
52
|
-
|
|
53
|
-
**Mapping Q&A to spec sections:**
|
|
54
|
-
- Core Decisions → Decisions, Approach
|
|
55
|
-
- Edge Cases & Tradeoffs → Edge Cases, Risks & Considerations
|
|
56
|
-
- Scope & Boundaries → Out of Scope, Implementation Steps
|
|
57
|
-
|
|
58
|
-
## Output
|
|
59
|
-
|
|
60
|
-
Write a complete spec file to the specified path. The spec must be:
|
|
61
|
-
- **Actionable** - Clear implementation steps referencing actual files
|
|
62
|
-
- **Grounded** - Based on discovered patterns, not assumptions
|
|
63
|
-
- **Complete** - Covers edge cases, testing, scope boundaries
|
|
64
|
-
|
|
65
|
-
## Spec Template
|
|
66
|
-
|
|
67
|
-
```markdown
|
|
68
|
-
# Spec: [TOPIC]
|
|
69
|
-
|
|
70
|
-
**Created**: [DATE]
|
|
71
|
-
**Issue**: [ISSUE-ID or N/A]
|
|
72
|
-
**Status**: Draft
|
|
73
|
-
|
|
74
|
-
## Overview
|
|
75
|
-
|
|
76
|
-
[What we're building and why - synthesized from interview]
|
|
77
|
-
|
|
78
|
-
## Context
|
|
79
|
-
|
|
80
|
-
[Key findings from research that informed decisions]
|
|
81
|
-
|
|
82
|
-
## Decisions
|
|
83
|
-
|
|
84
|
-
[Document decisions made during interview with rationale]
|
|
85
|
-
|
|
86
|
-
- **[Decision 1]**: [Choice] - [Why]
|
|
87
|
-
- **[Decision 2]**: [Choice] - [Why]
|
|
88
|
-
|
|
89
|
-
## Approach
|
|
90
|
-
|
|
91
|
-
[High-level strategy based on research + interview]
|
|
92
|
-
|
|
93
|
-
## Files to Modify
|
|
94
|
-
|
|
95
|
-
- `path/to/file.ts` - [what changes]
|
|
96
|
-
|
|
97
|
-
## Files to Create
|
|
98
|
-
|
|
99
|
-
- `path/to/new.ts` - [purpose]
|
|
100
|
-
|
|
101
|
-
## Implementation Steps
|
|
102
|
-
|
|
103
|
-
1. [ ] Step one (reference actual files)
|
|
104
|
-
2. [ ] Step two
|
|
105
|
-
3. [ ] Step three
|
|
106
|
-
|
|
107
|
-
## Edge Cases
|
|
108
|
-
|
|
109
|
-
- [Edge case 1] → [How we handle it]
|
|
110
|
-
- [Edge case 2] → [How we handle it]
|
|
111
|
-
|
|
112
|
-
## Testing Strategy
|
|
113
|
-
|
|
114
|
-
- [ ] Unit tests for X
|
|
115
|
-
- [ ] Integration test for Y
|
|
116
|
-
- [ ] Manual verification of Z
|
|
117
|
-
|
|
118
|
-
## Out of Scope
|
|
119
|
-
|
|
120
|
-
- [Explicitly excluded items]
|
|
121
|
-
|
|
122
|
-
## Risks & Considerations
|
|
123
|
-
|
|
124
|
-
- [Risk identified during research/interview]
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
## Rules
|
|
128
|
-
|
|
129
|
-
1. **Ground in research** - Reference actual files and patterns discovered
|
|
130
|
-
2. **Honor interview answers** - Don't override user decisions
|
|
131
|
-
3. **Be specific** - "Update UserService.ts" not "Update the service"
|
|
132
|
-
4. **Don't invent** - If something wasn't discussed, don't add it
|
|
133
|
-
5. **Keep it actionable** - Someone should be able to implement from this spec
|
|
134
|
-
|
|
135
|
-
## Quality Checklist
|
|
136
|
-
|
|
137
|
-
Before finishing, verify:
|
|
138
|
-
- [ ] All interview decisions are captured
|
|
139
|
-
- [ ] Implementation steps reference real files from research
|
|
140
|
-
- [ ] Edge cases from interview are documented
|
|
141
|
-
- [ ] Scope boundaries are clear
|
|
142
|
-
- [ ] No vague or generic steps
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Change how .bonfire/ is handled in git
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Change Git Strategy
|
|
6
|
-
|
|
7
|
-
## Step 1: Find Git Root
|
|
8
|
-
|
|
9
|
-
Run `git rev-parse --show-toplevel` to locate the repository root.
|
|
10
|
-
|
|
11
|
-
## Step 2: Read Current Config
|
|
12
|
-
|
|
13
|
-
Read `<git-root>/.bonfire/config.json` to check current `specsLocation` and `docsLocation` settings.
|
|
14
|
-
|
|
15
|
-
## Step 3: Explain Options
|
|
16
|
-
|
|
17
|
-
Present the git strategy options:
|
|
18
|
-
|
|
19
|
-
1. **Ignore all** - Keep sessions completely local
|
|
20
|
-
- Everything in .bonfire/ is gitignored
|
|
21
|
-
- Most private, nothing shared
|
|
22
|
-
- Good for: solo work, sensitive projects
|
|
23
|
-
|
|
24
|
-
2. **Hybrid** - Commit docs/specs, keep notes private
|
|
25
|
-
- docs/ and specs/ are committed
|
|
26
|
-
- index.md and archive/ stay local
|
|
27
|
-
- Good for: teams that want shared docs but private notes
|
|
28
|
-
|
|
29
|
-
3. **Commit all** - Share everything with team
|
|
30
|
-
- All session content is committed
|
|
31
|
-
- Only data/ and scratch/ ignored
|
|
32
|
-
- Good for: full transparency, team continuity
|
|
33
|
-
|
|
34
|
-
## Step 4: Get User Choice
|
|
35
|
-
|
|
36
|
-
Use the question tool to ask which strategy:
|
|
37
|
-
|
|
38
|
-
"Which git strategy for `.bonfire/`?" (Header: "Git")
|
|
39
|
-
- ignore-all (Recommended) - Keep sessions private/local
|
|
40
|
-
- hybrid - Commit docs/specs, keep notes private
|
|
41
|
-
- commit-all - Share everything with team
|
|
42
|
-
|
|
43
|
-
## Step 5: Update .gitignore
|
|
44
|
-
|
|
45
|
-
Write the appropriate `.gitignore` to `<git-root>/.bonfire/.gitignore`:
|
|
46
|
-
|
|
47
|
-
**Ignore all**:
|
|
48
|
-
```
|
|
49
|
-
*
|
|
50
|
-
!.gitignore
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
**Hybrid** (only include dirs that are inside .bonfire/):
|
|
54
|
-
```
|
|
55
|
-
*
|
|
56
|
-
!.gitignore
|
|
57
|
-
```
|
|
58
|
-
If docsLocation is `.bonfire/docs/`, add:
|
|
59
|
-
```
|
|
60
|
-
!docs/
|
|
61
|
-
!docs/**
|
|
62
|
-
```
|
|
63
|
-
If specsLocation is `.bonfire/specs/`, add:
|
|
64
|
-
```
|
|
65
|
-
!specs/
|
|
66
|
-
!specs/**
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
**Commit all**:
|
|
70
|
-
```
|
|
71
|
-
data/
|
|
72
|
-
scratch/
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
## Step 6: Handle Git Tracking
|
|
76
|
-
|
|
77
|
-
If switching FROM commit/hybrid TO ignore:
|
|
78
|
-
- Warn user that existing tracked files will remain tracked
|
|
79
|
-
- Offer to run: `git rm -r --cached .bonfire/` (removes from git but keeps files)
|
|
80
|
-
- They'll need to commit this change
|
|
81
|
-
|
|
82
|
-
If switching TO commit/hybrid:
|
|
83
|
-
- Files will be picked up on next commit
|
|
84
|
-
- No special action needed
|
|
85
|
-
|
|
86
|
-
## Step 7: Confirm
|
|
87
|
-
|
|
88
|
-
Report:
|
|
89
|
-
- New strategy applied
|
|
90
|
-
- Any manual steps needed
|
|
91
|
-
- How to verify the change
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Hand off session to new Claude instance when approaching context limits
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Session Handoff
|
|
6
|
-
|
|
7
|
-
Hand off the current session to a fresh Claude instance, preserving work state.
|
|
8
|
-
|
|
9
|
-
## Step 1: Verify Environment
|
|
10
|
-
|
|
11
|
-
Check if running inside tmux:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
[ -n "$TMUX" ] && echo "tmux: yes" || echo "tmux: no"
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
**If not in tmux**: Still generate handoff context, then provide manual instructions:
|
|
18
|
-
|
|
19
|
-
1. Continue with Steps 2-8 (skip Step 9)
|
|
20
|
-
2. Tell the user:
|
|
21
|
-
|
|
22
|
-
> "Automatic session spawning requires tmux. I've saved the handoff context.
|
|
23
|
-
>
|
|
24
|
-
> **To continue manually:**
|
|
25
|
-
> 1. Open a new terminal in this directory
|
|
26
|
-
> 2. Run: `opencode --append-system-prompt "$(cat .bonfire/handoff/context.md)"`
|
|
27
|
-
> 3. In the new session, run `/bonfire-start` to load full history
|
|
28
|
-
>
|
|
29
|
-
> The handoff context is saved at `.bonfire/handoff/context.md`"
|
|
30
|
-
|
|
31
|
-
## Step 2: Find Git Root
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
git rev-parse --show-toplevel
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Step 3: Verify Bonfire Exists
|
|
38
|
-
|
|
39
|
-
Check if `<git-root>/.bonfire/index.md` exists.
|
|
40
|
-
|
|
41
|
-
**If not**: Abort with message:
|
|
42
|
-
> "No .bonfire/ directory found. Run `/bonfire-start` first to initialize session tracking."
|
|
43
|
-
|
|
44
|
-
## Step 4: Check for Uncommitted Changes
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
git status --porcelain
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
**If uncommitted changes exist**: Warn the user:
|
|
51
|
-
> "Note: You have uncommitted changes. The new session will see them. Consider committing or stashing before handoff."
|
|
52
|
-
|
|
53
|
-
Ask if they want to proceed anyway.
|
|
54
|
-
|
|
55
|
-
## Step 5: Update index.md
|
|
56
|
-
|
|
57
|
-
Read `<git-root>/.bonfire/index.md` and update the current session entry:
|
|
58
|
-
|
|
59
|
-
1. **Add HANDOFF marker** to session title:
|
|
60
|
-
```markdown
|
|
61
|
-
### Session N - DATE (HANDOFF)
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
2. **Add "In Progress at Handoff"** section:
|
|
65
|
-
```markdown
|
|
66
|
-
**In Progress at Handoff**:
|
|
67
|
-
- [What was actively being worked on]
|
|
68
|
-
- [Current state of that work]
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
3. **Add handoff metadata**:
|
|
72
|
-
```markdown
|
|
73
|
-
**Handoff Reason**: Approaching context limit
|
|
74
|
-
**Continued In**: Next session
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
4. **Update "Next Session Priorities"** with the immediate work that needs to continue.
|
|
78
|
-
|
|
79
|
-
5. **Update Codemap** "This Session's Key Files" with files relevant to current work.
|
|
80
|
-
|
|
81
|
-
## Step 6: Generate Handoff Context
|
|
82
|
-
|
|
83
|
-
Create `<git-root>/.bonfire/handoff/` directory if it doesn't exist.
|
|
84
|
-
|
|
85
|
-
Write `<git-root>/.bonfire/handoff/context.md` with minimal context (~1K tokens max):
|
|
86
|
-
|
|
87
|
-
```markdown
|
|
88
|
-
# Session Handoff Context
|
|
89
|
-
|
|
90
|
-
**Date**: [CURRENT_DATE]
|
|
91
|
-
**Branch**: [current git branch]
|
|
92
|
-
**Repository**: [repo name from package.json or directory name]
|
|
93
|
-
|
|
94
|
-
## Current Task
|
|
95
|
-
|
|
96
|
-
[1-2 sentences describing what was actively being worked on when handoff triggered]
|
|
97
|
-
|
|
98
|
-
## Immediate Next Steps
|
|
99
|
-
|
|
100
|
-
1. [First priority - most urgent continuation]
|
|
101
|
-
2. [Second priority]
|
|
102
|
-
3. [Third priority if applicable]
|
|
103
|
-
|
|
104
|
-
## Key Context
|
|
105
|
-
|
|
106
|
-
- [Critical decision or constraint affecting the work]
|
|
107
|
-
- [Important file or component being modified]
|
|
108
|
-
- [Any blockers or considerations for new session]
|
|
109
|
-
|
|
110
|
-
## Uncommitted Changes
|
|
111
|
-
|
|
112
|
-
[List modified files from git status, or "None" if clean]
|
|
113
|
-
|
|
114
|
-
---
|
|
115
|
-
|
|
116
|
-
**Instructions for new session**: Run `/bonfire-start` to load full session context from `.bonfire/index.md`.
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
**Size guidance**: Keep this file under 1000 tokens (~150 words, ~750 characters). Focus on what's needed to continue immediately, not history. If the content exceeds this, trim the "Key Context" section to essential items only.
|
|
120
|
-
|
|
121
|
-
## Step 7: Mark Session as Handed Off
|
|
122
|
-
|
|
123
|
-
Create a marker file to prevent context corruption:
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
echo "$(date -Iseconds)" > <git-root>/.bonfire/handoff/handed-off
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
This marker tells other commands (like `/bonfire-end`) that this session has been handed off and should not update `index.md` again.
|
|
130
|
-
|
|
131
|
-
## Step 8: Add handoff/ to .gitignore
|
|
132
|
-
|
|
133
|
-
Read `<git-root>/.bonfire/.gitignore` and add `handoff/` if not present:
|
|
134
|
-
|
|
135
|
-
```
|
|
136
|
-
handoff/
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
Handoff context is transient and should not be committed.
|
|
140
|
-
|
|
141
|
-
## Step 9: Spawn New Session
|
|
142
|
-
|
|
143
|
-
Run the tmux command to spawn a new pane (horizontal split):
|
|
144
|
-
|
|
145
|
-
```bash
|
|
146
|
-
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
|
147
|
-
CONTEXT="$(cat "$REPO_ROOT/.bonfire/handoff/context.md")"
|
|
148
|
-
tmux split-window -h -c "$REPO_ROOT" \
|
|
149
|
-
"opencode --append-system-prompt '$CONTEXT' 'Continuing from session handoff. Please run /bonfire-start to load the full session context.'"
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
**Verify spawn succeeded**: Check that the new pane exists. If tmux fails (e.g., terminal too small), warn the user and provide manual instructions from Step 1.
|
|
153
|
-
|
|
154
|
-
This creates a new pane to the right of the current pane, keeping both sessions visible during handoff.
|
|
155
|
-
|
|
156
|
-
## Step 10: Confirm Handoff
|
|
157
|
-
|
|
158
|
-
Tell the user:
|
|
159
|
-
|
|
160
|
-
> **Handoff complete.**
|
|
161
|
-
>
|
|
162
|
-
> - Session state saved to `.bonfire/index.md`
|
|
163
|
-
> - Handoff context written to `.bonfire/handoff/context.md`
|
|
164
|
-
> - New session spawned in adjacent pane
|
|
165
|
-
>
|
|
166
|
-
> The new session will run `/bonfire-start` to load your full session history.
|
|
167
|
-
>
|
|
168
|
-
> You can close this pane when ready, or keep both visible during transition.
|