opencodekit 0.12.6 → 0.13.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 +2 -2
- package/dist/index.js +2756 -523
- package/dist/template/.opencode/AGENTS.md +35 -128
- package/dist/template/.opencode/README.md +4 -3
- package/dist/template/.opencode/agent/build.md +32 -21
- package/dist/template/.opencode/agent/explore.md +27 -16
- package/dist/template/.opencode/agent/planner.md +103 -63
- package/dist/template/.opencode/agent/review.md +31 -23
- package/dist/template/.opencode/agent/rush.md +27 -19
- package/dist/template/.opencode/agent/scout.md +27 -19
- package/dist/template/.opencode/agent/vision.md +29 -19
- package/dist/template/.opencode/command/accessibility-check.md +1 -0
- package/dist/template/.opencode/command/analyze-mockup.md +1 -0
- package/dist/template/.opencode/command/analyze-project.md +2 -1
- package/dist/template/.opencode/command/brainstorm.md +2 -1
- package/dist/template/.opencode/command/design-audit.md +1 -0
- package/dist/template/.opencode/command/design.md +1 -0
- package/dist/template/.opencode/command/finish.md +39 -4
- package/dist/template/.opencode/command/fix.md +28 -1
- package/dist/template/.opencode/command/implement.md +26 -6
- package/dist/template/.opencode/command/init.md +1 -0
- package/dist/template/.opencode/command/pr.md +28 -1
- package/dist/template/.opencode/command/research-ui.md +1 -0
- package/dist/template/.opencode/command/research.md +1 -4
- package/dist/template/.opencode/command/review-codebase.md +1 -0
- package/dist/template/.opencode/command/start.md +106 -0
- package/dist/template/.opencode/command/status.md +3 -2
- package/dist/template/.opencode/command/summarize.md +2 -1
- package/dist/template/.opencode/command/triage.md +66 -12
- package/dist/template/.opencode/command/ui-review.md +1 -0
- package/dist/template/.opencode/memory/project/architecture.md +59 -6
- package/dist/template/.opencode/memory/project/beads-workflow.md +278 -0
- package/dist/template/.opencode/memory/project/commands.md +20 -164
- package/dist/template/.opencode/memory/session-context.md +40 -0
- package/dist/template/.opencode/memory/user.md +24 -7
- package/dist/template/.opencode/opencode.json +77 -16
- package/dist/template/.opencode/package.json +1 -1
- package/dist/template/.opencode/plugin/compaction.ts +62 -18
- package/dist/template/.opencode/plugin/lib/notify.ts +2 -3
- package/dist/template/.opencode/plugin/sessions.ts +1 -1
- package/dist/template/.opencode/plugin/skill-mcp.ts +11 -12
- package/dist/template/.opencode/skill/beads/SKILL.md +44 -0
- package/dist/template/.opencode/skill/condition-based-waiting/example.ts +71 -65
- package/dist/template/.opencode/tool/ast-grep.ts +3 -3
- package/dist/template/.opencode/tool/bd-inbox.ts +7 -6
- package/dist/template/.opencode/tool/bd-msg.ts +3 -3
- package/dist/template/.opencode/tool/bd-release.ts +2 -2
- package/dist/template/.opencode/tool/bd-reserve.ts +5 -4
- package/dist/template/.opencode/tool/memory-read.ts +58 -58
- package/dist/template/.opencode/tool/memory-search.ts +2 -2
- package/dist/template/.opencode/tool/memory-update.ts +53 -54
- package/dist/template/.opencode/tool/observation.ts +6 -6
- package/dist/template/.opencode/tsconfig.json +19 -19
- package/package.json +8 -17
- package/dist/template/.opencode/command.backup/analyze-project.md +0 -465
- package/dist/template/.opencode/command.backup/finish.md +0 -167
- package/dist/template/.opencode/command.backup/implement.md +0 -143
- package/dist/template/.opencode/command.backup/pr.md +0 -252
- package/dist/template/.opencode/command.backup/status.md +0 -376
- package/dist/template/.opencode/lib/lsp/client.ts +0 -614
- package/dist/template/.opencode/lib/lsp/config.ts +0 -199
- package/dist/template/.opencode/lib/lsp/constants.ts +0 -339
- package/dist/template/.opencode/lib/lsp/types.ts +0 -138
- package/dist/template/.opencode/lib/lsp/utils.ts +0 -190
- package/dist/template/.opencode/memory/project/SHELL_OUTPUT_MIGRATION_PLAN.md +0 -551
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
purpose: Build, test, lint, deploy commands discovered for this project
|
|
3
|
-
updated: 2025-01-
|
|
3
|
+
updated: 2025-01-06
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Project Commands
|
|
@@ -8,190 +8,46 @@ updated: 2025-01-05
|
|
|
8
8
|
## Build
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
npm run
|
|
11
|
+
npm run build # Bundles src/index.ts + copies .opencode/ to dist/template/
|
|
12
|
+
npm run typecheck # TypeScript type checking only (no emit)
|
|
12
13
|
```
|
|
13
14
|
|
|
14
15
|
## Test
|
|
15
16
|
|
|
16
17
|
```bash
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
bun test # Run all tests
|
|
19
|
+
bun test src/commands/init.ts # Run single test file
|
|
20
|
+
bun test --watch # Watch mode
|
|
20
21
|
```
|
|
21
22
|
|
|
22
23
|
## Lint
|
|
23
24
|
|
|
24
|
-
<!-- npm run lint, ruff check, etc. -->
|
|
25
|
-
|
|
26
|
-
## Deploy
|
|
27
|
-
|
|
28
|
-
<!-- Deployment commands if applicable -->
|
|
29
|
-
|
|
30
|
-
## OpenCode Configuration
|
|
31
|
-
|
|
32
|
-
### Environment Variables
|
|
33
|
-
|
|
34
25
|
```bash
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
OPENCODE_DISABLE_LSP_DOWNLOAD=true # Skip auto-downloading LSP servers
|
|
38
|
-
OPENCODE_DISABLE_AUTOCOMPACT=true # Disable automatic session compaction
|
|
39
|
-
OPENCODE_DISABLE_PRUNE=true # Disable DCP pruning
|
|
26
|
+
npm run lint # Check with Biome
|
|
27
|
+
npm run lint:fix # Auto-fix issues
|
|
40
28
|
```
|
|
41
29
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
1. Global: `~/.config/opencode/opencode.json` or `dcp.jsonc`
|
|
45
|
-
2. Config Dir: `$OPENCODE_CONFIG_DIR/opencode.json`
|
|
46
|
-
3. Project: `.opencode/opencode.json` (highest priority)
|
|
30
|
+
## Development
|
|
47
31
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"nudgeFrequency": 8 // LLM nudged every 8 tool calls (default: 10)
|
|
32
|
+
```bash
|
|
33
|
+
bun run src/index.ts # Run CLI directly
|
|
34
|
+
npm run dev # Same as above
|
|
35
|
+
bun build src/index.ts --compile --outfile ock # Compile to binary
|
|
53
36
|
```
|
|
54
37
|
|
|
55
|
-
## Beads
|
|
56
|
-
|
|
57
|
-
The `bd` command is your issue tracker. JSONL is source of truth, SQLite is cache.
|
|
58
|
-
|
|
59
|
-
### Essential Commands
|
|
38
|
+
## Beads (Task Tracking)
|
|
60
39
|
|
|
61
40
|
```bash
|
|
62
|
-
bd ready #
|
|
41
|
+
bd ready # Find unblocked tasks
|
|
63
42
|
bd list --status=open # All open issues
|
|
64
43
|
bd show <id> # Full details
|
|
65
|
-
bd create "Title" -t task -p 2 # Create
|
|
44
|
+
bd create "Title" -t task -p 2 # Create task
|
|
66
45
|
bd update <id> --status in_progress # Claim work
|
|
67
46
|
bd close <id> --reason "Done" # Complete
|
|
68
|
-
bd sync #
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### Dependencies
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
bd dep add <child> <parent> --type blocks # Child blocked until parent closes
|
|
75
|
-
bd dep tree <id> # Visualize dependency chain
|
|
76
|
-
bd blocked # Show all blocked issues
|
|
47
|
+
bd sync # Sync with git (always run at session end)
|
|
77
48
|
```
|
|
78
49
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
bd list --status in_progress # See what's claimed by others
|
|
83
|
-
git pull && bd import # Get latest from team
|
|
84
|
-
bd sync # Push your changes
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### Priority Levels
|
|
88
|
-
|
|
89
|
-
- **P0** - Critical (security, data loss)
|
|
90
|
-
- **P1** - High (major features, important bugs)
|
|
91
|
-
- **P2** - Medium (default)
|
|
92
|
-
- **P3** - Low
|
|
93
|
-
- **P4** - Backlog
|
|
94
|
-
|
|
95
|
-
### Sandbox Mode
|
|
96
|
-
|
|
97
|
-
If running in restricted environment (Claude Code, etc.):
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
bd --sandbox ready
|
|
101
|
-
# Or: bd --no-daemon --no-auto-flush --no-auto-import list
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
## Beads Plugin Tools (For OpenCode Agents)
|
|
105
|
-
|
|
106
|
-
This project's plugin (`.opencode/plugin/beads.ts`) provides typed tools that wrap the CLI.
|
|
107
|
-
|
|
108
|
-
### Session Lifecycle
|
|
109
|
-
|
|
110
|
-
```typescript
|
|
111
|
-
bd_init({ role: "build" }); // Join workspace - MUST call first
|
|
112
|
-
bd_claim(); // Get next ready task, mark in_progress
|
|
113
|
-
bd_reserve({ paths: ["src/foo.ts"] }); // Lock files before editing
|
|
114
|
-
// ... do work ...
|
|
115
|
-
bd_done({ id: "bd-xxx", msg: "Done" }); // Close + release locks + sync
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### Task Management
|
|
119
|
-
|
|
120
|
-
```typescript
|
|
121
|
-
bd_add({ title: "Task", pri: 2, type: "task" }); // Create issue
|
|
122
|
-
bd_show({ id: "bd-xxx" }); // Get full details
|
|
123
|
-
bd_ls({ status: "open", limit: 10 }); // List issues
|
|
124
|
-
bd_ready(); // Ready-to-work tasks
|
|
125
|
-
bd_update({ id: "bd-xxx", status: "in_progress" }); // Update issue
|
|
126
|
-
bd_search({ query: "auth" }); // Search issues
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
### File Locking (Plugin-Only)
|
|
130
|
-
|
|
131
|
-
```typescript
|
|
132
|
-
bd_reserve({ paths: ["src/a.ts", "src/b.ts"], ttl: 600 }); // Lock files
|
|
133
|
-
bd_reservations(); // List active locks
|
|
134
|
-
bd_release({ paths: ["src/a.ts"] }); // Release specific
|
|
135
|
-
bd_release(); // Release all
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### Messaging (Plugin-Only)
|
|
139
|
-
|
|
140
|
-
```typescript
|
|
141
|
-
bd_msg({ subj: "Done", to: "all", global: true }); // Broadcast
|
|
142
|
-
bd_inbox({ n: 5, unread: true }); // Check messages
|
|
143
|
-
bd_ack({ ids: ["msg-abc", "msg-def"] }); // Mark messages as read
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
### Agent Coordination (Plugin-Only)
|
|
147
|
-
|
|
148
|
-
```typescript
|
|
149
|
-
bd_whois(); // See all agents and their current work
|
|
150
|
-
bd_whois({ agent: "build-abc" }); // Lookup specific agent
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
### Maintenance
|
|
154
|
-
|
|
155
|
-
```typescript
|
|
156
|
-
bd_sync(); // Sync with git
|
|
157
|
-
bd_status({ include_agents: true }); // Workspace overview
|
|
158
|
-
bd_doctor(); // Check database health
|
|
159
|
-
bd_cleanup({ days: 7 }); // Remove old closed issues
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
## Beads Workflow
|
|
163
|
-
|
|
164
|
-
### Start Work
|
|
165
|
-
|
|
166
|
-
```bash
|
|
167
|
-
bd ready # Find unblocked task
|
|
168
|
-
bd update bd-xxx --status in_progress # Claim it
|
|
169
|
-
git checkout -b bd-xxx # Create branch
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### During Work
|
|
173
|
-
|
|
174
|
-
```bash
|
|
175
|
-
git commit -m "WIP: bd-xxx - [progress]" # Checkpoint commits
|
|
176
|
-
bd sync # Sync beads state
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
### End Session
|
|
180
|
-
|
|
181
|
-
```bash
|
|
182
|
-
git add -A && git commit -m "bd-xxx: [summary]"
|
|
183
|
-
bd close bd-xxx --reason "Completed: [what]"
|
|
184
|
-
bd sync
|
|
185
|
-
git push
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
### Handoff (If Not Finishing)
|
|
189
|
-
|
|
190
|
-
```bash
|
|
191
|
-
git commit -m "WIP: bd-xxx - [where stopped]"
|
|
192
|
-
# Create handoff in .beads/artifacts/bd-xxx/handoffs/
|
|
193
|
-
bd sync
|
|
194
|
-
git push
|
|
195
|
-
```
|
|
50
|
+
## CI/CD
|
|
196
51
|
|
|
197
|
-
|
|
52
|
+
- GitHub Actions workflow at `.github/workflows/opencode.yml`
|
|
53
|
+
- Triggered by `/oc` or `/opencode` comments on issues/PRs
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
purpose: Session continuity state that survives compaction
|
|
3
|
+
updated: 2025-01-08
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Session Context
|
|
7
|
+
|
|
8
|
+
<!--
|
|
9
|
+
Agent-maintained via memory-update tool.
|
|
10
|
+
Update when: goal changes, key decision made, state shifts, uncertainty discovered.
|
|
11
|
+
After compaction: read this file, ask 1-3 targeted questions if gaps exist.
|
|
12
|
+
-->
|
|
13
|
+
|
|
14
|
+
## Goal
|
|
15
|
+
|
|
16
|
+
<!-- What we're trying to achieve + success criteria -->
|
|
17
|
+
|
|
18
|
+
## Constraints
|
|
19
|
+
|
|
20
|
+
<!-- User-specified limits, discovered guardrails. Mark UNCONFIRMED if inferred -->
|
|
21
|
+
|
|
22
|
+
## Decisions
|
|
23
|
+
|
|
24
|
+
<!-- Key choices made this session with brief rationale -->
|
|
25
|
+
|
|
26
|
+
## State
|
|
27
|
+
|
|
28
|
+
- **Done**:
|
|
29
|
+
- **Now**:
|
|
30
|
+
- **Next**:
|
|
31
|
+
|
|
32
|
+
## Open Questions
|
|
33
|
+
|
|
34
|
+
<!-- Uncertainties - mark UNCONFIRMED if not verified -->
|
|
35
|
+
|
|
36
|
+
## Working Set
|
|
37
|
+
|
|
38
|
+
- **Files**:
|
|
39
|
+
- **Bead**:
|
|
40
|
+
- **Branch**:
|
|
@@ -1,21 +1,38 @@
|
|
|
1
1
|
---
|
|
2
2
|
purpose: User identity, preferences, communication style
|
|
3
|
-
updated:
|
|
3
|
+
updated: 2025-01-06
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# User Profile
|
|
7
7
|
|
|
8
8
|
## Identity
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
- Name: huynhgiabuu
|
|
11
|
+
- Git email: buub1309120@gmail.com
|
|
10
12
|
|
|
11
13
|
## Communication Preferences
|
|
12
|
-
|
|
14
|
+
|
|
15
|
+
- Style: Detailed responses preferred
|
|
16
|
+
- Explanations welcome when helpful
|
|
13
17
|
|
|
14
18
|
## Workflow Preferences
|
|
15
|
-
|
|
19
|
+
|
|
20
|
+
- Git commits: Ask first before committing
|
|
21
|
+
- Beads updates: Ask first before modifying task state
|
|
22
|
+
- Auto-actions: Disabled - always confirm before state changes
|
|
16
23
|
|
|
17
24
|
## Technical Preferences
|
|
18
|
-
<!-- Languages, frameworks, patterns they favor -->
|
|
19
25
|
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
- Runtime: Bun
|
|
27
|
+
- Language: TypeScript
|
|
28
|
+
- Linter: Biome
|
|
29
|
+
|
|
30
|
+
## Rules to Always Follow
|
|
31
|
+
|
|
32
|
+
- Run `npm run lint:fix` before any commit
|
|
33
|
+
- Validate changes with `npm run typecheck`
|
|
34
|
+
- Don't modify dist/ directly (it's built output)
|
|
35
|
+
- Ask before adding new dependencies
|
|
36
|
+
- Ask before changing .opencode/ structure
|
|
37
|
+
- Never commit secrets or .env files
|
|
38
|
+
- Never force push to main
|
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
"agent": {
|
|
4
4
|
"build": {
|
|
5
5
|
"description": "Primary development agent with full codebase access",
|
|
6
|
-
"model": "
|
|
6
|
+
"model": "proxypal/gemini-claude-opus-4-5-thinking"
|
|
7
7
|
},
|
|
8
8
|
"compaction": {
|
|
9
|
-
"description": "Session summarizer for context continuity across compactions"
|
|
10
|
-
"model": "opencode/minimax-m2.1-free"
|
|
9
|
+
"description": "Session summarizer for context continuity across compactions"
|
|
11
10
|
},
|
|
12
11
|
"explore": {
|
|
13
12
|
"description": "Fast codebase search specialist",
|
|
@@ -29,7 +28,7 @@
|
|
|
29
28
|
},
|
|
30
29
|
"rush": {
|
|
31
30
|
"description": "Fast primary agent for small, well-defined tasks",
|
|
32
|
-
"model": "
|
|
31
|
+
"model": "zai-coding-plan/glm-4.7"
|
|
33
32
|
},
|
|
34
33
|
"scout": {
|
|
35
34
|
"description": "External research specialist for library docs and patterns",
|
|
@@ -50,30 +49,76 @@
|
|
|
50
49
|
"chatMaxRetries": 2,
|
|
51
50
|
"continue_loop_on_deny": false,
|
|
52
51
|
"lsp": true,
|
|
53
|
-
"primary_tools": [
|
|
52
|
+
"primary_tools": [
|
|
53
|
+
"edit",
|
|
54
|
+
"write",
|
|
55
|
+
"bash"
|
|
56
|
+
]
|
|
54
57
|
},
|
|
55
58
|
"formatter": {
|
|
56
59
|
"biome": {
|
|
57
|
-
"command": [
|
|
58
|
-
|
|
60
|
+
"command": [
|
|
61
|
+
"npx",
|
|
62
|
+
"@biomejs/biome",
|
|
63
|
+
"check",
|
|
64
|
+
"--write",
|
|
65
|
+
"$FILE"
|
|
66
|
+
],
|
|
67
|
+
"extensions": [
|
|
68
|
+
".js",
|
|
69
|
+
".jsx",
|
|
70
|
+
".ts",
|
|
71
|
+
".tsx",
|
|
72
|
+
".json",
|
|
73
|
+
".jsonc"
|
|
74
|
+
]
|
|
59
75
|
},
|
|
60
76
|
"cargo-fmt": {
|
|
61
|
-
"command": [
|
|
62
|
-
|
|
77
|
+
"command": [
|
|
78
|
+
"cargo",
|
|
79
|
+
"fmt",
|
|
80
|
+
"--",
|
|
81
|
+
"$FILE"
|
|
82
|
+
],
|
|
83
|
+
"extensions": [
|
|
84
|
+
".rs"
|
|
85
|
+
]
|
|
63
86
|
},
|
|
64
87
|
"java-formatter": {
|
|
65
|
-
"command": [
|
|
88
|
+
"command": [
|
|
89
|
+
"google-java-format",
|
|
90
|
+
"--replace",
|
|
91
|
+
"$FILE"
|
|
92
|
+
],
|
|
66
93
|
"environment": {
|
|
67
94
|
"JAVA_HOME": "{env:JAVA_HOME}"
|
|
68
95
|
},
|
|
69
|
-
"extensions": [
|
|
96
|
+
"extensions": [
|
|
97
|
+
".java"
|
|
98
|
+
]
|
|
70
99
|
},
|
|
71
100
|
"prettier": {
|
|
72
|
-
"command": [
|
|
73
|
-
|
|
101
|
+
"command": [
|
|
102
|
+
"npx",
|
|
103
|
+
"prettier",
|
|
104
|
+
"--write",
|
|
105
|
+
"$FILE"
|
|
106
|
+
],
|
|
107
|
+
"extensions": [
|
|
108
|
+
".html",
|
|
109
|
+
".css",
|
|
110
|
+
".scss",
|
|
111
|
+
".sass",
|
|
112
|
+
".md",
|
|
113
|
+
".yaml",
|
|
114
|
+
".yml"
|
|
115
|
+
]
|
|
74
116
|
}
|
|
75
117
|
},
|
|
76
|
-
"instructions": [
|
|
118
|
+
"instructions": [
|
|
119
|
+
".opencode/memory/user.md",
|
|
120
|
+
".opencode/memory/project/*.md"
|
|
121
|
+
],
|
|
77
122
|
"keybinds": {
|
|
78
123
|
"command_list": ";",
|
|
79
124
|
"leader": "`",
|
|
@@ -245,7 +290,15 @@
|
|
|
245
290
|
"context": 880964,
|
|
246
291
|
"output": 65536
|
|
247
292
|
},
|
|
248
|
-
"name": "Gemini 3 Flash Preview"
|
|
293
|
+
"name": "Gemini 3 Flash Preview",
|
|
294
|
+
"options": {
|
|
295
|
+
"generationConfig": {
|
|
296
|
+
"thinkingConfig": {
|
|
297
|
+
"thinkingLevel": "HIGH",
|
|
298
|
+
"includeThoughts": true
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
249
302
|
},
|
|
250
303
|
"gemini-3-pro-image-preview": {
|
|
251
304
|
"limit": {
|
|
@@ -259,7 +312,15 @@
|
|
|
259
312
|
"context": 880964,
|
|
260
313
|
"output": 65536
|
|
261
314
|
},
|
|
262
|
-
"name": "Gemini 3 Pro Preview"
|
|
315
|
+
"name": "Gemini 3 Pro Preview",
|
|
316
|
+
"options": {
|
|
317
|
+
"generationConfig": {
|
|
318
|
+
"thinkingConfig": {
|
|
319
|
+
"thinkingLevel": "HIGH",
|
|
320
|
+
"includeThoughts": true
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
263
324
|
},
|
|
264
325
|
"gemini-claude-opus-4-5-thinking": {
|
|
265
326
|
"limit": {
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Memory & Compaction Plugin
|
|
2
|
+
* Memory & Compaction Plugin (Codex-Inspired Continuity)
|
|
3
3
|
*
|
|
4
|
-
* Injects
|
|
5
|
-
* 1. Load
|
|
6
|
-
* 2.
|
|
7
|
-
* 3.
|
|
4
|
+
* Injects continuity context into session compaction:
|
|
5
|
+
* 1. Load session-context.md (CONTINUITY.md pattern)
|
|
6
|
+
* 2. Load project memory files
|
|
7
|
+
* 3. Inject beads in-progress state
|
|
8
|
+
* 4. Append workflow-specific compaction rules
|
|
9
|
+
*
|
|
10
|
+
* Session context format (agent-maintained via memory-update):
|
|
11
|
+
* - Goal: What we're trying to achieve + success criteria
|
|
12
|
+
* - Constraints: User-specified limits, discovered guardrails
|
|
13
|
+
* - Decisions: Key choices made this session
|
|
14
|
+
* - State: Done/Now/Next
|
|
15
|
+
* - Open Questions: Uncertainties marked UNCONFIRMED
|
|
16
|
+
* - Working Set: Files, bead IDs, branch
|
|
8
17
|
*/
|
|
9
18
|
|
|
10
19
|
import type { Plugin } from "@opencode-ai/plugin";
|
|
@@ -14,7 +23,19 @@ export const CompactionPlugin: Plugin = async ({ $, directory }) => {
|
|
|
14
23
|
|
|
15
24
|
return {
|
|
16
25
|
"experimental.session.compacting": async (input, output) => {
|
|
17
|
-
// Load
|
|
26
|
+
// 1. Load session context (CONTINUITY.md pattern) - HIGHEST PRIORITY
|
|
27
|
+
let sessionContext = "";
|
|
28
|
+
try {
|
|
29
|
+
const sessionFile = `${MEMORY_DIR}/session-context.md`;
|
|
30
|
+
const content = await $`cat ${sessionFile} 2>/dev/null`.text();
|
|
31
|
+
if (content.trim()) {
|
|
32
|
+
sessionContext = `\n## Session Continuity (Compaction-Safe)\n${content}`;
|
|
33
|
+
}
|
|
34
|
+
} catch {
|
|
35
|
+
// No session context yet
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// 2. Load project memory files
|
|
18
39
|
let memoryContext = "";
|
|
19
40
|
try {
|
|
20
41
|
const memoryFiles =
|
|
@@ -33,7 +54,7 @@ export const CompactionPlugin: Plugin = async ({ $, directory }) => {
|
|
|
33
54
|
// Memory dir doesn't exist or other error
|
|
34
55
|
}
|
|
35
56
|
|
|
36
|
-
// Inject beads in-progress state
|
|
57
|
+
// 3. Inject beads in-progress state
|
|
37
58
|
let beadsContext = "";
|
|
38
59
|
try {
|
|
39
60
|
const result =
|
|
@@ -48,12 +69,13 @@ export const CompactionPlugin: Plugin = async ({ $, directory }) => {
|
|
|
48
69
|
// Beads not available, skip
|
|
49
70
|
}
|
|
50
71
|
|
|
51
|
-
// Inject
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
72
|
+
// Inject all context - session context FIRST (most important)
|
|
73
|
+
const allContext = [sessionContext, beadsContext, memoryContext]
|
|
74
|
+
.filter(Boolean)
|
|
75
|
+
.join("\n");
|
|
76
|
+
|
|
77
|
+
if (allContext) {
|
|
78
|
+
output.context.push(`## Session Context\n${allContext}\n`);
|
|
57
79
|
}
|
|
58
80
|
|
|
59
81
|
// Append workflow-specific rules to OpenCode's default prompt
|
|
@@ -61,6 +83,28 @@ ${memoryContext}
|
|
|
61
83
|
|
|
62
84
|
## Additional Rules for This Workflow
|
|
63
85
|
|
|
86
|
+
### Session Continuity
|
|
87
|
+
Maintain session-context.md via memory-update tool. Format:
|
|
88
|
+
\`\`\`
|
|
89
|
+
Goal: [What + success criteria]
|
|
90
|
+
Constraints: [Limits, mark UNCONFIRMED if inferred]
|
|
91
|
+
Decisions: [Key choices this session]
|
|
92
|
+
State:
|
|
93
|
+
Done: [Completed]
|
|
94
|
+
Now: [Current focus - ONE thing]
|
|
95
|
+
Next: [Queued]
|
|
96
|
+
Open Questions: [Uncertainties - mark UNCONFIRMED]
|
|
97
|
+
Working Set: [Files, bead ID, branch]
|
|
98
|
+
\`\`\`
|
|
99
|
+
|
|
100
|
+
Update session-context.md when:
|
|
101
|
+
- Goal changes or clarifies
|
|
102
|
+
- Key decision made
|
|
103
|
+
- State shifts (Done/Now/Next)
|
|
104
|
+
- Uncertainty discovered
|
|
105
|
+
|
|
106
|
+
After compaction: Check session-context.md, ask 1-3 targeted questions if gaps exist.
|
|
107
|
+
|
|
64
108
|
### Beads Workflow
|
|
65
109
|
- PRESERVE: Bead IDs (bd-xxx format), bead states, in-progress task IDs
|
|
66
110
|
- DROP: Closed/completed beads (already tracked in git)
|
|
@@ -71,13 +115,13 @@ ${memoryContext}
|
|
|
71
115
|
|
|
72
116
|
### Memory System
|
|
73
117
|
If you discover:
|
|
74
|
-
- Gotchas/edge cases →
|
|
75
|
-
- Build/test commands →
|
|
76
|
-
- Code patterns/conventions →
|
|
77
|
-
- Architecture insights →
|
|
118
|
+
- Gotchas/edge cases → Save to .opencode/memory/project/gotchas.md
|
|
119
|
+
- Build/test commands → Save to .opencode/memory/project/commands.md
|
|
120
|
+
- Code patterns/conventions → Save to .opencode/memory/project/conventions.md
|
|
121
|
+
- Architecture insights → Save to .opencode/memory/project/architecture.md
|
|
78
122
|
|
|
79
123
|
### Preservation Priorities
|
|
80
|
-
- PRESERVE: File paths
|
|
124
|
+
- PRESERVE: File paths (file:line_number), user constraints, decisions, UNCONFIRMED items
|
|
81
125
|
- DROP: Failed attempts, superseded info, verbose tool outputs, exploration dead-ends
|
|
82
126
|
`;
|
|
83
127
|
},
|
|
@@ -12,7 +12,7 @@ let _isWSL: boolean | null = null;
|
|
|
12
12
|
export function isWSL(): boolean {
|
|
13
13
|
if (_isWSL !== null) return _isWSL;
|
|
14
14
|
try {
|
|
15
|
-
const fs = require("fs");
|
|
15
|
+
const fs = require("node:fs");
|
|
16
16
|
const release = fs.readFileSync("/proc/version", "utf8").toLowerCase();
|
|
17
17
|
_isWSL = release.includes("microsoft") || release.includes("wsl");
|
|
18
18
|
} catch {
|
|
@@ -28,7 +28,6 @@ export function isWSL(): boolean {
|
|
|
28
28
|
* @param message - Notification body
|
|
29
29
|
*/
|
|
30
30
|
export async function notify(
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
31
|
$: any,
|
|
33
32
|
title: string,
|
|
34
33
|
message: string,
|
|
@@ -39,7 +38,7 @@ export async function notify(
|
|
|
39
38
|
|
|
40
39
|
try {
|
|
41
40
|
if (platform === "darwin") {
|
|
42
|
-
await $`osascript -e ${
|
|
41
|
+
await $`osascript -e ${`display notification "${safeMessage}" with title "${safeTitle}"`}`;
|
|
43
42
|
} else if (platform === "linux") {
|
|
44
43
|
if (isWSL()) {
|
|
45
44
|
// WSL: try notify-send, fail silently
|
|
@@ -116,7 +116,7 @@ export const SessionsPlugin: Plugin = async ({ client }) => {
|
|
|
116
116
|
const userMessages = messageData.filter(
|
|
117
117
|
(m) => m.info?.role === "user",
|
|
118
118
|
);
|
|
119
|
-
summary +=
|
|
119
|
+
summary += "## Recent User Messages\n\n";
|
|
120
120
|
for (let i = 0; i < Math.min(userMessages.length, 5); i++) {
|
|
121
121
|
const m = userMessages[i];
|
|
122
122
|
const content = extractContent(m.info);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type ChildProcess, spawn } from "child_process";
|
|
2
|
-
import { existsSync, readFileSync } from "fs";
|
|
3
|
-
import { homedir } from "os";
|
|
4
|
-
import { join } from "path";
|
|
1
|
+
import { type ChildProcess, spawn } from "node:child_process";
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
5
|
import type { Plugin } from "@opencode-ai/plugin";
|
|
6
6
|
import { tool } from "@opencode-ai/plugin/tool";
|
|
7
7
|
|
|
@@ -155,7 +155,7 @@ export const SkillMcpPlugin: Plugin = async ({ directory }) => {
|
|
|
155
155
|
},
|
|
156
156
|
});
|
|
157
157
|
|
|
158
|
-
client.process.stdin?.write(JSON.stringify(request)
|
|
158
|
+
client.process.stdin?.write(`${JSON.stringify(request)}\n`);
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
161
|
|
|
@@ -232,10 +232,10 @@ export const SkillMcpPlugin: Plugin = async ({ directory }) => {
|
|
|
232
232
|
|
|
233
233
|
// Send initialized notification
|
|
234
234
|
proc.stdin?.write(
|
|
235
|
-
JSON.stringify({
|
|
235
|
+
`${JSON.stringify({
|
|
236
236
|
jsonrpc: "2.0",
|
|
237
237
|
method: "notifications/initialized",
|
|
238
|
-
})
|
|
238
|
+
})}\n`,
|
|
239
239
|
);
|
|
240
240
|
|
|
241
241
|
// Discover capabilities
|
|
@@ -430,7 +430,7 @@ The skill must be loaded first via the skill() tool to register its MCP config.`
|
|
|
430
430
|
if (args.skill_name) {
|
|
431
431
|
const toDisconnect: string[] = [];
|
|
432
432
|
for (const key of state.clients.keys()) {
|
|
433
|
-
if (key.startsWith(args.skill_name
|
|
433
|
+
if (key.startsWith(`${args.skill_name}:`)) {
|
|
434
434
|
toDisconnect.push(key);
|
|
435
435
|
}
|
|
436
436
|
}
|
|
@@ -440,11 +440,10 @@ The skill must be loaded first via the skill() tool to register its MCP config.`
|
|
|
440
440
|
state.clients.delete(key);
|
|
441
441
|
}
|
|
442
442
|
return JSON.stringify({ disconnected: toDisconnect });
|
|
443
|
-
} else {
|
|
444
|
-
const count = state.clients.size;
|
|
445
|
-
disconnectAll();
|
|
446
|
-
return JSON.stringify({ disconnected: "all", count });
|
|
447
443
|
}
|
|
444
|
+
const count = state.clients.size;
|
|
445
|
+
disconnectAll();
|
|
446
|
+
return JSON.stringify({ disconnected: "all", count });
|
|
448
447
|
},
|
|
449
448
|
}),
|
|
450
449
|
},
|