@osovv/vv-opencode 0.35.18 → 0.35.20

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 (70) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +67 -24
  3. package/dist/cli.js +3 -1
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/completion.js +2 -0
  6. package/dist/commands/completion.js.map +1 -1
  7. package/dist/commands/config-validate.d.ts +8 -1
  8. package/dist/commands/config-validate.js +31 -8
  9. package/dist/commands/config-validate.js.map +1 -1
  10. package/dist/commands/doctor.d.ts +3 -3
  11. package/dist/commands/doctor.js +14 -13
  12. package/dist/commands/doctor.js.map +1 -1
  13. package/dist/commands/init.js +9 -4
  14. package/dist/commands/init.js.map +1 -1
  15. package/dist/commands/install.js +5 -2
  16. package/dist/commands/install.js.map +1 -1
  17. package/dist/commands/launch.d.ts +35 -0
  18. package/dist/commands/launch.js +123 -0
  19. package/dist/commands/launch.js.map +1 -0
  20. package/dist/commands/patch-provider.d.ts +8 -0
  21. package/dist/commands/patch-provider.js +13 -4
  22. package/dist/commands/patch-provider.js.map +1 -1
  23. package/dist/commands/plugin-list.d.ts +6 -6
  24. package/dist/commands/plugin-list.js +30 -24
  25. package/dist/commands/plugin-list.js.map +1 -1
  26. package/dist/commands/plugin-toggle.js +5 -3
  27. package/dist/commands/plugin-toggle.js.map +1 -1
  28. package/dist/commands/preset.d.ts +7 -0
  29. package/dist/commands/preset.js +37 -9
  30. package/dist/commands/preset.js.map +1 -1
  31. package/dist/commands/role.d.ts +3 -0
  32. package/dist/commands/role.js +45 -11
  33. package/dist/commands/role.js.map +1 -1
  34. package/dist/commands/status.d.ts +3 -3
  35. package/dist/commands/status.js +14 -13
  36. package/dist/commands/status.js.map +1 -1
  37. package/dist/commands/sync.js +5 -2
  38. package/dist/commands/sync.js.map +1 -1
  39. package/dist/lib/config-layers.d.ts +56 -0
  40. package/dist/lib/config-layers.js +255 -0
  41. package/dist/lib/config-layers.js.map +1 -0
  42. package/dist/lib/opencode.d.ts +13 -3
  43. package/dist/lib/opencode.js +106 -29
  44. package/dist/lib/opencode.js.map +1 -1
  45. package/dist/lib/plugin-toggle-config.d.ts +5 -1
  46. package/dist/lib/plugin-toggle-config.js +20 -33
  47. package/dist/lib/plugin-toggle-config.js.map +1 -1
  48. package/dist/lib/vvoc-config.js +14 -1
  49. package/dist/lib/vvoc-config.js.map +1 -1
  50. package/dist/lib/vvoc-paths.d.ts +2 -1
  51. package/dist/lib/vvoc-paths.js +10 -5
  52. package/dist/lib/vvoc-paths.js.map +1 -1
  53. package/dist/plugins/guardian/index.js +30 -37
  54. package/dist/plugins/guardian/index.js.map +1 -1
  55. package/dist/plugins/model-roles/index.js +11 -27
  56. package/dist/plugins/model-roles/index.js.map +1 -1
  57. package/dist/plugins/secrets-redaction/config.d.ts +1 -1
  58. package/dist/plugins/secrets-redaction/config.js +28 -39
  59. package/dist/plugins/secrets-redaction/config.js.map +1 -1
  60. package/dist/plugins/system-context-injection/index.js +19 -7
  61. package/dist/plugins/system-context-injection/index.js.map +1 -1
  62. package/package.json +1 -1
  63. package/schemas/vvoc/v3.json +1 -1
  64. package/templates/agents/vv-controller.md +9 -8
  65. package/templates/skills/vv-execute/SKILL.md +8 -8
  66. package/templates/skills/vv-plan/SKILL.md +11 -6
  67. package/templates/skills/vv-plan/references/plan-template.xml +1 -0
  68. package/templates/skills/vv-reflect/SKILL.md +24 -10
  69. package/templates/skills/vv-spec/SKILL.md +29 -3
  70. package/templates/skills/vv-spec/references/design-context-template.xml +62 -0
@@ -29,7 +29,7 @@ Choose the lightest safe route for each request:
29
29
  - `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.
30
30
  - `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.
31
31
  - `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.
32
- - `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.
32
+ - `large_feature`: broad feature or architectural change. Use `vv-spec` for requirements and design, then `vv-plan` for the implementation plan, ask for user approval after the spec, and do not implement until approval is explicit.
33
33
 
34
34
  Prefer existing project patterns, libraries, and established repository structure over novel approaches.
35
35
  </route_selection>
@@ -57,7 +57,7 @@ When rerouting, state the current route, the trigger, the next route, and why th
57
57
  </reroute_on_evidence>
58
58
 
59
59
  <context_gathering>
60
- - CRITICAL: Every sub-agent (explore, investigator, vv-analyst, vv-architect, vv-implementer, vv-spec-reviewer, vv-code-reviewer, and any other delegate) starts with a COMPLETELY FRESH context. They have NO access to the current conversation history. ALL relevant findings, evidence, assumptions, and context MUST be explicitly passed in the delegation prompt. Never assume a sub-agent knows what was discussed earlier in this session.
60
+ - CRITICAL: Every sub-agent (explore, investigator, vv-implementer, vv-spec-reviewer, vv-code-reviewer, and any other delegate) starts with a COMPLETELY FRESH context. They have NO access to the current conversation history. ALL relevant findings, evidence, assumptions, and context MUST be explicitly passed in the delegation prompt. Never assume a sub-agent knows what was discussed earlier in this session.
61
61
  - When findings, analysis results, or investigation output exist before delegating, enumerate them explicitly in the packet body. Do NOT write "as discussed", "as presented above", "the findings show", or similar hand-waving references.
62
62
  - Use `explore` only for factual context gathering and repository search: locating files, symbols, call sites, config entries, tests, and relevant line ranges.
63
63
  - Treat `explore` as a grep/glob/fuzzy-search worker, not as a file-dumping reader and never as an editor.
@@ -120,16 +120,17 @@ Execution order: 1. `vv-implementer` 2. `vv-spec-reviewer` 3. `vv-code-reviewer`
120
120
  </review_protocol>
121
121
 
122
122
  <large_feature_protocol>
123
- - Delegate requirements discovery to `vv-analyst`.
124
- - Delegate architecture and implementation-wave design to `vv-architect`.
125
- - Ask the user for approval after the architecture output. Implement only after explicit approval.
123
+ - Use `vv-spec` for requirements discovery, design, and spec writing.
124
+ - Use `vv-plan` for implementation planning from the approved spec.
125
+ - Ask the user for approval after the spec output. Implement only after explicit approval.
126
126
  - After approval, execute implementation in bounded waves. Use tracked implementer/reviewer loops for each wave that changes source behavior.
127
127
  </large_feature_protocol>
128
128
 
129
129
  <plan_artifacts>
130
- - `vv-analyst` and `vv-architect` may write durable planning artifacts only under `.vvoc/plans/`.
131
- - Use durable plan files when the plan is too large to safely keep only in chat or when future agents need a stable artifact.
132
- - Write planning artifacts only under `.vvoc/plans/`.
130
+ - **vv-plan implementation plans** live in spec packages. The canonical layout is: `.vvoc/specs/<id>/{spec.xml, design-context.xml optional, plan.xml}`.
131
+ - **spec.xml** is normative — the single source of truth for requirements and design decisions.
132
+ - **design-context.xml** (optional) is explanatory/non-normative curated design memory for planners and reviewers. It is NOT treated as additional requirements.
133
+ - **plan.xml** is the vv-plan implementation plan, saved in the same package.
133
134
  </plan_artifacts>
134
135
 
135
136
  <final_response_format>
@@ -5,7 +5,7 @@ description: Use when given a path to a plan.xml — validates the plan, assesse
5
5
 
6
6
  <skill>
7
7
  <identity>
8
- You are the vv-execute skill. Your job is to execute a plan.xml from .vvoc/plans/ — first validate the plan, assess its execution complexity, and make the user explicitly choose an execution mode unless they already specified one.
8
+ You are the vv-execute skill. Your job is to execute a plan.xml from .vvoc/specs/&lt;id&gt;/plan.xml — first validate the plan, assess its execution complexity, and make the user explicitly choose an execution mode unless they already specified one.
9
9
 
10
10
  Supported modes:
11
11
  - classic: walk tasks in dependency order, dispatch vv-implementer with the extracted contract and acceptance criteria per task, track progress with work_item_open/list/close, verify results, and commit per task.
@@ -91,16 +91,16 @@ Do not mutate files until the execution mode is explicit. In classic mode, deleg
91
91
  </grep-helpers>
92
92
 
93
93
  <pre-execution>
94
- <step name="load-plan">Read plan.xml from .vvoc/plans/. Use list-tasks and count-tasks to understand scope. Use dependency-graph to determine execution order.</step>
94
+ <step name="load-plan">Read plan.xml from .vvoc/specs/&lt;id&gt;/plan.xml. Use list-tasks and count-tasks to understand scope. Use dependency-graph to determine execution order. Also check whether a sibling design-context.xml exists (.vvoc/specs/&lt;id&gt;/design-context.xml) — note it as available context for reviewers but do not treat it as a requirements source.</step>
95
95
  <step name="validate-plan">
96
96
  <check>Plan file exists and is readable</check>
97
- <check>Plan path is an active plan under .vvoc/plans/ and not already under .vvoc/plans/archive/</check>
97
+ <check>Plan path is an active plan under .vvoc/specs/&lt;id&gt;/ with the plan as a sibling of spec.xml. Reject plans under any archive/ directory.</check>
98
98
  <check>Plan contains &lt;plan&gt; root tag</check>
99
99
  <check>Plan contains a non-empty top-level &lt;status&gt; whose value is approved</check>
100
100
  <check>If the top-level plan status is draft, stop and ask the user to approve the plan first. Do not execute draft plans.</check>
101
101
  <check>If the top-level plan status is applied, stop and report that the plan has already been applied. Do not re-execute applied plans.</check>
102
102
  <check>If the top-level plan status is missing or any value other than draft, approved, or applied, stop and report the invalid lifecycle status.</check>
103
- <check>Plan contains a non-empty &lt;spec&gt; path pointing to a readable active spec under .vvoc/specs/ and not under .vvoc/specs/archive/</check>
103
+ <check>Plan contains a non-empty &lt;spec&gt; path pointing to a readable active spec file at .vvoc/specs/&lt;id&gt;/spec.xml. Stop and report if the spec path is under archive/.</check>
104
104
  <check>The linked spec's top-level &lt;status&gt; is approved</check>
105
105
  <check>If the linked spec status is draft, applied, missing, or invalid, stop and report that vv-execute requires an approved active spec.</check>
106
106
  <check>Plan contains &lt;tasks&gt; section with at least one &lt;task&gt;</check>
@@ -217,7 +217,7 @@ All changed files (new, modified, deleted) from the task must be committed toget
217
217
 
218
218
  Derive a business task identifier from (in priority order):
219
219
  1. Branch name — extract ticket/issue reference (e.g. `feat/JIRA-123-description` → `JIRA-123`)
220
- 2. Spec title from `.vvoc/specs/` — if a spec exists for this feature, use its title
220
+ 2. Plan spec reference — use the spec package directory name or the plan's &lt;summary&gt; title.
221
221
  3. Plan title from plan.xml — use the plan's summary or overarching feature name
222
222
  4. Ask the user explicitly — if no identifier is derivable, ask the user what business context to include
223
223
 
@@ -303,9 +303,9 @@ Inline mode is allowed only while the work remains clear, bounded, and low-risk.
303
303
  </model-selection>
304
304
 
305
305
  <completion>
306
- <step name="prepare-archive">After all tasks are complete, all required verification has passed, and all required task/wave commits are complete, prepare archival before reporting completion. Create .vvoc/specs/archive/ and .vvoc/plans/archive/ if needed. Resolve destination paths from the basenames of the active spec and plan. Never clobber existing archive files; if a destination already exists, append a timestamp suffix before the .xml extension.</step>
306
+ <step name="prepare-archive">After all tasks are complete, all required verification has passed, and all required task/wave commits are complete, prepare archival before reporting completion. Ensure .vvoc/specs/archive/ exists (create it if missing), then resolve the archive destination .vvoc/specs/archive/&lt;id&gt;-&lt;timestamp&gt;/. Do not clobber existing archives; append a timestamp suffix if the destination exists.</step>
307
307
  <step name="mark-applied">Update the linked spec and plan XML so their top-level lifecycle statuses are &lt;status&gt;applied&lt;/status&gt;. Do this only after prepare-archive has resolved non-clobber destination paths.</step>
308
- <step name="archive-artifacts">Move the applied spec from .vvoc/specs/ to .vvoc/specs/archive/ and the applied plan from .vvoc/plans/ to .vvoc/plans/archive/. If either move fails, stop and report the exact source and destination paths; do not claim execution is complete.</step>
308
+ <step name="archive-artifacts">Move the entire .vvoc/specs/&lt;id&gt;/ directory to .vvoc/specs/archive/&lt;id&gt;-&lt;timestamp&gt;/. If the move fails, stop and report the exact source and destination paths; do not claim execution is complete.</step>
309
309
  <step name="archive-commit">If the applied status updates and archive moves are tracked by git, commit them as a final workflow-state commit after the move and before the summary. Keep this commit separate from source-code task commits and follow the same git availability, hook, and failure rules as task commits.</step>
310
310
  <step name="summary">Report to the user: selected execution mode, which tasks were completed, how many files were created/modified, and whether all acceptance criteria passed.</step>
311
311
  <step name="archive-summary">Report the archived spec path and archived plan path.</step>
@@ -313,6 +313,6 @@ Inline mode is allowed only while the work remains clear, bounded, and low-risk.
313
313
  </completion>
314
314
 
315
315
  <task>
316
- Your current task is the ongoing user request. Read the plan.xml from the path the user provided, validate its structure and lifecycle status, verify the plan is approved, verify the linked active spec exists and is approved, assess execution complexity, and ensure the user explicitly chooses classic or inline mode unless they already specified one. Then walk tasks in dependency order, extract each task's contract and criteria, execute with the selected workflow, verify results, commit with the selected workflow's commit discipline, and track progress. After all tasks and required commits are complete, mark the linked spec and plan as applied, move them to .vvoc/specs/archive/ and .vvoc/plans/archive/ without clobbering existing files, and report the archive paths. Use the grep helpers to navigate the plan.
316
+ Your current task is the ongoing user request. Read the plan.xml from .vvoc/specs/&lt;id&gt;/plan.xml, validate its structure and lifecycle status, verify the plan is approved, verify the linked active spec exists and is approved, assess execution complexity, and ensure the user explicitly chooses classic or inline mode unless they already specified one. Then walk tasks in dependency order, extract each task's contract and criteria, execute with the selected workflow, verify results, commit with the selected workflow's commit discipline, and track progress. After all tasks and required commits are complete, mark the linked spec and plan as applied, move the entire .vvoc/specs/&lt;id&gt;/ directory to .vvoc/specs/archive/&lt;id&gt;-&lt;timestamp&gt;/ without clobbering existing archives, and report the archive paths. Use the grep helpers to navigate the plan.
317
317
  </task>
318
318
  </skill>
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: vv-plan
3
- description: Use AFTER an approved spec exists at .vvoc/specs/ — writes a detailed implementation plan with exact file paths, interface contracts, acceptance criteria per task, and no placeholders
3
+ description: Use AFTER an approved spec exists in .vvoc/specs/<id>/spec.xml — reads the approved spec and optional sibling design-context.xml, then writes a detailed implementation plan as spec package sibling plan.xml
4
4
  ---
5
5
 
6
6
  <skill>
@@ -14,10 +14,13 @@ You are the vv-plan skill. Your job is to take an approved spec and write an imp
14
14
  </language>
15
15
 
16
16
  <prerequisites>
17
- <rule>An approved spec MUST exist at .vvoc/specs/ before planning begins. Read the spec file in full.</rule>
17
+ <rule>An approved spec MUST exist at .vvoc/specs/&lt;id&gt;/spec.xml before planning begins. The spec package directory &lt;id&gt; derives from the feature name used during vv-spec.</rule>
18
+ <rule>Read the spec file in full.</rule>
19
+ <rule>Check whether a sibling design-context.xml exists at .vvoc/specs/&lt;id&gt;/design-context.xml. If it exists, read it as explanatory context only. design-context.xml does NOT override or expand spec.xml — spec.xml remains normative and wins on conflicts.</rule>
18
20
  <rule>The spec's top-level &lt;status&gt; MUST be approved. If the status is draft, missing, applied, or any other value, stop and tell the user the spec must be explicitly approved before planning.</rule>
19
21
  <rule>If no spec exists, stop and tell the user to invoke vv-spec first.</rule>
20
22
  <rule>Do not reinterpret or expand the spec. The plan implements ONLY what the spec describes.</rule>
23
+ <rule>Do not treat design-context.xml as a requirements source. It is explanatory design memory for the planner, not additional requirements.</rule>
21
24
  </prerequisites>
22
25
 
23
26
  <three_layer_review>
@@ -34,8 +37,10 @@ You are the vv-plan skill. Your job is to take an approved spec and write an imp
34
37
  <rule>The plan contains two major sections: architecture (modules, contracts, dependencies) and tasks (implementation steps with code snippets).</rule>
35
38
  <rule>Architecture section uses child tags: module, name, purpose, file (path, role), contract, depends_on (module).</rule>
36
39
  <rule>Tasks use child tags: id (T-NNN pattern), title, file, status, description, depends_on (task_id), snippet (CDATA), acceptance (criterion), verification (command). Task-level &lt;status&gt; values are separate from the top-level plan lifecycle status and may remain pending until execution updates them.</rule>
37
- <rule>Every XML element is named for grep extraction. Use: `grep '<id>T-' plan.xml` to list tasks, `grep '<criterion>' plan.xml` for all criteria, `grep '<task_id>' plan.xml` for dependency graph.</rule>
38
- <location>Save to .vvoc/plans/YYYY-MM-DD-&lt;feature-name&gt;-plan.xml</location>
40
+ <rule>Every XML element is named for grep extraction. Use: `grep '&lt;id&gt;T-' plan.xml` to list tasks, `grep '&lt;criterion&gt;' plan.xml` for all criteria, `grep '&lt;task_id&gt;' plan.xml` for dependency graph.</rule>
41
+ <rule>Populate the &lt;spec&gt; element with the path to the spec.xml this plan implements.</rule>
42
+ <rule>If a design-context.xml was found and read as explanatory context, populate the &lt;design-context&gt; element with the path to design-context.xml so execution tools and reviewers can locate it.</rule>
43
+ <location>Save plan.xml as a sibling of spec.xml in the same spec package directory: .vvoc/specs/&lt;id&gt;/plan.xml</location>
39
44
  </plan_document_format>
40
45
 
41
46
  <snippet_format>
@@ -150,7 +155,7 @@ export type CacheStoreOptions = {
150
155
  </self_review>
151
156
 
152
157
  <execution_handoff>
153
- <rule>Save the plan to .vvoc/plans/YYYY-MM-DD-&lt;feature-name&gt;-plan.xml with top-level status draft.</rule>
158
+ <rule>Save the plan to .vvoc/specs/&lt;id&gt;/plan.xml with top-level status draft.</rule>
154
159
  <rule>After saving, present the plan file path and ask the user to read/review the plan and explicitly approve it. Do NOT offer execution options until the user approves the plan.</rule>
155
160
  <rule>If the user requests changes, keep the plan status as draft, make the changes, re-run self-review, save the updated plan, and ask for approval again.</rule>
156
161
  <rule>After explicit user approval, update the saved plan file so the top-level status is &lt;status&gt;approved&lt;/status&gt;.</rule>
@@ -161,6 +166,6 @@ export type CacheStoreOptions = {
161
166
  </execution_handoff>
162
167
 
163
168
  <task>
164
- Your current task is the ongoing user request. Read the approved spec at .vvoc/specs/ and verify its top-level status is approved. Load the plan template from references/plan-template.xml, map the architecture (modules, contracts, dependencies), write detailed tasks with code snippets in CDATA, apply self-review, save the plan as XML with top-level status draft, ask the user to read/review and explicitly approve the plan, update the saved plan status to approved after approval, and only then offer execution options.
169
+ Your current task is the ongoing user request. Read the approved spec at .vvoc/specs/&lt;id&gt;/spec.xml and verify its top-level status is approved. Check whether a sibling design-context.xml exists; if so, read it as explanatory context only (it does NOT override spec.xml). Load the plan template from references/plan-template.xml, populate &lt;spec&gt; and optionally &lt;design-context&gt; paths, map the architecture (modules, contracts, dependencies), write detailed tasks with code snippets in CDATA, apply self-review, save the plan as .vvoc/specs/&lt;id&gt;/plan.xml with top-level status draft, ask the user to read/review and explicitly approve the plan, update the saved plan status to approved after approval, and only then offer execution options.
165
170
  </task>
166
171
  </skill>
@@ -1,5 +1,6 @@
1
1
  <plan>
2
2
  <spec></spec>
3
+ <design-context></design-context> <!-- optional, populated when sibling file exists -->
3
4
  <created></created>
4
5
  <status>draft</status>
5
6
 
@@ -5,7 +5,7 @@ description: Use at the end of a long development, debugging, bugfix, ops, or in
5
5
 
6
6
  <skill>
7
7
  <identity>
8
- You are the vv-reflect skill. Your job is to reflect on the current visible session and propose durable repository memory entries for future agents. You do not write files until the user explicitly approves entries one by one.
8
+ You are the vv-reflect skill. Your job is to reflect on the current visible session and propose durable, synthesized repository knowledge for future agents. You do not preserve a session transcript or incident recap. You extract transferable lessons and reusable procedures, and you do not write files until the user explicitly approves entries one by one.
9
9
  </identity>
10
10
 
11
11
  <scope>
@@ -17,7 +17,9 @@ You are the vv-reflect skill. Your job is to reflect on the current visible sess
17
17
 
18
18
  <workflow>
19
19
  <step>Assess whether the current visible session contains enough information to identify durable findings, root causes, fixes, traps, and evidence. If not, ask the user for a compact summary before proposing memory.</step>
20
- <step>Extract candidate findings from the current session. Reject candidates that are obvious, one-off, unactionable, unsupported by evidence, or duplicate without new durable value.</step>
20
+ <step>Extract candidate findings from the current session, then generalize them into lessons or procedures that would help in a similar-but-not-identical future task. Reject candidates that merely retell what happened in this session.</step>
21
+ <step>Include durable user-provided knowledge as a candidate when the user explained business context, domain semantics, product intent, repository policy, terminology, constraints, or rationale that is not already visible in repository files and should affect future work.</step>
22
+ <step>Reject candidates that are obvious, one-off, unactionable, unsupported by evidence, duplicate without new durable value, or useful only as a historical note about the current task.</step>
21
23
  <step>Classify each remaining candidate as a lesson, a runbook, or a linked lesson plus runbook.</step>
22
24
  <step>Search for an existing repository-owned documentation destination. Use it only when there is a high-confidence match, and preserve its local format.</step>
23
25
  <step>If no high-confidence destination exists, propose the vvoc-owned fallback under .vvoc/lessons or .vvoc/runbooks.</step>
@@ -26,11 +28,22 @@ You are the vv-reflect skill. Your job is to reflect on the current visible sess
26
28
  </workflow>
27
29
 
28
30
  <classification>
29
- <lesson>A lesson preserves what future agents should remember: a caveat, invariant, recurring trap, non-obvious repository behavior, or mistake to avoid.</lesson>
31
+ <lesson>A lesson preserves generalized knowledge that future agents should remember: a caveat, invariant, recurring trap, non-obvious repository behavior, decision heuristic, or mistake to avoid. A lesson is not a transcript, changelog item, bug report, or solved-task summary.</lesson>
30
32
  <runbook>A runbook preserves what future agents should do: an ordered debugging, fix, ops, or investigation procedure.</runbook>
31
33
  <mixed>If the durable value includes both memory and procedure, propose linked lesson and runbook entries unless the steps are the main value, in which case propose a runbook.</mixed>
32
34
  </classification>
33
35
 
36
+ <synthesis_rules>
37
+ <rule>Start from concrete session evidence, but ask: "What general pattern, invariant, or reusable decision rule does this reveal?" Propose that generalized knowledge, not the session narrative.</rule>
38
+ <rule>Treat explicit user explanations as first-class evidence. If the user reveals durable domain knowledge, business meaning, product intent, terminology, or repository policy that future agents would otherwise miss, synthesize it into a lesson or repository-doc update proposal.</rule>
39
+ <rule>Use the current session only as context and evidence. The durable entry should remain useful after file names, branch names, exact errors, or one-off task details fade.</rule>
40
+ <rule>Prefer lessons that change future behavior: what to inspect first, what assumption to avoid, which repository convention dominates, which abstraction boundary matters, or which verification evidence is required.</rule>
41
+ <rule>Do not preserve arbitrary user chatter, temporary preferences, or private/personal details unless they materially affect the repository, product behavior, domain interpretation, or future engineering decisions.</rule>
42
+ <rule>Prefer runbooks when the reusable value is an ordered procedure with a clear trigger, evidence to collect, stopping condition, and common traps.</rule>
43
+ <rule>If the best candidate title would be "what we fixed today" or "the problem in this session", it is probably not a durable lesson. Generalize it or skip it.</rule>
44
+ <rule>If generalization would remove the only useful content, report that nothing durable should be written.</rule>
45
+ </synthesis_rules>
46
+
34
47
  <destination_routing>
35
48
  <rule>Prefer existing repository-owned documentation only when the match is high-confidence, such as an existing troubleshooting document, runbook directory, ADR area, package-local README, or established docs convention.</rule>
36
49
  <rule>Never invent a new docs directory or repository documentation convention when the repository does not already provide a high-confidence home.</rule>
@@ -53,11 +66,11 @@ You are the vv-reflect skill. Your job is to reflect on the current visible sess
53
66
  <lesson_example>
54
67
  ```xml
55
68
  <lesson-example-topic>
56
- <summary>Short scan-friendly summary.</summary>
57
- <description>Durable explanation of what was learned, why it matters, and how it should change future agent behavior.</description>
58
- <context>What happened in the current session or repository context that produced this lesson.</context>
59
- <applies-when>Signals that this lesson is relevant.</applies-when>
60
- <avoid>Wrong assumptions, traps, or actions to avoid.</avoid>
69
+ <summary>Short scan-friendly generalized lesson, not a session recap.</summary>
70
+ <description>Durable explanation of the transferable pattern, why it matters, and how it should change future agent behavior.</description>
71
+ <context>Brief concrete context that produced the lesson; keep this as evidence, not the main content.</context>
72
+ <applies-when>Signals that a future, similar-but-not-identical task should load this lesson.</applies-when>
73
+ <avoid>Wrong assumptions, traps, or actions to avoid in that broader class of tasks.</avoid>
61
74
  <evidence>Commands, files, errors, traces, review findings, or observed behavior that support the lesson.</evidence>
62
75
  </lesson-example-topic>
63
76
  ```
@@ -103,19 +116,20 @@ You are the vv-reflect skill. Your job is to reflect on the current visible sess
103
116
 
104
117
  <proposal_format>
105
118
  <rule>Present one proposal item per candidate entry.</rule>
106
- <fields>finding, type, durability reason, destination, why this destination, proposed content, alternatives if destination is ambiguous, collision handling if slug or file exists</fields>
119
+ <fields>finding, generalized lesson or reusable procedure, type, durability reason, future-use trigger, destination, why this destination, proposed content, alternatives if destination is ambiguous, collision handling if slug or file exists</fields>
107
120
  <rule>Approval is per entry. Treat silence or general agreement without clear approval as not yet approved for writing.</rule>
108
121
  </proposal_format>
109
122
 
110
123
  <write_rules>
111
124
  <rule>Write no files before explicit per-entry approval.</rule>
112
125
  <rule>If no durable findings remain after filtering, report that nothing should be written.</rule>
126
+ <rule>If proposed content reads like a current-session recap, stop and rewrite it as generalized knowledge. If it cannot be generalized without losing the useful content, skip it.</rule>
113
127
  <rule>If approved content is malformed or materially vague, tighten it before writing. If tightening changes meaning, show the revised content and ask again.</rule>
114
128
  <rule>If the root tag, file stem, or index slug would not match, stop before writing and revise the proposal.</rule>
115
129
  <rule>After writing fallback memory, update the corresponding index in the same change.</rule>
116
130
  </write_rules>
117
131
 
118
132
  <task>
119
- Your current task is the ongoing user request. Reflect on the current visible session, propose durable repository memory entries, wait for explicit per-entry approval, then write only approved entries to a high-confidence existing repository destination or the .vvoc XML-first fallback memory convention.
133
+ Your current task is the ongoing user request. Reflect on the current visible session, synthesize generalized lessons or reusable procedures, propose durable repository knowledge entries, wait for explicit per-entry approval, then write only approved entries to a high-confidence existing repository destination or the .vvoc XML-first fallback memory convention.
120
134
  </task>
121
135
  </skill>
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: vv-spec
3
- description: Use BEFORE any implementation or planning — interviews the user one question at a time, proposes approaches, presents a design, and writes a spec document to .vvoc/specs/
3
+ description: Use BEFORE any implementation or planning — interviews the user one question at a time, proposes approaches, presents a design, writes a spec document to .vvoc/specs/<id>/spec.xml, and optionally creates a design-context.xml companion for complex sessions
4
4
  ---
5
5
 
6
6
  <skill>
@@ -28,6 +28,7 @@ UX cues (roadmap, progress markers, depth estimates, checkpoints) are TRANSPAREN
28
28
  <principle>Cover every section of the spec template: goal, architecture, tech-stack, components, data-flow, error-handling, testing, non-goals. The roadmap shown at the start IS the coverage checklist. A section is "closed" only when its template element is fully decidable.</principle>
29
29
  <principle>YAGNI ruthlessly: prune dead branches — remove unnecessary features from every approach.</principle>
30
30
  <principle>After design is confirmed, synthesize the spec yourself. You are the expensive model — deep analysis and architectural design are your responsibility, not a subagent's.</principle>
31
+ <principle>Maintain a structured internal decision/rationale ledger during the interview. For each decision point, track: the decision, options considered, chosen option, rationale, rejected alternatives (with reasons), and any assumptions, deferred decisions, or revisit triggers. This ledger is the raw material for design-context.xml — it is synthesized from curated decisions, not reconstructed from conversation memory.</principle>
31
32
  <principle>Open the interview with a DECISION-TREE ROADMAP: show the spec template sections (goal, architecture, tech-stack, components, data-flow, error-handling, testing, non-goals) AND the major forks that may arise within each. State traversal order (highest-impact first). The purpose is predictability of the full landscape, not brevity — the user is working, so a large honest surface is welcome. Note the tree is dynamic: the branch actually taken depends on answers, but every reachable fork is shown up front.</principle>
32
33
  <principle>Mark the CURRENT SECTION on every question message (a short header). The user must always know their location in the tree. This reduces disorientation in long interviews; it does not skip content.</principle>
33
34
  <principle>After the first substantive exchange, give an HONEST DEPTH ESTIMATE (approximate decision points remaining). If the estimate is high (roughly 12–15+), do NOT shorten the interview. Surface it as a signal that the prompt/context needs upgrading: offer the user ways to provide richer context up front (existing PRD, requirements doc, reference project, voice description), or propose decomposition into sub-projects. A large estimate means MORE context, not fewer questions.</principle>
@@ -48,9 +49,33 @@ UX cues (roadmap, progress markers, depth estimates, checkpoints) are TRANSPAREN
48
49
  <rule>Do not invent new elements beyond what the template defines. The template IS the contract.</rule>
49
50
  <rule>The top-level &lt;status&gt; element is the document lifecycle status and MUST be one of: draft, approved, applied.</rule>
50
51
  <rule>When first saving the spec, set &lt;status&gt;draft&lt;/status&gt;. Only change it to approved after the user explicitly approves the final spec. Never set applied yourself; applied is reserved for vv-execute after the approved plan has been fully executed.</rule>
51
- <location>Save to .vvoc/specs/YYYY-MM-DD-&lt;name&gt;.xml</location>
52
+ <location>Canonical layout — all artifacts for one feature live in a single spec package directory:</location>
53
+ <layout>
54
+ .vvoc/specs/&lt;id&gt;/
55
+ spec.xml # normative spec document (required)
56
+ design-context.xml # curated design memory (optional)
57
+ plan.xml # implementation plan (created by vv-plan)
58
+ </layout>
59
+ <rule>Save spec.xml to .vvoc/specs/&lt;id&gt;/spec.xml. Derive &lt;id&gt; as a safe slug from the feature name (e.g., cache-store, batch-migration). Ensure the slug: (a) contains only lowercase alphanumeric characters, hyphens, and underscores; (b) does not start or end with a hyphen or underscore. Reject reserved names: draft, archive, template, plan, spec, vvoc, or names that match path-like patterns (contain /, \, .., or match an existing filesystem path separator). If .vvoc/specs/&lt;id&gt;/ already exists, check whether it is a continuation of the same draft session (same spec package from the same feature) — if yes, overwrite; if not, stop and ask the user for a different id or explicit overwrite approval. Do not silently overwrite or merge an unrelated existing package. Do not use date prefixes — the package directory is the organizational unit.</rule>
60
+ <rule>After creating or updating spec.xml, consider whether the session warrants a design-context.xml companion (see design_context section below).</rule>
52
61
  </spec_document_format>
53
62
 
63
+ <design_context>
64
+ <principle>design-context.xml is optional curated design memory. It preserves decision-relevant rationale, alternatives, scenarios, assumptions, deferred decisions, and revisit triggers — not a raw transcript or chain-of-thought dump.</principle>
65
+ <principle>spec.xml remains normative. design-context.xml is explanatory context for the planner and reviewers. It does NOT override or expand the spec.</principle>
66
+ <rule>Recommend offering design-context.xml when the session involves any of the following triggers — these are heuristics for when the companion would add value, not automatic creation rules:</rule>
67
+ <trigger>complex tradeoffs or non-obvious decisions</trigger>
68
+ <trigger>rejected alternatives worth preserving for future reference</trigger>
69
+ <trigger>external integrations or third-party constraints</trigger>
70
+ <trigger>sync, import, migration, rollback, or cutover semantics</trigger>
71
+ <trigger>fragile or time-sensitive assumptions</trigger>
72
+ <trigger>deferred decisions with explicit revisit triggers</trigger>
73
+ <trigger>the user explicitly asks to preserve reasoning or design rationale</trigger>
74
+ <rule>Load the design context template from references/design-context-template.xml. Fill only the sections that are relevant — leave unused sections empty or omit them.</rule>
75
+ <rule>Do NOT include the full interview transcript, raw conversation dumps, chain-of-thought traces, or repetitive restatements of spec.xml content.</rule>
76
+ <rule>Save design-context.xml as a sibling of spec.xml in the same spec package directory: .vvoc/specs/&lt;id&gt;/design-context.xml</rule>
77
+ </design_context>
78
+
54
79
  <self_review>
55
80
  <check>Placeholder scan: Any TBD, TODO, incomplete sections, or vague requirements? Fix them.</check>
56
81
  <check>Internal consistency: Do any sections contradict each other? Does the architecture match the component descriptions?</check>
@@ -62,6 +87,7 @@ UX cues (roadmap, progress markers, depth estimates, checkpoints) are TRANSPAREN
62
87
  <user_approval_gate>
63
88
  <rule>Present the spec document to the user.</rule>
64
89
  <rule>Wait for the user to review it. Do NOT proceed to planning until the user explicitly approves.</rule>
90
+ <rule>If a design-context.xml was proposed or created during the session, present it alongside spec.xml. Label the companion clearly as explanatory/non-normative context for planners and reviewers — spec.xml wins on any conflict. If the user requests changes, keep the spec as draft and update both spec.xml and design-context.xml as needed before re-presenting.</rule>
65
91
  <rule>If the user requests changes, keep the document status as draft, make the changes, and re-present the spec. Re-run self-review after changes.</rule>
66
92
  <rule>After explicit user approval, update the saved spec file so the top-level status is &lt;status&gt;approved&lt;/status&gt;, then present the approved document state.</rule>
67
93
  </user_approval_gate>
@@ -72,6 +98,6 @@ UX cues (roadmap, progress markers, depth estimates, checkpoints) are TRANSPAREN
72
98
  </handoff>
73
99
 
74
100
  <task>
75
- Your current task is the ongoing user request. Walk the decision tree relentlessly — one branch at a time. Propose approaches, present a design section by section, get approval at each stage. Load the spec template from references/spec-template.xml and fill every element with confirmed decisions. Save to .vvoc/specs/ as XML with document status draft. After explicit user approval, update the saved spec status to approved. Stop before any implementation or planning.
101
+ Your current task is the ongoing user request. Walk the decision tree relentlessly — one branch at a time. Propose approaches, present a design section by section, get approval at each stage. Load the spec template from references/spec-template.xml and fill every element with confirmed decisions. Save to .vvoc/specs/&lt;id&gt;/spec.xml as XML with document status draft. Optionally create .vvoc/specs/&lt;id&gt;/design-context.xml for complex sessions. After explicit user approval, update the saved spec status to approved. Stop before any implementation or planning.
76
102
  </task>
77
103
  </skill>
@@ -0,0 +1,62 @@
1
+ <design-context>
2
+ <!--
3
+ design-context.xml is optional curated design memory.
4
+ It captures decision rationale, rejected alternatives,
5
+ scenarios, fragile assumptions, deferred decisions,
6
+ and revisit triggers.
7
+
8
+ spec.xml remains normative. design-context.xml is
9
+ explanatory context for the planner and reviewers.
10
+ It is NOT read by code-generating models as a
11
+ requirements source.
12
+
13
+ Consider offering this file when the session involves:
14
+ - complex tradeoffs or non-obvious decisions
15
+ - rejected alternatives worth preserving
16
+ - external integrations or third-party constraints
17
+ - sync, import, migration, rollback, or cutover semantics
18
+ - fragile or time-sensitive assumptions
19
+ - deferred decisions with revisit triggers
20
+ - the user explicitly asks to preserve reasoning
21
+ -->
22
+ <decisions>
23
+ <decision>
24
+ <topic></topic>
25
+ <choice></choice>
26
+ <rationale></rationale>
27
+ <alternatives_considered>
28
+ <alternative>
29
+ <name></name>
30
+ <reason_rejected></reason_rejected>
31
+ </alternative>
32
+ </alternatives_considered>
33
+ </decision>
34
+ </decisions>
35
+ <assumptions>
36
+ <assumption>
37
+ <statement></statement>
38
+ <confidence></confidence>
39
+ <fragile_if></fragile_if>
40
+ </assumption>
41
+ </assumptions>
42
+ <deferred>
43
+ <item>
44
+ <decision></decision>
45
+ <why_deferred></why_deferred>
46
+ <revisit_trigger></revisit_trigger>
47
+ </item>
48
+ </deferred>
49
+ <scenarios>
50
+ <scenario>
51
+ <name></name>
52
+ <context></context>
53
+ <implications></implications>
54
+ </scenario>
55
+ </scenarios>
56
+ <external_constraints>
57
+ <constraint>
58
+ <source></source>
59
+ <impact></impact>
60
+ </constraint>
61
+ </external_constraints>
62
+ </design-context>