triad-plus 1.8.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.
- package/CHANGELOG.md +22 -0
- package/README.md +14 -12
- package/adapters/antigravity/.agents/agents/triad-developer/agent.md +7 -3
- package/adapters/antigravity/.agents/agents/triad-orchestrator/agent.md +5 -0
- package/adapters/antigravity/.agents/agents/triad-reviewer/agent.md +7 -2
- package/adapters/antigravity/.agents/skills/triad/SKILL.md +22 -0
- package/adapters/claude-code/.claude/agents/triad-developer.md +9 -4
- package/adapters/claude-code/.claude/agents/triad-reviewer.md +10 -5
- package/adapters/claude-code/.claude/commands/triad.md +22 -0
- package/adapters/claude-code/README.md +11 -3
- package/adapters/codex/prompts/triad.md +28 -0
- package/adapters/copilot/.github/agents/triad-developer.agent.md +12 -6
- package/adapters/copilot/.github/agents/triad-evaluator.agent.md +2 -1
- package/adapters/copilot/.github/agents/triad-orchestrator.agent.md +15 -1
- package/adapters/copilot/.github/agents/triad-reviewer.agent.md +11 -5
- package/adapters/copilot/.github/skills/triad/SKILL.md +23 -0
- package/adapters/hermes/skills/triad/SKILL.md +18 -0
- package/adapters/opencode/.opencode/agents/triad-developer.md +9 -4
- package/adapters/opencode/.opencode/agents/triad-orchestrator.md +15 -0
- package/adapters/opencode/.opencode/agents/triad-reviewer.md +10 -3
- package/adapters/opencode/.opencode/commands/triad.md +21 -0
- package/adapters/opencode/README.md +19 -4
- package/adapters/registry.mjs +2 -0
- package/bin/triad-plus.js +8 -2
- package/docs/architecture.md +8 -0
- package/docs/assignment-packets.md +35 -0
- package/docs/bmad-integration.md +187 -82
- package/docs/configuration.md +9 -0
- package/docs/npx-installation.md +4 -0
- package/docs/operating-guide.it.md +8 -0
- package/docs/operating-guide.md +7 -0
- package/docs/verification.md +20 -0
- package/integrations/bmad/README.md +17 -9
- package/integrations/bmad/epics-parser.mjs +697 -0
- package/integrations/bmad/story-importer.mjs +143 -5
- package/package.json +2 -2
- package/runtime/lib/assignment-packet.mjs +516 -0
- package/runtime/triad-assignment-packet.mjs +62 -0
- package/runtime/triad-bmad-intake.mjs +150 -0
- package/runtime/triad-verify.mjs +16 -4
- package/schemas/verification-evidence.schema.json +8 -0
- package/skills/triad-loop-bootstrap/SKILL.md +39 -4
- package/skills/triad-loop-bootstrap/assets/loop-template/runtime/assignments/assignment.template.json +14 -1
- package/skills/triad-loop-developer/SKILL.md +19 -8
- package/skills/triad-loop-orchestrator/SKILL.md +83 -11
- package/skills/triad-loop-reviewer/SKILL.md +15 -5
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { access } from 'node:fs/promises';
|
|
4
|
+
import { realpathSync } from 'node:fs';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
7
|
+
|
|
8
|
+
const runtimeDirectory = path.dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
|
|
10
|
+
async function loadIntegration() {
|
|
11
|
+
const candidates = [
|
|
12
|
+
path.join(runtimeDirectory, 'integrations', 'bmad', 'epics-parser.mjs'),
|
|
13
|
+
path.resolve(runtimeDirectory, '..', 'integrations', 'bmad', 'epics-parser.mjs')
|
|
14
|
+
];
|
|
15
|
+
for (const candidate of candidates) {
|
|
16
|
+
try {
|
|
17
|
+
await access(candidate);
|
|
18
|
+
return import(pathToFileURL(candidate).href);
|
|
19
|
+
} catch {}
|
|
20
|
+
}
|
|
21
|
+
throw new Error('BMAD native intake assets are not installed');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function option(argv, name) {
|
|
25
|
+
const index = argv.indexOf(name);
|
|
26
|
+
return index >= 0 ? argv[index + 1] : null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function repeated(argv, name) {
|
|
30
|
+
const values = [];
|
|
31
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
32
|
+
if (argv[index] !== name) continue;
|
|
33
|
+
const value = argv[index + 1];
|
|
34
|
+
if (!value || value.startsWith('--')) throw new Error(`${name} requires a value`);
|
|
35
|
+
values.push(value);
|
|
36
|
+
index += 1;
|
|
37
|
+
}
|
|
38
|
+
return values;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function usage() {
|
|
42
|
+
process.stderr.write(`Native BMAD epics.md intake (integration/automation API)
|
|
43
|
+
|
|
44
|
+
Usage:
|
|
45
|
+
node .triad-runtime/triad-bmad-intake.mjs --source <epics.md>
|
|
46
|
+
node .triad-runtime/triad-bmad-intake.mjs --source <epics.md> --project <control> --output <features-dir> [--repository <id>] [--required-gate <story-id>=<gate-id>] [--depends-on <story-id>=<card-id>]
|
|
47
|
+
|
|
48
|
+
Without --output the command performs read-only ingestion and prints canonical
|
|
49
|
+
Stories. With --output it resolves Triad execution readiness and writes normal
|
|
50
|
+
Cards plus integration-side provenance. This command is an internal
|
|
51
|
+
deterministic primitive; the normal user entry point is the host's /triad
|
|
52
|
+
workflow with the epics.md path.
|
|
53
|
+
`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function keyed(values, label) {
|
|
57
|
+
const result = {};
|
|
58
|
+
for (const value of values) {
|
|
59
|
+
const separator = value.indexOf('=');
|
|
60
|
+
if (separator <= 0 || separator === value.length - 1) throw new Error(`${label} must use STORY-ID=VALUE`);
|
|
61
|
+
const storyId = value.slice(0, separator).trim();
|
|
62
|
+
const item = value.slice(separator + 1).trim();
|
|
63
|
+
if (!storyId || !item) throw new Error(`${label} must use STORY-ID=VALUE`);
|
|
64
|
+
(result[storyId] ??= []).push(item);
|
|
65
|
+
}
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async function main() {
|
|
70
|
+
const argv = process.argv.slice(2);
|
|
71
|
+
if (argv.includes('--help') || argv.includes('-h')) {
|
|
72
|
+
usage();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const source = option(argv, '--source');
|
|
76
|
+
if (!source) throw new Error('--source is required');
|
|
77
|
+
const output = option(argv, '--output');
|
|
78
|
+
const project = option(argv, '--project');
|
|
79
|
+
const repository = option(argv, '--repository');
|
|
80
|
+
const requiredGatesByStory = keyed(repeated(argv, '--required-gate'), '--required-gate');
|
|
81
|
+
const dependsOnByStory = keyed(repeated(argv, '--depends-on'), '--depends-on');
|
|
82
|
+
const { ingestBmadEpics, writeImportedEpics } = await loadIntegration();
|
|
83
|
+
if (output && !project) throw new Error('--project is required when --output is supplied');
|
|
84
|
+
const options = {
|
|
85
|
+
sourcePath: source,
|
|
86
|
+
projectRoot: project,
|
|
87
|
+
targetRepository: repository,
|
|
88
|
+
requiredGatesByStory,
|
|
89
|
+
dependsOnByStory
|
|
90
|
+
};
|
|
91
|
+
if (output) {
|
|
92
|
+
const result = await writeImportedEpics({ ...options, outputDirectory: output });
|
|
93
|
+
process.stdout.write(`${JSON.stringify({
|
|
94
|
+
status: 'ready',
|
|
95
|
+
source_kind: result.source_kind,
|
|
96
|
+
source_path: result.source_path,
|
|
97
|
+
source_sha256: result.source_sha256,
|
|
98
|
+
epic_count: result.epics.length,
|
|
99
|
+
story_count: result.stories.length,
|
|
100
|
+
card_count: result.outputs.length,
|
|
101
|
+
cards: result.outputs.map(({ story, cardPath, provenancePath, provenance }) => ({
|
|
102
|
+
story_id: story.id,
|
|
103
|
+
epic_id: story.epicId,
|
|
104
|
+
card_path: cardPath,
|
|
105
|
+
provenance_path: provenancePath,
|
|
106
|
+
card_sha256: provenance.card_sha256
|
|
107
|
+
}))
|
|
108
|
+
})}\n`);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const result = await ingestBmadEpics(options);
|
|
112
|
+
process.stdout.write(`${JSON.stringify({
|
|
113
|
+
status: 'ingested',
|
|
114
|
+
source_kind: result.source_kind,
|
|
115
|
+
source_path: result.source_path,
|
|
116
|
+
source_sha256: result.source_sha256,
|
|
117
|
+
epic_count: result.epics.length,
|
|
118
|
+
story_count: result.stories.length,
|
|
119
|
+
stories: result.stories.map((story) => ({
|
|
120
|
+
epic_id: story.epicId,
|
|
121
|
+
epic_title: story.epicTitle,
|
|
122
|
+
story_id: story.id,
|
|
123
|
+
title: story.title,
|
|
124
|
+
status: story.status,
|
|
125
|
+
ingestion_ready: story.ingestionReady,
|
|
126
|
+
execution_ready: story.executionReady,
|
|
127
|
+
source_heading: story.sourceHeading,
|
|
128
|
+
source_range: story.sourceRange
|
|
129
|
+
}))
|
|
130
|
+
})}\n`);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// `mktemp`/system temporary roots on macOS are commonly reached through the
|
|
134
|
+
// `/var` -> `/private/var` symlink. Compare canonical paths so the installed
|
|
135
|
+
// runtime CLI still runs when invoked from such a control workspace.
|
|
136
|
+
function isMainModule() {
|
|
137
|
+
if (!process.argv[1]) return false;
|
|
138
|
+
try {
|
|
139
|
+
return realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url));
|
|
140
|
+
} catch {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (isMainModule()) {
|
|
146
|
+
main().catch((error) => {
|
|
147
|
+
process.stderr.write(`${error.code ? `${error.code}: ` : ''}${error.message}\n`);
|
|
148
|
+
process.exitCode = 2;
|
|
149
|
+
});
|
|
150
|
+
}
|
package/runtime/triad-verify.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import { calculateCandidateFingerprint, collectCandidateChanges, worktreeBranch
|
|
|
8
8
|
import { executeGates, gateSelectionEvidence, loadTrustedGates, resolveGateSelection } from "./lib/gates.mjs";
|
|
9
9
|
import { resolveQualityContract } from "./lib/quality-baseline.mjs";
|
|
10
10
|
import { evaluateScopeContract, parseScopeContract } from "./lib/scope-contract.mjs";
|
|
11
|
+
import { resolveAssignmentContext, validateAssignmentPacket } from "./lib/assignment-packet.mjs";
|
|
11
12
|
|
|
12
13
|
const argv = process.argv.slice(2);
|
|
13
14
|
const option = (name) => {
|
|
@@ -70,7 +71,7 @@ async function resolveAssignment(projectRoot, trigger, explicitAssignment) {
|
|
|
70
71
|
return { assignmentPath, assignment: JSON.parse(source), assignmentHash: sha256(source) };
|
|
71
72
|
}
|
|
72
73
|
|
|
73
|
-
async function buildInvalidEvidence({ runId, trigger, assignment, reason, outputPath, failureCode = "verification_context_invalid", gateSelection = null, qualityBaselineFingerprint = null }) {
|
|
74
|
+
async function buildInvalidEvidence({ runId, trigger, assignment, reason, outputPath, failureCode = "verification_context_invalid", gateSelection = null, qualityBaselineFingerprint = null, assignmentPacket = null }) {
|
|
74
75
|
const evidence = {
|
|
75
76
|
schema_version: 1,
|
|
76
77
|
run_id: runId,
|
|
@@ -86,6 +87,9 @@ async function buildInvalidEvidence({ runId, trigger, assignment, reason, output
|
|
|
86
87
|
git_head: null,
|
|
87
88
|
candidate_fingerprint: null,
|
|
88
89
|
},
|
|
90
|
+
assignment_packet: assignmentPacket ?? (assignment?.assignment_packet_path || assignment?.assignment_packet_sha256
|
|
91
|
+
? { path: assignment.assignment_packet_path ?? null, sha256: assignment.assignment_packet_sha256 ?? null }
|
|
92
|
+
: null),
|
|
89
93
|
gates: [],
|
|
90
94
|
required_gates_passed: false,
|
|
91
95
|
status: "invalid_context",
|
|
@@ -154,6 +158,7 @@ async function main() {
|
|
|
154
158
|
let outputPath;
|
|
155
159
|
let gateSelection = null;
|
|
156
160
|
let qualityBaseline = null;
|
|
161
|
+
let assignmentPacket = null;
|
|
157
162
|
try {
|
|
158
163
|
let assignmentHash;
|
|
159
164
|
({ assignmentPath, assignment, assignmentHash } = await resolveAssignment(projectRoot, trigger, option("--assignment")));
|
|
@@ -167,12 +172,16 @@ async function main() {
|
|
|
167
172
|
if (!assignment.assignment_id) throw new Error("assignment ID is required");
|
|
168
173
|
if (assignment.agent_id !== trigger.agent_id || assignment.agent_type !== "triad_developer") throw new Error("developer assignment does not match trigger");
|
|
169
174
|
if ((await realpath(path.resolve(assignment.project_root ?? projectRoot))) !== projectRoot) throw new Error("assignment project root mismatch");
|
|
170
|
-
const
|
|
171
|
-
|
|
175
|
+
const assignmentContext = await resolveAssignmentContext(assignment, { projectRoot });
|
|
176
|
+
const worktree = assignmentContext.worktree;
|
|
172
177
|
const prdPath = path.resolve(projectRoot, assignment.prd_path ?? "artifacts/prd.md");
|
|
173
178
|
const cardPath = path.resolve(projectRoot, assignment.card_path);
|
|
174
179
|
await access(prdPath);
|
|
175
180
|
await access(cardPath);
|
|
181
|
+
// The packet is an immutable, shared assignment contract. Validate its
|
|
182
|
+
// binding before skills, scope, or expensive gates so a stale packet is
|
|
183
|
+
// reported as invalid context and consumes no retry budget.
|
|
184
|
+
assignmentPacket = await validateAssignmentPacket(assignment, projectRoot);
|
|
176
185
|
// Resolve the optional immutable Quality Contract before any baseline or
|
|
177
186
|
// expensive-gate check so a bound source drift keeps its precise failure
|
|
178
187
|
// classification (including when the source is the PRD itself).
|
|
@@ -220,6 +229,7 @@ async function main() {
|
|
|
220
229
|
candidate_fingerprint: before.value,
|
|
221
230
|
branch,
|
|
222
231
|
},
|
|
232
|
+
assignment_packet: assignmentPacket,
|
|
223
233
|
repository_skills: repositorySkills,
|
|
224
234
|
scope,
|
|
225
235
|
gates: [],
|
|
@@ -257,6 +267,7 @@ async function main() {
|
|
|
257
267
|
candidate_fingerprint: before.value,
|
|
258
268
|
branch,
|
|
259
269
|
},
|
|
270
|
+
assignment_packet: assignmentPacket,
|
|
260
271
|
repository_skills: repositorySkills,
|
|
261
272
|
scope,
|
|
262
273
|
gate_selection: gateSelectionEvidence(gateSelection),
|
|
@@ -283,7 +294,8 @@ async function main() {
|
|
|
283
294
|
outputPath,
|
|
284
295
|
failureCode: error.code ?? "verification_context_invalid",
|
|
285
296
|
gateSelection,
|
|
286
|
-
qualityBaselineFingerprint: qualityBaseline?.fingerprint ?? null
|
|
297
|
+
qualityBaselineFingerprint: qualityBaseline?.fingerprint ?? null,
|
|
298
|
+
assignmentPacket,
|
|
287
299
|
});
|
|
288
300
|
process.stdout.write(`${JSON.stringify({ run_id: runId, status: evidence.status, evidence: outputPath ?? null })}\n`);
|
|
289
301
|
process.exitCode = 3;
|
|
@@ -13,6 +13,14 @@
|
|
|
13
13
|
"assignment_sha256": { "type": ["string", "null"] },
|
|
14
14
|
"trigger": { "type": "object", "required": ["event", "agent_id", "agent_type"], "properties": { "event": { "type": "string" }, "agent_id": { "type": ["string", "null"] }, "agent_type": { "type": ["string", "null"] } } },
|
|
15
15
|
"baseline": { "type": "object", "required": ["prd_sha256", "card_sha256", "git_head", "candidate_fingerprint"], "properties": { "prd_sha256": { "type": ["string", "null"] }, "card_sha256": { "type": ["string", "null"] }, "quality_baseline_fingerprint": { "type": ["string", "null"], "pattern": "^[a-fA-F0-9]{64}$" }, "git_head": { "type": ["string", "null"] }, "candidate_fingerprint": { "type": ["string", "null"] }, "branch": { "type": ["string", "null"] } } },
|
|
16
|
+
"assignment_packet": {
|
|
17
|
+
"type": ["object", "null"],
|
|
18
|
+
"required": ["path", "sha256"],
|
|
19
|
+
"properties": {
|
|
20
|
+
"path": { "type": ["string", "null"] },
|
|
21
|
+
"sha256": { "type": ["string", "null"], "pattern": "^[a-fA-F0-9]{64}$" }
|
|
22
|
+
}
|
|
23
|
+
},
|
|
16
24
|
"scope": {
|
|
17
25
|
"type": "object",
|
|
18
26
|
"properties": {
|
|
@@ -13,13 +13,28 @@ Collect only missing essentials: project ID/title, readable PRD source, target
|
|
|
13
13
|
repositories with base/project branches and worktrees, measurable success
|
|
14
14
|
conditions, runnable quality gates, practical-test need, and integration need.
|
|
15
15
|
|
|
16
|
+
## Native BMAD planning boundary
|
|
17
|
+
|
|
18
|
+
When the owner input is a native BMAD `epics.md` artifact, BMAD is the
|
|
19
|
+
planning authority for Epic/Story boundaries and acceptance criteria. The
|
|
20
|
+
canonical Stories in that read-only artifact are the sole planning boundaries:
|
|
21
|
+
one canonical Story maps to one normal Triad Card. Bootstrap must not independently
|
|
22
|
+
re-decompose the PRD into another feature-card plan, create a second Story set,
|
|
23
|
+
or invoke an LLM to decide native Story boundaries. The native flow is
|
|
24
|
+
BMAD `epics.md` → canonical Stories → Triad Cards; the generic PRD-only
|
|
25
|
+
feature-plan step below does not apply to that input. Triad remains execution
|
|
26
|
+
authority after the planning handoff.
|
|
27
|
+
|
|
16
28
|
1. Create `<control-repository>/projects/<project-id>/`.
|
|
17
29
|
2. Copy `assets/project.yaml` to `project.yaml`; register only declared product
|
|
18
30
|
repositories, branches, and worktrees.
|
|
19
31
|
3. Copy the approved PRD to `artifacts/prd.md`; record source, collection time,
|
|
20
32
|
snapshot, revision when available, and SHA-256.
|
|
21
|
-
4. Copy `assets/loop-template/` to `.loop
|
|
22
|
-
under `features/` and a complete
|
|
33
|
+
4. Copy `assets/loop-template/` to `.loop/`. For ordinary PRD-only input,
|
|
34
|
+
create bounded feature cards under `features/` and a complete
|
|
35
|
+
`feature-plan.md`. For native BMAD input, ingest the canonical Stories and
|
|
36
|
+
materialize one normal Card per Story instead; do not perform a second
|
|
37
|
+
semantic decomposition.
|
|
23
38
|
When an owner-approved Quality Bar or additional intent/architecture source
|
|
24
39
|
exists, copy `assets/loop-template/quality-baseline.json`, fill only the
|
|
25
40
|
declared source hashes and criteria, compute its canonical fingerprint, and
|
|
@@ -47,10 +62,30 @@ conditions, runnable quality gates, practical-test need, and integration need.
|
|
|
47
62
|
The normal state route is `draft → ready → in_progress → verifying → in_review
|
|
48
63
|
→ approved|rework|blocked`. The Orchestrator owns those records. Before each
|
|
49
64
|
Developer dispatch, write an active assignment with a unique assignment ID,
|
|
50
|
-
feature, attempt, expected branch, worktree, PRD/card/gate
|
|
51
|
-
run ID.
|
|
65
|
+
feature, repository ID, attempt, expected branch, worktree, PRD/card/gate
|
|
66
|
+
hashes, and verifier run ID. Populate only the packet's bounded `context`
|
|
67
|
+
fields (relevant excerpts, acceptance, verification mapping, touch points,
|
|
68
|
+
constraints, risks, and prior evidence). Then create its immutable Assignment Packet and bind the returned path
|
|
69
|
+
and SHA-256 in that assignment:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
node .triad-runtime/triad-assignment-packet.mjs \
|
|
73
|
+
--project /absolute/path/to/control-workspace \
|
|
74
|
+
--assignment .loop/runtime/assignments/<assignment-file>.json
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The command returns JSON containing the packet path and the dispatch context;
|
|
78
|
+
launch the delegated role with `dispatch.cwd` set to the declared product
|
|
79
|
+
worktree. The verifier produces environment-derived evidence; it never changes
|
|
52
80
|
card state.
|
|
53
81
|
|
|
82
|
+
The control workspace and product worktree may be separate directories. An
|
|
83
|
+
external worktree is authorized by an exact repository mapping in
|
|
84
|
+
`project.yaml` (`repositories[].worktree`, falling back to `path`), not by an
|
|
85
|
+
assignment escape hatch. A mapped external worktree is valid even when the
|
|
86
|
+
legacy `allow_external_worktree` field is absent or false; an unmapped external
|
|
87
|
+
path fails closed before dispatch or gate execution.
|
|
88
|
+
|
|
54
89
|
Use local worktrees for enabled multi-repository integration and declare a final
|
|
55
90
|
integration card. Do not publish packages, alter registry versions, or create a
|
|
56
91
|
release as a bootstrap/integration step. Re-baseline only after an explicit owner
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
"feature_id": "REPLACE_ME_FEATURE_ID",
|
|
8
8
|
"attempt": 1,
|
|
9
9
|
"project_root": "REPLACE_ME_ABSOLUTE_CONTROL_WORKSPACE",
|
|
10
|
+
"repository_id": "REPLACE_ME_REPOSITORY_ID",
|
|
10
11
|
"worktree": "REPLACE_ME_DECLARED_WORKTREE_OR_ABSOLUTE_PATH",
|
|
11
12
|
"expected_branch": "REPLACE_ME_PROJECT_BRANCH",
|
|
12
13
|
"allow_external_worktree": false,
|
|
@@ -31,5 +32,17 @@
|
|
|
31
32
|
}
|
|
32
33
|
],
|
|
33
34
|
"verification_run_id": "REPLACE_ME_UUID",
|
|
34
|
-
"evidence_directory": ".loop/evidence/REPLACE_ME_FEATURE_ID/attempt-001"
|
|
35
|
+
"evidence_directory": ".loop/evidence/REPLACE_ME_FEATURE_ID/attempt-001",
|
|
36
|
+
"assignment_packet_path": null,
|
|
37
|
+
"assignment_packet_sha256": null,
|
|
38
|
+
"context": {
|
|
39
|
+
"relevant_prd_excerpts": [],
|
|
40
|
+
"relevant_adr_excerpts": [],
|
|
41
|
+
"acceptance_criteria": [],
|
|
42
|
+
"verification_mapping": [],
|
|
43
|
+
"expected_paths": [],
|
|
44
|
+
"constraints": [],
|
|
45
|
+
"risks": [],
|
|
46
|
+
"previous_evidence": []
|
|
47
|
+
}
|
|
35
48
|
}
|
|
@@ -5,14 +5,25 @@ description: Implement one bounded Triad feature card, add focused tests, and re
|
|
|
5
5
|
|
|
6
6
|
# Triad Developer
|
|
7
7
|
|
|
8
|
-
Change the artifact to satisfy the assigned goal.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
Change the artifact to satisfy the assigned goal. The host MUST launch this
|
|
9
|
+
activation with `cwd`/`workdir` equal to the assignment's declared product
|
|
10
|
+
worktree, not the control workspace. Verify that operational directory and
|
|
11
|
+
branch before editing. Read the immutable Assignment Packet first, then the
|
|
12
|
+
card, the mandatory repository skills, project instructions, and prior evidence
|
|
13
|
+
references named by the assignment. The packet is the primary contract and
|
|
14
|
+
eliminates broad startup discovery; read only the needed PRD/ADR section when a
|
|
15
|
+
packet detail is missing or contradictory, never the full documents by default.
|
|
16
|
+
When the assignment contains a scope contract, read it as a deterministic path
|
|
17
|
+
boundary in addition to the human card scope: keep every cumulative change from
|
|
18
|
+
the card baseline within its allowed paths, and use the recorded offending paths
|
|
19
|
+
for `scope_cleanup`. Do not change scope, policy, assignments, queue, state, or
|
|
20
|
+
evidence records.
|
|
21
|
+
|
|
22
|
+
The Orchestrator supplies explicit control-workspace, repository, worktree,
|
|
23
|
+
branch, card, packet, and mandatory-skill paths. Use native `read`, `grep`,
|
|
24
|
+
`glob`, and `list` primitives for simple reads/discovery when the host provides
|
|
25
|
+
them. Use shell/Bash for builds, tests, git, scripts, and system commands; do
|
|
26
|
+
not use shell as the default filesystem API.
|
|
16
27
|
|
|
17
28
|
At the beginning of every activation, read `.triad-plus/team.json` when it
|
|
18
29
|
exists. Your first report to the Orchestrator must identify you as its configured
|
|
@@ -8,6 +8,10 @@ description: Coordinate a Triad engineering run from declared feature cards thro
|
|
|
8
8
|
Maintain the goal and operational context. Decide the next step; do not perform
|
|
9
9
|
ordinary implementation or review. Read `project.yaml`, the frozen PRD, queue,
|
|
10
10
|
decision policy, current records, and `.triad-plus/team.json` when present.
|
|
11
|
+
The control workspace is the policy/state/evidence source; a delegated
|
|
12
|
+
Developer or Reviewer operates from the assigned product worktree. Prepare one
|
|
13
|
+
immutable Assignment Packet per assignment so role contexts do not reconstruct
|
|
14
|
+
the entire PRD/ADR from scratch.
|
|
11
15
|
|
|
12
16
|
Before the first owner-facing reply, read `.triad-plus/team.json` when it exists.
|
|
13
17
|
User-facing identity is permanent: adopt its non-empty
|
|
@@ -26,6 +30,50 @@ localized to the configured interaction language; then state whether the run is
|
|
|
26
30
|
new or resumed and what input was received. If the entry point already made that
|
|
27
31
|
presentation for this invocation, do not repeat it.
|
|
28
32
|
|
|
33
|
+
## Native BMAD intake
|
|
34
|
+
|
|
35
|
+
When the owner input is an `epics.md` file, or a directory that deterministically
|
|
36
|
+
contains `_bmad-output/planning-artifacts/epics.md`, use the native BMAD intake
|
|
37
|
+
before selecting a card. Do not ask the owner to split the file into Story
|
|
38
|
+
files or to run `import-bmad-story` once per Story. The BMAD source is read-only
|
|
39
|
+
and planning-owned.
|
|
40
|
+
|
|
41
|
+
For native BMAD input, the canonical Stories from `epics.md` are the sole
|
|
42
|
+
planning boundaries and the source of Triad Cards: one canonical Story maps to
|
|
43
|
+
one normal Triad Card. Do not run the generic PRD bootstrap decomposition a
|
|
44
|
+
second time, create parallel Cards, or use an LLM to reinterpret the Epic/Story
|
|
45
|
+
boundaries. BMAD decides what the executable Story is; Triad decides how it is
|
|
46
|
+
implemented, verified, and reviewed.
|
|
47
|
+
|
|
48
|
+
First ingest the source without execution assumptions so the Orchestrator can
|
|
49
|
+
inspect the canonical Epic/Story set:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
node .triad-runtime/triad-bmad-intake.mjs \
|
|
53
|
+
--source /absolute/path/to/_bmad-output/planning-artifacts/epics.md
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
After the control workspace is initialized and its project/repository/gate
|
|
57
|
+
readiness is valid, materialize normal Cards with the same deterministic
|
|
58
|
+
primitive and an explicit output directory:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
node .triad-runtime/triad-bmad-intake.mjs \
|
|
62
|
+
--source /absolute/path/to/_bmad-output/planning-artifacts/epics.md \
|
|
63
|
+
--project /absolute/path/to/control-workspace \
|
|
64
|
+
--output /absolute/path/to/control-workspace/features
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Supply `--repository` only when the Story or project configuration does not
|
|
68
|
+
resolve one deterministically. Supply per-Story `--required-gate STORY-ID=ID`
|
|
69
|
+
and `--depends-on STORY-ID=CARD-ID` only from explicit planning/owner input;
|
|
70
|
+
never infer them from prose or document order. Ingestion readiness (ID, title,
|
|
71
|
+
intent, acceptance criteria, Epic parent) is distinct from execution readiness
|
|
72
|
+
(repository, worktree, trusted gates, and Card contract). A native Story may be
|
|
73
|
+
ingested without `status: ready-for-dev`, but an explicit non-ready status stays
|
|
74
|
+
blocked from execution. Ambiguous or unavailable execution context is a
|
|
75
|
+
fail-closed escalation; do not dispatch a Developer or consume retry budget.
|
|
76
|
+
|
|
29
77
|
## Run one card
|
|
30
78
|
|
|
31
79
|
1. Verify the PRD hash, declared worktree/branch, repository instructions,
|
|
@@ -61,15 +109,35 @@ presentation for this invocation, do not repeat it.
|
|
|
61
109
|
gates, or consume retry/remediation budget. Legacy projects without the
|
|
62
110
|
quality contract retain PRD-only behavior.
|
|
63
111
|
2. Choose one dependency-approved `ready` card, mark it `in_progress`, append an
|
|
64
|
-
attempt, and create an active assignment before delegating.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
112
|
+
attempt, and create an active assignment before delegating. Bind the selected
|
|
113
|
+
repository ID as well as its declared branch/worktree. Populate the optional
|
|
114
|
+
`context` object with only bounded, assignment-relevant fields such as
|
|
115
|
+
`relevant_prd_excerpts`, `relevant_adr_excerpts`, `acceptance_criteria`,
|
|
116
|
+
`verification_mapping`, `expected_paths`, `constraints`, `risks`, and
|
|
117
|
+
`previous_evidence` (short text or references, never whole source files).
|
|
118
|
+
Before each delegation, publish an owner-facing
|
|
119
|
+
activation notice that attributes the configured display name, technical role,
|
|
120
|
+
and card/attempt to that role. Then run the exact packet command:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
node .triad-runtime/triad-assignment-packet.mjs \
|
|
124
|
+
--project /absolute/path/to/control-workspace \
|
|
125
|
+
--assignment .loop/runtime/assignments/<assignment-file>.json
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
It atomically creates (or verifies) the immutable packet, binds its path and
|
|
129
|
+
SHA-256 to the assignment, and returns explicit `dispatch.cwd`, control
|
|
130
|
+
workspace, repository, branch, card, packet, and mandatory-skill paths.
|
|
131
|
+
3. Dispatch the Developer with `cwd`/`workdir` exactly equal to the returned
|
|
132
|
+
assigned product worktree. Pass the card and Assignment Packet as the
|
|
133
|
+
primary contract, followed by the mandatory skill paths and any prior
|
|
134
|
+
evidence. Include the effective gate IDs (all trusted `required: true` gates
|
|
135
|
+
plus the card's selected IDs), risks, and findings. Globally required gates
|
|
136
|
+
are never suppressed. In selected mode, a selected optional gate is required
|
|
137
|
+
for that card and unselected optional gates may be skipped; dedupe the
|
|
138
|
+
effective set. Treat command results and role reports as **agent-reported
|
|
139
|
+
claims**, never as control-plane gate truth. The full PRD/ADR is a fallback
|
|
140
|
+
for a missing detail or contradiction, not systematic startup context.
|
|
73
141
|
4. After completion, move to `verifying`. Follow the recorded dispatch route:
|
|
74
142
|
wait for a valid hook-produced file when one is configured, otherwise invoke
|
|
75
143
|
the verifier explicitly. Accept only current evidence whose assignment ID,
|
|
@@ -94,8 +162,12 @@ presentation for this invocation, do not repeat it.
|
|
|
94
162
|
5. A passing verifier result is **environment-derived evidence**. Move only then
|
|
95
163
|
to `in_review`. Missing, stale, failed, timed-out, invalid-context, or
|
|
96
164
|
invalidated evidence never advances the card.
|
|
97
|
-
6.
|
|
98
|
-
|
|
165
|
+
6. Dispatch the Reviewer with the same immutable Assignment Packet and
|
|
166
|
+
`cwd`/`workdir` equal to the candidate worktree when the review needs direct
|
|
167
|
+
candidate inspection. Add the diff, Developer report, verifier evidence,
|
|
168
|
+
prior attempts, and risks. The Reviewer may consult only a necessary PRD/ADR
|
|
169
|
+
section when the packet is insufficient; it must not reconstruct the whole
|
|
170
|
+
requirement by default. Record its recommendation:
|
|
99
171
|
- `approved`: verify scope/evidence, commit the card locally, promote every
|
|
100
172
|
dependency-satisfied draft card to `ready`, then immediately select and
|
|
101
173
|
assign the next ready card;
|
|
@@ -5,11 +5,17 @@ description: Independently review one verified Triad implementation attempt agai
|
|
|
5
5
|
|
|
6
6
|
# Triad Reviewer
|
|
7
7
|
|
|
8
|
-
Look for defects and request correction until the result is acceptable.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
Look for defects and request correction until the result is acceptable. The host
|
|
9
|
+
should launch the Reviewer with `cwd`/`workdir` equal to the candidate worktree
|
|
10
|
+
when direct candidate inspection is required, while control-workspace paths are
|
|
11
|
+
passed explicitly. Read the same immutable Assignment Packet used by the
|
|
12
|
+
Developer, then the card, Developer report, actual diff/worktree, verifier
|
|
13
|
+
evidence, project policy, repository instructions, and prior attempts. The
|
|
14
|
+
packet is the shared assignment contract; consult only the necessary PRD/ADR
|
|
15
|
+
section when it is insufficient or contradictory rather than reconstructing
|
|
16
|
+
the whole requirement on every review. You may know prior attempts and
|
|
17
|
+
correction history; independence means assess the artifact and evidence
|
|
18
|
+
yourself, not blindness.
|
|
13
19
|
|
|
14
20
|
At the beginning of every activation, read `.triad-plus/team.json` when it
|
|
15
21
|
exists. Your first report to the Orchestrator must identify you as its configured
|
|
@@ -24,6 +30,10 @@ mismatched, or unreported required repository skill is a `blocked` result until
|
|
|
24
30
|
the Orchestrator creates a valid assignment; external context never substitutes
|
|
25
31
|
for the repository skill policy.
|
|
26
32
|
|
|
33
|
+
Use native `read`, `grep`, `glob`, and `list` primitives for simple reads when
|
|
34
|
+
the host provides them. Use shell/Bash for builds, tests, git, scripts, and
|
|
35
|
+
system commands, not as the default filesystem API.
|
|
36
|
+
|
|
27
37
|
Confirm scope, dependencies, candidate fingerprint, assignment ID, feature,
|
|
28
38
|
attempt, expected branch, and PRD/card/gate hashes. Reject stale, missing,
|
|
29
39
|
invalidated, or failed verifier evidence. Independently rerun enough required
|