opencode-bonfire 1.2.1 → 1.3.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.
|
@@ -8,14 +8,35 @@ description: End session - update context and commit changes
|
|
|
8
8
|
|
|
9
9
|
Run `git rev-parse --show-toplevel` to locate the repository root.
|
|
10
10
|
|
|
11
|
-
## Step 2:
|
|
11
|
+
## Step 2: Check for Handoff
|
|
12
|
+
|
|
13
|
+
Check if `<git-root>/.bonfire/handoff/handed-off` exists.
|
|
14
|
+
|
|
15
|
+
**If it exists**: This session was handed off to a new session. Warn the user:
|
|
16
|
+
|
|
17
|
+
> "This session was previously handed off. The new session may have already updated `index.md`.
|
|
18
|
+
> Running `/bonfire-end` here could cause conflicts or overwrite the new session's changes."
|
|
19
|
+
|
|
20
|
+
Ask the user:
|
|
21
|
+
1. "Proceed anyway" - Continue with /bonfire-end (user takes responsibility)
|
|
22
|
+
2. "Skip index.md update" - Only commit changes, don't update context
|
|
23
|
+
3. "Cancel" - Abort /bonfire-end
|
|
24
|
+
|
|
25
|
+
If user chooses to proceed or skip, delete the marker file after completion:
|
|
26
|
+
```bash
|
|
27
|
+
rm <git-root>/.bonfire/handoff/handed-off
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**If marker doesn't exist**: Continue normally.
|
|
31
|
+
|
|
32
|
+
## Step 3: Review Session Work
|
|
12
33
|
|
|
13
34
|
Review what was accomplished this session by examining:
|
|
14
35
|
- Recent git commits
|
|
15
36
|
- Files changed
|
|
16
37
|
- Conversation context
|
|
17
38
|
|
|
18
|
-
## Step
|
|
39
|
+
## Step 4: Update Session Context
|
|
19
40
|
|
|
20
41
|
Update `<git-root>/.bonfire/index.md`:
|
|
21
42
|
|
|
@@ -29,7 +50,7 @@ Update `<git-root>/.bonfire/index.md`:
|
|
|
29
50
|
|
|
30
51
|
3. Update "Current State" to reflect new status
|
|
31
52
|
|
|
32
|
-
## Step
|
|
53
|
+
## Step 5: Update Codemap
|
|
33
54
|
|
|
34
55
|
Update the "Codemap" section in `index.md` with files referenced this session:
|
|
35
56
|
|
|
@@ -68,7 +89,7 @@ Example:
|
|
|
68
89
|
- `.bonfire/specs/codemap-feature.md` - Feature specification
|
|
69
90
|
```
|
|
70
91
|
|
|
71
|
-
## Step
|
|
92
|
+
## Step 6: Commit Changes (if tracked)
|
|
72
93
|
|
|
73
94
|
Read `<git-root>/.bonfire/config.json` to check `gitStrategy`.
|
|
74
95
|
|
|
@@ -91,7 +112,7 @@ Read `<git-root>/.bonfire/config.json` to check `gitStrategy`.
|
|
|
91
112
|
|
|
92
113
|
If the commit fails due to hooks, help resolve the issue (but never bypass hooks with `--no-verify`).
|
|
93
114
|
|
|
94
|
-
## Step
|
|
115
|
+
## Step 7: Confirm
|
|
95
116
|
|
|
96
117
|
Summarize:
|
|
97
118
|
- What was documented
|
|
@@ -0,0 +1,168 @@
|
|
|
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.
|
|
@@ -199,6 +199,28 @@ Read `.bonfire/index.md` for current project state, recent work, and priorities.
|
|
|
199
199
|
Read `.bonfire/index.md` for current project state, recent work, and priorities.
|
|
200
200
|
```
|
|
201
201
|
|
|
202
|
+
## Step 3.5: Check for Handoff Continuation
|
|
203
|
+
|
|
204
|
+
Check if `<git-root>/.bonfire/handoff/context.md` exists.
|
|
205
|
+
|
|
206
|
+
**If it exists**: This session is continuing from a handoff. Acknowledge it:
|
|
207
|
+
|
|
208
|
+
> "Detected handoff context from previous session. Loading continuation state..."
|
|
209
|
+
|
|
210
|
+
Read the handoff context file and note:
|
|
211
|
+
- What task was in progress
|
|
212
|
+
- Immediate next steps
|
|
213
|
+
- Key context
|
|
214
|
+
|
|
215
|
+
Then clean up the handoff files:
|
|
216
|
+
```bash
|
|
217
|
+
rm -rf <git-root>/.bonfire/handoff/
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
The handoff context provides quick orientation, but the full history is in `index.md` (read in Step 4).
|
|
221
|
+
|
|
222
|
+
**If handoff context doesn't exist**: Continue normally.
|
|
223
|
+
|
|
202
224
|
## Step 4: Read Session Context
|
|
203
225
|
|
|
204
226
|
Read `<git-root>/.bonfire/index.md` and report when ready.
|
package/files/opencode.json
CHANGED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Handoff Awareness
|
|
3
|
+
model: anthropic/claude-haiku-4-20250514
|
|
4
|
+
mode: task
|
|
5
|
+
hidden: true
|
|
6
|
+
tools:
|
|
7
|
+
- bash
|
|
8
|
+
- read
|
|
9
|
+
- glob
|
|
10
|
+
permission:
|
|
11
|
+
task:
|
|
12
|
+
"*": deny
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Handoff Awareness
|
|
16
|
+
|
|
17
|
+
This skill detects when a session handoff may be beneficial and suggests the appropriate action.
|
|
18
|
+
|
|
19
|
+
## When to Trigger
|
|
20
|
+
|
|
21
|
+
Activate when user mentions:
|
|
22
|
+
- Context concerns: "running out of context", "context limit", "context window"
|
|
23
|
+
- Length concerns: "conversation is getting long", "too much context", "large conversation"
|
|
24
|
+
- Fresh start: "should we start fresh?", "new session?", "hand off?", "start over?"
|
|
25
|
+
- Degraded quality: "you're losing context", "you forgot", "we already discussed this"
|
|
26
|
+
- Explicit ask: "can you hand off?", "transfer to new session"
|
|
27
|
+
|
|
28
|
+
## Instructions
|
|
29
|
+
|
|
30
|
+
1. **Check for .bonfire/ directory**:
|
|
31
|
+
```bash
|
|
32
|
+
git rev-parse --show-toplevel
|
|
33
|
+
```
|
|
34
|
+
Then check if `.bonfire/index.md` exists.
|
|
35
|
+
|
|
36
|
+
2. **If .bonfire/ exists**, suggest handoff:
|
|
37
|
+
|
|
38
|
+
> "I can hand off this session to a fresh Claude instance while preserving your work.
|
|
39
|
+
>
|
|
40
|
+
> Run `/bonfire-handoff` to:
|
|
41
|
+
> 1. Save current progress to `.bonfire/index.md`
|
|
42
|
+
> 2. Generate minimal handoff context
|
|
43
|
+
> 3. Spawn a new Claude session in an adjacent tmux pane
|
|
44
|
+
>
|
|
45
|
+
> The new session will have access to your full session history via `/bonfire-start`."
|
|
46
|
+
|
|
47
|
+
3. **If .bonfire/ doesn't exist**, suggest initialization:
|
|
48
|
+
|
|
49
|
+
> "To enable session handoff, first run `/bonfire-start` to initialize session tracking.
|
|
50
|
+
> This creates a `.bonfire/` directory that preserves context across sessions."
|
|
51
|
+
|
|
52
|
+
4. **If not in tmux**, mention the limitation:
|
|
53
|
+
|
|
54
|
+
> "Note: Automatic session spawning requires tmux. If you're not in tmux, you can still
|
|
55
|
+
> run `/bonfire-handoff` to generate the handoff context, then manually start a new
|
|
56
|
+
> session and paste the context."
|
|
57
|
+
|
|
58
|
+
## Important
|
|
59
|
+
|
|
60
|
+
- This skill **suggests** handoff, it does NOT trigger it automatically
|
|
61
|
+
- User must explicitly run `/bonfire-handoff` to perform the handoff
|
|
62
|
+
- Don't suggest handoff for short conversations or early in a session
|
|
63
|
+
- If user is mid-task, suggest completing the current atomic unit first
|
|
64
|
+
- Handoff is specifically for context limit concerns, not for switching topics
|