opencodekit 0.16.0 → 0.16.1
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/AGENTS.md +64 -3
- package/dist/template/.opencode/command/create.md +34 -0
- package/dist/template/.opencode/command/design.md +35 -0
- package/dist/template/.opencode/command/handoff.md +15 -0
- package/dist/template/.opencode/command/init.md +40 -47
- package/dist/template/.opencode/command/plan.md +1 -0
- package/dist/template/.opencode/command/pr.md +15 -0
- package/dist/template/.opencode/command/research.md +3 -0
- package/dist/template/.opencode/command/resume.md +1 -0
- package/dist/template/.opencode/command/review-codebase.md +30 -0
- package/dist/template/.opencode/command/ship.md +43 -0
- package/dist/template/.opencode/command/start.md +1 -0
- package/dist/template/.opencode/command/status.md +24 -1
- package/dist/template/.opencode/command/ui-review.md +31 -0
- package/dist/template/.opencode/command/verify.md +35 -7
- package/dist/template/.opencode/memory/project/tech-stack.md +25 -22
- package/dist/template/.opencode/memory.db +0 -0
- package/dist/template/.opencode/memory.db-shm +0 -0
- package/dist/template/.opencode/memory.db-wal +0 -0
- package/dist/template/.opencode/opencode.json +817 -916
- package/dist/template/.opencode/package.json +1 -0
- package/dist/template/.opencode/plans/1770006237537-mighty-otter.md +418 -0
- package/dist/template/.opencode/plans/1770006913647-glowing-forest.md +170 -0
- package/dist/template/.opencode/plans/1770013678126-witty-planet.md +278 -0
- package/dist/template/.opencode/plugin/lib/memory-db.ts +828 -0
- package/dist/template/.opencode/plugin/memory.ts +38 -1
- package/dist/template/.opencode/skill/index-knowledge/SKILL.md +76 -31
- package/dist/template/.opencode/skill/memory-system/SKILL.md +110 -55
- package/dist/template/.opencode/tool/memory-get.ts +143 -0
- package/dist/template/.opencode/tool/memory-maintain.ts +167 -0
- package/dist/template/.opencode/tool/memory-migrate.ts +319 -0
- package/dist/template/.opencode/tool/memory-read.ts +17 -46
- package/dist/template/.opencode/tool/memory-search.ts +131 -28
- package/dist/template/.opencode/tool/memory-timeline.ts +105 -0
- package/dist/template/.opencode/tool/memory-update.ts +21 -26
- package/dist/template/.opencode/tool/observation.ts +112 -100
- package/dist/template/.opencode/tsconfig.json +19 -19
- package/package.json +1 -1
- package/dist/template/.opencode/memory/_templates/README.md +0 -73
- package/dist/template/.opencode/memory/_templates/observation.md +0 -39
- package/dist/template/.opencode/memory/_templates/prompt-engineering.md +0 -333
- package/dist/template/.opencode/memory/observations/2026-01-22-decision-agents-md-prompt-engineering-improvement.md +0 -29
- package/dist/template/.opencode/memory/observations/2026-01-25-decision-agent-roles-build-orchestrates-general-e.md +0 -14
- package/dist/template/.opencode/memory/observations/2026-01-25-decision-simplified-swarm-helper-tool-to-fix-type.md +0 -20
- package/dist/template/.opencode/memory/observations/2026-01-25-decision-use-beads-as-swarm-board-source-of-truth.md +0 -14
- package/dist/template/.opencode/memory/observations/2026-01-25-learning-user-wants-real-swarm-coordination-guida.md +0 -15
- package/dist/template/.opencode/memory/observations/2026-01-28-decision-created-deep-research-skill-for-thorough.md +0 -29
- package/dist/template/.opencode/memory/observations/2026-01-28-decision-gh-grep-mcp-wrapper-vs-native-grep-searc.md +0 -21
- package/dist/template/.opencode/memory/observations/2026-01-28-decision-oracle-tool-optimal-usage-patterns.md +0 -32
- package/dist/template/.opencode/memory/observations/2026-01-28-learning-ampcode-deep-mode-research-integration-w.md +0 -42
- package/dist/template/.opencode/memory/observations/2026-01-28-pattern-research-delegation-pattern-explore-for-.md +0 -32
- package/dist/template/.opencode/memory/observations/2026-01-29-decision-copilot-auth-plugin-rate-limit-handling.md +0 -27
- package/dist/template/.opencode/memory/observations/2026-01-29-decision-spec-driven-approach-for-opencodekit.md +0 -21
- package/dist/template/.opencode/memory/observations/2026-01-29-learning-karpathy-llm-coding-insights-dec-2025.md +0 -44
- package/dist/template/.opencode/memory/observations/2026-01-30-decision-github-copilot-claude-routing-keep-disab.md +0 -32
- package/dist/template/.opencode/memory/observations/2026-01-30-discovery-context-management-research-critical-gap.md +0 -14
- package/dist/template/.opencode/memory/observations/2026-01-30-discovery-kimi-k2-5-agent-swarm-architecture-patte.md +0 -45
- package/dist/template/.opencode/memory/observations/2026-01-30-pattern-swarm-tools-architecture.md +0 -28
- package/dist/template/.opencode/memory/observations/2026-01-31-decision-copilot-auth-plugin-updated-with-baseurl.md +0 -63
- package/dist/template/.opencode/memory/observations/2026-01-31-decision-created-dedicated-worker-agent-for-swarm.md +0 -20
- package/dist/template/.opencode/memory/observations/2026-01-31-decision-rollback-to-v1-1-47-for-copilot-claude-r.md +0 -21
- package/dist/template/.opencode/memory/observations/2026-01-31-decision-simplified-swarm-to-task-tool-pattern.md +0 -44
- package/dist/template/.opencode/memory/observations/2026-01-31-decision-swarm-architecture-task-tool-over-tmux.md +0 -33
- package/dist/template/.opencode/memory/observations/2026-01-31-decision-worker-skills-defined-for-swarm-delegati.md +0 -30
- package/dist/template/.opencode/memory/observations/2026-01-31-learning-gpt-reasoning-config-for-github-copilot.md +0 -51
- package/dist/template/.opencode/memory/observations/2026-01-31-learning-opencode-copilot-auth-comparison-finding.md +0 -61
- package/dist/template/.opencode/memory/observations/2026-01-31-learning-opencode-copilot-reasoning-architecture-.md +0 -66
- package/dist/template/.opencode/memory/observations/2026-01-31-learning-opencode-custom-tools-api.md +0 -48
- package/dist/template/.opencode/memory/observations/2026-01-31-learning-opencode-v1-1-48-skills-as-slash-command.md +0 -21
- package/dist/template/.opencode/memory/observations/2026-01-31-learning-swarm-system-simplified-removed-mailbox-.md +0 -30
- package/dist/template/.opencode/memory/observations/2026-01-31-learning-v1-1-48-native-copilot-reasoning-via-pr-.md +0 -45
- package/dist/template/.opencode/memory/observations/2026-01-31-warning-cannot-add-custom-config-to-opencode-jso.md +0 -18
- package/dist/template/.opencode/memory/observations/2026-01-31-warning-copilot-claude-v1-endpoint-returns-404-c.md +0 -48
- package/dist/template/.opencode/memory/observations/2026-01-31-warning-opencode-v1-1-48-claude-thinking-block-s.md +0 -51
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-add-skills-vs-commands-to-global-agents-.md +0 -15
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-build-agent-auto-loads-skills-contextual.md +0 -31
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-fixed-agent-configuration-for-opencodeki.md +0 -25
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-focused-agents-md-upgrade-for-opencode-k.md +0 -14
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-implement-tier-1-permission-upgrades.md +0 -15
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-instructions-config-explicit-paths-not-w.md +0 -40
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-merged-context-into-memory-project-singl.md +0 -42
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-oracle-tool-should-use-review-agent-not-.md +0 -14
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-plan-agent-auto-loads-skills-contextuall.md +0 -31
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-plan-phased-oracle-command-merge-into-ne.md +0 -14
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-prd-workflow-uses-prd-and-prd-task-skill.md +0 -23
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-prefer-review-agent-via-opencode-cli-ove.md +0 -14
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-remove-oracle-tool-add-ship-command-with.md +0 -14
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-remove-oracle-tool-and-add-ship-command-.md +0 -14
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-remove-oracle-tool-and-add-ship-command.md +0 -14
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-remove-skills-vs-commands-section-from-a.md +0 -14
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-replace-oracle-tool-with-ship-command-fl.md +0 -14
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-replace-oracle-with-ship-command-workflo.md +0 -14
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-replace-proxypal-oracle-with-cli-review-.md +0 -14
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-simplified-dist-template-only-tech-stack.md +0 -50
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-simplified-templates-only-tech-stack-md.md +0 -26
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-subagents-load-minimal-skills-stay-lean.md +0 -29
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-user-approved-permission-upgrades-in-ope.md +0 -15
- package/dist/template/.opencode/memory/observations/2026-02-01-discovery-verify-command-already-implemented.md +0 -28
- package/dist/template/.opencode/memory/observations/2026-02-01-feature-openspec-phase-b-complete-template-upgra.md +0 -43
- package/dist/template/.opencode/memory/observations/2026-02-01-learning-build-agent-should-use-dynamic-lsp-not-f.md +0 -14
- package/dist/template/.opencode/memory/observations/2026-02-01-learning-kimi-k2-5-model-requires-temperature-1-0.md +0 -22
- package/dist/template/.opencode/memory/observations/2026-02-01-learning-opencode-context-injection-already-imple.md +0 -27
- package/dist/template/.opencode/memory/observations/2026-02-01-learning-opencode-context-injection-uses-instruct.md +0 -35
- package/dist/template/.opencode/memory/observations/2026-02-01-learning-update-build-agent-prompt-to-use-context.md +0 -14
- package/dist/template/.opencode/memory/observations/2026-02-01-learning-upgrade-agents-md-using-opencode-expert-.md +0 -14
- package/dist/template/.opencode/memory/observations/2026-02-01-learning-upgrade-agents-md-with-opencode-expert-g.md +0 -14
- package/dist/template/.opencode/memory/observations/2026-02-01-learning-upgrade-agents-md-with-opencode-expert-r.md +0 -14
- package/dist/template/.opencode/memory/observations/2026-02-01-learning-user-prefers-copilot-gpt-5-2-codex-mediu.md +0 -14
- package/dist/template/.opencode/memory/observations/2026-02-01-learning-user-wants-general-agent-prompt-contextu.md +0 -15
- package/dist/template/.opencode/memory/observations/2026-02-01-learning-user-wants-general-agent-prompt-reviewed.md +0 -15
- package/dist/template/.opencode/memory/project/architecture.md +0 -60
- package/dist/template/.opencode/memory/project/command-rules.md +0 -122
- package/dist/template/.opencode/memory/project/commands.md +0 -72
- package/dist/template/.opencode/memory/project/conventions.md +0 -68
- package/dist/template/.opencode/memory/project/gotchas.md +0 -41
- /package/dist/template/.opencode/memory/_templates/{project/tech-stack.md → tech-stack.md} +0 -0
- /package/dist/template/.opencode/memory/{user.example.md → _templates/user.md} +0 -0
- /package/dist/template/.opencode/memory/{user.md → project/user.md} +0 -0
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
import fs from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
1
|
import { tool } from "@opencode-ai/plugin";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
| "pattern"
|
|
11
|
-
| "discovery"
|
|
12
|
-
| "learning"
|
|
13
|
-
| "warning";
|
|
14
|
-
|
|
15
|
-
type ConfidenceLevel = "high" | "medium" | "low";
|
|
2
|
+
import {
|
|
3
|
+
type ConfidenceLevel,
|
|
4
|
+
type ObservationInput,
|
|
5
|
+
type ObservationType,
|
|
6
|
+
storeObservation,
|
|
7
|
+
} from "../plugin/lib/memory-db.js";
|
|
16
8
|
|
|
17
9
|
const TYPE_ICONS: Record<ObservationType, string> = {
|
|
18
10
|
decision: "🎯",
|
|
@@ -78,14 +70,15 @@ export default tool({
|
|
|
78
70
|
Purpose:
|
|
79
71
|
- Capture decisions, bugs, features, patterns, discoveries, learnings, or warnings
|
|
80
72
|
- Auto-detects file references from content (file:line, \`path\`, src/, .opencode/)
|
|
81
|
-
- Stores in
|
|
82
|
-
-
|
|
73
|
+
- Stores in SQLite with FTS5 index for fast search
|
|
74
|
+
- Supports enhanced schema: facts, subtitle, files_read/files_modified
|
|
83
75
|
|
|
84
76
|
Example:
|
|
85
77
|
observation({
|
|
86
78
|
type: "decision",
|
|
87
79
|
title: "Use JWT for auth",
|
|
88
|
-
|
|
80
|
+
narrative: "Decided to use JWT tokens because...",
|
|
81
|
+
facts: "stateless, scalable, industry standard",
|
|
89
82
|
concepts: "authentication, jwt, security",
|
|
90
83
|
confidence: "high"
|
|
91
84
|
})`,
|
|
@@ -96,20 +89,43 @@ export default tool({
|
|
|
96
89
|
"Observation type: decision, bugfix, feature, pattern, discovery, learning, warning",
|
|
97
90
|
),
|
|
98
91
|
title: tool.schema.string().describe("Brief title for the observation"),
|
|
99
|
-
|
|
92
|
+
subtitle: tool.schema
|
|
93
|
+
.string()
|
|
94
|
+
.optional()
|
|
95
|
+
.describe("Optional subtitle or tagline"),
|
|
96
|
+
facts: tool.schema
|
|
100
97
|
.string()
|
|
98
|
+
.optional()
|
|
99
|
+
.describe("Comma-separated key facts (e.g., 'stateless, scalable')"),
|
|
100
|
+
narrative: tool.schema
|
|
101
|
+
.string()
|
|
102
|
+
.optional()
|
|
101
103
|
.describe("Detailed observation content with context"),
|
|
104
|
+
content: tool.schema
|
|
105
|
+
.string()
|
|
106
|
+
.optional()
|
|
107
|
+
.describe(
|
|
108
|
+
"DEPRECATED: Use 'narrative' instead. Alias for backward compat.",
|
|
109
|
+
),
|
|
102
110
|
concepts: tool.schema
|
|
103
111
|
.string()
|
|
104
112
|
.optional()
|
|
105
113
|
.describe(
|
|
106
114
|
"Comma-separated concept tags (e.g., 'authentication, oauth, security')",
|
|
107
115
|
),
|
|
116
|
+
files_read: tool.schema
|
|
117
|
+
.string()
|
|
118
|
+
.optional()
|
|
119
|
+
.describe("Comma-separated files that were read (e.g., 'src/auth.ts')"),
|
|
120
|
+
files_modified: tool.schema
|
|
121
|
+
.string()
|
|
122
|
+
.optional()
|
|
123
|
+
.describe("Comma-separated files that were modified"),
|
|
108
124
|
files: tool.schema
|
|
109
125
|
.string()
|
|
110
126
|
.optional()
|
|
111
127
|
.describe(
|
|
112
|
-
"
|
|
128
|
+
"DEPRECATED: Use 'files_modified' instead. Alias for backward compat.",
|
|
113
129
|
),
|
|
114
130
|
bead_id: tool.schema
|
|
115
131
|
.string()
|
|
@@ -125,21 +141,24 @@ export default tool({
|
|
|
125
141
|
.string()
|
|
126
142
|
.optional()
|
|
127
143
|
.describe(
|
|
128
|
-
"
|
|
144
|
+
"ID or filename of observation this supersedes (for contradiction handling)",
|
|
129
145
|
),
|
|
130
146
|
},
|
|
131
147
|
execute: async (args: {
|
|
132
148
|
type: string;
|
|
133
149
|
title: string;
|
|
134
|
-
|
|
150
|
+
subtitle?: string;
|
|
151
|
+
facts?: string;
|
|
152
|
+
narrative?: string;
|
|
153
|
+
content?: string;
|
|
135
154
|
concepts?: string;
|
|
155
|
+
files_read?: string;
|
|
156
|
+
files_modified?: string;
|
|
136
157
|
files?: string;
|
|
137
158
|
bead_id?: string;
|
|
138
159
|
confidence?: string;
|
|
139
160
|
supersedes?: string;
|
|
140
161
|
}) => {
|
|
141
|
-
const obsDir = path.join(process.cwd(), ".opencode/memory/observations");
|
|
142
|
-
|
|
143
162
|
// Validate type
|
|
144
163
|
const validTypes: ObservationType[] = [
|
|
145
164
|
"decision",
|
|
@@ -163,96 +182,77 @@ export default tool({
|
|
|
163
182
|
return `Error: Invalid confidence level '${args.confidence}'.\nValid levels: ${validConfidence.join(", ")}`;
|
|
164
183
|
}
|
|
165
184
|
|
|
166
|
-
//
|
|
167
|
-
const
|
|
168
|
-
const
|
|
169
|
-
const slug = args.title
|
|
170
|
-
.toLowerCase()
|
|
171
|
-
.replace(/[^a-z0-9]+/g, "-")
|
|
172
|
-
.replace(/^-|-$/g, "")
|
|
173
|
-
.substring(0, 40);
|
|
174
|
-
const filename = `${dateStr}-${obsType}-${slug}.md`;
|
|
175
|
-
const filePath = path.join(obsDir, filename);
|
|
185
|
+
// Handle deprecated fields (backward compat)
|
|
186
|
+
const narrative = args.narrative || args.content || "";
|
|
187
|
+
const filesModifiedRaw = args.files_modified || args.files || "";
|
|
176
188
|
|
|
177
|
-
// Parse
|
|
189
|
+
// Parse arrays from comma-separated strings
|
|
190
|
+
const facts = args.facts
|
|
191
|
+
? args.facts
|
|
192
|
+
.split(",")
|
|
193
|
+
.map((f) => f.trim())
|
|
194
|
+
.filter(Boolean)
|
|
195
|
+
: [];
|
|
178
196
|
const concepts = args.concepts
|
|
179
|
-
? args.concepts
|
|
197
|
+
? args.concepts
|
|
198
|
+
.split(",")
|
|
199
|
+
.map((c) => c.trim())
|
|
200
|
+
.filter(Boolean)
|
|
201
|
+
: [];
|
|
202
|
+
let filesRead = args.files_read
|
|
203
|
+
? args.files_read
|
|
204
|
+
.split(",")
|
|
205
|
+
.map((f) => f.trim())
|
|
206
|
+
.filter(Boolean)
|
|
207
|
+
: [];
|
|
208
|
+
const filesModified = filesModifiedRaw
|
|
209
|
+
? filesModifiedRaw
|
|
210
|
+
.split(",")
|
|
211
|
+
.map((f) => f.trim())
|
|
212
|
+
.filter(Boolean)
|
|
180
213
|
: [];
|
|
181
|
-
let files = args.files ? args.files.split(",").map((f) => f.trim()) : [];
|
|
182
214
|
|
|
183
|
-
// Auto-detect file references from
|
|
184
|
-
const detectedRefs = extractFileReferences(
|
|
215
|
+
// Auto-detect file references from narrative
|
|
216
|
+
const detectedRefs = extractFileReferences(narrative);
|
|
185
217
|
const detectedFiles = detectedRefs.map((r) => r.file);
|
|
186
218
|
|
|
187
219
|
// Merge detected files with explicitly provided files
|
|
188
|
-
|
|
189
|
-
files = allFiles;
|
|
190
|
-
|
|
191
|
-
// Build observation content with YAML frontmatter
|
|
192
|
-
const icon = TYPE_ICONS[obsType];
|
|
193
|
-
const confidenceIcon = CONFIDENCE_ICONS[confidence];
|
|
220
|
+
filesRead = [...new Set([...filesRead, ...detectedFiles])];
|
|
194
221
|
|
|
195
|
-
//
|
|
196
|
-
let
|
|
197
|
-
observation += `type: ${obsType}\n`;
|
|
198
|
-
observation += `created: ${now.toISOString()}\n`;
|
|
199
|
-
observation += `confidence: ${confidence}\n`;
|
|
200
|
-
observation += "valid_until: null\n";
|
|
201
|
-
observation += "superseded_by: null\n";
|
|
222
|
+
// Parse supersedes (could be numeric ID or filename)
|
|
223
|
+
let supersedesId: number | undefined;
|
|
202
224
|
if (args.supersedes) {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
208
|
-
if (concepts.length > 0) {
|
|
209
|
-
observation += `concepts: [${concepts.map((c) => `"${c}"`).join(", ")}]\n`;
|
|
210
|
-
}
|
|
211
|
-
if (files.length > 0) {
|
|
212
|
-
observation += `files: [${files.map((f) => `"${f}"`).join(", ")}]\n`;
|
|
225
|
+
const parsed = Number.parseInt(args.supersedes, 10);
|
|
226
|
+
if (!Number.isNaN(parsed)) {
|
|
227
|
+
supersedesId = parsed;
|
|
228
|
+
}
|
|
213
229
|
}
|
|
214
|
-
observation += "---\n\n";
|
|
215
230
|
|
|
216
|
-
//
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
231
|
+
// Prepare observation input
|
|
232
|
+
const input: ObservationInput = {
|
|
233
|
+
type: obsType,
|
|
234
|
+
title: args.title,
|
|
235
|
+
subtitle: args.subtitle,
|
|
236
|
+
facts: facts.length > 0 ? facts : undefined,
|
|
237
|
+
narrative: narrative || undefined,
|
|
238
|
+
concepts: concepts.length > 0 ? concepts : undefined,
|
|
239
|
+
files_read: filesRead.length > 0 ? filesRead : undefined,
|
|
240
|
+
files_modified: filesModified.length > 0 ? filesModified : undefined,
|
|
241
|
+
confidence,
|
|
242
|
+
bead_id: args.bead_id,
|
|
243
|
+
supersedes: supersedesId,
|
|
244
|
+
};
|
|
221
245
|
|
|
222
246
|
try {
|
|
223
|
-
//
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
// Write observation
|
|
227
|
-
await fs.writeFile(filePath, observation, "utf-8");
|
|
228
|
-
|
|
229
|
-
// Handle supersedes - update old observation's superseded_by field
|
|
230
|
-
let supersedesStatus = "";
|
|
231
|
-
if (args.supersedes) {
|
|
232
|
-
try {
|
|
233
|
-
const oldPath = path.join(obsDir, args.supersedes);
|
|
234
|
-
const oldContent = await fs.readFile(oldPath, "utf-8");
|
|
235
|
-
// Update superseded_by in frontmatter
|
|
236
|
-
const updatedContent = oldContent.replace(
|
|
237
|
-
/superseded_by: null/,
|
|
238
|
-
`superseded_by: "${filename}"`,
|
|
239
|
-
);
|
|
240
|
-
if (updatedContent !== oldContent) {
|
|
241
|
-
await fs.writeFile(oldPath, updatedContent, "utf-8");
|
|
242
|
-
supersedesStatus = `\nSupersedes: ✓ Marked ${args.supersedes} as superseded`;
|
|
243
|
-
}
|
|
244
|
-
} catch {
|
|
245
|
-
supersedesStatus = `\nSupersedes: ⚠ Could not update ${args.supersedes}`;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
let beadUpdate = "";
|
|
247
|
+
// Store in SQLite (single source of truth)
|
|
248
|
+
const sqliteId = storeObservation(input);
|
|
250
249
|
|
|
251
250
|
// Update bead notes if bead_id provided
|
|
251
|
+
let beadUpdate = "";
|
|
252
252
|
if (args.bead_id) {
|
|
253
253
|
try {
|
|
254
254
|
const { execSync } = await import("node:child_process");
|
|
255
|
-
const noteContent = `${
|
|
255
|
+
const noteContent = `${TYPE_ICONS[obsType]} ${obsType}: ${args.title}`;
|
|
256
256
|
execSync(
|
|
257
257
|
`bd edit ${args.bead_id} --note "${noteContent.replace(/"/g, '\\"')}"`,
|
|
258
258
|
{
|
|
@@ -267,13 +267,25 @@ export default tool({
|
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
-
// Build
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
270
|
+
// Build output
|
|
271
|
+
const icon = TYPE_ICONS[obsType];
|
|
272
|
+
const confIcon = CONFIDENCE_ICONS[confidence];
|
|
273
|
+
|
|
274
|
+
let output = `✓ Observation #${sqliteId} saved\n\n`;
|
|
275
|
+
output += `**Type**: ${icon} ${obsType}\n`;
|
|
276
|
+
output += `**Title**: ${args.title}\n`;
|
|
277
|
+
output += `**Confidence**: ${confIcon} ${confidence}\n`;
|
|
278
|
+
|
|
279
|
+
if (concepts.length > 0) {
|
|
280
|
+
output += `**Concepts**: ${concepts.join(", ")}\n`;
|
|
274
281
|
}
|
|
282
|
+
if (facts.length > 0) {
|
|
283
|
+
output += `**Facts**: ${facts.length} extracted\n`;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
output += beadUpdate;
|
|
275
287
|
|
|
276
|
-
return
|
|
288
|
+
return output;
|
|
277
289
|
} catch (error) {
|
|
278
290
|
if (error instanceof Error) {
|
|
279
291
|
return `Error saving observation: ${error.message}`;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"allowSyntheticDefaultImports": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"allowJs": true,
|
|
9
|
+
"strict": false,
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"declaration": true,
|
|
12
|
+
"outDir": "./dist",
|
|
13
|
+
"rootDir": "./",
|
|
14
|
+
"skipLibCheck": true,
|
|
15
|
+
"forceConsistentCasingInFileNames": true,
|
|
16
|
+
"resolveJsonModule": true,
|
|
17
|
+
"types": ["node", "bun-types"]
|
|
18
|
+
},
|
|
19
|
+
"include": ["plugin/**/*.ts", "tool/**/*.ts", "agent/**/*.ts", "*.ts"],
|
|
20
|
+
"exclude": ["node_modules", "dist", "**/*.js", "**/*.test.ts"]
|
|
21
21
|
}
|
package/package.json
CHANGED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
purpose: Index of available memory templates
|
|
3
|
-
updated: 2026-02-01
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Memory Templates
|
|
7
|
-
|
|
8
|
-
Templates for structured artifacts. Copy to `.beads/artifacts/<bead-id>/` when working on a bead.
|
|
9
|
-
|
|
10
|
-
## Artifact Templates (OpenSpec-aligned)
|
|
11
|
-
|
|
12
|
-
These follow the OpenSpec artifact flow: proposal → spec → design → tasks.
|
|
13
|
-
|
|
14
|
-
| Template | Purpose | When to Use |
|
|
15
|
-
| ------------- | ---------------------------------- | --------------------------------------------- |
|
|
16
|
-
| `proposal.md` | Capture WHY a change is needed | Starting a new feature or significant change |
|
|
17
|
-
| `spec.md` | Define WHAT with WHEN/THEN format | After proposal, before design |
|
|
18
|
-
| `tasks.md` | Implementation checklist | After design, before coding |
|
|
19
|
-
| `prd.md` | Combined PRD (proposal+spec+tasks) | Quick features that don't need full breakdown |
|
|
20
|
-
| `design.md` | Architecture decisions | Complex features needing design exploration |
|
|
21
|
-
|
|
22
|
-
## Context Injection
|
|
23
|
-
|
|
24
|
-
The file `.opencode/memory/project/tech-stack.md` is auto-injected into all AI prompts via `opencode.json` instructions[].
|
|
25
|
-
|
|
26
|
-
| File | Purpose |
|
|
27
|
-
| --------------- | ----------------------------------- |
|
|
28
|
-
| `tech-stack.md` | Framework, DB, styling, constraints |
|
|
29
|
-
|
|
30
|
-
**Additional context is captured organically:**
|
|
31
|
-
|
|
32
|
-
- AI discovers commands by reading package.json and running them
|
|
33
|
-
- AI captures conventions via `observation` tool as it works
|
|
34
|
-
- AI captures gotchas via `observation` tool when encountering issues
|
|
35
|
-
- Architecture learnings are saved to `.opencode/memory/observations/`
|
|
36
|
-
|
|
37
|
-
## Usage
|
|
38
|
-
|
|
39
|
-
### For Beads Work
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
# Copy artifact templates to bead folder
|
|
43
|
-
cp .opencode/memory/_templates/proposal.md .beads/artifacts/<bead-id>/
|
|
44
|
-
cp .opencode/memory/_templates/spec.md .beads/artifacts/<bead-id>/
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### For Project Documentation
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
# Fill in tech-stack.md when starting a new project
|
|
51
|
-
# Other project knowledge is captured via observation tool
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Template Philosophy
|
|
55
|
-
|
|
56
|
-
**Minimal scaffolds, not rigid forms.**
|
|
57
|
-
|
|
58
|
-
- Templates are starting points, not constraints
|
|
59
|
-
- Fill in what's relevant, delete what's not
|
|
60
|
-
- WHEN/THEN format in specs enables testable requirements
|
|
61
|
-
- Numbered tasks in `tasks.md` are machine-parseable
|
|
62
|
-
- Let AI learn organically rather than pre-filling empty templates
|
|
63
|
-
|
|
64
|
-
## OpenSpec Alignment
|
|
65
|
-
|
|
66
|
-
Our templates are inspired by [OpenSpec](https://github.com/Fission-AI/OpenSpec) patterns:
|
|
67
|
-
|
|
68
|
-
- **Proposal** → Captures motivation and impact
|
|
69
|
-
- **Spec** → Behavioral requirements with scenarios
|
|
70
|
-
- **Tasks** → Numbered, checkboxed implementation steps
|
|
71
|
-
- **Context injection** → Project info in all prompts
|
|
72
|
-
|
|
73
|
-
Key difference: We're AI-native (no CLI), so templates are simpler and commands provide the detailed guidance that OpenSpec puts in `schema.yaml` instructions.
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# Observation Template
|
|
2
|
-
|
|
3
|
-
**Type:** [decision | bugfix | feature | pattern | discovery | learning | warning]
|
|
4
|
-
**Created:** [timestamp]
|
|
5
|
-
**Bead:** [optional bead-id]
|
|
6
|
-
**Concepts:** `tag1`, `tag2`, `tag3`
|
|
7
|
-
**Files:** `path/to/file1.ts`, `path/to/file2.ts`
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## Context
|
|
12
|
-
|
|
13
|
-
[What situation prompted this observation? What were you working on?]
|
|
14
|
-
|
|
15
|
-
## Observation
|
|
16
|
-
|
|
17
|
-
[The core insight, decision, or learning. Be specific and actionable.]
|
|
18
|
-
|
|
19
|
-
## Rationale
|
|
20
|
-
|
|
21
|
-
[Why is this important? What alternatives were considered?]
|
|
22
|
-
|
|
23
|
-
## Future Reference
|
|
24
|
-
|
|
25
|
-
[How should this inform future decisions? Any follow-up actions?]
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## Type Definitions
|
|
30
|
-
|
|
31
|
-
| Type | Icon | Use For |
|
|
32
|
-
| --------- | ---- | ------------------------------------ |
|
|
33
|
-
| decision | 🎯 | Architectural or design choices made |
|
|
34
|
-
| bugfix | 🐛 | Bug root causes and solutions |
|
|
35
|
-
| feature | ✨ | Feature implementation notes |
|
|
36
|
-
| pattern | 🔄 | Recurring patterns or conventions |
|
|
37
|
-
| discovery | 💡 | Unexpected findings or insights |
|
|
38
|
-
| learning | 📚 | Lessons learned from experience |
|
|
39
|
-
| warning | ⚠️ | Pitfalls to avoid, gotchas |
|