@openplaybooks/converge 0.2.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/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@openplaybooks/converge",
3
+ "version": "0.2.0",
4
+ "private": false,
5
+ "type": "module",
6
+ "description": "CLI for Converge - A build system for AI agents",
7
+ "license": "MIT",
8
+ "author": "Converge Framework Contributors",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/openplaybooks-dev/converge.git",
12
+ "directory": "packages/cli"
13
+ },
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "keywords": [
18
+ "cli",
19
+ "converge",
20
+ "ai-agent",
21
+ "automation",
22
+ "orchestration"
23
+ ],
24
+ "bin": {
25
+ "converge": "./dist/index.js"
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "skills"
30
+ ],
31
+ "dependencies": {
32
+ "@anthropic-ai/claude-agent-sdk": "^0.2.0",
33
+ "@clack/prompts": "^0.9.1",
34
+ "glob": "^11.1.0",
35
+ "yaml": "^2.8.3",
36
+ "@openplaybooks/agentfn": "0.2.0",
37
+ "@openplaybooks/converge-core": "0.2.0",
38
+ "@openplaybooks/deepcodefn": "0.1.0",
39
+ "@openplaybooks/claudefn": "0.1.0",
40
+ "@openplaybooks/openfn": "^0.1.0",
41
+ "@openplaybooks/codexfn": "0.1.0"
42
+ },
43
+ "devDependencies": {
44
+ "@types/node": "^22.0.0",
45
+ "tsup": "^8.5.1",
46
+ "typescript": "^5.7.0",
47
+ "vitest": "^4.0.18"
48
+ },
49
+ "scripts": {
50
+ "build": "tsup",
51
+ "test": "vitest run",
52
+ "converge": "tsx src/main.ts"
53
+ }
54
+ }
@@ -0,0 +1,208 @@
1
+ ---
2
+ name: converge-control
3
+ description: Use when the user wants to run a converge playbook, monitor execution, inspect status, diagnose failures, or re-run after changes. Triggers on "run my playbook", "monitor this run", "converge failed", "what's the status", "retry failures", or "babysit this playbook".
4
+ ---
5
+
6
+ # Converge Control
7
+
8
+ ## Purpose
9
+
10
+ Run, monitor, and unblock a playbook using the **current** Converge runtime surface.
11
+
12
+ This skill is for:
13
+
14
+ - starting a playbook run
15
+ - watching progress
16
+ - narrowing failures to one task / subtree
17
+ - using the built-in operator commands (`status`, `list`, `show`, `doctor`, `playbook validate`)
18
+ - re-running only what needs to move
19
+
20
+ This skill is **not** for authoring a new playbook or redesigning its task tree. That belongs to **`converge-planning`**.
21
+
22
+ ## Current mental model
23
+
24
+ Converge has three important layers:
25
+
26
+ 1. **Source blueprint** — `.converge/playbooks/<name>/`
27
+ Files like `playbook.yml`, `TASK.md`, `seed` scripts, templates, playbook-scoped skills.
28
+ 2. **Runtime state** — `.converge/journal/<playbook>/`, `.converge/inventory/<playbook>/`, `.converge/artifacts/<playbook>/`
29
+ Execution state, event stream, per-task forensics, spawned-task ledger, and produced outputs.
30
+ 3. **Operator surface** — the CLI
31
+ `run`, `status`, `list`, `show`, `inspect`, `doctor`, `playbook validate`, `clean`, `stop`.
32
+
33
+ The playbook is the source of truth. Do **not** hand-edit `runstate.json`, `manifest.json`, or journal files to "fix" a run.
34
+
35
+ ## Primary workflow
36
+
37
+ Use this loop unless a narrower recipe in `troubleshooting/playbook.md` fits exactly.
38
+
39
+ ### 1. Preflight the playbook
40
+
41
+ Validate the definition before running:
42
+
43
+ ```bash
44
+ converge playbook validate <name>
45
+ ```
46
+
47
+ If the user is editing tasks live and wants a pure preview of what would execute:
48
+
49
+ ```bash
50
+ converge run --playbook=<name> --dry
51
+ ```
52
+
53
+ Use `--dry` instead of teaching an explicit compile-first workflow by default. `compile` still exists as a compatibility command, but the modern operator path is `run --dry`.
54
+
55
+ ### 2. Start the run
56
+
57
+ ```bash
58
+ converge run --playbook=<name>
59
+ ```
60
+
61
+ Common narrowed runs:
62
+
63
+ ```bash
64
+ # Only changed work and downstream
65
+ converge run --playbook=<name> --select 'state:modified+'
66
+
67
+ # Retry failures and their downstream consumers
68
+ converge run --playbook=<name> --select 'result:error+'
69
+
70
+ # One task / subtree
71
+ converge run --playbook=<name> --select '03-build+'
72
+
73
+ # Fail fast when debugging one subtree
74
+ converge run --playbook=<name> --select '03-build+' --fail-fast
75
+ ```
76
+
77
+ ### 3. Watch the run
78
+
79
+ Primary operator views:
80
+
81
+ ```bash
82
+ converge status --playbook=<name>
83
+ converge list --playbook=<name> --exclude 'status:complete'
84
+ converge show gantt --playbook=<name>
85
+ converge show graph --playbook=<name> --detail
86
+ ```
87
+
88
+ Raw event stream:
89
+
90
+ ```bash
91
+ tail -f .converge/journal/<playbook>/events.jsonl
92
+ tail -f .converge/journal/<playbook>/events.jsonl | grep -E '(NODE_COMPLETE|NODE_FAIL|CHECK_FAIL|ERROR|CYCLE)'
93
+ ```
94
+
95
+ ### 4. If the run fails
96
+
97
+ First classify whether the problem is:
98
+
99
+ - **definition-shape** → `converge playbook validate <name>`
100
+ - **runtime-shape** → `converge doctor --playbook=<name>`
101
+ - **task / check-shape** → `converge inspect --playbook=<name> --task=<id>`
102
+ - **selection / graph-shape** → `converge list --playbook=<name> --select ...` or `converge show graph`
103
+
104
+ Then use the smallest surgical next step:
105
+
106
+ ```bash
107
+ # Inspect one failed task
108
+ converge inspect --playbook=<name> --task=<taskId>
109
+
110
+ # Health-check the runtime state
111
+ converge doctor --playbook=<name>
112
+
113
+ # Reset only the failed subtree
114
+ converge clean --playbook=<name> --select '<taskId>+'
115
+
116
+ # Re-run just failures
117
+ converge run --playbook=<name> --select 'result:error+'
118
+ ```
119
+
120
+ ### 5. If the run is stuck or orphaned
121
+
122
+ ```bash
123
+ converge stop --playbook=<name>
124
+ ```
125
+
126
+ Then restart with a narrowed selection if possible.
127
+
128
+ ## Preferred command set
129
+
130
+ Use these first. They reflect the actual CLI surface and current docs.
131
+
132
+ ```bash
133
+ # Run
134
+ converge run --playbook=<name>
135
+
136
+ # Preview
137
+ converge run --playbook=<name> --dry
138
+
139
+ # Current status tree
140
+ converge status --playbook=<name>
141
+
142
+ # Selection-aware listing
143
+ converge list --playbook=<name> --exclude 'status:complete'
144
+
145
+ # Graph / gantt / metrics / journal views
146
+ converge show graph --playbook=<name> --detail
147
+ converge show gantt --playbook=<name>
148
+ converge show metrics --playbook=<name> --by-model --top=5
149
+
150
+ # Forensics
151
+ converge inspect --playbook=<name> --task=<taskId>
152
+
153
+ # Definition health
154
+ converge playbook validate <name>
155
+
156
+ # Runtime health
157
+ converge doctor --playbook=<name>
158
+
159
+ # Surgical cleanup
160
+ converge clean --playbook=<name> --select '<taskId>+'
161
+
162
+ # Stop a live / stale run
163
+ converge stop --playbook=<name>
164
+ ```
165
+
166
+ ## When to use compatibility commands
167
+
168
+ These still exist, but they are not the first teaching surface:
169
+
170
+ - `converge compile` → compatibility / low-level preview path
171
+ - `converge build` → `run --fail-fast`
172
+ - `converge retry` → `run --resume`
173
+ - `converge test` → checks-only execution
174
+
175
+ Use them when the user explicitly asks for them or when a fixture / test / older note already uses them.
176
+
177
+ ## Hard rules
178
+
179
+ - **Prefer `run --dry` over teaching `compile` first.**
180
+ - **Always scope with `--playbook=<name>` when more than one playbook exists.**
181
+ - **Use `doctor` for runtime-health questions.**
182
+ - **Use `playbook validate` for definition-health questions.**
183
+ - **Use `inspect --task=<id>` before proposing a novel fix.**
184
+ - **Use `clean --select` instead of deleting `.converge/journal/` or `.converge/inventory/` by hand.**
185
+ - **Use `stop` instead of ad-hoc `pkill` when possible.**
186
+ - **Do not edit generated runtime state. Fix the playbook source or the project inputs.**
187
+ - **If the failure is in user domain code or missing credentials, surface it clearly instead of inventing framework fixes.**
188
+
189
+ ## Hand-off rules
190
+
191
+ | Situation | Hand off to |
192
+ |---|---|
193
+ | User wants to design or restructure a playbook | `converge-planning` |
194
+ | User wants to debug framework code under `packages/` | `converge-development` |
195
+ | Failure is novel and crosses framework/runtime boundaries | user escalation with evidence |
196
+
197
+ ## File map
198
+
199
+ ```
200
+ SKILL.md
201
+ reference/
202
+ cli.md
203
+ events.md
204
+ troubleshooting/
205
+ playbook.md
206
+ ```
207
+
208
+ Load `reference/cli.md` for concrete command patterns, `reference/events.md` for event interpretation, and `troubleshooting/playbook.md` only when a concrete failure fingerprint matches.
@@ -0,0 +1,128 @@
1
+ # Converge CLI — operator cheatsheet
2
+
3
+ The commands you actually use while running and babysitting a playbook.
4
+
5
+ For the canonical contract, prefer:
6
+
7
+ ```bash
8
+ converge <command> --help
9
+ ```
10
+
11
+ ## Recommended invocation style
12
+
13
+ Prefer explicit playbook scoping:
14
+
15
+ ```bash
16
+ converge run --playbook=<name>
17
+ converge status --playbook=<name>
18
+ converge list --playbook=<name>
19
+ ```
20
+
21
+ Path-based invocation also exists, but `--playbook=<name>` is the clearer operator shape for the current docs and README.
22
+
23
+ ## Run / preview
24
+
25
+ ```bash
26
+ # Full run
27
+ converge run --playbook=<name>
28
+
29
+ # Preview only
30
+ converge run --playbook=<name> --dry
31
+
32
+ # Changed work + downstream
33
+ converge run --playbook=<name> --select 'state:modified+'
34
+
35
+ # Retry failures
36
+ converge run --playbook=<name> --select 'result:error+'
37
+
38
+ # One subtree
39
+ converge run --playbook=<name> --select '03-build+'
40
+
41
+ # Fail fast while debugging
42
+ converge run --playbook=<name> --select '03-build+' --fail-fast
43
+ ```
44
+
45
+ ## Status / visualization
46
+
47
+ ```bash
48
+ # Current task tree
49
+ converge status --playbook=<name>
50
+
51
+ # Incomplete tasks only
52
+ converge list --playbook=<name> --exclude 'status:complete'
53
+
54
+ # DAG graph
55
+ converge show graph --playbook=<name> --detail
56
+
57
+ # Timeline
58
+ converge show gantt --playbook=<name>
59
+
60
+ # Cost / model view
61
+ converge show metrics --playbook=<name> --by-model --top=5
62
+ ```
63
+
64
+ ## Forensics / health
65
+
66
+ ```bash
67
+ # One failed task
68
+ converge inspect --playbook=<name> --task=<taskId>
69
+
70
+ # Runtime health
71
+ converge doctor --playbook=<name>
72
+
73
+ # Definition health
74
+ converge playbook validate <name>
75
+ ```
76
+
77
+ ## Reset / stop
78
+
79
+ ```bash
80
+ # Reset one subtree
81
+ converge clean --playbook=<name> --select '<taskId>+'
82
+
83
+ # Stop live or stale run
84
+ converge stop --playbook=<name>
85
+ ```
86
+
87
+ ## Selection patterns
88
+
89
+ ```bash
90
+ # One task
91
+ --select '03-build'
92
+
93
+ # One task + descendants
94
+ --select '03-build+'
95
+
96
+ # Ancestors + node
97
+ --select '+03-build'
98
+
99
+ # Full lineage
100
+ --select '+03-build+'
101
+
102
+ # Errors and downstream
103
+ --select 'result:error+'
104
+
105
+ # Changed and downstream
106
+ --select 'state:modified+'
107
+
108
+ # Subtract completed work
109
+ --exclude 'status:complete'
110
+ ```
111
+
112
+ ## Compatibility commands
113
+
114
+ These commands still exist but are not the primary operator teaching surface:
115
+
116
+ ```bash
117
+ converge compile ...
118
+ converge build ...
119
+ converge retry ...
120
+ converge test ...
121
+ ```
122
+
123
+ Map them mentally to:
124
+
125
+ - `compile` → low-level preview / compatibility
126
+ - `build` → `run --fail-fast`
127
+ - `retry` → `run --resume`
128
+ - `test` → checks-only execution
@@ -0,0 +1,165 @@
1
+ # Converge run output — event catalog
2
+
3
+ Every distinct event that appears in the `events.jsonl` stream, what it means, what to do.
4
+
5
+ Use this when:
6
+
7
+ - Composing the Monitor `grep -E` filter
8
+ - Classifying an event during a run
9
+ - Debugging "what was happening when the run stopped?"
10
+
11
+ ## How to read this file
12
+
13
+ Each entry is:
14
+
15
+ ```
16
+ <event token (from events.jsonl)>
17
+ <one-line meaning>
18
+ → <action>
19
+ ```
20
+
21
+ Events are newline-delimited JSON objects in `.converge/journal/<playbook>/events.jsonl`. Each object has a `type` field.
22
+
23
+ ## Recommended Monitor filter
24
+
25
+ ```bash
26
+ tail -f .converge/journal/<playbook>/events.jsonl | grep -E '(NODE_START|NODE_COMPLETE|NODE_FAIL|CHECK_FAIL|DAG_LAYER|CYCLE|ERROR)'
27
+ ```
28
+
29
+ This catches all structural signals. Drop `NODE_START` and `DAG_LAYER` for a quieter feed:
30
+
31
+ ```bash
32
+ tail -f .converge/journal/<playbook>/events.jsonl | grep -E '(NODE_COMPLETE|NODE_FAIL|CHECK_FAIL|CYCLE|ERROR)'
33
+ ```
34
+
35
+ ---
36
+
37
+ ## Progress signals — keep watching
38
+
39
+ ```
40
+ NODE_START <nodeId>
41
+ ```
42
+ A node began execution. Forward progress.
43
+ → continue.
44
+
45
+ ```
46
+ NODE_COMPLETE <nodeId> cached
47
+ ```
48
+ Node's fingerprint matched the previous runstate. Skipped execution — outputs from the prior run are reused.
49
+ → continue. This is the common case for incremental runs.
50
+
51
+ ```
52
+ NODE_COMPLETE <nodeId> fresh
53
+ ```
54
+ Node executed and all checks passed. Outputs written and verified.
55
+ → continue.
56
+
57
+ ```
58
+ DAG_LAYER 3/7
59
+ ```
60
+ Executing topological layer 3 of 7. Nodes within a layer are independent and may run in parallel.
61
+ → continue. Progress signal.
62
+
63
+ ```
64
+ CHECK_PASS <nodeId> <checkId>
65
+ ```
66
+ A single check passed. Useful when watching a specific node's checks.
67
+ → continue.
68
+
69
+ ---
70
+
71
+ ## Node lifecycle — normal
72
+
73
+ ```
74
+ SEED_SPAWN <parentId> → [<childId>, ...]
75
+ ```
76
+ A seed function spawned child nodes into the DAG.
77
+ → continue. New nodes will appear in subsequent DAG_LAYER events.
78
+
79
+ ```
80
+ ATTEMPT <nodeId> 2/3
81
+ ```
82
+ Second attempt on this node. The AI agent read FEEDBACK.md and LEARN.md from attempt 1 and is retrying.
83
+ → continue unless attempt 3 arrives with the same failures.
84
+
85
+ ---
86
+
87
+ ## Structural failures — diagnose now
88
+
89
+ ```
90
+ CHECK_FAIL <nodeId> <checkId>
91
+ ```
92
+ A check failed on this attempt. The node may still converge on retry.
93
+ → if followed by NODE_COMPLETE on retry, it self-recovered. If repeated across all attempts for the same node, diagnose.
94
+
95
+ ```
96
+ NODE_FAIL <nodeId> <reason>
97
+ ```
98
+ Node failed all attempts. The runner will not retry. Downstream nodes are blocked.
99
+ → stop. Read `.converge/journal/<playbook>/tasks/<nodeId>/FEEDBACK.md` and `LEARN.md`. Apply a fix from `troubleshooting/playbook.md` or surface to the user.
100
+
101
+ ```
102
+ CYCLE_DETECTED [id1 → id2 → id3 → id1]
103
+ ```
104
+ A dependency cycle was found during compilation. The DAG is invalid.
105
+ → trace the `depends_on` edges between the listed nodes. Remove the edge that creates the cycle. Re-compile.
106
+
107
+ ```
108
+ FRONTIER_UNRESOLVED <nodeId>
109
+ ```
110
+ A seed parent was expected to spawn children (declared via `from_seed` with a catalog upstream) but produced no children. The catalog may be empty or the seed script errored.
111
+ → check the upstream catalog file. Check the seed script for errors. Re-compile with `--seed`.
112
+
113
+ ```
114
+ INPUT_MISSING <nodeId> <path>
115
+ ```
116
+ A node's declared `inputs:` file doesn't exist on disk. The upstream producer may have failed or the path is wrong.
117
+ → check whether the upstream node completed successfully. If the path is stale, fix the TASK.md `inputs:` and re-compile.
118
+
119
+ ---
120
+
121
+ ## Transients — runner handles, do nothing
122
+
123
+ ```
124
+ ERROR <provider>: API Error: 529 Overloaded
125
+ ERROR <provider>: network timeout
126
+ ```
127
+ Provider overload or transient network issue. Runner retries automatically.
128
+ → continue. Don't kill the run.
129
+
130
+ ## Run-level events
131
+
132
+ ```
133
+ RUN_START <playbook> <manifestHash>
134
+ ```
135
+ Run began. The manifest hash identifies which compiled DAG is being executed.
136
+ → continue.
137
+
138
+ ```
139
+ RUN_COMPLETE <playbook>
140
+ ```
141
+ All nodes completed. Run succeeded.
142
+ → verify final state with `converge list --playbook=<name>`.
143
+
144
+ ```
145
+ RUN_CANCELLED <playbook>
146
+ ```
147
+ Run was interrupted (SIGTERM, process kill). `runstate.json` was saved — resuming is automatic.
148
+ → re-launch with the same command. Completed nodes are cached.
149
+
150
+ ---
151
+
152
+ ## Quick action lookup
153
+
154
+ | You see... | You do... |
155
+ |---|---|
156
+ | `NODE_COMPLETE cached` | Nothing — it's a cache hit |
157
+ | `NODE_FAIL <id>` | Read FEEDBACK.md / LEARN.md, diagnose |
158
+ | `CYCLE_DETECTED` | Fix `depends_on` edges, re-compile |
159
+ | `FRONTIER_UNRESOLVED` | Check upstream catalog, check seed script |
160
+ | `INPUT_MISSING` | Check upstream node status, fix path |
161
+ | `CHECK_FAIL` once then `NODE_COMPLETE` on retry | Self-recovered — continue |
162
+ | `CHECK_FAIL` repeating across all attempts | Diagnose — load `troubleshooting/playbook.md` |
163
+ | `ERROR <provider>: API Error: 529` | Nothing — runner retries |
164
+ | Run process exits 0 | Verify with `converge list` |
165
+ | Run process exits non-zero | Tail last 30 events, find the NODE_FAIL |