@osovv/vv-opencode 0.1.0 → 0.2.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.
Files changed (44) hide show
  1. package/AGENTS.md +62 -50
  2. package/README.md +237 -20
  3. package/dist/commands/doctor.d.ts +1 -7
  4. package/dist/commands/doctor.js +3 -20
  5. package/dist/commands/doctor.js.map +1 -1
  6. package/dist/commands/guardian.js +1 -1
  7. package/dist/commands/guardian.js.map +1 -1
  8. package/dist/commands/install.d.ts +1 -7
  9. package/dist/commands/install.js +4 -16
  10. package/dist/commands/install.js.map +1 -1
  11. package/dist/commands/status.d.ts +1 -1
  12. package/dist/commands/status.js +2 -5
  13. package/dist/commands/status.js.map +1 -1
  14. package/dist/commands/sync.d.ts +1 -7
  15. package/dist/commands/sync.js +4 -15
  16. package/dist/commands/sync.js.map +1 -1
  17. package/dist/index.d.ts +1 -0
  18. package/dist/index.js +1 -0
  19. package/dist/index.js.map +1 -1
  20. package/dist/lib/opencode.d.ts +3 -18
  21. package/dist/lib/opencode.js +39 -111
  22. package/dist/lib/opencode.js.map +1 -1
  23. package/dist/lib/opencode.test.js +23 -6
  24. package/dist/lib/opencode.test.js.map +1 -1
  25. package/dist/lib/vvoc-paths.d.ts +6 -0
  26. package/dist/lib/vvoc-paths.js +25 -0
  27. package/dist/lib/vvoc-paths.js.map +1 -0
  28. package/dist/plugins/guardian.js +20 -21
  29. package/dist/plugins/guardian.js.map +1 -1
  30. package/dist/plugins/memory-store.d.ts +49 -0
  31. package/dist/plugins/memory-store.js +452 -0
  32. package/dist/plugins/memory-store.js.map +1 -0
  33. package/dist/plugins/memory.d.ts +2 -0
  34. package/dist/plugins/memory.js +323 -0
  35. package/dist/plugins/memory.js.map +1 -0
  36. package/dist/plugins/memory.test.d.ts +1 -0
  37. package/dist/plugins/memory.test.js +151 -0
  38. package/dist/plugins/memory.test.js.map +1 -0
  39. package/docs/development-plan.xml +100 -20
  40. package/docs/knowledge-graph.xml +30 -6
  41. package/docs/requirements.xml +30 -19
  42. package/docs/technology.xml +23 -14
  43. package/docs/verification-plan.xml +92 -25
  44. package/package.json +14 -2
@@ -1,14 +1,15 @@
1
- <DevelopmentPlan VERSION="0.2.0">
1
+ <DevelopmentPlan VERSION="0.3.0">
2
2
  <ArchitectureNotes>
3
- <objective>Package the existing Guardian plugin without behavior drift, while adding a small CLI that manages portable OpenCode config safely.</objective>
4
- <non-goal>Do not expand into a large monorepo or broad profile manager before the first plugin packaging path is stable.</non-goal>
3
+ <objective>Package portable OpenCode workflow plugins while keeping vvoc-owned config and memory data isolated from native OpenCode config.</objective>
4
+ <non-goal>Do not expand into a large monorepo or broad profile manager before plugin packaging, explicit memory, and vvoc config boundaries are stable.</non-goal>
5
5
  <risk-1>Config file mutation must stay conservative because users may already have hand-maintained JSONC with comments.</risk-1>
6
+ <risk-2>The file-based memory store does full scans and should stay explicit, simple, and easy to reason about until scale requires indexing.</risk-2>
6
7
  </ArchitectureNotes>
7
8
 
8
9
  <Modules>
9
10
  <M-CLI-CONFIG NAME="OpenCodeConfigTools" TYPE="UTILITY" LAYER="0" ORDER="1" STATUS="implemented">
10
11
  <contract>
11
- <purpose>Resolve OpenCode config paths, edit JSONC safely, render managed Guardian config, and inspect installation state.</purpose>
12
+ <purpose>Resolve OpenCode and vvoc config paths, edit JSONC safely, render managed Guardian config, and inspect installation state.</purpose>
12
13
  <inputs>
13
14
  <param name="scope" type="global | project" />
14
15
  <param name="cwd" type="string" />
@@ -23,13 +24,13 @@
23
24
  </errors>
24
25
  </contract>
25
26
  <interface>
26
- <export-resolvePaths PURPOSE="Resolve config and Guardian file paths for the selected scope." />
27
- <export-ensurePackageInstalled PURPOSE="Ensure the npm plugin is registered in OpenCode config." />
27
+ <export-resolvePaths PURPOSE="Resolve OpenCode config paths and vvoc-managed config paths for the selected scope." />
28
+ <export-ensurePackageInstalled PURPOSE="Ensure the npm package is registered in OpenCode config." />
28
29
  <export-syncGuardianConfig PURPOSE="Rewrite managed Guardian config while preserving current values." />
29
30
  </interface>
30
31
  <depends>none</depends>
31
32
  <target>
32
- <source>src/lib/opencode.ts</source>
33
+ <source>src/lib/opencode.ts + src/lib/vvoc-paths.ts</source>
33
34
  <tests>src/lib/opencode.test.ts</tests>
34
35
  </target>
35
36
  <observability>
@@ -57,7 +58,7 @@
57
58
  </contract>
58
59
  <interface>
59
60
  <export-install PURPOSE="Bootstrap plugin registration and optional Guardian config." />
60
- <export-sync PURPOSE="Refresh managed config files." />
61
+ <export-sync PURPOSE="Refresh managed vvoc config files." />
61
62
  <export-doctor PURPOSE="Diagnose installation drift or invalid config." />
62
63
  </interface>
63
64
  <depends>M-CLI-CONFIG</depends>
@@ -71,7 +72,7 @@
71
72
  </observability>
72
73
  <verification-ref>V-M-CLI-COMMANDS</verification-ref>
73
74
  <notes>
74
- <note-1>Commands should stay thin and delegate file logic to `M-CLI-CONFIG`.</note-1>
75
+ <note-1>Commands should stay thin and delegate file logic to helper utilities.</note-1>
75
76
  </notes>
76
77
  </M-CLI-COMMANDS>
77
78
 
@@ -92,7 +93,7 @@
92
93
  <interface>
93
94
  <export-GuardianPlugin PURPOSE="Register Guardian hooks, config agent, and permission review flow." />
94
95
  </interface>
95
- <depends>none</depends>
96
+ <depends>M-CLI-CONFIG</depends>
96
97
  <target>
97
98
  <source>src/plugins/guardian.ts</source>
98
99
  <tests>typecheck-only in v1</tests>
@@ -103,16 +104,83 @@
103
104
  </observability>
104
105
  <verification-ref>V-M-PLUGIN-GUARDIAN</verification-ref>
105
106
  <notes>
106
- <note-1>This module is a direct port of the existing standalone plugin and should change minimally at first.</note-1>
107
+ <note-1>Guardian now reads vvoc-managed config from `.vvoc/` or `$XDG_CONFIG_HOME/vvoc/` only.</note-1>
107
108
  </notes>
108
109
  </M-PLUGIN-GUARDIAN>
110
+
111
+ <M-PLUGIN-MEMORY-STORE NAME="MemoryStore" TYPE="UTILITY" LAYER="0" ORDER="3" STATUS="implemented">
112
+ <contract>
113
+ <purpose>Persist explicit memory entries in `.vvoc/memory`, support scope-aware CRUD, and rank lexical search results.</purpose>
114
+ <inputs>
115
+ <param name="MemoryRuntimeConfig" type="object" />
116
+ <param name="MemoryEntry or query/filter inputs" type="object" />
117
+ </inputs>
118
+ <outputs>
119
+ <param name="MemoryEntry | MemoryEntry[] | MemoryRuntimeConfig" type="object" />
120
+ </outputs>
121
+ <errors>
122
+ <error code="INVALID_MEMORY_CONFIG" />
123
+ <error code="INVALID_MEMORY_TEXT" />
124
+ </errors>
125
+ </contract>
126
+ <interface>
127
+ <export-loadMemoryRuntimeConfig PURPOSE="Load vvoc memory settings from global and project config files." />
128
+ <export-putMemory PURPOSE="Create a scoped memory entry in `.vvoc/memory`." />
129
+ <export-searchMemories PURPOSE="Return ranked lexical matches across relevant memory scopes." />
130
+ </interface>
131
+ <depends>none</depends>
132
+ <target>
133
+ <source>src/plugins/memory-store.ts</source>
134
+ <tests>src/plugins/memory.test.ts</tests>
135
+ </target>
136
+ <observability>
137
+ <log-prefix>[memory-store]</log-prefix>
138
+ <critical-block>BLOCK_MEMORY_SEARCH</critical-block>
139
+ </observability>
140
+ <verification-ref>V-M-PLUGIN-MEMORY-STORE</verification-ref>
141
+ <notes>
142
+ <note-1>Memory remains explicit-only. The store must not inject entries into prompts or system context.</note-1>
143
+ </notes>
144
+ </M-PLUGIN-MEMORY-STORE>
145
+
146
+ <M-PLUGIN-MEMORY NAME="MemoryPlugin" TYPE="INTEGRATION" LAYER="0" ORDER="4" STATUS="implemented">
147
+ <contract>
148
+ <purpose>Add explicit memory tools to OpenCode, register a report-only `memory-reviewer` subagent, and inject a short system reminder that encourages proactive memory tool usage without loading stored entries.</purpose>
149
+ <inputs>
150
+ <param name="PluginInput" type="@opencode-ai/plugin input" />
151
+ </inputs>
152
+ <outputs>
153
+ <param name="Hooks" type="OpenCode plugin hooks with custom tools and config mutation" />
154
+ </outputs>
155
+ <errors>
156
+ <error code="MEMORY_DISABLED" />
157
+ <error code="MEMORY_NOT_FOUND" />
158
+ </errors>
159
+ </contract>
160
+ <interface>
161
+ <export-MemoryPlugin PURPOSE="Register explicit memory tools and the `memory-reviewer` subagent." />
162
+ </interface>
163
+ <depends>M-PLUGIN-MEMORY-STORE</depends>
164
+ <target>
165
+ <source>src/plugins/memory.ts</source>
166
+ <tests>src/plugins/memory.test.ts</tests>
167
+ </target>
168
+ <observability>
169
+ <log-prefix>[memory]</log-prefix>
170
+ <critical-block>BLOCK_REGISTER_MEMORY_TOOLS</critical-block>
171
+ </observability>
172
+ <verification-ref>V-M-PLUGIN-MEMORY</verification-ref>
173
+ <notes>
174
+ <note-1>The reviewer is implemented as a bundled subagent, and the main chat path receives only a short memory policy reminder instead of prompt-injected memory entries.</note-1>
175
+ </notes>
176
+ </M-PLUGIN-MEMORY>
109
177
  </Modules>
110
178
 
111
179
  <DataFlow>
112
180
  <DF-PLUGIN-INSTALL NAME="PluginInstall" TRIGGER="vvoc install">
113
- <step-1>Resolve scope-specific OpenCode and Guardian config paths.</step-1>
181
+ <step-1>Resolve scope-specific OpenCode config paths and vvoc config paths.</step-1>
114
182
  <step-2>Ensure `@osovv/vv-opencode` exists in the OpenCode `plugin` array.</step-2>
115
- <step-3>Create `guardian.jsonc` when it does not already exist.</step-3>
183
+ <step-3>Create `guardian.jsonc` under the vvoc config root when it does not already exist.</step-3>
116
184
  <evidence>`vvoc status`, parsed config content, and successful typecheck/build.</evidence>
117
185
  </DF-PLUGIN-INSTALL>
118
186
  <DF-CONFIG-SYNC NAME="ManagedConfigSync" TRIGGER="vvoc sync">
@@ -121,18 +189,25 @@
121
189
  <step-3>Rewrite managed file canonically while preserving current values.</step-3>
122
190
  <evidence>Stable rewritten `guardian.jsonc` and no overwrite of unmanaged files without force.</evidence>
123
191
  </DF-CONFIG-SYNC>
124
- <DF-GUARDIAN-SETTINGS NAME="GuardianConfigWrite" TRIGGER="vvoc guardian config">
125
- <step-1>Parse CLI overrides for model, variant, timeout, and thresholds.</step-1>
126
- <step-2>Render a managed Guardian config template.</step-2>
127
- <step-3>Write or print the config depending on mode.</step-3>
128
- <evidence>JSONC parse succeeds and plugin can load the written file later.</evidence>
129
- </DF-GUARDIAN-SETTINGS>
130
192
  <DF-GUARDIAN-REVIEW NAME="GuardianPermissionReview" TRIGGER="permission.asked event">
131
193
  <step-1>Capture relevant tool and command intent for the session.</step-1>
132
194
  <step-2>Build a bounded transcript and planned action prompt.</step-2>
133
195
  <step-3>Run Guardian, interpret risk, and auto-reply only when below threshold.</step-3>
134
196
  <evidence>Guardian logs, toasts, and permission reply behavior inside OpenCode.</evidence>
135
197
  </DF-GUARDIAN-REVIEW>
198
+ <DF-MEMORY-ACCESS NAME="MemoryAccess" TRIGGER="memory_* tool call">
199
+ <step-0>Before model turns, the plugin appends a short system reminder that explicit memory tools exist, without injecting stored memory entries.</step-0>
200
+ <step-1>Load vvoc memory settings from `$XDG_CONFIG_HOME/vvoc/memory.jsonc` and project `.vvoc/memory.jsonc`.</step-1>
201
+ <step-2>Resolve relevant scopes from session id, git branch, project, or shared key.</step-2>
202
+ <step-3>Read or mutate entries under `.vvoc/memory/` using file-per-entry JSON records.</step-3>
203
+ <evidence>Correct file layout, deterministic CRUD/search behavior, and no automatic prompt injection.</evidence>
204
+ </DF-MEMORY-ACCESS>
205
+ <DF-MEMORY-REVIEW NAME="MemoryReview" TRIGGER="@memory-reviewer invocation">
206
+ <step-1>Register the reviewer subagent through plugin config mutation.</step-1>
207
+ <step-2>The reviewer inspects memory with `memory_list`, `memory_get`, and `memory_search` only.</step-2>
208
+ <step-3>The reviewer returns a keep/update/merge/delete report without modifying entries.</step-3>
209
+ <evidence>Bundled `memory-reviewer` agent with read-only memory tooling.</evidence>
210
+ </DF-MEMORY-REVIEW>
136
211
  </DataFlow>
137
212
 
138
213
  <ImplementationOrder>
@@ -143,8 +218,13 @@
143
218
  </Phase-1>
144
219
  <Phase-2 name="Guardian Packaging" status="done">
145
220
  <goal>Move the existing standalone Guardian plugin into the repository and export it from the package.</goal>
146
- <step-1 module="M-PLUGIN-GUARDIAN" status="done" verification="V-M-PLUGIN-GUARDIAN">Port the current Guardian plugin source into `src/plugins/guardian.ts`.</step-1>
221
+ <step-1 module="M-PLUGIN-GUARDIAN" status="done" verification="V-M-PLUGIN-GUARDIAN">Port Guardian and move runtime config to vvoc-owned paths.</step-1>
147
222
  </Phase-2>
223
+ <Phase-3 name="Explicit Memory" status="done">
224
+ <goal>Add explicit persistent memory, store it in `.vvoc/memory`, and expose a report-only reviewer subagent.</goal>
225
+ <step-1 module="M-PLUGIN-MEMORY-STORE" status="done" verification="V-M-PLUGIN-MEMORY-STORE">Implement file-based scoped memory storage and lexical search.</step-1>
226
+ <step-2 module="M-PLUGIN-MEMORY" status="done" verification="V-M-PLUGIN-MEMORY">Register memory tools and the `memory-reviewer` subagent via OpenCode plugin hooks.</step-2>
227
+ </Phase-3>
148
228
  </ImplementationOrder>
149
229
 
150
230
  <ExecutionPolicy>
@@ -1,15 +1,15 @@
1
1
  <KnowledgeGraph>
2
- <Project NAME="@osovv/vv-opencode" VERSION="0.2.0">
2
+ <Project NAME="@osovv/vv-opencode" VERSION="0.3.0">
3
3
  <keywords>opencode, plugins, workflow</keywords>
4
4
  <annotation>Portable OpenCode workflow package with plugins and a Bun CLI for install, sync, and cross-device setup.</annotation>
5
5
 
6
6
  <M-CLI-CONFIG NAME="OpenCodeConfigTools" TYPE="UTILITY" STATUS="implemented">
7
- <purpose>Path resolution, JSONC-aware config mutation, managed Guardian config rendering, and installation inspection.</purpose>
8
- <path>src/lib/opencode.ts</path>
7
+ <purpose>Path resolution, JSONC-aware config mutation, managed Guardian config rendering, and installation inspection with separated vvoc roots.</purpose>
8
+ <path>src/lib/opencode.ts + src/lib/vvoc-paths.ts</path>
9
9
  <depends>none</depends>
10
10
  <verification-ref>V-M-CLI-CONFIG</verification-ref>
11
11
  <annotations>
12
- <fn-resolvePaths PURPOSE="Resolve scope-aware config file paths for OpenCode and Guardian." />
12
+ <fn-resolvePaths PURPOSE="Resolve OpenCode config paths and vvoc-managed config paths for the selected scope." />
13
13
  <fn-ensurePackageInstalled PURPOSE="Add the package name to the OpenCode plugin array if needed." />
14
14
  <fn-syncGuardianConfig PURPOSE="Rewrite managed Guardian config while preserving current values." />
15
15
  </annotations>
@@ -22,7 +22,7 @@
22
22
  <verification-ref>V-M-CLI-COMMANDS</verification-ref>
23
23
  <annotations>
24
24
  <export-install PURPOSE="Bootstrap package registration and optional Guardian config." />
25
- <export-sync PURPOSE="Refresh managed config files." />
25
+ <export-sync PURPOSE="Refresh managed vvoc config files." />
26
26
  <export-guardian PURPOSE="Expose Guardian-specific helper commands." />
27
27
  </annotations>
28
28
  </M-CLI-COMMANDS>
@@ -30,13 +30,37 @@
30
30
  <M-PLUGIN-GUARDIAN NAME="GuardianPlugin" TYPE="INTEGRATION" STATUS="implemented">
31
31
  <purpose>Review OpenCode permission requests using a constrained Guardian agent and safe fallback behavior.</purpose>
32
32
  <path>src/plugins/guardian.ts</path>
33
- <depends>none</depends>
33
+ <depends>M-CLI-CONFIG</depends>
34
34
  <verification-ref>V-M-PLUGIN-GUARDIAN</verification-ref>
35
35
  <annotations>
36
36
  <export-GuardianPlugin PURPOSE="Register Guardian hooks for config, events, tool intent capture, and permission review." />
37
37
  </annotations>
38
38
  </M-PLUGIN-GUARDIAN>
39
39
 
40
+ <M-PLUGIN-MEMORY-STORE NAME="MemoryStore" TYPE="UTILITY" STATUS="implemented">
41
+ <purpose>Store explicit memory under `.vvoc/memory`, resolve scopes, and provide lexical ranking for search.</purpose>
42
+ <path>src/plugins/memory-store.ts</path>
43
+ <depends>none</depends>
44
+ <verification-ref>V-M-PLUGIN-MEMORY-STORE</verification-ref>
45
+ <annotations>
46
+ <fn-loadMemoryRuntimeConfig PURPOSE="Load global and project vvoc memory settings." />
47
+ <fn-putMemory PURPOSE="Create a scoped memory entry in `.vvoc/memory`." />
48
+ <fn-searchMemories PURPOSE="Return ranked lexical matches across scoped entries." />
49
+ </annotations>
50
+ </M-PLUGIN-MEMORY-STORE>
51
+
52
+ <M-PLUGIN-MEMORY NAME="MemoryPlugin" TYPE="INTEGRATION" STATUS="implemented">
53
+ <purpose>Add explicit memory tools to OpenCode and register the `memory-reviewer` subagent.</purpose>
54
+ <path>src/plugins/memory.ts</path>
55
+ <depends>M-PLUGIN-MEMORY-STORE</depends>
56
+ <verification-ref>V-M-PLUGIN-MEMORY</verification-ref>
57
+ <annotations>
58
+ <export-MemoryPlugin PURPOSE="Register memory tools and the report-only reviewer subagent." />
59
+ </annotations>
60
+ </M-PLUGIN-MEMORY>
61
+
40
62
  <CrossLink from="M-CLI-COMMANDS" to="M-CLI-CONFIG" relation="uses" />
63
+ <CrossLink from="M-PLUGIN-GUARDIAN" to="M-CLI-CONFIG" relation="uses" />
64
+ <CrossLink from="M-PLUGIN-MEMORY" to="M-PLUGIN-MEMORY-STORE" relation="uses" />
41
65
  </Project>
42
66
  </KnowledgeGraph>
@@ -1,4 +1,4 @@
1
- <RequirementsAnalysis VERSION="0.2.0">
1
+ <RequirementsAnalysis VERSION="0.3.0">
2
2
  <Project>
3
3
  <name>@osovv/vv-opencode</name>
4
4
  <annotation>Portable OpenCode workflow package with plugins and a Bun CLI for install, sync, and cross-device setup.</annotation>
@@ -14,53 +14,64 @@
14
14
  <UC-001>
15
15
  <Actor>User</Actor>
16
16
  <Action>Runs `vvoc install` for global or project scope.</Action>
17
- <Goal>To register `@osovv/vv-opencode` in OpenCode config and bootstrap Guardian config when needed.</Goal>
18
- <Preconditions>Bun and OpenCode are available, and the target config location is writable.</Preconditions>
19
- <AcceptanceCriteria>The package name appears in the resolved OpenCode config and a default Guardian config can be created idempotently.</AcceptanceCriteria>
17
+ <Goal>To register `@osovv/vv-opencode` in OpenCode config while keeping vvoc-managed config in `XDG_CONFIG_HOME/vvoc` or project-local `.vvoc/`.</Goal>
18
+ <Preconditions>Bun and OpenCode are available, and the target config locations are writable.</Preconditions>
19
+ <AcceptanceCriteria>The package name appears in the resolved OpenCode config and `guardian.jsonc` is created under the vvoc config root.</AcceptanceCriteria>
20
20
  <Priority>high</Priority>
21
21
  <RelatedFlows>DF-PLUGIN-INSTALL</RelatedFlows>
22
22
  </UC-001>
23
23
  <UC-002>
24
24
  <Actor>User</Actor>
25
25
  <Action>Runs `vvoc sync` on another machine or after package updates.</Action>
26
- <Goal>To refresh managed workflow files without clobbering manually-owned config.</Goal>
26
+ <Goal>To refresh managed vvoc-owned config files without clobbering manually-owned config.</Goal>
27
27
  <Preconditions>The target config files already exist or can be created.</Preconditions>
28
- <AcceptanceCriteria>Managed files are rewritten canonically, existing values are preserved, and unmanaged files are skipped unless force is explicit.</AcceptanceCriteria>
28
+ <AcceptanceCriteria>Managed files are rewritten canonically and unmanaged files are skipped unless force is explicit.</AcceptanceCriteria>
29
29
  <Priority>high</Priority>
30
30
  <RelatedFlows>DF-CONFIG-SYNC</RelatedFlows>
31
31
  </UC-002>
32
32
  <UC-003>
33
33
  <Actor>User</Actor>
34
- <Action>Runs `vvoc guardian config` with optional model, variant, timeout, or threshold overrides.</Action>
35
- <Goal>To customize Guardian behavior without editing JSONC by hand.</Goal>
36
- <Preconditions>A target OpenCode config scope has been chosen.</Preconditions>
37
- <AcceptanceCriteria>The generated `guardian.jsonc` is valid, readable by the plugin, and safe to resync later.</AcceptanceCriteria>
34
+ <Action>Uses `memory_put`, `memory_search`, `memory_get`, `memory_update`, `memory_delete`, or `memory_list` inside OpenCode.</Action>
35
+ <Goal>To persist explicit durable context in `.vvoc/memory/` without automatic prompt injection.</Goal>
36
+ <Preconditions>The package is enabled in OpenCode and memory is not disabled in `memory.jsonc`.</Preconditions>
37
+ <AcceptanceCriteria>Memory entries are stored in the correct scope, searchable later, and never silently injected into prompts.</AcceptanceCriteria>
38
38
  <Priority>high</Priority>
39
- <RelatedFlows>DF-GUARDIAN-SETTINGS</RelatedFlows>
39
+ <RelatedFlows>DF-MEMORY-ACCESS</RelatedFlows>
40
40
  </UC-003>
41
+ <UC-004>
42
+ <Actor>User</Actor>
43
+ <Action>Invokes the bundled `memory-reviewer` subagent.</Action>
44
+ <Goal>To audit stored memory and get keep/update/merge/delete suggestions without modifying entries.</Goal>
45
+ <Preconditions>The package is enabled in OpenCode and explicit memory exists in scope.</Preconditions>
46
+ <AcceptanceCriteria>The reviewer can only read memory tools and returns a report-only audit.</AcceptanceCriteria>
47
+ <Priority>medium</Priority>
48
+ <RelatedFlows>DF-MEMORY-REVIEW</RelatedFlows>
49
+ </UC-004>
41
50
  </UseCases>
42
51
 
43
52
  <NonGoals>
44
- <item-1>No public plugin marketplace, profile manager, or multi-package monorepo in v1.</item-1>
45
- <item-2>No forced overwrite of unmanaged user config files without an explicit force flag.</item-2>
46
- <item-3>No attempt to redesign Guardian logic before it is safely packaged and reproducible from this repository.</item-3>
53
+ <item-1>No automatic memory injection into prompts.</item-1>
54
+ <item-2>No vector store, embeddings, or indexed retrieval in v1 memory.</item-2>
55
+ <item-3>No fallback compatibility with old `.opencode/guardian.jsonc` or `~/.config/opencode/guardian.jsonc` paths after the vvoc path migration.</item-3>
47
56
  </NonGoals>
48
57
 
49
58
  <Constraints>
50
59
  <constraint-1>OpenCode config integration must follow documented global and project path conventions.</constraint-1>
51
- <constraint-2>Guardian must remain compatible with the current standalone plugin behavior while being moved into the repo.</constraint-2>
60
+ <constraint-2>vvoc-managed config must live under `$XDG_CONFIG_HOME/vvoc/` or project-local `.vvoc/`.</constraint-2>
52
61
  <constraint-3>Config writes must be idempotent and preserve existing JSONC comments in the main OpenCode config where practical.</constraint-3>
53
- <constraint-4>Generated Guardian config should be clearly marked as CLI-managed so sync can distinguish owned and non-owned files.</constraint-4>
62
+ <constraint-4>Memory must stay explicit-only. Stored entries must not be injected into prompts automatically.</constraint-4>
63
+ <constraint-5>Generated Guardian config should be clearly marked as CLI-managed so sync can distinguish owned and non-owned files.</constraint-5>
54
64
  </Constraints>
55
65
 
56
66
  <Risks>
57
67
  <risk-1>Repositories or machines may contain multiple config files (`.json` and `.jsonc`) that can drift from each other.</risk-1>
58
68
  <risk-2>Unsafe rewrites of user-maintained config could damage trust in the CLI.</risk-2>
59
- <risk-3>Guardian depends on OpenCode plugin and SDK surface area that may evolve over time.</risk-3>
69
+ <risk-3>The file-based memory store performs full scans and may degrade as the number of entries grows.</risk-3>
70
+ <risk-4>Guardian and Memory depend on OpenCode plugin and SDK surface area that may evolve over time.</risk-4>
60
71
  </Risks>
61
72
 
62
73
  <OpenQuestions>
63
- <question-1>Should future versions also manage agents, commands, skills, and themes in addition to plugins and Guardian config?</question-1>
64
- <question-2>Should the package eventually export multiple plugins from the same npm entrypoint or separate them by subpath and opt-in config?</question-2>
74
+ <question-1>Should future versions also manage OpenCode skills and agents as installable assets in addition to plugin config and vvoc-owned files?</question-1>
75
+ <question-2>Should memory eventually grow an index or vector-backed search layer once `.vvoc/memory` becomes large?</question-2>
65
76
  </OpenQuestions>
66
77
  </RequirementsAnalysis>
@@ -1,39 +1,48 @@
1
- <TechnologyStack VERSION="0.2.0">
1
+ <TechnologyStack VERSION="0.3.0">
2
2
  <Runtime>Bun 1.3.8</Runtime>
3
3
  <Language>TypeScript 5.8.2</Language>
4
4
  <Framework>citty 0.2.2</Framework>
5
5
 
6
6
  <Dependencies>
7
- <dep name="@opencode-ai/plugin" version="1.3.17" purpose="Type-safe OpenCode plugin API and hook definitions" />
8
- <dep name="@opencode-ai/sdk" version="1.3.17" purpose="OpenCode client types and runtime interactions used by Guardian" />
9
- <dep name="citty" version="0.2.2" purpose="CLI command tree and argument parsing for `vvoc`" />
10
- <dep name="jsonc-parser" version="3.3.1" purpose="Safe JSONC-aware config parsing and in-place edits" />
7
+ <dep name="@opencode-ai/plugin" version="1.3.17" purpose="Type-safe OpenCode plugin API, hooks, and custom tool helper." />
8
+ <dep name="@opencode-ai/sdk" version="1.3.17" purpose="OpenCode client types and runtime interactions used by Guardian and plugin logging." />
9
+ <dep name="citty" version="0.2.2" purpose="CLI command tree and argument parsing for `vvoc`." />
10
+ <dep name="jsonc-parser" version="3.3.1" purpose="Safe JSONC-aware config parsing for vvoc-managed config files and OpenCode config edits." />
11
11
  </Dependencies>
12
12
 
13
13
  <VersionConstraints>
14
14
  <constraint lib="bun" min="1.3.8" max="1.3.x" reason="The package and local verification target Bun-based runtime and test execution." />
15
- <constraint lib="@opencode-ai/plugin" min="1.3.17" max="1.3.x" reason="Guardian depends on the current plugin hook and input shape." />
16
- <constraint lib="@opencode-ai/sdk" min="1.3.17" max="1.3.x" reason="Guardian uses current SDK message, part, and config types." />
15
+ <constraint lib="@opencode-ai/plugin" min="1.3.17" max="1.3.x" reason="Guardian and Memory depend on the current plugin hook and custom tool API shape." />
16
+ <constraint lib="@opencode-ai/sdk" min="1.3.17" max="1.3.x" reason="Guardian uses current SDK message, part, and client log types." />
17
17
  </VersionConstraints>
18
18
 
19
19
  <Tooling>
20
20
  <tool name="package-manager" value="bun" version="1.3.8" />
21
21
  <tool name="compiler" value="typescript" version="5.8.2" />
22
+ <tool name="linter" value="oxlint" version="1.58.0" />
23
+ <tool name="formatter" value="oxfmt" version="0.43.0" />
24
+ <tool name="git-hooks" value="lefthook" version="2.1.5" />
22
25
  <tool name="test-runner" value="bun test" version="1.3.8" />
23
26
  </Tooling>
24
27
 
28
+ <ConfigLayout>
29
+ <openCode>OpenCode config remains in `opencode.json(c)` or `$XDG_CONFIG_HOME/opencode/`.</openCode>
30
+ <vvoc>vvoc-managed config lives in `.vvoc/` or `$XDG_CONFIG_HOME/vvoc/`.</vvoc>
31
+ <memory>Persistent explicit memory is stored in project-local `.vvoc/memory/`.</memory>
32
+ </ConfigLayout>
33
+
25
34
  <Testing>
26
35
  <module-level>
27
- <command>bun test src/lib/opencode.test.ts</command>
28
- <focus>Fast deterministic checks for config merge and Guardian config rendering.</focus>
36
+ <command>bun test src/lib/opencode.test.ts src/plugins/memory.test.ts</command>
37
+ <focus>Fast deterministic checks for config layout, Guardian config rendering, memory CRUD, and reviewer agent registration.</focus>
29
38
  </module-level>
30
39
  <wave-level>
31
- <command>bun run typecheck &amp;&amp; bun test</command>
32
- <focus>Checks merged CLI and helper behavior after coordinated changes.</focus>
40
+ <command>bun run check</command>
41
+ <focus>Checks merged CLI and plugin behavior with lint and format verification included.</focus>
33
42
  </wave-level>
34
43
  <phase-level>
35
- <command>bun run build &amp;&amp; bun test</command>
36
- <focus>Validates package output and regression-safe baseline behavior.</focus>
44
+ <command>bun run check &amp;&amp; bun run build</command>
45
+ <focus>Validates package output and regression-safe baseline behavior after quality gates pass.</focus>
37
46
  </phase-level>
38
47
  <mocking-policy>Prefer direct pure-function verification and fixture text over broad mocks.</mocking-policy>
39
48
  </Testing>
@@ -46,6 +55,6 @@
46
55
  </Observability>
47
56
 
48
57
  <DeliveryShape>
49
- <shape>One public npm package that exports OpenCode plugins and ships a Bun CLI binary named `vvoc`.</shape>
58
+ <shape>One public npm package that exports `GuardianPlugin` and `MemoryPlugin`, plus a Bun CLI binary named `vvoc`.</shape>
50
59
  </DeliveryShape>
51
60
  </TechnologyStack>