@pazmo/ai-workflow-kit 4.1.0 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.codex-plugin/plugin.json +1 -1
  4. package/README.ko.md +12 -0
  5. package/README.md +12 -0
  6. package/assets/check.mjs +4 -3
  7. package/bin/ai-workflow-kit.mjs +4 -1
  8. package/examples/host-routing/README.md +15 -0
  9. package/examples/verification/README.md +11 -0
  10. package/examples/verification/app.mjs +6 -0
  11. package/examples/verification/prove.mjs +12 -0
  12. package/examples/verification/verification.json +7 -0
  13. package/examples/verification/verify-cli/SKILL.md +34 -0
  14. package/examples/verification/verify-cli/features/README.md +7 -0
  15. package/examples/verification/verify-cli/features/addition.md +9 -0
  16. package/package.json +1 -1
  17. package/skills/workflow/EVALS.md +60 -2
  18. package/skills/workflow/SKILL.md +4 -2
  19. package/skills/workflow/references/execution.md +7 -7
  20. package/skills/workflow/references/graph-engineering.md +8 -4
  21. package/skills/workflow/references/intake.md +2 -0
  22. package/skills/workflow/references/model-selection.md +40 -0
  23. package/skills/workflow/references/pstack/LICENSE +21 -0
  24. package/skills/workflow/references/pstack/create-verification-skill.md +44 -0
  25. package/skills/workflow/references/pstack/principle-prove-it-works.md +22 -0
  26. package/skills/workflow/references/pstack/provenance.json +37 -0
  27. package/skills/workflow/references/pstack/references/feature-map-example/README.md +47 -0
  28. package/skills/workflow/references/pstack/references/feature-map-example/create-note.md +39 -0
  29. package/skills/workflow/references/pstack/references/feature-map-example/search.md +45 -0
  30. package/skills/workflow/references/role-graphs.md +7 -1
  31. package/skills/workflow/references/skill-integration.md +17 -2
  32. package/skills/workflow/references/understanding-gate.md +6 -3
  33. package/skills/workflow/references/verification.md +64 -0
  34. package/src/graph/approvals.mjs +19 -0
  35. package/src/graph/cli.mjs +100 -16
  36. package/src/graph/execution-metadata.mjs +22 -0
  37. package/src/graph/roles.mjs +1 -1
  38. package/src/graph/snapshot.mjs +76 -0
  39. package/src/graph/verification.mjs +151 -0
  40. package/src/graph/workflow.mjs +29 -13
  41. package/src/managed-block.mjs +3 -2
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: create-verification-skill
3
+ description: "Generate a project-local verification skill that drives your app the way a user does — any language, framework, or platform. Use for /create-verification-skill, \"make a control skill for this repo\", or when a project has no scripted way to prove UI/CLI/service behavior."
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Create a verification skill
8
+
9
+ Every serious project needs a scripted way to drive the real app and prove behavior: launch it, exercise a feature the way a user would, and capture evidence. This skill generates that as a project-local skill (`<skills>/verify-<app>/`) tailored to the repo. `<skills>` is your harness's project skill folder: `.cursor/skills/` in Cursor, `.claude/skills/` in Claude Code, `.pi/skills/` in Pi, `.agents/skills/` in Codex, OpenCode, and others. If the repo already keeps skills in one of these, use that one. You write the generator's output for the next agent, not for a human: it will be read cold, mid-task, by an agent that has never seen the app.
10
+
11
+ ## 1. Interview the repo, not the user
12
+
13
+ Answer these from the codebase and only ask the user what you cannot observe:
14
+
15
+ - **Surface:** what does a user actually touch? A web UI, a CLI/TUI, a desktop app, an API, a mobile app, a library? A repo can have several; pick the primary one and note the rest.
16
+ - **Run:** how does the app start locally? Prefer the repo's own documented dev command (package scripts, Makefile, README quickstart). Note ports, env vars, seed data, auth.
17
+ - **Drive:** how can an agent interact with it programmatically? Existing harnesses first — Playwright/Cypress specs, expect scripts, PTY helpers, curl-able endpoints, a debug port. Only then pick a generic recipe: browser/CDP for web and Electron, a tmux/PTY harness for CLI/TUI, plain HTTP for services.
18
+ - **Observe:** what evidence can be captured? Screenshots, terminal transcripts, response bodies, logs, exit codes, DB state.
19
+ - **Isolate:** can two instances run side by side (ports, data dirs, profiles)? If not, say so in the generated skill: refusing to double-drive a shared instance beats corrupting the user's session.
20
+
21
+ If the checkout doesn't build or start as-is, fix that first (or report it precisely) before generating; a skill written against a broken base teaches wrong steps. When an irrelevant missing asset blocks startup (a static dir the API never serves, a sample config), the generated skill may create it, clearly marked as verification scaffolding, and remove it in cleanup.
22
+
23
+ ## 2. Generate the skill
24
+
25
+ Write `<skills>/verify-<app>/SKILL.md` with YAML frontmatter (`name: verify-<app>` and a `description` that names the app, the surface, and when to reach for it — without frontmatter the skill never registers) and these sections, each grounded in what the interview actually found (no placeholders left):
26
+
27
+ - **Launch:** the exact command that starts the app for verification, and how to tell it's ready (a log line, a prompt). Launch must reach a usable state from an empty data dir, including any migrations and seed data. Ready means usable, not just that a process answers. A database health check can pass while its init scripts are still running. Include teardown. For a short-lived CLI or TUI there is no server to keep alive: launch means build the binary (or install deps) once, then start each drive in its own isolated PTY or tmux session.
28
+ - **Doctor:** one read-only check that answers "is this instance worth driving?" — process up, right version/build, port owned by us, auth valid. An agent runs this first whenever anything looks off.
29
+ - **Drive:** the harness recipe with real selectors/commands from this repo, not examples. Prefer stable handles (ARIA labels, data attributes, prompt strings, route paths) over coordinates and tab order.
30
+ - **Evidence:** what to capture for a proof and where it goes. State the proof standards: exercise the real user path, not internal setters or test-only endpoints; capture the action and the resulting state, not just the final screen; verify side effects (files written, rows inserted, messages sent) alongside what's visible; mocks only where a production boundary already isolates the external system. When the safe path is a dry-run or test mode, verify what it actually skips by observing (files, network, git refs) rather than trusting its name: some dry-runs still touch the network or open a browser.
31
+ - **Cleanup:** how to tear down instances the run created. Never kill by process name; kill what you started. Cleanup removes instances and scratch state, never the evidence: proof artifacts survive the teardown, in a location the skill names.
32
+ - **Helpers:** any script the skill ships is executable and its invocation is shown in the skill body. A helper the reader has to reverse-engineer is not a helper.
33
+
34
+ ## 3. Seed the feature map
35
+
36
+ Create `<skills>/verify-<app>/features/README.md` plus one file per user-facing feature you can identify (aim for the top 3-5 to start, from routes, commands, menus, or docs). Follow the shape in [`references/feature-map-example/`](references/feature-map-example/), with a README index and one file per feature. Each file answers, from the user's point of view: what the feature is, how to reach it, how to drive it with the harness, and what observable end state proves it works. The four H2s are `Sub-features`, `How to get to it (user POV)`, `Driving it with <harness>`, and `Gotchas`. If the seed data lacks a precondition that a journey needs, the journey reports a failure and the reason goes in that feature's `Gotchas`. Never weaken the journey to make it pass. The map is the repo's maintained verification source; a proof that drives one convenient entry point is incomplete when the map lists others.
37
+
38
+ ## 4. Prove the generated skill before handing it over
39
+
40
+ Run its own instructions end to end once: launch, doctor, drive ONE mapped feature (one is enough; the map exists so later runs can cover the rest), capture evidence, clean up. After cleanup, confirm the evidence still exists at the named location — a cleanup that eats the proof fails this step. Fix what fails, and run the generated cleanup after every failed iteration too, so broken attempts don't strand processes and ports. A generated skill that was never executed is a draft, not a deliverable. If you proved it in a stand-in for the real target (a container in place of a fresh VM, a local stack in place of a remote one), list every setup step the stand-in did that the target will not. Those steps stay unverified until a run on the real target covers them.
41
+
42
+ ## 5. Offer the maintenance loop
43
+
44
+ Point the user at `/maintain-verification-skill` for keeping the map honest as the app changes. Suggest a cadence only if they ask.
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: principle-prove-it-works
3
+ description: "Apply after completing a task, before declaring done. Verify against the real artifact (run the feature, read the actual value, inspect the diff), not a proxy, self-report, or 'it compiles.'"
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Prove It Works
8
+
9
+ Verify every task output by checking the real thing directly. Do not infer from proxies, self-reports, or "it compiles."
10
+
11
+ **Why:** Unverified work has unknown correctness. Indirect verification (file mtimes, output freshness, agent self-reports, cached screenshots) feels cheaper than direct observation. Acting on a wrong inference costs far more than checking the source.
12
+
13
+ Check the real thing, not a proxy:
14
+ - Check process liveness directly, not indirectly through derived state
15
+ - Read the actual value, not a cached or derived representation
16
+ - When verification fails, suspect the observation method before suspecting the system
17
+
18
+ ## Script the check when you can
19
+
20
+ The strongest proof is a deterministic script that re-runs the same comparison, not a one-time eyeball. Write the script, run it, and keep its output as an artifact a reviewer can re-run instead of trusting your word.
21
+
22
+ Keep the artifact visible for the human. Commit it only for large or complex work where the trail has to be auditable later, like a big port or migration (the **show-me-your-work** skill).
@@ -0,0 +1,37 @@
1
+ {
2
+ "repository": "https://github.com/backnotprop/pstack",
3
+ "commit": "0c3333f09655d7933919795fbf4f9946d62b6f77",
4
+ "license": "MIT",
5
+ "files": [
6
+ {
7
+ "source": "skills/principle-prove-it-works/SKILL.md",
8
+ "file": "principle-prove-it-works.md",
9
+ "sha256": "ec79a15025bac8d33d62011c54f3b612733fd2a024e623b531b3637aa75070e2"
10
+ },
11
+ {
12
+ "source": "skills/create-verification-skill/SKILL.md",
13
+ "file": "create-verification-skill.md",
14
+ "sha256": "bba612e8b81a02df0f49e6f6911f3b543c8c7d9f1f3c13ae6c0e2d58cc8c3ad3"
15
+ },
16
+ {
17
+ "source": "skills/create-verification-skill/references/feature-map-example/README.md",
18
+ "file": "references/feature-map-example/README.md",
19
+ "sha256": "cb7bd782cf89968a4ba3d58a5151db837430db92d19a6f52a906973b77b516ba"
20
+ },
21
+ {
22
+ "source": "skills/create-verification-skill/references/feature-map-example/create-note.md",
23
+ "file": "references/feature-map-example/create-note.md",
24
+ "sha256": "644a44c74f35d38c2feb7cd05a0121fdebbb623e8dc376c185b565a581d1ccf7"
25
+ },
26
+ {
27
+ "source": "skills/create-verification-skill/references/feature-map-example/search.md",
28
+ "file": "references/feature-map-example/search.md",
29
+ "sha256": "6e87b9e7f2791a7776ba1bb83f371cd285c306c67f19d245cc4dd6ca3015c823"
30
+ },
31
+ {
32
+ "source": "LICENSE",
33
+ "file": "LICENSE",
34
+ "sha256": "bc957ca6bee02792566a1a028d105e02e247c6e77cf057061674273da77b200e"
35
+ }
36
+ ]
37
+ }
@@ -0,0 +1,47 @@
1
+ # Notes verification map
2
+
3
+ This directory is the maintained source for verifying the user-facing behavior of Notes. Read the index before driving the app, then use the matching feature file as the recipe.
4
+
5
+ ## Baseline preconditions
6
+
7
+ - Launch Notes at `http://127.0.0.1:4173` with a disposable data directory.
8
+ - Set `NOTES_DATA_DIR=/tmp/notes-verify-$RUN_ID` so concurrent runs do not share state.
9
+ - Seed notes titled `Quarterly plan` and `Grocery list`.
10
+ - Put `control-notes` and the `notes` CLI on `PATH`.
11
+ - Run `control-notes doctor` and require the expected URL, data directory, and build revision.
12
+ - Never drive an instance that was not started by this verification run.
13
+
14
+ ## Driving conventions
15
+
16
+ - Start every recipe from the baseline state unless its preconditions say otherwise.
17
+ - Prefer ARIA roles and accessible names over CSS selectors or DOM position.
18
+ - Treat every command as literal. Keep quoted names and flags unchanged.
19
+ - Run browser actions through `control-notes browser`.
20
+ - Run terminal actions through `control-notes cli -- <command>`.
21
+ - Restore seeded data after a mutation. Do not remove proof artifacts during cleanup.
22
+
23
+ ## Proof and skip reporting
24
+
25
+ - Capture the user action and the resulting state, not only the final screen.
26
+ - UI proof includes an ARIA snapshot and a screenshot with the app identity visible.
27
+ - CLI proof includes the command, stdout, stderr, and exit code.
28
+ - Mutation proof includes a read-only second view of the stored value.
29
+ - Record the feature ID and entry point used with every artifact.
30
+ - Report an unreachable path with the attempted command and the unmet precondition.
31
+ - Do not report a skipped entry point as verified through a different path.
32
+
33
+ ## Feature entry contract
34
+
35
+ Each feature file starts with an H1 title and one paragraph describing the user-visible behavior. It then uses exactly four H2 sections in this order.
36
+
37
+ 1. `Sub-features` lists short IDs with one line for each behavior.
38
+ 2. `How to get to it (user POV)` lists every user entry point.
39
+ 3. `Driving it with <harness>` starts with `Preconditions:` and uses labeled bullets that pair each user action with an exact command and observable result.
40
+ 4. `Gotchas` lists traps that can waste or invalidate a verification run.
41
+
42
+ Keep implementation details out of the map. Name only user paths, stable handles, required state, commands, and observable proof.
43
+
44
+ ## Features
45
+
46
+ - [Create a note](./create-note.md) covers browser and CLI creation, cancellation, persistence, and cleanup.
47
+ - [Search notes](./search.md) covers toolbar, keyboard, and CLI search with matching, empty, and clear states.
@@ -0,0 +1,39 @@
1
+ # Create a note
2
+
3
+ Create note lets a user save a titled note from the browser or CLI, cancel an unfinished draft, and confirm the saved note from a second user-facing view.
4
+
5
+ ## Sub-features
6
+
7
+ - `create-open` opens a blank editor from each browser entry point.
8
+ - `create-save` persists a title and body.
9
+ - `create-cancel` discards an unfinished browser draft.
10
+ - `create-cli` creates the same note shape from the terminal.
11
+
12
+ ## How to get to it (user POV)
13
+
14
+ - Choose the `New note` button in the browser toolbar.
15
+ - Press `n` in the browser while focus is outside an editable field.
16
+ - Run `notes create --title <title> --body <body>` in a terminal.
17
+
18
+ ## Driving it with control-notes
19
+
20
+ Preconditions:
21
+
22
+ - Notes is healthy at `http://127.0.0.1:4173`.
23
+ - No note is titled `Release checklist`.
24
+ - `control-notes doctor` reports the expected URL and disposable data directory.
25
+
26
+ - **Open editor.** Choose `New note`. Run `control-notes browser click --role button --name "New note"`. A form named `Note editor` appears with focus in the `Title` textbox.
27
+ - **Enter content.** Type the title and body. Run `control-notes browser fill --role textbox --name "Title" --value "Release checklist"` and `control-notes browser fill --role textbox --name "Body" --value "Tag and publish"`. The `Save note` button becomes enabled.
28
+ - **Save note.** Choose `Save note`. Run `control-notes browser click --role button --name "Save note"`. A status named `Note saved` appears and the heading reads `Release checklist`.
29
+ - **Confirm persistence.** Return to the note list and reopen the note. Run `control-notes browser click --role link --name "All notes"` and `control-notes browser click --role link --name "Release checklist"`. The editor shows both saved values.
30
+ - **Cancel draft.** Open a new note, enter `Discard me`, and choose `Cancel`. Run `control-notes browser click --role button --name "New note"`, `control-notes browser fill --role textbox --name "Title" --value "Discard me"`, and `control-notes browser click --role button --name "Cancel"`. The note list returns and has no `Discard me` link.
31
+ - **CLI entry.** Create a second note. Run `control-notes cli -- notes create --title "CLI note" --body "Created from terminal" --format json`. Exit code `0` and stdout contain the new note ID and title.
32
+ - **Proof.** Reopen both saved notes from `All notes`. Run `control-notes browser snapshot --aria --path artifacts/create-note/list.aria.txt` and `control-notes browser screenshot --path artifacts/create-note/list.png`. The artifacts show `Release checklist` and `CLI note`.
33
+
34
+ ## Gotchas
35
+
36
+ - Pressing `n` while a textbox has focus types the character instead of opening a new editor.
37
+ - Titles are trimmed on save. Assert the rendered title, not the draft input value.
38
+ - A save status alone is insufficient proof. Reopen the note from the list.
39
+ - Remove `Release checklist` and `CLI note` during fixture cleanup, but retain their proof artifacts.
@@ -0,0 +1,45 @@
1
+ # Search notes
2
+
3
+ Search lets a user find notes by title or body text, inspect a matching note, and distinguish no matches from an unavailable search.
4
+
5
+ ## Sub-features
6
+
7
+ - `search-open` opens search from each supported browser entry point.
8
+ - `search-match` returns title and body matches without changing note data.
9
+ - `search-open-result` opens a result in the note editor.
10
+ - `search-empty` shows a complete empty state for a query with no matches.
11
+ - `search-clear` removes the query and restores the recent-notes view.
12
+ - `search-cli` returns the same matching notes from the terminal.
13
+
14
+ ## How to get to it (user POV)
15
+
16
+ - Choose the `Search` button in the browser toolbar.
17
+ - Press `/` in the browser while focus is outside an editable field.
18
+ - Run `notes search <query>` in a terminal.
19
+
20
+ ## Driving it with control-notes
21
+
22
+ Preconditions:
23
+
24
+ - Notes is healthy at `http://127.0.0.1:4173`.
25
+ - The disposable data directory contains `Quarterly plan` with body text `Draft budget`.
26
+ - `control-notes doctor` reports the expected URL and data directory.
27
+
28
+ - **Toolbar entry.** Choose the `Search` button. Run `control-notes browser click --role button --name "Search"`. A dialog named `Search notes` appears with focus in its searchbox.
29
+ - **Keyboard entry.** Close the dialog, focus the page, and press `/`. Run `control-notes browser press --key "/"`. The same dialog appears and the page does not insert a slash.
30
+ - **Title match.** Type `quarterly`. Run `control-notes browser fill --role searchbox --name "Search notes" --value "quarterly"`. The `Search results` list contains `Quarterly plan` and does not contain `Grocery list`.
31
+ - **Body match.** Replace the query with `budget`. Run `control-notes browser fill --role searchbox --name "Search notes" --value "budget"`. The result `Quarterly plan` remains visible with a body-match excerpt.
32
+ - **Open result.** Choose `Quarterly plan`. Run `control-notes browser click --role link --name "Quarterly plan"`. The dialog closes and the editor heading reads `Quarterly plan`.
33
+ - **Empty state.** Reopen search and enter `volcano`. Run `control-notes browser fill --role searchbox --name "Search notes" --value "volcano"`. A status named `No matching notes` appears after search completes.
34
+ - **Clear query.** Choose `Clear search`. Run `control-notes browser click --role button --name "Clear search"`. The searchbox is empty and the `Recent notes` region replaces the result list.
35
+ - **CLI match.** Search from the terminal. Run `control-notes cli -- notes search "quarterly" --format json`. Exit code `0` and stdout contain one object whose title is `Quarterly plan`.
36
+ - **CLI miss.** Search for an absent value. Run `control-notes cli -- notes search "volcano" --format json`. Exit code `0` and stdout are `[]`.
37
+ - **Proof.** Capture the populated result state. Run `control-notes browser snapshot --aria --path artifacts/search/results.aria.txt` and `control-notes browser screenshot --path artifacts/search/results.png`. Both artifacts identify Notes, the query, and `Quarterly plan`.
38
+
39
+ ## Gotchas
40
+
41
+ - Pressing `/` while the editor or searchbox has focus inserts text instead of opening search.
42
+ - Results update after a short debounce. Wait for the results list or empty status, not a fixed sleep.
43
+ - Archived notes are excluded unless the user enables `Include archived`.
44
+ - The CLI defaults to human-readable output. Use `--format json` for stable assertions.
45
+ - Opening a result changes browser state. Reopen search before proving another query.
@@ -12,6 +12,10 @@ Use this guide when assigned a role objective. If the dispatcher supplied an exi
12
12
 
13
13
  Standalone use has the same local rules. Codex/Claude runs the CLI and tools. No Office server is needed. The CLI cannot intercept tools or authenticate people: host permissions and real approvals remain separate.
14
14
 
15
+ Every role follows [model-selection.md](model-selection.md) before model dispatch. The host discovers and invokes permitted models; the role name does not fix a model tier. Model selection adds no assignment fields or CLI flags and cannot bypass local graph checks.
16
+
17
+ Task `input.verification` supplies the selected project recipe path/hash and checks relevant to this node's V scope. Read the recipe and only relevant feature entries; the CLI runs profile argv, not Markdown. Delivery `workflow-review` and role `review` also receive `input.reviewBudget`: default 3 with adaptation and no nested delegation. Apply the shared round allocation in `skill-integration.md`; Office/host enforces actual worker counts.
18
+
15
19
  If PM and Developer disagree about completion, return the exact requirement and evidence to Office. Resolve the shared criteria there. A changed requirement or assignment starts a new run; do not silently edit the bound source or reuse old completion evidence.
16
20
 
17
21
  ## Assignment schema and initialization
@@ -131,6 +135,8 @@ For `human`, `replan` or exhausted attempts, resolve the decision explicitly; th
131
135
 
132
136
  ## Compatibility and limits
133
137
 
134
- Assignment schema is v1; role run format is v2. Existing delivery v1 files work without migration. Old runtimes cannot read role v2. Do not downgrade a runtime while using these commands, or edit versions/fingerprints to force compatibility. Install this source artifact and run `doctor`; a package name/version alone does not prove which code an Office worker has.
138
+ Assignment schema remains v1; new delivery and role runs use v3. Legacy v1/v2 runs are inspectable only and require fresh review/verification in a new run. Stop old workers and inspect side effects before updating. Do not edit versions/fingerprints or rename runs to bypass retry limits. Install this source artifact and run `doctor`; a package name/version alone does not prove which code an Office worker has.
135
139
 
136
140
  No Office adapter, cross-run lock, transport authentication, sandbox, model execution or global budget manager is included. Each run has its existing atomic file lock and local read/write scheduling. Host processes must isolate multiple writers and validate actual revisions before integrating results.
141
+
142
+ New role runs use v3 with `kind: role`. Developer self-check requires real runner receipts for its V scope. Reviewer results include the tool-bound snapshot selected at initialization and started at review; code changes invalidate that assignment. `needs_changes` completes the review role, never delivery. PM/team-lead planning does not require runtime checks. Record host execution metadata as described in `model-selection.md`. Legacy v2 runs are read-only; do not translate their passed flags into v3 proof.
@@ -4,6 +4,8 @@ The kit owns work-graph rules and human gates. Prefer compatible Superpowers foc
4
4
 
5
5
  ## Select once for the assigned stage
6
6
 
7
+ Apply [model-selection.md](model-selection.md) before dispatch. Select from the host's permitted models for this task, including much smaller models when sufficient. Skill-internal workers inherit the same policy and limits; skill selection does not authorize a new provider or extra delegation.
8
+
7
9
  Read the actual installed skill and required references before invoking it. Resolve its full name/path through the host's skill catalog; prefer the namespaced `compound-engineering:ce-*` entry when duplicates exist, unless the user selected another installation. Record the selected skill, mode and artifact path in existing task evidence, not a new registry. Similar names do not guarantee matching arguments.
8
10
 
9
11
  Check that its mode and required tools fit the host's allowed workspace, delegation, model route, remaining budget and commit/publish permissions. A mode controls output/flow, not authorization. Return-to-caller does not automatically disable internal workers or implementation commits.
@@ -20,8 +22,8 @@ These are skill invocation arguments, not Graph CLI flags. Invocation uses the h
20
22
  | Team lead: plan approved work | `ce-plan` with an explicit caller-owned pipeline instruction and the approved Story | Plan, requirement links, confidence/review result and unresolved blockers |
21
23
  | Developer: implement the assigned approved task | `superpowers:test-driven-development`; `superpowers:systematic-debugging` for unexplained failures | Changed files, applicable RED/GREEN evidence, diagnosis and blockers; return to the assigned graph |
22
24
  | Verification owner: verify the submitted revision | `superpowers:verification-before-completion` | Fresh relevant commands, results, revision and limits |
23
- | Developer: simplify after related GREEN checks | `ce-simplify-code` scoped to the assigned changes | Behavior-preserving changes or a justified no-change result, then affected checks |
24
- | Reviewer: assess the submitted change | `ce-code-review mode:agent base:<base-ref> plan:<plan-path>` | Review JSON and evidence, including scope, verdict, findings and coverage limits |
25
+ | Developer: simplify after related GREEN checks | Inline simplification criteria in `execution.md`; compatible `ce-simplify-code` only within the shared budget below | Behavior-preserving changes or a justified no-change result, then affected checks |
26
+ | Reviewer: assess the submitted change | Budget-compatible `ce-code-review mode:agent base:<base-ref> plan:<plan-path>`, otherwise direct bounded review | Findings and evidence, including scope, verdict and coverage limits |
25
27
  | Delivery owner: capture proven learning | Namespaced CE `ce-compound mode:non-interactive <verified-context>` when supported | One useful learning or an explicit no-lesson outcome |
26
28
 
27
29
  For `ce-plan`, state: "Pipeline context: return the plan and review result to this workflow; the caller owns execution, human gates and the next action. Return unresolved decisions as blockers." Do not invent a `mode:pipeline` argument for a version that does not document it. Reuse an existing plan; a small reversible task can use the kit's minimal plan and direct implementation without creating a CE plan artifact solely to invoke `ce-work`.
@@ -44,6 +46,17 @@ Planning may already include document review. Reuse that receipt; a graph valida
44
46
 
45
47
  Office/host assigns roles, runs agents, transports messages and owns global execution limits. All skill-internal workers and correction attempts consume those same limits. Use permitted inline execution when the selected skill supports it; otherwise return a capability/budget blocker. Never claim an inline self-review was an independent reviewer. Do not weaken an independence requirement to fit a budget or force every review to the heaviest depth.
46
48
 
49
+ ### One review allocation
50
+
51
+ Before dispatch, the caller chooses the round's allocation and records the reason in existing review evidence. Graph review task input supplies `reviewBudget`: **default 3 agents**, 0–2 for small changes, 4–5 for specific high-risk seams. Host/user limits take precedence, including zero delegation. This is an operating default, not a measured optimum or a CLI-enforced scheduler.
52
+
53
+ - Normal round: combine correctness/security, tests/spec/runtime evidence, and maintainability/performance into three bounded assignments. Give each only the relevant diff, requirements and evidence references.
54
+ - Docs/mechanical changes: 0–1; a small behavioral change: 1–2. Add a specialist only for a named uncovered risk such as authorization or migration recovery; state why 4–5 is needed.
55
+ - Count **all** simplify/review/validation/report workers in the same round. Main performs simplification and aggregation by default. Reviewers return findings directly and do not re-delegate. New rounds need changed code or a named unresolved concern; unchanged work does not earn another full panel.
56
+ - Check the installed skill before invoking it. `mode:agent` selects output, not a worker cap. If its internal fan-out cannot fit the allocation, use the direct bounded review instead of launching it and hoping. Do not invent `max_reviewers` flags. Preserve any required independent-review coverage; report a gap if host limits prevent it.
57
+
58
+ The host enforces actual dispatch counts. Graph's ready-node width is a separate DAG limit and does not cap nested skill workers. Model choice follows `model-selection.md`; extra personas on one model are not the multi-model evidence of Pstack `interrogate`. Do not automatically append interrogate to CE review.
59
+
47
60
  The Reviewer reports fixes to the Developer; do not use `apply:local` on a read-only review assignment. "Read-only" concerns product changes; allow required review artifacts only in the designated output/scratch paths. Do not invoke CE shipping, PR, babysitting, or external-model routes merely because they are installed. A user-approved route still applies within its authorized scope.
48
61
 
49
62
  ## Superpowers coexistence
@@ -53,3 +66,5 @@ Do not automatically invoke `brainstorming → writing-plans → executing-plans
53
66
  Use Superpowers' focused TDD, systematic-debugging and verification skills by default where available and applicable to the assigned stage. Read their actual instructions; a skill name in evidence is not proof of execution. No artificial RED test is needed for a prose-only change. Preserve existing approvals and plans, and respect higher-priority host instructions. Do not rerun a procedure already completed with sufficient evidence. Missing focused skills use the kit's direct procedure, with the fallback disclosed. This is a deliberate composition of focused skills, not a claim that the full Superpowers workflow ran. Capture reusable knowledge through CE after resolved review and fresh verification.
54
67
 
55
68
  This reference is host instruction policy, not an SDK bridge or a code-enforced Office adapter. The kit installs this policy, not CE or Superpowers. Confirm capabilities in each actual agent environment; neither plugin's presence in the current developer session proves it is available in Office workers.
69
+
70
+ Pstack's principles and creation guide are selectively vendored with MIT notices in `pstack/provenance.json`. Read `verification.md` at setup/execution: discover/reuse the project's verification skill or guide, bind it through profile `recipe`, and drive its real journeys under SP's fresh-evidence procedure. No second orchestration or duplicate verification pass. Retrieve relevant `docs/solutions/` lessons and capture verified learning once after review and fresh checks.
@@ -14,15 +14,18 @@ Before presenting G4, run `node .ai-workflow/bin/graph.mjs status <run.json>` an
14
14
 
15
15
  ## Record
16
16
 
17
- Save the raw evidence, human answer, and evaluation to `docs/understanding/<slug>-diff.md`. Then record:
17
+ Save raw evidence, the actual human answer, and evaluation privately under `.ai-workflow/approvals/`. The referenced G4 JSON records `gate: "G4"`, the canonical `storyHash`, current Graph `snapshot`, `runId`, and a nonempty `responseRef` pointing to the real response. See `verification.md`. Binding detects reuse; it does not authenticate a person. Never invent a response or obtain it from another agent. Then record:
18
18
 
19
19
  `Understanding gate (G4): <artifact> · <date> · Check-in: accepted`
20
20
 
21
- Also append `G4: PASS — <what the human correctly restated>`. Set `Status: Delivered` only after both records exist and both of these exit 0:
21
+ Also append `G4: PASS — <what the human correctly restated>`. Set `Status: Delivered` only after both records exist and the document checks and bound delivery check exit 0:
22
22
 
23
23
  ```
24
24
  node .ai-workflow/bin/check.mjs story <story-file>
25
25
  node .ai-workflow/bin/check.mjs gate G4 <story-file>
26
+ node .ai-workflow/bin/graph.mjs delivery <run.json>
26
27
  ```
27
28
 
28
- Run them and report both exit codes; never claim the gate passed without that output. A `story` run on a Story that is not yet `Delivered` does not check G4 at all, and says so. Use `G4: N/A — <specific reason>` only when no implementation behavior changed; never use it to bypass uncertainty.
29
+ Run them and report the exit codes; never claim the gate passed without that output. A `story` run on a Story that is not yet `Delivered` does not check G4 at all, and says so. Use `G4: N/A — <specific reason>` only when no implementation behavior changed; never use it to bypass uncertainty.
30
+
31
+ Document-only `G4: N/A` remains a shape-check exception, not executable delivery proof. The strengthened delivery check requires a bound human G4 plus fresh Graph evidence; do not relabel N/A as runtime verification.
@@ -0,0 +1,64 @@
1
+ # Prove the current Story against the running product
2
+
3
+ Read this at project setup and final verification, not at every node. The pinned Pstack [principle](pstack/principle-prove-it-works.md) and [recipe guide](pstack/create-verification-skill.md) supply evidence standards. Pstack creates project-specific `verify-<app>` skills; it does not expose one universal `verify` skill. This integration uses that project procedure inside SP's fresh-verification stage; Graph owns state and receipts.
4
+
5
+ ## Discover and exercise the project procedure
6
+
7
+ 1. Inspect the project's skill catalog, E2E scripts and verification guides. Reuse an adequate existing procedure. Record its project-relative path as profile `recipe`; read it before running relevant checks. If no guide is needed for a simple existing assertion, a recipe-free profile remains valid.
8
+ 2. If the user journey has no runnable procedure, use the pinned creation guide to write a minimal project-local `verify-<app>/SKILL.md` or an existing-style verification guide. Include Launch (start/configure), Doctor (diagnose prerequisites), Drive (user actions and assertions), Evidence (preserved observations), Cleanup (owned resources) and only necessary Helpers. A short-lived CLI can state that no server is required. Reuse the current harness and record external stand-ins and limits.
9
+ 3. For multiple journeys, keep a small feature index beside the recipe linking each covered V to its actions, expected result, failure path and checker. Read only relevant entries. List helper/feature-map directories in profile `inputs`; Markdown links alone do not bind those files.
10
+ 4. Before accepting a new or changed procedure, actually follow it once: diagnose the environment, launch/drive the real product, inspect assertions/logs and clean up. Check that evidence survives cleanup. A changed feature or failed Doctor triggers repair of the affected procedure, not a second full workflow or one worker per feature.
11
+
12
+ For a runnable example see [verify-cli](../../../examples/verification/verify-cli/SKILL.md) in the package source; installed projects copy `examples/verification` from the package as described in its README. Do not install full Pstack setup/poteto-mode or register a second workflow to obtain this procedure.
13
+
14
+ For each Story V ID, describe the real user entry point, preconditions, action, expected state/side effect and failure path. Reuse a suitable existing test. Otherwise write a small executable checker that starts/drives the actual CLI/server/browser and asserts those observations. A server's successful startup alone does not prove its feature. No mocks beyond existing external boundaries. Missing prerequisites, unavailable environments and manual-only checks remain unverified and block executable delivery; never replace them with a convenient no-op.
15
+
16
+ ## Project profile
17
+
18
+ Create `.ai-workflow/verification.json` (review it like executable code):
19
+
20
+ ```json
21
+ {
22
+ "version": 1,
23
+ "recipe": "verify-app/SKILL.md",
24
+ "inputs": ["src", "scripts/prove-feature.mjs", "verify-app", "package.json"],
25
+ "checks": [
26
+ {"id":"feature", "covers":["V1"], "argv":["node","scripts/prove-feature.mjs"], "timeoutMs":30000}
27
+ ],
28
+ "requiresG3": false
29
+ }
30
+ ```
31
+
32
+ Use actual project paths and Story IDs. Optional `recipe` must name a readable, nonempty file inside the project without symlinks. Task inputs include its path/byte hash and relevant check IDs; receipts retain that recipe identity. The file is not executed as code. A hash binds content, not proof that an agent read/invoked the skill or that its assertions are adequate.
33
+
34
+ Commands run from the project root with `shell: false`, inherited host environment/permissions, closed stdin and a 30-second default timeout (maximum 300 seconds). Combined output over 10 MiB fails the check and retains truncated logs. Cleanup targets the command's process group on POSIX and its direct child on Windows; checkers must stop services they detach. If output pipes remain open beyond the 500ms termination grace, the runner closes its streams and records `outputIncomplete`, which fails verification. Shell operators are literal argv; put pipelines/server lifecycle in a reviewed checker script that asserts behavior and exits nonzero on failure. This runner is not a security sandbox. Use an existing worktree/container for risky prototypes according to host policy.
35
+
36
+ Git snapshots include HEAD, index state, tracked bytes/deletions, executable modes and nonignored untracked files, plus explicit inputs. Profile, selected recipe and required G3 design are always additional snapshot inputs, including when Git-ignored. Other ignored helpers/features require explicit inputs. Recipe edits make previous review/verification stale; profile edits require a new run. Non-Git projects must still list behavioral inputs explicitly, including dependencies/configuration/checkers. Commit/stage before final verification, or rerun affected checks after those Git changes. External services, environment variables, installed dependencies and data are not fully captured; record versions/seed conditions and remaining boundaries in the recipe.
37
+
38
+ Keep generated run/result/log/approval files under `.ai-workflow/runs/`, `.ai-workflow/evidence/`, `.ai-workflow/approvals/`. These outputs are excluded; never put product source there. Keep checker-generated caches/builds Git-ignored, or make them declared stable inputs. Logs may contain secrets: keep them local, inspect/redact before intentionally sharing, never automatically upload/commit them.
39
+
40
+ ## Bind human decisions
41
+
42
+ Compute the canonical Story hash with installed `storyContract` from `.ai-workflow/graph/workflow.mjs`; it excludes Status and G1/G3/G4 metadata lines. Add the existing gate line pointing to an approval JSON. Populate only after the real human decision:
43
+
44
+ ```json
45
+ {"gate":"G1", "storyHash":"<canonical hash>", "responseRef":"<actual response reference>"}
46
+ ```
47
+
48
+ For a design requiring G3, set `requiresG3: true` and `design: "docs/design.md"` in the profile; the G3 JSON additionally has `decisionHash` (SHA-256 of design bytes). Obtain the decision before initialization/implementation. Small changes need no G3. Risk declaration belongs to the approved scope and reviewed profile, not a keyword classifier.
49
+
50
+ G4 JSON additionally has the current Graph `snapshot` and `runId`; preserve prediction-before-reveal in `understanding-gate.md`. These bindings prevent accidental reuse; a host controlling repository files can forge records. They are not human identity authentication.
51
+
52
+ ## Run and inspect
53
+
54
+ Start the final verification node, then execute every configured check intersecting its V scope. If several checks cover the same V, all are required; one convenient passing journey cannot replace another:
55
+
56
+ ```bash
57
+ node .ai-workflow/bin/graph.mjs verify <run.json> workflow-verify <started-token> feature
58
+ ```
59
+
60
+ Under `superpowers:verification-before-completion`, read `verification.passed`, exit code/signal/timeout/incomplete-output, actual stdout/stderr, snapshot before/after and asserted boundaries from this same execution. No second run is needed merely because Pstack and SP both apply. CLI exit 0 reports successful collection, including a failing check. Empty logs are valid; the structured receipt captures execution. Raw log hashes and receipts are rechecked. A failed execution cannot be overridden by result `passed: true`; reset affected work and re-execute after correction. Repeating a check in one attempt is rejected. Reset preserves attempt counts and fences late results; it does not cancel a running process, which remains timeout-bound. Inspect host-owned workers before recovery.
61
+
62
+ Record the existing result JSON afterward. Review and final checks must reference the current code snapshot. `status` returns `stale` without rewriting saved state when code changed. Reset the earliest stale node, rerun descendants, and obtain G4 for the fresh snapshot. After real G4 run `graph.mjs delivery <run.json>`; document shape checks alone cannot establish delivery.
63
+
64
+ Legacy v1/v2 runs remain readable with `upgrade-required`. Stop old workers, retain artifacts/attempt history, and rerun checks/review in a new v3 run. Never import old `passed` flags as proof or reset budgets by renaming runs. Package 5.0 introduces this breaking persisted-format change; run format v3 is independent of the package version.
@@ -0,0 +1,19 @@
1
+ import { digest, readJson, readProjectFile } from './storage.mjs';
2
+
3
+ export function approvalPath(text, gate) {
4
+ return text.match(new RegExp(`^Understanding gate \\(${gate}\\):\\s*([^·|\\n]+)[·|]`, 'im'))?.[1].trim();
5
+ }
6
+
7
+ // Binding prevents accidental reuse. It does not authenticate the host or the human.
8
+ export async function boundApproval({ root, story, gate, expected, checkGate }) {
9
+ const checked = await checkGate({ root, file: story, gate });
10
+ if (!checked.ok) throw new Error(checked.errors.join('\n'));
11
+ const file = approvalPath(await readProjectFile(root, story), gate);
12
+ if (!file) throw new Error(`${gate} requires a bound approval JSON artifact.`);
13
+ const value = await readJson(root, file);
14
+ if (value.gate !== gate || typeof value.responseRef !== 'string' || !value.responseRef.trim()
15
+ || Object.entries(expected).some(([key, expectedValue]) => value[key] !== expectedValue)) {
16
+ throw new Error(`${gate} approval binding changed or missing; obtain a fresh human decision for this Story/revision.`);
17
+ }
18
+ return { file, hash: digest(JSON.stringify(value)) };
19
+ }