@openrig/cli 0.1.3 → 0.1.4

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 (89) hide show
  1. package/daemon/assets/guidance/openrig-start.md +16 -1
  2. package/daemon/dist/adapters/claude-code-adapter.d.ts +12 -0
  3. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  4. package/daemon/dist/adapters/claude-code-adapter.js +92 -3
  5. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  6. package/daemon/dist/adapters/codex-runtime-adapter.d.ts +5 -0
  7. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  8. package/daemon/dist/adapters/codex-runtime-adapter.js +82 -2
  9. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  10. package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
  11. package/daemon/dist/domain/native-resume-probe.js +24 -1
  12. package/daemon/dist/domain/native-resume-probe.js.map +1 -1
  13. package/daemon/dist/domain/runtime-adapter.d.ts +1 -0
  14. package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
  15. package/daemon/dist/domain/runtime-adapter.js.map +1 -1
  16. package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
  17. package/daemon/dist/domain/startup-orchestrator.js +10 -1
  18. package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
  19. package/daemon/specs/agents/analyst/agent.yaml +1 -0
  20. package/daemon/specs/agents/design/agent.yaml +2 -1
  21. package/daemon/specs/agents/design/guidance/role.md +13 -0
  22. package/daemon/specs/agents/impl/agent.yaml +2 -1
  23. package/daemon/specs/agents/impl/guidance/role.md +20 -0
  24. package/daemon/specs/agents/lead/agent.yaml +2 -1
  25. package/daemon/specs/agents/lead/guidance/role.md +18 -0
  26. package/daemon/specs/agents/qa/agent.yaml +2 -1
  27. package/daemon/specs/agents/qa/guidance/role.md +52 -0
  28. package/daemon/specs/agents/reviewer/agent.yaml +2 -1
  29. package/daemon/specs/agents/reviewer/guidance/role.md +13 -0
  30. package/daemon/specs/agents/shared/agent.yaml +28 -0
  31. package/daemon/specs/agents/shared/skills/agent-browser/LOCAL-INSIGHTS.md +189 -0
  32. package/daemon/specs/agents/shared/skills/agent-browser/SKILL.md +417 -0
  33. package/daemon/specs/agents/shared/skills/brainstorming/SKILL.md +96 -0
  34. package/daemon/specs/agents/shared/skills/containerized-e2e/SKILL.md +256 -0
  35. package/daemon/specs/agents/shared/skills/containerized-e2e/scripts/Dockerfile +39 -0
  36. package/daemon/specs/agents/shared/skills/containerized-e2e/scripts/build-e2e-image.sh +37 -0
  37. package/daemon/specs/agents/shared/skills/containerized-e2e/templates/control-plane-test.yaml +40 -0
  38. package/daemon/specs/agents/shared/skills/containerized-e2e/templates/e2e-report-template.md +94 -0
  39. package/daemon/specs/agents/shared/skills/containerized-e2e/templates/expansion-collision-fragment.yaml +13 -0
  40. package/daemon/specs/agents/shared/skills/containerized-e2e/templates/expansion-pod-fragment.yaml +14 -0
  41. package/daemon/specs/agents/shared/skills/development-team/SKILL.md +149 -0
  42. package/daemon/specs/agents/shared/skills/dogfood/SKILL.md +220 -0
  43. package/daemon/specs/agents/shared/skills/dogfood/references/issue-taxonomy.md +109 -0
  44. package/daemon/specs/agents/shared/skills/dogfood/templates/dogfood-report-template.md +53 -0
  45. package/daemon/specs/agents/shared/skills/executing-plans/SKILL.md +84 -0
  46. package/daemon/specs/agents/shared/skills/frontend-design/LICENSE.txt +177 -0
  47. package/daemon/specs/agents/shared/skills/frontend-design/SKILL.md +42 -0
  48. package/daemon/specs/agents/shared/skills/openrig-user/SKILL.md +262 -58
  49. package/daemon/specs/agents/shared/skills/orchestration-team/SKILL.md +234 -0
  50. package/daemon/specs/agents/shared/skills/review-team/SKILL.md +210 -0
  51. package/daemon/specs/agents/shared/skills/systematic-debugging/CREATION-LOG.md +119 -0
  52. package/daemon/specs/agents/shared/skills/systematic-debugging/SKILL.md +296 -0
  53. package/daemon/specs/agents/shared/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  54. package/daemon/specs/agents/shared/skills/systematic-debugging/condition-based-waiting.md +115 -0
  55. package/daemon/specs/agents/shared/skills/systematic-debugging/defense-in-depth.md +122 -0
  56. package/daemon/specs/agents/shared/skills/systematic-debugging/find-polluter.sh +63 -0
  57. package/daemon/specs/agents/shared/skills/systematic-debugging/root-cause-tracing.md +169 -0
  58. package/daemon/specs/agents/shared/skills/systematic-debugging/test-academic.md +14 -0
  59. package/daemon/specs/agents/shared/skills/systematic-debugging/test-pressure-1.md +58 -0
  60. package/daemon/specs/agents/shared/skills/systematic-debugging/test-pressure-2.md +68 -0
  61. package/daemon/specs/agents/shared/skills/systematic-debugging/test-pressure-3.md +69 -0
  62. package/daemon/specs/agents/shared/skills/test-driven-development/SKILL.md +371 -0
  63. package/daemon/specs/agents/shared/skills/test-driven-development/testing-anti-patterns.md +299 -0
  64. package/daemon/specs/agents/shared/skills/using-superpowers/SKILL.md +95 -0
  65. package/daemon/specs/agents/shared/skills/verification-before-completion/SKILL.md +139 -0
  66. package/daemon/specs/agents/shared/skills/writing-plans/SKILL.md +116 -0
  67. package/daemon/specs/agents/synthesizer/agent.yaml +1 -0
  68. package/daemon/specs/demo.CULTURE.md +92 -0
  69. package/daemon/specs/demo.yaml +91 -0
  70. package/daemon/specs/implementation-pair.yaml +3 -3
  71. package/daemon/specs/product-team.CULTURE.md +137 -0
  72. package/daemon/specs/product-team.yaml +5 -4
  73. package/dist/client.d.ts +8 -1
  74. package/dist/client.d.ts.map +1 -1
  75. package/dist/client.js +15 -6
  76. package/dist/client.js.map +1 -1
  77. package/dist/commands/daemon.d.ts.map +1 -1
  78. package/dist/commands/daemon.js +5 -1
  79. package/dist/commands/daemon.js.map +1 -1
  80. package/dist/commands/up.js +2 -2
  81. package/dist/commands/up.js.map +1 -1
  82. package/dist/daemon-lifecycle.d.ts.map +1 -1
  83. package/dist/daemon-lifecycle.js +54 -7
  84. package/dist/daemon-lifecycle.js.map +1 -1
  85. package/dist/fetch-with-timeout.d.ts +9 -0
  86. package/dist/fetch-with-timeout.d.ts.map +1 -0
  87. package/dist/fetch-with-timeout.js +41 -0
  88. package/dist/fetch-with-timeout.js.map +1 -0
  89. package/package.json +1 -1
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: frontend-design
3
+ description: Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.
4
+ license: Complete terms in LICENSE.txt
5
+ ---
6
+
7
+ This skill guides creation of distinctive, production-grade frontend interfaces that avoid generic "AI slop" aesthetics. Implement real working code with exceptional attention to aesthetic details and creative choices.
8
+
9
+ The user provides frontend requirements: a component, page, application, or interface to build. They may include context about the purpose, audience, or technical constraints.
10
+
11
+ ## Design Thinking
12
+
13
+ Before coding, understand the context and commit to a BOLD aesthetic direction:
14
+ - **Purpose**: What problem does this interface solve? Who uses it?
15
+ - **Tone**: Pick an extreme: brutally minimal, maximalist chaos, retro-futuristic, organic/natural, luxury/refined, playful/toy-like, editorial/magazine, brutalist/raw, art deco/geometric, soft/pastel, industrial/utilitarian, etc. There are so many flavors to choose from. Use these for inspiration but design one that is true to the aesthetic direction.
16
+ - **Constraints**: Technical requirements (framework, performance, accessibility).
17
+ - **Differentiation**: What makes this UNFORGETTABLE? What's the one thing someone will remember?
18
+
19
+ **CRITICAL**: Choose a clear conceptual direction and execute it with precision. Bold maximalism and refined minimalism both work - the key is intentionality, not intensity.
20
+
21
+ Then implement working code (HTML/CSS/JS, React, Vue, etc.) that is:
22
+ - Production-grade and functional
23
+ - Visually striking and memorable
24
+ - Cohesive with a clear aesthetic point-of-view
25
+ - Meticulously refined in every detail
26
+
27
+ ## Frontend Aesthetics Guidelines
28
+
29
+ Focus on:
30
+ - **Typography**: Choose fonts that are beautiful, unique, and interesting. Avoid generic fonts like Arial and Inter; opt instead for distinctive choices that elevate the frontend's aesthetics; unexpected, characterful font choices. Pair a distinctive display font with a refined body font.
31
+ - **Color & Theme**: Commit to a cohesive aesthetic. Use CSS variables for consistency. Dominant colors with sharp accents outperform timid, evenly-distributed palettes.
32
+ - **Motion**: Use animations for effects and micro-interactions. Prioritize CSS-only solutions for HTML. Use Motion library for React when available. Focus on high-impact moments: one well-orchestrated page load with staggered reveals (animation-delay) creates more delight than scattered micro-interactions. Use scroll-triggering and hover states that surprise.
33
+ - **Spatial Composition**: Unexpected layouts. Asymmetry. Overlap. Diagonal flow. Grid-breaking elements. Generous negative space OR controlled density.
34
+ - **Backgrounds & Visual Details**: Create atmosphere and depth rather than defaulting to solid colors. Add contextual effects and textures that match the overall aesthetic. Apply creative forms like gradient meshes, noise textures, geometric patterns, layered transparencies, dramatic shadows, decorative borders, custom cursors, and grain overlays.
35
+
36
+ NEVER use generic AI-generated aesthetics like overused font families (Inter, Roboto, Arial, system fonts), cliched color schemes (particularly purple gradients on white backgrounds), predictable layouts and component patterns, and cookie-cutter design that lacks context-specific character.
37
+
38
+ Interpret creatively and make unexpected choices that feel genuinely designed for the context. No design should be the same. Vary between light and dark themes, different fonts, different aesthetics. NEVER converge on common choices (Space Grotesk, for example) across generations.
39
+
40
+ **IMPORTANT**: Match implementation complexity to the aesthetic vision. Maximalist designs need elaborate code with extensive animations and effects. Minimalist or refined designs need restraint, precision, and careful attention to spacing, typography, and subtle details. Elegance comes from executing the vision well.
41
+
42
+ Remember: Claude is capable of extraordinary creative work. Don't hold back, show what can truly be created when thinking outside the box and committing fully to a distinctive vision.
@@ -5,18 +5,18 @@ description: Use when operating OpenRig with the `rig` CLI and you need the ship
5
5
 
6
6
  # OpenRig User
7
7
 
8
- Use this skill when you are working inside an OpenRig-managed topology or operating OpenRig as an agent.
9
- Treat `rig ... --help` and current code as ground truth if anything here ever conflicts with older notes.
8
+ This is an as-built guide to the shipped `rig` CLI.
9
+ Use current code and `rig ... --help` as ground truth if anything here ever conflicts with older planning docs.
10
10
 
11
11
  ## Core Loop
12
12
 
13
- Most OpenRig work reduces to:
13
+ Most work in OpenRig reduces to this loop:
14
14
  - recover identity: `rig whoami --json`
15
- - inspect state: `rig ps --nodes --json`
15
+ - inspect inventory: `rig ps --nodes --json`
16
16
  - read context: `rig transcript ...`, `rig ask ...`, `rig chatroom history ...`
17
17
  - act: `rig send`, `rig capture`, `rig broadcast`, lifecycle commands
18
18
 
19
- ## Identity
19
+ ## Identity and Recovery
20
20
 
21
21
  Start here after launch, compaction, or confusion:
22
22
 
@@ -24,32 +24,50 @@ Start here after launch, compaction, or confusion:
24
24
  rig whoami --json
25
25
  ```
26
26
 
27
- This returns your rig, logical ID, pod/member, session name, runtime, peers, transcript info, and `contextUsage` when available.
28
-
29
- Useful targeting flags:
27
+ What it gives you today:
28
+ - identity: rig, logical ID, pod/member, session name, runtime
29
+ - peers and directional edges
30
+ - transcript info
31
+ - `contextUsage` when available
30
32
 
33
+ Flags:
31
34
  ```bash
32
35
  rig whoami --session <name>
33
36
  rig whoami --node-id <id>
34
37
  ```
35
38
 
36
- ## Inventory and Health
39
+ If the daemon is unreachable but identity can still be inferred, `--json` may return a partial result instead of crashing.
40
+
41
+ ## Inventory and Monitoring
37
42
 
38
43
  ```bash
39
44
  rig ps
40
45
  rig ps --json
41
46
  rig ps --nodes
42
47
  rig ps --nodes --json
48
+ ```
49
+
50
+ Use `rig ps --nodes --json` for the current node inventory across rigs. It is the best machine-readable operator surface for:
51
+ - session name
52
+ - runtime
53
+ - session/startup status
54
+ - restore outcome
55
+ - attach/resume commands
56
+ - latest error
57
+
58
+ Other health surfaces:
59
+
60
+ ```bash
43
61
  rig status
44
62
  rig daemon status
63
+ rig config
64
+ rig preflight
45
65
  rig doctor
46
66
  ```
47
67
 
48
- Use `rig ps --nodes --json` as the main machine-readable operator surface.
49
-
50
- ## Communication
68
+ ## Transcript and Communication
51
69
 
52
- ### Transcript
70
+ ### Transcript access
53
71
 
54
72
  ```bash
55
73
  rig transcript <session> --tail 100
@@ -57,14 +75,17 @@ rig transcript <session> --grep "pattern"
57
75
  rig transcript <session> --json
58
76
  ```
59
77
 
60
- ### Send to one peer
78
+ ### Send to one session
61
79
 
62
80
  ```bash
63
81
  rig send <session> "message"
64
82
  rig send <session> "message" --verify
83
+ rig send <session> "message" --force
65
84
  rig send <session> "message" --json
66
85
  ```
67
86
 
87
+ Use `--verify` when you want delivery evidence. Use `--force` only when you intentionally want to bypass activity-risk checks.
88
+
68
89
  ### Capture terminal output
69
90
 
70
91
  ```bash
@@ -84,7 +105,7 @@ rig broadcast "message"
84
105
  rig broadcast --rig <name> "message" --json
85
106
  ```
86
107
 
87
- Aggregate transport commands report `transport_unavailable` honestly for nodes such as `external_cli` that cannot receive inbound tmux transport.
108
+ Without `--rig` or `--pod`, broadcast targets all running sessions.
88
109
 
89
110
  ### Chatroom
90
111
 
@@ -97,33 +118,49 @@ rig chatroom topic <rig> <topic-name> [--body <text>] [--sender <name>]
97
118
  rig chatroom watch <rig> [--tmux]
98
119
  ```
99
120
 
100
- Roundtable loop:
101
- 1. inspect room: `rig chatroom history my-rig --limit 5`
102
- 2. save if needed: `rig chatroom history my-rig --json > /tmp/old-room.json`
103
- 3. clear if needed: `rig chatroom clear my-rig`
104
- 4. set topic: `rig chatroom topic my-rig "ROUND START"`
105
- 5. post: `rig chatroom send my-rig "position..." --sender <session>`
106
- 6. monitor: `rig chatroom wait my-rig --timeout 120`
107
- 7. close: `rig chatroom topic my-rig "ROUND CLOSED"`
121
+ **Key commands:**
122
+ - `send` post a message
123
+ - `history` retrieve with composable filters (sender, since, after, topic)
124
+ - `wait` block until new matching messages arrive (polls history, times out honestly)
125
+ - `clear` delete all messages for the rig (destructive, rig-scoped)
126
+ - `topic` set a topic marker
127
+ - `watch` SSE or tmux-based live stream
128
+
129
+ **Roundtable protocol:**
130
+ 1. Inspect old room: `rig chatroom history my-rig --limit 5`
131
+ 2. Save if needed: `rig chatroom history my-rig --json > /tmp/old-room.json`
132
+ 3. Clear if needed: `rig chatroom clear my-rig`
133
+ 4. Set topic: `rig chatroom topic my-rig "ROUND START"`
134
+ 5. Post: `rig chatroom send my-rig "position..." --sender <session>`
135
+ 6. Monitor: `rig chatroom wait my-rig --timeout 120`
136
+ 7. Close: `rig chatroom topic my-rig "ROUND CLOSED"`
108
137
 
109
- ## `rig ask`
138
+ See `docs/planning/roadmaps/chatroom-roundtable-protocol.md` for the full protocol.
139
+
140
+ ### `rig ask`
110
141
 
111
142
  ```bash
112
143
  rig ask <rig> "question"
113
144
  rig ask <rig> "question" --json
114
145
  ```
115
146
 
116
- `rig ask` is an evidence/context command. It uses structured rig state plus transcript/chat evidence. It is not a hidden second-LLM call.
147
+ Current shipped behavior:
148
+ - queries the daemon for evidence
149
+ - returns rig summary
150
+ - returns transcript excerpts
151
+ - may return chat excerpts
152
+ - returns insufficiency state and optional guidance
153
+
154
+ This is an evidence/context command. It is not a hidden second-LLM call.
117
155
 
118
156
  ## Lifecycle
119
157
 
120
- ### Launch or restore a rig
158
+ ### Bring a rig up
121
159
 
122
160
  ```bash
123
161
  rig up <source>
124
162
  rig up <source> --plan
125
163
  rig up <source> --yes
126
- rig up <source> --cwd <path>
127
164
  rig up <source> --json
128
165
  ```
129
166
 
@@ -132,16 +169,21 @@ rig up <source> --json
132
169
  - a `.rigbundle` path
133
170
  - a bare name
134
171
 
172
+ Bare names are special:
173
+ - if they match a library spec, `rig up` launches from the spec library
174
+ - if they do not match a library spec, `rig up` treats the name as an existing-rig restore/power-on target
175
+ - if both exist, `rig up` fails loudly on ambiguity
176
+
135
177
  Current behavior notes:
136
- - `--cwd <path>` is the launch-time cwd override for all members in the rig
137
- - `--target <root>` is only for bundle/package installation; it does not change agent cwd
138
- - `local:` `agent_ref` values resolve relative to the rig spec directory, not your shell cwd
139
- - bare names are ambiguous if they match both a library spec and an existing rig name; OpenRig fails loudly instead of guessing
178
+ - `--target <root>` is only for `.rigbundle` / package installation. It does not change agent cwd.
179
+ - `local:` `agent_ref` values resolve relative to the rig spec directory, not your shell cwd.
180
+ - if you copy a built-in spec elsewhere, keep its `agents/` tree beside the YAML or rewrite those refs to `path:/absolute/path`
181
+ - there is no shipped `rig up --cwd` override yet
140
182
 
141
- Legacy bootstrap surface still ships too:
183
+ Legacy/spec-specific surfaces still ship too:
142
184
 
143
185
  ```bash
144
- rig bootstrap <spec> [--plan] [--yes] [--cwd <path>] [--json]
186
+ rig bootstrap <spec> [--plan] [--yes] [--json]
145
187
  rig requirements <spec> [--json]
146
188
  ```
147
189
 
@@ -155,9 +197,9 @@ rig down <rigId> --force
155
197
  rig down <rigId> --json
156
198
  ```
157
199
 
158
- `rig down` now cleans only OpenRig-managed blocks from `CLAUDE.md` and `AGENTS.md`, preserving user and third-party content.
200
+ If `--snapshot` succeeds, human output includes the restore hint.
159
201
 
160
- ### Release claimed/adopted rigs without killing live sessions
202
+ ### Release management without killing live claimed sessions
161
203
 
162
204
  ```bash
163
205
  rig release <rigId>
@@ -165,10 +207,11 @@ rig release <rigId> --delete
165
207
  rig release <rigId> --json
166
208
  ```
167
209
 
168
- Use `rig release` for adopted/claimed-session rigs when the external tmux sessions should stay alive.
169
- If a rig contains OpenRig-launched nodes, `rig release` fails loudly with `contains_launched_nodes`.
210
+ Use `rig release` for adopted/claimed-session rigs when you want OpenRig to stop managing the rig but leave the tmux sessions alive.
211
+ This is the safe recovery/reset surface for the "sessions still exist, management is broken or stale" case.
212
+ If the rig contains OpenRig-launched nodes, `rig release` refuses loudly instead of pretending the mixed rig is safe to detach.
170
213
 
171
- ### Snapshot and restore
214
+ ### Snapshots and restore
172
215
 
173
216
  ```bash
174
217
  rig snapshot <rigId>
@@ -176,7 +219,34 @@ rig snapshot list <rigId>
176
219
  rig restore <snapshotId> --rig <rigId>
177
220
  ```
178
221
 
179
- ## Discovery, Binding, and Attach
222
+ `rig restore` requires `--rig <rigId>`.
223
+
224
+ Claude Code autonomy note:
225
+ - unattended `rig whoami` on boot may require the local permission allow list to include `Bash(rig:*)`
226
+
227
+ ### Import/export and bundles
228
+
229
+ ```bash
230
+ rig export <rigId> -o rig.yaml
231
+ rig import <path> [--instantiate] [--materialize-only] [--preflight] [--target-rig <rigId>] [--rig-root <root>]
232
+ rig bundle create <spec> -o out.rigbundle
233
+ rig bundle inspect <bundle>
234
+ rig bundle install <bundle> [--plan] [--yes] [--target <root>] [--json]
235
+ ```
236
+
237
+ ### Legacy package surface
238
+
239
+ This still ships, but is explicitly marked legacy:
240
+
241
+ ```bash
242
+ rig package validate <path>
243
+ rig package plan <path> [--target <dir>] [--runtime <runtime>] [--role <name>]
244
+ rig package install <path> [--target <dir>] [--runtime <runtime>] [--role <name>] [--allow-merge]
245
+ rig package list
246
+ rig package rollback <installId>
247
+ ```
248
+
249
+ ## Discovery and Topology Mutation
180
250
 
181
251
  ### Discover unmanaged tmux sessions
182
252
 
@@ -193,7 +263,8 @@ rig bind <discoveredId> --rig <rigId> --node <logicalId>
193
263
  rig bind <discoveredId> --rig <rigId> --pod <namespace> --member <name>
194
264
  ```
195
265
 
196
- There is no shipped top-level `rig claim` command. The adoption surface is `discover`, `bind`, `adopt`, and `unclaim`.
266
+ There is no shipped top-level `rig claim` command.
267
+ The current adoption surface is `discover`, `bind`, `adopt`, and `unclaim`.
197
268
 
198
269
  ### Self-attach the current shell or agent
199
270
 
@@ -203,22 +274,51 @@ rig attach --self --rig <rigId> --node <logicalId> --print-env
203
274
  rig attach --self --rig <rigId> --pod <namespace> --member <name> --runtime <runtime>
204
275
  ```
205
276
 
206
- Proven behavior:
207
- - inside tmux: attaches as a normal tmux-backed node
208
- - outside tmux: attaches as `external_cli`
209
- - `--print-env` prints `OPENRIG_NODE_ID` and `OPENRIG_SESSION_NAME`
277
+ Use `rig attach --self` when the current agent should attach itself directly instead of going through `discover` + `bind`.
278
+
279
+ Current proven behavior:
280
+ - inside `tmux`: attaches as a normal tmux-backed node, preserving inbound `rig send` / `rig capture`
281
+ - outside `tmux`: attaches as `external_cli`
282
+ - `--print-env` prints the `OPENRIG_NODE_ID` and `OPENRIG_SESSION_NAME` exports for the current shell
283
+
284
+ Recommended flow:
285
+
286
+ ```bash
287
+ rig attach --self --rig <rigId> --node <logicalId> --print-env > /tmp/openrig-self-attach.env
288
+ . /tmp/openrig-self-attach.env
289
+ rig whoami --json
290
+ ```
291
+
292
+ Notes:
293
+ - for tmux-backed self-attach, `rig whoami --json` is the right verification
294
+ - for raw/external self-attach, `rig ps --nodes --json` is currently the more reliable verification surface
295
+ - if the current shell is outside tmux, pass `--display-name <name>` when you want a stable human session label recorded
210
296
 
211
- ## Adopt Existing Sessions
297
+ ### Adopt a topology and bind live sessions
212
298
 
213
299
  ```bash
300
+ rig adopt <path> --bind <logicalId=tmuxSessionOrDiscoveryId>
301
+ rig adopt <path> --bind <logicalId=...> --bind <logicalId=...> --json
214
302
  rig adopt <path> --bindings-file <bindings.yaml>
215
- rig adopt <path> --bind <logicalId=liveSession>
216
- rig adopt <path> --bindings-file <bindings.yaml> --target-rig <rigId>
303
+ rig adopt <path> --bind <logicalId=...> --target-rig <rigId> --rig-root <root>
304
+ ```
305
+
306
+ Use `rig adopt` when the sessions already exist and you want OpenRig to start managing them.
307
+
308
+ A bindings file is the durable map from authored logical IDs to live sessions. Shape:
309
+
310
+ ```yaml
311
+ bindings:
312
+ dev1.impl2: dev1-impl2@rigged-buildout
313
+ dev1.qa: dev1-qa@rigged-buildout
217
314
  ```
218
315
 
219
316
  Spec + bindings is the proven recovery pair for adopted rigs.
317
+ Spec gives OpenRig the intended topology. Bindings tells OpenRig which discovered live session belongs in each logical node.
220
318
 
221
- Proven recovery loop for still-alive sessions:
319
+ ### Proven adopted-rig recovery workflow
320
+
321
+ This workflow is proven for the case where the external tmux sessions are still alive:
222
322
 
223
323
  ```bash
224
324
  rig release <rigId> --delete
@@ -226,11 +326,88 @@ rig discover --json
226
326
  rig adopt <spec.yaml> --bindings-file <bindings.yaml>
227
327
  ```
228
328
 
229
- Mixed-origin rigs are allowed:
230
- - adopted nodes and OpenRig-launched nodes can coexist
231
- - but whole-rig `rig release` only works for claimed/adopted-only rigs
329
+ What this does:
330
+ - removes OpenRig management without killing the sessions
331
+ - re-discovers those same sessions as unmanaged
332
+ - re-attaches them to the topology defined by the spec + bindings
333
+
334
+ Important limits:
335
+ - this is for `sessions still alive`
336
+ - spec alone is not enough for adopted rigs; you also need bindings
337
+ - this does not yet mean OpenRig can recreate dead external sessions from nothing
338
+
339
+ ### Add unmanaged pods into an existing rig
340
+
341
+ This is the proven workflow when a rig is already managed, but a new pod was created outside OpenRig and you want to add it later:
342
+
343
+ ```bash
344
+ rig adopt <pod-fragment.yaml> --bindings-file <pod.bindings.yaml> --target-rig <rigId>
345
+ ```
346
+
347
+ Use this when:
348
+ - the target rig already exists
349
+ - the new sessions are live and visible in `rig discover --json`
350
+ - you want additive topology growth, not a full rebuild
232
351
 
233
- ## Specs and Library
352
+ What to prepare:
353
+ - a pod fragment spec with only the new pod
354
+ - a bindings file mapping the new logical IDs to the live session names
355
+
356
+ Verification loop:
357
+
358
+ ```bash
359
+ rig discover --json
360
+ rig adopt <fragment.yaml> --bindings-file <bindings.yaml> --target-rig <rigId>
361
+ rig ps --nodes --json
362
+ rig export <rigId> -o rig.yaml
363
+ ```
364
+
365
+ Success looks like:
366
+ - the new sessions stop appearing in `rig discover`
367
+ - the new logical IDs appear in `rig ps --nodes --json`
368
+ - `rig export` includes the new pod
369
+
370
+ ### Mixed-origin rigs are allowed
371
+
372
+ One rig can contain both:
373
+ - adopted nodes bound from already-running sessions
374
+ - OpenRig-launched nodes created later with `rig expand` / `rig launch`
375
+
376
+ Current safety rule:
377
+ - `rig release` is for claimed/adopted-only rigs
378
+ - if a rig contains launched nodes, `rig release` fails with `contains_launched_nodes`
379
+
380
+ ### Manager-assisted recovery
381
+
382
+ The proven operator pattern is:
383
+ - keep one OpenRig manager session outside the rig it manages
384
+ - address the target by rig name, not cached rig ID
385
+ - resolve the current owner from fresh `rig ps --nodes --json`
386
+ - send the manager the spec path, bindings path, and verification steps with `rig send`
387
+
388
+ This lets ordinary agents ask the manager for OpenRig help instead of every agent needing to be an OpenRig expert.
389
+
390
+ ### Add/remove running topology parts
391
+
392
+ ```bash
393
+ rig expand <rig-id> <pod-fragment-path> [--rig-root <path>] [--json]
394
+ rig launch <rigId> <nodeRef> [--json]
395
+ rig remove <rigId> <nodeRef> [--json]
396
+ rig shrink <rigId> <podRef> [--json]
397
+ rig unclaim <sessionRef> [--json]
398
+ ```
399
+
400
+ ## Specs and Validation
401
+
402
+ ### Validate specs
403
+
404
+ ```bash
405
+ rig spec validate <path> [--json]
406
+ rig spec preflight <path> [--rig-root <root>] [--json]
407
+ rig agent validate <path> [--json]
408
+ ```
409
+
410
+ ### Spec library
234
411
 
235
412
  ```bash
236
413
  rig specs ls [--kind <kind>] [--json]
@@ -238,16 +415,43 @@ rig specs show <name-or-id> [--json]
238
415
  rig specs preview <name-or-id> [--json]
239
416
  rig specs add <path> [--json]
240
417
  rig specs sync [--json]
418
+ rig specs remove <name-or-id> [--json]
419
+ rig specs rename <name-or-id> <new-name> [--json]
241
420
  ```
242
421
 
422
+ ## MCP
423
+
243
424
  ```bash
244
- rig export <rigId> -o rig.yaml
245
- rig import <path> [--instantiate] [--materialize-only] [--preflight] [--target-rig <rigId>] [--rig-root <root>]
246
- rig bundle create <spec> -o out.rigbundle
247
- rig bundle inspect <bundle>
248
- rig bundle install <bundle> [--plan] [--yes] [--target <root>] [--json]
425
+ rig mcp serve [--port <port>]
249
426
  ```
250
427
 
428
+ Current shipped MCP tools:
429
+ - `rig_up`
430
+ - `rig_down`
431
+ - `rig_ps`
432
+ - `rig_status`
433
+ - `rig_snapshot_create`
434
+ - `rig_snapshot_list`
435
+ - `rig_restore`
436
+ - `rig_discover`
437
+ - `rig_bind`
438
+ - `rig_bundle_inspect`
439
+ - `rig_agent_validate`
440
+ - `rig_rig_validate`
441
+ - `rig_rig_nodes`
442
+ - `rig_send`
443
+ - `rig_capture`
444
+ - `rig_chatroom_send`
445
+ - `rig_chatroom_watch`
446
+
447
+ ## JSON and Error Posture
448
+
449
+ Design assumptions that hold in the shipped CLI:
450
+ - many operator commands support `--json`
451
+ - error messages are intended to say what happened, why it matters, and what to do next
452
+ - daemon-backed commands fail loudly when the daemon is stopped or unhealthy
453
+ - restore failure is not something you should silently reinterpret as success
454
+
251
455
  ## After-Compaction Recovery Checklist
252
456
 
253
457
  1. `rig whoami --json`
@@ -257,7 +461,7 @@ rig bundle install <bundle> [--plan] [--yes] [--target <root>] [--json]
257
461
 
258
462
  ## Commands That Do Not Exist
259
463
 
260
- Do not assume these exist unless `rig --help` starts listing them:
464
+ Do not assume these exist unless the shipped help starts listing them:
261
465
  - `rig claim`
262
466
  - `rig env`
263
467
  - `rig blame`