triad-plus 1.6.0 → 1.8.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 (33) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +26 -0
  3. package/adapters/antigravity/.agents/agents/triad-evaluator/agent.md +5 -0
  4. package/adapters/claude-code/.claude/agents/triad-evaluator.md +5 -0
  5. package/adapters/copilot/.github/agents/triad-evaluator.agent.md +5 -0
  6. package/adapters/hermes/skills/triad/SKILL.md +5 -0
  7. package/adapters/opencode/.opencode/agents/triad-evaluator.md +6 -0
  8. package/bin/triad-plus.js +28 -3
  9. package/docs/architecture.md +7 -0
  10. package/docs/bmad-integration.md +110 -0
  11. package/docs/configuration.md +19 -0
  12. package/docs/evaluator-plus.md +9 -0
  13. package/docs/operating-guide.it.md +10 -0
  14. package/docs/operating-guide.md +10 -0
  15. package/docs/quality-contract.md +119 -0
  16. package/docs/verification.md +17 -0
  17. package/integrations/bmad/README.md +12 -0
  18. package/integrations/bmad/story-importer.mjs +475 -0
  19. package/package.json +2 -2
  20. package/runtime/lib/quality-baseline.mjs +205 -0
  21. package/runtime/triad-evaluator-validate.mjs +261 -0
  22. package/runtime/triad-verify.mjs +19 -5
  23. package/schemas/evaluator-plus-result.schema.json +16 -0
  24. package/schemas/quality-baseline.schema.json +42 -0
  25. package/schemas/verification-evidence.schema.json +1 -1
  26. package/skills/triad-loop-bootstrap/SKILL.md +8 -0
  27. package/skills/triad-loop-bootstrap/assets/loop-template/handoff-report.template.md +13 -0
  28. package/skills/triad-loop-bootstrap/assets/loop-template/quality-baseline.json +15 -0
  29. package/skills/triad-loop-bootstrap/assets/loop-template/run-state.yaml +7 -0
  30. package/skills/triad-loop-bootstrap/assets/loop-template/runtime/assignments/assignment.template.json +2 -0
  31. package/skills/triad-loop-bootstrap/assets/project.yaml +5 -0
  32. package/skills/triad-loop-evaluator/SKILL.md +12 -2
  33. package/skills/triad-loop-orchestrator/SKILL.md +51 -0
@@ -22,6 +22,19 @@
22
22
 
23
23
  - Evidence/review chain: `<verification/review/evaluator references>`
24
24
 
25
+ ## Quality Contract closure
26
+
27
+ - Quality Baseline: `<path, revision, fingerprint or legacy PRD-only mode>`
28
+ - Product-quality Evaluator+ verdict: `<PASS|FAIL|INDETERMINATE|not configured>`
29
+
30
+ | Criterion | Scope | Verdict | Evidence references |
31
+ | --- | --- | --- | --- |
32
+ | `<delivery criterion ID>` | `delivery_closure` | `<PASS|FAIL|INDETERMINATE>` | `<refs>` |
33
+
34
+ Delivery is `delivered` only when every configured `delivery_closure` criterion
35
+ is recorded as `PASS`. Product-quality criteria are evaluated by the fresh
36
+ Evaluator+ packet and are never silently evaluated during delivery closure.
37
+
25
38
  ## Local-worktree integration
26
39
 
27
40
  | Card | Consumer worktree | Provider worktree | Branch/commit map | Setup command | Data/event/callback gate |
@@ -0,0 +1,15 @@
1
+ {
2
+ "schema_version": 1,
3
+ "id": "REPLACE_ME_QUALITY_BASELINE_ID",
4
+ "revision": 1,
5
+ "sources": [
6
+ {
7
+ "id": "prd",
8
+ "role": "intent",
9
+ "path": "artifacts/prd.md",
10
+ "sha256": "REPLACE_ME_SHA256"
11
+ }
12
+ ],
13
+ "criteria": [],
14
+ "fingerprint": "REPLACE_ME_SHA256"
15
+ }
@@ -7,9 +7,16 @@ delivery:
7
7
  handoff: null
8
8
  branches: []
9
9
  evaluator_report: null
10
+ quality_criteria: [] # delivery_closure results; product_quality stays in Evaluator+
10
11
  delivered_at: null
11
12
  owner_message: null
12
13
 
14
+ quality_contract:
15
+ baseline: null
16
+ fingerprint: null
17
+ revision: null
18
+ rebaseline_events: []
19
+
13
20
  feature_plan:
14
21
  path: feature-plan.md
15
22
  status: declared
@@ -16,6 +16,8 @@
16
16
  "expected_prd_sha256": "REPLACE_ME_SHA256",
17
17
  "expected_card_sha256": "REPLACE_ME_SHA256",
18
18
  "expected_gates_sha256": "REPLACE_ME_SHA256",
19
+ "quality_baseline_path": null,
20
+ "expected_quality_baseline_fingerprint": null,
19
21
  "required_gate_ids": [],
20
22
  "scope_contract": null,
21
23
  "required_repository_skills": [
@@ -12,6 +12,11 @@ project:
12
12
  snapshot: artifacts/prd.md
13
13
  sha256: null
14
14
  source_revision: null
15
+ quality_contract:
16
+ # Optional immutable target for v1.8 projects. Leave both values null for
17
+ # legacy PRD-only behavior; bootstrap fills them only from declared sources.
18
+ baseline: null # artifacts/quality-baseline.json
19
+ fingerprint: null
15
20
  loop: .loop
16
21
  control_plane:
17
22
  verification: optional
@@ -31,13 +31,23 @@ values in the evaluation report. A missing or mismatched binding makes the
31
31
  evaluation `INDETERMINATE`; it never starts repair or changes the closed Triad
32
32
  result.
33
33
 
34
- Return a report conforming to `schemas/evaluator-plus-result.schema.json` and
35
- store it separately under `artifacts/evaluator-plus/<evaluation-id>.json`:
34
+ When the approved packet declares an immutable Quality Contract, receive its
35
+ fingerprint and only the criteria whose scope is `product_quality`. Do not
36
+ receive or evaluate `delivery_closure` criteria; those belong to the delivery
37
+ gate. Return a report conforming to `schemas/evaluator-plus-result.schema.json`
38
+ and store it separately under `artifacts/evaluator-plus/<evaluation-id>.json`:
36
39
 
37
40
  - `PASS`: the final artifact meets the supplied target;
38
41
  - `FAIL`: the target is not met, with direct evidence/references;
39
42
  - `INDETERMINATE`: the artifact or target cannot be observed reliably.
40
43
 
44
+ For a Quality Contract result, include `quality_baseline_fingerprint` and one
45
+ criterion result for every product-quality criterion, exactly once. Use only
46
+ `PASS`, `FAIL`, or `INDETERMINATE` per criterion. The overall `verdict` is
47
+ deterministically checked by `runtime/triad-evaluator-validate.mjs`: any FAIL
48
+ wins, otherwise any INDETERMINATE wins, otherwise PASS. A mismatch or missing
49
+ criterion is invalid evidence, not a product verdict.
50
+
41
51
  Include concise rationale, direct evidence references, and confidence. Do not
42
52
  edit source, change the Triad queue/state, commit, push, approve delivery, or
43
53
  request automatic repair, and never reopen the Triad run. A `FAIL` leaves the
@@ -52,6 +52,14 @@ presentation for this invocation, do not repeat it.
52
52
  that exact card baseline for every rework attempt: preserved candidate changes
53
53
  are normal during rework. Do not create the first scope-bound assignment from
54
54
  unattributable dirty product changes; record `invalid_context` instead.
55
+ If `project.quality_contract` is configured, load and validate its
56
+ project-relative JSON manifest before dispatch. Verify the canonical
57
+ fingerprint and every bound source SHA-256, then bind
58
+ `quality_baseline_path` and `expected_quality_baseline_fingerprint` on the
59
+ assignment. A `quality_baseline_invalid` or `quality_baseline_drift`
60
+ result is `invalid_context`: do not dispatch the Developer, run expensive
61
+ gates, or consume retry/remediation budget. Legacy projects without the
62
+ quality contract retain PRD-only behavior.
55
63
  2. Choose one dependency-approved `ready` card, mark it `in_progress`, append an
56
64
  attempt, and create an active assignment before delegating. Before each
57
65
  delegation, publish an owner-facing activation notice that attributes the
@@ -80,6 +88,9 @@ presentation for this invocation, do not repeat it.
80
88
  catalog and fails closed if a stale assignment names a missing or invalid
81
89
  gate. It records the selection mode, card IDs, effective IDs, and required
82
90
  IDs in the verification evidence.
91
+ When a Quality Contract is bound, `triad-verify` performs that baseline
92
+ preflight before the expensive gates and records its fingerprint in
93
+ `evidence.baseline.quality_baseline_fingerprint`.
83
94
  5. A passing verifier result is **environment-derived evidence**. Move only then
84
95
  to `in_review`. Missing, stale, failed, timed-out, invalid-context, or
85
96
  invalidated evidence never advances the card.
@@ -196,3 +207,43 @@ or change the already closed Triad run. A per-run `--evaluator` or
196
207
  `--no-evaluator` request may override the configuration when the host exposes it.
197
208
  Before dispatching it, publish the corresponding attributed Evaluator+
198
209
  activation notice.
210
+
211
+ When `project.quality_contract` is configured, the approved packet additionally
212
+ binds the immutable Quality Baseline fingerprint and includes only criteria whose
213
+ scope is `product_quality`. Never send `delivery_closure` criteria, queue state,
214
+ handoff state, or attempt history to Evaluator+. Validate the returned report
215
+ with a fresh source-integrity preflight from the control workspace first:
216
+
217
+ ```bash
218
+ node .triad-runtime/triad-evaluator-validate.mjs --mode baseline \
219
+ --project /absolute/path/to/control-workspace \
220
+ --baseline artifacts/quality-baseline.json
221
+ ```
222
+
223
+ Only after that command returns JSON `valid: true` may Evaluator+ be dispatched.
224
+ Then validate the returned report with this exact command (substituting the real
225
+ paths/fingerprint):
226
+
227
+ ```bash
228
+ node .triad-runtime/triad-evaluator-validate.mjs --mode evaluator \
229
+ --project /absolute/path/to/control-workspace \
230
+ --baseline artifacts/quality-baseline.json \
231
+ --result artifacts/evaluator-plus/evaluation.json \
232
+ --expected-candidate-fingerprint <final-candidate-fingerprint>
233
+ ```
234
+
235
+ The command reloads the baseline and every bound source immediately before
236
+ dispatch; a non-zero result is a closed validation failure. The control-plane
237
+ aggregate (FAIL over INDETERMINATE over PASS) is authoritative rather than an
238
+ LLM-supplied summary. Immediately before delivery closure, run this second exact
239
+ command with the delivery result array:
240
+
241
+ ```bash
242
+ node .triad-runtime/triad-evaluator-validate.mjs --mode delivery \
243
+ --project /absolute/path/to/control-workspace \
244
+ --baseline artifacts/quality-baseline.json \
245
+ --result artifacts/delivery-closure.json
246
+ ```
247
+
248
+ Record each delivery criterion and its evidence reference in the run/handoff,
249
+ and declare delivery only when every required delivery criterion is `PASS`.