@gtrabanco/pi-agentic-workflow 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.es.md +2 -0
  2. package/README.md +2 -0
  3. package/package.json +1 -1
  4. package/skills/audit-pr/SKILL.md +4 -1
  5. package/skills/audit-pr/references/02_CLOSURE_AND_SCOPE_GATES.md +35 -0
  6. package/skills/design-feature/SKILL.md +58 -21
  7. package/skills/design-feature/references/INTERVIEW.md +17 -0
  8. package/skills/design-feature/references/REPAIR.md +81 -0
  9. package/skills/design-feature/references/WRITE_AND_UPSERT.md +25 -2
  10. package/skills/discover-repository-state/SKILL.md +2 -1
  11. package/skills/evidence-grounding/SKILL.md +169 -0
  12. package/skills/evidence-grounding/references/DELEGATION.md +131 -0
  13. package/skills/evidence-grounding/references/READINESS.md +130 -0
  14. package/skills/evidence-grounding/references/ROWS.md +93 -0
  15. package/skills/execute-phase/SKILL.md +6 -1
  16. package/skills/execute-phase/references/DESCOPE.md +11 -5
  17. package/skills/execute-phase/references/PREFLIGHT.md +38 -1
  18. package/skills/execute-phase/references/PRE_EXECUTION_GATE.md +78 -0
  19. package/skills/log-session/SKILL.md +7 -1
  20. package/skills/loop-review-fold/SKILL.md +34 -2
  21. package/skills/orchestration-envelope/references/TURN_CONTRACT.md +34 -0
  22. package/skills/plan-feature/SKILL.md +37 -10
  23. package/skills/plan-feature/references/ROUTING.md +61 -2
  24. package/skills/plan-feature-from-issue/SKILL.md +30 -8
  25. package/skills/plan-feature-scaffold/SKILL.md +1 -1
  26. package/skills/plan-feature-scaffold/references/SCAFFOLD_PROCESS.md +35 -2
  27. package/skills/plan-fix/SKILL.md +31 -8
  28. package/skills/plan-fix/references/PLANNING_PROCESS.md +15 -0
  29. package/skills/pre-execution-review/SKILL.md +73 -0
  30. package/skills/pre-execution-review/references/LEDGERS.md +174 -0
  31. package/skills/pre-execution-review/references/POLICY.md +182 -0
  32. package/skills/pre-execution-review/references/SNAPSHOT.md +112 -0
  33. package/skills/resolve-repository-state/SKILL.md +2 -1
  34. package/skills/review-a11y/SKILL.md +10 -1
  35. package/skills/review-brand/SKILL.md +10 -1
  36. package/skills/review-change/SKILL.md +1 -1
  37. package/skills/review-change/references/OUTPUT_AND_GUARDRAILS.md +3 -1
  38. package/skills/review-change/references/PERSIST_AND_DECIDE.md +24 -6
  39. package/skills/review-change/references/REVIEW_PROCESS.md +32 -8
  40. package/skills/review-code/SKILL.md +10 -1
  41. package/skills/review-design/SKILL.md +10 -1
  42. package/skills/review-implementation/SKILL.md +1 -1
  43. package/skills/review-implementation/references/CLASSIFY.md +32 -0
  44. package/skills/review-perf/SKILL.md +10 -1
  45. package/skills/review-plan/SKILL.md +152 -0
  46. package/skills/review-plan/references/CHECKS.md +108 -0
  47. package/skills/review-plan/references/ENG-CHECKS.md +30 -0
  48. package/skills/review-plan/references/OUTPUT.md +149 -0
  49. package/skills/review-security/SKILL.md +10 -1
  50. package/skills/review-seo/SKILL.md +10 -1
  51. package/skills/review-spec/SKILL.md +145 -0
  52. package/skills/review-spec/references/CHECKS.md +105 -0
  53. package/skills/review-spec/references/OUTPUT.md +135 -0
  54. package/skills/review-verify/SKILL.md +10 -1
  55. package/skills/ship-roadmap/SKILL.md +1 -1
  56. package/skills/ship-roadmap/references/ADVANCE.md +34 -6
  57. package/skills/ship-roadmap/references/CLOSEOUT_AND_LOG.md +2 -1
  58. package/skills/ship-roadmap/references/MODEL_ROUTING.md +2 -0
  59. package/skills/ship-roadmap/references/RECOVERY_AND_SELECTION.md +3 -2
  60. package/skills/verification-contract/SKILL.md +10 -1
  61. package/skills/workflow-status/SKILL.md +11 -5
  62. package/skills/workflow-status/references/ENVELOPE_FIELDS.md +6 -2
  63. package/skills/workflow-status/references/PRE_EXECUTION.md +78 -0
  64. package/skills/workflow-status/references/SENSOR_CORE.md +46 -6
@@ -27,6 +27,7 @@ side). The recommendation itself is unaffected — this only adds visibility.
27
27
  "suggested": [{"command": "/review-change", "trigger": "accumulation: 420 changed lines since last-reviewed sha", "source_skill": "execute-phase"}]},
28
28
  "detail": {
29
29
  "design_candidates": [{"id": "08-billing-webhooks", "status": "idea", "next": "/design-feature 08-billing-webhooks"}],
30
+ "pre_execution": [{"unit": "12-export-api", "stage": "plan", "label": "stale", "verdict": "PLAN-REVIEW-PASS", "boundDigest": "sha256:9f2c…", "observedDigest": "sha256:41ab…", "recommended": "/review-plan 12-export-api", "reason": "docs/features/12-export-api/ACCEPTANCE.md changed after the review"}],
30
31
  "features": [
31
32
  {"id": "07-csv-export", "status": "in-progress", "deps": ["01"], "deps_unmet": [],
32
33
  "phase": {"current": "P2", "total": 4}, "pr": null,
@@ -68,8 +69,11 @@ side). The recommendation itself is unaffected — this only adds visibility.
68
69
  ```
69
70
 
70
71
  `detail.startable_now`, `detail.blocked_units` (with build orders),
71
- `detail.design_candidates`, and `detail.pending_triage` are the keys an
72
- orchestrator routes on; every id in `startable_now`/`blocked_units` must appear
72
+ `detail.design_candidates`, `detail.pre_execution` (one row per sensed unit from step
73
+ 6a, `{unit, stage, label, verdict, boundDigest, observedDigest, recommended, reason}`,
74
+ `verdict`/`reason` null when absent) and `detail.pending_triage` are the keys an
75
+ orchestrator routes on; a unit appears in `startable_now` only when its
76
+ `pre_execution[].label` is `current` for the stage it is about to enter; every id in `startable_now`/`blocked_units` must appear
73
77
  fully in `features`/`fixes` — an `idea` unit appears ONLY in
74
78
  `design_candidates` (and `detail.features`), never in `startable_now`, since
75
79
  it has no deps-met check to pass (design precedes dependency startability).
@@ -0,0 +1,78 @@
1
+ ## Pre-execution receipt sensing (step 6a)
2
+
3
+ Roadmap status says what exists; only a receipt bound to the current bytes says
4
+ whether the unit may be executed. Sense it like every other signal — read the file,
5
+ recompute the digest, never trust the prose sitting around the block.
6
+
7
+ ### What is read
8
+
9
+ For every unit whose resolved status is `defined`, `planned` or `in-progress`:
10
+
11
+ 1. The newest `## Pre-execution review receipt v1 — spec` and `… — plan` block in the
12
+ unit's `progress.md` (no `progress.md`, or no block for that stage → `missing`).
13
+ 2. The `snapshot` line — the `sha256:` digest the receipt binds — and each bound
14
+ artifact's current bytes: re-derive the digest with the recipe owner's verify
15
+ mode — `node scripts/pre-execution-snapshot.mjs verify --stage <spec|plan> --unit
16
+ <id> [--parent <64-hex>]` (`pre-execution-review` owns the recipe; a feature plan
17
+ check needs the Product digest it descended from, a fix check binds no parent).
18
+ Read `structural.reasonCode` and `structural.changedPaths` out of the JSON — they
19
+ name the dimension that stopped being true, which is what the sensor labels
20
+ `stale`. A snapshot digest is a canonical
21
+ SHA-256 over the snapshot object, so `git hash-object` is never a substitute: it
22
+ stays correct only for the frozen `ACCEPTANCE.md` manifest blob.
23
+ 3. The verdict, the reviewed `unit`, the stage, and the author fields
24
+ (`reviewer` and `authorId` — the receipt's `Reviewer:` / `Author:` lines — and
25
+ `authorExclusion`).
26
+
27
+ ### What proves a review ran (step 8)
28
+
29
+ One artifact later, the same discipline: step 8's `review_pending` keys on the
30
+ unit's **durable review mark** — the `REVIEW-RAN` row of its `review-findings.md`
31
+ ledger, whose shape and writer `pre-execution-review`'s `LEDGERS.md` owns — and
32
+ judges it by step 8's currency rule in `SENSOR_CORE.md`, never by a keying
33
+ invented here. A findings ledger with rows and no mark leaves the unit
34
+ review-pending: its rows prove findings were folded against
35
+ some state, which is a different fact from *this* state being reviewed, so the
36
+ sensor reports a missing gate, never a verdict that no review ever happened.
37
+
38
+ ### One label per stage, and the command it recommends
39
+
40
+ | Label | Evidence | Recommended |
41
+ |---|---|---|
42
+ | `current` | stage PASS verdict **and** recomputed digest = bound digest | spec: `/plan-feature <slug>` · plan: `/execute-phase <NN>` |
43
+ | `missing` | no receipt block for the stage | `defined` → `/review-spec <slug>` · planned/in-progress → `/review-plan <NN>` |
44
+ | `stale` | bound digest differs, or a bound context row moved | re-run **that stage's** review |
45
+ | `wrong-stage` | the only PASS belongs to the other stage | the stage that is missing — never the stage that passed |
46
+ | `substitute` | prose verdict, legacy block, or internal attestation stands where a receipt should be | that stage's review, and report the substitute as a blocker detail |
47
+ | `self-approved` | the author of the artifact recorded the PASS | that stage's review in a clean context |
48
+ | `author-readiness` | an authoring readiness result sits where a verdict should be | that stage's review — readiness never licenses execution |
49
+ | `legacy` | `planned`/`in-progress` unit with no ledgers and no receipt (predates feature 28) | the adoption route below |
50
+
51
+ A stale receipt re-runs the **review**, not the authoring skill: the artifacts may be
52
+ exactly right and simply need re-judging in a clean context. A missing verdict block,
53
+ or a verdict outside the stage's fixed set, is `missing` with the reason recorded —
54
+ never a guess in the recommended direction.
55
+
56
+ ### Envelope projection
57
+
58
+ - A unit that is otherwise startable but lacks a current PASS for the stage it is
59
+ about to enter becomes a `gate` blocker (`scope: unit`, detail names stage +
60
+ label). `startable_now` keeps only units whose next command is genuinely runnable,
61
+ so `next.recommended` never points a human at `execute-phase` on an unreviewed plan.
62
+ - `detail.pre_execution[]` gains one row per sensed unit: `{unit, stage, label,
63
+ verdict, boundDigest, observedDigest, recommended, reason}` — `verdict`/`reason`
64
+ are `null` when absent, `observedDigest` is always the digest computed **now**.
65
+ `detail` is opaque to the envelope schema, so no field outside it changes.
66
+ - Nothing is inferred from the *absence* of a block: an unreadable artifact is
67
+ `missing` with the failure in `reason`, never a carried-forward claim from the
68
+ receipt itself.
69
+
70
+ ### Legacy units
71
+
72
+ A `planned`/`in-progress` unit with no ledgers and no receipt predates the gate; it
73
+ reports as `legacy`, which is a different fact from `missing` ("never reviewed") and
74
+ routes the human differently. `pre-execution-review` owns the adoption rule —
75
+ construct the ledgers, never coerce old evidence, keep frozen acceptance and every
76
+ past commit byte-identical, and resume only on a current `PLAN-REVIEW-PASS`. This
77
+ sensor only reports the label and the command; it never edits a unit to make the
78
+ label disappear, and it files nothing.
@@ -64,16 +64,36 @@ live evidence against a frozen ledger remains a contradiction candidate.
64
64
  command matched to the exact status: `defined` → `/plan-feature <slug>`,
65
65
  `planned` → `/execute-phase <NN>`.
66
66
  - deps unmet (any status ≥ `defined`) → `blocked_units` (unchanged).
67
+ 6a. **Sense the pre-execution receipts** for every unit at `defined`, `planned` or
68
+ `in-progress` ([pre-execution evidence](PRE_EXECUTION.md)): read the stage's
69
+ newest receipt block, re-derive the bound digest with the recipe owner's
70
+ verify mode (`node scripts/pre-execution-snapshot.mjs verify --stage
71
+ <spec|plan> --unit <id> [--parent <64-hex>]` — a snapshot digest is a canonical SHA-256, never a
72
+ git blob id; `structural.reasonCode` names the dimension that drifted), and
73
+ label the stage `current`/`missing`/`stale`/`wrong-stage`/`substitute`/
74
+ `self-approved`/`author-readiness`/`legacy`. The label **overrides step 6's
75
+ status-only command**: a unit without a current PASS for the stage it is about to
76
+ enter is demoted out of `startable_now` into a `gate` blocker naming the missing
77
+ review, and `detail.pre_execution[]` records the row. A roadmap row is never
78
+ edited here — sensing only reads.
67
79
  7. **Phase progress.** For each in-progress feature, read `TASKS.md`: current
68
80
  phase, total phases, per-phase checkbox completion.
69
81
  8. **Pending quality gates.** For each unit with commits: has the mandatory
70
- `review-change` for its current state run (review report present in the
71
- feature folder — the unit's `review-findings.md` fold ledger, when
72
- present, IS that artifact: its presence, with any rows at all, proves
73
- `review-change` ran for the unit's current state)? Has `audit-pr` a
82
+ `review-change` for its current state run? The artifact is the unit's
83
+ **durable review mark** — the `REVIEW-RAN` row of its `review-findings.md`
84
+ fold ledger, whose shape and writer `pre-execution-review`'s `LEDGERS.md`
85
+ owns and it counts while the sha it names is an ancestor of the unit's head
86
+ and no commit after it touched a bound input of that review, over the paths
87
+ `pre-execution-review`'s `SNAPSHOT.md` binds:
88
+ `git log <mark-sha>..HEAD -- <bound paths>` prints nothing. Equality with the
89
+ head is not the test and cannot be: carrying the mark is a commit, and that
90
+ commit moves the head, so a rule keyed on equality calls every review that
91
+ finished its own turn unreviewed. The ledger's presence is never that proof: a
92
+ review that found nothing writes no finding row, so presence would call a
93
+ reviewed unit unreviewed and an unreviewed one reviewed. Has `audit-pr` a
74
94
  MERGE-READY bound to the PR's current head SHA (look for the audit
75
- comment marker on the PR)? Derive `review_pending` / `audit_pending` /
76
- `merge_ready` per unit.
95
+ comment marker on the PR)? Derive `review_pending` (no current mark) /
96
+ `audit_pending` / `merge_ready` per unit.
77
97
  9. **Fix-now fold ledger → `findings.fix_now[]`.** For each in-flight unit
78
98
  (feature or fix) that has a `review-findings.md` ledger, read only its
79
99
  `folded: no` rows and emit each as a structured item:
@@ -93,3 +113,23 @@ live evidence against a frozen ledger remains a contradiction candidate.
93
113
  error); no unit in the run has one → `findings.fix_now: []`, same as
94
114
  today. **Read-only**: this step only projects the ledger's current
95
115
  unfolded rows — never writes, ticks `folded`, or judges.
116
+
117
+ ### Envelope fields the sensor projects (versioned grammar)
118
+
119
+ Steps 1-9 print these keys and no others; each row must be a field the schema
120
+ package's envelope validator declares for that object.
121
+
122
+ ```text
123
+ sensor-fields@1
124
+ # machine: envelope
125
+ object | field
126
+ unit | type
127
+ pr | merge_ready
128
+ gates | review_pending
129
+ gates | audit_pending
130
+ findings | fix_now
131
+ findings.fix_now | suggested_tier
132
+ dependencies | unmet
133
+ blockers | kind
134
+ recommendations | product_audit
135
+ ```