@openrig/cli 0.1.7 → 0.1.9

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 (50) hide show
  1. package/daemon/dist/adapters/claude-code-adapter.d.ts +1 -0
  2. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  3. package/daemon/dist/adapters/claude-code-adapter.js +10 -0
  4. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  5. package/daemon/dist/adapters/cmux.d.ts.map +1 -1
  6. package/daemon/dist/adapters/cmux.js +1 -0
  7. package/daemon/dist/adapters/cmux.js.map +1 -1
  8. package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
  9. package/daemon/dist/domain/native-resume-probe.js +11 -0
  10. package/daemon/dist/domain/native-resume-probe.js.map +1 -1
  11. package/daemon/dist/startup.d.ts.map +1 -1
  12. package/daemon/dist/startup.js +14 -0
  13. package/daemon/dist/startup.js.map +1 -1
  14. package/daemon/docs/reference/agent-spec.md +411 -0
  15. package/daemon/docs/reference/agent-startup-guide.md +339 -0
  16. package/daemon/docs/reference/edge-types.md +126 -0
  17. package/daemon/docs/reference/rig-spec.md +474 -0
  18. package/daemon/specs/agents/shared/agent.yaml +2 -0
  19. package/daemon/specs/agents/shared/skills/rig-architect/SKILL.md +332 -0
  20. package/dist/bin-wrapper.d.ts +1 -0
  21. package/dist/bin-wrapper.d.ts.map +1 -1
  22. package/dist/bin-wrapper.js +41 -1
  23. package/dist/bin-wrapper.js.map +1 -1
  24. package/dist/commands/bootstrap.js +1 -1
  25. package/dist/commands/bootstrap.js.map +1 -1
  26. package/dist/commands/docs.d.ts +3 -0
  27. package/dist/commands/docs.d.ts.map +1 -0
  28. package/dist/commands/docs.js +55 -0
  29. package/dist/commands/docs.js.map +1 -0
  30. package/dist/commands/doctor.d.ts +6 -1
  31. package/dist/commands/doctor.d.ts.map +1 -1
  32. package/dist/commands/doctor.js +53 -10
  33. package/dist/commands/doctor.js.map +1 -1
  34. package/dist/commands/setup.d.ts +39 -0
  35. package/dist/commands/setup.d.ts.map +1 -0
  36. package/dist/commands/setup.js +345 -0
  37. package/dist/commands/setup.js.map +1 -0
  38. package/dist/commands/up.d.ts.map +1 -1
  39. package/dist/commands/up.js +6 -2
  40. package/dist/commands/up.js.map +1 -1
  41. package/dist/daemon-lifecycle.d.ts +7 -0
  42. package/dist/daemon-lifecycle.d.ts.map +1 -1
  43. package/dist/daemon-lifecycle.js +45 -8
  44. package/dist/daemon-lifecycle.js.map +1 -1
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +2 -0
  47. package/dist/index.js.map +1 -1
  48. package/dist/mcp-server.js +1 -1
  49. package/dist/mcp-server.js.map +1 -1
  50. package/package.json +1 -1
@@ -0,0 +1,411 @@
1
+ # AgentSpec Reference
2
+
3
+ Version: 1.0
4
+ Last validated against code: 2026-04-11
5
+ Source of truth: `packages/daemon/src/domain/agent-manifest.ts`, `packages/daemon/src/domain/types.ts`
6
+
7
+ This is the canonical reference for the AgentSpec YAML format (`agent.yaml`). Every field, validation rule, and default documented here was traced from the actual parser and validator code.
8
+
9
+ ---
10
+
11
+ ## Minimal Valid Example
12
+
13
+ ```yaml
14
+ name: my-agent
15
+ version: "1.0"
16
+
17
+ profiles:
18
+ default:
19
+ uses:
20
+ skills: []
21
+ guidance: []
22
+ subagents: []
23
+ hooks: []
24
+ runtime_resources: []
25
+
26
+ resources: {}
27
+
28
+ startup:
29
+ files: []
30
+ actions: []
31
+ ```
32
+
33
+ ## Practical Example (implementer agent)
34
+
35
+ ```yaml
36
+ name: implementer
37
+ version: "1.0"
38
+ description: Implementation agent — writes code following TDD discipline
39
+
40
+ defaults:
41
+ runtime: claude-code
42
+
43
+ imports:
44
+ - ref: local:../../shared
45
+
46
+ profiles:
47
+ default:
48
+ uses:
49
+ skills: [using-superpowers, openrig-user, development-team, test-driven-development, mental-model-ha]
50
+ guidance: []
51
+ subagents: []
52
+ hooks: []
53
+ runtime_resources: []
54
+
55
+ resources:
56
+ guidance:
57
+ - id: role
58
+ path: guidance/role.md
59
+
60
+ startup:
61
+ files:
62
+ - path: guidance/role.md
63
+ delivery_hint: send_text
64
+ required: true
65
+ actions: []
66
+ ```
67
+
68
+ ## Complete Example (all features)
69
+
70
+ ```yaml
71
+ name: vault-specialist
72
+ version: "1.0"
73
+ description: Vault specialist agent — manages HashiCorp Vault for this managed app
74
+
75
+ defaults:
76
+ runtime: claude-code
77
+ model: claude-opus-4-6
78
+ lifecycle:
79
+ execution_mode: interactive_resident
80
+ compaction_strategy: harness_native
81
+ restore_policy: resume_if_possible
82
+
83
+ imports:
84
+ - ref: local:../../shared
85
+ - ref: local:../common-tools
86
+ version: "2.0"
87
+
88
+ profiles:
89
+ default:
90
+ summary: Standard Vault operations profile
91
+ preferences:
92
+ runtime: claude-code
93
+ uses:
94
+ skills: [openrig-user, mental-model-ha, vault-user]
95
+ guidance: []
96
+ subagents: []
97
+ hooks: []
98
+ runtime_resources: []
99
+ startup:
100
+ files:
101
+ - path: guidance/profile-specific.md
102
+ delivery_hint: send_text
103
+ actions: []
104
+ lifecycle:
105
+ restore_policy: resume_if_possible
106
+
107
+ resources:
108
+ skills:
109
+ - id: vault-user
110
+ path: skills/vault-user
111
+ guidance:
112
+ - id: role
113
+ path: guidance/role.md
114
+ hooks:
115
+ - id: pre-commit
116
+ path: hooks/pre-commit.sh
117
+ runtimes: [claude-code]
118
+ runtime_resources:
119
+ - id: claude-settings
120
+ path: runtime/claude-settings.json
121
+ runtime: claude-code
122
+ type: settings
123
+
124
+ startup:
125
+ files:
126
+ - path: guidance/role.md
127
+ delivery_hint: send_text
128
+ required: true
129
+ - path: startup/context.md
130
+ delivery_hint: send_text
131
+ required: true
132
+ - path: guidance/optional-tips.md
133
+ delivery_hint: guidance_merge
134
+ required: false
135
+ applies_on: [fresh_start]
136
+ actions:
137
+ - type: send_text
138
+ value: "Load vault-user skill and verify Vault health."
139
+ phase: after_ready
140
+ idempotent: true
141
+ ```
142
+
143
+ ---
144
+
145
+ ## Top-Level Fields
146
+
147
+ | Field | Type | Required | Default | Description |
148
+ |-------|------|----------|---------|-------------|
149
+ | `name` | string | yes | — | Agent name. Used in spec library identification and validation messages. |
150
+ | `version` | string | yes | — | Spec version. Informational — not used for compatibility gating. |
151
+ | `description` | string | no | — | Human-readable description. Shown in spec library and review surfaces. |
152
+ | `defaults` | Defaults | no | — | Default runtime, model, and lifecycle settings. Applied when not overridden by the rig spec or profile. |
153
+ | `imports` | Import[] | no | `[]` | Other AgentSpecs to import. Resources from imported specs become available for profile `uses` references. |
154
+ | `profiles` | map<string, Profile> | no | `{}` | Named profiles. Each profile selects resources and can override startup/lifecycle. The rig spec member's `profile` field selects which profile to use. |
155
+ | `resources` | Resources | no | all empty | Declared resources (skills, guidance, subagents, hooks, runtime resources). These are the available pool that profiles select from via `uses`. |
156
+ | `startup` | StartupBlock | no | `{ files: [], actions: [] }` | Agent-level startup files and actions. Applied to all profiles via the startup layering model. |
157
+
158
+ ---
159
+
160
+ ## Defaults
161
+
162
+ ```yaml
163
+ defaults:
164
+ runtime: claude-code
165
+ model: claude-opus-4-6
166
+ lifecycle:
167
+ execution_mode: interactive_resident
168
+ compaction_strategy: harness_native
169
+ restore_policy: resume_if_possible
170
+ ```
171
+
172
+ | Field | Type | Required | Default | Description |
173
+ |-------|------|----------|---------|-------------|
174
+ | `runtime` | string | no | — | Default runtime for this agent. Can be overridden by the rig spec member's `runtime` field. |
175
+ | `model` | string | no | — | Default model. Can be overridden by the rig spec member's `model` field. |
176
+ | `lifecycle` | Lifecycle | no | see below | Lifecycle behavior defaults. |
177
+
178
+ ### Lifecycle Defaults
179
+
180
+ | Field | Type | Default | Allowed Values |
181
+ |-------|------|---------|----------------|
182
+ | `execution_mode` | string | `interactive_resident` | `interactive_resident` (only value in v1; `wake_on_demand` is explicitly rejected) |
183
+ | `compaction_strategy` | string | `harness_native` | `harness_native`, `pod_continuity` (`custom_prompt` is explicitly rejected in v1) |
184
+ | `restore_policy` | string | `resume_if_possible` | `resume_if_possible`, `relaunch_fresh`, `checkpoint_only` |
185
+
186
+ ---
187
+
188
+ ## Imports
189
+
190
+ ```yaml
191
+ imports:
192
+ - ref: local:../../shared
193
+ - ref: local:../common-tools
194
+ version: "2.0"
195
+ ```
196
+
197
+ | Field | Type | Required | Description |
198
+ |-------|------|----------|-------------|
199
+ | `ref` | string | yes | Reference to another AgentSpec directory. Must start with `local:` (relative) or `path:` (absolute). The referenced directory must contain an `agent.yaml`. |
200
+ | `version` | string | no | Optional version constraint. Must be an exact version — no ranges (`~`, `^`, `>=`, etc.). |
201
+
202
+ ### Import Resolution
203
+
204
+ - `local:` paths resolve relative to the importing spec's directory
205
+ - `path:` paths are absolute filesystem paths
206
+ - Imported resources become available for `uses` references in profiles
207
+ - When referencing imported resources in `uses`, use qualified `namespace:id` format (e.g., `shared:openrig-user`)
208
+ - Unqualified references (just `id`) resolve against the spec's own local resources first
209
+
210
+ ### The Shared Import Pattern
211
+
212
+ Most built-in agents import the shared builtin spec:
213
+
214
+ ```yaml
215
+ imports:
216
+ - ref: local:../../shared
217
+ ```
218
+
219
+ This gives access to the full pool of shared skills (openrig-user, mental-model-ha, development-team, etc.) and agents select the ones they need via profile `uses`.
220
+
221
+ ---
222
+
223
+ ## Profiles
224
+
225
+ ```yaml
226
+ profiles:
227
+ default:
228
+ summary: Standard operations profile
229
+ preferences:
230
+ runtime: claude-code
231
+ model: claude-opus-4-6
232
+ uses:
233
+ skills: [openrig-user, mental-model-ha, vault-user]
234
+ guidance: [role]
235
+ subagents: []
236
+ hooks: []
237
+ runtime_resources: []
238
+ startup:
239
+ files: []
240
+ actions: []
241
+ lifecycle:
242
+ restore_policy: resume_if_possible
243
+ ```
244
+
245
+ | Field | Type | Required | Default | Description |
246
+ |-------|------|----------|---------|-------------|
247
+ | `summary` | string | no | — | Profile description. |
248
+ | `preferences` | object | no | — | Runtime/model preferences for this profile. |
249
+ | `preferences.runtime` | string | no | — | Preferred runtime. |
250
+ | `preferences.model` | string | no | — | Preferred model. |
251
+ | `uses` | Uses | no | all empty | Selects which declared resources are active for this profile. |
252
+ | `startup` | StartupBlock | no | — | Profile-level startup files and actions. Merged with agent-level startup via layering. |
253
+ | `lifecycle` | Lifecycle | no | — | Profile-level lifecycle overrides. |
254
+
255
+ ### Uses
256
+
257
+ The `uses` block selects which resources from the `resources` pool (including imported resources) are active for this profile.
258
+
259
+ ```yaml
260
+ uses:
261
+ skills: [openrig-user, mental-model-ha, vault-user]
262
+ guidance: [role]
263
+ subagents: []
264
+ hooks: [pre-commit]
265
+ runtime_resources: [claude-settings]
266
+ ```
267
+
268
+ Each array contains resource IDs. These can be:
269
+ - **Unqualified** (`vault-user`) — resolves against the spec's own `resources` first, then imported specs
270
+ - **Qualified** (`shared:openrig-user`) — resolves against a specific imported spec's resources
271
+
272
+ The `uses` categories are: `skills`, `guidance`, `subagents`, `hooks`, `runtime_resources`.
273
+
274
+ ---
275
+
276
+ ## Resources
277
+
278
+ ```yaml
279
+ resources:
280
+ skills:
281
+ - id: vault-user
282
+ path: skills/vault-user
283
+ guidance:
284
+ - id: role
285
+ path: guidance/role.md
286
+ subagents:
287
+ - id: helper
288
+ path: subagents/helper
289
+ hooks:
290
+ - id: pre-commit
291
+ path: hooks/pre-commit.sh
292
+ runtimes: [claude-code]
293
+ runtime_resources:
294
+ - id: claude-settings
295
+ path: runtime/claude-settings.json
296
+ runtime: claude-code
297
+ type: settings
298
+ ```
299
+
300
+ Resources are the available pool. They are NOT automatically delivered to agents — profiles select them via `uses`. The only resources delivered are those that the active profile's `uses` block references.
301
+
302
+ ### Resource Categories
303
+
304
+ | Category | Fields | Description |
305
+ |----------|--------|-------------|
306
+ | `skills` | `id`, `path` | Skill directories containing a SKILL.md. Delivered via `skill_install`. |
307
+ | `guidance` | `id`, `path`, `target`*, `merge`* | Guidance files. Delivered via `guidance_merge` into CLAUDE.md/AGENTS.md. |
308
+ | `subagents` | `id`, `path` | Subagent definitions. |
309
+ | `hooks` | `id`, `path`, `runtimes`* | Hook scripts. Optional `runtimes` array restricts to specific runtimes. |
310
+ | `runtime_resources` | `id`, `path`, `runtime`, `type` | Runtime-specific resources. `runtime` and `type` are required. |
311
+
312
+ *Fields marked with `*` are optional.
313
+
314
+ ### Resource Path Rules
315
+
316
+ - All resource paths must be safe relative paths (no `..` traversal, no absolute paths)
317
+ - Paths resolve relative to the agent spec's directory
318
+ - Resource IDs must be unique within their category
319
+ - Resource IDs are the identifiers used in `uses` references
320
+
321
+ ### Guidance Resources
322
+
323
+ ```yaml
324
+ guidance:
325
+ - id: role
326
+ path: guidance/role.md
327
+ target: CLAUDE.md # optional — where to merge
328
+ merge: managed_block # optional — how to merge (default: managed_block)
329
+ ```
330
+
331
+ | Field | Type | Required | Default | Description |
332
+ |-------|------|----------|---------|-------------|
333
+ | `id` | string | yes | — | Resource identifier. |
334
+ | `path` | string | yes | — | Relative path to the guidance file. |
335
+ | `target` | string | no | — | Target file for merging (e.g., `CLAUDE.md`). |
336
+ | `merge` | string | no | `managed_block` | Merge strategy. One of: `managed_block`, `append`. |
337
+
338
+ ---
339
+
340
+ ## Startup Block
341
+
342
+ The startup block follows the same format as in the RigSpec (see `docs/reference/rig-spec.md` for full details on files and actions).
343
+
344
+ Agent-level startup is applied to all profiles. Profile-level startup is applied only when that profile is active. Both merge additively via the startup layering model.
345
+
346
+ ### Delivery Hint Quick Reference
347
+
348
+ | Hint | When Delivered | Mechanism |
349
+ |------|---------------|-----------|
350
+ | `auto` | Before harness boot | System chooses based on file type |
351
+ | `guidance_merge` | Before harness boot | Merged into CLAUDE.md/AGENTS.md as managed block |
352
+ | `skill_install` | Before harness boot | Installed to runtime skill directory |
353
+ | `send_text` | After harness is ready | Sent as text to agent terminal via tmux |
354
+
355
+ ---
356
+
357
+ ## Validation Rules Summary
358
+
359
+ 1. `name` and `version` are required non-empty strings.
360
+ 2. `imports` must be an array of objects with `ref` field.
361
+ 3. Import `ref` must start with `local:` (relative) or `path:` (absolute).
362
+ 4. Import `version` must be an exact version (no ranges).
363
+ 5. `profiles` must be a map (object), not an array.
364
+ 6. Profile `uses` references must resolve to declared resources (local or imported).
365
+ 7. Unqualified `uses` references that don't resolve to local resources require imports to be present.
366
+ 8. Qualified `uses` references must be in `namespace:id` format.
367
+ 9. All resource paths must be safe relative paths.
368
+ 10. Resource IDs must be unique within their category.
369
+ 11. `runtime_resources` entries require `runtime` field.
370
+ 12. Lifecycle `execution_mode` must be `interactive_resident`.
371
+ 13. Lifecycle `compaction_strategy` must be `harness_native` or `pod_continuity`.
372
+ 14. Lifecycle `restore_policy` must be `resume_if_possible`, `relaunch_fresh`, or `checkpoint_only`.
373
+ 15. Startup files and actions follow the same validation rules as in RigSpec.
374
+
375
+ ---
376
+
377
+ ## File System Layout
378
+
379
+ An agent spec directory follows this conventional layout:
380
+
381
+ ```
382
+ my-agent/
383
+ agent.yaml # required — the AgentSpec
384
+ guidance/
385
+ role.md # role definition
386
+ startup/
387
+ context.md # boot-time grounding
388
+ skills/
389
+ my-skill/
390
+ SKILL.md # skill content
391
+ hooks/
392
+ pre-commit.sh # hook script
393
+ runtime/
394
+ claude-settings.json # runtime-specific resource
395
+ ```
396
+
397
+ The only required file is `agent.yaml`. Everything else is referenced by paths in the spec and must exist at those relative paths.
398
+
399
+ ---
400
+
401
+ ## Shipped Examples
402
+
403
+ | Agent | Location | Imports | Profile Skills | Purpose |
404
+ |-------|----------|---------|---------------|---------|
405
+ | `shared` | `specs/agents/shared/` | none | — (resource pool only) | Shared skill pool for all built-in agents |
406
+ | `implementer` | `specs/agents/development/implementer/` | `shared` | openrig-user, development-team, test-driven-development, mental-model-ha, etc. | TDD implementation agent |
407
+ | `qa` | `specs/agents/development/qa/` | `shared` | openrig-user, development-team, etc. | Quality assurance agent |
408
+ | `orchestrator` | `specs/agents/orchestration/orchestrator/` | `shared` | openrig-user, orchestration-team, etc. | Rig orchestration lead |
409
+ | `reviewer` | `specs/agents/review/reviewer/` | `shared` | openrig-user, review-team, etc. | Independent code reviewer |
410
+ | `vault-specialist` | `specs/agents/apps/vault-specialist/` | `shared` | openrig-user, mental-model-ha, vault-user | Vault domain specialist |
411
+ | `design` | `specs/agents/design/` | none | — | Product designer |