@osovv/vv-opencode 0.29.1 → 0.30.2

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 (75) hide show
  1. package/README.md +5 -10
  2. package/dist/commands/doctor.js +0 -1
  3. package/dist/commands/doctor.js.map +1 -1
  4. package/dist/commands/plugin-list.js +3 -0
  5. package/dist/commands/plugin-list.js.map +1 -1
  6. package/dist/commands/status.js +0 -1
  7. package/dist/commands/status.js.map +1 -1
  8. package/dist/commands/upgrade.js +4 -0
  9. package/dist/commands/upgrade.js.map +1 -1
  10. package/dist/index.d.ts +0 -1
  11. package/dist/index.js +6 -6
  12. package/dist/index.js.map +1 -1
  13. package/dist/lib/agent-models.d.ts +1 -1
  14. package/dist/lib/agent-models.js +7 -1
  15. package/dist/lib/agent-models.js.map +1 -1
  16. package/dist/lib/managed-agents.d.ts +1 -1
  17. package/dist/lib/managed-agents.js +3 -8
  18. package/dist/lib/managed-agents.js.map +1 -1
  19. package/dist/lib/model-roles.d.ts +0 -1
  20. package/dist/lib/model-roles.js +7 -4
  21. package/dist/lib/model-roles.js.map +1 -1
  22. package/dist/lib/opencode.d.ts +1 -8
  23. package/dist/lib/opencode.js +9 -19
  24. package/dist/lib/opencode.js.map +1 -1
  25. package/dist/lib/vvoc-config.d.ts +0 -28
  26. package/dist/lib/vvoc-config.js +21 -97
  27. package/dist/lib/vvoc-config.js.map +1 -1
  28. package/dist/lib/vvoc-paths.js +1 -1
  29. package/dist/lib/vvoc-paths.js.map +1 -1
  30. package/dist/lib/vvoc-preset-registry.d.ts +12 -3
  31. package/dist/lib/vvoc-preset-registry.js +11 -2
  32. package/dist/lib/vvoc-preset-registry.js.map +1 -1
  33. package/dist/plugins/hashline-edit/autocorrect-replacement-lines.js +4 -0
  34. package/dist/plugins/hashline-edit/autocorrect-replacement-lines.js.map +1 -1
  35. package/dist/plugins/hashline-edit/edit-operation-primitives.js +4 -0
  36. package/dist/plugins/hashline-edit/edit-operation-primitives.js.map +1 -1
  37. package/dist/plugins/hashline-edit/file-text-canonicalization.js +4 -0
  38. package/dist/plugins/hashline-edit/file-text-canonicalization.js.map +1 -1
  39. package/dist/plugins/hashline-edit/normalize-edits.js +4 -0
  40. package/dist/plugins/hashline-edit/normalize-edits.js.map +1 -1
  41. package/dist/plugins/hashline-edit/types.js +4 -0
  42. package/dist/plugins/hashline-edit/types.js.map +1 -1
  43. package/dist/plugins/secrets-redaction/config.js +2 -0
  44. package/dist/plugins/secrets-redaction/config.js.map +1 -1
  45. package/dist/plugins/secrets-redaction/deep.js +4 -0
  46. package/dist/plugins/secrets-redaction/deep.js.map +1 -1
  47. package/dist/plugins/secrets-redaction/engine.js +3 -0
  48. package/dist/plugins/secrets-redaction/engine.js.map +1 -1
  49. package/dist/plugins/secrets-redaction/index.js +4 -0
  50. package/dist/plugins/secrets-redaction/index.js.map +1 -1
  51. package/dist/plugins/secrets-redaction/patterns.js +8 -0
  52. package/dist/plugins/secrets-redaction/patterns.js.map +1 -1
  53. package/dist/plugins/secrets-redaction/restore.js +4 -0
  54. package/dist/plugins/secrets-redaction/restore.js.map +1 -1
  55. package/dist/plugins/secrets-redaction/session.js +8 -0
  56. package/dist/plugins/secrets-redaction/session.js.map +1 -1
  57. package/dist/plugins/secrets-redaction.js +4 -0
  58. package/dist/plugins/secrets-redaction.js.map +1 -1
  59. package/dist/plugins/system-context-injection/index.js +1 -1
  60. package/dist/plugins/system-context-injection/index.js.map +1 -1
  61. package/dist/plugins/workflow/index.js +1 -1
  62. package/dist/plugins/workflow/index.js.map +1 -1
  63. package/package.json +3 -8
  64. package/schemas/vvoc/v3.json +2 -13
  65. package/templates/agents/vv-controller.md +7 -7
  66. package/dist/plugins/memory/index.d.ts +0 -2
  67. package/dist/plugins/memory/index.js +0 -440
  68. package/dist/plugins/memory/index.js.map +0 -1
  69. package/dist/plugins/memory/system-instruction.md +0 -8
  70. package/dist/plugins/memory-store.d.ts +0 -51
  71. package/dist/plugins/memory-store.js +0 -461
  72. package/dist/plugins/memory-store.js.map +0 -1
  73. package/schemas/vvoc/v1.json +0 -94
  74. package/schemas/vvoc/v2.json +0 -124
  75. package/templates/agents/memory-reviewer.md +0 -40
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osovv/vv-opencode",
3
- "version": "0.29.1",
3
+ "version": "0.30.2",
4
4
  "description": "Portable OpenCode workflow plugins, explicit memory, and CLI tooling.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -14,7 +14,6 @@
14
14
  "plugins",
15
15
  "workflow",
16
16
  "guardian",
17
- "memory",
18
17
  "xdg",
19
18
  "grace",
20
19
  "bun",
@@ -42,10 +41,6 @@
42
41
  "types": "./dist/plugins/hashline-edit/index.d.ts",
43
42
  "import": "./dist/plugins/hashline-edit/index.js"
44
43
  },
45
- "./plugins/memory": {
46
- "types": "./dist/plugins/memory/index.d.ts",
47
- "import": "./dist/plugins/memory/index.js"
48
- },
49
44
  "./plugins/model-roles": {
50
45
  "types": "./dist/plugins/model-roles/index.d.ts",
51
46
  "import": "./dist/plugins/model-roles/index.js"
@@ -64,7 +59,7 @@
64
59
  }
65
60
  },
66
61
  "scripts": {
67
- "build": "rm -rf dist && tsc -p tsconfig.build.json && mkdir -p dist/plugins/memory dist/plugins/workflow && cp src/plugins/memory/system-instruction.md dist/plugins/memory/system-instruction.md && cp src/plugins/workflow/system-instruction.md dist/plugins/workflow/system-instruction.md",
62
+ "build": "rm -rf dist && tsc -p tsconfig.build.json && mkdir -p dist/plugins/workflow && cp src/plugins/workflow/system-instruction.md dist/plugins/workflow/system-instruction.md",
68
63
  "prepublishOnly": "bun run build",
69
64
  "typecheck": "tsc --noEmit -p tsconfig.json",
70
65
  "lint": "oxlint --deny warnings src",
@@ -72,7 +67,7 @@
72
67
  "fmt:check": "oxfmt --check src",
73
68
  "test": "bun test",
74
69
  "check": "bun run typecheck && bun run lint && bun run fmt:check && bun test",
75
- "pack:check": "bun run build && bun -e \"const root = await import('./dist/index.js'); if (!('GuardianPlugin' in root)) throw new Error('dist root export missing GuardianPlugin'); if (!('HashlineEditPlugin' in root)) throw new Error('dist root export missing HashlineEditPlugin'); if (!('MemoryPlugin' in root)) throw new Error('dist root export missing MemoryPlugin'); if (!('ModelRolesPlugin' in root)) throw new Error('dist root export missing ModelRolesPlugin'); if (!('SystemContextInjectionPlugin' in root)) throw new Error('dist root export missing SystemContextInjectionPlugin'); if (!('WorkflowPlugin' in root)) throw new Error('dist root export missing WorkflowPlugin'); if (!('SecretsRedactionPlugin' in root)) throw new Error('dist root export missing SecretsRedactionPlugin'); await import('./dist/plugins/guardian/index.js'); await import('./dist/plugins/hashline-edit/index.js'); await import('./dist/plugins/memory/index.js'); await import('./dist/plugins/model-roles/index.js'); await import('./dist/plugins/system-context-injection/index.js'); await import('./dist/plugins/workflow/index.js'); await import('./dist/plugins/secrets-redaction/index.js')\" && npm pack --dry-run",
70
+ "pack:check": "bun run build && bun -e \"const root = await import('./dist/index.js'); if (!('GuardianPlugin' in root)) throw new Error('dist root export missing GuardianPlugin'); if (!('HashlineEditPlugin' in root)) throw new Error('dist root export missing HashlineEditPlugin'); if (!('ModelRolesPlugin' in root)) throw new Error('dist root export missing ModelRolesPlugin'); if (!('SystemContextInjectionPlugin' in root)) throw new Error('dist root export missing SystemContextInjectionPlugin'); if (!('WorkflowPlugin' in root)) throw new Error('dist root export missing WorkflowPlugin'); if (!('SecretsRedactionPlugin' in root)) throw new Error('dist root export missing SecretsRedactionPlugin'); await import('./dist/plugins/guardian/index.js'); await import('./dist/plugins/hashline-edit/index.js'); await import('./dist/plugins/model-roles/index.js'); await import('./dist/plugins/system-context-injection/index.js'); await import('./dist/plugins/workflow/index.js'); await import('./dist/plugins/secrets-redaction/index.js')\" && npm pack --dry-run",
76
71
  "prepare": "lefthook install --force"
77
72
  },
78
73
  "dependencies": {
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://cdn.jsdelivr.net/npm/@osovv/vv-opencode@0.29.0/schemas/vvoc/v3.json",
3
+ "$id": "https://cdn.jsdelivr.net/npm/@osovv/vv-opencode@0.30.2/schemas/vvoc/v3.json",
4
4
  "title": "vvoc config",
5
5
  "description": "Canonical vvoc configuration document.",
6
6
  "type": "object",
7
7
  "additionalProperties": false,
8
- "required": ["$schema", "version", "roles", "guardian", "memory", "secretsRedaction", "presets"],
8
+ "required": ["$schema", "version", "roles", "guardian", "secretsRedaction", "presets"],
9
9
  "properties": {
10
10
  "$schema": {
11
11
  "type": "string",
@@ -40,17 +40,6 @@
40
40
  "reviewToastDurationMs": { "type": "integer", "minimum": 1 }
41
41
  }
42
42
  },
43
- "memory": {
44
- "type": "object",
45
- "additionalProperties": false,
46
- "required": ["enabled", "defaultSearchLimit"],
47
- "properties": {
48
- "enabled": { "type": "boolean" },
49
- "defaultSearchLimit": { "type": "integer", "minimum": 1 },
50
- "reviewerModel": { "type": "string", "minLength": 1 },
51
- "reviewerVariant": { "type": "string", "minLength": 1 }
52
- }
53
- },
54
43
  "secretsRedaction": {
55
44
  "type": "object",
56
45
  "additionalProperties": false,
@@ -5,11 +5,11 @@ mode: primary
5
5
 
6
6
  You are the vv-controller primary agent.
7
7
 
8
- Your job is to own the user-facing workflow end to end: clarify only when necessary, gather context, choose the lightest safe route, implement directly when appropriate, delegate when useful, run verification, and report the result.
8
+ Your job is to own the user-facing workflow end to end: clarify when intent or expected output is unclear, gather context, choose the lightest safe route, present findings before acting, delegate when useful, run verification, and report the result.
9
9
 
10
10
  Core principles:
11
11
 
12
- - Be autonomous and pragmatic. When the task is clear enough, do the work directly.
12
+ - Present before acting. When the user asks for review, analysis, planning, or investigation, output the findings or plan first. Do not silently proceed to implementation.
13
13
  - Match the user's language in normal replies. Keep system-level prompts and task packets in English.
14
14
  - Prefer the smallest correct change that satisfies the request.
15
15
  - Do not make silent material assumptions. A material assumption affects behavior, scope, API shape, schema, UX, data meaning, security, or verification.
@@ -21,9 +21,9 @@ Route selection:
21
21
 
22
22
  - `direct_change`: localized, clear, low-risk implementation. You may edit files directly and verify directly.
23
23
  - `docs_only`: documentation-only change. You may edit documentation directly and verify formatting or relevant checks.
24
- - `investigate_first`: bugs, pasted errors, regressions, failing tests, unclear behavior, or unknown root cause. Delegate to `investigator` before implementing unless the root cause is already proven.
24
+ - `investigate_first`: bugs, pasted errors, regressions, failing tests, unclear behavior, or unknown root cause. Delegate to `investigator`, then present findings to the user before taking any implementation action.
25
25
  - `change_with_review`: multi-file, ambiguous, risky, public API/config/setup behavior, persistence, security-sensitive, or cross-module changes. Use the tracked implementer/reviewer loop.
26
- - `review_only`: explicit review request. Decide whether spec review, code review, or both are needed. Open a work item before invoking tracked reviewers.
26
+ - `review_only`: explicit review request. Decide whether spec review, code review, or both are needed. Open a work item before invoking tracked reviewers. Findings are the final output — do not proceed to fixes without user confirmation.
27
27
  - `large_feature`: broad feature or architectural change. Use `vv-analyst` then `vv-architect`, ask for user approval after architecture, and do not implement until approval is explicit.
28
28
 
29
29
  Context gathering:
@@ -97,12 +97,12 @@ Plan artifacts:
97
97
 
98
98
  Final response:
99
99
 
100
- - Start with the outcome.
101
- - Mention files changed and verification run.
100
+ - Start with the outcome. For review, analysis, planning, or investigation tasks, the outcome is the findings or plan — not the implementation.
101
+ - Mention files changed and verification run only when implementation occurred.
102
102
  - Mention assumptions, skipped checks, or residual risks only when they matter.
103
103
  - Suggest next steps only when they are natural and useful.
104
104
 
105
105
 
106
106
  <task>
107
- Your current task is the ongoing user request. Route it, implement it, or delegate it according to the guidelines above: clarify when needed, gather context, choose the safest route, verify, and report.
107
+ Your current task is the ongoing user request. Classify it first: if the user asks for review, analysis, planning, or investigation, present the output as the result. If the user asks for implementation, route it and implement. Clarify when intent or scope is unclear, gather context, choose the safest route, present findings before acting, verify, and report.
108
108
  </task>
@@ -1,2 +0,0 @@
1
- import { type Plugin } from "@opencode-ai/plugin";
2
- export declare const MemoryPlugin: Plugin;
@@ -1,440 +0,0 @@
1
- // FILE: src/plugins/memory/index.ts
2
- // VERSION: 0.3.0
3
- // START_MODULE_CONTRACT
4
- // PURPOSE: Register explicit vvoc memory tools and the report-only memory reviewer agent.
5
- // SCOPE: Memory reviewer agent config, managed prompt loading, scope resolution, memory tool execution, proactive system instruction injection, and plugin initialization logging.
6
- // DEPENDS: [@opencode-ai/plugin, node:fs/promises, src/lib/managed-agents.ts, src/lib/model-roles.ts, src/lib/vvoc-config.ts, src/lib/vvoc-paths.ts, src/plugins/memory-store.ts]
7
- // LINKS: [M-PLUGIN-MEMORY, M-PLUGIN-MEMORY-STORE]
8
- // ROLE: RUNTIME
9
- // MAP_MODE: EXPORTS
10
- // END_MODULE_CONTRACT
11
- //
12
- // START_MODULE_MAP
13
- // MemoryPlugin - Registers explicit memory tools, proactive system guidance, and the memory-reviewer subagent.
14
- // END_MODULE_MAP
15
- //
16
- // START_CHANGE_SUMMARY
17
- // LAST_CHANGE: [v0.3.0 - Resolved memory-reviewer runtime model from the built-in fast role and added explicit plugin error codes.]
18
- // LAST_CHANGE: [v0.2.6 - Switched memory-reviewer to vvoc-managed prompt files with no bundled runtime fallback.]
19
- // END_CHANGE_SUMMARY
20
- import { tool } from "@opencode-ai/plugin";
21
- import { readFile } from "node:fs/promises";
22
- import { loadManagedAgentPromptText } from "../../lib/managed-agents.js";
23
- import { ROLE_REFERENCE_PREFIX, resolveRoleReference, } from "../../lib/model-roles.js";
24
- import { createDefaultVvocConfig } from "../../lib/vvoc-config.js";
25
- import { getGlobalVvocConfigPath } from "../../lib/vvoc-paths.js";
26
- import { deleteMemory, getDefaultProjectScopeKey, getDefaultSearchLimit, getDefaultSharedScopeKey, getMemory, listMemories, loadMemoryRuntimeConfig, normalizeReadScopeType, normalizeWriteScopeType, putMemory, resolveBranchScopeKey, searchMemories, updateMemory, } from "../memory-store.js";
27
- import systemInstructionTemplate from "./system-instruction.md?raw";
28
- const MEMORY_REVIEW_AGENT = "memory-reviewer";
29
- const MEMORY_REVIEWER_RUNTIME_ROLE_REF = `${ROLE_REFERENCE_PREFIX}fast`;
30
- const z = tool.schema;
31
- const MEMORY_SYSTEM_INSTRUCTION = systemInstructionTemplate.trim();
32
- // START_BLOCK_MEMORY_PLUGIN_ERROR_HANDLING
33
- function createMemoryPluginError(options) {
34
- const error = new Error(options.message);
35
- error.code = options.code;
36
- if (options.cause !== undefined) {
37
- error.cause = options.cause;
38
- }
39
- return error;
40
- }
41
- function asModelRolesError(error) {
42
- if (!error || typeof error !== "object") {
43
- return undefined;
44
- }
45
- const maybeError = error;
46
- if (typeof maybeError.code !== "string") {
47
- return undefined;
48
- }
49
- return maybeError;
50
- }
51
- function loadConfiguredRoleMapOrThrow(configText, configPath) {
52
- let parsed;
53
- try {
54
- parsed = JSON.parse(configText);
55
- }
56
- catch (error) {
57
- throw createMemoryPluginError({
58
- code: "UNKNOWN_ROLE",
59
- message: `UNKNOWN_ROLE: cannot parse ${configPath} to resolve ${MEMORY_REVIEWER_RUNTIME_ROLE_REF}`,
60
- cause: error,
61
- });
62
- }
63
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
64
- throw createMemoryPluginError({
65
- code: "UNKNOWN_ROLE",
66
- message: `UNKNOWN_ROLE: ${configPath} must contain a top-level object with roles`,
67
- });
68
- }
69
- const roles = parsed.roles;
70
- if (!roles || typeof roles !== "object" || Array.isArray(roles)) {
71
- throw createMemoryPluginError({
72
- code: "UNKNOWN_ROLE",
73
- message: `UNKNOWN_ROLE: ${configPath} must contain a roles object with fast role assignment`,
74
- });
75
- }
76
- const roleMap = {};
77
- for (const [roleId, modelSelection] of Object.entries(roles)) {
78
- roleMap[roleId] = String(modelSelection);
79
- }
80
- return roleMap;
81
- }
82
- async function loadMemoryReviewerRuntimeModel() {
83
- const configPath = getGlobalVvocConfigPath();
84
- const configText = await readFile(configPath, "utf8").catch((error) => {
85
- if (error.code === "ENOENT") {
86
- return undefined;
87
- }
88
- throw error;
89
- });
90
- const roleMap = configText
91
- ? loadConfiguredRoleMapOrThrow(configText, configPath)
92
- : createDefaultVvocConfig().roles;
93
- try {
94
- const resolved = resolveRoleReference(MEMORY_REVIEWER_RUNTIME_ROLE_REF, roleMap);
95
- return {
96
- model: resolved.normalized,
97
- };
98
- }
99
- catch (error) {
100
- const code = asModelRolesError(error)?.code;
101
- throw createMemoryPluginError({
102
- code: "UNKNOWN_ROLE",
103
- message: code === "UNKNOWN_ROLE"
104
- ? `UNKNOWN_ROLE: built-in role reference ${MEMORY_REVIEWER_RUNTIME_ROLE_REF} could not be resolved`
105
- : `UNKNOWN_ROLE: built-in role reference ${MEMORY_REVIEWER_RUNTIME_ROLE_REF} resolved an invalid model selection`,
106
- cause: error,
107
- });
108
- }
109
- }
110
- // END_BLOCK_MEMORY_PLUGIN_ERROR_HANDLING
111
- // START_BLOCK_REVIEWER_AGENT_CONFIGURATION
112
- function createMemoryReviewerToolsConfig() {
113
- return {
114
- bash: false,
115
- edit: false,
116
- write: false,
117
- read: false,
118
- list: false,
119
- glob: false,
120
- grep: false,
121
- task: false,
122
- webfetch: false,
123
- websearch: false,
124
- codesearch: false,
125
- lsp: false,
126
- skill: false,
127
- todoread: false,
128
- todowrite: false,
129
- memory_search: true,
130
- memory_get: true,
131
- memory_list: true,
132
- memory_put: false,
133
- memory_update: false,
134
- memory_delete: false,
135
- };
136
- }
137
- function installMemoryReviewerAgent(config, reviewerPrompt, reviewerModel) {
138
- config.agent ??= {};
139
- config.agent[MEMORY_REVIEW_AGENT] = {
140
- mode: "subagent",
141
- description: "Reviews stored vvoc memory and suggests cleanup actions without modifying entries.",
142
- prompt: reviewerPrompt.trim(),
143
- permission: {
144
- edit: "deny",
145
- webfetch: "deny",
146
- bash: {
147
- "*": "deny",
148
- },
149
- },
150
- tools: createMemoryReviewerToolsConfig(),
151
- model: reviewerModel,
152
- };
153
- }
154
- // END_BLOCK_REVIEWER_AGENT_CONFIGURATION
155
- // START_BLOCK_SCOPE_RESOLUTION
156
- function resolveWriteScope(scopeType, scopeKey, sessionID, directory) {
157
- const normalizedType = normalizeWriteScopeType(scopeType) ?? "project";
158
- if (normalizedType === "project") {
159
- return { scopeType: "project", scopeKey: getDefaultProjectScopeKey() };
160
- }
161
- if (normalizedType === "shared") {
162
- return {
163
- scopeType: "shared",
164
- scopeKey: typeof scopeKey === "string" && scopeKey.trim()
165
- ? scopeKey.trim()
166
- : getDefaultSharedScopeKey(),
167
- };
168
- }
169
- if (normalizedType === "session") {
170
- return {
171
- scopeType: "session",
172
- scopeKey: typeof scopeKey === "string" && scopeKey.trim() ? scopeKey.trim() : sessionID,
173
- };
174
- }
175
- return {
176
- scopeType: "branch",
177
- scopeKey: typeof scopeKey === "string" && scopeKey.trim()
178
- ? scopeKey.trim()
179
- : resolveBranchScopeKey(directory),
180
- };
181
- }
182
- function getRelevantScopes(sessionID, directory) {
183
- return [
184
- resolveWriteScope("session", undefined, sessionID, directory),
185
- resolveWriteScope("branch", undefined, sessionID, directory),
186
- resolveWriteScope("project", undefined, sessionID, directory),
187
- resolveWriteScope("shared", undefined, sessionID, directory),
188
- ];
189
- }
190
- function resolveReadScopes(scopeType, scopeKey, sessionID, directory) {
191
- const normalizedType = normalizeReadScopeType(scopeType);
192
- if (!normalizedType) {
193
- return getRelevantScopes(sessionID, directory);
194
- }
195
- if (normalizedType === "all") {
196
- return undefined;
197
- }
198
- return [resolveWriteScope(normalizedType, scopeKey, sessionID, directory)];
199
- }
200
- // END_BLOCK_SCOPE_RESOLUTION
201
- // START_BLOCK_MEMORY_OUTPUT_FORMATTING
202
- function formatMemoryEntry(entry) {
203
- return `- ${entry.id} [${entry.scope_type}:${entry.scope_key}] [${entry.kind}] ${entry.text}`;
204
- }
205
- function formatMemoryEntries(entries) {
206
- return entries.map(formatMemoryEntry).join("\n");
207
- }
208
- function formatMemoryDetails(entry) {
209
- return JSON.stringify(entry, null, 2);
210
- }
211
- function getMemoryMetadataTitle(action, count) {
212
- if (typeof count === "number") {
213
- return `${action} (${count})`;
214
- }
215
- return action;
216
- }
217
- function getMemoryConfigWarningLines(memoryConfig) {
218
- return memoryConfig.warnings.map((warning) => `- ${warning}`);
219
- }
220
- // END_BLOCK_MEMORY_OUTPUT_FORMATTING
221
- // START_BLOCK_VALIDATE_MEMORY_ENABLED
222
- function assertEnabled(memoryConfig) {
223
- if (!memoryConfig.enabled) {
224
- throw createMemoryPluginError({
225
- code: "MEMORY_DISABLED",
226
- message: "MEMORY_DISABLED: vvoc memory is disabled in vvoc.json",
227
- });
228
- }
229
- }
230
- // END_BLOCK_VALIDATE_MEMORY_ENABLED
231
- export const MemoryPlugin = async ({ client, directory }) => {
232
- // START_BLOCK_INITIALIZE_MEMORY_PLUGIN
233
- const memoryConfig = await loadMemoryRuntimeConfig(directory);
234
- await client.app.log({
235
- body: {
236
- service: "memory",
237
- level: "info",
238
- message: "[memory][MemoryPlugin][BLOCK_INITIALIZE_MEMORY_PLUGIN] memory plugin initialized",
239
- extra: {
240
- enabled: memoryConfig.enabled,
241
- projectStorageRoot: memoryConfig.projectStorageRoot,
242
- sharedStorageRoot: memoryConfig.sharedStorageRoot,
243
- defaultSearchLimit: memoryConfig.defaultSearchLimit,
244
- configSources: memoryConfig.sources,
245
- configWarnings: memoryConfig.warnings,
246
- },
247
- },
248
- });
249
- if (!memoryConfig.enabled) {
250
- return {};
251
- }
252
- const metadataWarnings = getMemoryConfigWarningLines(memoryConfig);
253
- const memoryReviewerPrompt = await loadManagedAgentPromptText(directory, MEMORY_REVIEW_AGENT);
254
- const memoryReviewerRuntimeModel = await loadMemoryReviewerRuntimeModel();
255
- // END_BLOCK_INITIALIZE_MEMORY_PLUGIN
256
- return {
257
- config: async (config) => {
258
- installMemoryReviewerAgent(config, memoryReviewerPrompt, memoryReviewerRuntimeModel.model);
259
- await client.app.log({
260
- body: {
261
- service: "memory",
262
- level: "info",
263
- message: "[memory][installMemoryReviewerAgent][BLOCK_REVIEWER_AGENT_CONFIGURATION] memory reviewer registered",
264
- },
265
- });
266
- },
267
- "experimental.chat.system.transform": async (_input, output) => {
268
- if (!output.system.includes(MEMORY_SYSTEM_INSTRUCTION)) {
269
- output.system.push(MEMORY_SYSTEM_INSTRUCTION);
270
- }
271
- },
272
- tool: {
273
- // START_BLOCK_REGISTER_MEMORY_READ_TOOLS
274
- memory_search: tool({
275
- description: "Search explicit persistent vvoc memory. Shared scope is global across projects, and session/branch/project scopes are local to the current project. Memory is never preloaded into the prompt.",
276
- args: {
277
- query: z.string(),
278
- scopeType: z.enum(["session", "branch", "project", "shared", "all"]).optional(),
279
- scopeKey: z.string().optional(),
280
- kind: z.string().optional(),
281
- limit: z.number().int().positive().optional(),
282
- },
283
- async execute(args, context) {
284
- assertEnabled(memoryConfig);
285
- const results = await searchMemories(memoryConfig, args.query, {
286
- scopes: resolveReadScopes(args.scopeType, args.scopeKey, context.sessionID, context.worktree),
287
- kind: args.kind,
288
- limit: args.limit ?? getDefaultSearchLimit(memoryConfig),
289
- });
290
- context.metadata({
291
- title: getMemoryMetadataTitle("Memory Search", results.length),
292
- metadata: { count: results.length },
293
- });
294
- if (results.length === 0) {
295
- return metadataWarnings.length > 0
296
- ? [`No matching memory entries found.`, "", ...metadataWarnings].join("\n")
297
- : "No matching memory entries found.";
298
- }
299
- return metadataWarnings.length > 0
300
- ? [formatMemoryEntries(results), "", "Warnings:", ...metadataWarnings].join("\n")
301
- : formatMemoryEntries(results);
302
- },
303
- }),
304
- memory_get: tool({
305
- description: "Load a single explicit memory entry by id from vvoc memory storage.",
306
- args: {
307
- id: z.string(),
308
- },
309
- async execute(args, context) {
310
- assertEnabled(memoryConfig);
311
- const entry = await getMemory(memoryConfig, args.id);
312
- if (!entry) {
313
- throw createMemoryPluginError({
314
- code: "MEMORY_NOT_FOUND",
315
- message: `MEMORY_NOT_FOUND: Memory not found: ${args.id}`,
316
- });
317
- }
318
- context.metadata({
319
- title: getMemoryMetadataTitle("Memory Get"),
320
- metadata: { id: entry.id },
321
- });
322
- return formatMemoryDetails(entry);
323
- },
324
- }),
325
- // END_BLOCK_REGISTER_MEMORY_READ_TOOLS
326
- // START_BLOCK_REGISTER_MEMORY_MUTATION_TOOLS
327
- memory_put: tool({
328
- description: "Create a new explicit memory entry in session, branch, project, or shared scope. Shared scope is global across projects. Use this deliberately for durable facts, preferences, or procedures.",
329
- args: {
330
- text: z.string(),
331
- kind: z.string().optional(),
332
- scopeType: z.enum(["session", "branch", "project", "shared"]).optional(),
333
- scopeKey: z.string().optional(),
334
- tags: z.array(z.string()).optional(),
335
- meta: z.record(z.string(), z.unknown()).optional(),
336
- },
337
- async execute(args, context) {
338
- assertEnabled(memoryConfig);
339
- const scope = resolveWriteScope(args.scopeType, args.scopeKey, context.sessionID, context.worktree);
340
- const entry = await putMemory(memoryConfig, {
341
- scope_type: scope.scopeType,
342
- scope_key: scope.scopeKey,
343
- kind: args.kind,
344
- text: args.text,
345
- tags: args.tags,
346
- meta: args.meta,
347
- });
348
- context.metadata({
349
- title: getMemoryMetadataTitle("Memory Put"),
350
- metadata: { id: entry.id, scopeType: entry.scope_type, scopeKey: entry.scope_key },
351
- });
352
- return `Stored memory ${entry.id}`;
353
- },
354
- }),
355
- memory_update: tool({
356
- description: "Update an existing explicit memory entry by id.",
357
- args: {
358
- id: z.string(),
359
- text: z.string().optional(),
360
- kind: z.string().optional(),
361
- tags: z.array(z.string()).optional(),
362
- meta: z.record(z.string(), z.unknown()).optional(),
363
- },
364
- async execute(args, context) {
365
- assertEnabled(memoryConfig);
366
- if (args.text === undefined &&
367
- args.kind === undefined &&
368
- args.tags === undefined &&
369
- args.meta === undefined) {
370
- throw new Error("memory_update requires at least one field to change");
371
- }
372
- const entry = await updateMemory(memoryConfig, args.id, {
373
- text: args.text,
374
- kind: args.kind,
375
- tags: args.tags,
376
- meta: args.meta,
377
- });
378
- if (!entry) {
379
- throw createMemoryPluginError({
380
- code: "MEMORY_NOT_FOUND",
381
- message: `MEMORY_NOT_FOUND: Memory not found: ${args.id}`,
382
- });
383
- }
384
- context.metadata({
385
- title: getMemoryMetadataTitle("Memory Update"),
386
- metadata: { id: entry.id },
387
- });
388
- return `Updated memory ${entry.id}`;
389
- },
390
- }),
391
- memory_delete: tool({
392
- description: "Delete an explicit memory entry by id.",
393
- args: {
394
- id: z.string(),
395
- },
396
- async execute(args, context) {
397
- assertEnabled(memoryConfig);
398
- const entry = await deleteMemory(memoryConfig, args.id);
399
- if (!entry) {
400
- throw createMemoryPluginError({
401
- code: "MEMORY_NOT_FOUND",
402
- message: `MEMORY_NOT_FOUND: Memory not found: ${args.id}`,
403
- });
404
- }
405
- context.metadata({
406
- title: getMemoryMetadataTitle("Memory Delete"),
407
- metadata: { id: entry.id },
408
- });
409
- return `Deleted memory ${entry.id}`;
410
- },
411
- }),
412
- // END_BLOCK_REGISTER_MEMORY_MUTATION_TOOLS
413
- // START_BLOCK_REGISTER_MEMORY_LIST_TOOL
414
- memory_list: tool({
415
- description: "List explicit persistent memory entries across session, branch, project, or shared scopes. Shared scope is global across projects. Memory is never preloaded into the prompt.",
416
- args: {
417
- scopeType: z.enum(["session", "branch", "project", "shared", "all"]).optional(),
418
- scopeKey: z.string().optional(),
419
- kind: z.string().optional(),
420
- limit: z.number().int().positive().optional(),
421
- },
422
- async execute(args, context) {
423
- assertEnabled(memoryConfig);
424
- const results = await listMemories(memoryConfig, {
425
- scopes: resolveReadScopes(args.scopeType, args.scopeKey, context.sessionID, context.worktree),
426
- kind: args.kind,
427
- limit: args.limit ?? getDefaultSearchLimit(memoryConfig),
428
- });
429
- context.metadata({
430
- title: getMemoryMetadataTitle("Memory List", results.length),
431
- metadata: { count: results.length },
432
- });
433
- return results.length > 0 ? formatMemoryEntries(results) : "No memory entries found.";
434
- },
435
- }),
436
- // END_BLOCK_REGISTER_MEMORY_LIST_TOOL
437
- },
438
- };
439
- };
440
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/memory/index.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,iBAAiB;AACjB,wBAAwB;AACxB,4F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AAO,CAAC,MAAM,EAAE;qBACpC,CAAC,CAAC;oBAEH,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,0BAA0B,CAAC;gBACxF,CAAC;aACF,CAAC;YACF,sCAAsC;SACvC;KACF,CAAC;AACJ,CAAC,CAAC"}
@@ -1,8 +0,0 @@
1
- vvoc explicit memory is available in this workspace.
2
-
3
- - Stored memory is never preloaded into the prompt.
4
- - When durable user preferences, recurring project facts, or reusable procedures may already exist, consider memory_search, memory_list, or memory_get before guessing.
5
- - When you discover durable information that should survive across turns or sessions, consider memory_put if your current role and available tools permit it.
6
- - Use shared scope for reusable facts that should be visible across projects.
7
- - Use project, branch, or session scope for context that belongs only to the current project.
8
- - Reserve memory for durable information that should survive across turns or sessions.
@@ -1,51 +0,0 @@
1
- import { parseMemoryConfigText, renderMemoryConfig, type MemoryConfigOverrides } from "../lib/vvoc-config.js";
2
- declare const MEMORY_SCOPE_TYPES: readonly ["session", "branch", "project", "shared"];
3
- declare const MEMORY_SCOPE_TYPES_WITH_ALL: readonly ["session", "branch", "project", "shared", "all"];
4
- export type MemoryScopeType = (typeof MEMORY_SCOPE_TYPES)[number];
5
- export type MemoryReadScopeType = (typeof MEMORY_SCOPE_TYPES_WITH_ALL)[number];
6
- export type MemoryScope = {
7
- scopeType: MemoryScopeType;
8
- scopeKey: string;
9
- };
10
- export type MemoryEntry = {
11
- id: string;
12
- scope_type: MemoryScopeType;
13
- scope_key: string;
14
- kind: string;
15
- text: string;
16
- tags: string[];
17
- meta: Record<string, unknown>;
18
- created_at: string;
19
- updated_at: string;
20
- };
21
- export type MemoryRuntimeConfig = {
22
- enabled: boolean;
23
- projectStorageRoot: string;
24
- sharedStorageRoot: string;
25
- defaultSearchLimit: number;
26
- sources: string[];
27
- warnings: string[];
28
- };
29
- export type MemoryFilters = {
30
- scopes?: MemoryScope[];
31
- kind?: string;
32
- limit?: number;
33
- };
34
- export { parseMemoryConfigText, renderMemoryConfig, type MemoryConfigOverrides };
35
- export declare function loadMemoryRuntimeConfig(directory: string): Promise<MemoryRuntimeConfig>;
36
- export declare function getDefaultSearchLimit(config: MemoryRuntimeConfig): number;
37
- export declare function getDefaultProjectScopeKey(): string;
38
- export declare function getDefaultSharedScopeKey(): string;
39
- export declare function normalizeReadScopeType(value: unknown): MemoryReadScopeType | undefined;
40
- export declare function normalizeWriteScopeType(value: unknown): MemoryScopeType | undefined;
41
- export declare function resolveBranchScopeKey(cwd: string): string;
42
- export declare function listMemories(config: MemoryRuntimeConfig, filters?: MemoryFilters): Promise<MemoryEntry[]>;
43
- export declare function getMemory(config: MemoryRuntimeConfig, id: string): Promise<MemoryEntry | null>;
44
- export declare function putMemory(config: MemoryRuntimeConfig, entry: Partial<MemoryEntry> & {
45
- text: string;
46
- scope_type: MemoryScopeType;
47
- scope_key: string;
48
- }): Promise<MemoryEntry>;
49
- export declare function updateMemory(config: MemoryRuntimeConfig, id: string, patch?: Partial<Pick<MemoryEntry, "kind" | "text" | "tags" | "meta">>): Promise<MemoryEntry | null>;
50
- export declare function deleteMemory(config: MemoryRuntimeConfig, id: string): Promise<MemoryEntry | null>;
51
- export declare function searchMemories(config: MemoryRuntimeConfig, query: string, filters?: MemoryFilters): Promise<MemoryEntry[]>;