tracegrove 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,61 +1,26 @@
1
1
  # tracegrove
2
2
 
3
- **Behaviour tests your app has to actually pass, written by you or by a coding agent, with evidence anyone can re-verify.**
3
+ Tracegrove runs behavior checks against an app you launch locally, then saves an evidence bundle you can inspect and verify again. This 0.x release supports Node, FastAPI, and Django samples on POSIX hosts. Linux is exercised in CI; Windows process-tree execution is unsupported. Other hosts need their own qualification.
4
4
 
5
- tracegrove starts your real FastAPI, Django or Node app, walks it through scenarios written as
6
- short YAML files, checks every effect with an independent read, cleans up what it created, and
7
- seals the whole run into a bundle that `verify-bundle` can re-derive byte for byte. Claude Code
8
- or Codex can draft the scenarios from your routes and your intent, with explicit low-cost defaults,
9
- and tracegrove re-checks everything they write before you see it. When a run breaks, `tracegrove heal`
10
- fixes setup mistakes and drifted tests, proves every fix with a re-run, and reports real product
11
- bugs instead of editing them away.
5
+ ![Tracegrove showing a verified sample run](https://cdn.jsdelivr.net/npm/tracegrove@0.3.0/docs/images/ui-run.png)
12
6
 
13
- ![tracegrove ui: a run shown as a tree of scenarios, each step with its request, timing and status](docs/images/ui-run.png)
7
+ ## Try the sample
14
8
 
15
- ## First run: an isolated app and verified evidence
16
-
17
- The [consolidated implementation and release plan](docs/capability-schema-foundation.md) records
18
- what is implemented, in progress, planned and blocked, with exact PRs and evidence.
19
-
20
- This candidate is unpublished. Start from an authorized checkout of the reviewed commit;
21
- run the following from its root. Do not install an unrelated registry package with `npx tracegrove`.
22
- The first run needs **Node >=22.22.0 and <23**, npm with lockfile-v3 support, a POSIX shell,
23
- writable workspace/temp storage and loopback sockets. Linux is exercised in CI; macOS is
24
- implemented through the POSIX host but remains unqualified on Hope's offline Mac. Windows
25
- process-tree execution is blocked. This API sample needs no Docker, Python, browser, model,
26
- cloud account or application credentials. Dependency installation needs authorized npm access.
27
- Use one shell session for these blocks. Agents with stateless shell calls should execute the
28
- bootstrap, build and quickstart blocks together so the selected PATH and writable npm cache persist.
29
-
30
- Check `node --version`. If Node 22 is absent and this environment permits dependency installation,
31
- this optional bootstrap installs a pinned toolchain into an owned temporary folder:
9
+ You need Node.js >=22.22.0 and <23, npm, a POSIX shell, writable temporary storage, and local loopback sockets. Use a provisioned Node 22 runtime; the Node 24 line has not been qualified. The notes sample needs no Docker, browser, Python, cloud account, or coding agent. Install from npm in an empty directory:
32
10
 
33
11
  ```bash
34
- TRACEGROVE_TOOLS="$(mktemp -d)"
35
- npm install --prefix "$TRACEGROVE_TOOLS" --cache "$TRACEGROVE_TOOLS/cache" node@22.23.3 npm@10.9.9
36
- export PATH="$TRACEGROVE_TOOLS/node_modules/.bin:$PATH"
37
- node --version
12
+ mkdir tracegrove-demo && cd tracegrove-demo
13
+ npm init -y
14
+ npm install --save-dev --save-exact tracegrove@0.3.1
38
15
  ```
39
16
 
40
- Keep that PATH for the verifier **and the app it launches**. If installation or network access is
41
- denied, select an already provisioned environment; do not change network or permission settings.
42
- Then build (the temporary npm cache also works in clouds with a read-only home directory):
43
-
44
- ```bash
45
- export npm_config_cache="$(mktemp -d)"
46
- npm ci
47
- npm run build
48
- ```
49
-
50
- Run this single quickstart. It creates an empty owned sample directory, checks configuration and
51
- runtime prerequisites, starts a real notes app with isolated synthetic fixtures, and re-verifies
52
- the saved evidence. No agent CLI is invoked.
17
+ Run this block in the same directory. It creates a synthetic Notes API, checks prerequisites, runs two scenarios, and verifies the saved evidence. The `TRACEGROVE_CLI` override is for maintainers testing a local build.
53
18
 
54
19
  <!-- onboarding-quickstart:start -->
55
20
  ```bash
56
21
  set -euo pipefail
57
- TRACEGROVE_CLI="$PWD/dist/cli/main.js"
58
- TRACEGROVE_DEMO="$(mktemp -d)"
22
+ TRACEGROVE_CLI="${TRACEGROVE_CLI:-$PWD/node_modules/tracegrove/dist/cli/main.js}"
23
+ TRACEGROVE_DEMO="$(mktemp -d "$PWD/tracegrove-notes-XXXXXX")"
59
24
  node "$TRACEGROVE_CLI" sample-config --sample notes-api --output "$TRACEGROVE_DEMO"
60
25
  node "$TRACEGROVE_CLI" doctor --config "$TRACEGROVE_DEMO/verification/workflow.yaml" --json
61
26
  node "$TRACEGROVE_CLI" check --dir "$TRACEGROVE_DEMO" --json
@@ -66,524 +31,32 @@ printf 'Evidence retained at %s\n' "$TRACEGROVE_RUN"
66
31
  ```
67
32
  <!-- onboarding-quickstart:end -->
68
33
 
69
- Expected: doctor has `blocked: false`, check has `ok: true`, test exits 0 with
70
- `outcome: passed` and `bundleVerified: true`, and verification has `ok: true`.
71
- `TRACEGROVE_RUN` contains `summary.json`, `summary.md`, `junit.xml`, `request.json` and `bundle/`.
72
- The run's receipts retain fixture removal and host-process cleanup confirmations. Keep the
73
- evidence before deleting your sample directory; ephemeral clouds require exporting it through
74
- an already authorized artifact destination. A successful process exit alone is insufficient.
75
-
76
- For a browser journey, install the pinned Playwright Chromium through the environment's approved
77
- dependency setup (`npx --no-install playwright install chromium`; Linux also needs its system
78
- libraries), generate `--sample notes-browser` into a **different empty directory**, and select
79
- `test --grep notes.browser`. Missing browser/system dependencies are blockers, not permission
80
- to install system packages or open ports automatically. For a small human UI use
81
- `node "$TRACEGROVE_CLI" ui --dir "$TRACEGROVE_DEMO"`; when the cloud has no authorized UI preview,
82
- use the JSON and saved artifacts. Public inbound access is unnecessary for the CLI journey.
83
-
84
- | Environment | Current qualification and needed setup |
85
- | --- | --- |
86
- | This Codex Linux cloud | Actual native/API/browser fixture journeys recorded; Node 22 and writable temp needed. General portable-profile dispatch and host network confinement remain unqualified. |
87
- | GitHub-hosted Linux CI | Native, browser, Django and two isolated Docker sample lanes exercised. This does not qualify every coding-cloud runtime. |
88
- | Hope's macOS machine | Offline; actual clean-start/journey/cleanup evidence unavailable. Needs Node 22, app dependencies, allowed process/loopback access and artifact storage. |
89
- | Other Codex or Claude coding clouds | Unqualified until capability discovery and the same clean-start journey pass. Do not assume Docker, persistent disks, root, browser libraries or inbound access. |
90
- | OrgX-triggered cloud/workflow | Unqualified. Task dispatch alone does not provide a runner, workspace, secret broker, network policy or cleanup lease. |
91
- | Existing external staging | No general external-host adapter or secret broker is wired into this CLI. Declaring an origin/placement does not enable it; keep blocked until authorized adapter qualification. |
92
-
93
- The [portable environment contract and rollout gates](docs/portable-environments.md) give the exact
94
- current-versus-needed matrix, generated SDK templates and credential-reference contract. Those
95
- templates are experimental SDK records, **not** additional `tracegrove.config.yaml` fields.
96
-
97
- If a check fails, use its code and recovery action. `check --dir` validates authoring;
98
- `doctor --dir <project> --json` finds the authoring config, writes its derived corpus and checks
99
- the selected native plan. From a project subdirectory, `doctor --json` finds the config above it.
100
- `doctor --config <low-level workflow.yaml> --profile <name> --json` checks the existing host plan.
101
- Doctor returns `tracegrove.doctor/v1` JSON with the selected host/corpus refs, source/runtime
102
- digests, checks, errors and recovery actions; exit 2 means blocked. It never starts the app,
103
- but can invoke the configured interpreter with `--version`. Browser executable presence is
104
- installation metadata; engine launch, system libraries and video capture remain untested.
105
- Its result always says `execution: not_started` and `verificationVerdict: not_evaluated`.
106
- Portable SDK profiles and external staging are not executable doctor configurations.
107
- Neither command proves a running app. Top-level failures with `--json` return
108
- `tracegrove.cli-error/v1` on stdout with a quiet stderr, a public error class, bounded reason codes,
109
- recovery actions and the process exit code. Doctor retains its `tracegrove.doctor/v1` report.
110
- These error envelopes omit exception text, paths, argument values and stacks; successful reports,
111
- doctor diagnostics and retained artifacts keep their existing contents and access requirements.
112
- `--json false` and `--json=false` retain prose errors; `--jsonl` retains its existing event stream
113
- and top-level error behavior. Completed `test --json` reports keep their established schema.
114
- Exit 1 means assertion failure, 2 blocked/inconclusive, 3 infrastructure failure,
115
- 4 cancellation. Do not retry assertions into a clean result or discard the first attempt.
116
-
117
- Retry `test` only after fixing the reported cause; it creates a fresh execution with owned
118
- fixtures and preserves prior run folders. To stop, send one interrupt and allow cleanup to finish;
119
- unconfirmed cleanup requires reconciliation of that run's owned resources before another attempt.
120
- For recorded local recovery state, use `recovery-status --state-dir <owned-state> --execution <id> --json`.
121
- It reports a bounded read-only checkpoint and historical evidence; it never clears ownership,
122
- recovers locks or admits a retry. See [local recovery inspection](docs/local-execution-recovery.md#read-only-recovery-inspection).
123
- `verify-bundle` and UI recording playback inspect saved evidence; a new `test` performs new actions.
124
- New `test` reports include `executionId` and the actual `stateDir` for recovery and export.
125
- The UI Cancel run button targets the current operation and waits for settlement. Closing the
126
- UI requests cancellation before returning; inspect saved receipts for cleanup status. Saved-run
127
- results and recordings are freshly checked against sealed evidence, while names and flow paths
128
- remain unsealed annotations. Historical steps are never relabeled using current flow positions.
129
-
130
- Credentials belong in the environment's authorized resolver. Never put real credentials in
131
- flows, `app.env`, launch args, profiles or artifacts. The sample issues temporary synthetic persona
132
- tokens in memory; execution permissions remain the host's separate authority.
133
-
134
- What makes it different:
135
-
136
- - **Real app, real requests.** No mocks of your own code. Every step is an HTTP call to the app
137
- tracegrove launched for this run, on a free port with its own data dir and per-persona tokens.
138
- - **Independent readback.** `observe: true` re-reads state through a separate request and polls
139
- until the expectation holds, so "the endpoint said 204" is never mistaken for "it's deleted".
140
- - **Owned cleanup.** Fixtures are created through your API, read back, and deleted with a confirmed
141
- 404/410, in reverse order, even when a scenario fails.
142
- - **Evidence, not logs.** Each run is a sealed bundle with source digests, receipts and the frozen
143
- request. `verify-bundle` rehashes it and re-reduces the verdict on another machine.
144
- - **Agents under the hood, never trusted blindly.** Claude Code or Codex writes drafts; tracegrove
145
- compiles them itself and only a real run produces a verdict.
146
-
147
- ## Quickstart: test your own app
148
-
149
- Tracegrove drops into an existing FastAPI, Django or Node repo with one config file and one
150
- YAML file per test. Those short files compile into the strict corpus described below, so every
151
- run still gets attested source identity, independent readback, owned cleanup and a sealed,
152
- re-verifiable evidence bundle.
153
-
154
- ```text
155
- npx --no-install tracegrove init # detects FastAPI / Django / Node, writes tracegrove.config.yaml + an example flow
156
- npx --no-install tracegrove test # compile, plan, run, verify; results in .tracegrove/runs/latest/
157
- npx --no-install tracegrove heal # something broke? fix what is safe, prove it, report the rest
158
- npx --no-install tracegrove # inside a project: where things stand and what to run next
159
- ```
160
-
161
- `tracegrove test` prints the run as a small tree: passing scenarios stay folded, failing ones unfold
162
- to the step that broke with what was expected and what came back, followed by the next command
163
- worth running. On a terminal it shows a live line of what is happening (starting the app, which
164
- step, cleanup) and uses colour unless `NO_COLOR` is set.
34
+ Success means `doctor` reports `blocked: false`, `check` reports `ok: true`, `test` reports `outcome: passed` and `bundleVerified: true`, and `verify-bundle` reports `ok: true`. Keep the evidence directory if you need the receipts; after exporting it, remove the temporary sample with `rm -rf "$TRACEGROVE_DEMO"` in that same shell. The sample uses in-memory synthetic persona tokens and an isolated app data directory. A passing sample does not qualify your app or host.
165
35
 
166
- ```yaml
167
- # tracegrove.config.yaml
168
- project: notes
169
- app:
170
- adapter: fastapi # node | fastapi | django | command
171
- entry: app.main:app
172
- sources: [app/**/*.py] # bytes attested as "what was tested"
173
- personas:
174
- owner: { subject: alice } # the first persona is the default caller
175
- intruder: { subject: bob }
176
- ```
177
-
178
- ```yaml
179
- # tracegrove/notes/crud.flow.yaml -> case id notes.crud
180
- title: Create, read, deny a stranger and delete a note
181
- steps:
182
- - name: create
183
- POST: /notes
184
- json: { title: Fresh note, body: hello }
185
- expect: 201
186
- save: { noteId: note.id }
187
- - name: read back
188
- GET: /notes/{noteId}
189
- observe: true # independent readback, polled until expect holds
190
- expect: { status: 200, json: { note.title: Fresh note } }
191
- - name: intruder is denied
192
- GET: /notes/{noteId}
193
- as: intruder
194
- expect: { status: 403, absent: [note] }
195
- ```
36
+ ## Test your app
196
37
 
197
- Tracegrove picks a free port, passes it (and a fresh data directory and one random bearer token
198
- per persona) to the app through `PORT`, `TRACEGROVE_DATA_DIR` and `TRACEGROVE_TOKENS`
199
- (`{token: subject}` JSON), and waits on `app.health`. The app accepts those tokens in test mode;
200
- `tracegrove init` prints the five-line snippet for the detected framework.
38
+ Run `npx --no-install tracegrove init` in a project with Tracegrove installed. It creates `tracegrove.config.yaml` and a starter flow. Adjust the app entry, health route, source paths, and personas, then run `npx --no-install tracegrove check` followed by `npx --no-install tracegrove test --json`. For a human view, run `npx --no-install tracegrove ui`.
201
39
 
202
- | `adapter` | launches |
203
- | --- | --- |
204
- | `node` | `node <entry>` |
205
- | `fastapi` | `<python> -m uvicorn <entry> --host 127.0.0.1 --port {port}` (python: `.venv/bin/python`, else `python3`) |
206
- | `django` | `manage.py migrate --noinput && manage.py runserver 127.0.0.1:{port} --noreload` in the `entry` folder |
207
- | `command` | Reserved; BLOCKED until the application runtime can be independently observed |
208
-
209
- Conventions:
40
+ Your app must accept the per-run test persona tokens provided through `TRACEGROVE_TOKENS`, or use another reviewed test-only authentication path. Keep that path disabled in production. The Node, FastAPI, and Django adapters start the app on an assigned local port. Django's migration step must point at a database inside `TRACEGROVE_DATA_DIR`; check its settings before running so it cannot migrate another database. Tracegrove does not provision a database or cloud runner for you.
210
41
 
211
- - Flows live in `tracegrove/<area>/<behavior>.flow.yaml`; the case id is `<area>.<behavior>`.
212
- - Fixtures live in `tracegrove/fixtures/<name>.fixture.yaml` and are used with `given: { alias: name }`;
213
- their saved values are `{alias.output}` in later steps. They are created through the API, read
214
- back independently and deleted with a confirmed 404/410 absence.
215
- - `save: { name: dot.path }` makes `{name}` available to later steps; `expect.json` keys are dot
216
- paths into the response body. Prefer block style for anything containing `{` or `[` (or quote it).
217
- - The effect envelope (methods, path prefixes, create budget) is derived from the steps.
218
- - Each run writes `.tracegrove/runs/<UTC time>_<outcome>_<id>/` with `summary.md`, `summary.json`,
219
- `junit.xml`, the frozen `request.json` and the verified `bundle/`; `runs/latest` points at the
220
- newest. Add `.tracegrove/` to `.gitignore` (init does).
221
- - Editor validation: point `yaml.schemas` at `schema/tracegrove_config_v1.json` and
222
- `schema/tracegrove_flow_v1.json`.
42
+ Results are saved under `.tracegrove/runs/<run>/` with `summary.json`, `summary.md`, `junit.xml`, and `bundle/`. Bundle verification checks file integrity and recomputes the verdict; bundles are unsigned, so a receiving system still needs to trust their producer. Press Ctrl-C once to request cancellation and wait for cleanup. If cleanup is unconfirmed, inspect the receipts before another attempt.
223
43
 
224
- Runnable samples: `src/samples/notes-api` (Node), `src/samples/fastapi-notes`,
225
- `src/samples/django-notes`. `tracegrove compile` writes the derived v1 corpus to
226
- `.tracegrove/compiled/` if you want to inspect it or drop to the low-level commands.
44
+ [Getting started with your app](https://cdn.jsdelivr.net/npm/tracegrove@0.3.1/docs/getting-started.md) · [Verified bundles and cleanup](https://cdn.jsdelivr.net/npm/tracegrove@0.3.1/docs/verified-bundles.md) · [Recovery inspection](https://cdn.jsdelivr.net/npm/tracegrove@0.3.1/docs/local-execution-recovery.md)
227
45
 
228
- ## Self-healing: `tracegrove heal`
46
+ ## For coding agents and CI
229
47
 
230
- ```text
231
- npx --no-install tracegrove heal # diagnose, repair, re-run, keep only what passes
232
- npx --no-install tracegrove heal --dry-run # show what it would change; change nothing
233
- npx --no-install tracegrove heal --no-agent # setup fixes only, no coding agent
234
- npx --no-install tracegrove heal --undo latest # put back every change the last heal kept
235
- npx --no-install tracegrove test --heal # run, and heal if anything fails
236
- ```
48
+ Use `status --json` to find the next action, `discover --json` to compare routes and flows, `check --json` to compile, and `test --json` to execute. The `test` summary uses `tracegrove.run-summary/v1` and includes `outcome`, `runDir`, `bundleVerified`, `cases`, and `blockers`. `doctor` uses `tracegrove.doctor/v1`; top-level JSON errors use `tracegrove.cli-error/v1`. Keep the first failed run and its evidence when diagnosing a retry.
237
49
 
238
- Heal reads the latest failure and sorts every problem into one of a few kinds, then acts on each:
239
-
240
- | Finding | What heal does |
50
+ | Exit | Meaning |
241
51
  | --- | --- |
242
- | **Setup**: the app never answered its health check | Finds GET routes and string literals in your source that look like health endpoints (`/health`, `/healthz`, `/ready`, …), tries them one at a time in `tracegrove.config.yaml`, and keeps the first one under which the app actually starts. |
243
- | **Setup**: the Python interpreter is missing or lacks the framework | Tries `.venv`, `venv` and `PATH` interpreters that can import FastAPI and uvicorn (or Django) and keeps the one tracegrove recognizes. |
244
- | **Authoring**: a flow does not compile | Hands the `check` issues to your coding agent, limited to the named files. |
245
- | **Failing check** | Asks the agent to read the handlers and recent changes and call each failure **test drift** (the app changed on purpose; update the flow) or a **product bug** (the app is wrong; leave the flow alone). |
246
- | **Evidence** or **infrastructure** | Never repaired; explained, with the run folder to read. |
247
-
248
- Repair safeguards and their limits:
249
-
250
- - **Drift edits need an explicit verdict and a passing case.** A successful agent must provide
251
- one matching drift verdict before an edit is admitted. Missing, malformed, conflicting or
252
- foreign verdicts are rejected. Candidate flow edits must compile and pass their case;
253
- setup fixes must clear their setup check. Other failures stay reported.
254
- - **Product bugs stay red.** A case the agent calls a product bug keeps its failing test, the heal
255
- exits 1, and the report says what is wrong in one sentence.
256
- - **Mechanical guards reject deleted steps, renamed steps, fewer checks and success/denial
257
- flips**, for example `403` to `200`. These guards and an agent verdict do not prove intended
258
- product behavior or semantic equivalence: inspect the saved diff. Watched edits outside the
259
- failing flows and newly discovered files are restored or removed; this is not an agent sandbox.
260
- - **Undo preserves subsequent edits.** Kept changes have backups and complete file hashes under
261
- `.tracegrove/heals/<id>/` next to `report.json` (schema `tracegrove.heal/v1`). Undo restores only
262
- the exact recorded healed file. Changed files, altered backups and old reports without these
263
- bindings require manual undo. Heal and undo share a local lock; keep other editors and tools
264
- idle because they do not participate in it.
265
- - **Cancellation waits for the owned operation.** The UI cancels by operation ID and stops new
266
- mutations during shutdown. Agent exit precedes rollback of unretained heal edits. Inspect the
267
- saved report and run receipts for retained setup fixes and cleanup status.
268
- - **Comments survive.** Config edits go through a YAML document model, so your comments and
269
- formatting stay put.
270
-
271
- In the UI, **Heal** (or `h`) runs the same thing with the agent's progress streaming in, then
272
- shows findings, each kept change as a diff, and **Undo all**.
273
-
274
- The Heal tab ships inside the CLI. The optional repository illustration `docs/images/ui-heal.png` is excluded from the npm package; no UI behavior depends on it.
275
-
276
- ## The grove: `tracegrove ui`
277
-
278
- ```text
279
- npx --no-install tracegrove ui # current folder, working tree
280
- npx --no-install tracegrove ui --dir ../api --branch feature/billing
281
- ```
282
-
283
- A local page (bound to 127.0.0.1, with a per-session token on anything that writes), light and
284
- dark, down to phone width:
285
-
286
- - **Run.** Your scenarios as a bonsai: the trunk is the run, each branch a scenario, each twig a
287
- step with its request, its slice of the run clock and the observed status. Failures collect in
288
- **Needs a fix**; pick a step to see expected against observed and the evidence line. Run all,
289
- run one scenario, or switch to any earlier run.
290
- - **Discover.** Pick the working tree or any git branch (read with `git show`, nothing is checked
291
- out). Routes from FastAPI decorators, Django `path()` and Express-style routers are listed with
292
- the flows that reach them, changed-on-this-branch first. Draft a skeleton for one route, or write
293
- what should be true in **Intent** and press **Draft with Claude**: what the agent reads, edits
294
- and says streams in live, and its flows arrive already checked, with **Run the new scenarios**
295
- one click away.
296
- - **Heal.** Diagnose and repair with one button, watch the agent work, review every kept change as
297
- a diff, see product bugs called out, and undo any heal. Earlier heals stay listed.
298
- - **History.** A grid with one column per run and one row per scenario, so a single case's record
299
- and the whole set read at a glance. Any cell opens that run at that scenario.
300
- - **Settings.** Choose Claude Code, Codex or none, and the model. Installed CLIs are detected.
301
-
302
- While a run is going, the step being executed pulses in the tree and the header says what is
303
- happening, from real run events rather than a timer. **⌘K** (or **Ctrl K**, or `/`) opens a command
304
- palette for every action, scenario and branch; `j`/`k` move through scenarios, `r` reruns the
305
- selected one, `R` runs all, `h` heals, `1`–`5` switch tabs and `?` lists the keys. Pruning and
306
- healing both offer **Undo** in the confirmation.
307
-
308
- **Pruning is a rename.** Prune a scenario and its file becomes `*.flow.yaml.pruned`: the compiler
309
- skips it, the tree shows it as a dashed branch, and **Graft back** restores it. Nothing is deleted.
310
-
311
- Discovery is a static heuristic that proposes tests; it is never evidence. Only `tracegrove test`
312
- produces a verdict.
313
-
314
- ## Agents under the hood
315
-
316
- tracegrove does not ship a model. It drives the coding agent you already use, headless:
317
-
318
- | Provider | Command it runs | Default model |
319
- | --- | --- | --- |
320
- | `claude` (default) | `claude -p … --model claude-haiku-5-5 --output-format stream-json --permission-mode acceptEdits --allowedTools Read,Write,Edit,Glob,Grep,Bash(tracegrove check/list/discover)` | `claude-haiku-5-5` |
321
- | `codex` | `codex exec --sandbox workspace-write --model gpt-6-luna` | `gpt-6-luna` |
322
- | `none` | nothing; discovery and templates only | |
323
-
324
- The agent gets the discovery report, your intent, the naming conventions, an existing flow as an
325
- example, the persona names and the JSON Schemas. Its instructions request drafts under
326
- `tracegrove/discovered/` and read-only checks; its CLI permissions remain the execution boundary.
327
- Its stream of events is shown live in the terminal and the UI. If Claude Code rejects the
328
- configured model id, tracegrove retries once with the `haiku` alias and records that in the
329
- result (a dotted id such as `claude-haiku-4.5` is corrected to `claude-haiku-4-5` up front). The
330
- agent runs as its own session even when tracegrove is itself driven from inside Claude Code.
331
- After it exits, tracegrove lists changed flow files and compiles the project. Compilation is
332
- not independent confirmation of the developer's intent. A configured `maxBudgetUsd` is
333
- supported by the Claude adapter; Codex blocks that setting until enforced accounting exists.
334
-
335
- Where the choice comes from, highest first:
336
-
337
- 1. `--agent` / `--model` on `tracegrove draft`
338
- 2. `.tracegrove/settings.json`, your own choice, written by **Settings** in the UI or `tracegrove settings --agent codex`
339
- 3. `agent:` in `tracegrove.config.yaml`, the team default:
340
-
341
- ```yaml
342
- agent:
343
- provider: claude # claude | codex | none
344
- model: claude-haiku-5-5 # optional
345
- maxBudgetUsd: 0.50 # optional spend cap per draft (Claude Code)
346
- ```
347
- 4. The explicit low-cost defaults above. No inherited CLI model or silent provider fallback.
348
-
349
- ### Commands built for agents
350
-
351
- Every one takes `--json`; the first five never start your app:
352
-
353
- ```text
354
- tracegrove status # where things stand plus an ordered `next` list of commands and why
355
- tracegrove discover [--branch <b>] # routes vs. flows that reach them; changed files first
356
- tracegrove check # compile only; exit 0 when clean, 2 with file:path-located issues
357
- tracegrove list # flows with ids, tags and steps
358
- tracegrove draft --intent "<what should be true>" [--agent claude|codex] [--model <m>]
359
- tracegrove settings [--agent …] [--model …]
360
- tracegrove heal [--dry-run] [--no-agent] # runs the suite; returns findings, kept diffs and `next`
361
- ```
362
-
363
- So any agent, including one you run yourself, can loop: `status` → `discover` → write flows →
364
- `check` → `test` → `heal` → follow `next`. `tracegrove init` writes `tracegrove/AGENTS.md` with
365
- these conventions and the loop, so Claude Code, Codex or Cursor pick them up from the repo.
366
-
367
- ## How it fits together
368
-
369
- Prefer TypeScript? Use `tracegrove.config.ts` with `defineConfig`, `.flow.ts`
370
- with `flow`, and `.fixture.ts` with `fixture`, all exported by
371
- `workflow-verify/authoring`. These reuse the YAML validation and execution path.
372
- See [typed authoring](docs/developer-ux.md#typescript-authoring) for examples,
373
- module evaluation bounds, and supported TypeScript syntax.
374
-
375
- ```text
376
- tracegrove.config.yaml + tracegrove/**/*.flow.yaml + fixtures
377
- │ authoring compiler (src/authoring)
378
- ▼
379
- .tracegrove/compiled/ (strict workflow.*/v1 corpus, $file refs frozen to sha256)
380
- │ planner → admission + local ledger → executor
381
- │ hosts: local_process | mock_loopback surface: http fixtures: API create/readback/cleanup
382
- ▼
383
- trusted reducer → bundle writer → verify-bundle → .tracegrove/runs/<run>/
384
- ```
385
-
386
- The everyday flow is `init` → `ui` or `draft` (discover, write with an agent, prune) → `test` → read the
387
- run in the grove or with `show` → hand the bundle to anyone who runs `verify-bundle`.
388
-
389
- What the adapters cover now and what's next:
390
-
391
- | Area | Supported now | Next |
392
- | --- | --- | --- |
393
- | App launch | node, fastapi, django; free port, data dir, per-persona tokens. Command wrappers remain blocked | `app.setup` commands (alembic, prisma, knex) |
394
- | Seeding | Fixtures created through the app's API, read back, deleted with confirmed absence | SQL seeding, repo seed commands (factory_boy, Prisma seed), snapshots |
395
- | Databases | SQLite via `TRACEGROVE_DATA_DIR` | `db: postgres` per-run database with `DATABASE_URL`, DB-state oracles, Redis/Mongo services |
396
- | Async jobs | Separate-worker SQLite samples through HTTP or native Node IPC: persisted output, idempotency, cancellation, owner isolation | Independently supervised/attested Celery/RQ/BullMQ workers and broker services; hosted provider qualification |
397
- | Third parties | Whole-app mock host for the contract lane (low-level corpus only) | Outbound interceptor (stub/record/pass-through per provider), record and replay, email/webhook capture |
398
- | Data pipelines | None | `job` surface for dbt/Airflow/Dagster runs, table oracles (row counts, schema, golden files), DuckDB first |
399
- | Browser | Typed short flows and low-level corpus, authenticated local personas, DOM/API assertions, sealed video and Grove playback | Staging qualification, trace/redaction collectors and controller-death cleanup |
400
-
401
- The full gap analysis by layer, with priorities, is in [docs/architecture.md](docs/architecture.md).
402
-
403
- ## The verification core
404
-
405
- This is the Phase 1a implementation of the plan in
406
- `orgx/docs/architecture/workflow-verification-platform.md`. It is a prototype; nothing below is a
407
- production claim.
408
-
409
- What exists and is exercised by tests:
410
-
411
- - Canonical JSON codec with shared vectors and SHA-256 self digests (`ref.digest` excluded).
412
- - Strict versioned schemas (Zod 4) exported as JSON Schema under `schema/`, checked in sync.
413
- - Project corpus loader: YAML/JSON beside the product source, `{ $file: ./path }` references
414
- frozen into exact refs, a frozen corpus manifest, digest-verified lookup.
415
- - Compiler, planner (`plan` is side-effect free and returns blockers with owner and action),
416
- admission with idempotent redelivery, local single-writer ledger with stale-lock recovery.
417
- - Executor: local process host with launcher-computed identity attestation and issued
418
- credentials, mock loopback host for the `mock_contract` lane, real HTTP driver with
419
- per-operation deadlines, registered fixture actions with independent readback and
420
- reverse-order cleanup, boundary observations, sealed receipts, trusted reducer.
421
- - Evidence bundle writer and `verify-bundle`, which rehashes every file, rechecks every self
422
- digest, re-derives assertions from the frozen case and re-reduces the verdict.
423
- - `tracegrove` CLI (also installed as `workflow-verify`): `init`, `test`, `list`, `show`, `compile`, `ui`, `discover`, `check`, `draft`, `settings`, `sample-config`, `validate`, `doctor`, `plan`, `cases`, `rerun`, `controller`, `seed --preview`,
424
- `run`, `inspect`, `export`, `verify-bundle`, `schema`. Exit codes 0/1/2/3/4.
425
- - A real file-backed notes API sample with its corpus, plus an offline contract lane.
426
-
427
- The local controller owns an exclusive ledger and accepts authenticated loopback commands
428
- for one project. CLI runs delegate to that writer; concurrent redelivery reconciles the same
429
- execution. Case lookup uses bounded pages with snapshot-bound cursors. `rerun` freezes a fresh
430
- campaign while preserving case digests and original request lineage. Use
431
- `inspect --request` for static frozen-plan checks and `inspect --bundle` for independently
432
- verified evidence. [Inspection and export](docs/verified-bundles.md#inspect-and-hand-off-a-frozen-run)
433
- use sealed snapshots; lifecycle reruns require fresh owner registration.
434
-
435
- The POSIX local host uses a trusted supervisor with an IPC ownership channel. If
436
- the controller is killed, the supervisor terminates the application process group
437
- and removes its owned workspace. A process-kill test checks both effects. This
438
- does not establish recovery after the supervisor itself is killed, distributed
439
- fencing, or cleanup of external provider resources. Windows local launches are
440
- blocked until a process-tree ownership implementation exists.
441
-
442
- Bundle verification checks sealed required files, host capability records, target attestations,
443
- fixture completeness and boundary observations. It rejects empty/traversal manifests and
444
- producer resealing that removes required observations. This verifies portable integrity and
445
- record consistency; the importer still needs its own issuer trust and access policy.
446
- The [verified snapshot reader](docs/verified-bundles.md) supplies complete checked
447
- records from the same bounded bytes used by the reducer, without rereading payloads.
448
-
449
- `verifySourceCitation` checks exact repository/commit/path identity, document and
450
- file digests, and inclusive line excerpt bytes through authorized trusted host ports.
451
- It preserves UTF-8 and CRLF bytes, rejects traversal, unsupported files and unavailable
452
- objects, and never falls back to the current checkout. These checks establish cited
453
- source bytes. The source-analysis API connects them to runnable change elements and
454
- the authenticated review policy; it does not establish passing product behavior.
455
-
456
- The Phase 2 review API (`editPlan`, `reviewPlan`) binds exact source-plan
457
- digests and scopes. Every specification edit clears its review. Concurrent edits and
458
- reviews use a host-owned atomic compare-and-swap port; losing writes publish neither
459
- review nor projection. Reviewer identity and policy come from authenticated host
460
- admission. Tests exercise stale tokens, concurrent writers, resolver tampering and
461
- denied authority. This API has no hosted store, execution-admission integration or
462
- scenario activation. Resolving and validating source citations and coverage policy
463
- are enforced through trusted source-analysis and policy ports before approval; hosted
464
- implementations remain separate work. These records alone are not authority for product execution.
465
- See [source-backed review](docs/source-review.md) for the immutable checks and atomic host contract.
466
- `source-resolve` and `GitSourceReader` [freeze local Git commit pairs and full diffs](docs/git-source-resolution.md)
467
- and read cited immutable objects after checkout changes. They supply source facts;
468
- independent review policy, full source transport and runtime identity remain separate gates.
469
- `LocalReviewStore` connects that API to the existing single-writer journal and preserves
470
- reviews/source checks across reopen. [Local review storage](docs/local-review-store.md)
471
- requires trusted host admission and source checking; it does not supply distributed authority.
472
- `promoteScenario` binds actual current review storage to a proposed scenario and retains
473
- the full plan, gaps and source-validation snapshot. [Source promotion](docs/source-promotion.md)
474
- remains separate from structural validation, execution and activation.
475
-
476
- Scenario qualification now has a typed registration/invalidation API with exact-matrix
477
- and monotonic-history checks. [Structural validation](docs/scenario-structure.md) shares
478
- the executor's static preflight and atomically moves authorized proposed/degraded
479
- scenarios to validating, without running them. The lifecycle API records pending work
480
- and invalidates semantic edits;
481
- it does not qualify or activate coverage. See [registration contract](docs/qualification-registration.md).
482
- `reduceQualificationRound` binds an entire verified terminal campaign to the registered
483
- cell/attempt allocations, retaining failed and mock evidence without granting a live
484
- proof level. See [terminal result contract](docs/qualification-results.md) for the host authority boundary.
485
- `LocalQualificationResults` retains those complete rounds through the existing immutable
486
- result sink and supplies a durable replay-assessment index, with fresh issuer checks on reads.
487
- `assessScenarioReplay` derives readiness from authenticated complete rounds, retains pending
488
- and failed history, requires at least two independent live campaigns and checks the latest
489
- admitted round. [Replay assessment](docs/replay-assessment.md) is read-only.
490
- `activateScenario` rechecks that evidence and publishes an authenticated activation through
491
- an atomic host port, with exact round selection and idempotent receipt recovery. See
492
- [activation contract](docs/scenario-activation.md); hosted authority and activated regression execution remain open.
493
- `LocalScenarioStore.activationPorts(results, authority)` publishes the active projection,
494
- receipt and full assessment records together on the existing local ledger, after fresh
495
- evidence and explicit owner authorization checks. Historical receipts cannot reverse invalidation.
496
- `LocalScenarioStore` persists actual registration on the local ledger. The SDK's
497
- `prepareQualificationExecution` and explicit runtime owner connect those admissions
498
- to new executions using allocated cell identities, with current authority checks
499
- before effects. See [registered execution](docs/qualification-registration.md#executing-a-registered-round).
500
-
501
- `result-ingest --bundle <run/bundle> --sink <directory>` retains an independently
502
- re-verified local bundle in the existing single-writer ledger and an immutable
503
- archive. `results --sink <directory>` lists scoped receipts;
504
- `results --sink <directory> --id <result-id>` freshly re-verifies a retained result
505
- after the producer's directory is gone. The [result sink](docs/result-sink.md)
506
- preserves failed and mocked outcomes, rejects conflicting deliveries, and never
507
- treats storage acceptance as issuer authentication, qualification, or activation.
508
-
509
- The optional [AWR delivery adapter](docs/awr-delivery.md) freezes a redacted report
510
- and destination in that same ledger. `awr-prepare`, `awr-inspect`, and `awr-deliver`
511
- separate preparation from authenticated import, retain failed product verdicts,
512
- and retry the original key after a lost acknowledgement without rerunning tests.
513
- Imported evidence remains unverified; native work acceptance is a separate gate.
514
- The [work-report attachment stage](docs/work-report-attachment.md) links an imported
515
- report to its original frozen work binding, rechecks hosted receipt identity, and
516
- recovers lost attachment acknowledgements independently of import or execution.
517
-
518
- The [local browser runner](docs/browser-driver.md) executes typed UI steps alongside HTTP
519
- fixtures and independent readback, and verifies recordings in the portable bundle.
520
- Browser short flows run through `tracegrove test`; Grove plays receipt-bound recordings
521
- after rechecking the bundle. See the browser sample and guide for the exact syntax.
522
- Still open: full runtime source selection,
523
- hosted review and qualification, coordination acceptance, `seed --apply`, and distributed crash recovery.
524
- Selected Git base/head trees can now be materialized into private independent
525
- directories with [Git object proofs](docs/git-object-proof.md) checked against actual
526
- file bytes and rechecked by the launch supervisor. Metadata-only proof checks do not
527
- establish runtime verification. Add `--source-repository-role application` to bind a
528
- single resolver-head snapshot to its measured Git-object repository tuple and frozen
529
- source selection. Local revision qualification is covered; hosted issuer authentication
530
- and remote repository ownership remain separate.
531
- Use `source-materialize`; the [source guide](docs/git-source-resolution.md#run-selected-revisions-independently)
532
- shows running the same saved flow against each revision. `test --source-snapshot`
533
- binds local launch content to the manifest: the supervisor verifies and copies the
534
- pinned tree into its owned workspace. Automatic authenticated runtime revision
535
- attestation remains open.
536
- Agent drafting checks compilation; it does not confirm intended behavior or approve a plan.
537
-
538
- ## Zero-OrgX quickstart (low-level corpus)
539
-
540
- ```text
541
- npm install && npm run build
542
- node dist/cli/main.js sample-config --sample notes-api --output ./notes
543
- node dist/cli/main.js doctor --config ./notes/verification/workflow.yaml
544
- node dist/cli/main.js plan --config ./notes/verification/workflow.yaml --output ./out/request.json
545
- node dist/cli/main.js run --request ./out/request.json
546
- node dist/cli/main.js verify-bundle --bundle ./notes/verification/.workflow-verify/executions/<id>
547
- ```
548
-
549
- No OrgX account, database, Docker, Python or model call is involved. The real sample's
550
- proof claim is local application behavior at the attested source digest, not deployment.
551
-
552
- To exercise asynchronous work, generate `sample-config --sample report-jobs --output
553
- ./reports`, then run `tracegrove test --config ./reports/tracegrove.config.yaml`.
554
- The [report jobs sample](src/samples/report-jobs/README.md) uses a real separate worker
555
- and persisted SQLite queue. Completion requires an independent output readback;
556
- accepting a submission alone cannot pass. Its controlled missing-output defect
557
- produces a sealed failed attempt. No model calls or external accounts are used.
558
- For low-level commands, use the config path printed by sample generation.
559
- For native `job.submit`, `job.observe`, and `job.cancel`, generate
560
- `sample-config --sample report-native --output ./native-reports` instead.
561
- The [native job bridge](docs/native-jobs.md) uses the same application, worker,
562
- and storage with typed Node IPC requests and job observations. Hosted providers,
563
- independent worker attestation and distributed crash recovery remain open.
564
-
565
- For local MCP tools, install the pinned optional SDK and generate
566
- `sample-config --sample notes-mcp --output ./mcp-notes`. The
567
- [MCP protocol driver](docs/mcp-driver.md) uses the same planner, persona, evidence
568
- and CLI path, with explicit tool/call limits and independent HTTP readback.
569
- Protocol results do not qualify a widget host or mobile surface.
570
-
571
- ## Checks
572
-
573
- For clean, credential-free Docker runs, see [container qualification](containers/README.md). Native real HTTP and offline contract lanes produce separate saved bundles.
574
-
575
- ```text
576
- npm run verify # typecheck, schema sync, unit and end-to-end tests
577
- npm run test:conformance # verifier conformance cases (refusals and non-green results)
578
- ```
52
+ | 0 | Passed or clean |
53
+ | 1 | Assertion failed |
54
+ | 2 | Blocked or inconclusive |
55
+ | 3 | Infrastructure failed |
56
+ | 4 | Cancelled |
579
57
 
580
- ## Repository provenance
58
+ `draft` runs a configured Claude Code or Codex CLI and may edit flow files. `heal` runs the suite and can edit setup or flow files after its checks. Commit or stash your work before either command; review every proposed diff. `heal --dry-run` inspects without keeping edits. An agent verdict or a successful compile does not prove that a changed test still expresses your intent.
581
59
 
582
- This private repository was extracted with `git subtree split` from
583
- `hopeatina/orgx:packages/tracegrove` at OrgX commit
584
- `6da4205e0cef9fbd75b0e8e04cdfc6d5de669910`. The extracted bootstrap commit is
585
- `92f163c49812e373bdb04550ea3771b278eab0cd`.
60
+ [Agent command and JSON guide](https://cdn.jsdelivr.net/npm/tracegrove@0.3.1/docs/agent-guide.md) · [Browser driver](https://cdn.jsdelivr.net/npm/tracegrove@0.3.1/docs/browser-driver.md) · [Native jobs](https://cdn.jsdelivr.net/npm/tracegrove@0.3.1/docs/native-jobs.md) · [MCP driver](https://cdn.jsdelivr.net/npm/tracegrove@0.3.1/docs/mcp-driver.md)
586
61
 
587
- `codex/bootstrap` is the default branch. Releases are tagged on GitHub; v0.2.0 is the first,
588
- with the authoring layer, the grove UI and agent drafting. The standalone sample installs a pinned package archive,
589
- so its CI needs no cross-repository credential.
62
+ Apache-2.0 licensed.