triad-plus 1.7.0 → 1.9.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 (60) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +23 -12
  3. package/adapters/antigravity/.agents/agents/triad-developer/agent.md +7 -3
  4. package/adapters/antigravity/.agents/agents/triad-evaluator/agent.md +5 -0
  5. package/adapters/antigravity/.agents/agents/triad-orchestrator/agent.md +5 -0
  6. package/adapters/antigravity/.agents/agents/triad-reviewer/agent.md +7 -2
  7. package/adapters/antigravity/.agents/skills/triad/SKILL.md +22 -0
  8. package/adapters/claude-code/.claude/agents/triad-developer.md +9 -4
  9. package/adapters/claude-code/.claude/agents/triad-evaluator.md +5 -0
  10. package/adapters/claude-code/.claude/agents/triad-reviewer.md +10 -5
  11. package/adapters/claude-code/.claude/commands/triad.md +22 -0
  12. package/adapters/claude-code/README.md +11 -3
  13. package/adapters/codex/prompts/triad.md +28 -0
  14. package/adapters/copilot/.github/agents/triad-developer.agent.md +12 -6
  15. package/adapters/copilot/.github/agents/triad-evaluator.agent.md +7 -1
  16. package/adapters/copilot/.github/agents/triad-orchestrator.agent.md +15 -1
  17. package/adapters/copilot/.github/agents/triad-reviewer.agent.md +11 -5
  18. package/adapters/copilot/.github/skills/triad/SKILL.md +23 -0
  19. package/adapters/hermes/skills/triad/SKILL.md +23 -0
  20. package/adapters/opencode/.opencode/agents/triad-developer.md +9 -4
  21. package/adapters/opencode/.opencode/agents/triad-evaluator.md +6 -0
  22. package/adapters/opencode/.opencode/agents/triad-orchestrator.md +15 -0
  23. package/adapters/opencode/.opencode/agents/triad-reviewer.md +10 -3
  24. package/adapters/opencode/.opencode/commands/triad.md +21 -0
  25. package/adapters/opencode/README.md +19 -4
  26. package/adapters/registry.mjs +2 -0
  27. package/bin/triad-plus.js +8 -2
  28. package/docs/architecture.md +15 -0
  29. package/docs/assignment-packets.md +35 -0
  30. package/docs/bmad-integration.md +187 -82
  31. package/docs/configuration.md +28 -0
  32. package/docs/evaluator-plus.md +9 -0
  33. package/docs/npx-installation.md +4 -0
  34. package/docs/operating-guide.it.md +18 -0
  35. package/docs/operating-guide.md +17 -0
  36. package/docs/quality-contract.md +119 -0
  37. package/docs/verification.md +37 -0
  38. package/integrations/bmad/README.md +17 -9
  39. package/integrations/bmad/epics-parser.mjs +697 -0
  40. package/integrations/bmad/story-importer.mjs +143 -5
  41. package/package.json +2 -2
  42. package/runtime/lib/assignment-packet.mjs +516 -0
  43. package/runtime/lib/quality-baseline.mjs +205 -0
  44. package/runtime/triad-assignment-packet.mjs +62 -0
  45. package/runtime/triad-bmad-intake.mjs +150 -0
  46. package/runtime/triad-evaluator-validate.mjs +261 -0
  47. package/runtime/triad-verify.mjs +33 -7
  48. package/schemas/evaluator-plus-result.schema.json +16 -0
  49. package/schemas/quality-baseline.schema.json +42 -0
  50. package/schemas/verification-evidence.schema.json +9 -1
  51. package/skills/triad-loop-bootstrap/SKILL.md +47 -4
  52. package/skills/triad-loop-bootstrap/assets/loop-template/handoff-report.template.md +13 -0
  53. package/skills/triad-loop-bootstrap/assets/loop-template/quality-baseline.json +15 -0
  54. package/skills/triad-loop-bootstrap/assets/loop-template/run-state.yaml +7 -0
  55. package/skills/triad-loop-bootstrap/assets/loop-template/runtime/assignments/assignment.template.json +16 -1
  56. package/skills/triad-loop-bootstrap/assets/project.yaml +5 -0
  57. package/skills/triad-loop-developer/SKILL.md +19 -8
  58. package/skills/triad-loop-evaluator/SKILL.md +12 -2
  59. package/skills/triad-loop-orchestrator/SKILL.md +134 -11
  60. package/skills/triad-loop-reviewer/SKILL.md +15 -5
@@ -0,0 +1,119 @@
1
+ # Immutable Quality Contract
2
+
3
+ Triad+ 1.8 optionally binds a run to an owner-approved, machine-readable
4
+ Quality Baseline. It is an additional target record, not a second control
5
+ plane and not a replacement for the PRD, card baseline, or candidate
6
+ fingerprint.
7
+
8
+ ```text
9
+ Quality Baseline fingerprint = what the run was meant to satisfy
10
+ Repository/card baseline = where implementation started
11
+ Candidate fingerprint = what implementation produced
12
+ ```
13
+
14
+ ## Manifest
15
+
16
+ The manifest is JSON and is normally stored at
17
+ `artifacts/quality-baseline.json`:
18
+
19
+ ```json
20
+ {
21
+ "schema_version": 1,
22
+ "id": "my-project-quality-baseline",
23
+ "revision": 1,
24
+ "sources": [
25
+ {
26
+ "id": "prd",
27
+ "role": "intent",
28
+ "path": "artifacts/prd.md",
29
+ "sha256": "<64-hex-digest>"
30
+ }
31
+ ],
32
+ "criteria": [
33
+ { "id": "QB-001", "scope": "product_quality", "requirement": "..." },
34
+ { "id": "QB-010", "scope": "delivery_closure", "requirement": "..." }
35
+ ],
36
+ "fingerprint": "<sha256-of-canonical-manifest-without-fingerprint>"
37
+ }
38
+ ```
39
+
40
+ The manifest requires a positive revision, at least one source, unique source
41
+ and criterion IDs, project-relative source paths, SHA-256 for every source, and
42
+ non-empty requirements. Version 1 has exactly two criterion scopes:
43
+ `product_quality` and `delivery_closure`.
44
+
45
+ The fingerprint is SHA-256 over canonical JSON with object keys sorted
46
+ recursively, array order preserved, and the `fingerprint` field excluded from
47
+ the payload. Whitespace and object formatting therefore do not change it.
48
+
49
+ ## Binding and drift
50
+
51
+ When `project.quality_contract` is present, the Orchestrator binds both the
52
+ manifest path and its fingerprint in every active Developer assignment:
53
+
54
+ ```json
55
+ {
56
+ "quality_baseline_path": "artifacts/quality-baseline.json",
57
+ "expected_quality_baseline_fingerprint": "<sha256>"
58
+ }
59
+ ```
60
+
61
+ `triad-verify` validates the manifest and all source hashes before expensive
62
+ gates. A malformed manifest or fingerprint mismatch is
63
+ `quality_baseline_invalid`; a valid manifest whose declared sources or
64
+ assignment fingerprint no longer match is `quality_baseline_drift`. Both are
65
+ `invalid_context`: no Developer dispatch, expensive gates, or retry budget.
66
+
67
+ Projects without `quality_contract` retain the legacy PRD-only path. A
68
+ rebaseline is never an in-place edit: create a new revision/fingerprint and
69
+ record an explicit lineage event. Historical evidence is not silently
70
+ reinterpreted.
71
+
72
+ ## Phase ownership
73
+
74
+ `product_quality` criteria are included in the fresh, blind Evaluator+ packet.
75
+ The packet carries the baseline fingerprint, final candidate fingerprint,
76
+ criteria, approved source material, and bounded verifier evidence. It never
77
+ includes delivery criteria, queue state, handoff state, or attempt history.
78
+
79
+ Evaluator+ returns one result per product criterion. The control plane validates
80
+ coverage, uniqueness, scope, candidate/baseline fingerprints, and the overall
81
+ verdict. Aggregation is deterministic:
82
+
83
+ ```text
84
+ any FAIL -> FAIL
85
+ else any INDETERMINATE -> INDETERMINATE
86
+ else -> PASS
87
+ ```
88
+
89
+ `delivery_closure` criteria are evaluated separately during delivery closure
90
+ and recorded with criterion ID, verdict, and evidence references. A run is not
91
+ `delivered` when any configured delivery criterion is `FAIL` or
92
+ `INDETERMINATE`. Quality Bar evaluation is not a required-gate replacement,
93
+ and an Evaluator+ failure never repairs or reopens Triad automatically.
94
+
95
+ ## Explicit control-plane validation
96
+
97
+ The installed runtime exposes deterministic commands for the two phase
98
+ boundaries. Run the baseline preflight before dispatch, then run the phase
99
+ validators from the control workspace so the baseline is reloaded from disk:
100
+
101
+ ```bash
102
+ node .triad-runtime/triad-evaluator-validate.mjs --mode baseline \
103
+ --project /absolute/path/to/control \
104
+ --baseline artifacts/quality-baseline.json
105
+
106
+ node .triad-runtime/triad-evaluator-validate.mjs --mode evaluator \
107
+ --project /absolute/path/to/control \
108
+ --baseline artifacts/quality-baseline.json \
109
+ --result artifacts/evaluator-plus/evaluation.json \
110
+ --expected-candidate-fingerprint <final-candidate-fingerprint>
111
+
112
+ node .triad-runtime/triad-evaluator-validate.mjs --mode delivery \
113
+ --project /absolute/path/to/control \
114
+ --baseline artifacts/quality-baseline.json \
115
+ --result artifacts/delivery-closure.json
116
+ ```
117
+
118
+ Each command emits one machine-readable JSON result and exits non-zero for an
119
+ invalid contract, source drift, stale candidate binding, or invalid result.
@@ -17,6 +17,23 @@ An agent-reported claim is not the same as verification evidence. A Developer ca
17
17
  report the commands it ran; `triad-verify` independently observes declared
18
18
  required `control-plane` gates and writes atomic evidence.
19
19
 
20
+ ## Immutable Quality Contract
21
+
22
+ Projects may opt into `project.quality_contract` with a project-relative JSON
23
+ manifest and its expected SHA-256 fingerprint. The shared
24
+ `runtime/lib/quality-baseline.mjs` loader canonicalizes the manifest (excluding
25
+ its self-declared `fingerprint`), validates source paths, IDs, scopes, and hashes,
26
+ then verifies every bound source before any expensive gate runs. A malformed,
27
+ missing, or mismatched contract is `invalid_context`; a valid manifest whose
28
+ bound source content has changed is `quality_baseline_drift`. Both fail closed:
29
+ no Developer dispatch, gate execution, or retry budget consumption is allowed.
30
+
31
+ The verifier records `baseline.quality_baseline_fingerprint` when configured and
32
+ records `null` for legacy projects. The Quality Contract is distinct from the
33
+ repository/card baseline and the candidate fingerprint: it says what the run is
34
+ trying to satisfy, not which Git commit was checked out or what the candidate
35
+ changed.
36
+
20
37
  Before gates run, the verifier validates the active assignment, PRD/card/gate
21
38
  hashes, worktree, expected branch, and candidate fingerprint. It records the
22
39
  assignment ID/hash and run ID, executes deterministic commands with a bounded
@@ -29,6 +46,26 @@ it does not itself approve, rework, or transition a run.
29
46
  Evidence files and logs are diagnostics. Users normally need only the
30
47
  Orchestrator's summary and the Reviewer verdict.
31
48
 
49
+ ## Assignment packets and dispatch context
50
+
51
+ The Orchestrator can create one immutable packet per active assignment with:
52
+
53
+ ```bash
54
+ node .triad-runtime/triad-assignment-packet.mjs \
55
+ --project /absolute/path/to/control-workspace \
56
+ --assignment .loop/runtime/assignments/<assignment-file>.json
57
+ ```
58
+
59
+ The command binds a packet path and SHA-256 to the assignment and returns the
60
+ explicit product-worktree `dispatch.cwd`. The packet contains the bounded card
61
+ contract, relevant excerpts, verification mapping, expected paths, risks,
62
+ constraints, mandatory skill references, and prior evidence references. It is
63
+ the primary Developer/Reviewer context; full PRD/ADR reads are fallback-only.
64
+ It never replaces real skill reads or verifier hash checks. A bound packet is
65
+ validated before `triad-verify` executes scope or gates, and a changed or
66
+ missing packet fails closed as `assignment_packet_invalid`. Assignments without
67
+ packet fields retain legacy behavior.
68
+
32
69
  ## Card-declared required gates
33
70
 
34
71
  The work queue may carry a machine-readable `required_gates` list for an
@@ -1,12 +1,20 @@
1
- # BMAD Story importer
1
+ # BMAD integration
2
2
 
3
- This optional integration converts one BMAD Markdown Story with
4
- `status: ready-for-dev` into a normal Triad feature Card. It is intentionally
5
- small and deterministic: the source is read-only, caller options are explicit,
6
- and BMAD workflows are never invoked.
3
+ The primary BMAD handoff is the native planning artifact
4
+ `_bmad-output/planning-artifacts/epics.md`. Use the deterministic parser in
5
+ `epics-parser.mjs` to detect Epic/Story boundaries, ingest canonical Stories,
6
+ resolve Triad execution readiness, and materialize normal Cards with strong
7
+ source provenance.
7
8
 
8
- See [the public BMAD integration guide](../../docs/bmad-integration.md) for the
9
- mapping contract, CLI/API examples, provenance sidecar, and fail-closed rules.
9
+ The parser is read-only and does not invoke BMAD workflows or mutate
10
+ `epics.md`. It reuses the Card builder from `story-importer.mjs`; no
11
+ intermediate BMAD Story files are required.
10
12
 
11
- The implementation is in `story-importer.mjs`. It does not add BMAD-specific
12
- branches to the Triad Core or infer gates/dependencies from planning order.
13
+ `story-importer.mjs` remains the low-level compatibility API for a standalone
14
+ Story that already has `status: ready-for-dev`. It is retained for debugging,
15
+ tests, automation, and existing callers, but it is not the primary BMAD user
16
+ workflow.
17
+
18
+ See [the native BMAD integration guide](../../docs/bmad-integration.md) for the
19
+ handoff contract, repository resolution, execution readiness, provenance, and
20
+ fail-closed behavior.