opencodekit 0.17.4 → 0.17.5
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/dist/index.js +1 -1
- package/dist/template/.opencode/.version +1 -0
- package/dist/template/.opencode/memory.db-shm +0 -0
- package/dist/template/.opencode/memory.db-wal +0 -0
- package/dist/template/.opencode/package.json +1 -1
- package/dist/template/.opencode/plugin/sessions.ts +60 -0
- package/dist/template/.opencode/plugin/skill-mcp.ts +48 -0
- package/dist/template/.opencode/tool/action-queue.ts +9 -4
- package/dist/template/.opencode/tool/memory-search.ts +12 -7
- package/dist/template/.opencode/tool/observation.ts +65 -4
- package/dist/template/.opencode/tool/swarm.ts +14 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -759,7 +759,7 @@ var cac = (name = "") => new CAC(name);
|
|
|
759
759
|
// package.json
|
|
760
760
|
var package_default = {
|
|
761
761
|
name: "opencodekit",
|
|
762
|
-
version: "0.17.
|
|
762
|
+
version: "0.17.5",
|
|
763
763
|
description: "CLI tool for bootstrapping and managing OpenCodeKit projects",
|
|
764
764
|
keywords: ["agents", "cli", "mcp", "opencode", "opencodekit", "template"],
|
|
765
765
|
license: "MIT",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.17.5
|
|
Binary file
|
|
Binary file
|
|
@@ -7,7 +7,67 @@ import type { Plugin } from "@opencode-ai/plugin";
|
|
|
7
7
|
import { tool } from "@opencode-ai/plugin/tool";
|
|
8
8
|
|
|
9
9
|
export const SessionsPlugin: Plugin = async ({ client }) => {
|
|
10
|
+
const getProjectContext = () =>
|
|
11
|
+
"Project context: OpenCodeKit CLI repo; sessions often mention .opencode/ plugins, commands, memory rules, beads IDs, and Bun/TypeScript constraints.";
|
|
12
|
+
|
|
13
|
+
const getBestPractices = () =>
|
|
14
|
+
"Best practices: Prefer recent sessions, keep queries focused, and reference exact file paths or IDs found in the session.";
|
|
15
|
+
|
|
10
16
|
return {
|
|
17
|
+
"tool.definition": async (input, output) => {
|
|
18
|
+
const toolID = input.toolID;
|
|
19
|
+
const projectContext = getProjectContext();
|
|
20
|
+
const commonBestPractices = getBestPractices();
|
|
21
|
+
|
|
22
|
+
switch (toolID) {
|
|
23
|
+
case "list_sessions": {
|
|
24
|
+
output.description = `${output.description}
|
|
25
|
+
|
|
26
|
+
${projectContext}
|
|
27
|
+
${commonBestPractices}
|
|
28
|
+
|
|
29
|
+
Recent session examples:
|
|
30
|
+
list_sessions({ since: "this week", limit: 5 })
|
|
31
|
+
list_sessions({ since: "yesterday", limit: 3 })`;
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
case "read_session": {
|
|
35
|
+
output.description = `${output.description}
|
|
36
|
+
|
|
37
|
+
${projectContext}
|
|
38
|
+
Best practices: Use "last" for most recent context; add a short focus keyword (e.g., "sessions", "plugin", "beads") to reduce noise.
|
|
39
|
+
|
|
40
|
+
Recent session examples:
|
|
41
|
+
read_session({ session_reference: "last" })
|
|
42
|
+
read_session({ session_reference: "last", focus: "sessions plugin" })`;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
case "search_session": {
|
|
46
|
+
output.description = `${output.description}
|
|
47
|
+
|
|
48
|
+
${projectContext}
|
|
49
|
+
Best practices: Start with 1-2 specific keywords, then read the top match for full context.
|
|
50
|
+
|
|
51
|
+
Recent session examples:
|
|
52
|
+
search_session({ query: "sessions plugin", limit: 5 })
|
|
53
|
+
search_session({ query: ".opencode", limit: 5 })`;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
case "summarize_session": {
|
|
57
|
+
output.description = `${output.description}
|
|
58
|
+
|
|
59
|
+
${projectContext}
|
|
60
|
+
Best practices: Summarize long sessions only after confirming the ID from list_sessions; check back later for the generated summary.
|
|
61
|
+
|
|
62
|
+
Recent session examples:
|
|
63
|
+
summarize_session({ session_id: "abc123" }) // from list_sessions
|
|
64
|
+
summarize_session({ session_id: "def456" })`;
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
default:
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
},
|
|
11
71
|
tool: {
|
|
12
72
|
list_sessions: tool({
|
|
13
73
|
description: `List OpenCode sessions with metadata.
|
|
@@ -338,7 +338,53 @@ export const SkillMcpPlugin: Plugin = async ({ directory }) => {
|
|
|
338
338
|
state.clients.clear();
|
|
339
339
|
}
|
|
340
340
|
|
|
341
|
+
function buildLoadedMcpDetails(): {
|
|
342
|
+
summary: string;
|
|
343
|
+
examples: string;
|
|
344
|
+
} {
|
|
345
|
+
const loadedEntries = Array.from(state.loadedSkills.entries());
|
|
346
|
+
if (loadedEntries.length === 0) {
|
|
347
|
+
return {
|
|
348
|
+
summary:
|
|
349
|
+
"Loaded MCP skills: (none). Load a skill with MCP config via skill() before using this tool.",
|
|
350
|
+
examples:
|
|
351
|
+
'Examples:\n- skill("playwright")\n- skill_mcp(skill_name="playwright", list_tools=true)',
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
const summaryLines = ["Loaded MCP skills and servers:"];
|
|
356
|
+
const examples: string[] = [];
|
|
357
|
+
for (const [skillName, config] of loadedEntries) {
|
|
358
|
+
const serverNames = Object.keys(config);
|
|
359
|
+
summaryLines.push(`- ${skillName}: ${serverNames.join(", ")}`);
|
|
360
|
+
|
|
361
|
+
const serverHint =
|
|
362
|
+
serverNames.length > 1 ? `, mcp_name="${serverNames[0]}"` : "";
|
|
363
|
+
examples.push(
|
|
364
|
+
`- skill_mcp(skill_name="${skillName}", list_tools=true${serverHint})`,
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
return {
|
|
369
|
+
summary: summaryLines.join("\n"),
|
|
370
|
+
examples: `Examples:\n${examples.slice(0, 3).join("\n")}`,
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
|
|
341
374
|
return {
|
|
375
|
+
"tool.definition": async (input, output) => {
|
|
376
|
+
const toolID = input.toolID;
|
|
377
|
+
if (toolID === "skill_mcp") {
|
|
378
|
+
const details = buildLoadedMcpDetails();
|
|
379
|
+
output.description = `${output.description}\n\n${details.summary}\n\n${details.examples}`;
|
|
380
|
+
}
|
|
381
|
+
if (toolID === "skill_mcp_status") {
|
|
382
|
+
output.description = `${output.description}
|
|
383
|
+
|
|
384
|
+
Connection status: Shows currently active MCP server connections from skill-embedded MCP servers.
|
|
385
|
+
Example: skill_mcp_status({})`;
|
|
386
|
+
}
|
|
387
|
+
},
|
|
342
388
|
tool: {
|
|
343
389
|
skill_mcp: tool({
|
|
344
390
|
description: `Invoke MCP tools from skill-embedded MCP servers.
|
|
@@ -399,6 +445,8 @@ The skill must be loaded first via the skill() tool to register its MCP config.`
|
|
|
399
445
|
});
|
|
400
446
|
}
|
|
401
447
|
|
|
448
|
+
state.loadedSkills.set(skill_name, mcpConfig);
|
|
449
|
+
|
|
402
450
|
// Determine which MCP server to use
|
|
403
451
|
const serverNames = Object.keys(mcpConfig);
|
|
404
452
|
const targetServer = mcp_name || serverNames[0];
|
|
@@ -237,10 +237,15 @@ Returns a consumable queue with:
|
|
|
237
237
|
- ready tasks
|
|
238
238
|
- idle workers
|
|
239
239
|
|
|
240
|
-
Operations:
|
|
241
|
-
- status: Read last stored queue snapshot
|
|
242
|
-
- refresh: Recompute queue from Beads + swarm progress and store snapshot
|
|
243
|
-
- clear: Clear stored queue snapshot
|
|
240
|
+
Operations with context-aware hints:
|
|
241
|
+
- status: Read last stored queue snapshot. Use for quick checks or when you just refreshed and want a stable view without re-scanning.
|
|
242
|
+
- refresh: Recompute queue from Beads + swarm progress and store snapshot. Use when work has changed (new beads, workers progressed, approvals resolved) or when status shows stale counts.
|
|
243
|
+
- clear: Clear stored queue snapshot. Use when you want to force a clean slate before a fresh refresh or when stale data is confusing the queue view.
|
|
244
|
+
|
|
245
|
+
Examples:
|
|
246
|
+
- You see pending approvals but know they were resolved: run refresh to rebuild from live worker progress.
|
|
247
|
+
- You want a quick glance during a long session: run status to reuse the last snapshot.
|
|
248
|
+
- You suspect the snapshot is corrupted or out of date: run clear, then refresh to rebuild from scratch.`,
|
|
244
249
|
args: {
|
|
245
250
|
op: tool.schema
|
|
246
251
|
.enum(["status", "refresh", "clear"])
|
|
@@ -188,18 +188,23 @@ function formatFallbackResults(
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
export default tool({
|
|
191
|
-
description: `Search observations
|
|
191
|
+
description: `Search memory across observations and markdown archives.
|
|
192
192
|
|
|
193
193
|
Purpose:
|
|
194
|
-
- Fast, ranked search across all observations in SQLite
|
|
194
|
+
- Fast, ranked search across all observations in SQLite (when FTS5 is available)
|
|
195
195
|
- Returns compact index (~50-100 tokens per result) for progressive disclosure
|
|
196
196
|
- Use memory-get for full details after identifying relevant observations
|
|
197
197
|
|
|
198
|
-
|
|
199
|
-
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
- "
|
|
198
|
+
FTS5 availability:
|
|
199
|
+
- Auto-detected at runtime; if unavailable, observation searches fall back to file scan
|
|
200
|
+
|
|
201
|
+
Search modes and hints:
|
|
202
|
+
- "observations" (default): Best for decisions, bugs, learnings; uses FTS5 ranking when available
|
|
203
|
+
- "handoffs": Use for past session handoffs and summaries
|
|
204
|
+
- "research": Use for research notes and external findings
|
|
205
|
+
- "templates": Use for memory templates and boilerplate references
|
|
206
|
+
- "beads": Use for task artifacts in .beads/artifacts
|
|
207
|
+
- "all": Use when you are unsure where info lives; searches SQLite + markdown + beads
|
|
203
208
|
|
|
204
209
|
Example:
|
|
205
210
|
memory-search({ query: "authentication" })
|
|
@@ -73,13 +73,74 @@ export default tool({
|
|
|
73
73
|
- Stores in SQLite with FTS5 index for fast search
|
|
74
74
|
- Supports enhanced schema: facts, subtitle, files_read/files_modified
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
Confidence guidance:
|
|
77
|
+
- high: verified by tests, logs, or direct inspection (default)
|
|
78
|
+
- medium: likely, but not fully verified
|
|
79
|
+
- low: uncertain or speculative
|
|
80
|
+
|
|
81
|
+
Type-specific examples:
|
|
82
|
+
decision
|
|
77
83
|
observation({
|
|
78
84
|
type: "decision",
|
|
79
85
|
title: "Use JWT for auth",
|
|
80
|
-
narrative: "
|
|
81
|
-
facts: "stateless, scalable
|
|
82
|
-
concepts: "authentication, jwt
|
|
86
|
+
narrative: "Chose JWT for stateless auth across services.",
|
|
87
|
+
facts: "stateless, scalable",
|
|
88
|
+
concepts: "authentication, jwt",
|
|
89
|
+
confidence: "high"
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
bugfix
|
|
93
|
+
observation({
|
|
94
|
+
type: "bugfix",
|
|
95
|
+
title: "Fix null pointer on login",
|
|
96
|
+
narrative: "Guarded optional user in src/auth.ts:42 to prevent crash.",
|
|
97
|
+
files_modified: "src/auth.ts",
|
|
98
|
+
concepts: "auth, null-check",
|
|
99
|
+
confidence: "high"
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
feature
|
|
103
|
+
observation({
|
|
104
|
+
type: "feature",
|
|
105
|
+
title: "Add CLI --dry-run",
|
|
106
|
+
narrative: "Introduce dry-run mode to show planned changes without writing.",
|
|
107
|
+
files_modified: "src/commands/init.ts",
|
|
108
|
+
concepts: "cli, ux",
|
|
109
|
+
confidence: "medium"
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
pattern
|
|
113
|
+
observation({
|
|
114
|
+
type: "pattern",
|
|
115
|
+
title: "Use zod for input validation",
|
|
116
|
+
narrative: "All command inputs validated with zod schemas before execute.",
|
|
117
|
+
concepts: "validation, zod",
|
|
118
|
+
confidence: "high"
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
discovery
|
|
122
|
+
observation({
|
|
123
|
+
type: "discovery",
|
|
124
|
+
title: "Build copies .opencode/ to dist/template/",
|
|
125
|
+
narrative: "Found rsync step in build.ts that bundles .opencode/.",
|
|
126
|
+
files_read: "build.ts",
|
|
127
|
+
confidence: "high"
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
learning
|
|
131
|
+
observation({
|
|
132
|
+
type: "learning",
|
|
133
|
+
title: "Bun test respects --watch",
|
|
134
|
+
narrative: "Observed bun test --watch keeps runner active during edits.",
|
|
135
|
+
confidence: "medium"
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
warning
|
|
139
|
+
observation({
|
|
140
|
+
type: "warning",
|
|
141
|
+
title: "Do not edit dist/ directly",
|
|
142
|
+
narrative: "dist/ is built output and overwritten on build.",
|
|
143
|
+
concepts: "build, generated",
|
|
83
144
|
confidence: "high"
|
|
84
145
|
})`,
|
|
85
146
|
args: {
|
|
@@ -13,17 +13,25 @@ const execFileAsync = promisify(execFile);
|
|
|
13
13
|
export default tool({
|
|
14
14
|
description: `Swarm orchestration for parallel task execution.
|
|
15
15
|
|
|
16
|
-
Operations:
|
|
16
|
+
Operations (choose by op):
|
|
17
17
|
- plan: Analyze task for parallel execution
|
|
18
|
+
Examples:
|
|
19
|
+
swarm({ op: "plan", task: "Investigate auth failures", files: "src/auth.ts,src/api.ts" })
|
|
20
|
+
swarm({ op: "plan", task: "Refactor utils" })
|
|
18
21
|
- monitor: Track worker progress
|
|
22
|
+
Examples:
|
|
23
|
+
swarm({ op: "monitor", team: "frontend", action: "status" })
|
|
24
|
+
swarm({ op: "monitor", team: "frontend", action: "update", worker_id: "w1", phase: "build", progress: 60, status: "working" })
|
|
19
25
|
- delegate: Create delegation packet
|
|
26
|
+
Examples:
|
|
27
|
+
swarm({ op: "delegate", bead_id: "B-123", title: "Add caching", outcome: "Cache layer in place", checks: "lint,typecheck" })
|
|
28
|
+
swarm({ op: "delegate", bead_id: "B-123", outcome: "Bug fixed", must_do: "add test", must_not: "change API" })
|
|
20
29
|
- sync: Bridge Beads tasks to OpenCode todos
|
|
30
|
+
Examples:
|
|
31
|
+
swarm({ op: "sync", action: "push", filter: "open" })
|
|
32
|
+
swarm({ op: "sync", action: "pull" })
|
|
21
33
|
|
|
22
|
-
|
|
23
|
-
swarm({ op: "plan", task: "..." })
|
|
24
|
-
swarm({ op: "monitor", team: "...", action: "status" })
|
|
25
|
-
swarm({ op: "delegate", bead_id: "...", outcome: "..." })
|
|
26
|
-
swarm({ op: "sync", action: "push" })`,
|
|
34
|
+
Tip: Each example only applies when the matching op is used.`,
|
|
27
35
|
|
|
28
36
|
args: {
|
|
29
37
|
op: tool.schema
|
package/package.json
CHANGED