vgxness 1.5.1 → 1.6.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 (56) hide show
  1. package/README.md +23 -2
  2. package/dist/agents/agent-seed-service.js +10 -0
  3. package/dist/agents/canonical-agent-manifest.js +177 -0
  4. package/dist/agents/canonical-agent-projection.js +164 -0
  5. package/dist/agents/renderers/claude-renderer.js +30 -52
  6. package/dist/cli/bun-bin.js +6 -0
  7. package/dist/cli/cli-flags.js +1 -1
  8. package/dist/cli/cli-help.js +7 -4
  9. package/dist/cli/commands/agent-skill-dispatcher.js +6 -5
  10. package/dist/cli/commands/interactive-entrypoint-dispatcher.js +2 -2
  11. package/dist/cli/commands/mcp-dispatcher.js +75 -3
  12. package/dist/cli/commands/setup-dispatcher.js +9 -0
  13. package/dist/cli/index.js +1 -1
  14. package/dist/cli/tui/main-menu/main-menu-read-model.js +41 -44
  15. package/dist/cli/tui/main-menu/main-menu-render-shape.js +15 -15
  16. package/dist/cli/tui/opentui/main-menu/screen.js +39 -41
  17. package/dist/cli/tui/opentui/main-menu/smoke.js +1 -1
  18. package/dist/cli/tui/opentui/main-menu/view.js +1 -1
  19. package/dist/cli/tui/setup/setup-tui-read-model.js +15 -12
  20. package/dist/governance/governance-report-builder.js +45 -26
  21. package/dist/mcp/claude-code-agent-config.js +95 -0
  22. package/dist/mcp/claude-code-cli.js +71 -0
  23. package/dist/mcp/claude-code-config.js +84 -0
  24. package/dist/mcp/claude-code-project-memory.js +127 -0
  25. package/dist/mcp/claude-code-scope.js +18 -0
  26. package/dist/mcp/client-install-claude-code-contract.js +114 -0
  27. package/dist/mcp/client-install-claude-code.js +136 -0
  28. package/dist/mcp/index.js +8 -0
  29. package/dist/mcp/opencode-default-agent-config.js +7 -113
  30. package/dist/mcp/provider-canonical-agent-manifest.js +39 -0
  31. package/dist/mcp/provider-change-plan.js +109 -1
  32. package/dist/mcp/provider-doctor.js +105 -1
  33. package/dist/mcp/provider-health-types.js +4 -0
  34. package/dist/mcp/provider-status.js +159 -3
  35. package/dist/mcp/schema.js +6 -5
  36. package/dist/mcp/validation.js +1 -1
  37. package/dist/memory/memory-service.js +4 -0
  38. package/dist/sdd/sdd-workflow-service.js +129 -59
  39. package/dist/setup/providers/claude-setup-adapter.js +13 -8
  40. package/dist/setup/setup-plan.js +60 -1
  41. package/docs/architecture.md +55 -113
  42. package/docs/cli.md +90 -2
  43. package/docs/code-runtime.md +218 -0
  44. package/docs/contributing.md +120 -0
  45. package/docs/glossary.md +211 -0
  46. package/docs/mcp.md +144 -0
  47. package/docs/prd.md +23 -26
  48. package/docs/providers.md +150 -0
  49. package/docs/roadmap.md +88 -0
  50. package/docs/safety.md +147 -0
  51. package/docs/storage.md +93 -0
  52. package/package.json +1 -1
  53. package/docs/funcionamiento-del-sistema.md +0 -865
  54. package/docs/harness-gap-analysis.md +0 -243
  55. package/docs/vgxcode.md +0 -87
  56. package/docs/vgxness-code.md +0 -48
@@ -0,0 +1,211 @@
1
+ # Glossary
2
+
3
+ Terms used across the VGXNESS docs and codebase. The product surface is small enough that most of these are first-class concepts in `src/` rather than incidental vocabulary.
4
+
5
+ ## Acceptance
6
+
7
+ A human-only action that records explicit approval of a SDD phase artifact. `vgxness_sdd_accept_artifact` requires `acceptedBy.type === 'human'`; the runtime rejects agent or anonymous acceptance. Acceptance is distinct from artifact presence — saving a draft never implies acceptance.
8
+
9
+ ## Adapter
10
+
11
+ A translator between VGXNESS's provider-neutral domain and a specific provider. The control plane uses renderers/install planners (OpenCode, JSON, Claude project-local support). The code runtime uses `CodeProviderAdapter` implementations (`openai-compatible`, `fake`).
12
+
13
+ ## Agent
14
+
15
+ A provider-neutral definition of who executes work. Carries role, instructions, capabilities, model preference, permissions, and compatible workflows. Subagents are specialized agents intended for delegated, scoped work with constrained tools.
16
+
17
+ ## Approval record
18
+
19
+ A first-class record linked to a permission-decision event. Created when a permission request resolves to `ask`; resolved once as `approved`, `rejected`, or `cancelled` with actor, reason, and timestamp. Approvals drive `resumeApprovedOperation(...)`.
20
+
21
+ ## Attempt
22
+
23
+ A reserved operation execution linked to an approval. Attempts transition through `reserved` → `succeeded` | `failed` | `abandoned`. Multiple ordered attempts are allowed per approval, but only one is `reserved` at a time.
24
+
25
+ ## Blockers (SDD cockpit)
26
+
27
+ Aggregated reasons a SDD phase is not ready. Kinds: `missing-topic-key`, `unaccepted-phase`, `legacy-artifact`, `readiness`. Surfaced through `vgxness_sdd_cockpit`.
28
+
29
+ ## Bun
30
+
31
+ The canonical installed CLI/MCP runtime and verification path. Required `>= 1.3.14`. The only supported storage runtime (via `bun:sqlite`).
32
+
33
+ ## Canonical agent manifest
34
+
35
+ The built-in, validated manifest that defines the manager agent and the SDD subagents (`vgxness-sdd-explore`, `vgxness-sdd-propose`, `vgxness-sdd-spec`, `vgxness-sdd-design`, `vgxness-sdd-tasks`, `vgxness-sdd-apply`, `vgxness-sdd-verify`, `vgxness-sdd-archive`, plus `init` and `onboard`). Lives in `src/agents/canonical-agent-manifest.ts`. `promptContractVersion` increments on breaking contract changes.
36
+
37
+ ## Change (SDD)
38
+
39
+ The unit of SDD work. Identified by a project-scoped `change` id. Artifacts are stored under canonical topic keys `sdd/{change}/{phase}`.
40
+
41
+ ## Checkpoint
42
+
43
+ A labeled, ordered JSON blob attached to a run that lets work resume. Append through `vgxness_run_checkpoint`. Checkpoints are part of the run; they are not the same as memory observations.
44
+
45
+ ## Cockpit
46
+
47
+ A read-only SDD aggregate view. `vgxness_sdd_cockpit` returns per-phase status, blockers, and a recommended next action. The TUI should eventually mirror this surface.
48
+
49
+ ## Code runtime
50
+
51
+ The native workspace runtime exposed through `vgxness code` (`inspect` / `plan` / `craft-preview` / `craft` / `sdd`). Provider-neutral; speaks to any OpenAI-compatible endpoint through `openai-compatible-provider-adapter.ts`.
52
+
53
+ ## Configurator plane
54
+
55
+ The part of VGXNESS that renders provider-specific artifacts (OpenCode config, agent JSON) without mutating the registry. Separate from the runtime control plane.
56
+
57
+ ## Control plane
58
+
59
+ The part of VGXNESS that owns workflow state, runs, approvals, checkpoints, and audit evidence. Exposed through CLI, TUI, and MCP.
60
+
61
+ ## Decision
62
+
63
+ A permission resolution: `allow`, `ask`, or `deny`. For SDD-phase gating the matrix uses four modes: `allow`, `audit`, `require-preflight`, `deny`.
64
+
65
+ ## Dry-run
66
+
67
+ A read-only preview. Setup plans, MCP setup previews, OpenCode previews, workflow previews, and status views are dry-runs by contract — they must not write provider config or call providers.
68
+
69
+ ## Eval target
70
+
71
+ A testable property of the harness. The 11 eval targets live in [Architecture](./architecture.md) and are covered by `node:test` files under `test/`.
72
+
73
+ ## Execution isolation plan
74
+
75
+ A planned strategy for executing a reserved operation: `workspace`, `git-worktree`, or `process-sandbox`. Produced by `planExecutionIsolation(...)`. The actual executor is still test-only in v1.5.1.
76
+
77
+ ## Governance report
78
+
79
+ A redacted, structured report over SDD state, runs, and approvals. Surfaced through `vgxness_governance_report`. Useful for review before promotion.
80
+
81
+ ## MCP
82
+
83
+ Model Context Protocol. The agent-facing transport. VGXNESS exposes 38 typed tools over stdio through `vgxness mcp start`. The tool list lives in `SUPPORTED_VGX_MCP_TOOL_NAMES` (`src/mcp/schema.ts`) and is documented in [MCP tools](./mcp.md).
84
+
85
+ ## Memory observation
86
+
87
+ A durable record in the SQLite store. Identified by `id`; upserted by `topicKey`. Types: `architecture`, `decision`, `bugfix`, `pattern`, `config`, `discovery`, `learning`, `preference`, `manual`. Project or personal scope.
88
+
89
+ ## Natural-language planner
90
+
91
+ The provider-agnostic front-door classifier for operator text. Maps an intent to exactly one preview flow: `direct`, `plan`, `sdd`, or `diagnose`. Non-executing by design.
92
+
93
+ ## OpenCode
94
+
95
+ The primary/default supported provider for the control plane. The configurator renders OpenCode MCP config and manager/SDD agent definitions. Claude Code is supported secondary for project-local VGXNESS MCP/subagent configuration through explicit guarded apply.
96
+
97
+ ## Operation attempt
98
+
99
+ See **Attempt**.
100
+
101
+ ## Payload mode
102
+
103
+ A knob that controls how much context a payload returns. `compact` (default for the manager) keeps tokens bounded; `verbose` returns the full content. Applies to `vgxness_agent_activate`, `vgxness_skill_payload`, `vgxness_sdd_get_artifact`, `vgxness_sdd_list_artifacts`, `vgxness_governance_report`.
104
+
105
+ ## Pending approval
106
+
107
+ An approval record that has not been resolved yet. Created when a permission request resolves to `ask`. Visible in the run details.
108
+
109
+ ## Permission
110
+
111
+ A category of action. Categories: `read`, `edit`, `implementation-edit`, `spec-write`, `design-write`, `task-write`, `shell`, `test-run`, `install`, `network`, `git`, `git-write`, `memory`, `memory-write`, `external-directory`, `provider-tool`, `secrets`. See [Safety model](./safety.md).
112
+
113
+ ## Phase (SDD)
114
+
115
+ A canonical stage in the SDD lifecycle: `explore`, `proposal`, `spec`, `design`, `tasks`, `apply-progress`, `verify`, `archive`. Each phase has prerequisites and an acceptance requirement.
116
+
117
+ ## Policy evaluator
118
+
119
+ The function that resolves a permission request. Returns `allow`, `ask`, or `deny` with a reason. Conservative defaults; workspace boundary denials cannot be relaxed by agent overrides.
120
+
121
+ ## Preflight
122
+
123
+ A permission decision plus execution isolation plan produced before a reserved operation. `vgxness_run_preflight` may create a pending approval when the decision is `ask`.
124
+
125
+ ## Project (scope)
126
+
127
+ One of two memory scopes. `project` is repo-specific; `personal` is user-global. Scopes live in the same database, separated by columns.
128
+
129
+ ## Provider adapter
130
+
131
+ See **Adapter**.
132
+
133
+ ## Readiness
134
+
135
+ Whether a SDD phase can advance. Combines prerequisite artifacts, human acceptance of prerequisites, and aggregate blockers. Surfaced through `vgxness_sdd_ready`, `vgxness_sdd_get_readiness`, and `vgxness_sdd_cockpit`.
136
+
137
+ ## Redaction
138
+
139
+ Stripping secret-shaped values before they leave the runtime. `redactSecrets`, `redactJson`, and `omitSensitiveCommandOutput` live in `src/code/reporting/redaction.ts` and `src/export/redaction.ts`.
140
+
141
+ ## Reserved attempt
142
+
143
+ An operation attempt in the `reserved` state. Exclusive per approval. Finalized to `succeeded` or `failed` after the executor returns; recovery-only `abandoned` for stuck attempts.
144
+
145
+ ## Retry policy
146
+
147
+ The policy that decides whether a new attempt is allowed after a prior one. `never`, `after-abandoned`, `after-failure`, `after-failure-or-abandoned`. Default is `never`. Evaluated by `vgxness_run_resume_gate`.
148
+
149
+ ## Run
150
+
151
+ The auditable unit of execution. Has 8 statuses: `created`, `planned`, `running`, `needs-human`, `completed`, `failed`, `blocked`, `cancelled`. Carries events, checkpoints, approvals, and operation attempts.
152
+
153
+ ## Run snapshot export
154
+
155
+ A versioned JSON package containing the full run, its events, checkpoints, approvals, and attempts. Useful for review and debugging. `RunSnapshotPackageV1`.
156
+
157
+ ## Scope
158
+
159
+ `project` or `personal`. Memory, agents, skills, and manager profile overlays all carry a scope.
160
+
161
+ ## SDD
162
+
163
+ Spec-Driven Development. The canonical workflow `explore → proposal → spec → design → tasks → apply-progress → verify → archive`. See [PRD](./prd.md) for the principles and [Architecture](./architecture.md) for the engine.
164
+
165
+ ## Session
166
+
167
+ A scoped record of work in progress. Started with `vgxness_session_start`, appended to with `vgxness_session_append_activity`, closed with `vgxness_session_close`. The latest restorable session is read through `vgxness_session_restore` or, more reliably, `vgxness_context_cockpit`.
168
+
169
+ ## Skill
170
+
171
+ A versioned, reusable knowledge/procedure that can be attached to an agent, workflow, phase, or provider adapter. Skill improvement proposals must be approved by a human before activation.
172
+
173
+ ## Skill improvement proposal
174
+
175
+ A reviewable, versioned change to a skill. Goes through `draft` → `submitted` → `approved`/`rejected`/`cancelled` → `applied`. Only `approved` proposals can be applied.
176
+
177
+ ## SddCockpitBlocker
178
+
179
+ A typed blocker surfaced by the SDD cockpit. Kinds: `missing-topic-key`, `unaccepted-phase`, `legacy-artifact`, `readiness`. See [Safety model](./safety.md) and [Architecture](./architecture.md).
180
+
181
+ ## SddPrerequisiteBlocker
182
+
183
+ A typed blocker for a missing or unaccepted prerequisite phase. Reasons: `missing`, `draft`, `legacy`, `rejected`, `superseded`.
184
+
185
+ ## Subagent
186
+
187
+ See **Agent**.
188
+
189
+ ## Topic key
190
+
191
+ The durable upsert key for memory observations and SDD artifacts. For SDD, the canonical form is `sdd/{change}/{phase}`.
192
+
193
+ ## Trace event
194
+
195
+ A structured event in a run's timeline. Kinds: `timeline`, `evidence`, `memory-operation`, `artifact-reference`, `tool-call`, `permission-decision`, `execution-plan`, `operation-execution`, `approval`, `verification`.
196
+
197
+ ## TUI
198
+
199
+ Terminal UI. OpenTUI (`@opentui/core`) is the framework for the main menu and setup screens.
200
+
201
+ ## Verification plan
202
+
203
+ A recommended set of verification steps for a change type. `vgxness_verification_plan` takes a `changeType` (`docs-only`, `test-only`, `cli`, `mcp`, `sdd-storage`, `provider-setup`, `package-release`, `workflow-runs`) and returns the recommended plan.
204
+
205
+ ## Worktree (planned)
206
+
207
+ A planned execution isolation strategy. `git-worktree` plans produce a plan to mutate inside an isolated worktree; the actual worktree creation is follow-up.
208
+
209
+ ## Workspace boundary
210
+
211
+ The set of paths inside `workspaceRoot`. The policy evaluator uses `realpathSync` to defeat symlink escapes and refuses to relax boundary denials.
package/docs/mcp.md ADDED
@@ -0,0 +1,144 @@
1
+ # MCP tools
2
+
3
+ VGXNESS exposes 38 typed MCP tools over stdio through `vgxness mcp start`. The canonical list is the `SUPPORTED_VGX_MCP_TOOL_NAMES` array in `src/mcp/schema.ts` — treat that as the source of truth. The list below mirrors it; if a tool appears here that is not in the array, or vice versa, the array wins.
4
+
5
+ Tools are exposed under the `vgxness_*` prefix. Some MCP hosts strip the prefix and accept the short form (`sdd_status`, `memory_save`, etc.). The schema accepts both.
6
+
7
+ All tools:
8
+
9
+ - Are read-only or auditable on the VGXNESS side. The only state-mutating tools are the ones explicitly named `*_save`, `*_update`, `*_start`, `*_checkpoint`, `*_finalize`, `*_accept_artifact`, `*_set`, `*_append_activity`, `*_close`, `*_record_*`.
10
+ - Validate input with `zod` before dispatching to the service layer.
11
+ - Return either a typed result or a `VgxMcpError` with a `code` and `message`.
12
+ - Do not require the agent to import or instantiate anything; pass JSON, get JSON.
13
+
14
+ ## SDD workflow (10)
15
+
16
+ | Tool | Purpose | Required inputs | Notes |
17
+ |---|---|---|---|
18
+ | `vgxness_sdd_status` | Report per-phase artifact presence and the next ready missing phase. | `project`, `change` | |
19
+ | `vgxness_sdd_next` | Recommend the next phase decision for a change. | `project`, `change` | |
20
+ | `vgxness_sdd_ready` | Check whether a specific phase is ready. | `project`, `change`, `phase`; optional `runId`, `agentId` | Returns structured `SddReadiness` with `blockedPrerequisites`. |
21
+ | `vgxness_sdd_get_readiness` | Same as `ready` with explicit output shape. | same as `ready` | |
22
+ | `vgxness_sdd_save_artifact` | Persist phase content under canonical topic key `sdd/{change}/{phase}`. | `project`, `change`, `phase`, `content` | Saving does not imply acceptance. |
23
+ | `vgxness_sdd_accept_artifact` | Record explicit human acceptance for a phase. | `project`, `change`, `phase`, `acceptedBy` (`{type:"human", id, displayName?}`); optional `acceptedAt`, `note`, `notes`, `rationale`, `runId`, `agentId` | `acceptedBy.type` must be `"human"`. Runtime rejects agent or anonymous acceptance. |
24
+ | `vgxness_sdd_get_artifact` | Read one full artifact. | `project`, `change`, `phase`; optional `payloadMode` (`compact`/`verbose`) | |
25
+ | `vgxness_sdd_list_artifacts` | List all artifacts for a change in canonical phase order. | `project`, `change`; optional `payloadMode` | |
26
+ | `vgxness_sdd_cockpit` | Aggregate per-phase status, blockers, and recommended next action. | `project`, `change` | Returns `SddCockpit` with `aggregateBlockers` of kinds `missing-topic-key`, `unaccepted-phase`, `legacy-artifact`, `readiness`. |
27
+ | `vgxness_governance_report` | Build a redacted governance report for a project/change/run. | `project`; optional `change`, `runId`, `workflow`, `phase`, `agentId`, `agent` (with `id`, `name`, `mode`, `scope`), `payloadMode` | See [Safety model](./safety.md) for redaction rules. |
28
+
29
+ ## Memory (4)
30
+
31
+ | Tool | Purpose | Required inputs |
32
+ |---|---|---|
33
+ | `vgxness_memory_save` | Upsert memory observation. | `project`, `type` (`architecture`/`decision`/`bugfix`/`pattern`/`config`/`discovery`/`learning`/`preference`/`manual`), `title`, `content`; optional `scope` (`project`/`personal`), `topicKey` |
34
+ | `vgxness_memory_search` | FTS5 search over memory. | `limit` (1–100); optional `project`, `scope`, `type`, `topicKey`, `query` |
35
+ | `vgxness_memory_get` | Read one observation by id. | `id` |
36
+ | `vgxness_memory_update` | Patch an existing observation. | `id`; optional `type`, `title`, `content`, `topicKey` |
37
+
38
+ `topicKey` is the durable upsert key: re-saving with the same key updates the existing observation rather than creating a duplicate.
39
+
40
+ ## Sessions (5)
41
+
42
+ | Tool | Purpose | Required inputs | Notes |
43
+ |---|---|---|---|
44
+ | `vgxness_session_start` | Begin a session record. | `project`; optional `id`, `directory` | If `id` is omitted, the runtime generates one. |
45
+ | `vgxness_session_append_activity` | Append a structured event to a session. | `sessionId`, `actor`, `kind` (`prompt`/`tool_call`/`artifact`/`summary`/`error`), `payloadJson` | `payloadJson` is a stringified JSON value, validated before append. |
46
+ | `vgxness_session_close` | Close a session with a summary. | `sessionId`, `actor`, `summary` (non-empty, trimmed) | |
47
+ | `vgxness_session_restore` | Read the latest restorable session for a project/directory. | `project`; optional `directory` | One signal — not authoritative. Prefer `vgxness_context_cockpit`. |
48
+ | `vgxness_context_cockpit` | Read-only cockpit: recent sessions, bounded memory previews, last restorable session. | `project`; optional `directory`, `limit` | Does not trace, mutate state, run preflight, or write provider config. |
49
+
50
+ ## Agents, profile, skills (5)
51
+
52
+ | Tool | Purpose | Required inputs | Notes |
53
+ |---|---|---|---|
54
+ | `vgxness_agent_resolve` | Rank registered agents/subagents for a task. | `project`, `scope?`, `taskDescription` or `intent`; optional `desiredCapabilities`, `workflow`, `phase`, `providerAdapter`, `mode` (`agent`/`subagent`) | Deterministic rule-based ranking. No model call. |
55
+ | `vgxness_agent_activate` | Build an activation envelope for the resolved agent. | `project`, `agentId` or `name`; optional `scope`, `workflow`, `phase`, `providerAdapter`, `mode`, `workspaceRoot`, `maxSourceBytes`, `payloadMode` | Default `payloadMode` is `compact`. |
56
+ | `vgxness_manager_profile_get` | Read the manager profile overlay. | `project`; optional `scope`, `managerName` | |
57
+ | `vgxness_manager_profile_set` | Upsert a manager profile overlay. | input shape from `SaveManagerProfileOverlayInput` | Requires explicit human authorization in the harness prompt. |
58
+ | `vgxness_skill_payload` | Resolve and build a provider-agnostic skill injection payload. | `agentId`/`name`+`project`+`scope`, `workflow`, `phase`, `providerAdapter`; `workspaceRoot`; optional `maxSourceBytes`, `mode` | `mode` defaults to `compact`. See [Code runtime](./code-runtime.md) for how the runtime consumes this. |
59
+
60
+ ## OpenCode preview (2)
61
+
62
+ | Tool | Purpose | Required inputs | Notes |
63
+ |---|---|---|---|
64
+ | `vgxness_opencode_manager_payload` | Build the OpenCode manager payload envelope. | `OpenCodeManagerPayloadInput` shape (project, scope, agent, workflow/phase, workspaceRoot, maxSourceBytes, payloadMode) | `installable: false`, `readOnly: true`. |
65
+ | `vgxness_opencode_handoff_preview` | Compose a full handoff preview: provider artifacts + skill diagnostics + SDD status + provider status + safety flags. | `project`; optional `scope`, `agentId`, `agentName`, `workspaceRoot`, `maxSourceBytes`, `change`, `phase` | Read-only preview. Does not execute OpenCode, install hooks, or write provider config. |
66
+
67
+ ## Runs (8)
68
+
69
+ | Tool | Purpose | Required inputs | Notes |
70
+ |---|---|---|---|
71
+ | `vgxness_run_list` | List runs with filters. | `limit`; optional `project`, `status` (one of the 8 `RunStatus` values) | |
72
+ | `vgxness_run_get` | Read a run with `events`, `checkpoints`, `approvals`, `operationAttempts`. | `id` | |
73
+ | `vgxness_run_start` | Create a run record. | `CreateRunInput` shape | |
74
+ | `vgxness_run_checkpoint` | Append a resumable JSON state. | `AppendRunCheckpointInput` shape | |
75
+ | `vgxness_run_finalize` | Finalize a run with `outcome` and `outcomeReason`. | `FinalizeRunInput` shape | `outcome` must match a terminal `status`. Re-finalization is rejected. |
76
+ | `vgxness_run_preflight` | Run policy evaluation and return the decision + planned execution isolation strategy. | `PreflightRunOperationInput` shape | May create a pending approval when the decision is `ask`. Does not invoke an executor. |
77
+ | `vgxness_run_resume_inspect` | Plan-only resume advisory. | `runId` | Returns `RunResumeOrchestrationPlan` with blockers and `nextAction` (`resolve-approval`/`inspect-run`/`retry-check`/`manual-recovery`/`no-action`). |
78
+ | `vgxness_run_resume_gate` | Evaluate retry policy for an approval without executing. | `approvalId`; optional `policy` | Default policy is `never`. See [Safety model](./safety.md) for the policy table. |
79
+
80
+ Run `status` accepts the full 8-state vocabulary: `created`, `planned`, `running`, `needs-human`, `completed`, `failed`, `blocked`, `cancelled`. `outcome` is one of `success`, `partial`, `failure`, `blocked`, `cancelled`.
81
+
82
+ ## Providers (3)
83
+
84
+ | Tool | Purpose | Required inputs | Notes |
85
+ |---|---|---|---|
86
+ | `vgxness_provider_status` | Report provider health for a project/scope. | `ProviderHealthInput` shape (project, scope, workspaceRoot, providerAdapter) | Read-only. |
87
+ | `vgxness_provider_doctor` | Run provider health checks with structured JSON output. | same as `status` | |
88
+ | `vgxness_provider_change_plan` | Compose a read-only provider config change plan. | `ProviderChangePlanInput` shape (`provider`: `opencode`/`claude`/`antigravity`/`custom`; `changeType`: `opencode-mcp-install`/`setup`/`install`/`config-preparation`; `workspaceRoot`; `payloadMode`) | Does not write provider config. See [Providers](./providers.md). |
89
+
90
+ ## Verification (1)
91
+
92
+ | Tool | Purpose | Required inputs |
93
+ |---|---|---|
94
+ | `vgxness_verification_plan` | Recommend a verification plan for a change type. | `changeType` (`docs-only`/`test-only`/`cli`/`mcp`/`sdd-storage`/`provider-setup`/`package-release`/`workflow-runs`) |
95
+
96
+ ## Usage patterns
97
+
98
+ Starting, resuming, and ending a session:
99
+
100
+ ```text
101
+ vgxness_session_start { project: "vgxness", directory: "/path" }
102
+ vgxness_session_append_activity { sessionId, actor, kind, payloadJson }
103
+ vgxness_session_close { sessionId, actor, summary }
104
+ ```
105
+
106
+ Inspecting SDD before doing any work:
107
+
108
+ ```text
109
+ vgxness_sdd_cockpit { project: "vgxness", change: "new-flow" }
110
+ vgxness_sdd_get_readiness { project: "vgxness", change: "new-flow", phase: "proposal" }
111
+ ```
112
+
113
+ The cockpit returns `aggregateBlockers`; if any are `unaccepted-phase`, the agent should not run the next phase until a human accepts the prerequisite.
114
+
115
+ Recording a phase with explicit human acceptance:
116
+
117
+ ```text
118
+ vgxness_sdd_save_artifact { project, change, phase: "proposal", content: "..." }
119
+ # human opens the harness and runs:
120
+ vgxness_sdd_accept_artifact { project, change, phase: "proposal", acceptedBy: { type: "human", id: "uziel" }, rationale: "Reviewed proposal." }
121
+ ```
122
+
123
+ Running a planned operation:
124
+
125
+ ```text
126
+ vgxness_run_start { project, userIntent, workflow: "sdd", phase: "apply-progress", selectedAgentId, providerAdapter, model }
127
+ vgxness_run_preflight { runId, category: "edit", operation: "apply_patch", workspaceRoot, targetPath, payload }
128
+ # if decision is "ask", wait for human approval; on approval, the harness resumes via run_resume_inspect + run_resume_gate.
129
+ vgxness_run_checkpoint { runId, label: "after-step-1", state: {...} }
130
+ vgxness_run_finalize { runId, outcome: "success", outcomeReason: "..." }
131
+ ```
132
+
133
+ ## Safety boundary
134
+
135
+ MCP tools do not:
136
+
137
+ - Write provider config (`.opencode/`, `.claude/`, `opencode.json`, `CLAUDE.md`).
138
+ - Execute providers (`opencode`, `claude`, etc.).
139
+ - Install global memory.
140
+ - Create `openspec/`.
141
+ - Bypass permission policy.
142
+ - Mutate other tools' state outside the VGXNESS SQLite store.
143
+
144
+ Tools that would normally mutate external state (provider install, shell, network) are split into a plan/preview step and an explicit `apply` step. The apply step requires an MCP-side `apply` flag or a separate `vgxness` CLI command (e.g. `vgxness setup apply --yes`).
package/docs/prd.md CHANGED
@@ -128,18 +128,7 @@ Minimum MCP capabilities:
128
128
 
129
129
  Candidate MCP tools:
130
130
 
131
- ```text
132
- vgxness_sdd_status
133
- vgxness_sdd_next
134
- vgxness_sdd_ready
135
- vgxness_sdd_save_artifact
136
- vgxness_run_start
137
- vgxness_run_checkpoint
138
- vgxness_run_request_approval
139
- vgxness_agent_resolve
140
- vgxness_skill_payload
141
- vgxness_profile_get
142
- ```
131
+ The current MCP surface covers SDD status and artifacts, memory read/write, sessions, agent resolution and activation, skill payload, OpenCode manager payload, run lifecycle (start, list, get, preflight, checkpoint, finalize, resume inspect, resume gate), provider status/doctor/change-plan, verification plan, governance report, and context cockpit. The full, current list lives in [MCP tools](./mcp.md) and in `SUPPORTED_VGX_MCP_TOOL_NAMES` (`src/mcp/schema.ts`); treat that array as the source of truth.
143
132
 
144
133
  #### CLI
145
134
 
@@ -213,8 +202,8 @@ The same flow must be available through CLI flags for automation and CI-friendly
213
202
 
214
203
  Initial integration targets:
215
204
 
216
- - OpenCode
217
- - Claude Code
205
+ - OpenCode — primary supported provider. The configurator plane renders OpenCode MCP config and manager/SDD agent definitions; the code runtime speaks to any OpenAI-compatible endpoint, including OpenCode's local bridge.
206
+ - Claude Code — supported secondary for project-local VGXNESS MCP/subagent configuration and guarded project-root `CLAUDE.md` managed memory. Confirmed writes are explicit and guarded (`.mcp.json`, `.claude/agents/*.md`, and the `CLAUDE.md` managed block only); VGXNESS does not install/execute Claude Code and never manually writes `~/.claude.json` or `.claude/CLAUDE.md`.
218
207
 
219
208
  Pi/`gentle-pi` is a design reference and future adapter target, not part of the first integration target list unless the MVP scope is explicitly expanded.
220
209
 
@@ -358,15 +347,23 @@ The MVP is successful when an advanced individual developer can:
358
347
 
359
348
  ## Open questions
360
349
 
361
- - What is the first integration adapter: OpenCode or Claude Code?
362
- - Should memory storage be per-repo by default, with global memory in a user-level directory?
363
- - What config format should define agents/subagents?
364
- - What config format should define skills and skill versions?
365
- - Which skill improvement proposals should require approval versus automatic rejection?
366
- - Which commands form the first public CLI surface?
367
- - Which TUI framework should be used for the first implementation?
368
- - Should the MCP server run only over stdio for MVP, or also support local HTTP later?
369
- - What is the safest default install command and update channel?
370
- - What privacy/export guarantees are required before public release?
371
- - What is the first sandbox strategy: normal workspace, git worktree, or process/container isolation?
372
- - What trace format should be used for local inspection and future cloud sync?
350
+ Many of the early PRD questions are resolved in v1.5.1. Tracking them here keeps the historical record.
351
+
352
+ | Question | Resolved as of v1.5.1 |
353
+ |---|---|
354
+ | First integration adapter | OpenCode primary/default; Claude is supported secondary for project-local explicit apply. |
355
+ | Memory storage scopes | Project memory and personal/global memory live in separate SQLite stores; `--db` flag and `VGXNESS_DB_PATH` env var override. |
356
+ | Agent config format | Provider-neutral schema in `src/agents/schema.ts`; canonical manifest with validation in `src/agents/canonical-agent-manifest.ts`. |
357
+ | Skill config format | Versioned skills with source metadata (`path`/`url`/`inline`); active version gating in `src/skills/skill-registry-service.ts`. |
358
+ | Skill improvement approval | All proposals require explicit human approval before activation; rejected/cancelled proposals cannot be applied. |
359
+ | First public CLI surface | `vgxness {init, setup, doctor, mcp, sdd, agents, skills, memory, runs, code, opencode}`. See [CLI reference](./cli.md). |
360
+ | First TUI framework | OpenTUI (`@opentui/core`) for the main menu and setup screens; legacy tui-kit screens still in tree for backwards compatibility. |
361
+ | MCP transport | Local stdio for MVP; HTTP deferred. |
362
+ | Default install command | `npm install -g vgxness` ships both `vgxness` and `vgx` bins; Bun 1.3.14+ is the canonical installed runtime. |
363
+ | Sandbox strategy | Planning-only in v1.5.1 (`src/runs/sandbox-worktree-planning.ts`); real sandbox/worktree execution is follow-up. Approval-gated edits/shell happen through the code runtime's executors. |
364
+
365
+ Still open:
366
+
367
+ - Privacy/export guarantees required before public release (depends on release scope).
368
+ - Distributed multi-worker execution model (post-MVP).
369
+ - Web/hosted console surface (post-MVP).
@@ -0,0 +1,150 @@
1
+ # Providers
2
+
3
+ VGXNESS is provider-agnostic at the core: the registry stores provider-neutral definitions and adapters translate them into provider-specific config and runtime behavior. This document covers the two adapter layers: the **control-plane adapter** (OpenCode primary plus supported secondary Claude Code support) and the **code-runtime provider adapter** (OpenAI-compatible + fake).
4
+
5
+ ## Status (v1.6.0)
6
+
7
+ | Provider | Control plane | Code runtime | Notes |
8
+ |---|---|---|---|
9
+ | OpenCode | `managed` | n/a (target) | Primary supported provider. The configurator renders OpenCode MCP config and manager/SDD agent definitions into the chosen scope. |
10
+ | Claude Code | `supported-secondary` | n/a | Supported for Claude CLI MCP registration planning/apply, project `.mcp.json` compatibility, project-root `CLAUDE.md` managed memory, and project/user agent planning. Scopes are `local`, `project`, and `user`; `personal`/`global` map to `user` for compatibility. Confirmed applies are explicit and guarded; read-only surfaces do not execute Claude Code and VGXNESS never manually mutates `~/.claude.json`. |
11
+ | Antigravity | `placeholder` | n/a | Listed in the TUI Installation surface as coming-soon. |
12
+ | Custom / future | `extension` | extension point | Per the [Architecture](./architecture.md) decision, anything not OpenCode or Claude is a custom extension. |
13
+ | OpenAI-compatible | n/a | `openai-compatible-provider-adapter.ts` | Real adapter used by `vgxness code`. Speaks to any OpenAI-compatible endpoint. |
14
+ | Fake | n/a | `fake-provider-adapter.ts` | Deterministic, offline; for unit tests and CI. |
15
+
16
+ ## Control-plane adapter contract
17
+
18
+ The control-plane adapter takes a root agent plus optional registered subagents and returns previewable artifacts. It does not mutate the registry, write provider config, or call providers.
19
+
20
+ | Type | Purpose |
21
+ |---|---|
22
+ | `ProviderRenderer` | Named renderer for one output format/provider. |
23
+ | `ProviderRenderInput` | A root agent plus optional registered subagents. |
24
+ | `ProviderRenderResult` | Generated artifacts, provider name, `installable: false`, warnings. |
25
+ | `ProviderRenderArtifact` | Relative path, content type, and generated contents. |
26
+
27
+ ### OpenCode renderer
28
+
29
+ `src/agents/renderers/opencode-renderer.ts` renders a single OpenCode config preview with `$schema` and an `agent` object. Top-level agents default to `primary`; subagents render as `subagent`. Agent keys are sanitized deterministically from registry names, and rendering rejects key collisions instead of overwriting generated config.
30
+
31
+ ```bash
32
+ vgxness agents render --provider opencode --project vgxness --name apply-agent
33
+ ```
34
+
35
+ The output is previewable JSON; the renderer does not write to `.opencode/`, `.claude/`, or any user/global provider config.
36
+
37
+ ### JSON renderer
38
+
39
+ `src/agents/renderers/json-renderer.ts` produces a debug/export shape. It includes the matching `adapters.json` as `selectedAdapter` so downstream consumers can replay the same rendering deterministically.
40
+
41
+ ```bash
42
+ vgxness agents render --provider json --project vgxness --name apply-agent
43
+ ```
44
+
45
+ ### Claude Code support
46
+
47
+ Claude Code is supported as a secondary, non-default control-plane target. Read-only status, doctor, setup plan, and change-plan surfaces can inspect or preview Claude targets without Claude Code installed and without writing files.
48
+
49
+ Claude scopes are canonicalized to `local`, `project`, and `user`; VGXNESS compatibility aliases `personal` and legacy `global` map to Claude `user` with warnings. MCP registration is represented as argv only, for example `claude mcp add --scope user vgxness -- vgxness mcp start`; no shell strings or manual `~/.claude.json` edits are generated. Status/doctor/change-plan avoid private Claude config reads and do not execute Claude Code.
50
+
51
+ Allowed project-scope writes, only after explicit guarded apply with run preflight metadata (`vgxness mcp install claude --scope project --yes --run-id <id>`):
52
+
53
+ - `.mcp.json`
54
+ - `.claude/agents/*.md`
55
+ - project-root `CLAUDE.md`, only the VGXNESS managed block; user content outside the block is preserved exactly and existing files are backed up before append/update
56
+
57
+ User-scoped agent files target `~/.claude/agents/*.md` only as an explicit external-directory/preflighted operation. They are never written by read-only planning/status/doctor/change-plan.
58
+
59
+ Forbidden writes:
60
+
61
+ - `~/.claude.json`
62
+ - `.claude/CLAUDE.md`
63
+
64
+ Malformed, duplicate, partial, or conflicting VGXNESS markers in `CLAUDE.md` cause the full Claude project install to be refused before `.mcp.json`, `.claude/agents/*.md`, or `CLAUDE.md` are mutated.
65
+
66
+ Manual/opt-in runtime validation checklist (not normal CI):
67
+
68
+ 1. Apply Claude project-local config through the guarded VGXNESS flow.
69
+ 2. Open Claude Code in the project manually.
70
+ 3. Approve the project MCP server if prompted.
71
+ 4. Run `/mcp` and verify `vgxness` is connected.
72
+ 5. Run `/agents` and verify expected project subagents are visible.
73
+ 6. Ask Claude to call a safe read-only VGXNESS MCP tool.
74
+ 7. Confirm forbidden files were not written by VGXNESS.
75
+
76
+ ### OpenCode injection preview
77
+
78
+ `OpenCodeInjectionPreviewService` (in `src/providers/opencode/`) composes existing read-only outputs into a single envelope:
79
+
80
+ | Output | Source |
81
+ |---|---|
82
+ | `providerArtifacts` | OpenCode renderer for the selected agent and registered subagents. |
83
+ | `skillPayload` | Skill registry payload builder for the selected SDD phase and OpenCode adapter. |
84
+ | `sdd` | SDD workflow status and readiness for the selected project/change/phase. |
85
+ | `context` and `safety` | OpenCode preview layer metadata for future OpenCode/MCP/hook callers. |
86
+
87
+ The envelope is always `installable: false` and `readOnly: true`. It does not execute OpenCode, install hooks, create MCP servers, create runs, record skill usage, or touch provider/user/global config. Future live injection should build on this contract only after a separate approved change defines execution, hook, or MCP safety rules.
88
+
89
+ ```bash
90
+ vgxness opencode preview --provider opencode --agent apply-agent --project vgxness --change checkout-flow --phase apply-progress
91
+ ```
92
+
93
+ ## Code-runtime provider adapter
94
+
95
+ The code runtime speaks to a model through `CodeProviderAdapter` (`src/code/providers/provider-adapter.ts`):
96
+
97
+ ```ts
98
+ export interface CodeProviderAdapter {
99
+ readonly id: string;
100
+ readonly displayName: string;
101
+ readonly capabilities: ProviderCapabilities;
102
+ createResponse(request: ProviderRequest): Promise<ProviderResponse>;
103
+ streamResponse?(request: ProviderRequest): AsyncIterable<ProviderStreamEvent>;
104
+ countTokens?(input: ProviderTokenInput): Promise<TokenUsageEstimate>;
105
+ diagnostics?(model: string): Promise<ProviderDiagnostics>;
106
+ }
107
+ ```
108
+
109
+ Errors are surfaced through `CodeProviderError` with a `code` of `missing_credentials`, `blocked_credentials`, `provider_error`, or `retryable_provider_error`. The `retryable` flag tells callers whether a transient retry is meaningful.
110
+
111
+ ### `openai-compatible-provider-adapter.ts`
112
+
113
+ The real adapter. Speaks to any OpenAI-compatible endpoint; credentials come from environment references, never embedded in prompts or reports. The adapter streams responses through `stream-normalizer.ts` and maps messages with `message-mapper.ts`.
114
+
115
+ ### `fake-provider-adapter.ts`
116
+
117
+ Deterministic, offline. Used by `test/code/` and `bun run smoke:opentui-code` to keep CI hermetic. The fake adapter is intentionally thin — it does not model provider quirks, only the contract.
118
+
119
+ ### Adding a new code-runtime provider
120
+
121
+ 1. Implement `CodeProviderAdapter` and a `CodeProviderError`-throwing path. The interface is small; most of the work is in the request/response shape and the stream normalizer.
122
+ 2. Add credentials handling in `src/code/providers/credentials.ts`. Do not embed secrets; accept environment references only.
123
+ 3. Add a smoke test under `test/code/providers.test.ts` that exercises `createResponse`, `streamResponse`, and `countTokens` (where applicable).
124
+ 4. If the new provider has a different default tool shape, add a normalizer. If the stream events are different, extend `stream-normalizer.ts`.
125
+ 5. Update [Code runtime](./code-runtime.md) and this document with the new adapter id and capabilities.
126
+
127
+ ## OpenCode provider install and doctor
128
+
129
+ Provider install and doctor flows live in `src/mcp/client-install-opencode.ts` and `src/mcp/provider-doctor.ts` and are exposed through the MCP server and the CLI:
130
+
131
+ - `vgxness mcp install opencode --plan` — read-only plan; never writes config.
132
+ - `vgxness mcp install opencode --yes` — explicit write path; creates a backup first.
133
+ - `vgxness mcp doctor opencode` — JSON report of provider health.
134
+ - `vgxness provider status` / `vgxness provider doctor` (planned CLI) — same shape through the operator surface.
135
+ - `vgxness setup rollback --backup <path>` — restores a previous OpenCode config byte-for-byte after validation.
136
+
137
+ Writes happen only through `apply` with explicit consent. Plans, status, doctor, change-plan, and previews are read-only by contract.
138
+
139
+ ## Safety boundary
140
+
141
+ Adapters and renderers must not:
142
+
143
+ - Write provider config outside explicit guarded apply. OpenCode install writes only its selected target; Claude project compatibility apply writes only `.mcp.json`, `.claude/agents/*.md`, and the guarded project-root `CLAUDE.md` managed block; Claude local/user MCP registration uses Claude CLI argv after confirmation/preflight and never manual private-config mutation.
144
+ - Call providers (`opencode`, `claude`, etc.) during preview or status.
145
+ - Install global memory.
146
+ - Create `openspec/`.
147
+ - Bypass permission policy.
148
+ - Mutate other tools' state outside the VGXNESS SQLite store.
149
+
150
+ Adapter code is reviewed against the safety boundary tests in `test/mcp/` and `test/agents/provider-renderer.test.ts` before merge.