vgxness 0.1.0

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 (121) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +110 -0
  3. package/dist/agents/agent-activation-service.js +144 -0
  4. package/dist/agents/agent-registry-service.js +46 -0
  5. package/dist/agents/agent-resolver.js +249 -0
  6. package/dist/agents/agent-seed-service.js +146 -0
  7. package/dist/agents/manager-profile-overlay-service.js +34 -0
  8. package/dist/agents/profile-model-routing.js +26 -0
  9. package/dist/agents/renderers/claude-renderer.js +98 -0
  10. package/dist/agents/renderers/index.js +16 -0
  11. package/dist/agents/renderers/json-renderer.js +87 -0
  12. package/dist/agents/renderers/opencode-renderer.js +100 -0
  13. package/dist/agents/renderers/provider-adapter.js +6 -0
  14. package/dist/agents/repositories/agents.js +185 -0
  15. package/dist/agents/repositories/manager-profile-overlays.js +81 -0
  16. package/dist/agents/schema.js +1 -0
  17. package/dist/cli/dashboard-operational-read-models.js +153 -0
  18. package/dist/cli/dashboard-renderer.js +109 -0
  19. package/dist/cli/dashboard-screen-renderers.js +332 -0
  20. package/dist/cli/dashboard-tui-read-model.js +71 -0
  21. package/dist/cli/dashboard-tui-state.js +218 -0
  22. package/dist/cli/dispatcher.js +2880 -0
  23. package/dist/cli/index.js +27 -0
  24. package/dist/cli/interactive-dashboard.js +29 -0
  25. package/dist/cli/mcp-start-path.js +21 -0
  26. package/dist/cli/setup-status-renderer.js +29 -0
  27. package/dist/cli/setup-wizard-read-model.js +56 -0
  28. package/dist/cli/setup-wizard-renderer.js +148 -0
  29. package/dist/cli/setup-wizard-state.js +82 -0
  30. package/dist/cli/tui-render-helpers.js +192 -0
  31. package/dist/export/redaction.js +71 -0
  32. package/dist/harness/tools/agents.js +245 -0
  33. package/dist/harness/tools/memory.js +29 -0
  34. package/dist/mcp/client-install-opencode-contract.js +227 -0
  35. package/dist/mcp/client-install-opencode.js +194 -0
  36. package/dist/mcp/client-setup-preview.js +38 -0
  37. package/dist/mcp/control-plane.js +175 -0
  38. package/dist/mcp/doctor.js +193 -0
  39. package/dist/mcp/index.js +10 -0
  40. package/dist/mcp/opencode-default-agent-config.js +156 -0
  41. package/dist/mcp/opencode-visibility.js +102 -0
  42. package/dist/mcp/schema.js +234 -0
  43. package/dist/mcp/stdio-server.js +56 -0
  44. package/dist/mcp/validation.js +761 -0
  45. package/dist/memory/import/dry-run-planner.js +58 -0
  46. package/dist/memory/import/index.js +3 -0
  47. package/dist/memory/import/observation-writer.js +220 -0
  48. package/dist/memory/import/package.js +178 -0
  49. package/dist/memory/memory-service.js +126 -0
  50. package/dist/memory/repositories/artifacts.js +41 -0
  51. package/dist/memory/repositories/observations.js +133 -0
  52. package/dist/memory/repositories/sessions.js +105 -0
  53. package/dist/memory/repositories/traces.js +58 -0
  54. package/dist/memory/schema.js +1 -0
  55. package/dist/memory/search.js +11 -0
  56. package/dist/memory/sqlite/database.js +97 -0
  57. package/dist/memory/sqlite/migrations/001_initial.sql +128 -0
  58. package/dist/memory/sqlite/migrations/002_observation_revisions.sql +14 -0
  59. package/dist/memory/sqlite/migrations/003_agent_registry.sql +26 -0
  60. package/dist/memory/sqlite/migrations/004_run_runtime.sql +62 -0
  61. package/dist/memory/sqlite/migrations/005_run_approvals.sql +20 -0
  62. package/dist/memory/sqlite/migrations/006_run_operation_attempts.sql +32 -0
  63. package/dist/memory/sqlite/migrations/007_abandoned_operation_attempts.sql +46 -0
  64. package/dist/memory/sqlite/migrations/008_run_execution_plan_events.sql +105 -0
  65. package/dist/memory/sqlite/migrations/009_multiple_operation_attempts.sql +73 -0
  66. package/dist/memory/sqlite/migrations/010_skill_registry.sql +66 -0
  67. package/dist/memory/sqlite/migrations/011_skill_usage_resolution_outcomes.sql +21 -0
  68. package/dist/memory/sqlite/migrations/012_skill_improvement_proposals.sql +37 -0
  69. package/dist/memory/sqlite/migrations/013_skill_evaluation_scenarios.sql +43 -0
  70. package/dist/memory/sqlite/migrations/014_manager_profile_overlays.sql +14 -0
  71. package/dist/memory/storage-paths.js +72 -0
  72. package/dist/orchestrator/natural-language-planner.js +191 -0
  73. package/dist/orchestrator/schema.js +1 -0
  74. package/dist/permissions/index.js +2 -0
  75. package/dist/permissions/policy-evaluator.js +109 -0
  76. package/dist/permissions/schema.js +1 -0
  77. package/dist/providers/opencode/injection-preview.js +134 -0
  78. package/dist/providers/opencode/manager-payload.js +129 -0
  79. package/dist/runs/execution-planning.js +117 -0
  80. package/dist/runs/operation-execution.js +1 -0
  81. package/dist/runs/operation-retry.js +124 -0
  82. package/dist/runs/repositories/runs.js +611 -0
  83. package/dist/runs/run-insights.js +145 -0
  84. package/dist/runs/run-service.js +713 -0
  85. package/dist/runs/run-snapshot-export-service.js +31 -0
  86. package/dist/runs/sandbox-process-execution.js +218 -0
  87. package/dist/runs/sandbox-worktree-planning.js +59 -0
  88. package/dist/runs/schema.js +1 -0
  89. package/dist/sdd/artifact-portability-service.js +118 -0
  90. package/dist/sdd/schema.js +17 -0
  91. package/dist/sdd/sdd-workflow-service.js +217 -0
  92. package/dist/setup/backup-rollback-service.js +76 -0
  93. package/dist/setup/index.js +3 -0
  94. package/dist/setup/providers/antigravity-setup-adapter.js +18 -0
  95. package/dist/setup/providers/claude-setup-adapter.js +30 -0
  96. package/dist/setup/providers/custom-setup-adapter.js +18 -0
  97. package/dist/setup/providers/index.js +6 -0
  98. package/dist/setup/providers/opencode-setup-adapter.js +104 -0
  99. package/dist/setup/providers/provider-setup-adapter.js +15 -0
  100. package/dist/setup/providers/provider-setup-registry.js +11 -0
  101. package/dist/setup/schema.js +1 -0
  102. package/dist/setup/setup-defaults.js +11 -0
  103. package/dist/setup/setup-lifecycle-service.js +175 -0
  104. package/dist/setup/setup-plan.js +105 -0
  105. package/dist/skills/repositories/skill-evaluation-scenarios.js +289 -0
  106. package/dist/skills/repositories/skill-improvement-proposals.js +288 -0
  107. package/dist/skills/repositories/skills.js +430 -0
  108. package/dist/skills/schema.js +1 -0
  109. package/dist/skills/skill-payload.js +94 -0
  110. package/dist/skills/skill-registry-service.js +92 -0
  111. package/dist/skills/skill-resolver.js +191 -0
  112. package/dist/workflows/command-allowlist-adapter.js +70 -0
  113. package/dist/workflows/schema.js +4 -0
  114. package/dist/workflows/workflow-executor.js +345 -0
  115. package/dist/workflows/workflow-registry.js +66 -0
  116. package/docs/architecture.md +698 -0
  117. package/docs/cli.md +741 -0
  118. package/docs/funcionamiento-del-sistema.md +868 -0
  119. package/docs/harness-gap-analysis.md +229 -0
  120. package/docs/prd.md +372 -0
  121. package/package.json +57 -0
package/docs/cli.md ADDED
@@ -0,0 +1,741 @@
1
+ # Use the local CLI
2
+
3
+ Run `vgxness` commands from the repo with `npm run cli -- ...`. The CLI is intentionally thin: it parses flags, opens the local SQLite store, and calls the existing domain services for memory, agents, runs, and permissions.
4
+
5
+ ## Local tarball alpha install
6
+
7
+ Use this workflow to dogfood the installable alpha without publishing to npm. It builds the package, installs the tarball into an isolated temporary prefix, and uses an explicit temporary database so your default global memory store is untouched.
8
+
9
+ ```bash
10
+ npm run build
11
+ VGXNESS_TARBALL=$(npm pack --json | node -e 'const fs = require("node:fs"); const [pkg] = JSON.parse(fs.readFileSync(0, "utf8")); process.stdout.write(pkg.filename);')
12
+
13
+ VGXNESS_SMOKE_PREFIX=$(mktemp -d)
14
+ VGXNESS_SMOKE_WORKDIR=$(mktemp -d)
15
+ VGXNESS_SMOKE_DB="$VGXNESS_SMOKE_WORKDIR/smoke.sqlite"
16
+
17
+ npm install --prefix "$VGXNESS_SMOKE_PREFIX" --global --no-audit --no-fund "./$VGXNESS_TARBALL"
18
+ export PATH="$VGXNESS_SMOKE_PREFIX/bin:$PATH"
19
+ ```
20
+
21
+ Run the smoke checks from the temporary workdir:
22
+
23
+ ```bash
24
+ cd "$VGXNESS_SMOKE_WORKDIR"
25
+ vgxness --help
26
+ vgx --help
27
+ vgx setup plan
28
+ vgxness setup status --db "$VGXNESS_SMOKE_DB"
29
+ vgxness dashboard status --project vgxness --db "$VGXNESS_SMOKE_DB"
30
+ vgxness mcp install opencode --plan --db "$VGXNESS_SMOKE_DB"
31
+ ```
32
+
33
+ The MCP plan is read-only. With the explicit smoke DB above, it should show an installed server command that starts with `vgxness mcp start --db "$VGXNESS_SMOKE_DB"` and must not mention `npm run cli`, `tsx`, or repository-relative source paths. If `--db` is omitted, the installed command should be `vgxness mcp start` and use the global default at runtime.
34
+
35
+ Only apply the OpenCode project config after reviewing the plan:
36
+
37
+ ```bash
38
+ vgxness mcp install opencode --yes --db "$VGXNESS_SMOKE_DB"
39
+ ```
40
+
41
+ Rollback cleanup:
42
+
43
+ ```bash
44
+ rm -rf "$VGXNESS_SMOKE_PREFIX"
45
+ rm -rf "$VGXNESS_SMOKE_WORKDIR"
46
+ rm -f "./$VGXNESS_TARBALL"
47
+ ```
48
+
49
+ For the automated version of this workflow, run `npm run package:smoke:install`.
50
+
51
+ ## Alpha npm/global setup
52
+
53
+ The npm package name is `vgxness`, the recommended alpha release tag is `alpha`, and the license is proprietary (`SEE LICENSE IN LICENSE`). The npm package is inspectable JavaScript for Node runtime purposes, but it is not open-source licensed and must not be redistributed without permission.
54
+
55
+ Release defaults used by the guided setup are:
56
+
57
+ - Node.js `>=22`.
58
+ - Provider: OpenCode.
59
+ - Database: global user data location by default.
60
+ - Install mode: MCP plus manager/SDD agents (`mcp-plus-agents`).
61
+ - Public CLI language: English.
62
+
63
+ Recommended user flow after `npm install -g vgxness`:
64
+
65
+ ```bash
66
+ vgx --help
67
+ vgx init # guided wizard in a TTY; read-only plan in CI/non-TTY
68
+ vgx setup plan # explicit read-only plan
69
+ vgx setup apply --yes # writes OpenCode config only after explicit consent
70
+ vgx doctor # general alias for MCP doctor checks
71
+ vgx setup rollback --backup <path>
72
+ ```
73
+
74
+ `setup plan` is always read-only. With the default global database, the OpenCode MCP command is `vgxness mcp start`; for custom/project-local DBs it includes `--db <path>`. `setup rollback --backup <path>` validates a VGXNESS/OpenCode backup such as `opencode.json.backup-<timestamp>`, creates a pre-rollback backup of the current target when present, restores the selected backup byte-for-byte, and recommends `vgx doctor`.
75
+
76
+ `vgx init` prompts in English when stdin/stdout are TTYs: project name, DB location, provider, OpenCode scope, install mode, then shows the plan and asks `Apply this setup? Type "yes" to continue:`. Any answer other than `yes` exits successfully without writes. In CI/non-TTY without `--yes`, `init` returns the read-only plan and never waits for input.
77
+
78
+ ## Quick path
79
+
80
+ ```bash
81
+ npm run cli -- agents register --project vgxness --name apply-agent --description "Applies focused slices" --instructions "Follow SDD apply rules."
82
+ npm run cli -- agents seed load --file seeds/agents/agent-seed-v1.json
83
+ npm run cli -- agents list --project vgxness
84
+ npm run cli -- agents get --project vgxness --name apply-agent
85
+ npm run cli -- agents resolve --project vgxness --capabilities implementation,typescript --workflow sdd --phase apply --provider opencode --task "Implement a focused slice"
86
+ npm run cli -- agents render --provider json --project vgxness --name apply-agent
87
+ npm run cli -- agents render --provider opencode --project vgxness --name apply-agent
88
+ npm run cli -- opencode preview --provider opencode --agent apply-agent --project vgxness --change my-change --phase apply-progress
89
+ npm run cli -- sdd status --project vgxness --change my-change
90
+ ```
91
+
92
+ `agents render` returns generated artifacts in JSON. It does **not** install them or write `.opencode/`, `.claude/`, or any user/global provider config.
93
+
94
+ `agents seed load` reads a project-local JSON manifest and upserts those agents into the local SQLite registry. It does **not** install OpenCode, create `.opencode/` or `.claude/`, or write provider/user/global config.
95
+
96
+ `opencode preview` returns a combined, preview-only injection envelope for future OpenCode/MCP/hook callers. It does **not** execute OpenCode, install hooks or MCP servers, create runs, record skill usage, or write provider config.
97
+
98
+ ## Guided dashboard
99
+
100
+ Use the interactive dashboard for a read-only operational view and guided setup:
101
+
102
+ ```bash
103
+ npm run cli --
104
+ npm run cli -- dashboard interactive [--project vgxness] [--change my-change]
105
+ npm run cli -- dashboard status --project vgxness [--change my-change]
106
+ ```
107
+
108
+ The installed `vgxness` binary opens the interactive dashboard when run with no arguments. Use `vgxness --help` or `vgxness -h` to print command help without starting the dashboard; explicit subcommands keep their normal behavior.
109
+
110
+ The top-level menu is exactly: **Setup, Workflows, Runs, Approvals, Agents, SDD, Doctor, Settings**. Terminal controls are `1-8` to switch screens, `r` to refresh, `?` for help, and `q` to quit. In Setup, use `n`/`b` for wizard steps, `j`/`k` for provider focus, `space` to toggle selection, `d` for details, and `esc` to close details or go back.
111
+
112
+ `dashboard interactive` can launch without `--project`; it opens Setup and reports environment/provider guidance while project-scoped checks are deferred rather than failed. Project-scoped screens render recoverable `project-required` states until you relaunch or refresh with a project.
113
+
114
+ Provider support shown in the Setup wizard is:
115
+
116
+ - **OpenCode** — supported primary provider with preview/status/doctor and read-only install planning.
117
+ - **Claude** — preview-only guidance; no install/apply action is exposed.
118
+ - **Antigravity** — placeholder/coming-soon guidance only.
119
+ - **Custom/future** — extension point with safe manual/default unsupported behavior.
120
+
121
+ The dashboard displays preview/status data, workflow registry entries, run traces, and approvals/preflights as read-only/copy-only data. It does **not** silently write OpenCode or other provider config, does **not** call provider executables, does **not** run install/apply/doctor/workflow commands, and does **not** approve/reject preflights. Any operational next action is copied for explicit execution outside the TUI.
122
+
123
+ ## Natural-language orchestrator preview
124
+
125
+ Use `orchestrator preview` when you want `vgxness` to classify a request before deciding whether to answer directly, plan manually, diagnose, or enter SDD:
126
+
127
+ ```bash
128
+ npm run cli -- orchestrator preview \
129
+ --project vgxness \
130
+ --intent "Build a new persistent checkout workflow" \
131
+ --change checkout-workflow \
132
+ --db .vgx/memory.sqlite
133
+ ```
134
+
135
+ The command prints a deterministic JSON envelope with `flow`, `confidence`, `reason`, `signals`, `needsClarification`, optional `suggestedChangeId`, `previewActions`, `safety`, and optional read-only SDD `status`/`next` context when `--change` is supplied.
136
+
137
+ Safety boundary: this is a preview only. It does **not** call providers, edit files, write provider config, create runs, run installers, install global memory, or create `openspec/`. Preview actions are labels/manual commands for review, not executed steps.
138
+
139
+ ## Workflow CLI
140
+
141
+ Use workflow commands when you want an explicit operator-controlled path from intent classification to a recorded run and, optionally, a guarded execution request. Supported workflows are `explore`, `quickfix`, `plan`, `build`, `debug`, and `sdd`:
142
+
143
+ - `explore` — inspect or discover context without committing to implementation.
144
+ - `quickfix` — small, low-risk fixes where formal SDD is likely unnecessary.
145
+ - `plan` — produce a plan or review path before implementation.
146
+ - `build` — implement a planned feature or change.
147
+ - `debug` — investigate and validate a bug or failure.
148
+ - `sdd` — substantial or high-risk work that should follow formal SDD phases.
149
+
150
+ Each workflow has three modes:
151
+
152
+ ```bash
153
+ npm run cli -- <workflow> preview --project <name> --intent <text>
154
+ npm run cli -- <workflow> run --project <name> --intent <text> [--phase <name>] [--agent-id <id>] [--db <path>]
155
+ npm run cli -- <workflow> execute --run-id <id> --confirm [--override-escalation] [--workspace <path>] [--db <path>] [--executor safe-non-dispatching|provider|command]
156
+ ```
157
+
158
+ `preview` is read-only: it returns the workflow registry plus optional planner output, does not open or write the database, does not create runs, does not call providers, does not edit files, and does not write provider config. Use it to choose between `quickfix`, `debug`, `sdd`, or another workflow before recording state.
159
+
160
+ `run` records the selected workflow intent and a `workflow-run-planned` checkpoint in the local SQLite store. It selects or validates an agent, stores the run id, and reports any planner recommendation such as SDD escalation. It does not dispatch providers, edit files, write provider config, create subagents, or mutate SDD artifacts.
161
+
162
+ `execute` is the explicit gated continuation for an existing run. It requires `--run-id` and `--confirm`, verifies the run belongs to the workflow command being executed, resolves the selected agent, checks escalation unless `--override-escalation` is supplied, and records preflight/evidence before any executor can run. The default `safe-non-dispatching` executor records ready-to-dispatch/preflight state only. The `provider` executor is guarded and non-dispatching unless enforceable evidence and adapter gates prove dispatch is safe.
163
+
164
+ Examples:
165
+
166
+ ```bash
167
+ # Preview a small docs/help fix.
168
+ npm run cli -- quickfix preview \
169
+ --project vgxness \
170
+ --intent "Fix the CLI help copy for workflow execute"
171
+
172
+ # Record a debug workflow run, then inspect the run id in the JSON output.
173
+ npm run cli -- debug run \
174
+ --project vgxness \
175
+ --intent "Investigate why workflow execute is blocked" \
176
+ --db /tmp/vgxness-debug.sqlite
177
+
178
+ # Record formal SDD work at a canonical phase.
179
+ npm run cli -- sdd run \
180
+ --project vgxness \
181
+ --intent "Implement the workflow CLI documentation" \
182
+ --phase apply-progress \
183
+ --db /tmp/vgxness-sdd.sqlite
184
+
185
+ # Execute a previously recorded run with the default non-dispatching gate.
186
+ npm run cli -- quickfix execute \
187
+ --run-id <run-id> \
188
+ --confirm \
189
+ --db /tmp/vgxness-debug.sqlite
190
+ ```
191
+
192
+ ### Command executor allowlist
193
+
194
+ Use `--executor command` only for the built-in bounded-process checks. It never accepts shell strings; each command maps to a fixed executable and argv array:
195
+
196
+ | `--command` | Fixed argv | Timeout | Output cap | Use |
197
+ | --- | --- | ---: | ---: | --- |
198
+ | `typecheck` | `npm run typecheck` | 60s | 256 KiB | Run the project TypeScript typecheck script. |
199
+ | `node-version` | `node --version` | 5s | 8 KiB | Harmless local runtime smoke check. |
200
+
201
+ ```bash
202
+ npm run cli -- quickfix execute \
203
+ --run-id <run-id> \
204
+ --confirm \
205
+ --executor command \
206
+ --command typecheck \
207
+ --command-cwd . \
208
+ --command-targets src/cli/dispatcher.ts,docs/cli.md \
209
+ --db /tmp/vgxness-workflow.sqlite
210
+ ```
211
+
212
+ Command execution is bounded to the workspace: `--command-cwd` must resolve inside `--workspace` (or the current working directory when `--workspace` is omitted), provider/OpenCode config directories are rejected as cwd or targets, timeouts and output caps are enforced, and the process runs without a shell. It is not a general sandbox: it does not provide filesystem or network isolation beyond the explicit cwd/target validation and fixed command allowlist.
213
+
214
+ ### Workflow approvals CLI
215
+
216
+ Use approval commands to resolve per-operation human approval requests without loosening global permissions:
217
+
218
+ ```bash
219
+ npm run cli -- approvals list [--run-id <id>] [--db <path>]
220
+ npm run cli -- approvals approve --id <approval-id> [--db <path>]
221
+ npm run cli -- approvals reject --id <approval-id> [--reason <text>] [--db <path>]
222
+ ```
223
+
224
+ The safer default is unchanged: shell operations use `shell: ask` unless explicitly configured otherwise. Approval records let an operator authorize one exact pending operation, instead of changing provider or global permissions to make future shell operations pass automatically.
225
+
226
+ Command executor approval flow:
227
+
228
+ ```bash
229
+ # 1. Record the workflow run and keep the returned run id.
230
+ npm run cli -- quickfix run \
231
+ --project vgxness \
232
+ --intent "Check the local Node runtime" \
233
+ --db /tmp/vgxness-workflow.sqlite
234
+
235
+ # 2. Request an allowlisted command dispatch. With shell ask, this stops at approval.
236
+ npm run cli -- quickfix execute \
237
+ --run-id <run-id> \
238
+ --confirm \
239
+ --executor command \
240
+ --command node-version \
241
+ --db /tmp/vgxness-workflow.sqlite
242
+
243
+ # 3. Inspect the pending approval for that run.
244
+ npm run cli -- approvals list \
245
+ --run-id <run-id> \
246
+ --db /tmp/vgxness-workflow.sqlite
247
+
248
+ # 4. Approve the exact recorded operation.
249
+ npm run cli -- approvals approve \
250
+ --id <approval-id> \
251
+ --db /tmp/vgxness-workflow.sqlite
252
+
253
+ # 5. Re-run the same execute command; the command now dispatches.
254
+ npm run cli -- quickfix execute \
255
+ --run-id <run-id> \
256
+ --confirm \
257
+ --executor command \
258
+ --command node-version \
259
+ --db /tmp/vgxness-workflow.sqlite
260
+ ```
261
+
262
+ When approval is required, `execute` returns `status:"needs-human"`, `reason:"approval-required"`, and an approval id in the preflight audit. `approvals list --run-id <run-id>` shows pending approvals for that run; omit `--run-id` to list pending approvals across runs in the selected database.
263
+
264
+ Approval reuse is intentionally narrow. A resolved approval must match the run id, permission category and operation, command input, selected agent, workflow, and related metadata closely enough for the same operation to resume. A different command, run, workflow, or selected-agent context will not reuse the old approval.
265
+
266
+ To deny an operation, reject the approval instead of approving it:
267
+
268
+ ```bash
269
+ npm run cli -- approvals reject \
270
+ --id <approval-id> \
271
+ --reason "not appropriate for this run" \
272
+ --db /tmp/vgxness-workflow.sqlite
273
+ ```
274
+
275
+ A rejected approval is recorded in the run audit trail and prevents the matching operation from dispatching on retry; create a new run or request a different operation if the decision changes later.
276
+
277
+ ### SDD workflow commands vs formal SDD commands
278
+
279
+ `sdd preview`, `sdd run`, and `sdd execute` are workflow commands and use the three-mode workflow contract above. `sdd status`, `sdd ready`, `sdd save-artifact`, `sdd get-artifact`, `sdd list-artifacts`, and `sdd next` are formal SDD artifact/status commands. Formal SDD commands read or write SDD artifact state in the selected local SQLite store; they do not execute providers or continue workflow runs.
280
+
281
+ ## MCP setup preview and doctor
282
+
283
+ Use this flow to manually verify MCP readiness after implementation. Setup preview is read-only: it does **not** install anything, create `.opencode/` or `.claude/`, or write provider/user/global config.
284
+
285
+ ```bash
286
+ npm run cli -- mcp setup --preview --provider opencode --db <path>
287
+ npm run cli -- mcp setup --preview --provider claude --db <path>
288
+ npm run cli -- mcp doctor --db <path> --project vgxness --change manual-smoke
289
+ ```
290
+
291
+ The setup preview JSON includes `installable:false`, `readOnly:true`, `writesProviderConfig:false`, plus a copyable MCP server command. Without `--db`, preview snippets omit `--db` and rely on the global default database; with `--db <path>` or `VGXNESS_DB_PATH`, snippets keep the explicit database argument. If needed, copy the `server.command` and `server.args` from the preview into your client manually; the preview itself never writes that config. For OpenCode project config automation, inspect `mcp install opencode --plan` before applying with `--yes`.
292
+
293
+ Doctor prints JSON with `ready` and `checks`. `ready:true` means required checks passed. `ready:false` means at least one required check failed; read the failed check `id`, `detail`, and optional `remediation` to fix the local setup, then run doctor again.
294
+
295
+ ## OpenCode MCP visibility
296
+
297
+ Use this read-only diagnostic when you need to confirm why OpenCode sees the project-local `vgxness` server from the repo but not from outside the worktree:
298
+
299
+ ```bash
300
+ npm run cli -- mcp doctor opencode
301
+ opencode mcp list
302
+ ```
303
+
304
+ Run both commands from the `vgxness` repo or a directory inside its worktree. The diagnostic reports the current cwd, detected project root, expected project target `.opencode/opencode.json`, optional user target `$HOME/.config/opencode/opencode.json`, whether each target contains `mcp.vgxness`, and whether the project config is inside OpenCode's project-local discovery boundary for the current cwd.
305
+
306
+ Expected happy path: after OpenCode starts inside `vgxness`, `opencode mcp list` should show `vgxness` with the registered VGXNESS MCP tools exposed by the current build. Treat `SUPPORTED_VGX_MCP_TOOL_NAMES` and `client.listTools()` as the source of truth rather than a fixed count. Restart OpenCode if the server is not listed after project-local config changes.
307
+
308
+ From a parent directory or another path outside the worktree, the project-local `vgxness` server is not expected to appear. Use `mcp install opencode --scope user --plan` to inspect the user/global target without writing it. OpenCode may load project config with higher precedence than user config for a workspace, so check project config first when both define `mcp.vgxness`.
309
+
310
+ ## OpenCode MCP install
311
+
312
+ Use the installer when you want `vgxness` registered in OpenCode instead of copying the setup preview by hand. Project scope is the default; user scope is opt-in:
313
+
314
+ ```bash
315
+ npm run cli -- mcp doctor --db <path> --project vgxness --change manual-smoke
316
+ npm run cli -- mcp install opencode --plan --scope project --db <path>
317
+ npm run cli -- mcp install opencode --yes --scope project --db <path>
318
+ npm run cli -- mcp install opencode --plan --scope user
319
+ npm run cli -- mcp install opencode --yes --scope user
320
+ ```
321
+
322
+ Use `--plan` first when you want concrete target analysis without mutation. It prints the same OpenCode install contract the apply path uses, including `scope`, `targetPath`, `safety`, backup requirement, merge policy, verification hints, and any refusal reason. It does not create `.opencode/`, write user config, touch `$HOME/.config/opencode`, or create backups. Project scope plans target only the project config path; user scope requires explicit `--scope user` and targets `$HOME/.config/opencode/opencode.json` only when requested.
323
+
324
+ The `--yes` flag is required for apply because this path writes OpenCode config. If `--db` and `VGXNESS_DB_PATH` are omitted, the installed server and manual doctor commands omit `--db` and resolve the global default database at runtime. Pass `--db .vgx/memory.sqlite` when you intentionally want the old project-local database, or another explicit path when you need an isolated store preserved in the installed command.
325
+
326
+ On success, the installer creates or updates exactly one target: project scope writes `<workspace>/.opencode/opencode.json`; user scope writes `$HOME/.config/opencode/opencode.json`. It writes top-level `mcp.vgxness` as an OpenCode local server, preserves unrelated fields and `$schema`, and reports the installed `targetPath`, optional `backupPath`, server command, restart warning, and manual doctor command.
327
+
328
+ Safety boundaries:
329
+
330
+ - Project scope is the default. `--scope project` is an explicit alias for the default; `--scope user` is required for `$HOME/.config/opencode/opencode.json`.
331
+ - `--plan` is read-only and `--yes` is the explicit mutating apply path.
332
+ - It refuses to proceed without `--yes`.
333
+ - It refuses ambiguous project targets, missing `HOME` for user scope, malformed JSON, JSONC config, unsupported `mcp` shapes, and existing `mcp.vgxness` by default.
334
+ - Before modifying an existing JSON config, it writes a sibling backup such as `.opencode/opencode.json.backup-20260515T052852123Z` or `$HOME/.config/opencode/opencode.json.backup-20260515T052852123Z`.
335
+ - OpenCode project config may override user config for a workspace; if user-scope install succeeds but `vgxness` is not visible, inspect project `.opencode/opencode.json` first.
336
+
337
+ Rollback is file-based:
338
+
339
+ - If install created a new config, delete the reported `targetPath` (`.opencode/opencode.json` for project scope or `$HOME/.config/opencode/opencode.json` for user scope).
340
+ - If install modified an existing config, restore the reported backup over `targetPath`.
341
+ - Run `npm run cli -- mcp doctor --db <path> --project vgxness --change manual-smoke` again after rollback.
342
+
343
+ Manual OpenCode verification checklist:
344
+
345
+ 1. Run doctor before install and note any failed checks.
346
+ 2. Run `npm run cli -- mcp install opencode --yes --db <path>`.
347
+ 3. Inspect `.opencode/opencode.json` and confirm `mcp.vgxness` has `type:"local"`, a `command` array, and `enabled:true`.
348
+ 4. Restart OpenCode so it reloads project config.
349
+ 5. In OpenCode, confirm the `vgxness` MCP tools are available.
350
+ 6. Call `vgxness_sdd_status` against a known project/change, then run doctor again if anything fails.
351
+
352
+ ## SDD workflow examples
353
+
354
+ Use `sdd` commands to inspect local SDD artifact state and save, read, or list phase artifacts. These commands read and write only the selected `vgxness` local SQLite memory store: `--db <path>` when passed, `VGXNESS_DB_PATH` when set, or the global default database when neither override is present.
355
+
356
+ ```bash
357
+ npm run cli -- sdd status --project vgxness --change sdd-workflow-engine --db /tmp/vgxness-memory.sqlite
358
+ npm run cli -- sdd ready --project vgxness --change sdd-workflow-engine --phase spec --db /tmp/vgxness-memory.sqlite
359
+ npm run cli -- sdd save-artifact --project vgxness --change sdd-workflow-engine --phase proposal --content "# Proposal" --db /tmp/vgxness-memory.sqlite
360
+ npm run cli -- sdd get-artifact --project vgxness --change sdd-workflow-engine --phase proposal --db /tmp/vgxness-memory.sqlite
361
+ npm run cli -- sdd list-artifacts --project vgxness --change sdd-workflow-engine --db /tmp/vgxness-memory.sqlite
362
+ VGXNESS_DB_PATH=/tmp/vgxness-memory.sqlite npm run cli -- sdd list-artifacts --project vgxness --change sdd-workflow-engine
363
+ ```
364
+
365
+ Current phases are `explore`, `proposal`, `spec`, `design`, `tasks`, `apply-progress`, `verify`, and `archive`. Each artifact is stored under `sdd/{change}/{phase}` in the local SQLite memory store. `sdd status` reports which phase artifacts are present and the next ready missing phase. `sdd ready` reports satisfied prerequisites and missing artifact topic keys for one phase. `sdd get-artifact` returns the full stored artifact plus metadata; `sdd list-artifacts` returns matching artifacts in canonical SDD phase order.
366
+
367
+ The SDD CLI is status/persistence only. It does **not** execute providers, continue workflows, create `openspec/`, or write `.opencode/`, `.claude/`, or user/global provider config.
368
+
369
+ ## Agent resolution
370
+
371
+ `agents resolve` ranks registered agents/subagents for a task using transparent metadata rules. It is read-only and does not execute agents, call a model, or mutate provider configuration.
372
+
373
+ ```bash
374
+ npm run cli -- agents resolve --project vgxness --capabilities implementation,typescript --workflow sdd --phase apply --provider opencode --task "Implement the next PRD slice"
375
+ npm run cli -- agents resolve --project vgxness --mode subagent --capabilities review --workflow sdd --phase verify
376
+ ```
377
+
378
+ The response includes ranked `candidates` with `score` and `reasons`, plus `skipped` definitions with reasons such as provider, workflow, capability, scope, or mode mismatch. Exact workflow/phase matches are reported as `workflow phase matched: sdd:<phase>`, and SDD planning or verification task semantics are reported as `phase semantics matched: sdd-planning` or `phase semantics matched: sdd-verification`. Empty adapter maps are treated as provider-neutral; explicit adapter maps must include the requested provider.
379
+
380
+ Resolution v1 uses only current registry metadata: capabilities, workflows/phases, adapters, `skills`, task text, mode, and parent constraints. Future orchestration/AI ranking can build on this result, but it is intentionally not part of v1.
381
+
382
+ ## Agent seed loading
383
+
384
+ Load the checked-in v1 seed when a local registry should contain the project manager and seed subagents:
385
+
386
+ ```bash
387
+ npm run cli -- agents seed load --file seeds/agents/agent-seed-v1.json
388
+ ```
389
+
390
+ The command prints an `AgentSeedLoadSummary` JSON payload with `created`, `updated`, `agents`, `subagents`, and `warnings`. Re-running the same seed is safe: records are upserted by the current project, scope, and name, so existing seed records are updated in place instead of duplicated.
391
+
392
+ The checked-in `vgxness-manager` and SDD subagents are self-contained: their seed instructions describe the MCP-first orchestration contract inline and do not require installing `~/.config/opencode/skills/sdd-*`. SDD skills can still be registered and attached as optional registry assets when a project wants extra reusable guidance.
393
+
394
+ Seed loading preserves user-created agents that are absent from the manifest. It only writes to the selected local registry database (`--db`, `VGXNESS_DB_PATH`, or the global default); it does **not** create `.opencode/`, `.claude/`, provider config, or user/global OpenCode configuration.
395
+
396
+ After loading, you can inspect or preview the seed manager through normal registry commands:
397
+
398
+ ```bash
399
+ npm run cli -- agents get --project vgxness --name vgxness-manager
400
+ npm run cli -- agents render --provider opencode --project vgxness --name vgxness-manager
401
+ ```
402
+
403
+ The render command returns preview artifacts only and keeps provider config untouched.
404
+
405
+ ## Skill examples
406
+
407
+ Register an optional provider-agnostic skill, add an active version, attach it to a workflow phase, and record a simple run outcome. These examples are registry-managed enhancements, not requirements for the checked-in OpenCode manager/subagents:
408
+
409
+ ```bash
410
+ npm run cli -- skills register --project vgxness --name sdd-apply --description "Applies focused SDD slices"
411
+ npm run cli -- skills add-version --project vgxness --name sdd-apply --version 1.0.0 --source-kind path --source-path .config/opencode/skills/sdd-apply/SKILL.md --activate
412
+ npm run cli -- skills attach --project vgxness --name sdd-apply --target-type workflow-phase --target-key sdd:apply
413
+ npm run cli -- skills record-usage --project vgxness --name sdd-apply --outcome helped --run-id <run-id> --target-type workflow-phase --target-key sdd:apply
414
+ ```
415
+
416
+ Resolve the skills that would be available to a runtime context:
417
+
418
+ ```bash
419
+ npm run cli -- skills resolve --agent apply-agent --project vgxness --workflow sdd --phase apply --provider opencode
420
+ npm run cli -- skills resolve --agent apply-agent --project vgxness --phase apply --run <run-id> --record-usage selected
421
+ ```
422
+
423
+ `skills resolve` is read-only by default. It combines matching skill attachments plus the agent definition `skills` field, returns active/current versions only, and includes source metadata plus inline `summary`/`content` when available. It records `selected` or `injected` usage only when both `--run` and `--record-usage` are explicit.
424
+
425
+ Create and review a skill improvement proposal without activating it:
426
+
427
+ ```bash
428
+ npm run cli -- skills propose --project vgxness --name sdd-apply --proposed-version 1.1.0 --source-kind inline --inline-metadata '{"content":"Updated skill body"}' --rationale "Repeated correction from trace" --source-signal '{"kind":"trace-failure"}'
429
+ npm run cli -- skills proposals --status draft
430
+ npm run cli -- skills get-proposal --proposal <proposal-id>
431
+ ```
432
+
433
+ Activation is gated. Submitting and approving a proposal still does **not** change the active skill; only explicit apply creates the new active/current skill version:
434
+
435
+ ```bash
436
+ npm run cli -- skills submit-proposal --proposal <proposal-id> --actor uziel --reason "Ready for review"
437
+ npm run cli -- skills approve-proposal --proposal <proposal-id> --actor uziel --reason "Reviewed diff"
438
+ npm run cli -- skills apply-proposal --proposal <proposal-id> --actor uziel --reason "Activate approved proposal"
439
+ ```
440
+
441
+ Rejected or cancelled proposals cannot be applied. These commands store reviewable diffs and audit metadata in SQLite only; they do not rewrite external skill files or provider configs.
442
+
443
+ Build an injection-ready payload without mutating provider config:
444
+
445
+ ```bash
446
+ npm run cli -- skills payload --agent apply-agent --project vgxness --workflow sdd --phase apply --provider opencode
447
+ ```
448
+
449
+ `skills payload` resolves the same active skills and returns payload v1 JSON: skill identity/version, source kind, available content or an unavailable reason, attachment reasons, and ordering metadata. Inline `content` is included directly. Local `path` sources are loaded read-only only when they resolve inside the current workspace root. URL sources are never fetched in v1 and return `url_fetch_disabled`. The command does **not** write `.opencode/`, `.claude/`, provider prompts, or external skill files.
450
+
451
+ `skills get` returns the current version, all versions, attachments, and usage records:
452
+
453
+ ```bash
454
+ npm run cli -- skills get --project vgxness --name sdd-apply
455
+ npm run cli -- skills list --project vgxness
456
+ ```
457
+
458
+ Skill registry/resolution v1 is descriptive and controlled. It stores source metadata, compatibility hints, attachments, usage outcomes, and reviewable improvement proposals. Payload v1 can load inline content and safe workspace-local path content. It does **not** fetch URLs, mutate provider config, rewrite external skill files, generate unapproved diffs, or activate autonomous updates.
459
+
460
+ ## Subagent examples
461
+
462
+ ```bash
463
+ npm run cli -- subagents register --parent-agent-id <agent-id> --project vgxness --name review-subagent --description "Reviews focused slices" --instructions "Review the current slice."
464
+ npm run cli -- subagents list --parent-agent-id <agent-id>
465
+ npm run cli -- subagents get --project vgxness --name review-subagent
466
+ ```
467
+
468
+ ## JSON definitions
469
+
470
+ Use `--file` when a definition has permissions, memory, workflows, skills, or adapter config. File input is a complete definition: the CLI rejects mixed definition flags such as `--name`, `--project`, `--instructions`, or `--parent-agent-id` when `--file` is present.
471
+
472
+ ```json
473
+ {
474
+ "project": "vgxness",
475
+ "scope": "project",
476
+ "name": "apply-agent",
477
+ "description": "Applies focused slices",
478
+ "instructions": { "kind": "inline", "value": "Follow SDD apply rules." },
479
+ "permissions": { "read": "allow", "edit": "ask", "shell": "ask" },
480
+ "memory": { "scopes": ["project"] },
481
+ "workflows": ["sdd"],
482
+ "skills": ["sdd-apply"],
483
+ "adapters": { "opencode": { "model": "openai/gpt-5.5" } }
484
+ }
485
+ ```
486
+
487
+ ```bash
488
+ npm run cli -- agents register --file ./agent.json
489
+ npm run cli -- subagents register --file ./subagent.json
490
+ ```
491
+
492
+ For subagents, include `parentAgentId` in the JSON file.
493
+
494
+ ## Render preview
495
+
496
+ Render uses the provider-agnostic registry as input and returns generated content only:
497
+
498
+ ```bash
499
+ npm run cli -- agents render --provider json --id <agent-id>
500
+ npm run cli -- agents render --provider opencode --id <agent-id>
501
+ ```
502
+
503
+ Example response shape:
504
+
505
+ ```json
506
+ {
507
+ "provider": "json",
508
+ "installable": false,
509
+ "artifacts": [
510
+ {
511
+ "relativePath": "rendered/json/vgxness/project/apply-agent.agent.json",
512
+ "contentType": "application/json",
513
+ "contents": "{...}\n"
514
+ }
515
+ ],
516
+ "warnings": ["Rendering returns preview artifacts only; it does not install or write provider configuration."]
517
+ }
518
+ ```
519
+
520
+ OpenCode preview returns one safe artifact path, not a real config write:
521
+
522
+ ```json
523
+ {
524
+ "provider": "opencode",
525
+ "installable": false,
526
+ "artifacts": [
527
+ {
528
+ "relativePath": "rendered/opencode/vgxness/project/apply-agent/opencode.json",
529
+ "contentType": "application/json",
530
+ "contents": "{\"$schema\":\"https://opencode.ai/config.json\",\"agent\":{...}}\n"
531
+ }
532
+ ]
533
+ }
534
+ ```
535
+
536
+ The preview `opencode.json` includes `$schema` and an `agent` object. Top-level registry agents render as OpenCode `primary`; registered subagents render as `subagent`.
537
+
538
+ ## OpenCode injection preview
539
+
540
+ Use `opencode preview` when you want to inspect the full SDD context that could later be handed to an OpenCode integration:
541
+
542
+ ```bash
543
+ npm run cli -- opencode preview \
544
+ --provider opencode \
545
+ --agent apply-agent \
546
+ --project vgxness \
547
+ --change checkout-flow \
548
+ --phase apply-progress
549
+ ```
550
+
551
+ Required inputs are `--provider opencode`, exactly one of `--agent` or `--agent-id`, `--project`, `--change`, and `--phase`. Add `--scope personal` only when selecting a personal-scope agent; otherwise project scope is used.
552
+
553
+ The command prints only the preview envelope JSON on success:
554
+
555
+ ```json
556
+ {
557
+ "version": 1,
558
+ "provider": "opencode",
559
+ "installable": false,
560
+ "readOnly": true,
561
+ "context": {
562
+ "project": "vgxness",
563
+ "change": "checkout-flow",
564
+ "workflow": "sdd",
565
+ "phase": "apply-progress",
566
+ "provider": "opencode",
567
+ "agent": { "id": "...", "name": "apply-agent", "scope": "project", "mode": "agent" }
568
+ },
569
+ "providerArtifacts": { "provider": "opencode", "installable": false, "artifacts": [] },
570
+ "skillPayload": { "version": 1, "providerAgnostic": true, "items": [] },
571
+ "sdd": { "status": {}, "readiness": {} },
572
+ "safety": {
573
+ "installable": false,
574
+ "readOnly": true,
575
+ "executesProvider": false,
576
+ "writesProviderConfig": false,
577
+ "recordsRuns": false,
578
+ "recordsSkillUsage": false
579
+ },
580
+ "warnings": ["OpenCode injection preview is preview-only and installable=false."]
581
+ }
582
+ ```
583
+
584
+ Validation failures are deterministic and print `validation_failed: ...` to stderr with no partial JSON envelope. Unsupported providers fail; this command currently supports only `--provider opencode`.
585
+
586
+ The boundary is intentionally strict: the preview composes the existing OpenCode render artifact, skill payload, and SDD status/readiness so future MCP or hook wiring has a stable contract. It is not live injection yet.
587
+
588
+ ## Memory examples
589
+
590
+ ```bash
591
+ npm run cli -- memory save --project vgxness --type decision --title "CLI path" --content "Use local SQLite by default."
592
+ npm run cli -- memory search --project vgxness --query SQLite
593
+ ```
594
+
595
+ ## Run examples
596
+
597
+ Create an auditable local run record, add a checkpoint, inspect it, and finish it:
598
+
599
+ ```bash
600
+ npm run cli -- runs create --project vgxness --intent "Build runtime foundation" --workflow sdd --phase apply --agent-id apply-agent --provider-adapter opencode --model openai/gpt-5.5
601
+ npm run cli -- runs permission-check --run-id <run-id> --category shell --operation npm-test
602
+ npm run cli -- runs approvals --run <run-id>
603
+ npm run cli -- runs approve --approval <approval-id> --actor uziel --reason "Approved for local verification"
604
+ npm run cli -- runs checkpoint --run-id <run-id> --label after-plan --state '{"next":"tests"}'
605
+ npm run cli -- runs get --id <run-id>
606
+ npm run cli -- runs resume-inspect --id <run-id>
607
+ npm run cli -- runs resume-gate --approval <approval-id>
608
+ npm run cli -- runs list --project vgxness
609
+ npm run cli -- runs finish --run-id <run-id> --status completed --outcome success
610
+ ```
611
+
612
+ Runs are runtime state, not long-term memory. Use event and checkpoint payloads to reference memory observation IDs or artifact IDs when needed; do not duplicate durable observations into run state.
613
+
614
+ `runs permission-check` evaluates the same core permission policy as `permissions check`, records a `permission-decision` event on the run timeline, and returns the decision plus event. When the decision is `ask`, it also creates a pending approval record linked to that decision event. `allow` and `deny` decisions do not create approvals.
615
+
616
+ Resolving an approval appends an `approval` audit event and updates the approval status:
617
+
618
+ ```bash
619
+ npm run cli -- runs approve --approval <approval-id> --actor uziel --reason "Looks safe"
620
+ npm run cli -- runs reject --approval <approval-id> --actor uziel --reason "Too broad"
621
+ npm run cli -- runs cancel-approval --approval <approval-id> --actor uziel --reason "No longer needed"
622
+ ```
623
+
624
+ Approval resolution is persistence-only: approving records human consent but does **not** execute by itself. Resume-after-approval currently exists only in the runtime service through `RunService.resumeApprovedOperation({ approvalId, executor })`, and it requires an injected fake/test/sandbox executor supplied by code. Before that injected executor is called, the service writes a durable operation attempt reservation with an ordered attempt sequence. Storage supports multiple attempts per approval for future retries, but active `reserved` attempts still block another reservation. The default retry policy is `never`: repeated resume calls for the same approval fail before executor invocation after `reserved`, `succeeded`, `failed`, or `abandoned` attempts, even if the final runtime event was not recorded.
625
+
626
+ `runs retry-check` evaluates whether an approval is eligible for another attempt. It is read-only: it does **not** retry, reserve an attempt, invoke an executor, append events, or mutate retry state. Without `--policy`, it uses the safe default policy, `never`.
627
+
628
+ ```bash
629
+ npm run cli -- runs retry-check --approval <approval-id>
630
+ npm run cli -- runs retry-check --approval <approval-id> --policy '{"mode":"after-failure","retryableStatuses":["failed"]}'
631
+ ```
632
+
633
+ Example blocked response:
634
+
635
+ ```json
636
+ {
637
+ "approvalId": "...",
638
+ "runId": "...",
639
+ "decision": "blocked",
640
+ "allowed": false,
641
+ "reasonCode": "retry_disabled",
642
+ "reason": "Retry blocked by policy never after failed",
643
+ "policy": { "mode": "never" },
644
+ "retryableStatuses": [],
645
+ "evaluatedAttemptCount": 1,
646
+ "executorInvoked": false,
647
+ "operationExecuted": false
648
+ }
649
+ ```
650
+
651
+ Policy input is strict JSON. Current policy modes are `never`, `after-abandoned`, `after-failure`, and `after-failure-or-abandoned`; active `reserved` attempts and already `succeeded` attempts are never retryable.
652
+
653
+ ### Read-only resume inspection
654
+
655
+ Use `runs resume-inspect --id <run-id>` when an operator needs checkpoint and blocker context before deciding what to do manually:
656
+
657
+ ```bash
658
+ npm run cli -- runs resume-inspect --id <run-id>
659
+ ```
660
+
661
+ The JSON output includes the run identity and status, latest checkpoint or `null`, blockers, pending approvals, active and failed attempts, debug evidence references, conservative `manualNextCommands`, and safety flags:
662
+
663
+ ```json
664
+ {
665
+ "safety": {
666
+ "executableResume": false,
667
+ "executorInvoked": false,
668
+ "operationExecuted": false,
669
+ "writesProviderConfig": false,
670
+ "createsSandbox": false,
671
+ "createsWorktree": false
672
+ }
673
+ }
674
+ ```
675
+
676
+ Manual next-command examples include `vgxness runs get --id <run-id>`, `vgxness runs timeline --id <run-id>`, `vgxness runs debug --id <run-id>`, `vgxness runs resume-plan --id <run-id>`, `vgxness runs approvals --run <run-id>`, and `vgxness runs retry-check --approval <approval-id>`. The inspect command does not run those commands for you.
677
+
678
+ This flow is inspection only. It does **not** execute provider work, run preflight, admit retry attempts, write provider config, create sandboxes, create worktrees, or expose a CLI resume command.
679
+
680
+ ### Read-only resume gate
681
+
682
+ Use `runs resume-gate --approval <approval-id>` after `resume-inspect` identifies a pending approval and you want one approval-scoped planner response:
683
+
684
+ ```bash
685
+ npm run cli -- runs resume-inspect --id <run-id>
686
+ npm run cli -- runs resume-gate --approval <approval-id>
687
+ npm run cli -- runs resume-gate --approval <approval-id> --policy '{"mode":"after-failure","retryableStatuses":["failed"]}'
688
+ ```
689
+
690
+ resume-gate is plan-only. It returns the `RunService.getRunResumeOrchestrationPlan` JSON with run and approval status, reconstructed pending operation context, retry-check guidance, blockers, manual next commands, and read-only safety flags. It does **not** run preflight, admit retry, invoke executors, execute operations, write provider config, create sandboxes, create worktrees, or append audit mutation records.
691
+
692
+ Manual next-step examples:
693
+
694
+ - `npm run cli -- runs approve --approval <approval-id> --actor <name> --reason "Reviewed"` when the approval is still pending.
695
+ - `npm run cli -- runs retry-check --approval <approval-id>` to inspect retry eligibility separately.
696
+ - Inspect the returned operation and continue manually outside the CLI if policy and human review allow it.
697
+
698
+ There is still no executable `runs resume` CLI surface. The gate only explains the next safe manual step.
699
+
700
+ If a reservation gets stuck, code can call `RunService.abandonReservedOperationAttempt({ attemptId, actor, reason })`. This records `abandoned` plus an audit event and does not execute, retry, or invoke any executor. There is no CLI resume, abandon, or retry command yet because the CLI has no safe default executor or operator flow.
701
+
702
+ Code can also call `RunService.admitOperationRetryAttempt({ approvalId, policy, executorName })` to reserve retry metadata only after explicit policy evaluation allows the latest terminal attempt. This is **not** retry execution: it appends audit metadata with `executorInvoked: false` and `operationExecuted: false`, and it does not call a shell, filesystem, network, provider, or executor. CLI mutation for retry admission is intentionally deferred until the operator UX clearly separates reservation from actual execution.
703
+
704
+ The runtime service has an enforcement gate for operation attempts, but there is intentionally no CLI command for real execution yet. Denied and approval-required operations are blocked before executor invocation, and allowed or approved-resumed operations require an injected fake/test/sandbox executor from code.
705
+
706
+ ## Permission check examples
707
+
708
+ Preview the current core policy without executing the operation:
709
+
710
+ ```bash
711
+ npm run cli -- permissions check --category read --operation read-file --path src/index.ts
712
+ npm run cli -- permissions check --category edit --operation write-file --path ../outside.txt
713
+ npm run cli -- permissions check --category provider-tool --operation call-tool --provider-tool vendor.tool
714
+ ```
715
+
716
+ The response is a decision object with `decision`, `reason`, and `message`. This is a policy decision service only; use `runs permission-check` when you also want an auditable run event and approval record for `ask`. Real provider/tool execution, CLI resume wiring, and isolated sandbox execution remain follow-up work.
717
+
718
+ ## Storage
719
+
720
+ By default, vgxness uses a global user data database and creates the parent directory when needed:
721
+
722
+ | Platform | Global default |
723
+ |---|---|
724
+ | macOS | `~/Library/Application Support/vgxness/memory.sqlite` |
725
+ | Linux | `${XDG_DATA_HOME:-~/.local/share}/vgxness/memory.sqlite` |
726
+ | Windows | `%APPDATA%\\vgxness\\memory.sqlite` |
727
+
728
+ Selection precedence is `--db <path>` (selected source: `flag`) > `VGXNESS_DB_PATH` (selected source: `environment`) > global default (selected source: `global-default`). The resolver fails clearly if no user data base directory is available instead of falling back to the current working directory.
729
+
730
+ Override the path when you need an isolated store:
731
+
732
+ ```bash
733
+ npm run cli -- agents list --db /tmp/vgxness.sqlite
734
+ VGXNESS_DB_PATH=/tmp/vgxness.sqlite npm run cli -- memory search --project vgxness
735
+ ```
736
+
737
+ Existing project-local stores remain compatible; opt in explicitly when needed:
738
+
739
+ ```bash
740
+ npm run cli -- memory search --project vgxness --db .vgx/memory.sqlite
741
+ ```