@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.
- package/daemon/dist/adapters/claude-code-adapter.d.ts +1 -0
- package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-code-adapter.js +10 -0
- package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
- package/daemon/dist/adapters/cmux.d.ts.map +1 -1
- package/daemon/dist/adapters/cmux.js +1 -0
- package/daemon/dist/adapters/cmux.js.map +1 -1
- package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
- package/daemon/dist/domain/native-resume-probe.js +11 -0
- package/daemon/dist/domain/native-resume-probe.js.map +1 -1
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +14 -0
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/docs/reference/agent-spec.md +411 -0
- package/daemon/docs/reference/agent-startup-guide.md +339 -0
- package/daemon/docs/reference/edge-types.md +126 -0
- package/daemon/docs/reference/rig-spec.md +474 -0
- package/daemon/specs/agents/shared/agent.yaml +2 -0
- package/daemon/specs/agents/shared/skills/rig-architect/SKILL.md +332 -0
- package/dist/bin-wrapper.d.ts +1 -0
- package/dist/bin-wrapper.d.ts.map +1 -1
- package/dist/bin-wrapper.js +41 -1
- package/dist/bin-wrapper.js.map +1 -1
- package/dist/commands/bootstrap.js +1 -1
- package/dist/commands/bootstrap.js.map +1 -1
- package/dist/commands/docs.d.ts +3 -0
- package/dist/commands/docs.d.ts.map +1 -0
- package/dist/commands/docs.js +55 -0
- package/dist/commands/docs.js.map +1 -0
- package/dist/commands/doctor.d.ts +6 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +53 -10
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/setup.d.ts +39 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +345 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +6 -2
- package/dist/commands/up.js.map +1 -1
- package/dist/daemon-lifecycle.d.ts +7 -0
- package/dist/daemon-lifecycle.d.ts.map +1 -1
- package/dist/daemon-lifecycle.js +45 -8
- package/dist/daemon-lifecycle.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-server.js +1 -1
- package/dist/mcp-server.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
# Agent Startup Guide
|
|
2
|
+
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Last validated: 2026-04-11
|
|
5
|
+
Applies to: OpenRig 0.1.x
|
|
6
|
+
|
|
7
|
+
This guide teaches you how to think about what goes into an agent's startup experience — what files to write, where to put them, and how the layering model delivers them. It is an authoring guide, not a schema reference. For field-level details, see `rig-spec.md` and `agent-spec.md`.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Two Categories of Startup
|
|
12
|
+
|
|
13
|
+
Everything an agent receives at boot time falls into one of two categories:
|
|
14
|
+
|
|
15
|
+
### Category 1: Context Loading
|
|
16
|
+
|
|
17
|
+
The agent reads markdown files into its context window. This is the **primary mechanism** in OpenRig today and the one you should invest most of your authoring effort in.
|
|
18
|
+
|
|
19
|
+
Context loading shapes what the agent knows, believes, and is capable of:
|
|
20
|
+
- Who it is (role, identity, pod membership)
|
|
21
|
+
- How the team works (culture, communication norms, coordination protocols)
|
|
22
|
+
- What the project is (codebase context, architecture, domain knowledge)
|
|
23
|
+
- What it can do (skills, SOPs, operational procedures)
|
|
24
|
+
- What its environment looks like (services, access credentials, tools)
|
|
25
|
+
|
|
26
|
+
### Category 2: Deterministic Configuration
|
|
27
|
+
|
|
28
|
+
The rig spec declaratively installs things into the agent's runtime environment:
|
|
29
|
+
- Hooks (git hooks, pre-commit scripts)
|
|
30
|
+
- Permissions (`.claude/settings.json` allowlists, approval modes)
|
|
31
|
+
- MCPs (Model Context Protocol servers)
|
|
32
|
+
- System dependencies (tools, packages)
|
|
33
|
+
|
|
34
|
+
See the **Current Support Matrix** section at the end of this guide for what is reliable today vs experimental.
|
|
35
|
+
|
|
36
|
+
**The v0.2.0 recommendation:** Put as much of your setup logic as possible into Category 1 (context loading via markdown files). Describe the desired end state in startup files and let the agent handle the configuration. The deterministic path exists in the spec and will become more reliable over time, but for now the context-loading path is the one that works consistently across runtimes.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Context Loading: What Goes Where
|
|
41
|
+
|
|
42
|
+
### Skills vs Startup Files — The Key Distinction
|
|
43
|
+
|
|
44
|
+
**Skills** are reusable SOPs. They teach an agent HOW to do something — how to use OpenRig, how to do TDD, how to run a code review, how to operate Vault. Skills transfer across rigs. A skill you write once can be used by any agent in any rig.
|
|
45
|
+
|
|
46
|
+
**Startup/guidance files** are rig-specific and role-specific. They tell an agent WHO it is, WHAT it's working on, and HOW this particular team operates. They are authored per-rig and often per-pod or per-member.
|
|
47
|
+
|
|
48
|
+
| Put in a skill when... | Put in a startup/guidance file when... |
|
|
49
|
+
|------------------------|---------------------------------------|
|
|
50
|
+
| The knowledge is reusable across rigs | The knowledge is specific to this rig or project |
|
|
51
|
+
| It teaches a procedure or methodology | It teaches identity, role, or team context |
|
|
52
|
+
| It could be useful to any agent of this type | It's only useful to agents in this specific topology |
|
|
53
|
+
| Examples: `openrig-user`, `test-driven-development`, `vault-user` | Examples: `role.md`, `CULTURE.md`, `startup/context.md` |
|
|
54
|
+
|
|
55
|
+
### The Belt-and-Suspenders Pattern for Skills
|
|
56
|
+
|
|
57
|
+
Skills are delivered to agents through two parallel paths:
|
|
58
|
+
|
|
59
|
+
1. **Spec declaration:** The agent spec's `resources.skills` + profile `uses.skills` ensures the skill files are projected to the agent's workspace (installed before harness boot)
|
|
60
|
+
2. **Startup instruction:** The guidance/startup files tell the agent to actually read and load those skills
|
|
61
|
+
|
|
62
|
+
Both paths are important. The spec projection ensures the files are physically present. The startup instruction ensures the agent knows to read them. This redundancy is intentional — it handles cases where one path fails.
|
|
63
|
+
|
|
64
|
+
Example: An implementer agent's startup guidance says "Load the following skills: openrig-user, test-driven-development, mental-model-ha" — AND the agent spec's profile uses those same skill IDs. The agent gets the files from projection and the instruction to read them from guidance.
|
|
65
|
+
|
|
66
|
+
### The File Types
|
|
67
|
+
|
|
68
|
+
**Role guidance (`guidance/role.md`)**
|
|
69
|
+
|
|
70
|
+
Tells the agent who it is and what its responsibilities are:
|
|
71
|
+
- Title and primary function
|
|
72
|
+
- Specific responsibilities (bulleted list)
|
|
73
|
+
- Working rhythm (how the agent operates day-to-day)
|
|
74
|
+
- Principles (behavioral guidelines)
|
|
75
|
+
- Relationship to other team members
|
|
76
|
+
|
|
77
|
+
This is the agent's identity document. Every agent should have one.
|
|
78
|
+
|
|
79
|
+
**Rig culture (`CULTURE.md`)**
|
|
80
|
+
|
|
81
|
+
The rig-wide constitution. Applied to ALL agents in the rig:
|
|
82
|
+
- Communication norms (use `rig send`/chatroom, not raw tmux)
|
|
83
|
+
- Coordination protocol (how work flows between pods)
|
|
84
|
+
- Quality standards (what "done" means)
|
|
85
|
+
- Commit/merge policy
|
|
86
|
+
- Escalation rules
|
|
87
|
+
|
|
88
|
+
Think of this as the team operating manual that every team member reads on day one.
|
|
89
|
+
|
|
90
|
+
**Startup context (`startup/context.md`)**
|
|
91
|
+
|
|
92
|
+
Boot-time grounding information specific to this agent's operating environment:
|
|
93
|
+
- Identity recovery instructions (`rig whoami --json`)
|
|
94
|
+
- Environment details (service URLs, access credentials, ports)
|
|
95
|
+
- System check instructions (what should be running, how to verify)
|
|
96
|
+
- Role-specific delegation information (who to ask, who delegates to you)
|
|
97
|
+
|
|
98
|
+
This is especially important for managed-app specialists (e.g., a Vault specialist needs to know the Vault address and dev token).
|
|
99
|
+
|
|
100
|
+
**Project documentation**
|
|
101
|
+
|
|
102
|
+
Rig-level startup files that teach the agent about the project:
|
|
103
|
+
- Architecture overview
|
|
104
|
+
- Key conventions
|
|
105
|
+
- Domain vocabulary
|
|
106
|
+
- Recent context (what's been happening, what's in progress)
|
|
107
|
+
|
|
108
|
+
These go in rig-level or pod-level startup blocks and are delivered to relevant agents.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## The Layering Model
|
|
113
|
+
|
|
114
|
+
Startup content is merged additively through layers. Each layer adds to what the previous layers provided. Later layers do NOT replace earlier layers — they append.
|
|
115
|
+
|
|
116
|
+
### The Layers (in delivery order)
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
1. Agent layer — from the AgentSpec's top-level startup block
|
|
120
|
+
2. Profile layer — from the active profile's startup block
|
|
121
|
+
3. Rig layer — from the RigSpec's top-level startup block
|
|
122
|
+
4. Culture layer — from the RigSpec's culture_file
|
|
123
|
+
5. Pod layer — from the pod's startup block
|
|
124
|
+
6. Member layer — from the member's startup block in the RigSpec
|
|
125
|
+
7. Operator layer — injected at runtime (openrig-start overlay, context collector, etc.)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### What Each Layer Is For
|
|
129
|
+
|
|
130
|
+
| Layer | Authored by | Purpose | Example content |
|
|
131
|
+
|-------|-------------|---------|-----------------|
|
|
132
|
+
| Agent | Agent spec author | Core identity and capabilities that travel with this agent type | Role guidance, default skills |
|
|
133
|
+
| Profile | Agent spec author | Profile-specific variations | Different skill sets for "default" vs "minimal" profiles |
|
|
134
|
+
| Rig | Rig spec author | Rig-wide context for all agents | Team norms, project documentation |
|
|
135
|
+
| Culture | Rig spec author | Rig constitution | `CULTURE.md` — communication, quality, operating philosophy |
|
|
136
|
+
| Pod | Rig spec author | Pod-specific coordination context | Pod SOP, intra-pod workflow |
|
|
137
|
+
| Member | Rig spec author | Individual member overrides | Member-specific instructions, cwd-specific context |
|
|
138
|
+
| Operator | OpenRig system | System-injected runtime content | `openrig-start.md`, context collector |
|
|
139
|
+
|
|
140
|
+
### Practical Guidance
|
|
141
|
+
|
|
142
|
+
**Most rigs only need three layers:** agent (role.md), rig (culture), and operator (openrig-start). Start simple. Add pod and member layers only when agents in the same pod need different startup content.
|
|
143
|
+
|
|
144
|
+
**The culture layer is high-value and often skipped.** A rig without a `CULTURE.md` relies on agents to guess how the team communicates and coordinates. Write one. Even a short culture file dramatically improves team coherence.
|
|
145
|
+
|
|
146
|
+
**Member-level startup is for exceptions, not the rule.** If every member has its own startup block, the layering model is being used as a configuration dump. Refactor shared content up to the pod or rig level.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Delivery Mechanisms
|
|
151
|
+
|
|
152
|
+
### How Files Reach the Agent
|
|
153
|
+
|
|
154
|
+
| Delivery Hint | When | How | Use For |
|
|
155
|
+
|---------------|------|-----|---------|
|
|
156
|
+
| `auto` | Before harness boot | System chooses | Default — let OpenRig decide |
|
|
157
|
+
| `guidance_merge` | Before harness boot | Merged into `CLAUDE.md` / `AGENTS.md` as a managed block | Role guidance, culture, project context |
|
|
158
|
+
| `skill_install` | Before harness boot | Copied to runtime's skill directory | Skills |
|
|
159
|
+
| `send_text` | After harness is ready | Sent as text to agent's terminal via tmux | Boot-time grounding, identity hints, instructions to read skills |
|
|
160
|
+
|
|
161
|
+
### Delivery Timing Matters
|
|
162
|
+
|
|
163
|
+
Files delivered via `guidance_merge` and `skill_install` happen BEFORE the agent's harness boots. The agent sees them immediately when it starts — they're part of the initial context.
|
|
164
|
+
|
|
165
|
+
Files delivered via `send_text` happen AFTER the harness is ready. The agent receives them as messages in its terminal. Use this for:
|
|
166
|
+
- Identity grounding (agent reads and processes the instructions)
|
|
167
|
+
- Instructions to load skills (the files are already projected, the message tells the agent to read them)
|
|
168
|
+
- Context that should feel like an operator briefing, not pre-loaded content
|
|
169
|
+
|
|
170
|
+
### The `applies_on` Field
|
|
171
|
+
|
|
172
|
+
Each startup file and action specifies when it applies:
|
|
173
|
+
- `fresh_start` — delivered on first launch only
|
|
174
|
+
- `restore` — delivered on restore from snapshot
|
|
175
|
+
- Default: `[fresh_start, restore]` (both)
|
|
176
|
+
|
|
177
|
+
Use this to avoid re-sending context that the agent already has from its resumed conversation. For example, a one-time project briefing might only apply on `fresh_start`, while identity grounding should apply on both.
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Deterministic Configuration
|
|
182
|
+
|
|
183
|
+
The AgentSpec and RigSpec allow declaring deterministic environment configuration:
|
|
184
|
+
|
|
185
|
+
### What the Spec Supports
|
|
186
|
+
|
|
187
|
+
**Hooks** (in `resources.hooks`):
|
|
188
|
+
```yaml
|
|
189
|
+
resources:
|
|
190
|
+
hooks:
|
|
191
|
+
- id: pre-commit
|
|
192
|
+
path: hooks/pre-commit.sh
|
|
193
|
+
runtimes: [claude-code]
|
|
194
|
+
```
|
|
195
|
+
Hooks are scripts copied to the agent's workspace. They can be git hooks, automation scripts, or environment setup.
|
|
196
|
+
|
|
197
|
+
**Runtime resources** (in `resources.runtime_resources`):
|
|
198
|
+
```yaml
|
|
199
|
+
resources:
|
|
200
|
+
runtime_resources:
|
|
201
|
+
- id: claude-settings
|
|
202
|
+
path: runtime/claude-settings.json
|
|
203
|
+
runtime: claude-code
|
|
204
|
+
type: settings
|
|
205
|
+
```
|
|
206
|
+
Runtime-specific configuration files projected into the agent's runtime environment.
|
|
207
|
+
|
|
208
|
+
**Startup actions** (in `startup.actions`):
|
|
209
|
+
```yaml
|
|
210
|
+
startup:
|
|
211
|
+
actions:
|
|
212
|
+
- type: send_text
|
|
213
|
+
value: "/install-mcp my-server"
|
|
214
|
+
phase: after_ready
|
|
215
|
+
idempotent: true
|
|
216
|
+
```
|
|
217
|
+
Commands sent to the agent's terminal after it's ready. Can install MCPs, run setup commands, etc.
|
|
218
|
+
|
|
219
|
+
### Current Support Matrix (OpenRig 0.1.x)
|
|
220
|
+
|
|
221
|
+
| Capability | Status | Notes |
|
|
222
|
+
|------------|--------|-------|
|
|
223
|
+
| Guidance file projection (`guidance_merge`) | **Supported** | Reliable. Primary delivery mechanism. |
|
|
224
|
+
| Skill projection (`skill_install`) | **Supported** | Reliable. Skills are copied to workspace. |
|
|
225
|
+
| `send_text` delivery after ready | **Supported** | Reliable. Requires harness to be ready. |
|
|
226
|
+
| Hook projection | **Experimental** | Files are copied but execution/integration varies by runtime. |
|
|
227
|
+
| Runtime resource projection | **Experimental** | Files are projected but runtime-specific handling is not guaranteed. |
|
|
228
|
+
| Permission allowlisting | **Supported (manual)** | Works via `~/.claude/settings.json` or Codex launch flags. OpenRig can describe the desired state; agent self-configures. |
|
|
229
|
+
| MCP installation | **Experimental** | Claude Code: `/mcp` interactive command or `claude mcp add` from CLI. Can also be described in startup files for agent self-configuration. Reliability depends on runtime TUI state. |
|
|
230
|
+
| System dependency installation | **Not deterministic** | Describe in startup files; agent handles via shell commands. |
|
|
231
|
+
| Recurring tasks / wake timers | **Runtime-dependent** | Claude Code supports recurring tasks via the `/loop` command. Codex does not have a confirmed equivalent. Orchestrators should include `/loop` instructions in startup for Claude Code agents. |
|
|
232
|
+
|
|
233
|
+
### The v0.2.0 Approach: Describe, Then Let the Agent Handle It
|
|
234
|
+
|
|
235
|
+
For anything beyond `guidance_merge`, `skill_install`, and `send_text`, the recommended approach is:
|
|
236
|
+
|
|
237
|
+
1. **Describe the desired end state** in a startup file (e.g., "You need these MCP servers configured, these permissions set, these hooks installed")
|
|
238
|
+
2. **Include a system check** in the startup instructions ("Verify your environment: check that X is installed, Y is configured, Z is accessible")
|
|
239
|
+
3. **Empower the agent to self-configure** ("If any of these are missing, install/configure them")
|
|
240
|
+
4. **Optionally also declare it in the spec** for when deterministic support improves — the spec serves as the blueprint, and the startup file serves as the fallback instruction
|
|
241
|
+
|
|
242
|
+
This way, when deterministic support becomes fully reliable, the agent will boot up, see that everything is already set up (by the deterministic path), run its system check, confirm everything looks good, and proceed. Until then, the agent reads the instructions and handles the setup itself.
|
|
243
|
+
|
|
244
|
+
### Runtime Differences
|
|
245
|
+
|
|
246
|
+
**Claude Code:**
|
|
247
|
+
- Reads from `CLAUDE.md` and `.claude/` directory
|
|
248
|
+
- Recurring tasks via the `/loop` command (e.g., `/loop 5m "check rig health"`) — this is NOT hooks; hooks are event-driven
|
|
249
|
+
- MCP server management via `/mcp` interactive command or `claude mcp add` from CLI
|
|
250
|
+
- Event-driven hooks system in `.claude/settings.json` — reacts to events like `PreToolUse`, `PostToolUse`, `SessionStart`, etc. (not time-based)
|
|
251
|
+
- Permission allowlisting via `.claude/settings.json` (`permissions.allow`, `permissions.deny`, `permissions.defaultMode`)
|
|
252
|
+
- Can self-configure MCP servers, permissions, and hooks from startup instructions
|
|
253
|
+
|
|
254
|
+
**Codex:**
|
|
255
|
+
- Reads from `AGENTS.md` and `.agents/` directory
|
|
256
|
+
- Recurring task support is limited — no confirmed equivalent of Claude Code's `/loop` command
|
|
257
|
+
- MCP configuration mechanism differs from Claude Code
|
|
258
|
+
- Approval mode controlled via launch flags (`-a`, `-s`, `--full-auto`)
|
|
259
|
+
- Can self-install dependencies from instructions but timer/recurring behavior is not reliably available
|
|
260
|
+
|
|
261
|
+
When authoring startup content, note which instructions are runtime-specific. For example, an orchestrator that needs a monitoring loop should include instructions like: "If running Claude Code, use `/loop 3m` to periodically check rig health. If running Codex, check rig health at the start of each task cycle instead."
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Patterns and Anti-Patterns
|
|
266
|
+
|
|
267
|
+
### Good Patterns
|
|
268
|
+
|
|
269
|
+
**Start with role + culture + one skill**
|
|
270
|
+
```
|
|
271
|
+
agent.yaml → guidance/role.md
|
|
272
|
+
rig.yaml → culture_file: CULTURE.md
|
|
273
|
+
profile → uses.skills: [openrig-user]
|
|
274
|
+
```
|
|
275
|
+
This is the minimum effective startup. The agent knows who it is, how the team works, and how to use the rig.
|
|
276
|
+
|
|
277
|
+
**Separate project context from role**
|
|
278
|
+
|
|
279
|
+
Don't put project documentation inside the role guidance. The role is about the agent's function; project context is about what the agent is working on. Use rig-level or pod-level startup files for project context.
|
|
280
|
+
|
|
281
|
+
**Tell the agent about its skills explicitly**
|
|
282
|
+
|
|
283
|
+
In a startup file or guidance, include a line like:
|
|
284
|
+
```
|
|
285
|
+
You have the following skills loaded: openrig-user, test-driven-development, mental-model-ha. Use them.
|
|
286
|
+
```
|
|
287
|
+
This prompts the agent to actually invoke the skills, not just have them as passive context.
|
|
288
|
+
|
|
289
|
+
**Include a system check in startup context**
|
|
290
|
+
|
|
291
|
+
```
|
|
292
|
+
## System Check
|
|
293
|
+
|
|
294
|
+
After identity recovery, verify:
|
|
295
|
+
1. `rig ps --nodes` shows your rig running
|
|
296
|
+
2. `rig env status` shows services healthy (if applicable)
|
|
297
|
+
3. Your working directory is correct
|
|
298
|
+
4. Required tools are available (node, npm, git, etc.)
|
|
299
|
+
|
|
300
|
+
If anything is missing, fix it before starting work.
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### Anti-Patterns
|
|
304
|
+
|
|
305
|
+
**Dumping everything into one giant CLAUDE.md**
|
|
306
|
+
|
|
307
|
+
Don't. Use the layering model. Role goes in the agent spec. Culture goes in the rig spec. Project context goes in rig/pod startup files. If everything is in one file, you can't reuse any of it.
|
|
308
|
+
|
|
309
|
+
**Duplicating skill content in guidance files**
|
|
310
|
+
|
|
311
|
+
If you find yourself copying text from a skill into a guidance file, stop. Reference the skill instead. Skills are projected; guidance should point to them, not duplicate them.
|
|
312
|
+
|
|
313
|
+
**Using send_text for content that should be pre-loaded**
|
|
314
|
+
|
|
315
|
+
If the agent needs to know something BEFORE it starts reasoning, use `guidance_merge` (delivered before boot), not `send_text` (delivered after boot). `send_text` is for instructions the agent should process as a first task, not for foundational context.
|
|
316
|
+
|
|
317
|
+
**Over-specifying member-level startup**
|
|
318
|
+
|
|
319
|
+
If every member has a large startup block, the rig spec becomes a configuration dump. Refactor shared content up to the pod level. Member-level startup should be small overrides, not complete agent briefings.
|
|
320
|
+
|
|
321
|
+
**Relying on deterministic hooks for critical setup**
|
|
322
|
+
|
|
323
|
+
If your rig REQUIRES a hook to function and the hook installation fails silently, the agent won't know something is wrong. Always pair deterministic config with a startup instruction or system check that verifies the result.
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## Authoring Checklist
|
|
328
|
+
|
|
329
|
+
When creating a new agent's startup experience:
|
|
330
|
+
|
|
331
|
+
- [ ] Write a `guidance/role.md` — who is this agent?
|
|
332
|
+
- [ ] Reference it in the agent spec's `resources.guidance` AND `startup.files`
|
|
333
|
+
- [ ] Write a rig `CULTURE.md` if the rig doesn't have one
|
|
334
|
+
- [ ] Choose skills from the shared pool via profile `uses`
|
|
335
|
+
- [ ] Write a `startup/context.md` if the agent needs environment grounding
|
|
336
|
+
- [ ] Include a system check in the startup context
|
|
337
|
+
- [ ] Verify the agent spec validates: `rig agent validate agent.yaml`
|
|
338
|
+
- [ ] Verify the rig spec validates: `rig spec validate rig.yaml`
|
|
339
|
+
- [ ] Test by launching the rig and checking that the agent received the expected content
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Edge Types Reference
|
|
2
|
+
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Last validated against code: 2026-04-11
|
|
5
|
+
Source of truth: `packages/daemon/src/domain/rigspec-schema.ts`, `packages/daemon/src/domain/rigspec-instantiator.ts`
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
Edges define relationships between members in a rig topology. They appear in two places:
|
|
12
|
+
|
|
13
|
+
- **Pod-local edges** — between members in the same pod (use unqualified member IDs)
|
|
14
|
+
- **Cross-pod edges** — between members in different pods (use `pod.member` format)
|
|
15
|
+
|
|
16
|
+
See `docs/reference/rig-spec.md` for the YAML syntax.
|
|
17
|
+
|
|
18
|
+
## Edge Kinds
|
|
19
|
+
|
|
20
|
+
Five edge kinds are accepted by the validator:
|
|
21
|
+
|
|
22
|
+
| Kind | Accepted | Has Runtime Behavior | Description |
|
|
23
|
+
|------|----------|---------------------|-------------|
|
|
24
|
+
| `delegates_to` | yes | **yes — affects launch order** | Source delegates work to target |
|
|
25
|
+
| `spawned_by` | yes | **yes — affects launch order** | Target was spawned by source |
|
|
26
|
+
| `can_observe` | yes | no | Source can observe target's output |
|
|
27
|
+
| `collaborates_with` | yes | no | Peer collaboration |
|
|
28
|
+
| `escalates_to` | yes | no | Source escalates to target |
|
|
29
|
+
|
|
30
|
+
## What Edges Actually Do Today (OpenRig 0.1.x)
|
|
31
|
+
|
|
32
|
+
### Launch ordering
|
|
33
|
+
|
|
34
|
+
Only `delegates_to` and `spawned_by` affect runtime behavior. They constrain the order in which nodes are launched:
|
|
35
|
+
|
|
36
|
+
- **`delegates_to`**: source launches BEFORE target. The delegator must be up before the delegate.
|
|
37
|
+
- **`spawned_by`**: target (parent) launches BEFORE source (child). The parent must be up before the child it spawned.
|
|
38
|
+
|
|
39
|
+
This ordering is enforced in both `PodRigInstantiator` (initial launch) and `RestoreOrchestrator` (restore from snapshot). The code uses topological sort over the dependency graph — if there's a cycle, instantiation fails.
|
|
40
|
+
|
|
41
|
+
All other edge kinds (`can_observe`, `collaborates_with`, `escalates_to`) do NOT constrain launch order.
|
|
42
|
+
|
|
43
|
+
### Graph visualization
|
|
44
|
+
|
|
45
|
+
All edges are rendered in the UI topology graph. They create visual connections between nodes, helping the operator understand the team structure. Pod-local edges appear within the pod group; cross-pod edges connect across groups.
|
|
46
|
+
|
|
47
|
+
### Identity projection
|
|
48
|
+
|
|
49
|
+
All edges appear in `rig whoami --json` output under `edges.outgoing` and `edges.incoming`, with their kind and the connected peer's identity. This lets an agent know its relationship to other members — but the agent interprets this information, it's not enforced by the runtime.
|
|
50
|
+
|
|
51
|
+
### Attach hint heuristic
|
|
52
|
+
|
|
53
|
+
The post-command handoff (the "Attach:" line after `rig up` and `rig restore`) uses edges to prefer the orchestrator as the default attach target. The heuristic looks for the first node with `delegates_to` outgoing edges.
|
|
54
|
+
|
|
55
|
+
## What Edges Do NOT Do Today
|
|
56
|
+
|
|
57
|
+
Edges do NOT currently:
|
|
58
|
+
|
|
59
|
+
- **Route messages** — `rig send` can target any session, regardless of edges
|
|
60
|
+
- **Enforce delegation** — an agent can communicate with any peer, not just its edge targets
|
|
61
|
+
- **Control permissions** — there's no edge-based access control
|
|
62
|
+
- **Affect transport** — `rig capture`, `rig broadcast`, etc. work based on session identity, not edge topology
|
|
63
|
+
|
|
64
|
+
These are aspirational capabilities. The edge vocabulary is intentionally richer than the current runtime behavior so that the topology captures design intent even before the runtime enforces it.
|
|
65
|
+
|
|
66
|
+
## Design Intent (Why We Have Five Kinds)
|
|
67
|
+
|
|
68
|
+
The five kinds represent a taxonomy of how agents relate to each other in a working team:
|
|
69
|
+
|
|
70
|
+
**`delegates_to`** — the most common edge. An orchestrator delegates to an implementer. A lead delegates to a worker. This is the primary workflow direction. When an orchestrator sends a task, it uses `rig send` to the session it `delegates_to`.
|
|
71
|
+
|
|
72
|
+
**`spawned_by`** — for hierarchical launch relationships. A subagent spawned by a parent process. Less common in current topologies.
|
|
73
|
+
|
|
74
|
+
**`can_observe`** — the review/oversight relationship. A reviewer observes an implementer's work. The reviewer can `rig capture` and `rig transcript` the implementation session. This edge communicates intent: "I'm watching your output."
|
|
75
|
+
|
|
76
|
+
**`collaborates_with`** — peer relationships. Two agents working side-by-side at the same level of the hierarchy. Neither delegates to the other.
|
|
77
|
+
|
|
78
|
+
**`escalates_to`** — the reverse of delegation. When a worker hits a decision it can't make, it escalates to a lead. This is less common in current topologies but represents a real coordination pattern.
|
|
79
|
+
|
|
80
|
+
## Choosing Edge Kinds
|
|
81
|
+
|
|
82
|
+
### Common Patterns
|
|
83
|
+
|
|
84
|
+
**Orchestrator → workers:**
|
|
85
|
+
```yaml
|
|
86
|
+
edges:
|
|
87
|
+
- kind: delegates_to
|
|
88
|
+
from: orch.lead
|
|
89
|
+
to: dev.impl
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Reviewer → implementer:**
|
|
93
|
+
```yaml
|
|
94
|
+
edges:
|
|
95
|
+
- kind: can_observe
|
|
96
|
+
from: rev.r1
|
|
97
|
+
to: dev.impl
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Implementation pair:**
|
|
101
|
+
```yaml
|
|
102
|
+
edges:
|
|
103
|
+
- kind: delegates_to
|
|
104
|
+
from: impl
|
|
105
|
+
to: qa
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### When You're Not Sure
|
|
109
|
+
|
|
110
|
+
If you're unsure which edge kind to use:
|
|
111
|
+
|
|
112
|
+
1. Does one agent give work to the other? → `delegates_to`
|
|
113
|
+
2. Does one agent watch the other's output? → `can_observe`
|
|
114
|
+
3. Are they equals working together? → `collaborates_with`
|
|
115
|
+
4. Does one report problems up? → `escalates_to`
|
|
116
|
+
5. Did one create the other? → `spawned_by`
|
|
117
|
+
|
|
118
|
+
If none fit, `can_observe` is the safest default — it documents the relationship without implying a workflow direction and doesn't affect launch ordering.
|
|
119
|
+
|
|
120
|
+
## Validation Rules
|
|
121
|
+
|
|
122
|
+
1. Edge kinds must be one of: `delegates_to`, `spawned_by`, `can_observe`, `collaborates_with`, `escalates_to`
|
|
123
|
+
2. Pod-local edges use unqualified member IDs — both `from` and `to` must exist in the same pod
|
|
124
|
+
3. Cross-pod edges use `pod.member` format — both endpoints must resolve to actual members
|
|
125
|
+
4. Cross-pod edges must reference different pods (same-pod edges should use the pod-local syntax)
|
|
126
|
+
5. Self-edges are not validated at the schema level but are not meaningful
|