@pazmo/ai-workflow-kit 5.3.0 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/README.ko.md +32 -42
- package/README.md +32 -42
- package/assets/check.mjs +127 -4
- package/assets/graph.mjs +2 -1
- package/package.json +1 -1
- package/skills/workflow/EVALS.md +16 -11
- package/skills/workflow/SKILL.md +7 -5
- package/skills/workflow/assets/STORY.md +30 -15
- package/skills/workflow/references/execution.md +26 -15
- package/skills/workflow/references/fast-path.md +23 -0
- package/skills/workflow/references/graph-advanced.md +126 -0
- package/skills/workflow/references/graph-engineering.md +1 -122
- package/skills/workflow/references/graph-minimal.md +52 -0
- package/skills/workflow/references/intake.md +25 -9
- package/skills/workflow/references/jira.md +3 -3
- package/skills/workflow/references/light-lane.md +31 -0
- package/skills/workflow/references/model-selection.md +14 -0
- package/skills/workflow/references/role-graphs.md +2 -2
- package/skills/workflow/references/skill-integration.md +4 -4
- package/skills/workflow/references/understanding-gate.md +49 -9
- package/skills/workflow/references/verification.md +3 -3
- package/src/graph/advance.mjs +180 -0
- package/src/graph/approvals.mjs +29 -1
- package/src/graph/approve.mjs +105 -0
- package/src/graph/cli.mjs +126 -8
- package/src/graph/copies.mjs +85 -0
- package/src/graph/light.mjs +182 -0
- package/src/graph/profile.mjs +129 -0
- package/src/graph/snapshot.mjs +2 -1
- package/src/graph/verification.mjs +92 -28
- package/src/graph/workflow.mjs +1 -1
- package/src/jira.mjs +14 -13
- package/src/managed-block.mjs +3 -3
|
@@ -1,30 +1,45 @@
|
|
|
1
1
|
# Story: <observable outcome>
|
|
2
|
-
Status: Draft
|
|
3
|
-
Owner: <human owner>
|
|
4
|
-
Understanding gate (G1): <pending>
|
|
5
|
-
Understanding gate (G4): <pending>
|
|
6
2
|
|
|
7
3
|
## Goal
|
|
8
|
-
|
|
4
|
+
1. As-is: <what happens today and why it is a problem>
|
|
5
|
+
2. To-be: <what happens after the change>
|
|
6
|
+
3. Unchanged: <what must stay exactly as it is>
|
|
9
7
|
|
|
10
8
|
## Domain
|
|
11
|
-
- Terms:
|
|
12
|
-
|
|
9
|
+
- Terms:
|
|
10
|
+
1. <term> = <meaning; code identifiers are fine>
|
|
11
|
+
- Invariant:
|
|
12
|
+
1. <must always / never happen>
|
|
13
|
+
|
|
14
|
+
## Decisions
|
|
15
|
+
- D1. ASSUMED: <decision title>
|
|
16
|
+
1. <the decided value or rule>
|
|
17
|
+
2. <a different consequence or action, only if there is one>
|
|
18
|
+
- OPEN BLOCKING: <remove before approval, or omit>
|
|
13
19
|
|
|
14
20
|
## MUST
|
|
15
|
-
- M1. <
|
|
16
|
-
|
|
21
|
+
- M1. <condition or case>
|
|
22
|
+
1. <result A + result B that happen together>
|
|
23
|
+
- M2. <condition or case>
|
|
24
|
+
1. <result>
|
|
17
25
|
|
|
18
26
|
## SHOULD
|
|
19
|
-
- S1. <
|
|
27
|
+
- S1. <title> (<purpose>)
|
|
28
|
+
1. <action>
|
|
20
29
|
|
|
21
30
|
## OUT
|
|
22
|
-
- O1. <
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
-
|
|
26
|
-
- OPEN BLOCKING: <remove before approval, or omit>
|
|
31
|
+
- O1. <excluded area>
|
|
32
|
+
1. <excluded item>
|
|
33
|
+
2. <another excluded item>
|
|
34
|
+
- O2. <single excluded item>
|
|
27
35
|
|
|
28
36
|
## Verify
|
|
29
37
|
- V1 [M1]. <input/action → observable result>
|
|
30
38
|
- V2 [M2]. <failure/retry → state remains valid>
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
Status: Draft
|
|
42
|
+
Owner: <human owner>
|
|
43
|
+
Lane: <light | standard>
|
|
44
|
+
Understanding gate (G1): <pending>
|
|
45
|
+
Understanding gate (G4): <pending>
|
|
@@ -2,16 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
## Assigned graph work
|
|
4
4
|
|
|
5
|
-
If a host such as Agent Office delegates a started kit node, use its run/token and perform only the assigned role's procedure below. Return evidence and feedback to that graph; do not restart the entire workflow. Office coordinates roles and communication, while the kit continues to govern the work graph. See `graph-
|
|
5
|
+
If a host such as Agent Office delegates a started kit node, use its run/token and perform only the assigned role's procedure below. Return evidence and feedback to that graph; do not restart the entire workflow. Office coordinates roles and communication, while the kit continues to govern the work graph. See `graph-advanced.md` for dispatch boundaries.
|
|
6
6
|
|
|
7
7
|
## Stage integration
|
|
8
8
|
|
|
9
9
|
Read `skill-integration.md` before selecting skills. Prefer Superpowers focused planning/implementation/review/verification skills and CE learning capture; CE planning, simplify and review modes are explicit alternatives. Keep one workflow owner. Existing approvals and the assigned role/task bound each invocation. Use the same evidence requirements with a disclosed direct fallback when a compatible skill is unavailable.
|
|
10
10
|
|
|
11
|
+
## Orchestration
|
|
12
|
+
|
|
13
|
+
The main session keeps the Story, G1, the plan and the G4 summary. Code reading and writing go to subagents, on the tiers in `model-selection.md`:
|
|
14
|
+
|
|
15
|
+
- **Implementation:** a mid-tier subagent. Its brief is the Story's MUST/Verify, the `begin` brief and the intake map. It writes the tests and code and returns a short summary. The main session reads that summary, `git diff --stat` and the check results, not the code.
|
|
16
|
+
- **Review:** one mid-tier subagent with the Story's MUST/Verify and the diff; two main-model reviewers for a Story that needs G3.
|
|
17
|
+
- **Escalation:** after two failed attempts on the same node, the main model takes over.
|
|
18
|
+
- Codex, or any host without subagents, does the same steps in the main session.
|
|
19
|
+
|
|
20
|
+
**Test volume:** one focused test per Verify item, and a second only for a distinct failure path in its MUST. Add no tests for behavior the Story does not change unless an Invariant names it.
|
|
21
|
+
|
|
11
22
|
## Size first
|
|
12
23
|
|
|
13
|
-
- **
|
|
14
|
-
- **
|
|
24
|
+
- **Light lane** (`Lane: light`): follow `light-lane.md`. Record `Plan source: N/A — small and reversible`.
|
|
25
|
+
- **Standard, one outcome:** the built-in minimal plan. The Story's MUST/Verify, the `begin` brief and the intake map are the implementer's spec; write no plan document. Record `Plan source: N/A — minimal plan`.
|
|
26
|
+
- **Normal:** several dependent outcomes. Use `superpowers:writing-plans` under the caller-owned contract → Superpowers focused TDD/diagnosis → inline simplification → bounded review with `superpowers:requesting-code-review` or direct review when compatible skills are available; simplify only after related tests pass. Apply the shared review allocation in `skill-integration.md` (default 1). Otherwise perform equivalent repository-grounded stages directly.
|
|
15
27
|
- **High-risk/hard to reverse:** add G3. Present the key design decision, alternatives, invariant, rollback/recovery path, and evidence plan; end the turn for human approval before work. Save that decision to `docs/understanding/<slug>-plan.md` and record `Understanding gate (G3): <artifact> · <YYYY-MM-DD> · Check-in: accepted`.
|
|
16
28
|
|
|
17
29
|
High-risk signals: money/payment, authentication/authorization, concurrency, destructive migration, sensitive data, data loss, and irreversible external side effects.
|
|
@@ -22,7 +34,7 @@ Lead with the human-visible change and the reason for the chosen approach. Then
|
|
|
22
34
|
|
|
23
35
|
Use one concrete scenario rather than a list of framework names. Explain each proposed Task by the behavior it delivers and how it connects to the next Task, not just the repository or layer it touches. Keep already-approved decisions visible without asking for them again; ask only for a new material decision. This explanation belongs to the existing plan and G3 checkpoint, not an extra document or gate.
|
|
24
36
|
|
|
25
|
-
This is pre-implementation explanation.
|
|
37
|
+
This is pre-implementation explanation, not G4. At G4, follow `understanding-gate.md` for the Story's mode: `ai-summary` by default, `human-restatement` (prediction before reveal) for G3 work.
|
|
26
38
|
|
|
27
39
|
## Task rule
|
|
28
40
|
|
|
@@ -32,14 +44,13 @@ Create Tasks only when the approved Story cannot be reviewed as one PR. Each Tas
|
|
|
32
44
|
|
|
33
45
|
For user-authorized optional Jira publication after G1, follow `jira.md`. Without a connector or authorized target, produce a preview only; the Story remains canonical.
|
|
34
46
|
|
|
35
|
-
1. Read the approved Story
|
|
36
|
-
2.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
7. Record the verified evidence in the graph, run its `status` command, and require `action: g4` before continuing to `understanding-gate.md`; passing tests alone are not completion.
|
|
47
|
+
1. Read the approved Story and the intake map. Open code only to settle a specific question; the implementer reads the code.
|
|
48
|
+
2. Choose the plan by size above and set up the run with `go` as `fast-path.md` describes; several outcomes supply the reviewed task DAG (`graph-advanced.md`). Fix a wrong detected profile with `verification.md`: assert the actual user path and failure cases, rather than treating exit 0 from a no-op as behavioral proof. Do not create a second requirement source. Complete any required G3 before implementation nodes run.
|
|
49
|
+
3. `begin` each implementation node and dispatch the implementer (Orchestration above). It uses compatible `superpowers:test-driven-development`, and `superpowers:systematic-debugging` for unexplained failures. For new behavior or a bug fix it demonstrates RED before production code, then GREEN after the minimum change. Then `complete` the node; its checks decide.
|
|
50
|
+
4. Refactor while green: the implementer performs the simplification pass below. Use `ce-simplify-code` only when its actual dispatch fits the same round's allocation; otherwise apply the criteria directly.
|
|
51
|
+
5. Review the final diff against the Story, failure paths and testing limits with one reviewer (`skill-integration.md`): compatible `superpowers:requesting-code-review` or direct review, and bounded `ce-code-review mode:agent` only when the user or host selects it. Record its findings with `complete --verdict … --notes …`. Do not apply fixes from a read-only review assignment.
|
|
52
|
+
6. Apply compatible `superpowers:verification-before-completion` through `complete` on `workflow-verify`: it executes the configured checks, or reuses passing receipts for unchanged code. On a failure, read the receipt and raw log it names. Do not run a second verification pass solely to satisfy both names, and never claim old results cover new edits.
|
|
53
|
+
7. Require `next: g4` before continuing to `understanding-gate.md`; passing tests alone are not completion.
|
|
43
54
|
|
|
44
55
|
## Simplification pass
|
|
45
56
|
|
|
@@ -47,7 +58,7 @@ For user-authorized optional Jira publication after G1, follow `jira.md`. Withou
|
|
|
47
58
|
- Limit scope to the current task's changed code and necessary related seams. Avoid unrelated refactoring, new abstractions or packages, and edits made just to fill a diff.
|
|
48
59
|
- Reduce duplication, unnecessary state, branches and complexity to improve understanding. Fewer lines or replacing `for` with a stream is not evidence of improvement; chaining operations does not necessarily reduce traversals. Check actual iteration and evaluation behavior before claiming efficiency.
|
|
49
60
|
- Preserve behavior, result order, side effects, domain boundaries, failure handling and safety checks. A proposal that changes them belongs to the existing design or scope-change process, not a silent simplification.
|
|
50
|
-
-
|
|
61
|
+
- The implementer simplifies inline by default. Any simplify workers consume the shared review allocation in `skill-integration.md`; select only skill modes that fit host limits.
|
|
51
62
|
- Include changes (or no-change outcome), review scope and fresh checks briefly in existing review/verification evidence. Add no separate approval gate, mandatory document or Jira Task.
|
|
52
63
|
|
|
53
64
|
|
|
@@ -57,9 +68,9 @@ Graph execution is installed and used automatically after G1. Small changes use
|
|
|
57
68
|
|
|
58
69
|
Planning is repository-grounded planning → review → deterministic validation. Research code, tests and risks as needed; do not require separate analyzer, advocate or mediator agents. Reuse an existing plan, whichever skill produced it. The host performs agent/tool work and the installed CLI owns readiness, evidence records and recovery; never create a second nested orchestration pipeline for the same task.
|
|
59
70
|
|
|
60
|
-
The execution graph does not replace human gates. G1 still approves scope before planning/implementation, G3 still protects high-risk choices, and G4 still requires prediction-before-reveal. Superpowers focused skills and CE stage skills provide node behavior as mapped in `skill-integration.md`; the graph owns dependency and retry structure rather than copying those skills.
|
|
71
|
+
The execution graph does not replace human gates. G1 still approves scope before planning/implementation, G3 still protects high-risk choices, and G4 still requires the human's own decision: explicit approval of the AI summary, or prediction-before-reveal restatement for G3 work. Superpowers focused skills and CE stage skills provide node behavior as mapped in `skill-integration.md`; the graph owns dependency and retry structure rather than copying those skills.
|
|
61
72
|
|
|
62
|
-
After each node, explicitly evaluate and record its evidence. Route failed checks to `fix`, changed assumptions to `replan`, and unresolved human decisions to `human`. For fixes within an unchanged plan, reset the earliest affected node and its descendants, preserving independent completed work. Changed plans/requirements require a new validated run; do not transplant stale evidence. Three attempts exhaust the run's retry allowance. Never silently create a new run to evade a stop. See `graph-
|
|
73
|
+
After each node, explicitly evaluate and record its evidence. Route failed checks to `fix`, changed assumptions to `replan`, and unresolved human decisions to `human`. For fixes within an unchanged plan, reset the earliest affected node and its descendants, preserving independent completed work. Changed plans/requirements require a new validated run; do not transplant stale evidence. Three attempts exhaust the run's retry allowance. Never silently create a new run to evade a stop. See `graph-minimal.md` for the executable protocol.
|
|
63
74
|
|
|
64
75
|
## Capture verified learning
|
|
65
76
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Fast path (for the model; terse)
|
|
2
|
+
|
|
3
|
+
MAIN = G1, G4, joins. Outside DIRECT, never read code, test logs or kit source in main. Never edit code or run formatters in main (an edit after `complete implement` reruns every check); a style nit is a note. Read only CLI JSON, subagent summaries, `git diff --stat`. CLI = `node .ai-workflow/bin/graph.mjs`; its JSON is compact, never tail it. Pipe other long output to `| tail -20`. Never sleep or poll; results arrive by themselves. Chain dependent CLI calls with `&&` in one Bash call. No subagents on this host: do steps 1, 3 and 4 in main, same order.
|
|
4
|
+
|
|
5
|
+
DIRECT: when the request names one behavior and its place and leaves nothing to decide (`graph.mjs copies` finds no copy with it; nothing to assume or ask) and the light-lane rules of the step 1 footer hold: no Story, gates or subagents. Main reads at most 8 files, edits, adds one focused test per stated behavior, runs those and existing tests of changed classes once, then reports: change, test, what was not run. Anything to decide: step 1.
|
|
6
|
+
|
|
7
|
+
1. STORY: one Agent `model: opus` gets the request and these rules. It explores first (at most 12 tool calls: code path, callers, tests, config, contracts), writes `docs/stories/<slug>.md` from `../assets/STORY.md`, and returns at most 10 lines (Goal, MUST titles, ASSUMED, OUT) plus a map of at most 15 lines (`file:line` refs, current behavior, test command):
|
|
8
|
+
- Goal: `1. As-is:` `2. To-be:` `3. Unchanged:`. To-be removes the pain the request names, manual or night-time work included; never put what that needs into OUT (make it MUST, or `OPEN BLOCKING`). Whoever drafts the Story first runs `graph.mjs copies <files or folders the change touches>` and follows its `rule` for parallel copies, never ASSUMED one copy into OUT; D1 is `Copies:` the list and the decision. Domain: numbered Terms, Invariant.
|
|
9
|
+
- Decisions above MUST: `ASSUMED` defaults come from the code: change where the request's text or area already is, branching on values that code already receives; a new signal or place says why. `OPEN BLOCKING` only for behavior a human must choose (money, migration, auth: never `ASSUMED`; see `domain-risks.md`).
|
|
10
|
+
- MUST/SHOULD/OUT: every request sentence maps to a MUST, or to OUT with why; title line, nested numbers; results that happen together: one line joined by `+`.
|
|
11
|
+
- Verify: `V# [M#]` success and failure.
|
|
12
|
+
- Footer after `---`: Status, Owner, `Lane: light` only if reversible + one module + no external contract + no persistent data + not high-risk; else `Lane: standard`.
|
|
13
|
+
- At most three blocking questions, two rounds; more, or an open idea: `intake.md`.
|
|
14
|
+
2. G1: show the Story path and its Decisions lines, then explain in the user's language in at most five lines: today, after, unchanged, how we check. Ask. END THE TURN. Only an explicit approval counts. Then, in one message, one Bash call: save the reply with a heredoc to `.ai-workflow/approvals/<slug>-g1-reply.md` `&& graph.mjs approve G1 <story> --response <reply> && graph.mjs go <story> .ai-workflow/runs/<slug>.json --scope <module or path>…` (light lane: `light` instead of `go`). Never edit Status or gate lines. The brief's `checks` are the exact commands; never open `verification.json`.
|
|
15
|
+
3. IMPLEMENT: one Agent, `model: sonnet`. Give it the Story MUST and Verify, the brief JSON, the run path and the map. Its rules: test-first; one focused test per Verify item, a second only for a distinct failure path; run a new test RED once only when it compiles against existing code; never the full suite; never write a test runner; never change build or test config to run a test; if tests cannot run, say so. It finishes with `graph.mjs complete <run> implement --tests <its test classes or files and the existing tests of classes it changed>` (light: `graph.mjs check <run> --tests …`): that is its GREEN run. On `status: failed` it fixes from `failing.tail` and runs `complete` again, at most twice; a failure only in an untouched test existed before: drop it from `--tests` and say so. It returns at most 15 lines: files, `V# → test` per Verify item, the last `complete` JSON.
|
|
16
|
+
4. REVIEW: one Agent `model: sonnet`, read-only (no builds or tests; at most 8 tool calls). Give it the Story path, the implementer's report and `<slug>`. It reads `git diff`, writes findings to `.ai-workflow/evidence/review-1.md` (at most 15 lines) and, on pass, four Korean lines to `.ai-workflow/approvals/<slug>-g4-summary.md`: `1. 사용자가 겪는 변화` `2. 지킨 규칙과 실패할 때 동작` `3. 확인한 테스트` `4. 확인하지 못한 것`. Verdict `fix` only when a MUST or Verify item is unmet or behavior is wrong; anything else is a note.
|
|
17
|
+
- Pass: one Bash call: `graph.mjs complete <run> workflow-review --verdict pass --notes .ai-workflow/evidence/review-1.md && graph.mjs complete <run> workflow-verify && cat <summary>`. Light: `graph.mjs review <run> --verdict pass --notes … && cat <summary>`.
|
|
18
|
+
- Fix: `--verdict fix` alone; the implementer fixes only the listed findings and runs `complete implement`; then the pass call without a new reviewer (one round); main writes the summary, and anything not fixed goes to line 4.
|
|
19
|
+
- Still failing after two attempts: implement again with `model: opus`.
|
|
20
|
+
5. VERIFY reuses passing receipts; expect `next: g4`. Light: no verify step.
|
|
21
|
+
6. G4: show the four lines as written. Ask. END THE TURN. Only an explicit approval counts; on a correction, fix the line and ask again. Then one Bash call: save the reply to `.ai-workflow/approvals/<slug>-g4-reply.md` `&& graph.mjs approve G4 <run> --summary <summary> --response <reply>`. Report its result.
|
|
22
|
+
|
|
23
|
+
Other cases: `next: human|replan` → ask the human. `stop` → report, no new run. High-risk (G3) or several dependent outcomes → `execution.md`. Roles → `role-graphs.md`.
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Graph: advanced use
|
|
2
|
+
|
|
3
|
+
The standard path is [fast-path.md](fast-path.md) and [graph-minimal.md](graph-minimal.md): `approve G1`, `go`, `complete` per node, `approve G4`. This page covers custom plans, roles, the lower-level start/verify/record protocol, routing details and the programmatic API.
|
|
4
|
+
|
|
5
|
+
Use the installed Graph CLI automatically after G1; no user opt-in, extra npm install, API key or custom JavaScript adapter is needed. The host (Codex/Claude) executes agent and tool work. The local CLI checks dependencies, persists results and tells the host what to do next. It does not launch models. Its verification runner executes only checks selected by ID from the repository-owned verification profile, using argv without a shell. Treat that profile as executable project code; host permissions still apply.
|
|
6
|
+
|
|
7
|
+
Read `skill-integration.md` when selecting Superpowers or CE for a graph node. Each selected skill implements only that stage; its own completion or shipping workflow cannot replace the kit's remaining gates.
|
|
8
|
+
|
|
9
|
+
## Roles and graph ownership
|
|
10
|
+
|
|
11
|
+
The kit supplies graph construction, deterministic validation, dependency scheduling, joins, evidence and failure routing in both standalone use and Agent Office. Office assigns people-like roles, launches agents, carries messages and displays progress; it uses kit readiness/results rather than implementing a competing graph state machine. Office does not disable the kit graph.
|
|
12
|
+
|
|
13
|
+
A role is not necessarily one node. A Developer may perform several implementation nodes; a Reviewer may inspect several independent areas. Function nodes perform deterministic checks without an agent. Split nodes only for a meaningful dependency, distinct evidence or recovery boundary.
|
|
14
|
+
|
|
15
|
+
For a delegated node, the dispatch must identify the kit run, node, started token, role, task description, approved Story constraints, allowed access and direct dependency outputs. The assigned agent applies the relevant procedure and returns summary, evidence and explicit evaluation to that same run. It must not initialize a new delivery graph, repeat G1/G4, spawn an unbounded team or implement changes inside a read-only review assignment. Missing scope or inputs must be reported to the dispatcher rather than invented. The kit graph is already active: executing its assigned node is graph use.
|
|
16
|
+
|
|
17
|
+
For a separate role objective, use the durable `init-role` entrypoint in [role-graphs.md](role-graphs.md). It supplies PM, team-lead, developer and reviewer flows without appending the whole delivery envelope. PM intake before G1 remains non-implementation work and cannot authorize production edits. The optional generic API is still available for custom graphs, with the different guarantees listed below.
|
|
18
|
+
|
|
19
|
+
Role-local execution and host enforcement are compatible. An agent performs its assigned kit flow; Office uses that flow's identity and results to dispatch work and accept its outcome. Office also applies host-owned permissions, cancellation and global budgets. It must not reimplement the role's workflow rules or treat a worker's "done" message as proof of graph completion. If a role uses a separate graph, link its run to the Office assignment and target revision; its completion is only that role's outcome, not completion of the whole delivery. This describes the integration contract, not an adapter already shipped by the kit.
|
|
20
|
+
|
|
21
|
+
Link messages to run/node/attempt and the requirement, question, decision, artifact or finding they concern. A review failure goes back through the kit's corrective route to the responsible implementation node. Only the overall delivery owner presents G4 after final evidence, using the actual user's response. Role completion is not project completion.
|
|
22
|
+
|
|
23
|
+
One controller owns each persisted kit run through the CLI. Its file is authoritative for local transitions; Office owns the shared goal, acceptance criteria, assignments, collaboration and integration. Office may index local progress but must not independently advance a copy. The CLI file store is not a finished Office adapter. Locking and write exclusion apply within that run, not across separate runs or processes editing the same repository. Office must isolate independent writers or serialize them and enforce any overall time/cost/cancellation limits. The kit's three-attempt bound does not implement an Office-wide budget or process cancellation.
|
|
24
|
+
|
|
25
|
+
## Initialize or resume
|
|
26
|
+
|
|
27
|
+
Read the approved Story, relevant code/tests and prior learnings. Complete required G3 before implementation. Reuse repository-grounded planning/review already performed by Compound skills; do not repeat it with a fixed team of analyzers, advocates and mediators.
|
|
28
|
+
|
|
29
|
+
Read [verification.md](verification.md) to configure real checks and bound G1/G3 records before initialization. New runs use v3. Legacy v1/v2 runs are read-only and return `upgrade-required`; stop old workers, inspect side effects, and create a new run with fresh review/checks without evading attempt limits.
|
|
30
|
+
|
|
31
|
+
Use a stable run path for the Story, such as `.ai-workflow/runs/<slug>.json`. If it exists, run `status`; never replace it to escape a failure. For a small/reversible change, use the built-in plan:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
node .ai-workflow/bin/graph.mjs init - .ai-workflow/runs/<slug>.json docs/<story>.md
|
|
35
|
+
node .ai-workflow/bin/graph.mjs status .ai-workflow/runs/<slug>.json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The minimal plan is `implement → workflow-review → workflow-verify`. Implementation includes test-first work, related GREEN tests and bounded simplification. Final review checks the diff; verification supplies fresh checks after any fixes. No separate plan document is needed for small work.
|
|
39
|
+
|
|
40
|
+
For independently meaningful outcomes, write a reviewed JSON plan (HOW only; Story M/V IDs remain canonical):
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"id": "coupon-change",
|
|
45
|
+
"nodes": [
|
|
46
|
+
{ "id": "model", "description": "Represent the approved coupon rules", "access": "write", "covers": ["M1"], "verify": "Exercise allowed and rejected model transitions" },
|
|
47
|
+
{ "id": "api", "description": "Expose the approved behavior", "access": "write", "covers": ["V1"], "verify": "Check the Story's API success and failure cases" }
|
|
48
|
+
],
|
|
49
|
+
"edges": [{ "from": "model", "to": "api" }]
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Every Story M/V ID must be covered and unknown IDs are rejected. `description`, `verify`, `covers` and `access` are required per task. Use the actual Story IDs, not these example IDs. Run `init <plan.json> <run.json> <story.md>`; it deterministically validates references/cycles and appends mandatory final review/verification. Never put human approval inside generated nodes.
|
|
54
|
+
|
|
55
|
+
## Execute ready work
|
|
56
|
+
|
|
57
|
+
1. Read the JSON status and its `action`. Apply [model-selection.md](model-selection.md) before dispatch using the cached host catalog. Give each worker only its task, Story constraints, relevant files and `input.dependencies`; do not send the whole run/history. Read evidence files by reference as needed.
|
|
58
|
+
2. Reserve each ready task before starting work:
|
|
59
|
+
|
|
60
|
+
`node .ai-workflow/bin/graph.mjs start <run.json> <node-id> <ready-token>`
|
|
61
|
+
|
|
62
|
+
Use the returned `started.token` for the result record. Start durably counts the attempt and marks it running, preventing duplicate dispatch and overlapping writers. Execute only reserved tasks. They include a token for that unique run, exact attempt and dependency state. One host controller owns the run. Read-only tasks may run concurrently within the host's limits; write tasks are exclusive. A read node must not edit code: fail it with `fix` and reset the earliest implementation node when changes are needed.
|
|
63
|
+
3. Save actual observations to a new, nonempty project-relative evidence file per attempt. Include changed files, commands, exit codes, review findings and verification limits as applicable. Do not overwrite evidence from completed independent work. Long logs remain files, not copied model context.
|
|
64
|
+
4. Write a result JSON with the started task's token:
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"token": "copy started.token from start",
|
|
69
|
+
"output": { "summary": "Describe the observable result", "evidence": ["docs/understanding/coupon-model-attempt-1.md"] },
|
|
70
|
+
"evaluation": { "passed": true }
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
node .ai-workflow/bin/graph.mjs record <run.json> <node-id> <result.json>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
A failed result uses `"evaluation": { "passed": false, "action": "fix", "feedback": "Specific failed expectation and affected task" }`. Evaluation is mandatory. An omitted value, empty evidence, premature node or stale token cannot complete a task. Implementation/review observations remain host judgments. Final verification and Developer self-check additionally require runner-issued successful receipts covering every assigned V ID. Execute `node .ai-workflow/bin/graph.mjs verify <run.json> <node-id> <started-token> <check-id>` for each required check, inspect the returned exit status and raw logs, then record. `passed: true` cannot override a failed/missing execution. Runner CLI exit 0 means the execution was collected; inspect `verification.passed`, not just CLI exit status. CLI exit 0 means the record was accepted, including a failure record: inspect `action` and `failed`.
|
|
79
|
+
|
|
80
|
+
## Route the next action
|
|
81
|
+
|
|
82
|
+
| Action | Host behavior |
|
|
83
|
+
|---|---|
|
|
84
|
+
| `execute` | Perform ready tasks and record their results. Fetch fresh status after each completion. |
|
|
85
|
+
| `wait` | Wait for running workers; do not dispatch them again. After an interrupted session, inspect their side effects and explicitly reset stopped workers. |
|
|
86
|
+
| `fix` | Identify the earliest affected task; reset it before doing corrective work, then rerun it and invalidated descendants. Independent results stay recorded. |
|
|
87
|
+
| `replan` | Correct the plan; validate it into a new run and retain the old run as evidence. Scope changes use the existing human gate. |
|
|
88
|
+
| `human` | Surface the unresolved decision and wait. After resolution, use a new run reflecting it. |
|
|
89
|
+
| `stop` | Report exhausted attempts and evidence. Do not restart under a new filename without an explicit decision to continue. |
|
|
90
|
+
| `question` | Transport the pending question; submit the matching answer and continue with `resumed.token`. See `role-graphs.md`. An answer is not approval. |
|
|
91
|
+
| `role-complete` | Return the role's native outcome and evidence to the caller. This does not finish delivery. |
|
|
92
|
+
| `stale` | Code changed after review/check start. Inspect changes and reset the earliest affected node; rerun invalidated descendants. Status never rewrites saved state. |
|
|
93
|
+
| `upgrade-required` | Legacy run is inspectable only; follow the migration note above. |
|
|
94
|
+
| `g4` | Follow `understanding-gate.md`; this is readiness, not approval or delivery. |
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
node .ai-workflow/bin/graph.mjs reset <run.json> <earliest-affected-node> "What will be corrected and why"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Reset the implementation node when a review requires code edits; resetting only the reviewer would retain invalid implementation evidence. Stop any affected running workers before reset; reset invalidates their old tokens. Reset preserves attempt counts; three attempts is the per-node limit. No automatic repeated side effects or unrestricted retry loop. Changing graph content or Story requirements invalidates the run; progress/gate metadata may change without invalidating requirements. New plans conservatively start fresh instead of guessing which old outputs remain valid.
|
|
101
|
+
|
|
102
|
+
Writes use an exclusive `.lock` and atomic file replacement. After a crashed CLI process, inspect the lock's owner and the run before manually removing a stale lock. Never delete a live writer's lock. Avoid simultaneous install/remove and execution. Updates/removal preserve run and evidence files; keep those separate from the managed `.ai-workflow/graph/` runtime.
|
|
103
|
+
|
|
104
|
+
## Programmatic API (optional)
|
|
105
|
+
|
|
106
|
+
After init, import from `./.ai-workflow/graph/index.mjs`. Consumers who install the npm package as a dependency can also import `@pazmo/ai-workflow-kit/src/graph/index.mjs`.
|
|
107
|
+
|
|
108
|
+
`executeTaskGraph({ graph, runNode, evaluateNode, context, runState, maxConcurrency })` requires explicit evaluation results. Default concurrency is 1; a higher positive integer allows overlapping nodes marked `access: 'read'`. Writers and undeclared-access nodes run exclusively. A newly ready node starts as soon as a slot becomes available; joins wait only for their dependencies. `waves` records dispatch batches, not global barriers.
|
|
109
|
+
|
|
110
|
+
Node input is `{ context, dependencies }`, copied to avoid shared mutation. Persisted states carry a graph fingerprint; changed plans and unknown/unevaluated statuses are rejected. Interrupted `running` nodes require an explicit `resetAffectedSubgraph` after checking external side effects. This in-process API does not persist checkpoints or approve gates; use the installed CLI for the durable host workflow.
|
|
111
|
+
|
|
112
|
+
The generic API is not the delivery CLI's policy API. Choose the interface by its actual guarantees:
|
|
113
|
+
|
|
114
|
+
| Responsibility | Generic API | Delivery CLI | Host |
|
|
115
|
+
|---|---|---|---|
|
|
116
|
+
| Dependency readiness, read concurrency, exclusive writers | Within one execution | Within one run | Isolate or serialize work across runs |
|
|
117
|
+
| Attempts | Counts starts; no built-in cap | Maximum three starts per node | Enforce global time, cost and attempt budgets |
|
|
118
|
+
| `human` / `replan` evaluation | Records the action; independent work can continue | Routes to the decision; no further start until resolved in a new run | Stop affected processes and obtain the decision |
|
|
119
|
+
| Evidence and persistence | Returns state and explicit evaluation; no evidence-file checks or checkpoint store | Binds actual snapshots, runner receipts and evidence hashes; persists run changes | Judge assertion adequacy and external/environment boundaries |
|
|
120
|
+
| User approval and tool permissions | Not provided | Checks approval records, not identity; does not intercept tools | Own actual approval events and execution permissions |
|
|
121
|
+
|
|
122
|
+
Do not assume `executeTaskGraph` or `resetAffectedSubgraph` enforces the delivery CLI's retry or human-decision rules. Office integration must first identify its actual dispatch, storage, cancellation and result-application boundary. If it needs shared delivery transitions, extract only the necessary rules from the CLI when connecting that consumer; do not duplicate the rules in Office or invent an unused public API in advance.
|
|
123
|
+
|
|
124
|
+
`access: 'read'` describes product-code access, not a filesystem sandbox. Review evidence and test-generated files may still require designated output paths. Host enforcement must distinguish these from product edits. Multiple developer processes alone do not provide safe parallel implementation: the host must manage workspace isolation, integration and verification of the combined result.
|
|
125
|
+
|
|
126
|
+
`createPlanningGraph()` supplies `planner → review → validate-graph`. Planner/review callbacks return task graphs; the last node executes built-in deterministic validation rather than an LLM callback. Research and extra review roles are chosen for the work, not required by the graph.
|
|
@@ -1,124 +1,3 @@
|
|
|
1
1
|
# Graph execution
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Read `skill-integration.md` when selecting Superpowers or CE for a graph node. Each selected skill implements only that stage; its own completion or shipping workflow cannot replace the kit's remaining gates.
|
|
6
|
-
|
|
7
|
-
## Roles and graph ownership
|
|
8
|
-
|
|
9
|
-
The kit supplies graph construction, deterministic validation, dependency scheduling, joins, evidence and failure routing in both standalone use and Agent Office. Office assigns people-like roles, launches agents, carries messages and displays progress; it uses kit readiness/results rather than implementing a competing graph state machine. Office does not disable the kit graph.
|
|
10
|
-
|
|
11
|
-
A role is not necessarily one node. A Developer may perform several implementation nodes; a Reviewer may inspect several independent areas. Function nodes perform deterministic checks without an agent. Split nodes only for a meaningful dependency, distinct evidence or recovery boundary.
|
|
12
|
-
|
|
13
|
-
For a delegated node, the dispatch must identify the kit run, node, started token, role, task description, approved Story constraints, allowed access and direct dependency outputs. The assigned agent applies the relevant procedure and returns summary, evidence and explicit evaluation to that same run. It must not initialize a new delivery graph, repeat G1/G4, spawn an unbounded team or implement changes inside a read-only review assignment. Missing scope or inputs must be reported to the dispatcher rather than invented. The kit graph is already active: executing its assigned node is graph use.
|
|
14
|
-
|
|
15
|
-
For a separate role objective, use the durable `init-role` entrypoint in [role-graphs.md](role-graphs.md). It supplies PM, team-lead, developer and reviewer flows without appending the whole delivery envelope. PM intake before G1 remains non-implementation work and cannot authorize production edits. The optional generic API is still available for custom graphs, with the different guarantees listed below.
|
|
16
|
-
|
|
17
|
-
Role-local execution and host enforcement are compatible. An agent performs its assigned kit flow; Office uses that flow's identity and results to dispatch work and accept its outcome. Office also applies host-owned permissions, cancellation and global budgets. It must not reimplement the role's workflow rules or treat a worker's "done" message as proof of graph completion. If a role uses a separate graph, link its run to the Office assignment and target revision; its completion is only that role's outcome, not completion of the whole delivery. This describes the integration contract, not an adapter already shipped by the kit.
|
|
18
|
-
|
|
19
|
-
Link messages to run/node/attempt and the requirement, question, decision, artifact or finding they concern. A review failure goes back through the kit's corrective route to the responsible implementation node. Only the overall delivery owner presents G4 after final evidence, using the actual user's response. Role completion is not project completion.
|
|
20
|
-
|
|
21
|
-
One controller owns each persisted kit run through the CLI. Its file is authoritative for local transitions; Office owns the shared goal, acceptance criteria, assignments, collaboration and integration. Office may index local progress but must not independently advance a copy. The CLI file store is not a finished Office adapter. Locking and write exclusion apply within that run, not across separate runs or processes editing the same repository. Office must isolate independent writers or serialize them and enforce any overall time/cost/cancellation limits. The kit's three-attempt bound does not implement an Office-wide budget or process cancellation.
|
|
22
|
-
|
|
23
|
-
## Initialize or resume
|
|
24
|
-
|
|
25
|
-
Read the approved Story, relevant code/tests and prior learnings. Complete required G3 before implementation. Reuse repository-grounded planning/review already performed by Compound skills; do not repeat it with a fixed team of analyzers, advocates and mediators.
|
|
26
|
-
|
|
27
|
-
Read [verification.md](verification.md) to configure real checks and bound G1/G3 records before initialization. New runs use v3. Legacy v1/v2 runs are read-only and return `upgrade-required`; stop old workers, inspect side effects, and create a new run with fresh review/checks without evading attempt limits.
|
|
28
|
-
|
|
29
|
-
Use a stable run path for the Story, such as `.ai-workflow/runs/<slug>.json`. If it exists, run `status`; never replace it to escape a failure. For a small/reversible change, use the built-in plan:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
node .ai-workflow/bin/graph.mjs init - .ai-workflow/runs/<slug>.json docs/<story>.md
|
|
33
|
-
node .ai-workflow/bin/graph.mjs status .ai-workflow/runs/<slug>.json
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
The minimal plan is `implement → workflow-review → workflow-verify`. Implementation includes test-first work, related GREEN tests and bounded simplification. Final review checks the diff; verification supplies fresh checks after any fixes. No separate plan document is needed for small work.
|
|
37
|
-
|
|
38
|
-
For independently meaningful outcomes, write a reviewed JSON plan (HOW only; Story M/V IDs remain canonical):
|
|
39
|
-
|
|
40
|
-
```json
|
|
41
|
-
{
|
|
42
|
-
"id": "coupon-change",
|
|
43
|
-
"nodes": [
|
|
44
|
-
{ "id": "model", "description": "Represent the approved coupon rules", "access": "write", "covers": ["M1"], "verify": "Exercise allowed and rejected model transitions" },
|
|
45
|
-
{ "id": "api", "description": "Expose the approved behavior", "access": "write", "covers": ["V1"], "verify": "Check the Story's API success and failure cases" }
|
|
46
|
-
],
|
|
47
|
-
"edges": [{ "from": "model", "to": "api" }]
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Every Story M/V ID must be covered and unknown IDs are rejected. `description`, `verify`, `covers` and `access` are required per task. Use the actual Story IDs, not these example IDs. Run `init <plan.json> <run.json> <story.md>`; it deterministically validates references/cycles and appends mandatory final review/verification. Never put human approval inside generated nodes.
|
|
52
|
-
|
|
53
|
-
## Execute ready work
|
|
54
|
-
|
|
55
|
-
1. Read the JSON status and its `action`. Apply [model-selection.md](model-selection.md) before dispatch using the cached host catalog. Give each worker only its task, Story constraints, relevant files and `input.dependencies`; do not send the whole run/history. Read evidence files by reference as needed.
|
|
56
|
-
2. Reserve each ready task before starting work:
|
|
57
|
-
|
|
58
|
-
`node .ai-workflow/bin/graph.mjs start <run.json> <node-id> <ready-token>`
|
|
59
|
-
|
|
60
|
-
Use the returned `started.token` for the result record. Start durably counts the attempt and marks it running, preventing duplicate dispatch and overlapping writers. Execute only reserved tasks. They include a token for that unique run, exact attempt and dependency state. One host controller owns the run. Read-only tasks may run concurrently within the host's limits; write tasks are exclusive. A read node must not edit code: fail it with `fix` and reset the earliest implementation node when changes are needed.
|
|
61
|
-
3. Save actual observations to a new, nonempty project-relative evidence file per attempt. Include changed files, commands, exit codes, review findings and verification limits as applicable. Do not overwrite evidence from completed independent work. Long logs remain files, not copied model context.
|
|
62
|
-
4. Write a result JSON with the started task's token:
|
|
63
|
-
|
|
64
|
-
```json
|
|
65
|
-
{
|
|
66
|
-
"token": "copy started.token from start",
|
|
67
|
-
"output": { "summary": "Describe the observable result", "evidence": ["docs/understanding/coupon-model-attempt-1.md"] },
|
|
68
|
-
"evaluation": { "passed": true }
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
node .ai-workflow/bin/graph.mjs record <run.json> <node-id> <result.json>
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
A failed result uses `"evaluation": { "passed": false, "action": "fix", "feedback": "Specific failed expectation and affected task" }`. Evaluation is mandatory. An omitted value, empty evidence, premature node or stale token cannot complete a task. Implementation/review observations remain host judgments. Final verification and Developer self-check additionally require runner-issued successful receipts covering every assigned V ID. Execute `node .ai-workflow/bin/graph.mjs verify <run.json> <node-id> <started-token> <check-id>` for each required check, inspect the returned exit status and raw logs, then record. `passed: true` cannot override a failed/missing execution. Runner CLI exit 0 means the execution was collected; inspect `verification.passed`, not just CLI exit status. CLI exit 0 means the record was accepted, including a failure record: inspect `action` and `failed`.
|
|
77
|
-
|
|
78
|
-
## Route the next action
|
|
79
|
-
|
|
80
|
-
| Action | Host behavior |
|
|
81
|
-
|---|---|
|
|
82
|
-
| `execute` | Perform ready tasks and record their results. Fetch fresh status after each completion. |
|
|
83
|
-
| `wait` | Wait for running workers; do not dispatch them again. After an interrupted session, inspect their side effects and explicitly reset stopped workers. |
|
|
84
|
-
| `fix` | Identify the earliest affected task; reset it before doing corrective work, then rerun it and invalidated descendants. Independent results stay recorded. |
|
|
85
|
-
| `replan` | Correct the plan; validate it into a new run and retain the old run as evidence. Scope changes use the existing human gate. |
|
|
86
|
-
| `human` | Surface the unresolved decision and wait. After resolution, use a new run reflecting it. |
|
|
87
|
-
| `stop` | Report exhausted attempts and evidence. Do not restart under a new filename without an explicit decision to continue. |
|
|
88
|
-
| `question` | Transport the pending question; submit the matching answer and continue with `resumed.token`. See `role-graphs.md`. An answer is not approval. |
|
|
89
|
-
| `role-complete` | Return the role's native outcome and evidence to the caller. This does not finish delivery. |
|
|
90
|
-
| `stale` | Code changed after review/check start. Inspect changes and reset the earliest affected node; rerun invalidated descendants. Status never rewrites saved state. |
|
|
91
|
-
| `upgrade-required` | Legacy run is inspectable only; follow the migration note above. |
|
|
92
|
-
| `g4` | Follow `understanding-gate.md`; this is readiness, not approval or delivery. |
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
node .ai-workflow/bin/graph.mjs reset <run.json> <earliest-affected-node> "What will be corrected and why"
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
Reset the implementation node when a review requires code edits; resetting only the reviewer would retain invalid implementation evidence. Stop any affected running workers before reset; reset invalidates their old tokens. Reset preserves attempt counts; three attempts is the per-node limit. No automatic repeated side effects or unrestricted retry loop. Changing graph content or Story requirements invalidates the run; progress/gate metadata may change without invalidating requirements. New plans conservatively start fresh instead of guessing which old outputs remain valid.
|
|
99
|
-
|
|
100
|
-
Writes use an exclusive `.lock` and atomic file replacement. After a crashed CLI process, inspect the lock's owner and the run before manually removing a stale lock. Never delete a live writer's lock. Avoid simultaneous install/remove and execution. Updates/removal preserve run and evidence files; keep those separate from the managed `.ai-workflow/graph/` runtime.
|
|
101
|
-
|
|
102
|
-
## Programmatic API (optional)
|
|
103
|
-
|
|
104
|
-
After init, import from `./.ai-workflow/graph/index.mjs`. Consumers who install the npm package as a dependency can also import `@pazmo/ai-workflow-kit/src/graph/index.mjs`.
|
|
105
|
-
|
|
106
|
-
`executeTaskGraph({ graph, runNode, evaluateNode, context, runState, maxConcurrency })` requires explicit evaluation results. Default concurrency is 1; a higher positive integer allows overlapping nodes marked `access: 'read'`. Writers and undeclared-access nodes run exclusively. A newly ready node starts as soon as a slot becomes available; joins wait only for their dependencies. `waves` records dispatch batches, not global barriers.
|
|
107
|
-
|
|
108
|
-
Node input is `{ context, dependencies }`, copied to avoid shared mutation. Persisted states carry a graph fingerprint; changed plans and unknown/unevaluated statuses are rejected. Interrupted `running` nodes require an explicit `resetAffectedSubgraph` after checking external side effects. This in-process API does not persist checkpoints or approve gates; use the installed CLI for the durable host workflow.
|
|
109
|
-
|
|
110
|
-
The generic API is not the delivery CLI's policy API. Choose the interface by its actual guarantees:
|
|
111
|
-
|
|
112
|
-
| Responsibility | Generic API | Delivery CLI | Host |
|
|
113
|
-
|---|---|---|---|
|
|
114
|
-
| Dependency readiness, read concurrency, exclusive writers | Within one execution | Within one run | Isolate or serialize work across runs |
|
|
115
|
-
| Attempts | Counts starts; no built-in cap | Maximum three starts per node | Enforce global time, cost and attempt budgets |
|
|
116
|
-
| `human` / `replan` evaluation | Records the action; independent work can continue | Routes to the decision; no further start until resolved in a new run | Stop affected processes and obtain the decision |
|
|
117
|
-
| Evidence and persistence | Returns state and explicit evaluation; no evidence-file checks or checkpoint store | Binds actual snapshots, runner receipts and evidence hashes; persists run changes | Judge assertion adequacy and external/environment boundaries |
|
|
118
|
-
| User approval and tool permissions | Not provided | Checks approval records, not identity; does not intercept tools | Own actual approval events and execution permissions |
|
|
119
|
-
|
|
120
|
-
Do not assume `executeTaskGraph` or `resetAffectedSubgraph` enforces the delivery CLI's retry or human-decision rules. Office integration must first identify its actual dispatch, storage, cancellation and result-application boundary. If it needs shared delivery transitions, extract only the necessary rules from the CLI when connecting that consumer; do not duplicate the rules in Office or invent an unused public API in advance.
|
|
121
|
-
|
|
122
|
-
`access: 'read'` describes product-code access, not a filesystem sandbox. Review evidence and test-generated files may still require designated output paths. Host enforcement must distinguish these from product edits. Multiple developer processes alone do not provide safe parallel implementation: the host must manage workspace isolation, integration and verification of the combined result.
|
|
123
|
-
|
|
124
|
-
`createPlanningGraph()` supplies `planner → review → validate-graph`. Planner/review callbacks return task graphs; the last node executes built-in deterministic validation rather than an LLM callback. Research and extra review roles are chosen for the work, not required by the graph.
|
|
3
|
+
Standard lane: [graph-minimal.md](graph-minimal.md). Custom plans, roles, the start/verify/record protocol and the API: [graph-advanced.md](graph-advanced.md).
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Graph: the minimal plan
|
|
2
|
+
|
|
3
|
+
The standard lane after G1. Run commands from the project root; each prints compact JSON. Read [graph-advanced.md](graph-advanced.md) only for a custom plan, a role assignment, a question or a failure this page does not cover.
|
|
4
|
+
|
|
5
|
+
## Set up once
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
node .ai-workflow/bin/graph.mjs go docs/<story>.md .ai-workflow/runs/<slug>.json --scope <module-or-path>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
- `go` runs `profile` (if no profile exists), `init` and `begin` for the first node, and returns its brief. Run again, it returns to the node in progress. `fast-path.md` is the step-by-step version of this page.
|
|
12
|
+
- `profile` writes `.ai-workflow/verification.json` from `package.json`, `tsconfig.json` or `gradlew` and never overwrites one. Its `{scope}` and `{gradle-test}` placeholders resolve per run from `go --scope`, so checks stay on the touched module or path. Edit it only when detection is wrong ([verification.md](verification.md)).
|
|
13
|
+
- Do not run the test suite yourself first. `baseline` is optional: use it when the repository is known to have failing tests, then narrow the failing check and `init` a new run file.
|
|
14
|
+
- If the run file exists, run `status` and continue; never replace a run to escape a failure.
|
|
15
|
+
|
|
16
|
+
## Three nodes, two calls each
|
|
17
|
+
|
|
18
|
+
The plan is `implement → workflow-review → workflow-verify`.
|
|
19
|
+
|
|
20
|
+
1. `begin` implement returns a brief: covered M/V IDs, the advisory area, the checks and earlier feedback. Dispatch the implementer with it; it ends with `complete` implement, which runs the checks and records the result.
|
|
21
|
+
2. `begin` workflow-review. Dispatch one reviewer with the Story's MUST/Verify and the diff. Write its findings under `.ai-workflow/evidence/` (a file elsewhere counts as a code change and makes the review stale), then `complete` with `--verdict pass|fix --notes <file>`.
|
|
22
|
+
3. `begin` workflow-verify, then `complete`. Passing receipts for unchanged code are reused, not rerun.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
node .ai-workflow/bin/graph.mjs begin <run.json> implement
|
|
26
|
+
node .ai-workflow/bin/graph.mjs complete <run.json> implement
|
|
27
|
+
node .ai-workflow/bin/graph.mjs complete <run.json> workflow-review --verdict fix --notes .ai-workflow/evidence/review-1.md
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Who does what
|
|
31
|
+
|
|
32
|
+
- **Implementer:** a subagent on the host's mid tier (Claude Code: the Agent tool with `model: "sonnet"` under Opus). Brief: the Story's MUST and Verify, the `begin` brief and the intake map. Test-first, one focused test per Verify item, a second only for a distinct failure path. It simplifies while green, runs `complete implement --tests …` itself as its GREEN run (fixing and rerunning on a failure, at most twice) and returns a short summary of changed files, test results and the last `complete` result. Do not re-read its code: read the summary, `git diff --stat` and the `complete` result.
|
|
33
|
+
- **Reviewer:** one mid-tier subagent, read-only. Story and diff in, findings out; on pass it also drafts the four G4 lines, which main shows unchanged. A Story with G3 gets two reviewers on a strong tier.
|
|
34
|
+
- **Escalation:** after two failed attempts on the same node, the next attempt runs on a stronger tier (`model: "opus"`).
|
|
35
|
+
- Hosts without subagents do the same steps in the main session.
|
|
36
|
+
|
|
37
|
+
## Follow `next`
|
|
38
|
+
|
|
39
|
+
| `next` | Do |
|
|
40
|
+
|---|---|
|
|
41
|
+
| a node id | `begin` it. After a fix, its brief carries the feedback. |
|
|
42
|
+
| `g4` | Follow `understanding-gate.md`, then `delivery`. |
|
|
43
|
+
| `human` / `replan` | Surface the decision and wait; a new run follows it. |
|
|
44
|
+
| `stop` | Three attempts used; report the evidence. |
|
|
45
|
+
|
|
46
|
+
A failing check or a review `fix` has already reset the implementation node. If `begin` reports stale work, reset the named node with `graph.mjs reset <run> <node> "<reason>"`.
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
node .ai-workflow/bin/graph.mjs delivery <run.json>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
`delivery` needs fresh Graph evidence and G4 bound to the final snapshot. Graph evidence never approves G3 or G4.
|
|
@@ -6,11 +6,17 @@ For a PM assignment, perform only intake and return the Story proposal or questi
|
|
|
6
6
|
|
|
7
7
|
Derive before asking: actor, desired outcome, terms/entities, state change, invariant/forbidden outcome, failure, external side effect, and observable evidence.
|
|
8
8
|
|
|
9
|
+
## Explore with a subagent
|
|
10
|
+
|
|
11
|
+
Before asking or drafting, explore. With subagents, the Story subagent (`fast-path.md` step 1, a strong tier) explores first, at most 12 tool calls, then drafts the Story and returns a map of at most 15 lines: files involved, current behavior, constraints (tests, contracts, callers) and the test command. Whoever drafts the Story (the Story subagent or the main session) first runs `node .ai-workflow/bin/graph.mjs copies <files or folders the change touches>` and follows the rule it prints: parallel copies that have the behavior are in To-be unless the request names one with a word the code uses for it (cite `file:line`), else `OPEN BLOCKING`; never ASSUMED one copy and the rest into OUT. `D1. Copies:` gives the list and the decision. One explorer saves a serial step: exploration and drafting happen in one context. Hosts without subagents read the code in the main session. Pass the map on to the implementer.
|
|
12
|
+
|
|
9
13
|
## Question policy
|
|
10
14
|
|
|
11
15
|
- Ask **only blocking** unknowns that change behavior, ownership, or failure semantics.
|
|
12
16
|
- Ask one decision per turn by default; **at most three** independent, closely related questions.
|
|
13
17
|
- Stop after **two question rounds**. Draft with safe defaults labeled `ASSUMED`; keep unsafe gaps as `OPEN BLOCKING`.
|
|
18
|
+
- Every sentence of the request maps to a MUST, or to OUT with the reason. A request that asks for two things (add a line here, branch the text there) gets both; never pick one.
|
|
19
|
+
- `ASSUMED` defaults come from the code, not from new design. Change the place where the request's text or area already is, and branch on values the touched code already receives. A new signal, a new screen area or a new dependency needs a reason in the Decision line.
|
|
14
20
|
- Apply the matching lenses in `domain-risks.md` before drafting. In a Payment/money or Data or system migration Story, a lens item that changes behavior and that neither the requirement nor a human settled is `OPEN BLOCKING`, never `ASSUMED`; reasonable people could pick either side.
|
|
15
21
|
- Never ask implementation or **HOW** questions before the contract is clear. Database, queue, lock, and file choices belong to planning.
|
|
16
22
|
- Offer a concrete default rather than an open questionnaire when a conventional safe choice exists.
|
|
@@ -28,19 +34,29 @@ Cover these points in a few connected sentences:
|
|
|
28
34
|
|
|
29
35
|
Explain observable behavior here, not implementation choices. Label a suspected cause as a hypothesis. Use an analogy only when it clarifies the real behavior, and connect it back to that behavior. For a simple change, one or two sentences are enough. Do not force a diagram, quiz, separate explainer artifact, or another approval round.
|
|
30
36
|
|
|
31
|
-
|
|
37
|
+
In the Story, this explanation becomes the Goal's three lines (As-is, To-be, Unchanged); the formal criteria and technical evidence follow in the later sections. It is part of the same contract, not a second requirements source. The reader should be able to judge the desired outcome before seeing field names, gate IDs or commands.
|
|
32
38
|
|
|
33
39
|
## Output recipe
|
|
34
40
|
|
|
35
41
|
Create one Story from `../assets/STORY.md`:
|
|
36
42
|
|
|
37
|
-
1. Goal:
|
|
38
|
-
2. Domain:
|
|
39
|
-
3.
|
|
40
|
-
4.
|
|
41
|
-
5.
|
|
42
|
-
6.
|
|
43
|
+
1. Goal: exactly three numbered lines — `1. As-is:` (what happens today and why it hurts), `2. To-be:` (what happens after), `3. Unchanged:` (what must stay as it is).
|
|
44
|
+
2. Domain: `Terms:` and `Invariant:` as numbered lists, one item per line, never comma-joined. Code identifiers are fine.
|
|
45
|
+
3. Decisions: human choices, `ASSUMED`, and material open items. They sit above MUST so the reader judges them first.
|
|
46
|
+
4. MUST: numbered positive and negative behavior.
|
|
47
|
+
5. SHOULD: useful but non-blocking behavior.
|
|
48
|
+
6. OUT: explicit exclusions that prevent scope expansion.
|
|
43
49
|
7. Verify: V# cases mapped to M#; include success and failure.
|
|
50
|
+
8. Record footer: after Verify, a `---` line, then `Status:`, `Owner:`, `Lane:` and the gate lines. Write `Lane: light` only when all five rules in `light-lane.md` hold; otherwise `Lane: standard`.
|
|
51
|
+
|
|
52
|
+
Item shape for D, M, S and O:
|
|
53
|
+
|
|
54
|
+
- The item line is a short title: the condition, case or area.
|
|
55
|
+
- Details go in nested numbers under it.
|
|
56
|
+
- Results that happen together share one line, joined with `+`.
|
|
57
|
+
- A new nested number means a different action or a different result.
|
|
58
|
+
- A purpose, explanation or evidence goes in parentheses on the title line or on the same line. It is not its own number.
|
|
59
|
+
- An item that its title says completely has no nested numbers.
|
|
44
60
|
|
|
45
61
|
Keep it one-screen by default. Do not copy it into an “AI spec.”
|
|
46
62
|
|
|
@@ -76,7 +92,7 @@ Show the full concise draft, beginning with the plain-language explanation above
|
|
|
76
92
|
|
|
77
93
|
`Understanding gate (G1): <artifact> · <date> · Check-in: accepted`
|
|
78
94
|
|
|
79
|
-
|
|
95
|
+
`node .ai-workflow/bin/graph.mjs approve G1 <story-file> --response <reply-file>` writes the approval JSON, the gate line and `Status: Approved`, then runs both checks. By hand: verify instead of assuming. Write `Status: Approved` and the G1 record first, then run
|
|
80
96
|
both checks and report both exit codes:
|
|
81
97
|
|
|
82
98
|
```
|
|
@@ -93,4 +109,4 @@ unless both exit 0, and never claim the gate passed without that output.
|
|
|
93
109
|
|
|
94
110
|
No approval means no implementation.
|
|
95
111
|
|
|
96
|
-
For new v3 Graph runs, the G1 artifact must be JSON with `gate: "G1"`, canonical `storyHash`, and `responseRef` to the actual user decision. Store it under `.ai-workflow/approvals/`; `verification.md` gives the binding format. Document shape checks alone do not prove approval binding or delivery.
|
|
112
|
+
For new v3 Graph runs, the G1 artifact must be JSON with `gate: "G1"`, canonical `storyHash`, and `responseRef` to the actual user decision. A `Lane: light` Story's G1 JSON also has `lane: "light"`. Store it under `.ai-workflow/approvals/`; `verification.md` gives the binding format. Document shape checks alone do not prove approval binding or delivery.
|