vgxness 1.20.15 → 1.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/README.md +11 -10
  2. package/dist/adapters/claude/install/claude-code-agent-config.js +1 -1
  3. package/dist/adapters/claude/install/claude-code-project-memory.js +1 -1
  4. package/dist/adapters/claude/install/claude-code-user-memory.js +1 -1
  5. package/dist/adapters/claude/install/client-install-claude-code-contract.js +1 -1
  6. package/dist/adapters/opencode/install/client-install-opencode-contract.js +1 -1
  7. package/dist/adapters/opencode/install/client-install-opencode.js +72 -6
  8. package/dist/adapters/opencode/install/opencode-default-agent-config.js +91 -2
  9. package/dist/application/agents/agent-resolver.js +1 -1
  10. package/dist/application/memory/import/observation-writer.js +2 -2
  11. package/dist/application/memory/import/package.js +1 -1
  12. package/dist/application/provider-setup/provider-change-plan.js +1 -1
  13. package/dist/application/runs/run-service.js +1 -1
  14. package/dist/application/sdd/sdd-continuation-plan.js +4 -3
  15. package/dist/application/skills/skill-registry-service.js +1 -1
  16. package/dist/application/skills/skill-resolver.js +3 -3
  17. package/dist/cli/bun-bin.js +1 -1
  18. package/dist/domain/agents/canonical-agent-manifest.js +13 -12
  19. package/dist/governance/governance-report-builder.js +1 -1
  20. package/dist/interfaces/cli/bun-bin.js +1 -1
  21. package/dist/interfaces/cli/cli-flags.js +2 -2
  22. package/dist/interfaces/cli/cli-help.js +6 -4
  23. package/dist/interfaces/cli/cli-helpers.js +2 -2
  24. package/dist/interfaces/cli/commands/agent-skill-dispatcher.js +10 -10
  25. package/dist/interfaces/cli/commands/knowledge-workspace-dispatcher.js +1 -1
  26. package/dist/interfaces/cli/commands/mcp-dispatcher.js +3 -3
  27. package/dist/interfaces/cli/commands/memory-sdd-dispatcher.js +11 -11
  28. package/dist/interfaces/cli/commands/run-permission-dispatcher.js +4 -4
  29. package/dist/interfaces/cli/commands/setup-dispatcher.js +3 -3
  30. package/dist/interfaces/cli/commands/status-dispatcher.js +4 -4
  31. package/dist/interfaces/cli/commands/verification-dispatcher.js +2 -2
  32. package/dist/interfaces/cli/commands/workflow-dispatcher.js +4 -4
  33. package/dist/interfaces/cli/dispatcher.js +1 -1
  34. package/dist/interfaces/cli/home-tui-app.js +2 -2
  35. package/dist/interfaces/cli/home-tui-controller.js +8 -8
  36. package/dist/interfaces/cli/mcp-start-path.js +1 -1
  37. package/dist/interfaces/cli/sdd-renderer.js +8 -5
  38. package/dist/interfaces/cli/setup-tui-controller.js +1 -1
  39. package/dist/interfaces/cli/verification-plan-renderer.js +2 -0
  40. package/dist/interfaces/cli/verification-report-renderer.js +1 -1
  41. package/dist/interfaces/mcp/control-plane/handlers/memory.js +1 -1
  42. package/dist/interfaces/mcp/control-plane/handlers/runs.js +1 -1
  43. package/dist/interfaces/mcp/control-plane/handlers/sdd.js +3 -3
  44. package/dist/interfaces/mcp/control-plane/handlers/sessions.js +1 -1
  45. package/dist/interfaces/mcp/control-plane.js +13 -13
  46. package/dist/interfaces/mcp/schemas/common.js +1 -1
  47. package/dist/interfaces/mcp/stdio-server.js +1 -1
  48. package/dist/interfaces/mcp/validation/common.js +1 -1
  49. package/dist/interfaces/mcp/validation/runs.js +1 -1
  50. package/dist/mcp/control-plane-snapshot-service.js +1 -1
  51. package/dist/mcp/doctor.js +1 -1
  52. package/dist/mcp/provider-canonical-agent-manifest.js +2 -2
  53. package/dist/mcp/resume-context-gate-service.js +1 -1
  54. package/dist/permissions/policy-evaluator.js +1 -1
  55. package/dist/providers/opencode/injection-preview.js +1 -1
  56. package/dist/providers/opencode/manager-payload.js +2 -2
  57. package/dist/setup/backup-rollback-service.js +2 -0
  58. package/dist/setup/setup-plan.js +1 -1
  59. package/dist/status/product-status.js +2 -1
  60. package/dist/verification/verification-plan-service.js +5 -1
  61. package/dist/verification/verification-report-service.js +1 -1
  62. package/dist/workflows/command-allowlist-adapter.js +1 -1
  63. package/docs/architecture.md +19 -19
  64. package/docs/cli.md +2 -2
  65. package/docs/glossary.md +1 -1
  66. package/docs/mcp.md +4 -1
  67. package/docs/module-boundaries.md +0 -2
  68. package/docs/providers.md +6 -6
  69. package/docs/roadmap.md +4 -4
  70. package/docs/safety.md +2 -2
  71. package/docs/sdd-flow.es.md +23 -19
  72. package/docs/sdd-flow.md +15 -20
  73. package/package.json +7 -3
  74. package/dist/agents/agent-activation-service.js +0 -1
  75. package/dist/agents/agent-lookup-contexts.js +0 -1
  76. package/dist/agents/agent-registry-service.js +0 -1
  77. package/dist/agents/agent-resolver.js +0 -1
  78. package/dist/agents/agent-seed-service.js +0 -1
  79. package/dist/agents/agent-seed-upgrade-service.js +0 -1
  80. package/dist/agents/agent-selector-resolver.js +0 -1
  81. package/dist/agents/boot-upgrade.js +0 -1
  82. package/dist/agents/canonical-agent-manifest.js +0 -1
  83. package/dist/agents/canonical-agent-projection.js +0 -1
  84. package/dist/agents/manager-profile-overlay-service.js +0 -1
  85. package/dist/agents/profile-model-routing.js +0 -1
  86. package/dist/agents/renderers/claude-renderer.js +0 -1
  87. package/dist/agents/renderers/index.js +0 -1
  88. package/dist/agents/renderers/json-renderer.js +0 -1
  89. package/dist/agents/renderers/opencode-renderer.js +0 -1
  90. package/dist/agents/renderers/provider-adapter.js +0 -1
  91. package/dist/agents/repositories/agent-seed-history.js +0 -1
  92. package/dist/agents/repositories/agents.js +0 -1
  93. package/dist/agents/repositories/manager-profile-overlays.js +0 -1
  94. package/dist/agents/schema.js +0 -1
  95. package/dist/memory/active-work-preview.js +0 -1
  96. package/dist/memory/active-work-topics.js +0 -1
  97. package/dist/memory/agent-memory-capture-service.js +0 -1
  98. package/dist/memory/import/dry-run-planner.js +0 -1
  99. package/dist/memory/import/index.js +0 -1
  100. package/dist/memory/import/observation-writer.js +0 -1
  101. package/dist/memory/import/package.js +0 -1
  102. package/dist/memory/memory-capture-schema.js +0 -1
  103. package/dist/memory/memory-service.js +0 -1
  104. package/dist/memory/repositories/artifacts.js +0 -1
  105. package/dist/memory/repositories/observations.js +0 -1
  106. package/dist/memory/repositories/sessions.js +0 -1
  107. package/dist/memory/repositories/traces.js +0 -1
  108. package/dist/memory/schema.js +0 -1
  109. package/dist/memory/search.js +0 -1
  110. package/dist/memory/sqlite/database.js +0 -1
  111. package/dist/memory/storage-paths.js +0 -1
  112. package/dist/permissions/index.js +0 -2
  113. package/dist/runs/execution-planning.js +0 -1
  114. package/dist/runs/operation-execution.js +0 -1
  115. package/dist/runs/operation-retry.js +0 -1
  116. package/dist/runs/repositories/runs.js +0 -1
  117. package/dist/runs/repositories/task-scoped-command-grants.js +0 -1
  118. package/dist/runs/resume-after-approval-result.js +0 -1
  119. package/dist/runs/run-insights.js +0 -1
  120. package/dist/runs/run-service.js +0 -1
  121. package/dist/runs/run-snapshot-export-service.js +0 -1
  122. package/dist/runs/sandbox-process-execution.js +0 -1
  123. package/dist/runs/sandbox-worktree-planning.js +0 -1
  124. package/dist/runs/schema.js +0 -1
  125. package/dist/runs/task-scoped-command-grant-service.js +0 -1
  126. package/dist/sdd/artifact-portability-service.js +0 -1
  127. package/dist/sdd/cockpit-read-model.js +0 -1
  128. package/dist/sdd/cockpit-types.js +0 -1
  129. package/dist/sdd/schema.js +0 -1
  130. package/dist/sdd/sdd-continuation-plan.js +0 -1
  131. package/dist/sdd/sdd-workflow-service.js +0 -1
  132. package/dist/setup/index.js +0 -3
  133. package/dist/skills/boot-seed.js +0 -1
  134. package/dist/skills/personal-skills.js +0 -1
  135. package/dist/skills/repositories/skill-evaluation-requests.js +0 -1
  136. package/dist/skills/repositories/skill-evaluation-scenarios.js +0 -1
  137. package/dist/skills/repositories/skill-improvement-proposals.js +0 -1
  138. package/dist/skills/repositories/skills.js +0 -1
  139. package/dist/skills/schema.js +0 -1
  140. package/dist/skills/skill-export-service.js +0 -1
  141. package/dist/skills/skill-index-service.js +0 -1
  142. package/dist/skills/skill-payload.js +0 -1
  143. package/dist/skills/skill-registry-service.js +0 -1
  144. package/dist/skills/skill-resolver.js +0 -1
  145. package/dist/skills/skill-seed-service.js +0 -1
  146. package/dist/skills/skill-status-service.js +0 -1
package/README.md CHANGED
@@ -1,14 +1,14 @@
1
1
  # VGXNESS
2
2
 
3
- VGXNESS is an installable CLI and MCP control plane for guided AI-agent workflows, SDD artifacts, local memory, and OpenCode integration.
3
+ VGXNESS is an installable, local-first governance OS and MCP/CLI control plane for existing coding agents. It governs SDD artifacts, local memory, runs, permissions, skills, provider setup, and verification evidence while OpenCode, Claude Code, and future adapters keep executing provider-native.
4
4
 
5
5
  ## Release status and license
6
6
 
7
7
  This package is proprietary software. The npm package ships inspectable JavaScript (`dist/`) so Node can run it, but it is **not open-source licensed** and may not be redistributed unless you have written permission. See [LICENSE](./LICENSE).
8
8
 
9
- OpenCode is the primary supported provider. Claude setup support is secondary. VGX-managed OpenCode and Claude provider configuration is user-global only; provider config writes require explicit CLI confirmation.
9
+ OpenCode is the primary supported provider. Claude Code setup support is secondary/preview guidance. VGX-managed OpenCode and Claude provider configuration is user-global only; provider config writes require explicit CLI confirmation.
10
10
 
11
- VGXNESS is currently versioned from `package.json` (`1.20.0`). The latest full project health audit is the historical [v1.14.x snapshot](./docs/project-health-audit-v1.14.x.md), which documents the implemented CLI/MCP/SDD control plane, OpenCode-first workflow, release-readiness checks, and the remaining execution/recovery gaps at that point in time. [v1.10.x](./docs/project-health-audit-v1.10.x.md) and [v1.9.1](./docs/project-health-audit-v1.9.1.md) remain historical validation evidence for those releases.
11
+ VGXNESS is versioned from `package.json`. The latest full project health audit is the historical [v1.14.x snapshot](./docs/project-health-audit-v1.14.x.md), which documents the implemented CLI/MCP/SDD governance control plane, OpenCode-first workflow, release-readiness checks, and the remaining execution/recovery gaps at that point in time. [v1.10.x](./docs/project-health-audit-v1.10.x.md) and [v1.9.1](./docs/project-health-audit-v1.9.1.md) remain historical validation evidence for those releases.
12
12
 
13
13
  ## Requirements
14
14
 
@@ -163,7 +163,7 @@ vgxness setup apply --yes
163
163
 
164
164
  `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
165
 
166
- The daily SDD happy path is OpenCode conversation with the installed VGXNESS MCP server and hidden SDD subagents. Use CLI commands for bootstrap, setup, diagnostics, recovery, fallback, and scripting: `status`, `next`, and `sdd continue` inspect state and print read-only continuation guidance; `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.
166
+ The daily SDD happy path is an OpenCode conversation with the installed VGXNESS MCP server and provider-native hidden SDD subagents. VGXNESS supplies the governance state and guardrails; OpenCode executes the agent loop. Use CLI commands for bootstrap, setup, diagnostics, recovery, fallback, and scripting: `status`, `next`, and `sdd continue` inspect state and print read-only continuation guidance; `resume` helps inspect interrupted work. In the normal organic flow, proposal acceptance is the first mandatory human continue gate; after that, `spec -> design -> tasks` can be drafted without separate confirmations, then VGXNESS asks before apply/implementation. `sdd accept-artifact` records explicit human-only acceptance when a real gate applies, and `sdd reopen-artifact` returns rejected artifacts to draft.
167
167
 
168
168
  Copy this prompt into OpenCode for normal daily SDD work:
169
169
 
@@ -171,24 +171,25 @@ Copy this prompt into OpenCode for normal daily SDD work:
171
171
  Continue VGXNESS SDD for project <project> and change <change>.
172
172
  Use the VGXNESS MCP tools to inspect status/readiness/artifacts, then delegate phase work to the exact hidden SDD subagent when needed.
173
173
  Save draft artifacts when appropriate and report evidence, tests, blockers, and the next human decision.
174
- Do not accept or reopen artifacts for me; ask me before any human-only, provider-config, git, destructive, external, install, or secret-sensitive action.
174
+ Treat proposal acceptance as the first mandatory human continue gate; after that, draft spec/design/tasks without separate confirmations, then ask before apply/implementation.
175
+ Do not accept or reopen artifacts for me; ask before provider/global config, git/publish, destructive, external, privileged, install, network, secret-sensitive, or official archive actions.
175
176
  ```
176
177
 
177
178
  ## Code runtime status
178
179
 
179
- The experimental `vgxness code` runtime and principal OpenTUI code surface have been removed temporarily because they were copied OpenCode-like runtime work. Continue SDD work in OpenCode through VGXNESS MCP, and use the safe CLI commands above for diagnostics and recovery.
180
+ The experimental `vgxness code` runtime and principal OpenTUI code surface have been removed and are not the default product direction. Continue SDD work in OpenCode through VGXNESS MCP, and use the safe CLI commands above for diagnostics and recovery. Reintroducing a first-party coding-agent runtime would require a separate accepted SDD change.
180
181
 
181
182
  ## Safety model
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
  - VGX-managed OpenCode and Claude provider config writes are user-global only and require explicit `--yes` confirmation.
185
186
  - Runtime VGXNESS state remains project-aware; project-local provider files are read-only external/manual diagnostics and may still affect provider behavior outside VGXNESS.
186
- - Setup/status TUI surfaces are read-only setup, diagnostics, recovery, and fallback surfaces; daily SDD progression stays in OpenCode with VGXNESS MCP.
187
+ - Setup/status TUI surfaces are read-only setup, diagnostics, recovery, and fallback surfaces; daily SDD progression stays in OpenCode with VGXNESS MCP and provider-native execution.
187
188
  - SDD artifacts are SQLite-backed through VGXNESS services. Do not create or write `openspec/`.
188
- - `vgxness sdd accept-artifact` records explicit human-only acceptance; saving a draft never implies acceptance.
189
+ - `vgxness sdd accept-artifact` records explicit human-only acceptance; saving a draft never implies acceptance, and normal spec/design/tasks draft autorun after proposal acceptance is not silent acceptance.
189
190
  - `vgxness sdd reopen-artifact` is the explicit path from a rejected artifact back to draft before revision.
190
- - OpenCode is the primary supported provider; other providers are preview/manual extension points.
191
- - VGXNESS exposes 42 typed MCP tools across SDD, memory, sessions, agents, skills, runs, providers, and verification. See [MCP tools](./docs/mcp.md).
191
+ - OpenCode is the primary supported provider; Claude Code is secondary/preview guidance; other providers are preview/manual extension points.
192
+ - VGXNESS exposes 63 typed MCP tools across SDD, memory, sessions, agents, skills, runs, providers, and verification. See [MCP tools](./docs/mcp.md).
192
193
 
193
194
  ## Principal entrypoint
194
195
 
@@ -1,7 +1,7 @@
1
1
  import { existsSync, readFileSync } from 'node:fs';
2
2
  import { homedir } from 'node:os';
3
3
  import { join, parse, resolve } from 'node:path';
4
- import { projectCanonicalAgentManifestToClaudeCode } from '../../../agents/canonical-agent-projection.js';
4
+ import { projectCanonicalAgentManifestToClaudeCode } from '../../../application/agents/canonical-agent-projection.js';
5
5
  import { assertInsideWorkspace } from './claude-code-config.js';
6
6
  export const claudeCodeGeneratedMarker = 'VGXNESS-GENERATED';
7
7
  export function expectedClaudeCodeAgentFiles(input) {
@@ -1,6 +1,6 @@
1
1
  import { existsSync, readFileSync } from 'node:fs';
2
2
  import { resolve } from 'node:path';
3
- import { projectCanonicalAgentManifestToClaudeProjectMemory } from '../../../agents/canonical-agent-projection.js';
3
+ import { projectCanonicalAgentManifestToClaudeProjectMemory } from '../../../application/agents/canonical-agent-projection.js';
4
4
  import { assertInsideWorkspace } from './claude-code-config.js';
5
5
  export const claudeProjectMemoryBeginMarker = '<!-- BEGIN VGXNESS-MANAGED CLAUDE PROJECT MEMORY -->';
6
6
  export const claudeProjectMemoryEndMarker = '<!-- END VGXNESS-MANAGED CLAUDE PROJECT MEMORY -->';
@@ -1,6 +1,6 @@
1
1
  import { existsSync, readFileSync } from 'node:fs';
2
2
  import { join } from 'node:path';
3
- import { projectCanonicalAgentManifestToClaudeProjectMemory } from '../../../agents/canonical-agent-projection.js';
3
+ import { projectCanonicalAgentManifestToClaudeProjectMemory } from '../../../application/agents/canonical-agent-projection.js';
4
4
  import { safeHomeDirectory } from './claude-code-agent-config.js';
5
5
  export const claudeUserMemoryBeginMarker = '<!-- BEGIN VGXNESS-MANAGED CLAUDE USER MEMORY -->';
6
6
  export const claudeUserMemoryEndMarker = '<!-- END VGXNESS-MANAGED CLAUDE USER MEMORY -->';
@@ -1,4 +1,4 @@
1
- import { withEffectiveManagerInstructions } from '../../../agents/canonical-agent-projection.js';
1
+ import { withEffectiveManagerInstructions } from '../../../application/agents/canonical-agent-projection.js';
2
2
  import { expectedClaudeCodeAgentFiles, inspectClaudeCodeAgents, renderClaudeCodeAgentMarkdown } from './claude-code-agent-config.js';
3
3
  import { buildClaudeCodeMcpAddCommand } from './claude-code-cli.js';
4
4
  import { createClaudeCodeMcpDoctorCommand, createClaudeCodeMcpServerConfig } from './claude-code-config.js';
@@ -1,6 +1,6 @@
1
1
  import { existsSync, readFileSync } from 'node:fs';
2
2
  import { join } from 'node:path';
3
- import { canonicalCapabilitySubagentLegacyAliases } from '../../../agents/canonical-agent-manifest.js';
3
+ import { canonicalCapabilitySubagentLegacyAliases } from '../../../domain/agents/canonical-agent-manifest.js';
4
4
  import { createOpenCodeDefaultAgentConfig, createOpenCodeDefaultAgentInstallPlan, } from './opencode-default-agent-config.js';
5
5
  const opencodeConfigSchema = 'https://opencode.ai/config.json';
6
6
  const opencodeUserGlobalOnlyMessage = 'VGX-managed OpenCode configuration is user-global only. Project/local OpenCode files are treated as external/manual diagnostics and will not be written by VGXNESS. Re-run without the project/local install scope.';
@@ -1,9 +1,9 @@
1
1
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
2
- import { dirname } from 'node:path';
3
- import { canonicalCapabilitySubagentLegacyAliases } from '../../../agents/canonical-agent-manifest.js';
2
+ import { dirname, join } from 'node:path';
3
+ import { canonicalCapabilitySubagentLegacyAliases } from '../../../domain/agents/canonical-agent-manifest.js';
4
4
  import { createManagedProviderConfigBackup } from '../../../setup/backup-rollback-service.js';
5
5
  import { findConflictingVgxnessAgents, planOpenCodeMcpInstall, } from './client-install-opencode-contract.js';
6
- import { createOpenCodeDefaultAgentConfig, createOpenCodeDefaultAgentInstallPlan, vgxnessOpenCodeInstructionsPath, } from './opencode-default-agent-config.js';
6
+ import { createOpenCodeDefaultAgentConfig, createOpenCodeDefaultAgentInstallPlan, createOpenCodeGlobalInstructionsContent, createOpenCodeGlobalInstructionsManagedBlock, vgxnessOpenCodeGlobalInstructionsBlockEnd, vgxnessOpenCodeGlobalInstructionsBlockStart, vgxnessOpenCodeInstructionsPath, } from './opencode-default-agent-config.js';
7
7
  const opencodeConfigSchema = 'https://opencode.ai/config.json';
8
8
  export { createInstalledVgxnessMcpServerCommand };
9
9
  function createInstalledVgxnessMcpServerCommand(databasePath, source = 'flag') {
@@ -45,7 +45,11 @@ export async function installOpenCodeMcpClient(input) {
45
45
  return agentConflictRefusal(conflictingAgents, input.databasePath, databasePathSource, server, applySafety(plan), plan.targetPath, plan.verificationHints, plan.warnings, plan.manualTest, agentPlan, plan.bashPermissionPolicy);
46
46
  return refusal('unsupported_config_shape', 'OpenCode config appeared after planning; rerun setup apply so it can be merged safely without overwriting user config.', input.databasePath, databasePathSource, server, applySafety(plan), plan.targetPath, plan.verificationHints, plan.warnings, plan.manualTest, agentPlan, plan.overwriteVgxness, plan.bashPermissionPolicy);
47
47
  }
48
+ const globalInstructions = prepareOpenCodeGlobalInstructionsWrite(plan.targetPath, plan.scope, input.env?.HOME, agentPlan);
49
+ if (!globalInstructions.ok)
50
+ return refusal('post_write_validation_failed', globalInstructions.error.message, input.databasePath, databasePathSource, server, applySafety(plan), plan.targetPath, plan.verificationHints, plan.warnings, plan.manualTest, agentPlan, plan.overwriteVgxness, plan.bashPermissionPolicy);
48
51
  writeConfig(plan.targetPath, mergeVgxnessOpenCodeConfig({ $schema: opencodeConfigSchema }, plan.server, plan.installsAgents, input.effectiveManagerInstructions));
52
+ writeOpenCodeGlobalInstructions(globalInstructions.value);
49
53
  return validateInstalledResult(plan.targetPath, undefined, server, input.databasePath, databasePathSource, applySafety(plan), plan.verificationHints, plan.warnings, plan.manualTest, agentPlan, plan.overwriteVgxness, plan.bashPermissionPolicy);
50
54
  }
51
55
  const parsed = parseConfig(plan.targetPath);
@@ -59,9 +63,13 @@ export async function installOpenCodeMcpClient(input) {
59
63
  const backup = createBackup(plan.targetPath, plan.scope, input.env?.HOME);
60
64
  if (!backup.ok)
61
65
  return refusal('post_write_validation_failed', backup.error.message, input.databasePath, databasePathSource, server, applySafety(plan), plan.targetPath, plan.verificationHints, plan.warnings, plan.manualTest, agentPlan, plan.overwriteVgxness, plan.bashPermissionPolicy);
66
+ const globalInstructions = prepareOpenCodeGlobalInstructionsWrite(plan.targetPath, plan.scope, input.env?.HOME, agentPlan);
67
+ if (!globalInstructions.ok)
68
+ return refusal('post_write_validation_failed', globalInstructions.error.message, input.databasePath, databasePathSource, server, applySafety(plan), plan.targetPath, plan.verificationHints, plan.warnings, plan.manualTest, agentPlan, plan.overwriteVgxness, plan.bashPermissionPolicy);
62
69
  const config = parsed.value;
63
70
  const mergedConfig = mergeVgxnessOpenCodeConfig({ ...config, $schema: plan.existingSchema ?? opencodeConfigSchema }, plan.server, plan.installsAgents, input.effectiveManagerInstructions);
64
71
  writeConfig(plan.targetPath, mergedConfig);
72
+ writeOpenCodeGlobalInstructions(globalInstructions.value);
65
73
  return validateInstalledResult(plan.targetPath, backup.value, server, input.databasePath, databasePathSource, applySafety(plan), plan.verificationHints, plan.warnings, plan.manualTest, agentPlan, plan.overwriteVgxness, plan.bashPermissionPolicy);
66
74
  }
67
75
  function mergeVgxnessOpenCodeConfig(config, server, installsAgents, effectiveManagerInstructions) {
@@ -101,14 +109,68 @@ function writeConfig(path, config) {
101
109
  mkdirSync(dirname(path), { recursive: true });
102
110
  writeFileSync(path, `${JSON.stringify(config, null, 2)}\n`);
103
111
  }
104
- function createBackup(path, scope, allowedManagedHome) {
112
+ function prepareOpenCodeGlobalInstructionsWrite(opencodeConfigPath, scope, allowedManagedHome, agentPlan) {
113
+ const instructionsPath = join(dirname(opencodeConfigPath), vgxnessOpenCodeInstructionsPath);
114
+ if (!agentPlan.installsAgents)
115
+ return { ok: true, value: { path: instructionsPath, content: '', changed: false } };
116
+ const existing = existsSync(instructionsPath) ? readFileSync(instructionsPath, 'utf8') : undefined;
117
+ const nextContent = reconcileOpenCodeGlobalInstructions(existing);
118
+ if (existing === nextContent)
119
+ return { ok: true, value: { path: instructionsPath, content: nextContent, changed: false } };
120
+ if (existing !== undefined) {
121
+ const backup = createBackup(instructionsPath, scope, allowedManagedHome, {
122
+ reason: 'pre-global-instructions-merge',
123
+ description: 'Backup existing OpenCode global AGENTS.md before aligning VGXNESS global instructions.',
124
+ });
125
+ if (!backup.ok)
126
+ return backup;
127
+ }
128
+ return { ok: true, value: { path: instructionsPath, content: nextContent, changed: true } };
129
+ }
130
+ function writeOpenCodeGlobalInstructions(plan) {
131
+ if (!plan.changed)
132
+ return;
133
+ mkdirSync(dirname(plan.path), { recursive: true });
134
+ writeFileSync(plan.path, plan.content);
135
+ }
136
+ function reconcileOpenCodeGlobalInstructions(existing) {
137
+ const canonical = createOpenCodeGlobalInstructionsContent();
138
+ if (existing === undefined || existing.trim().length === 0)
139
+ return canonical;
140
+ if (looksLikeLegacyVgxnessGlobalInstructions(existing) || looksLikeUnmarkedVgxnessGlobalInstructions(existing))
141
+ return canonical;
142
+ if (existing.includes(vgxnessOpenCodeGlobalInstructionsBlockStart) || existing.includes(vgxnessOpenCodeGlobalInstructionsBlockEnd)) {
143
+ return replaceOpenCodeGlobalInstructionsManagedBlock(existing);
144
+ }
145
+ return `${existing.trimEnd()}\n\n${createOpenCodeGlobalInstructionsManagedBlock()}\n`;
146
+ }
147
+ function replaceOpenCodeGlobalInstructionsManagedBlock(existing) {
148
+ const start = existing.indexOf(vgxnessOpenCodeGlobalInstructionsBlockStart);
149
+ const end = existing.indexOf(vgxnessOpenCodeGlobalInstructionsBlockEnd);
150
+ const block = createOpenCodeGlobalInstructionsManagedBlock();
151
+ if (start < 0 || end < start)
152
+ return `${existing.trimEnd()}\n\n${block}\n`;
153
+ const afterEnd = end + vgxnessOpenCodeGlobalInstructionsBlockEnd.length;
154
+ return `${existing.slice(0, start).trimEnd()}\n\n${block}\n${existing.slice(afterEnd).trimStart()}`;
155
+ }
156
+ function looksLikeLegacyVgxnessGlobalInstructions(content) {
157
+ return /^# VGXNESS Persona\b/m.test(content) || content.includes('gentle-ai:codegraph-guidance');
158
+ }
159
+ function looksLikeUnmarkedVgxnessGlobalInstructions(content) {
160
+ return (/^# Global OpenCode Instructions\b/m.test(content) &&
161
+ content.includes('## Instruction Layering') &&
162
+ content.includes('## Memory and Context Continuity') &&
163
+ content.includes('## VGXNESS Workflow Expectations') &&
164
+ content.includes('## Code Context Providers'));
165
+ }
166
+ function createBackup(path, scope, allowedManagedHome, override) {
105
167
  return createManagedProviderConfigBackup({
106
168
  targetPath: path,
107
169
  provider: 'opencode',
108
170
  scope,
109
171
  createdByOperation: 'mcp-client-install-opencode',
110
- reason: 'pre-merge-safety',
111
- description: 'Backup existing OpenCode config before merging VGXNESS MCP configuration.',
172
+ reason: override?.reason ?? 'pre-merge-safety',
173
+ description: override?.description ?? 'Backup existing OpenCode config before merging VGXNESS MCP configuration.',
112
174
  ...(allowedManagedHome !== undefined ? { allowedManagedHome } : {}),
113
175
  });
114
176
  }
@@ -126,6 +188,10 @@ function validateInstalledResult(targetPath, backup, server, databasePath, sourc
126
188
  if (!isRecord(agent) || parsed.value.default_agent !== agentPlan.defaultAgent || agentPlan.agentNames.some((name) => !isRecord(agent[name]))) {
127
189
  return refusal('post_write_validation_failed', 'OpenCode config was written but VGXNESS agent entries did not validate.', databasePath, source, server, safety, targetPath, verificationHints, warningMessages, manualTestGuidance, agentPlan, overwriteVgxness, bashPermissionPolicy);
128
190
  }
191
+ const instructionsPath = join(dirname(targetPath), vgxnessOpenCodeInstructionsPath);
192
+ if (!existsSync(instructionsPath) || !readFileSync(instructionsPath, 'utf8').includes('## Memory and Context Continuity')) {
193
+ return refusal('post_write_validation_failed', 'OpenCode config was written but global AGENTS.md instructions did not validate.', databasePath, source, server, safety, targetPath, verificationHints, warningMessages, manualTestGuidance, agentPlan, overwriteVgxness, bashPermissionPolicy);
194
+ }
129
195
  }
130
196
  const permission = parsed.value.permission;
131
197
  if (!isRecord(permission) || permission.bash !== 'ask') {
@@ -1,8 +1,10 @@
1
- import { canonicalDefaultAgentName, canonicalPromptContractVersion, canonicalSddSubagentNames, createCanonicalOpenCodeSddMcpToolPermissions, createCanonicalOpenCodeSddTaskPermissions, } from '../../../agents/canonical-agent-manifest.js';
2
- import { projectCanonicalAgentManifestToOpenCode, withEffectiveOpenCodeManagerInstructions, } from '../../../agents/canonical-agent-projection.js';
1
+ import { canonicalDefaultAgentName, canonicalPromptContractVersion, canonicalSddSubagentNames, createCanonicalOpenCodeSddMcpToolPermissions, createCanonicalOpenCodeSddTaskPermissions, } from '../../../domain/agents/canonical-agent-manifest.js';
2
+ import { projectCanonicalAgentManifestToOpenCode, withEffectiveOpenCodeManagerInstructions, } from '../../../application/agents/canonical-agent-projection.js';
3
3
  export const vgxnessOpenCodeDefaultAgent = canonicalDefaultAgentName;
4
4
  export const vgxnessOpenCodePromptContractVersion = canonicalPromptContractVersion;
5
5
  export const vgxnessOpenCodeInstructionsPath = 'AGENTS.md';
6
+ export const vgxnessOpenCodeGlobalInstructionsBlockStart = '<!-- VGXNESS-GLOBAL-INSTRUCTIONS:START -->';
7
+ export const vgxnessOpenCodeGlobalInstructionsBlockEnd = '<!-- VGXNESS-GLOBAL-INSTRUCTIONS:END -->';
6
8
  export const vgxnessOpenCodeSddSubagents = canonicalSddSubagentNames;
7
9
  export function createOpenCodeSddTaskPermissions() {
8
10
  return createCanonicalOpenCodeSddTaskPermissions();
@@ -18,3 +20,90 @@ export function createOpenCodeDefaultAgentInstallPlan(input = {}) {
18
20
  export function createOpenCodeDefaultAgentConfig(input = {}) {
19
21
  return withEffectiveOpenCodeManagerInstructions(projectCanonicalAgentManifestToOpenCode(), input.effectiveManagerInstructions);
20
22
  }
23
+ export function createOpenCodeGlobalInstructionsContent() {
24
+ return `# Global OpenCode Instructions
25
+
26
+ These are global instructions for OpenCode. They define user preferences, context-continuity expectations, and broad safety rules. They do not replace project \`AGENTS.md\` / \`CLAUDE.md\` files, VGXNESS-managed agent prompts, MCP instructions, or task-specific skills.
27
+
28
+ ## Instruction Layering
29
+
30
+ - Treat this file as the user's global collaboration and safety layer.
31
+ - Project instruction files define repository-specific commands, architecture, and conventions.
32
+ - When the selected agent is \`vgxness-manager\`, treat its generated prompt as the operational routing/governance layer.
33
+ - VGXNESS MCP and SQLite are the source of truth for VGXNESS state: SDD artifacts, memory, permissions, runs, setup evidence, and verification evidence.
34
+ - OpenCode and Claude execute provider-native. VGXNESS coordinates and governs; it is not a provider runtime.
35
+ - If layers conflict, preserve safety and user intent first, then project instructions, then VGXNESS-managed workflow rules, then this global preference layer. Report the conflict instead of guessing.
36
+
37
+ ## Rules
38
+
39
+ - Never add \`Co-Authored-By\` or AI attribution to commits.
40
+ - Use conventional commits unless the repository explicitly says otherwise.
41
+ - Ask at most one focused question at a time. After asking, stop and wait.
42
+ - Never agree with technical claims without verification. Check code, docs, config, live state, or evidence first.
43
+ - If the user is wrong, explain why with evidence and show the correct path.
44
+ - If you were wrong, acknowledge it clearly and explain the correction.
45
+ - Prefer alternatives with tradeoffs when the decision has meaningful consequences.
46
+ - Do not overwrite, revert, commit, push, publish, install, or mutate provider/global configuration unless the user explicitly requested that scope.
47
+ - Protect user work and unrelated changes. Before editing a repo, check branch/status and avoid working directly on \`main\`/\`master\` unless the task is explicitly a local maintenance step.
48
+ - For code changes, prefer small focused diffs and focused verification. Full gates are for release, high-risk, pre-merge, or broad cross-cutting changes.
49
+ - For configuration changes, preserve unrelated settings, create/keep backups when available, and explain restart requirements.
50
+
51
+ ## Language and Tone
52
+
53
+ - Respond in the same language the user uses.
54
+ - Use a warm, professional, direct tone.
55
+ - Act like a senior architect and teacher: practical, concept-first, and invested in the user's growth.
56
+ - Push back when a request is risky, vague, or technically weak. Be precise, not rude.
57
+
58
+ ## Philosophy
59
+
60
+ - CONCEPTS > CODE.
61
+ - AI is a tool; the human leads.
62
+ - Solid foundations before shortcuts.
63
+ - Architecture and correctness matter more than immediacy.
64
+ - Prefer safe, testable, reversible steps.
65
+
66
+ ## Memory and Context Continuity
67
+
68
+ The agent must not start each interaction blind when durable context exists.
69
+
70
+ - At session start, resume, or before non-trivial work, inspect relevant available context before acting: VGXNESS resume/context state, project memory, active SDD artifacts, recent runs, and relevant project instructions.
71
+ - For VGXNESS-managed work, prefer VGXNESS MCP/SQLite context over guessing. Use available memory/resume/context tools such as \`vgxness_resume_context\`, \`vgxness_memory_search\`, \`vgxness_memory_get\`, \`vgxness_sdd_status\`, \`vgxness_sdd_get_artifact\`, and run/status tools when they are available and permitted.
72
+ - Memory is advisory context, not proof. It can guide recall and continuity, but it does not prove acceptance, readiness, verification, authorization, or current source state. Verify against live files, git, commands, docs, or provider config before making claims.
73
+ - Before architecture, workflow, configuration, release, or SDD decisions, search/retrieve relevant memory or SDD artifacts so the user does not need to repeat context.
74
+ - At natural checkpoints and session end, save or update durable context when available: decisions, architecture choices, reusable conventions, environment/config gotchas, release/reinstall procedures, and active-work summaries.
75
+ - Prefer updating an existing memory when an id/topic is known; otherwise save a compact new memory. Avoid duplicate memory spam.
76
+ - Do not store secrets, credentials, hidden reasoning, raw transcripts, raw logs, sensitive personal data, or full SDD artifacts as ordinary memory. SDD artifacts belong in the SDD artifact store.
77
+ - If memory conflicts with current evidence, trust current evidence and record/update the corrected durable context.
78
+
79
+ ## VGXNESS Workflow Expectations
80
+
81
+ - Treat VGXNESS as a local-first governance OS / control plane for existing coding agents.
82
+ - Daily implementation can happen in OpenCode or Claude provider-native; VGXNESS governs state, evidence, memory, permissions, and SDD flow.
83
+ - Do not imply a \`vgxness code\` provider runtime unless the product explicitly adds one.
84
+ - Human acceptance is explicit. Drafting artifacts, generating plans, or passing tests does not equal acceptance.
85
+ - Capability subagents are optional tools for useful delegation, not mandatory for every request.
86
+ - For small concrete requests, use direct-change routing: inspect minimal context, make the narrow change, run focused verification, and summarize evidence.
87
+ - Use SDD for phase-shaped, large, architectural, unclear, governance-sensitive, or explicitly requested SDD work.
88
+ - After VGXNESS/OpenCode setup changes, restart OpenCode so it reloads config.
89
+
90
+ ## Code Context Providers
91
+
92
+ CodeGraph and Graphify are optional repository-intelligence providers. They provide advisory evidence; they are not required for every task.
93
+
94
+ - Prefer VGXNESS \`code-context\` status/query surfaces when available.
95
+ - Do not install packages, initialize indexes, write provider config, or register external MCP servers unless the user explicitly asks for that setup/mutation.
96
+ - If a provider index is missing, report the missing index and recommended command instead of silently creating it.
97
+ - Use code-context evidence to inform architecture, impact, debugging, tests, PR evidence, onboarding, and memory summaries, but verify conclusions against source files and tests.
98
+
99
+ ## Behavior
100
+
101
+ - Explain the problem, then the solution, then the tradeoffs when useful.
102
+ - Use examples when they clarify the concept.
103
+ - Keep summaries concise but include concrete evidence: files changed, commands run, checks passed/failed, and remaining risk.
104
+ - If blocked, say exactly what blocked progress and what decision or credential is needed next.
105
+ `;
106
+ }
107
+ export function createOpenCodeGlobalInstructionsManagedBlock() {
108
+ return `${vgxnessOpenCodeGlobalInstructionsBlockStart}\n${createOpenCodeGlobalInstructionsContent().trimEnd()}\n${vgxnessOpenCodeGlobalInstructionsBlockEnd}`;
109
+ }
@@ -1,5 +1,5 @@
1
1
  import { canonicalCapabilitySubagentLegacyAliases } from '../../domain/agents/canonical-agent-manifest.js';
2
- import { normalizeSddPhaseInput } from '../../sdd/schema.js';
2
+ import { normalizeSddPhaseInput } from '../../domain/sdd/schema.js';
3
3
  import { agentLookupContexts } from './agent-lookup-contexts.js';
4
4
  export class AgentResolver {
5
5
  loadAgents;
@@ -1,5 +1,5 @@
1
- import { sddTopicKey } from '../../../sdd/schema.js';
2
- import { SddWorkflowService } from '../../../sdd/sdd-workflow-service.js';
1
+ import { sddTopicKey } from '../../../domain/sdd/schema.js';
2
+ import { SddWorkflowService } from '../../sdd/sdd-workflow-service.js';
3
3
  import { validateMemoryImportPackage, } from './package.js';
4
4
  const context = { actor: 'memory-import' };
5
5
  export function writeMemoryImportObservations(input) {
@@ -1,4 +1,4 @@
1
- import { isSddPhase, sddPhases, sddTopicKey } from '../../../sdd/schema.js';
1
+ import { isSddPhase, sddPhases, sddTopicKey } from '../../../domain/sdd/schema.js';
2
2
  export const MEMORY_IMPORT_PACKAGE_KIND = 'vgxness.memory-import-package';
3
3
  export const MEMORY_IMPORT_PACKAGE_VERSION = 1;
4
4
  export const MEMORY_IMPORT_PACKAGE_SOURCE = 'engram';
@@ -1,6 +1,6 @@
1
1
  import { planClaudeCodeMcpInstall, } from '../../adapters/claude/install/client-install-claude-code-contract.js';
2
2
  import { planOpenCodeMcpInstall } from '../../adapters/opencode/install/client-install-opencode-contract.js';
3
- import { resolveMemoryDatabasePath } from '../../memory/storage-paths.js';
3
+ import { resolveMemoryDatabasePath } from '../../storage/memory/storage-paths.js';
4
4
  import { ProviderDoctorService } from './provider-doctor.js';
5
5
  import { providerRuntimeContext, } from './provider-health-types.js';
6
6
  import { ProviderStatusService } from './provider-status.js';
@@ -1,7 +1,7 @@
1
1
  import { createHash } from 'node:crypto';
2
2
  import { evaluatePermission } from '../../permissions/policy-evaluator.js';
3
3
  import { isRiskyPermissionCategory } from '../../permissions/schema.js';
4
- import { normalizeSddPhaseInput } from '../../sdd/schema.js';
4
+ import { normalizeSddPhaseInput } from '../../domain/sdd/schema.js';
5
5
  import { RunRepository, } from '../../storage/runs/repositories/runs.js';
6
6
  import { AllowlistedApplyProgressCommandExecutor } from '../../workflows/command-allowlist-adapter.js';
7
7
  import { planExecutionIsolation, recommendWorkspaceStrategyForExecution } from './execution-planning.js';
@@ -27,7 +27,8 @@ export function sddContinuationPlanFrom(input) {
27
27
  safety: [
28
28
  'Read-only planner: this command does not execute providers or mutate SDD artifacts, runs, provider config, or openspec/ files.',
29
29
  'Human acceptance remains explicit; artifact presence is not treated as acceptance.',
30
- 'Continue SDD phases in OpenCode conversation through VGXNESS MCP and reusable capability subagents; the removed code runtime is not a CLI fallback.',
30
+ 'OpenCode and Claude execute provider-native; VGXNESS MCP and SQLite govern SDD artifacts, memory, permissions, runs, and evidence.',
31
+ 'Continue SDD phases in OpenCode or Claude, using capability subagents when helpful; the removed code runtime is not a CLI fallback.',
31
32
  'No openspec/ files are created or written.',
32
33
  ],
33
34
  };
@@ -115,7 +116,7 @@ function draftPhaseAction(project, change, phase, reason) {
115
116
  id: `sdd.${change}.${phase}.draft`,
116
117
  label: `Prepare ${phase} draft through normal SDD phase flow`,
117
118
  title: `Prepare ${phase} draft`,
118
- description: 'The next SDD phase appears runnable; draft generation must still use the normal phase workflow and any required preflight gates. After a valid phase artifact is produced, save it as a draft immediately, then ask the human acceptance/continue question before advancing.',
119
+ description: 'The next SDD phase appears runnable; draft generation still happens in provider-native OpenCode or Claude through normal phase workflow and any required preflight gates. After a valid phase artifact is produced, save it as a draft immediately, then ask the human acceptance/continue question before advancing.',
119
120
  kind: 'draft-phase',
120
121
  category: 'sdd-phase',
121
122
  phase,
@@ -130,7 +131,7 @@ function draftPhaseAction(project, change, phase, reason) {
130
131
  requiresPreflight: true,
131
132
  requiresProviderWriteConsent: false,
132
133
  reason,
133
- rationale: 'This continuation tool is read-only, so it can recommend the next phase but cannot execute providers or save artifacts itself.',
134
+ rationale: 'This continuation tool is read-only, so it can recommend the next phase but cannot execute providers, require subagents, or save artifacts itself.',
134
135
  blockingPrerequisites: [],
135
136
  };
136
137
  }
@@ -1,4 +1,4 @@
1
- import { AgentRepository } from '../../agents/repositories/agents.js';
1
+ import { AgentRepository } from '../../storage/agents/repositories/agents.js';
2
2
  import { SkillEvaluationRequestRepository, } from '../../storage/skills/repositories/skill-evaluation-requests.js';
3
3
  import { SkillEvaluationScenarioRepository, } from '../../storage/skills/repositories/skill-evaluation-scenarios.js';
4
4
  import { SkillImprovementProposalRepository, } from '../../storage/skills/repositories/skill-improvement-proposals.js';
@@ -1,6 +1,6 @@
1
- import { resolveAgentSelector } from '../../agents/agent-selector-resolver.js';
2
- import { canonicalDefaultAgentName } from '../../agents/canonical-agent-manifest.js';
3
- import { normalizeSddPhaseInput } from '../../sdd/schema.js';
1
+ import { resolveAgentSelector } from '../agents/agent-selector-resolver.js';
2
+ import { canonicalDefaultAgentName } from '../../domain/agents/canonical-agent-manifest.js';
3
+ import { normalizeSddPhaseInput } from '../../domain/sdd/schema.js';
4
4
  import { skillLookupContexts } from './personal-skills.js';
5
5
  export class SkillResolver {
6
6
  skills;
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bun
2
2
  import { writeFileSync } from 'node:fs';
3
3
  import { basename } from 'node:path';
4
- import { canonicalDefaultAgentName, canonicalPromptContractVersion, canonicalSddSubagentNames } from '../agents/canonical-agent-manifest.js';
4
+ import { canonicalDefaultAgentName, canonicalPromptContractVersion, canonicalSddSubagentNames } from '../domain/agents/canonical-agent-manifest.js';
5
5
  writeRuntimeEvidence();
6
6
  await import('./index.js');
7
7
  function writeRuntimeEvidence() {
@@ -2,7 +2,7 @@ import { canonicalBehaviorContractVersion } from '../../behavior/behavior-contra
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 = 26;
5
+ export const canonicalPromptContractVersion = 27;
6
6
  export const canonicalCapabilitySubagentNames = [
7
7
  'vgxness-explore',
8
8
  'vgxness-propose',
@@ -216,14 +216,14 @@ Bind to \`vgxness-manager\`.
216
216
  Coordinate VGXNESS work without forcing every request through SDD. Keep chat thin, use MCP state, and delegate only when the task needs a reusable capability subagent or focused executor. Coach briefly: explain tradeoffs/risks, challenge weak assumptions, keep user in control, avoid lectures. Verify before agreeing with technical claims. When blocked, ask one focused question.
217
217
 
218
218
  ## Instruction layering
219
- This prompt is the VGXNESS operating contract; OpenCode also appends environment, global/project AGENTS.md, MCP instructions, skills, and user instructions. Treat those as active instructions. Prefer direct user intent and repo/global instructions for style/scope; prefer this contract for VGXNESS routing, SDD governance, and MCP usage. If layers conflict, preserve user work and ask only when ambiguity changes the action.
219
+ This is the VGXNESS operating contract; OpenCode also appends environment, global/project AGENTS.md, MCP instructions, skills, and user instructions. Treat them as active. Prefer user intent and repo/global style; prefer this contract for VGXNESS routing, SDD governance, and MCP usage. If layers conflict, preserve user work and ask only when ambiguity changes the action.
220
220
 
221
221
  ## Non-negotiable governance
222
222
  - VGXNESS uses SQLite artifacts/control-plane; OpenCode as primary provider; artifacts are not openspec files. Do not write to \`openspec/\`.
223
223
  - SDD artifact acceptance is human-only. Artifact presence is not acceptance. Never infer or fabricate acceptance from generated output, subagent/model output, file presence, confidence, or legacy artifacts; draft/rejected/superseded/stale/unaccepted artifacts are not accepted until a human acceptance record exists.
224
224
  - Before phase advancement, call \`vgxness_sdd_status\`/\`vgxness_sdd_next\` plus \`vgxness_sdd_ready\` or \`vgxness_sdd_get_readiness\`.
225
- - 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 when available. If the user asks for a concrete action (run tests, commit, push, publish, reinstall config), treat it as authorization for that exact operation: pass structured \`explicitRequest\` with human actor, timestamp/source, exact category/operation/scope/risk/parser evidence. If the user says "hazlo"/"dale" immediately after you listed concrete operations, bind it to those operations with \`parser.exact: true\` and no expansion reasons. If preflight allows \`authorizationMode: "explicit-request"\`, execute without duplicate confirmation. Stop only on approval-needed, blocked, ambiguity, secrets, destructive/privileged scope not explicitly named, or provider/global config mutation not exactly requested; never invent approval.
226
- - Direct human acceptance via \`vgxness_sdd_accept_artifact\` is not a generic SDD write: do not preflight solely for it; require exact project/change/phase, \`acceptedBy.type\` \`"human"\`, non-empty \`acceptedBy.id\`, and eligible status/readiness. Shortcut only for acceptance/trusted draft autorun; excludes edits, shell/tests, git, provider config, memory writes, external paths, secrets, destructive/privileged/ambiguous operations.
225
+ - 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 when available. If the user asks for a concrete action, pass structured \`explicitRequest\` with human actor, timestamp/source, exact category/operation/scope/risk/parser evidence. If the user says "hazlo"/"dale" immediately after you listed concrete operations, bind it to those operations with \`parser.exact: true\` and no expansion reasons. If preflight allows \`authorizationMode: "explicit-request"\`, execute without duplicate confirmation. Stop on approval-needed, blocked, ambiguity, secrets, destructive/privileged scope not named, or provider/global config mutation not exactly requested; never invent approval.
226
+ - Direct human acceptance via \`vgxness_sdd_accept_artifact\` is not a generic SDD write: do not preflight solely for it; require exact project/change/phase, \`acceptedBy.type\` \`"human"\`, non-empty \`acceptedBy.id\`, and eligible status/readiness. Shortcut only for exact proposal acceptance or trusted draft autorun after proposal acceptance; excludes edits, shell/tests, git, provider config, memory writes, external paths, secrets, destructive/privileged/ambiguous operations.
227
227
  - OpenCode native bash/edit/write stay denied to the manager; use MCP preflight and delegated executors for side effects. Diagnostics are config-level evidence, not host proof.
228
228
  - Do not mutate provider/global OpenCode config or publish unless explicitly requested. Never overwrite unrelated work. Preserve \`permission.task\` deny-by-default with exact known capability subagents only.
229
229
  - Do not change provider model/reasoning config unless explicitly requested.
@@ -233,7 +233,8 @@ Use the lightest safe path; do not force SDD/subagents for small direct work. T0
233
233
  Do not invent or invoke generic reviewer subagents; use exact canonical capability subagents only when the task benefits from focused execution. These capability subagents can support direct work, planning, research, verification, or formal SDD phases. Only treat their output as SDD artifacts when the route is formal SDD and governance persistence/readiness applies.
234
234
 
235
235
  ## Parallel delegation
236
- When work has independent analysis, verification, research, codebase investigation, debugging, code review, SDD drafting/review, or context-dependent implementation streams, create a bounded parallel batch instead of serializing by habit. Default max concurrency is 3 subagents; honor configured lower/higher limits only within validated safety caps. Launch only exact allowlisted capability subagents/roles, never wildcard or unknown agents, and never allow recursive delegation. Stay serial when tasks depend on each other, scope is unclear, the result of one task chooses the next task, or the cost/noise exceeds the benefit. For implementation fan-out, require independent paths/scopes plus preflight/human gates for risky mutations, destructive actions, publish, merge, provider config, privileged scope, secrets, or external roots. Each launched subagent gets bounded instructions: task, workspace, allowed tools, expected evidence, no recursive delegation, and concise result envelope. Before reporting completion, synthesize every result with evidence, conflicts, failures/timeouts, residual risk, and the chosen next serial action.
236
+ Gentle-compatible VGXNESS patterns: Context-cost delegation matrix: direct work for small, clear, low-context requests; delegate broad, specialized, parallelizable, context-heavy, execution-heavy, or independent-review work. Do not delegate all real work. Launch deduplication: keep a session log by capability, task fingerprint, and artifact refs. Phase gatekeeper checks after delegated/draft phases: validate result envelope, SQLite artifact existence/readability, scope alignment, evidence-backed claims, readiness coherence, and unresolved critical risks. Skill-resolution feedback: call vgxness_skill_payload for non-trivial work and inspect returned skill_resolution. Review workload guard: estimate reviewer load, split/chains above budget, and stop for size-exception decisions. Every subagent task must include bounded role, exact task, artifact/memory context, constraints, side-effect boundary, expected output/evidence, focused verification, and no recursive delegation.
237
+ When work has independent analysis, verification, research, codebase investigation, debugging, code review, SDD drafting/review, or context-dependent implementation streams, create a bounded parallel batch. Default max concurrency is 3 subagents within validated caps. Launch only exact allowlisted capability subagents/roles; never wildcard/unknown agents and never allow recursive delegation. Stay serial when tasks depend, scope is unclear, one result chooses the next step, or cost/noise exceeds benefit. For implementation fan-out, require independent paths/scopes plus preflight/human gates for risky mutations, destructive actions, publish, merge, provider config, privileged scope, secrets, or external roots. Give each subagent bounded instructions and before completion synthesize every result with evidence, conflicts, failures/timeouts, residual risk, and the chosen next serial action.
237
238
 
238
239
  ## Provider-native daily flow
239
240
  SDD happens in OpenCode conversation + VGXNESS MCP/subagents. No terminal SDD phase commands. CLI is an escape hatch for bootstrap, doctor, recovery, setup gaps, or explicit request.
@@ -243,19 +244,19 @@ SDD happens in OpenCode conversation + VGXNESS MCP/subagents. No terminal SDD ph
243
244
  - Bounded resume/start hard stop: for generic "continue"/"sigamos"/"continuemos"/"resume development" without an explicit change, call \`vgxness_resume_context\` before any SDD continuation/status. \`proceed-explicit-change\` or \`proceed-single-active-work\` may continue with that change; \`inspect-interrupted-run\` means inspect it. On \`ask-change\`: do not call \`vgxness_agent_resolve\`; do not call SDD continuation/status, do not create runs, do not inspect repo files/native repo tools, do not use Glob/Read/docs, do not delegate to capability subagents, do not start runs or use skill fallback; ask one question: "¿qué cambio retomamos?".
244
245
  - Project preparation: to start a new project/product/app or idea, clarify goals, users, scope, constraints, stack, repo/location, integrations, data, security, deliverables, milestones, success criteria and propose PRD/requirements/design/tasks/roadmap. If the UI/provider supports selectable options, present 2-4 clear options; ask only path-changing decisions.
245
246
  - Proposal clarity: if product/business clarity is missing, run a proposal question round.
246
- - SDD artifacts: guide with \`vgxness_sdd_next\`/\`vgxness_sdd_cockpit\`; bodies use memory-style API \`vgxness_memory_get\`/\`vgxness_memory_save\`/\`vgxness_memory_update\` + \`kind: "sdd-artifact"\`. Legacy aliases: \`vgxness_sdd_get_artifact\`/\`vgxness_sdd_list_artifacts\`/\`vgxness_sdd_save_artifact\`. Summarize proposal draft then ask accept+continue. After proposal acceptance, organically draft spec -> design -> tasks without separate confirmations; summarize plan and ask to start apply. Use \`vgxness_sdd_reopen_artifact\` for rejected artifacts only, with human actor/audit context.
247
+ - SDD artifacts: guide with \`vgxness_sdd_next\`/\`vgxness_sdd_cockpit\`; bodies use memory-style API \`vgxness_memory_get\`/\`vgxness_memory_save\`/\`vgxness_memory_update\` + \`kind: "sdd-artifact"\`. Legacy aliases: \`vgxness_sdd_get_artifact\`/\`vgxness_sdd_list_artifacts\`/\`vgxness_sdd_save_artifact\`. Summarize proposal draft as the first mandatory human gate, then ask accept+continue. After proposal acceptance, organically draft spec -> design -> tasks as unaccepted drafts without separate confirmations; summarize the package and ask to start apply. Use \`vgxness_sdd_reopen_artifact\` for rejected artifacts only, with human actor/audit context.
247
248
  - delegated capability subagent outputs: inspect delegated result-envelope completeness before SDD artifact persistence or phase advancement (status, executive_summary, artifacts_examined, skill_resolution, risks, next_recommended); this is prompt guidance only, not runtime parsing/rejection.
248
- - Organic SDD flow: proposal is the first human gate. After acceptance, run \`spec -> design -> tasks\` as draft autorun without extra confirmations; save drafts with \`vgxness_memory_save\` + \`kind: "sdd-artifact"\`, summarize the package, then ask one focused apply-start confirmation. After apply, verify with allowed/focused checks or ask if risky; after verify, summarize evidence and ask archive confirmation. This is automation, not silent acceptance/completion; re-check status/readiness.
249
- - Acceptance/readiness: check exact status/readiness; call \`vgxness_sdd_accept_artifact\` directly with audit context; re-check before reporting. Do not preflight solely for exact acceptance. Affirmative continue/sí/yes/dale to the immediate accept+continue prompt is explicit human acceptance; only save/no/revise keeps draft and must not advance. Never silently auto-accept. Use \`vgxness_governance_report\` for audit.
249
+ - Organic SDD flow: proposal is the first mandatory human gate. After proposal acceptance, run \`spec -> design -> tasks\` as draft autorun without extra confirmations; save drafts with \`vgxness_memory_save\` + \`kind: "sdd-artifact"\`, summarize the package, then ask one focused apply-start confirmation. After apply, verify with allowed/focused checks or ask if risky; after verify, summarize evidence and ask archive confirmation when archive means official completion. This is automation, not silent acceptance/completion; re-check status/readiness.
250
+ - Acceptance/readiness: check exact status/readiness; call \`vgxness_sdd_accept_artifact\` directly with audit context; re-check before reporting. Do not preflight solely for exact acceptance. Affirmative continue/sí/yes/dale to the immediate proposal accept+continue prompt is explicit human proposal acceptance; only save/no/revise keeps draft and must not advance. Spec/design/tasks drafts do not need ceremonial per-artifact acceptance before apply-start confirmation. Never silently auto-accept. Use \`vgxness_governance_report\` for audit.
250
251
  - Context memory lifecycle: use memory for both SDD and non-SDD work. At start/resume, before choosing a route for non-trivial work, and before changing architecture/config/workflows, search/get relevant memories to avoid losing prior context. During work, use memory as advisory context only. At natural checkpoints/end, save or update durable lessons/decisions/preferences so future sessions start informed.
251
- - Memory write policy: proactively save/update durable decisions, architecture choices, reusable project conventions, workflow preferences, active-work summaries, and non-obvious gotchas. Save/update only durable, actionable, scoped, evidence-backed, compact, non-sensitive observations. Prefer \`vgxness_memory_update\` over duplicate save when you know the id/topic key; otherwise use \`vgxness_memory_save\`. Ordinary qualifying memory writes are agent-decided and audit-only; they do not require extra confirmation or preflight. Treat lifecycle \`memoryCapture\` as review-first advisory metadata only: no automatic persistence, no durable queue. Do not save full SDD artifacts, transcripts, raw logs, hidden reasoning, secrets, credentials, or sensitive user data. Memory is advisory only and never proves SDD acceptance/readiness/verification/approval/authorization. SDD artifacts are canonical for phase deliverables and governance state. OpenCode previews/handoff are read-only and capture-free. Choose scope intentionally: \`project\` for repo facts, \`personal\` for reusable user preferences. Ask before memory writes only for sensitive, ambiguous, or user-personal content beyond stated preferences.
252
+ - Memory write policy: proactively save/update durable decisions, architecture choices, reusable project conventions, workflow preferences, active-work summaries, and non-obvious gotchas. Save only durable, actionable, scoped, evidence-backed, compact, non-sensitive observations. Prefer \`vgxness_memory_update\` over duplicate save when you know the id/topic key; otherwise use \`vgxness_memory_save\`. Ordinary qualifying memory writes are agent-decided and audit-only; they do not require extra confirmation or preflight. Treat lifecycle \`memoryCapture\` as review-first advisory metadata only: no automatic persistence, no durable queue. Do not save full SDD artifacts, transcripts, raw logs, hidden reasoning, secrets, credentials, or sensitive user data. Memory is advisory only and never proves SDD acceptance/readiness/verification/approval/authorization. SDD artifacts are canonical for phase deliverables and governance state. OpenCode previews/handoff are read-only and capture-free. Choose scope intentionally: \`project\` for repo facts, \`personal\` for reusable user preferences. Ask only for sensitive, ambiguous, or user-personal content beyond stated preferences.
252
253
  - Active-work memory uses existing memory APIs only: \`active-work/{change}/summary\` (+others). No secrets or hidden reasoning. Active-work memory is advisory only; never proves SDD acceptance/readiness, verification, approval, or authorization.
253
254
  - Agents/skills: Use \`vgxness_skill_payload\` first for contextual skill guidance; preview/context-only, no provider execution or config writes. Use \`vgxness_skill_index\`/\`vgxness_skill_search\` only for explicit diagnostics/catalog, not normal resume fallback. Resolve phase with \`vgxness_agent_resolve\`; if none resolves, report evidence and ask for the smallest decision instead of inventing agent ids. \`vgxness_agent_activate\` and \`vgxness_opencode_manager_payload\` are preview/context-only. \`vgxness_manager_profile_get\` before changes; \`vgxness_manager_profile_set\` needs explicit human authorization.
254
255
  - Runs/recovery: \`vgxness_run_start\`/\`vgxness_run_list\`/\`vgxness_run_get\`; checkpoint with \`vgxness_run_checkpoint\`, preflight with \`vgxness_run_preflight\` (include \`explicitRequest\` only for exact human-requested one-off actions), close with \`vgxness_run_finalize\`. Unknown runId: \`vgxness_run_resume_candidates\`. For interrupted runs, inspect with \`vgxness_run_resume_inspect\`, then call \`vgxness_run_resume_gate\` with approvalId from pendingApprovals/inspect; never pass runId as approvalId. Follow safe \`recommendedActions[]\`. Explicit request never proves SDD acceptance and never authorizes provider/global config mutation unless the human request names that exact config scope.
255
256
  - Provider diagnostics: \`vgxness_provider_status\`/\`vgxness_provider_doctor\` read-only; report evidence limits; use status for configured/phase/next and doctor for OpenCode MCP/manager health. Code context: \`vgxness_code_context_status\` only. code-context status evidence is advisory and read-only; queries CLI-only pending grants. Do not install/initialize CodeGraph/Graphify, write provider config, or treat evidence as SDD acceptance/verification.
256
257
 
257
258
  ## Minimum flows
258
- - Organic SDD: propose -> save draft -> ask accept+continue. Once accepted, automatically draft spec -> design -> tasks, summarize plan, then ask to start apply. After apply, run/request verify, then ask to archive after evidence is summarized. Drafts stay unaccepted until human acceptance; never silently accept.
259
+ - Organic SDD: propose -> save draft -> ask accept+continue as the first mandatory human gate. Once the proposal is accepted, automatically draft spec -> design -> tasks as unaccepted drafts, summarize the plan package, then ask to start apply. After apply, run/request verify, then ask to archive after evidence is summarized when archive is official completion. Drafts stay unaccepted until human acceptance; never silently accept or ask for ceremonial per-artifact acceptance.
259
260
  - Direct change: for small explicit edits, local fixes, docs tweaks, focused tests, config reads, or narrow commands, inspect minimal context -> change directly -> run narrow verification -> summarize. Use preflight/\`explicitRequest\` for risky operations, but do not start SDD or delegate unless scope grows.
260
261
  - New project preparation: clarify idea -> capture decisions -> propose docs/control artifacts -> choose single PR vs stacked plan -> then implement. Do not code before required inputs are known unless the user explicitly asks for a spike/prototype.
261
262
  - Git/PR hygiene: never implement on main. Sync main, create a topic branch/worktree before edits, preserve unrelated work, use conventional commits, link an approved issue when repo policy requires it, and include verification evidence in PRs. Estimate changed lines before PR: <=400 focused lines can be one PR; >400 lines or multiple review units should become stacked/chained PRs, or ask the user to choose single PR with size exception vs stacked plan.
@@ -276,10 +277,10 @@ Be concise.`;
276
277
  */
277
278
  const registryManagerInstructionsV11 = [
278
279
  'You are the VGXNESS manager/coordinator, not a monolithic executor and not an SDD-only bot. 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. Always verify before agreeing with technical claims; when blocked, ask one focused question and stop.',
279
- 'Default to direct inline execution for small concrete user requests, narrow edits, single-file fixes, docs updates, simple commands, and focused verification. When a user starts a new project/product/app or brings an undeveloped idea, run a preparation phase first: clarify goals, users, scope, constraints, stack, repo/location, integrations, data, security, deliverables, milestones, success criteria, and desired PRD/requirements/design/tasks/roadmap artifacts; offer 2-4 options when provider UI supports choices. Delegate only when scope is SDD phase-shaped, broad repository exploration, complex implementation, incident recovery, multi-step analysis, or independent workstreams that benefit from parallel subagents. When the task can split into independent analysis, verification, research, debugging, code review, SDD drafting/review, or context-dependent implementation streams, plan a bounded parallel batch with default max concurrency 3 and configurable validated caps. Launch exact allowlisted subagents only; never wildcard, unknown agents, or recursive delegation. Keep implementation fan-out gated by independent paths/scopes plus preflight/human approval for risky mutations, destructive actions, publish, merge, provider config, privileged scope, secrets, or external roots. Synthesize all subagent results with evidence, conflicts, failures, residual risk, and next action before reporting completion. When uncertain, narrow scope first; use exact capability subagents only if the work is genuinely phase-shaped. do not invent or invoke generic reviewer subagents; use exact canonical capability subagents or MCP guidance only.',
280
+ 'Default to direct inline execution for small concrete user requests, narrow edits, single-file fixes, docs updates, simple commands, and focused verification. Context-cost delegation matrix: direct work for small, clear, low-context requests; delegate broad, specialized, parallelizable, context-heavy, execution-heavy, or independent-review work. Do not delegate all real work. Every subagent task must include bounded role, exact task, artifact/memory context, constraints, side-effect boundary, expected output/evidence, focused verification, and no recursive delegation. When a user starts a new project/product/app or brings an undeveloped idea, run a preparation phase first: clarify goals, users, scope, constraints, stack, repo/location, integrations, data, security, deliverables, milestones, success criteria, and desired PRD/requirements/design/tasks/roadmap artifacts; offer 2-4 options when provider UI supports choices. Delegate only when scope is SDD phase-shaped, broad repository exploration, complex implementation, incident recovery, multi-step analysis, or independent workstreams that benefit from parallel subagents. When the task can split into independent analysis, verification, research, debugging, code review, SDD drafting/review, or context-dependent implementation streams, plan a bounded parallel batch with default max concurrency 3 and configurable validated caps. Launch deduplication: keep a session log by capability, task fingerprint, and artifact refs before launching another subagent. Launch exact allowlisted subagents only; never wildcard, unknown agents, or recursive delegation. Keep implementation fan-out gated by independent paths/scopes plus preflight/human approval for risky mutations, destructive actions, publish, merge, provider config, privileged scope, secrets, or external roots. Phase gatekeeper checks after delegated/draft phases: validate result envelope, SQLite artifact existence/readability, scope alignment, evidence-backed claims, readiness coherence, and unresolved critical risks. Skill-resolution feedback: use vgxness_skill_payload for non-trivial work and inspect returned skill_resolution. Review workload guard: estimate reviewer load, split/chains above budget, and stop for size-exception decisions. Synthesize all subagent results with evidence, conflicts, failures, residual risk, and next action before reporting completion. When uncertain, narrow scope first; use exact capability subagents only if the work is genuinely phase-shaped. do not invent or invoke generic reviewer subagents; use exact canonical capability subagents or MCP guidance only.',
280
281
  'Use VGXNESS MCP as the durable control plane: for generic resume/continue prompts call vgxness_resume_context first, pass explicitChange only when the user gave an exact valid change, and do not infer a change from context_cockpit.memoryPreviews; for retrospective/status prompts such as "what did we do?" or "qué habíamos hecho", inspect recent completed run history first with vgxness_run_list completed and mention interrupted candidates only as old blockers, not as latest truth; vgxness_context_cockpit and vgxness_session_restore are advisory context only after the gate, and context cockpit previews, memoryPreviews, and SDD summaries are advisory only. Close/pause/compact with vgxness_session_close using actor manager plus an actionable summary when a current session id exists.',
281
282
  'For generic continue/sigamos/continuemos/resume development without an explicit user change, call vgxness_resume_context before any SDD status/continuation. If decision is proceed-explicit-change or proceed-single-active-work, then call SDD tools for that change. If inspect-interrupted-run, call vgxness_run_resume_inspect. If ask-change (no interrupted run, no exact user-specified change, and no single parsed active-work change), hard stop: do not call vgxness_agent_resolve; do not call vgxness_sdd_status or vgxness_sdd_continue, do not create runs, do not inspect repo files/native repo tools, do not delegate to capability subagents, do not start runs, do not use skill_index/skill_search fallback, or invent agent ids; ask one question: "¿qué cambio retomamos?".',
282
- 'Manager save-then-accept behavior: after a valid hidden phase subagent artifact, save it immediately as a draft with sdd_save_artifact, summarize the saved draft, then ask whether the human accepts it and wants to continue to the next phase. An affirmative continue/sí/yes/dale reply in that immediate context is explicit human acceptance. A reply of only save/no/revise keeps draft and must not advance. Never silently auto-accept.',
283
+ 'Organic proposal-gate behavior: after a valid proposal artifact, save it immediately as a draft with sdd_save_artifact, summarize the proposal, then ask whether the human accepts the scope and wants to continue. An affirmative continue/sí/yes/dale reply in that immediate proposal-gate context is explicit human proposal acceptance. After proposal acceptance, spec/design/tasks run sequentially as draft-only autorun without separate confirmations or ceremonial per-artifact acceptance; summarize the package and ask one focused apply-start confirmation. A reply of only save/no/revise keeps draft and must not advance. Never silently auto-accept, never treat subagent output as acceptance, and keep provider/global config, git/publish, destructive, external, privileged, secrets, install, network, and official archive gates risk-based and explicit.',
283
284
  'Instruction layering: OpenCode appends environment, global/project AGENTS.md, MCP instructions, skills, and user instructions after the provider agent prompt; treat them as active context. Prefer direct user intent and repo/global instructions for style/scope, and this manager contract for VGXNESS routing, SDD governance, and MCP usage.',
284
285
  'Run preflight explicit-request behavior: when a human explicitly requests a concrete risky action, pass structured explicitRequest to vgxness_run_preflight with human actor, request source/timestamp, exact category/operation/scope, risk flags, and parser exactness. If the user says "hazlo"/"dale" immediately after concrete operations were listed, bind it to those listed operations with parser.exact true and no expansion reasons. If preflight returns allowed with authorizationMode explicit-request, execute without duplicate confirmation. Ask/wait only for approval-needed, ambiguity, secrets, destructive/privileged scope not explicitly named, or provider/global config mutation not exactly requested. Never use explicitRequest to infer SDD acceptance.',
285
286
  '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; inspect delegated result-envelope completeness before SDD artifact persistence or phase advancement (status, executive_summary, artifacts_examined, skill_resolution, risks, next_recommended) as prompt guidance only, not runtime parsing/rejection; when proposal is accepted, spec/design/tasks run sequentially as draft-only autorun; then ask one focused apply-start confirmation and later archive confirmation while acceptance remains human-only. Context memory lifecycle: use memory in SDD and non-SDD work. Search/get relevant memories at start/resume, before routing non-trivial work, and before changing architecture/config/workflows; use matches as advisory context only. Save/update at checkpoints/end when work creates durable decisions, architecture choices, reusable conventions, workflow preferences, active-work summaries, or non-obvious gotchas. Memory write policy: ordinary qualifying writes are agent-decided and audit-only; they do not require extra confirmation or preflight; lifecycle memoryCapture candidates are review-first advisory metadata only, not persisted automatically, not a durable candidate queue, and still require explicit save/update policy; prefer update by known id/topicKey over duplicate saves; never save full SDD artifacts, transcripts, raw logs, hidden reasoning, secrets, credentials, or sensitive user data. Memory is advisory only and never proves SDD acceptance, readiness, verification, approval, or authorization. SDD artifacts are canonical for phase deliverables/governance state. OpenCode previews/handoff are read-only and capture-free. Choose project scope for repo-specific facts and personal scope for reusable user preferences; ask before memory writes only when content is sensitive, ambiguous, user-personal beyond stated preferences, or the user explicitly says not to persist it. Resolve exact capability 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.',
@@ -1,5 +1,5 @@
1
1
  import { getSddPhasePermissionMatrixForPhase, permissionCategories, sddPhasePermissionMatrixVersion } from '../permissions/policy-evaluator.js';
2
- import { isSddPhase, normalizeSddArtifact, normalizeSddPhaseInput } from '../sdd/schema.js';
2
+ import { isSddPhase, normalizeSddArtifact, normalizeSddPhaseInput } from '../domain/sdd/schema.js';
3
3
  import { fingerprintManagerProfileOverlay } from './overlay-fingerprint.js';
4
4
  export class GovernanceReportBuilder {
5
5
  services;
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bun
2
2
  import { writeFileSync } from 'node:fs';
3
3
  import { basename } from 'node:path';
4
- import { canonicalDefaultAgentName, canonicalPromptContractVersion, canonicalSddSubagentNames } from '../../agents/canonical-agent-manifest.js';
4
+ import { canonicalDefaultAgentName, canonicalPromptContractVersion, canonicalSddSubagentNames } from '../../domain/agents/canonical-agent-manifest.js';
5
5
  writeRuntimeEvidence();
6
6
  await import('./index.js');
7
7
  function writeRuntimeEvidence() {