@cleocode/playbooks 2026.4.92 → 2026.4.94
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/package.json +5 -4
- package/src/__tests__/runtime.test.ts +678 -0
- package/src/__tests__/starter.e2e.test.ts +462 -0
- package/src/index.ts +17 -0
- package/src/runtime.ts +912 -0
- package/starter/ivtr.cantbook +97 -0
- package/starter/rcasd.cantbook +142 -0
- package/starter/release.cantbook +99 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
version: "1.0"
|
|
2
|
+
name: ivtr
|
|
3
|
+
description: >
|
|
4
|
+
IVTR execution loop — Implement, Validate, Test. Each stage is a distinct
|
|
5
|
+
agentic node wired in declaration order; failures retry in place up to
|
|
6
|
+
`max_iterations`, mimicking the classic build-lint-test cycle. The runtime
|
|
7
|
+
keeps per-node iteration counters so the total retry budget across the three
|
|
8
|
+
nodes is bounded by the sum of each node's cap (see T930 runtime semantics).
|
|
9
|
+
|
|
10
|
+
inputs:
|
|
11
|
+
- name: taskId
|
|
12
|
+
required: true
|
|
13
|
+
description: Task id being executed (e.g. T934).
|
|
14
|
+
- name: maxAttempts
|
|
15
|
+
required: false
|
|
16
|
+
default: 3
|
|
17
|
+
description: >
|
|
18
|
+
Documentation-only hint — the runtime uses per-node max_iterations.
|
|
19
|
+
|
|
20
|
+
nodes:
|
|
21
|
+
- id: implement
|
|
22
|
+
type: agentic
|
|
23
|
+
skill: ct-task-executor
|
|
24
|
+
role: worker
|
|
25
|
+
description: >
|
|
26
|
+
Implement {{inputs.taskId}} against its spec and acceptance criteria.
|
|
27
|
+
On failure, retries in place with the last error injected into context
|
|
28
|
+
(__lastError / __lastFailedNode). Cap: 3 attempts.
|
|
29
|
+
inputs:
|
|
30
|
+
taskId: "{{inputs.taskId}}"
|
|
31
|
+
ensures:
|
|
32
|
+
schema: implementation_diff
|
|
33
|
+
on_failure:
|
|
34
|
+
max_iterations: 3
|
|
35
|
+
escalate: false
|
|
36
|
+
|
|
37
|
+
- id: validate
|
|
38
|
+
type: agentic
|
|
39
|
+
skill: ct-validator
|
|
40
|
+
role: worker
|
|
41
|
+
description: >
|
|
42
|
+
Validate the implementation against the task spec — static checks,
|
|
43
|
+
schema compliance, and contract invariants. Retries in place on
|
|
44
|
+
failure; a sustained failure escalates back to implement via
|
|
45
|
+
`inject_into` so the worker can incorporate the validator's feedback.
|
|
46
|
+
requires:
|
|
47
|
+
from: implement
|
|
48
|
+
fields:
|
|
49
|
+
- diff
|
|
50
|
+
ensures:
|
|
51
|
+
schema: validation_report
|
|
52
|
+
on_failure:
|
|
53
|
+
max_iterations: 2
|
|
54
|
+
inject_into: implement
|
|
55
|
+
|
|
56
|
+
- id: test
|
|
57
|
+
type: agentic
|
|
58
|
+
skill: ct-task-executor
|
|
59
|
+
role: worker
|
|
60
|
+
description: >
|
|
61
|
+
Run the task's test suite and verify every acceptance criterion passes.
|
|
62
|
+
On failure, bounces back to implement with the failing test names in
|
|
63
|
+
context so the worker can address root cause rather than re-running.
|
|
64
|
+
Terminal stage of the IVTR loop.
|
|
65
|
+
requires:
|
|
66
|
+
from: validate
|
|
67
|
+
fields:
|
|
68
|
+
- passed
|
|
69
|
+
ensures:
|
|
70
|
+
schema: test_report
|
|
71
|
+
on_failure:
|
|
72
|
+
max_iterations: 2
|
|
73
|
+
inject_into: implement
|
|
74
|
+
|
|
75
|
+
edges:
|
|
76
|
+
- from: implement
|
|
77
|
+
to: validate
|
|
78
|
+
contract:
|
|
79
|
+
requires:
|
|
80
|
+
- diff
|
|
81
|
+
ensures:
|
|
82
|
+
- passed
|
|
83
|
+
- from: validate
|
|
84
|
+
to: test
|
|
85
|
+
contract:
|
|
86
|
+
requires:
|
|
87
|
+
- passed
|
|
88
|
+
ensures:
|
|
89
|
+
- testsPassed
|
|
90
|
+
|
|
91
|
+
error_handlers:
|
|
92
|
+
- on: iteration_cap_exceeded
|
|
93
|
+
action: hitl_escalate
|
|
94
|
+
message: "IVTR loop exhausted — implementation, validation, or tests keep failing."
|
|
95
|
+
- on: contract_violation
|
|
96
|
+
action: inject_hint
|
|
97
|
+
message: "Contract violated at stage boundary — check requires/ensures fields."
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
version: "1.0"
|
|
2
|
+
name: rcasd
|
|
3
|
+
description: >
|
|
4
|
+
RCASD planning pipeline — Research, Consensus, Architecture, Specification,
|
|
5
|
+
Decomposition. Linear five-stage agent chain that produces a fully-decomposed
|
|
6
|
+
epic ready for IVTR execution. Every stage merges its structured output into
|
|
7
|
+
the run context via the playbook runtime state machine (see T930).
|
|
8
|
+
|
|
9
|
+
inputs:
|
|
10
|
+
- name: epicId
|
|
11
|
+
required: true
|
|
12
|
+
description: Parent epic id being planned (e.g. T999).
|
|
13
|
+
- name: scope
|
|
14
|
+
required: false
|
|
15
|
+
default: global
|
|
16
|
+
description: Planning scope (global|team|project).
|
|
17
|
+
|
|
18
|
+
nodes:
|
|
19
|
+
- id: research
|
|
20
|
+
type: agentic
|
|
21
|
+
skill: ct-research-agent
|
|
22
|
+
role: lead
|
|
23
|
+
description: >
|
|
24
|
+
Gather context for {{inputs.epicId}} — prior art, patterns, alternatives,
|
|
25
|
+
and unknowns. Emits a structured research summary into the run context.
|
|
26
|
+
inputs:
|
|
27
|
+
topic: "{{inputs.epicId}}"
|
|
28
|
+
scope: "{{inputs.scope}}"
|
|
29
|
+
ensures:
|
|
30
|
+
schema: research_summary
|
|
31
|
+
on_failure:
|
|
32
|
+
max_iterations: 2
|
|
33
|
+
escalate: true
|
|
34
|
+
|
|
35
|
+
- id: consensus
|
|
36
|
+
type: agentic
|
|
37
|
+
skill: ct-validator
|
|
38
|
+
agent: consensus-lead
|
|
39
|
+
role: lead
|
|
40
|
+
description: >
|
|
41
|
+
Review research findings, validate approach, surface risks, and obtain
|
|
42
|
+
HITL alignment on direction before committing to architecture.
|
|
43
|
+
requires:
|
|
44
|
+
from: research
|
|
45
|
+
fields:
|
|
46
|
+
- summary
|
|
47
|
+
- risks
|
|
48
|
+
ensures:
|
|
49
|
+
schema: consensus_decision
|
|
50
|
+
on_failure:
|
|
51
|
+
max_iterations: 2
|
|
52
|
+
|
|
53
|
+
- id: architecture
|
|
54
|
+
type: agentic
|
|
55
|
+
skill: ct-spec-writer
|
|
56
|
+
agent: architecture-lead
|
|
57
|
+
role: lead
|
|
58
|
+
description: >
|
|
59
|
+
Choose concrete patterns, integration points, and data flows. Capture
|
|
60
|
+
decisions as ADR stubs referenced by the specification stage.
|
|
61
|
+
requires:
|
|
62
|
+
from: consensus
|
|
63
|
+
fields:
|
|
64
|
+
- decision
|
|
65
|
+
ensures:
|
|
66
|
+
schema: architecture_plan
|
|
67
|
+
on_failure:
|
|
68
|
+
max_iterations: 2
|
|
69
|
+
|
|
70
|
+
- id: specification
|
|
71
|
+
type: agentic
|
|
72
|
+
skill: ct-spec-writer
|
|
73
|
+
role: lead
|
|
74
|
+
description: >
|
|
75
|
+
Write a formal specification using RFC 2119 language, acceptance
|
|
76
|
+
criteria, contract invariants, and failure modes for {{inputs.epicId}}.
|
|
77
|
+
requires:
|
|
78
|
+
from: architecture
|
|
79
|
+
fields:
|
|
80
|
+
- patterns
|
|
81
|
+
- adrs
|
|
82
|
+
ensures:
|
|
83
|
+
schema: specification_document
|
|
84
|
+
on_failure:
|
|
85
|
+
max_iterations: 2
|
|
86
|
+
|
|
87
|
+
- id: decomposition
|
|
88
|
+
type: agentic
|
|
89
|
+
skill: ct-epic-architect
|
|
90
|
+
role: lead
|
|
91
|
+
description: >
|
|
92
|
+
Break {{inputs.epicId}} into atomic child tasks with dependencies,
|
|
93
|
+
acceptance gates, and size estimates (small|medium|large). Terminal
|
|
94
|
+
stage of the RCASD pipeline.
|
|
95
|
+
requires:
|
|
96
|
+
from: specification
|
|
97
|
+
fields:
|
|
98
|
+
- acceptance
|
|
99
|
+
- requirements
|
|
100
|
+
ensures:
|
|
101
|
+
schema: task_tree
|
|
102
|
+
on_failure:
|
|
103
|
+
max_iterations: 2
|
|
104
|
+
escalate: true
|
|
105
|
+
|
|
106
|
+
edges:
|
|
107
|
+
- from: research
|
|
108
|
+
to: consensus
|
|
109
|
+
contract:
|
|
110
|
+
requires:
|
|
111
|
+
- summary
|
|
112
|
+
ensures:
|
|
113
|
+
- decision
|
|
114
|
+
- from: consensus
|
|
115
|
+
to: architecture
|
|
116
|
+
contract:
|
|
117
|
+
requires:
|
|
118
|
+
- decision
|
|
119
|
+
ensures:
|
|
120
|
+
- patterns
|
|
121
|
+
- from: architecture
|
|
122
|
+
to: specification
|
|
123
|
+
contract:
|
|
124
|
+
requires:
|
|
125
|
+
- patterns
|
|
126
|
+
ensures:
|
|
127
|
+
- acceptance
|
|
128
|
+
- from: specification
|
|
129
|
+
to: decomposition
|
|
130
|
+
contract:
|
|
131
|
+
requires:
|
|
132
|
+
- acceptance
|
|
133
|
+
ensures:
|
|
134
|
+
- children
|
|
135
|
+
|
|
136
|
+
error_handlers:
|
|
137
|
+
- on: iteration_cap_exceeded
|
|
138
|
+
action: hitl_escalate
|
|
139
|
+
message: "RCASD stage exhausted retries — escalate to human for direction."
|
|
140
|
+
- on: agentic_timeout
|
|
141
|
+
action: inject_hint
|
|
142
|
+
message: "Narrow scope and retry."
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
version: "1.0"
|
|
2
|
+
name: release
|
|
3
|
+
description: >
|
|
4
|
+
Release pipeline — bump version, update the changelog, pause at a HITL
|
|
5
|
+
approval gate, then publish. The approval node uses the `conservative`
|
|
6
|
+
policy so the runtime always requires human sign-off (it returns
|
|
7
|
+
`terminalStatus=pending_approval` with a signed HMAC resume token per
|
|
8
|
+
approval.ts).
|
|
9
|
+
|
|
10
|
+
inputs:
|
|
11
|
+
- name: targetVersion
|
|
12
|
+
required: true
|
|
13
|
+
description: Target semver or CalVer to publish (e.g. 2026.4.92).
|
|
14
|
+
- name: channel
|
|
15
|
+
required: false
|
|
16
|
+
default: latest
|
|
17
|
+
description: npm dist-tag (latest|next|canary).
|
|
18
|
+
|
|
19
|
+
nodes:
|
|
20
|
+
- id: version_bump
|
|
21
|
+
type: agentic
|
|
22
|
+
skill: ct-dev-workflow
|
|
23
|
+
agent: release-lead
|
|
24
|
+
role: lead
|
|
25
|
+
description: >
|
|
26
|
+
Bump package.json versions to {{inputs.targetVersion}} across the
|
|
27
|
+
monorepo (pnpm run version:bump or equivalent orchestrator call).
|
|
28
|
+
inputs:
|
|
29
|
+
targetVersion: "{{inputs.targetVersion}}"
|
|
30
|
+
ensures:
|
|
31
|
+
schema: version_bump_report
|
|
32
|
+
on_failure:
|
|
33
|
+
max_iterations: 2
|
|
34
|
+
|
|
35
|
+
- id: changelog
|
|
36
|
+
type: agentic
|
|
37
|
+
skill: ct-documentor
|
|
38
|
+
agent: release-lead
|
|
39
|
+
role: lead
|
|
40
|
+
description: >
|
|
41
|
+
Update CHANGELOG.md with an entry for {{inputs.targetVersion}}, summarize
|
|
42
|
+
the commits since the last tag, and categorize (feat/fix/chore/docs).
|
|
43
|
+
requires:
|
|
44
|
+
from: version_bump
|
|
45
|
+
fields:
|
|
46
|
+
- versionBumped
|
|
47
|
+
ensures:
|
|
48
|
+
schema: changelog_entry
|
|
49
|
+
on_failure:
|
|
50
|
+
max_iterations: 2
|
|
51
|
+
|
|
52
|
+
- id: approval
|
|
53
|
+
type: approval
|
|
54
|
+
policy: conservative
|
|
55
|
+
prompt: >
|
|
56
|
+
Approve release of {{inputs.targetVersion}} to {{inputs.channel}}?
|
|
57
|
+
Review the changelog entry and version bump before clicking approve.
|
|
58
|
+
description: >
|
|
59
|
+
HITL gate — runtime pauses here and returns a signed HMAC resume token.
|
|
60
|
+
A human (or automated owner) must call approveGate() / rejectGate() and
|
|
61
|
+
then resumePlaybook() to continue past this node.
|
|
62
|
+
|
|
63
|
+
- id: publish
|
|
64
|
+
type: agentic
|
|
65
|
+
skill: ct-dev-workflow
|
|
66
|
+
agent: release-lead
|
|
67
|
+
role: lead
|
|
68
|
+
description: >
|
|
69
|
+
Publish to npm (pnpm run release:publish --tag {{inputs.channel}}).
|
|
70
|
+
Terminal node — completes the release pipeline.
|
|
71
|
+
ensures:
|
|
72
|
+
schema: publish_report
|
|
73
|
+
on_failure:
|
|
74
|
+
max_iterations: 1
|
|
75
|
+
escalate: true
|
|
76
|
+
|
|
77
|
+
edges:
|
|
78
|
+
- from: version_bump
|
|
79
|
+
to: changelog
|
|
80
|
+
contract:
|
|
81
|
+
requires:
|
|
82
|
+
- versionBumped
|
|
83
|
+
ensures:
|
|
84
|
+
- changelogUpdated
|
|
85
|
+
- from: changelog
|
|
86
|
+
to: approval
|
|
87
|
+
- from: approval
|
|
88
|
+
to: publish
|
|
89
|
+
contract:
|
|
90
|
+
ensures:
|
|
91
|
+
- published
|
|
92
|
+
|
|
93
|
+
error_handlers:
|
|
94
|
+
- on: iteration_cap_exceeded
|
|
95
|
+
action: hitl_escalate
|
|
96
|
+
message: "Release stage exhausted retries — stop and investigate before retrying."
|
|
97
|
+
- on: contract_violation
|
|
98
|
+
action: abort
|
|
99
|
+
message: "Release contract violated — halt to avoid publishing a broken artifact."
|