vgxness 1.9.3 → 1.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -138,7 +138,7 @@ Run the guided setup wizard in a TTY:
138
138
  vgxness init
139
139
  ```
140
140
 
141
- In non-TTY shells, `vgxness init` prints the same read-only setup plan instead of prompting. For a copyable happy path after installing the package globally:
141
+ In non-TTY shells, `vgxness init` prints the same read-only setup plan instead of prompting. For a copyable bootstrap and diagnostic path after installing the package globally:
142
142
 
143
143
  ```bash
144
144
  vgxness setup plan
@@ -147,6 +147,7 @@ vgxness doctor
147
147
  vgxness status --project <project> --change <change>
148
148
  vgxness next --project <project> --change <change>
149
149
  vgxness sdd continue --project <project> --change <change>
150
+ vgxness code sdd <change> <phase> --project <project> --save-artifact
150
151
  ```
151
152
 
152
153
  Stable defaults are: package `vgxness`, provider `opencode`, global user data DB, user/global OpenCode scope (`$HOME/.config/opencode/opencode.json`), and `mcp-plus-agents` mode. Use `--scope project` only when you intentionally want `<workspace>/.opencode/opencode.json`. The generated MCP command for the global DB default is:
@@ -163,7 +164,7 @@ vgxness setup apply --yes
163
164
 
164
165
  `vgxness setup plan` and `vgxness setup status` are human-readable and do not write provider config by default; local VGXNESS store initialization may occur when a command needs the selected SQLite store. `vgxness doctor`, `vgxness status`, `vgxness next`, `vgxness sdd status`, `vgxness sdd next`, `vgxness sdd continue`, and `vgxness sdd accept-artifact` are also human-readable by default. Pass `--json` when you need parseable automation output. `vgxness setup apply --yes` is the explicit provider-config write path.
165
166
 
166
- The SDD happy path is `status` -> `next` -> `sdd continue` -> `code sdd` or `resume` -> `accept-artifact` or `reopen-artifact`. `sdd continue`, top-level `status`/`next`, and `resume` are advisory/read-only surfaces; related interrupted run hints and resume candidates help the operator choose the next command but do not execute providers or retry runs. Draft-run suggestions are planning-only: human acceptance is still required, and `apply-progress` remains gated.
167
+ The daily SDD happy path is OpenCode conversation with the installed VGXNESS MCP server and hidden SDD subagents. Use CLI/TUI commands for bootstrap, setup, diagnostics, recovery, fallback, and scripting: `status`, `next`, and `sdd continue` inspect state and print manual fallback guidance; `code sdd` remains available for an explicit manual fallback run; `resume` helps inspect interrupted work. After a draft is ready, `sdd accept-artifact` records explicit human acceptance, and `sdd reopen-artifact` returns rejected artifacts to draft. Draft-run suggestions are planning-only: human acceptance is still required, and `apply-progress` remains gated.
167
168
 
168
169
  ## Code runtime (`vgxness code`)
169
170
 
@@ -182,7 +183,7 @@ Edits, shell, network, git mutations, SDD persistence, and memory saves route th
182
183
 
183
184
  - Preview, status, and plan commands do not write provider config; local VGXNESS store initialization may occur where the command needs SQLite-backed state.
184
185
  - Provider config writes require explicit `--yes` confirmation.
185
- - Setup/status TUI surfaces are preview-oriented; run copied commands explicitly when you choose to act.
186
+ - Setup/status TUI surfaces are read-only setup, diagnostics, recovery, and fallback surfaces; daily SDD progression stays in OpenCode with VGXNESS MCP.
186
187
  - SDD artifacts are SQLite-backed through VGXNESS services. Do not create or write `openspec/`.
187
188
  - `vgxness sdd accept-artifact` records explicit human-only acceptance; saving a draft never implies acceptance.
188
189
  - `vgxness sdd reopen-artifact` is the explicit path from a rejected artifact back to draft before revision.
@@ -2,7 +2,7 @@ import { canonicalBehaviorContractVersion } from '../behavior/behavior-contract-
2
2
  export const canonicalDefaultAgentName = 'vgxness-manager';
3
3
  export const canonicalOpenCodeDefaultModel = 'openai/gpt-5.5';
4
4
  export const canonicalOpenCodeManagerReasoningEffort = 'high';
5
- export const canonicalPromptContractVersion = 9;
5
+ export const canonicalPromptContractVersion = 10;
6
6
  export const canonicalSddSubagentNames = [
7
7
  'vgxness-sdd-explore',
8
8
  'vgxness-sdd-propose',
@@ -78,13 +78,25 @@ function managerDefinition() {
78
78
  builtIn: true,
79
79
  name: canonicalDefaultAgentName,
80
80
  description: 'Coordinates VGXNESS MCP state and SDD sub-agents while routing Tier 0-2 lightweight work, Tier 3 preflight validation, and Tier 4 formal SDD.',
81
- instructions: { kind: 'inline', value: registryManagerInstructionsV9 },
81
+ instructions: { kind: 'inline', value: registryManagerInstructionsV10 },
82
82
  capabilities: ['sdd-orchestration', 'agent-routing', 'mcp-coordination', 'project-local-automation'],
83
83
  permissions: { read: 'allow', edit: 'ask', shell: 'ask', git: 'ask', memory: 'allow', 'provider-tool': 'deny', secrets: 'deny' },
84
84
  memory: { scopes: ['project'] },
85
85
  workflows: ['explore', 'quickfix', 'plan', 'build', 'debug', 'sdd', 'agent-seeding', 'opencode-install'],
86
86
  skills: ['vgxness-sdd-manager'],
87
- adapters: { opencode: { model: canonicalOpenCodeDefaultModel, config: { options: { reasoningEffort: canonicalOpenCodeManagerReasoningEffort, vgxnessPromptContractVersion: canonicalPromptContractVersion, vgxnessBehaviorContractVersion: canonicalBehaviorContractVersion }, permission: { task: createCanonicalOpenCodeSddTaskPermissions() } } } },
87
+ adapters: {
88
+ opencode: {
89
+ model: canonicalOpenCodeDefaultModel,
90
+ config: {
91
+ options: {
92
+ reasoningEffort: canonicalOpenCodeManagerReasoningEffort,
93
+ vgxnessPromptContractVersion: canonicalPromptContractVersion,
94
+ vgxnessBehaviorContractVersion: canonicalBehaviorContractVersion,
95
+ },
96
+ permission: { task: createCanonicalOpenCodeSddTaskPermissions(), ...createCanonicalOpenCodeSddMcpToolPermissions() },
97
+ },
98
+ },
99
+ },
88
100
  providerSupport: commonSupport(),
89
101
  };
90
102
  }
@@ -110,6 +122,19 @@ function subagentDefinition(name) {
110
122
  export function createCanonicalOpenCodeSddTaskPermissions() {
111
123
  return Object.fromEntries([['*', 'deny'], ...canonicalSddSubagentNames.map((name) => [name, 'allow'])]);
112
124
  }
125
+ export function createCanonicalOpenCodeSddMcpToolPermissions() {
126
+ return {
127
+ vgxness_sdd_status: 'allow',
128
+ vgxness_sdd_next: 'allow',
129
+ vgxness_sdd_ready: 'allow',
130
+ vgxness_sdd_get_readiness: 'allow',
131
+ vgxness_sdd_get_artifact: 'allow',
132
+ vgxness_sdd_list_artifacts: 'allow',
133
+ vgxness_sdd_cockpit: 'allow',
134
+ vgxness_agent_resolve: 'allow',
135
+ vgxness_sdd_save_artifact: 'allow',
136
+ };
137
+ }
113
138
  export function createCanonicalOpenCodeSddSubagentPrompt(name) {
114
139
  const phase = name.replace('vgxness-sdd-', '');
115
140
  const common = `You are the VGXNESS SDD ${phase} executor, not the orchestrator. Do this phase's work yourself. Do NOT delegate, do NOT call task/delegate, and do NOT launch sub-agents. Use provided SDD artifacts, VGXNESS MCP state, and local repository evidence as needed. Retrieve full artifact content through MCP when the phase requires it; do not expect the manager to paste verbose artifacts into your prompt. Do not depend on external local skill files; this inline contract is sufficient. Preserve unrelated user work, keep output concise, and report evidence.`;
@@ -132,7 +157,7 @@ Coordinate SDD; keep chat thin, use VGXNESS MCP as durable state, delegate to th
132
157
  - SDD artifact acceptance is human-only. Never infer or fabricate acceptance from generated output, subagent/model output, file presence, confidence, or legacy artifacts. Treat draft/rejected/superseded/stale/unaccepted artifacts as not accepted until a human acceptance record exists.
133
158
  - Before phase advancement, call readiness/status tools: \`vgxness_sdd_status\`/\`vgxness_sdd_next\` and \`vgxness_sdd_ready\` or \`vgxness_sdd_get_readiness\`.
134
159
  - Before risky VGX-managed side effects (edit, shell/tests, git, network, provider-tool, secrets, external-directory, destructive, privileged, ambiguous), call \`vgxness_run_preflight\` with runId/workflow/phase/agent context when available. If approval/block is required, stop; do not invent approval.
135
- - Direct human acceptance of an exact SDD artifact via \`vgxness_sdd_accept_artifact\` is not a generic SDD write for manager routing: do not call \`vgxness_run_preflight\` solely for that acceptance when the user explicitly accepted the exact project/change/phase artifact, \`acceptedBy.type\` is \`"human"\`, \`acceptedBy.id\` is non-empty, and status/readiness confirms the artifact is eligible. This shortcut applies only to \`vgxness_sdd_accept_artifact\`, not \`vgxness_sdd_save_artifact\`, edits, shell/tests, git, provider config, memory writes, external paths, secrets, destructive/privileged/ambiguous operations.
160
+ - Direct human acceptance of an exact SDD artifact via \`vgxness_sdd_accept_artifact\` is not a generic SDD write for manager routing: do not call \`vgxness_run_preflight\` solely for that acceptance when the user explicitly accepted the exact project/change/phase artifact, \`acceptedBy.type\` is \`"human"\`, \`acceptedBy.id\` is non-empty, and status/readiness confirms the artifact is eligible. This shortcut applies only to \`vgxness_sdd_accept_artifact\` and the trusted draft autorun chain described below; it does not apply to edits, shell/tests, git, provider config, memory writes, external paths, secrets, destructive/privileged/ambiguous operations.
136
161
  - OpenCode native/provider tools are governance-v1 audit-only/non-hard-blocking. Report warnings; do not say native OpenCode tools are hard-blocked by config.
137
162
  - Do not mutate provider/global OpenCode config. Do not write to \`openspec/\`. Do not publish packages unless explicitly requested. Never revert/overwrite unrelated user work. Preserve \`permission.task\` deny-by-default with only exact known SDD subagents allowed.
138
163
  - Do not change provider model/reasoning config unless explicitly requested.
@@ -146,6 +171,7 @@ Daily SDD happens inside OpenCode through conversation, VGXNESS MCP, and hidden
146
171
  ## MCP playbook
147
172
  - For starting, resuming, or recovering context: prefer \`vgxness_context_cockpit\`; treat \`vgxness_session_restore\` as one signal, not truth. For ending, pausing, handing off, or compacting: \`vgxness_session_close\` with current session id and actor \`manager\`; if no id, do not invent one and summarize.
148
173
  - SDD artifacts: guide state with \`vgxness_sdd_next\`/\`vgxness_sdd_cockpit\`; list/read with \`vgxness_sdd_get_artifact\`/\`vgxness_sdd_list_artifacts\`; prefer \`payloadMode: "compact"\` so the primary context stays clean; use verbose only when required, preferably inside the delegated phase subagent. Save with \`vgxness_sdd_save_artifact\` only after the appropriate flow. Use \`vgxness_sdd_reopen_artifact\` only for rejected artifacts returning to draft, with explicit human actor/audit context. SDD artifacts are not generic memory.
174
+ - Trusted draft autorun: when the exact \`proposal\` artifact is already accepted, you may run exactly \`spec -> design -> tasks\` without extra human confirmation via exact hidden subagents and save drafts with \`vgxness_sdd_save_artifact\`. This is draft-only planning, not acceptance or completion. Do not use for explore/proposal/apply-progress/verify/archive, rejected/superseded artifacts, accepted overwrites, or risky side effects (provider config, edits, shell/tests, git, secrets, external/destructive/privileged/ambiguous). Re-check status/readiness before and after; generated spec/design drafts may feed downstream design/tasks but remain unaccepted.
149
175
  - Acceptance/readiness: check SDD status/readiness for the exact project/change/phase, confirm explicit human acceptance of that exact artifact, call \`vgxness_sdd_accept_artifact\` directly with audit context (\`acceptedBy.type: "human"\`, non-empty \`acceptedBy.id\`, runId, agentId), then re-check status/readiness before reporting state. Do not add \`vgxness_run_preflight\` solely for that exact direct acceptance call. Ambiguous replies count only when tied to an immediate exact acceptance prompt. Use \`vgxness_governance_report\` for readiness, artifact states, preflight posture, and audit warnings.
150
176
  - Memory: call \`vgxness_memory_search\`/\`vgxness_memory_get\` for prior work or unclear context; call \`vgxness_memory_save\` for durable discoveries, decisions, bug fixes, config, patterns, or preferences; use \`vgxness_memory_update\` only to correct/evolve a known id. Do not duplicate full SDD artifacts as memory.
151
177
  - Agents/profile/payloads: resolve exact phase with \`vgxness_agent_resolve\`. \`vgxness_agent_activate\`, \`vgxness_opencode_manager_payload\`, and \`vgxness_skill_payload\` are preview context only; agent_activate does not execute a provider or write provider config. Use \`vgxness_manager_profile_get\` before behavior changes; \`vgxness_manager_profile_set\` requires explicit human authorization.
@@ -154,7 +180,7 @@ Daily SDD happens inside OpenCode through conversation, VGXNESS MCP, and hidden
154
180
 
155
181
  ## Minimum flows
156
182
  - Simple answer: inline; memory only for prior context; no run by default.
157
- - Proposal/spec/design/tasks: status/next -> readiness -> prerequisites -> exact subagent -> delegate -> persist by governance.
183
+ - Proposal/spec/design/tasks: status/next -> readiness -> prerequisites -> exact subagent -> delegate -> persist by governance; if proposal is accepted, spec/design/tasks may run as the trusted draft autorun chain without extra confirmation, but drafts remain unaccepted.
158
184
  - Apply/verify: require prerequisites -> artifacts -> exact subagent -> start/recover run -> preflight writes/shell/git/tests -> delegate -> checkpoint -> save -> finalize.
159
185
  - Config/provider/prompt change: inspect manager/profile or payload first; persistent changes need explicit human authorization.
160
186
  - Recovery: MCP first. Continue: use \`vgxness_sdd_continue\`; read-only/advisory: no provider execution, run creation, artifact mutation, provider config/openspec writes, or acceptance/apply-progress bypass. CLI \`vgxness sdd continue\` is human fallback only. \`vgxness resume --project\` is for candidate runs; \`vgxness code sdd ... --draft-run\` is a planning-only path, never for apply-progress.
@@ -170,10 +196,10 @@ Be concise: delegated work, results, files/decisions, evidence/tests, risks, nex
170
196
  * render baselines, and manager profile overlay baselines; they are
171
197
  * intentionally distinct from the provider runtime prompt above.
172
198
  */
173
- const registryManagerInstructionsV9 = [
199
+ const registryManagerInstructionsV10 = [
174
200
  'You are the VGXNESS SDD coordinator, not a monolithic executor. Coach briefly while coordinating: explain useful tradeoffs, be realistic about risks and unknowns, respectfully challenge weak assumptions with better options, keep the user comfortable and in control, and stay concise.',
175
201
  'Use VGXNESS MCP as the durable control plane: restore session context with vgxness_session_restore before inferring start/resume state from chat, and close/pause/compact with vgxness_session_close using actor manager plus an actionable summary when a current session id exists.',
176
- 'Check SDD status/next/ready/cockpit, read prerequisites with sdd_get_artifact or sdd_list_artifacts, use public sdd_continue/internal vgxness_sdd_continue first for advisory read-only continuation plans, use sdd_reopen_artifact only for rejected artifacts returning to draft with explicit human actor/audit context, save accepted phase output with sdd_save_artifact, search/get/save/update memory only for reusable knowledge, resolve exact SDD subagents before substantial phase work, use runs/checkpoints/preflight/finalize for significant implementation or verification, use run_resume_candidates for unknown runId, inspect interrupted runs by runId with run_resume_inspect, then call run_resume_gate with approvalId from pendingApprovals/inspect; never pass runId as approvalId; use vgxness_provider_status for configured/phase/next questions plus vgxness_provider_doctor for read-only OpenCode MCP/manager health.',
202
+ 'Check SDD status/next/ready/cockpit, read prerequisites with sdd_get_artifact or sdd_list_artifacts, use public sdd_continue/internal vgxness_sdd_continue first for advisory read-only continuation plans, use sdd_reopen_artifact only for rejected artifacts returning to draft with explicit human actor/audit context, save phase output with sdd_save_artifact only by governance; when proposal is accepted, spec/design/tasks may run sequentially as draft-only autorun without extra confirmation, while acceptance remains human-only. Search/get/save/update memory only for reusable knowledge, resolve exact SDD subagents before substantial phase work, use runs/checkpoints/preflight/finalize for significant implementation or verification, use run_resume_candidates for unknown runId, inspect interrupted runs by runId with run_resume_inspect, then call run_resume_gate with approvalId from pendingApprovals/inspect; never pass runId as approvalId; use vgxness_provider_status for configured/phase/next questions plus vgxness_provider_doctor for read-only OpenCode MCP/manager health.',
177
203
  'Prefer payloadMode=compact for manager-facing status/context reads, SDD artifact reads/lists, and activation handoffs so the primary context stays clean; request payloadMode=verbose only when full artifact contents, provider payloads, or skill context are actually needed, preferably inside delegated phase subagents.',
178
204
  'MCP sdd_continue must not execute providers, create runs, mutate artifacts, write provider config/openspec, bypass human acceptance, or treat draft-run as apply-progress.',
179
205
  'CLI is an escape hatch for bootstrap, doctor, rollback, recovery, MCP unavailable/setup missing, or explicit user request; do not tell users to run terminal SDD phase commands for normal daily flow. CLI vgxness sdd continue is a human/manual fallback only; vgxness resume --project is for candidate runs, and vgxness code sdd ... --draft-run is planning-only.',
@@ -183,8 +209,8 @@ const subagentData = {
183
209
  'vgxness-sdd-explore': { seedDescription: 'Investigates codebase context and identifies options before proposals.', seedInstructions: 'You are the explore phase executor, not the orchestrator. Do not delegate. Explore repository evidence for the requested SDD change. Do not implement code changes. Return concise findings, risks, and recommended next artifacts.', capabilities: ['sdd-exploration', 'codebase-research', 'discovery'], permissions: { read: 'allow', edit: 'deny', shell: 'ask', git: 'deny', memory: 'allow', 'provider-tool': 'deny', secrets: 'deny' }, workflows: ['sdd:explore'], skills: ['vgxness-sdd-explore'], phaseContract: 'Investigate codebase context, constraints, options, and risks. Do not implement code changes. Return findings and recommended next artifacts.' },
184
210
  'vgxness-sdd-propose': { seedDescription: 'Creates focused change proposals from exploration findings.', seedInstructions: 'You are the proposal phase executor, not the orchestrator. Do not delegate. Create a focused SDD proposal from exploration evidence. Do not implement code changes. Identify scope, tradeoffs, non-goals, and acceptance direction.', capabilities: ['sdd-proposal', 'proposal-planning', 'scope-definition'], permissions: { read: 'allow', edit: 'deny', shell: 'deny', git: 'deny', memory: 'allow', 'provider-tool': 'deny', secrets: 'deny' }, workflows: ['sdd:proposal'], skills: ['vgxness-sdd-proposal'], phaseContract: 'Create or refine a focused SDD proposal from exploration evidence. Do not implement code changes. Include scope, tradeoffs, non-goals, and acceptance direction.' },
185
211
  'vgxness-sdd-spec': { seedDescription: 'Writes detailed requirements and acceptance criteria for SDD changes.', seedInstructions: 'You are the spec phase executor, not the orchestrator. Do not delegate. Write a detailed SDD specification with requirements, acceptance criteria, edge cases, and out-of-scope items. Do not implement code changes.', capabilities: ['sdd-specification', 'requirements', 'acceptance-criteria'], permissions: { read: 'allow', edit: 'deny', shell: 'deny', git: 'deny', memory: 'allow', 'provider-tool': 'deny', secrets: 'deny' }, workflows: ['sdd:spec'], skills: ['vgxness-sdd-spec'], phaseContract: 'Write requirements, acceptance criteria, edge cases, and out-of-scope items. Do not implement code changes.' },
186
- 'vgxness-sdd-design': { seedDescription: 'Creates technical design from approved specs and proposals.', seedInstructions: 'You are the design phase executor, not the orchestrator. Do not delegate. Create a technical design grounded in the repository. Identify affected modules, data shapes, risks, rollout, and verification strategy. Do not implement code changes.', capabilities: ['sdd-design', 'technical-design', 'architecture-planning'], permissions: { read: 'allow', edit: 'deny', shell: 'ask', git: 'deny', memory: 'allow', 'provider-tool': 'deny', secrets: 'deny' }, workflows: ['sdd:design'], skills: ['vgxness-sdd-design'], phaseContract: 'Create technical design grounded in the repository: affected modules, data shapes, safety, rollout, and verification. Do not implement code changes.' },
187
- 'vgxness-sdd-tasks': { seedDescription: 'Breaks specs and designs into implementation tasks.', seedInstructions: 'You are the tasks phase executor, not the orchestrator. Do not delegate. Break the SDD spec/design into small, ordered, testable implementation tasks. Do not implement code changes.', capabilities: ['sdd-tasks', 'task-breakdown', 'implementation-planning'], permissions: { read: 'allow', edit: 'deny', shell: 'deny', git: 'deny', memory: 'allow', 'provider-tool': 'deny', secrets: 'deny' }, workflows: ['sdd:tasks'], skills: ['vgxness-sdd-tasks'], phaseContract: 'Break approved spec/design into small ordered testable implementation tasks. Do not implement code changes.' },
212
+ 'vgxness-sdd-design': { seedDescription: 'Creates technical design from accepted proposals and accepted or trusted draft specs.', seedInstructions: 'You are the design phase executor, not the orchestrator. Do not delegate. Create a technical design grounded in the repository. Identify affected modules, data shapes, risks, rollout, and verification strategy. Do not implement code changes.', capabilities: ['sdd-design', 'technical-design', 'architecture-planning'], permissions: { read: 'allow', edit: 'deny', shell: 'ask', git: 'deny', memory: 'allow', 'provider-tool': 'deny', secrets: 'deny' }, workflows: ['sdd:design'], skills: ['vgxness-sdd-design'], phaseContract: 'Create technical design grounded in the repository: affected modules, data shapes, safety, rollout, and verification. You may use an accepted spec or a trusted draft spec produced in the manager autorun chain. Do not implement code changes.' },
213
+ 'vgxness-sdd-tasks': { seedDescription: 'Breaks accepted or trusted draft specs and designs into implementation tasks.', seedInstructions: 'You are the tasks phase executor, not the orchestrator. Do not delegate. Break the SDD spec/design into small, ordered, testable implementation tasks. Do not implement code changes.', capabilities: ['sdd-tasks', 'task-breakdown', 'implementation-planning'], permissions: { read: 'allow', edit: 'deny', shell: 'deny', git: 'deny', memory: 'allow', 'provider-tool': 'deny', secrets: 'deny' }, workflows: ['sdd:tasks'], skills: ['vgxness-sdd-tasks'], phaseContract: 'Break accepted or trusted draft spec/design into small ordered testable implementation tasks. Do not implement code changes.' },
188
214
  'vgxness-sdd-apply': { seedDescription: 'Implements code changes from SDD task definitions.', seedInstructions: 'You are the apply phase executor, not the orchestrator. Implement only the assigned SDD tasks directly. Do not delegate. Keep changes small, preserve unrelated user work, run focused checks when authorized, and report changed files plus verification evidence.', capabilities: ['sdd-apply', 'implementation', 'code-change'], permissions: { read: 'allow', edit: 'ask', shell: 'ask', git: 'ask', memory: 'allow', 'provider-tool': 'deny', secrets: 'deny' }, workflows: ['sdd:apply-progress'], skills: ['vgxness-sdd-apply'], phaseContract: 'Implement only assigned SDD tasks. Preserve unrelated dirty files and user work. Use focused tests when authorized. Report changed files, tests/evidence, and residual risks.' },
189
215
  'vgxness-sdd-verify': { seedDescription: 'Validates implementation against specs, tasks, and evidence.', seedInstructions: 'You are the verify phase executor, not the orchestrator. Do not delegate. Verify the implementation against SDD artifacts. Prefer focused local tests, inspect evidence, and report residual risk. Do not implement unrelated changes.', capabilities: ['sdd-verify', 'verification', 'test-review', 'risk-review'], permissions: { read: 'allow', edit: 'deny', shell: 'ask', git: 'deny', memory: 'allow', 'provider-tool': 'deny', secrets: 'deny' }, workflows: ['sdd:verify'], skills: ['vgxness-sdd-verify'], phaseContract: 'Validate implementation against SDD artifacts and task acceptance criteria. Prefer focused local tests and evidence review. Do not implement unrelated changes.' },
190
216
  'vgxness-sdd-archive': { seedDescription: 'Archives completed SDD change artifacts and outcomes.', seedInstructions: 'You are the archive phase executor, not the orchestrator. Do not delegate. Archive completed SDD artifacts and summarize final outcome, verification, and follow-ups. Confirm before writes beyond the requested archive artifact.', capabilities: ['sdd-archive', 'artifact-archive', 'release-notes'], permissions: { read: 'allow', edit: 'ask', shell: 'deny', git: 'deny', memory: 'allow', 'provider-tool': 'deny', secrets: 'deny' }, workflows: ['sdd:archive'], skills: ['vgxness-sdd-archive'], phaseContract: 'Archive completed SDD outcome with summary, verification evidence, follow-ups, and residual risks. Confirm before any repository writes beyond the requested archive artifact.' },
@@ -44,6 +44,21 @@ export function projectCanonicalAgentManifestToOpenCode(manifest = canonicalAgen
44
44
  }
45
45
  return { defaultAgent: canonicalDefaultAgentName, agents };
46
46
  }
47
+ export function withEffectiveOpenCodeManagerInstructions(projection, instructions) {
48
+ const trimmed = instructions?.trim() ?? '';
49
+ if (trimmed === '')
50
+ return projection;
51
+ const manager = projection.agents[projection.defaultAgent];
52
+ if (manager === undefined)
53
+ return projection;
54
+ return {
55
+ defaultAgent: projection.defaultAgent,
56
+ agents: {
57
+ ...projection.agents,
58
+ [projection.defaultAgent]: { ...manager, prompt: trimmed },
59
+ },
60
+ };
61
+ }
47
62
  export function projectCanonicalAgentManifestToClaudeCode(manifest = canonicalAgentManifest) {
48
63
  assertValidCanonicalManifest(manifest);
49
64
  const manager = manifest.agents.find((agent) => agent.name === manifest.defaultAgentName && agent.mode === 'agent');
@@ -72,7 +72,7 @@ Areas:
72
72
  mcp doctor [--db <path>] [--project <name>] [--change <id>] [--timeout-ms <ms>]
73
73
  MCP setup preview is read-only; it does not install or write .opencode/, .claude/, or provider config.
74
74
  Without --db, MCP install and setup commands use the vgxness global default database; pass --db .vgx/memory.sqlite for project-local compatibility.
75
- OpenCode install defaults to user/global scope and installs mcp.vgxness plus vgxness-manager and hidden vgxness-sdd-* agents; use --mcp-only for legacy MCP-only config.
75
+ OpenCode install defaults to user/global scope and installs mcp.vgxness plus permission.bash=allow, vgxness-manager, and hidden vgxness-sdd-* agents; use --mcp-only for legacy MCP-only config.
76
76
  Use --overwrite-vgxness (alias --reinstall) to reinstall only VGXNESS-managed OpenCode entries while preserving unrelated config; --yes is still required to write.
77
77
  It writes only after --yes. The default target is $HOME/.config/opencode/opencode.json; use --scope project to target .opencode/opencode.json explicitly.
78
78
  Project OpenCode config can override user config. Plans are read-only; applies refuse unsafe existing config and create backups before merge.
@@ -75,25 +75,56 @@ export function runMcpInstallCommand(parsed, environment) {
75
75
  }),
76
76
  });
77
77
  }
78
- const result = await installOpenCodeMcpClient({
79
- cwd: environment.cwd,
80
- databasePath: databasePath.value.path,
81
- databasePathSource: databasePath.value.source,
82
- scope: scope.value,
83
- env: environment.env,
84
- confirmed: parsed.flags.yes === true,
85
- mcpOnly,
86
- overwriteVgxness,
87
- });
88
- return result.status === 'installed'
89
- ? jsonResult({ ok: true, value: result })
90
- : resultFailure({
91
- ok: false,
92
- error: {
93
- code: 'validation_failed',
94
- message: `${result.reason}: ${result.message} Manual doctor command: ${result.manualTest.doctorCommand.join(' ')}`,
95
- },
78
+ if (parsed.flags.yes !== true) {
79
+ const result = await installOpenCodeMcpClient({
80
+ cwd: environment.cwd,
81
+ databasePath: databasePath.value.path,
82
+ databasePathSource: databasePath.value.source,
83
+ scope: scope.value,
84
+ env: environment.env,
85
+ confirmed: false,
86
+ mcpOnly,
87
+ overwriteVgxness,
96
88
  });
89
+ return result.status === 'installed'
90
+ ? jsonResult({ ok: true, value: result })
91
+ : resultFailure({
92
+ ok: false,
93
+ error: {
94
+ code: 'validation_failed',
95
+ message: `${result.reason}: ${result.message} Manual doctor command: ${result.manualTest.doctorCommand.join(' ')}`,
96
+ },
97
+ });
98
+ }
99
+ const opened = openCliDatabase(databasePath.value.path);
100
+ if (!opened.ok)
101
+ return resultFailure(opened);
102
+ try {
103
+ const effectiveManagerInstructions = computeEffectiveManagerInstructions(opened.value);
104
+ const result = await installOpenCodeMcpClient({
105
+ cwd: environment.cwd,
106
+ databasePath: databasePath.value.path,
107
+ databasePathSource: databasePath.value.source,
108
+ scope: scope.value,
109
+ env: environment.env,
110
+ confirmed: true,
111
+ mcpOnly,
112
+ overwriteVgxness,
113
+ ...(effectiveManagerInstructions === undefined ? {} : { effectiveManagerInstructions }),
114
+ });
115
+ return result.status === 'installed'
116
+ ? jsonResult({ ok: true, value: result })
117
+ : resultFailure({
118
+ ok: false,
119
+ error: {
120
+ code: 'validation_failed',
121
+ message: `${result.reason}: ${result.message} Manual doctor command: ${result.manualTest.doctorCommand.join(' ')}`,
122
+ },
123
+ });
124
+ }
125
+ finally {
126
+ opened.value.close();
127
+ }
97
128
  })();
98
129
  }
99
130
  function claudeInstallScopeFlag(flags) {
@@ -8,6 +8,7 @@ import { createNaturalLanguagePlan } from '../../orchestrator/natural-language-p
8
8
  import { OpenCodeInjectionPreviewService } from '../../providers/opencode/injection-preview.js';
9
9
  import { RunService } from '../../runs/run-service.js';
10
10
  import { ArtifactPortabilityService } from '../../sdd/artifact-portability-service.js';
11
+ import { buildSddCockpitSurfaceResponse } from '../../sdd/cockpit-read-model.js';
11
12
  import { normalizeSddArtifact, normalizeSddPhaseInput, sddPhases } from '../../sdd/schema.js';
12
13
  import { SddWorkflowService } from '../../sdd/sdd-workflow-service.js';
13
14
  import { SkillRegistryService } from '../../skills/skill-registry-service.js';
@@ -145,9 +146,12 @@ export function runSddCommand(command, parsed, database, environment) {
145
146
  }
146
147
  if (command === 'cockpit') {
147
148
  const cockpit = service.getCockpit({ project: project.value, change: change.value });
148
- if (!cockpit.ok || parsed.flags.json === true)
149
+ if (!cockpit.ok)
149
150
  return jsonResult(cockpit);
150
- return okText(renderSddCockpit(cockpit.value));
151
+ const surface = buildSddCockpitSurfaceResponse(cockpit.value);
152
+ if (parsed.flags.json === true)
153
+ return jsonResult({ ok: true, value: surface });
154
+ return okText(renderSddCockpit(surface));
151
155
  }
152
156
  if (command === 'ready') {
153
157
  const phase = requiredFlag(parsed.flags, 'phase');
@@ -1,5 +1,6 @@
1
1
  import { resolve } from 'node:path';
2
2
  import { AgentRegistryService } from '../../agents/agent-registry-service.js';
3
+ import { computeEffectiveManagerInstructions } from '../../agents/manager-profile-overlay-service.js';
3
4
  import { resolveAgentProfileModel } from '../../agents/profile-model-routing.js';
4
5
  import { installOpenCodeMcpClient } from '../../mcp/client-install-opencode.js';
5
6
  import { createMcpClientSetupPreview } from '../../mcp/client-setup-preview.js';
@@ -144,16 +145,27 @@ export async function applySetupPlanInput(input, environment) {
144
145
  plan: plan.value,
145
146
  },
146
147
  };
147
- const result = await installOpenCodeMcpClient({
148
- cwd: environment.cwd,
149
- databasePath: plan.value.db.path,
150
- databasePathSource: plan.value.db.source === 'global-default' || plan.value.db.source === 'environment' ? plan.value.db.source : 'flag',
151
- scope: input.scope ?? vgxnessSetupDefaults.defaultOpenCodeScope,
152
- env: environment.env,
153
- confirmed: true,
154
- mcpOnly: input.installMode === 'mcp-only',
155
- ...(input.overwriteVgxness === undefined ? {} : { overwriteVgxness: input.overwriteVgxness }),
156
- });
148
+ const opened = openCliDatabase(plan.value.db.path);
149
+ if (!opened.ok)
150
+ return opened;
151
+ let result;
152
+ try {
153
+ const effectiveManagerInstructions = computeEffectiveManagerInstructions(opened.value, input.project);
154
+ result = await installOpenCodeMcpClient({
155
+ cwd: environment.cwd,
156
+ databasePath: plan.value.db.path,
157
+ databasePathSource: plan.value.db.source === 'global-default' || plan.value.db.source === 'environment' ? plan.value.db.source : 'flag',
158
+ scope: input.scope ?? vgxnessSetupDefaults.defaultOpenCodeScope,
159
+ env: environment.env,
160
+ confirmed: true,
161
+ mcpOnly: input.installMode === 'mcp-only',
162
+ ...(input.overwriteVgxness === undefined ? {} : { overwriteVgxness: input.overwriteVgxness }),
163
+ ...(effectiveManagerInstructions === undefined ? {} : { effectiveManagerInstructions }),
164
+ });
165
+ }
166
+ finally {
167
+ opened.value.close();
168
+ }
157
169
  return result.status === 'installed'
158
170
  ? {
159
171
  ok: true,
@@ -1,4 +1,5 @@
1
1
  export function renderProductStatus(status) {
2
+ const commandHeading = productCommandHeading(status);
2
3
  const lines = [
3
4
  'Status',
4
5
  ...status.status.map((line) => `- ${line}`),
@@ -9,7 +10,7 @@ export function renderProductStatus(status) {
9
10
  'Next',
10
11
  ...status.next.map((line) => `- ${line}`),
11
12
  '',
12
- 'Command',
13
+ commandHeading,
13
14
  `- ${status.command}`,
14
15
  '',
15
16
  ...(status.relatedRunContext === undefined ? [] : relatedRunContextLines(status.relatedRunContext, true)),
@@ -43,6 +44,7 @@ function buildBlockedNextCommand(status) {
43
44
  return `vgxness next --project ${status.project.value} --change ${change}${dbHint}`;
44
45
  }
45
46
  export function renderProductNext(next) {
47
+ const commandHeading = next.blocked ? 'Recovery/diagnostic command' : 'Manual fallback command';
46
48
  const lines = [
47
49
  'Next',
48
50
  ...next.next.map((line) => `- ${line}`),
@@ -51,7 +53,7 @@ export function renderProductNext(next) {
51
53
  ...next.why.map((line) => `- ${line}`),
52
54
  ...(next.blockers.length === 0 ? [] : ['', 'Blockers', ...next.blockers.map((line) => `- ${line}`)]),
53
55
  '',
54
- 'Command',
56
+ commandHeading,
55
57
  `- ${next.command}`,
56
58
  '',
57
59
  ...(next.relatedRunContext === undefined ? [] : relatedRunContextLines(next.relatedRunContext, true)),
@@ -60,6 +62,11 @@ export function renderProductNext(next) {
60
62
  ];
61
63
  return `${lines.join('\n')}\n`;
62
64
  }
65
+ function productCommandHeading(status) {
66
+ if (status.sddNextStatus === 'runnable')
67
+ return 'Manual fallback command';
68
+ return 'Recovery/diagnostic command';
69
+ }
63
70
  function relatedRunContextLines(relatedRunContext, includeTrailingBlank) {
64
71
  return [
65
72
  'Related interrupted run:',
@@ -10,7 +10,8 @@ export function renderSddStatus(input) {
10
10
  ? 'No next SDD phase remains for this change.'
11
11
  : input.status.nextReadyPhase === undefined
12
12
  ? 'Review blockers or accept present draft artifacts before continuing.'
13
- : `Run or draft the ${input.status.nextReadyPhase} phase with ${directPhaseCommand}.`;
13
+ : `Continue the ${input.status.nextReadyPhase} phase in OpenCode using VGXNESS MCP and hidden SDD subagents.`;
14
+ const commandLabel = directPhaseCommand === undefined ? 'Diagnostic command' : 'Manual fallback command';
14
15
  const lines = [
15
16
  'SDD Status',
16
17
  `Project: ${input.project}`,
@@ -28,7 +29,7 @@ export function renderSddStatus(input) {
28
29
  ...(missing.length === 0 ? ['- none'] : missing.map((topicKey) => `- ${topicKey}`)),
29
30
  '',
30
31
  `Recommended action: ${recommendedAction}`,
31
- `Command: ${directPhaseCommand ?? `vgxness sdd next --project ${input.project} --change ${input.status.change}`}`,
32
+ `${commandLabel}: ${directPhaseCommand ?? `vgxness sdd next --project ${input.project} --change ${input.status.change}`}`,
32
33
  `JSON: vgxness sdd status --project ${input.project} --change ${input.status.change} --json`,
33
34
  ];
34
35
  return `${lines.join('\n')}\n`;
@@ -40,6 +41,10 @@ export function renderSddNext(input) {
40
41
  const commandGuidance = input.decision.status === 'runnable' && input.decision.nextPhase !== undefined
41
42
  ? `vgxness code sdd ${input.decision.change} ${input.decision.nextPhase} --save-artifact`
42
43
  : `vgxness sdd status --project ${input.project} --change ${input.decision.change}`;
44
+ const commandLabel = input.decision.status === 'runnable' && input.decision.nextPhase !== undefined ? 'Manual fallback command' : 'Diagnostic command';
45
+ const primaryAction = input.decision.status === 'runnable' && input.decision.nextPhase !== undefined
46
+ ? `Continue the ${input.decision.nextPhase} phase in OpenCode using VGXNESS MCP and hidden SDD subagents.`
47
+ : input.decision.recommendedAction;
43
48
  const lines = [
44
49
  'SDD Next',
45
50
  `Project: ${input.project}`,
@@ -64,13 +69,14 @@ export function renderSddNext(input) {
64
69
  'Next actions:',
65
70
  ...(guidance.length === 0 ? ['- none'] : guidance.map((item) => `- ${item.phase}: ${item.action}`)),
66
71
  '',
67
- `Recommended action: ${input.decision.recommendedAction}`,
68
- `Command: ${commandGuidance}`,
72
+ `Recommended action: ${primaryAction}`,
73
+ `${commandLabel}: ${commandGuidance}`,
69
74
  `JSON: vgxness sdd next --project ${input.project} --change ${input.decision.change} --json`,
70
75
  ];
71
76
  return `${lines.join('\n')}\n`;
72
77
  }
73
78
  export function renderSddContinuationPlan(plan) {
79
+ const suggestedCommandLabel = plan.status === 'runnable' ? 'Manual fallback command' : 'Diagnostic command';
74
80
  const lines = [
75
81
  'SDD Continue (read-only)',
76
82
  `Project: ${plan.project}`,
@@ -81,17 +87,17 @@ export function renderSddContinuationPlan(plan) {
81
87
  `Reason: ${plan.reason}`,
82
88
  '',
83
89
  'Recommended plan:',
84
- `- ${plan.recommendedAction}`,
85
- `- Suggested command: ${plan.suggestedCommand}`,
86
- `- Inspect command: ${plan.inspectCommand}`,
90
+ `- ${plan.status === 'runnable' && plan.nextPhase !== undefined ? `Continue the ${plan.nextPhase} phase in OpenCode using VGXNESS MCP and hidden SDD subagents.` : plan.recommendedAction}`,
91
+ `- ${suggestedCommandLabel}: ${plan.suggestedCommand}`,
92
+ `- Diagnostic command: ${plan.inspectCommand}`,
87
93
  '',
88
94
  'Blocker-specific next actions:',
89
95
  ...(plan.blockerActions.length === 0
90
96
  ? ['- none']
91
97
  : plan.blockerActions.map((item) => {
92
- const draftRun = item.draftRunCommand === undefined ? '' : `; draftRunCommand=${item.draftRunCommand}`;
98
+ const draftRun = item.draftRunCommand === undefined ? '' : `; manualFallbackCommand=${item.draftRunCommand}`;
93
99
  const warning = item.warning === undefined ? '' : `; warning=${item.warning}`;
94
- return `- ${item.phase}: ${item.action}; command=${item.command}${draftRun}${warning}`;
100
+ return `- ${item.phase}: ${item.action}; recoveryCommand=${item.command}${draftRun}${warning}`;
95
101
  })),
96
102
  '',
97
103
  ...(plan.relatedRunContext === undefined
@@ -114,21 +120,28 @@ export function renderSddContinuationPlan(plan) {
114
120
  return `${lines.join('\n')}\n`;
115
121
  }
116
122
  export function renderSddCockpit(cockpit) {
117
- const blockers = cockpit.aggregateBlockers;
123
+ const readModel = cockpit.readModel;
124
+ const blockers = readModel.blockers;
118
125
  const lines = [
119
126
  'SDD Cockpit (read-only)',
120
- `Project: ${cockpit.project}`,
121
- `Change: ${cockpit.change}`,
122
- `Actionable phase: ${cockpit.actionablePhase ?? 'none'}`,
123
- `Next: ${cockpit.next.status}${cockpit.next.nextPhase === undefined ? '' : ` / ${cockpit.next.nextPhase}`}`,
124
- `Recommended action: ${cockpit.recommendedAction}`,
125
- `Accepted: ${cockpit.acceptedCount}/${cockpit.phases.length}`,
126
- `Legacy artifacts: ${cockpit.legacyCount}`,
127
- '',
128
- 'Aggregate blockers:',
127
+ `Project: ${readModel.project}`,
128
+ `Change: ${readModel.change}`,
129
+ `Next action: ${readModel.nextAction.kind}${readModel.nextAction.phase === undefined ? '' : ` / ${readModel.nextAction.phase}`}`,
130
+ `Recommended action: ${readModel.nextAction.label}`,
131
+ `Content included: ${readModel.contentIncluded ? 'yes' : 'no'}`,
132
+ `Accepted: ${readModel.summary.acceptedArtifacts}/${readModel.summary.totalPhases}`,
133
+ `Legacy artifacts: ${readModel.summary.legacyArtifacts}`,
134
+ '',
135
+ 'Phases:',
136
+ ...readModel.phases.map((phase) => `- ${phase.phase}: status=${phase.artifact.status}; accepted=${phase.acceptance.acceptedByHuman ? 'human' : 'no'}; content=${phase.artifact.contentAvailable ? 'metadata-only' : 'none'}; topic=${phase.topicKey}`),
137
+ '',
138
+ 'Blockers:',
129
139
  ...(blockers.length === 0
130
140
  ? ['- none']
131
- : blockers.map((blocker) => `- ${blocker.kind}: ${blocker.phase} at ${blocker.topicKey} - ${blocker.reason}${blocker.action === undefined ? '' : `; action=${blocker.action}`}`)),
141
+ : blockers.map((blocker) => `- ${blocker.severity}/${blocker.code}: ${blocker.phase ?? 'change'} at ${blocker.topicKey ?? '-'} - ${blocker.message}${blocker.action === undefined ? '' : `; action=${blocker.action}`}`)),
142
+ '',
143
+ 'Guidance:',
144
+ ...readModel.guidance.map((item) => `- ${item}`),
132
145
  '',
133
146
  `Inspect: ${cockpit.inspectCommand}`,
134
147
  `Cockpit JSON: ${cockpit.inspectCommand}`,
@@ -11,10 +11,10 @@ const statCards = [
11
11
  { label: 'actions', value: '5', badge: '', description: 'safe routes' },
12
12
  { label: 'provider', value: '1', badge: '', description: 'OpenCode' },
13
13
  { label: 'writes', value: '0', badge: '', description: 'dashboard render' },
14
- { label: 'SDD', value: 'guided', badge: '', description: 'MCP flow' },
14
+ { label: 'SDD', value: 'OpenCode', badge: '', description: 'daily surface' },
15
15
  ];
16
16
  const statusSnapshotLines = [
17
- 'OpenCode supported; dashboard does not call providers.',
17
+ 'OpenCode + VGXNESS MCP is the daily SDD surface; dashboard does not call providers.',
18
18
  'Advanced checks stay explicit: setup status, mcp doctor opencode.',
19
19
  ];
20
20
  const optionCopy = {
@@ -34,17 +34,17 @@ const optionCopy = {
34
34
  },
35
35
  sdd: {
36
36
  label: 'SDD workflow',
37
- description: 'artifacts, phases, next step',
37
+ description: 'diagnostics, recovery, fallback',
38
38
  badges: [tuiBadges.previewOnly],
39
39
  detailTitle: 'SDD workflow',
40
- detailLines: ['Use OpenCode conversation plus VGXNESS MCP for daily progression.'],
40
+ detailLines: ['Use OpenCode conversation plus VGXNESS MCP and hidden SDD subagents for daily progression; this TUI stays read-only for setup, diagnostics, recovery, and fallback commands.'],
41
41
  },
42
42
  'advanced-cli': {
43
43
  label: 'Advanced CLI',
44
- description: 'manual commands, no automation',
44
+ description: 'fallback scripts, no automation',
45
45
  badges: [tuiBadges.manual],
46
46
  detailTitle: 'Advanced CLI',
47
- detailLines: ['Prints explicit command references; no provider config is written.'],
47
+ detailLines: ['Prints explicit diagnostic, recovery, fallback, and scripting command references; no provider config is written.'],
48
48
  },
49
49
  exit: {
50
50
  label: 'Quit',
@@ -62,13 +62,13 @@ export function buildMainMenuViewModel(state) {
62
62
  subtitle: dashboardHero.subtitle,
63
63
  hero: dashboardHero,
64
64
  statCards,
65
- contextLines: ['Pick a route. Dashboard render stays passive/read-only.'],
65
+ contextLines: ['Pick a route. Dashboard render stays passive/read-only; daily SDD continues in OpenCode.'],
66
66
  options,
67
67
  detail: { title: focused.detailTitle, lines: focused.detailLines, badges: focused.badges },
68
68
  statusSnapshot: { title: 'Signal', lines: statusSnapshotLines, badges: [tuiBadges.readOnly] },
69
69
  safetyLines: ['read-only • no provider writes • explicit confirmation'],
70
70
  helpLines: state.helpVisible
71
- ? ['Keys: ↑/↓ or j/k move, Enter open, ?/h help, q/Esc quit.', 'Guidance entries print commands only; setup writes still require confirmation.']
71
+ ? ['Keys: ↑/↓ or j/k move, Enter open, ?/h help, q/Esc quit.', 'Guidance entries print fallback/diagnostic commands only; setup writes still require confirmation.']
72
72
  : [],
73
73
  footer: state.viewport.mode === 'narrow' ? 'no provider writes • explicit confirmation' : 'j/k • enter • q • no provider writes • explicit confirmation',
74
74
  };
@@ -1,4 +1,7 @@
1
+ import { computeEffectiveManagerInstructions } from '../../../agents/manager-profile-overlay-service.js';
1
2
  import { installOpenCodeMcpClient } from '../../../mcp/client-install-opencode.js';
3
+ import { openMemoryDatabase } from '../../../memory/sqlite/database.js';
4
+ import { prepareMemoryDatabasePath } from '../../../memory/storage-paths.js';
2
5
  import { vgxnessSetupDefaults } from '../../../setup/setup-defaults.js';
3
6
  import { createSetupPlan } from '../../../setup/setup-plan.js';
4
7
  export function setupPlanInputFromTui(input) {
@@ -37,16 +40,30 @@ export async function applySetupTuiPlan(planInput, runtime) {
37
40
  };
38
41
  if (plan.value.status !== 'ready')
39
42
  return { ok: false, error: { code: 'validation_failed', message: `Setup plan is ${plan.value.status}; resolve blockers before applying.` } };
40
- const installed = await installOpenCodeMcpClient({
41
- cwd: runtime.cwd,
42
- databasePath: plan.value.db.path,
43
- databasePathSource: plan.value.db.source === 'global-default' || plan.value.db.source === 'environment' ? plan.value.db.source : 'flag',
44
- scope: planInput.scope ?? vgxnessSetupDefaults.defaultOpenCodeScope,
45
- env: runtime.env,
46
- confirmed: true,
47
- mcpOnly: planInput.installMode === 'mcp-only',
48
- ...(planInput.overwriteVgxness === undefined ? {} : { overwriteVgxness: planInput.overwriteVgxness }),
49
- });
43
+ const prepared = prepareMemoryDatabasePath(plan.value.db.path);
44
+ if (!prepared.ok)
45
+ return prepared;
46
+ const opened = openMemoryDatabase({ path: plan.value.db.path });
47
+ if (!opened.ok)
48
+ return opened;
49
+ let installed;
50
+ try {
51
+ const effectiveManagerInstructions = computeEffectiveManagerInstructions(opened.value, planInput.project);
52
+ installed = await installOpenCodeMcpClient({
53
+ cwd: runtime.cwd,
54
+ databasePath: plan.value.db.path,
55
+ databasePathSource: plan.value.db.source === 'global-default' || plan.value.db.source === 'environment' ? plan.value.db.source : 'flag',
56
+ scope: planInput.scope ?? vgxnessSetupDefaults.defaultOpenCodeScope,
57
+ env: runtime.env,
58
+ confirmed: true,
59
+ mcpOnly: planInput.installMode === 'mcp-only',
60
+ ...(planInput.overwriteVgxness === undefined ? {} : { overwriteVgxness: planInput.overwriteVgxness }),
61
+ ...(effectiveManagerInstructions === undefined ? {} : { effectiveManagerInstructions }),
62
+ });
63
+ }
64
+ finally {
65
+ opened.value.close();
66
+ }
50
67
  if (installed.status !== 'installed')
51
68
  return { ok: false, error: { code: 'validation_failed', message: `${installed.reason}: ${installed.message}` } };
52
69
  return {