@cloverleaf/reference-impl 0.7.1 → 0.7.3
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/dist/cli.mjs +3 -0
- package/lib/cli.ts +2 -0
- package/package.json +1 -1
- package/prompts/plan.md +8 -0
- package/skills/cloverleaf-run-plan/SKILL.md +20 -4
package/dist/cli.mjs
CHANGED
|
@@ -590,6 +590,9 @@ try {
|
|
|
590
590
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
591
591
|
});
|
|
592
592
|
const sibling = JSON.parse(raw);
|
|
593
|
+
// Skip siblings that are already merged — they no longer contest scope
|
|
594
|
+
if (sibling['status'] === 'merged')
|
|
595
|
+
continue;
|
|
593
596
|
const scope = sibling['scope'];
|
|
594
597
|
const files = Array.isArray(scope?.['files_touched'])
|
|
595
598
|
? scope['files_touched'].filter((x) => typeof x === 'string')
|
package/lib/cli.ts
CHANGED
|
@@ -604,6 +604,8 @@ try {
|
|
|
604
604
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
605
605
|
});
|
|
606
606
|
const sibling = JSON.parse(raw) as Record<string, unknown>;
|
|
607
|
+
// Skip siblings that are already merged — they no longer contest scope
|
|
608
|
+
if (sibling['status'] === 'merged') continue;
|
|
607
609
|
const scope = sibling['scope'] as Record<string, unknown> | undefined;
|
|
608
610
|
const files = Array.isArray(scope?.['files_touched'])
|
|
609
611
|
? (scope!['files_touched'] as unknown[]).filter((x): x is string => typeof x === 'string')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloverleaf/reference-impl",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "Reference implementation of the Cloverleaf methodology as Claude Code skills. Implements the Tight Loop (Implementer + Reviewer).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/prompts/plan.md
CHANGED
|
@@ -89,3 +89,11 @@ Dependencies:
|
|
|
89
89
|
**How to compute the diff inline:**
|
|
90
90
|
- **Logical** edges: edges you explicitly declared in `task_dag.edges` for sequencing reasons.
|
|
91
91
|
- **Inferred from file overlap**: edges the system will auto-compute by comparing `scope.files_touched` across tasks. For the summary, compute these yourself: for each pair of tasks (A, B) where A has lower task-number, if `scope.files_touched` sets overlap, list an inferred edge A → B with the overlapping paths. Do NOT add these to `task_dag.edges` — list them only in this summary so the human can sanity-check before approval.
|
|
92
|
+
|
|
93
|
+
**Partial-scope warning:** Count the tasks where `scope.files_touched` is absent or an empty array. If that count is greater than zero, append the following warning line at the bottom of the gate-pending summary (substituting the actual task IDs), then add an advisory note that the walker will silent-skip scope enforcement on those tasks:
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
⚠ Tasks without scope.files_touched: <CLV-XX, CLV-YY>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Omit this warning line entirely when every task has a non-empty `scope.files_touched`.
|
|
@@ -111,11 +111,23 @@ description: Autonomous DAG walker for Cloverleaf Plans. Given a PLAN-ID in stat
|
|
|
111
111
|
|
|
112
112
|
Record the returned `session_id`, `worktree_path`, and `branch_name` in walk-state with `state: "running"`, `started_at: <now>`, `last_seq: 0`. Persist via `walk-state-write`.
|
|
113
113
|
|
|
114
|
-
Immediately after `mcp__claw-drive__start_session` returns,
|
|
114
|
+
Immediately after `mcp__claw-drive__start_session` returns, read the `notification_contract` from the session response and validate it:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
IDLE_AFTER=$(echo "$START_SESSION_RESPONSE" | jq -r '.notification_contract.idle_after_seconds // 600')
|
|
118
|
+
EXPECTED_TOKENS="DONE NEEDS-INPUT"
|
|
119
|
+
for tok in $EXPECTED_TOKENS; do
|
|
120
|
+
if ! echo "$START_SESSION_RESPONSE" | jq -e ".notification_contract.vocabulary | index(\"$tok\")" > /dev/null 2>&1; then
|
|
121
|
+
echo "WARNING: notification_contract.vocabulary missing expected token '$tok' — vocab drift detected" >&2
|
|
122
|
+
fi
|
|
123
|
+
done
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Then attach a Monitor tool stream for the new session:
|
|
115
127
|
|
|
116
128
|
```
|
|
117
129
|
Monitor(
|
|
118
|
-
watch_command: "claw-drive watch <session_id> --since 0 --idle-after
|
|
130
|
+
watch_command: "claw-drive watch <session_id> --since 0 --idle-after $IDLE_AFTER",
|
|
119
131
|
persistent: true,
|
|
120
132
|
timeout_ms: 3600000
|
|
121
133
|
)
|
|
@@ -127,13 +139,13 @@ description: Autonomous DAG walker for Cloverleaf Plans. Given a PLAN-ID in stat
|
|
|
127
139
|
|
|
128
140
|
```
|
|
129
141
|
Monitor(
|
|
130
|
-
watch_command: "claw-drive watch <session_id> --since <last_seq> --idle-after
|
|
142
|
+
watch_command: "claw-drive watch <session_id> --since <last_seq> --idle-after $IDLE_AFTER",
|
|
131
143
|
persistent: true,
|
|
132
144
|
timeout_ms: 3600000
|
|
133
145
|
)
|
|
134
146
|
```
|
|
135
147
|
|
|
136
|
-
The `--idle-after
|
|
148
|
+
The `--idle-after $IDLE_AFTER` flag instructs claw-drive to emit a synthetic `idle` event if a session produces no output for `$IDLE_AFTER` seconds, enabling the walker to detect stalled sessions without polling.
|
|
137
149
|
|
|
138
150
|
d. **Handle events.** Dispatch each incoming Monitor event by type:
|
|
139
151
|
|
|
@@ -342,3 +354,7 @@ The concrete policy JSON is the same one used during the CLV-16..CLV-20 dogfood
|
|
|
342
354
|
- Final-gate drain is serial across tasks — one prompt, one decision.
|
|
343
355
|
- The walker exits after the loop reports the final status; it does not auto-retry escalated tasks.
|
|
344
356
|
- Scope-contested merges are escalated, never auto-resolved.
|
|
357
|
+
|
|
358
|
+
## Notes
|
|
359
|
+
|
|
360
|
+
**Vocab dependency.** The walker reads `notification_contract.vocabulary` from the `start_session` response advisorily — if the expected tokens (`DONE`, `NEEDS-INPUT`) are absent it warns to stderr but continues. The authoritative source of truth for which tokens Session B will emit is the SDK's `--driven-tokens` flag passed when claw-drive spawns the session. A mismatch between the contract and the actual flag signals a version skew between the claw-drive server and the reference-impl skill; upgrade both components together to keep them in sync.
|