@elizaos/plugin-agent-orchestrator 2.0.0-alpha.5 → 2.0.0-alpha.537

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 (190) hide show
  1. package/README.md +233 -0
  2. package/assets/claude-code-skills/eliza-runtime/SKILL.md +123 -0
  3. package/assets/claude-code-skills/eliza-runtime/references/hooks.md +82 -0
  4. package/assets/claude-code-skills/eliza-runtime/references/orchestration.md +68 -0
  5. package/assets/claude-code-skills/eliza-runtime/references/synthesis.md +84 -0
  6. package/assets/claude-code-skills/eliza-runtime/scripts/eliza-context.sh +103 -0
  7. package/assets/claude-code-skills/eliza-runtime/scripts/eliza-decision.sh +48 -0
  8. package/assets/claude-code-skills/eliza-runtime/scripts/eliza-parent.sh +143 -0
  9. package/dist/actions/coding-task-handlers.d.ts +64 -0
  10. package/dist/actions/coding-task-handlers.d.ts.map +1 -0
  11. package/dist/actions/coding-task-helpers.d.ts +35 -0
  12. package/dist/actions/coding-task-helpers.d.ts.map +1 -0
  13. package/dist/actions/eval-metadata.d.ts +11 -0
  14. package/dist/actions/eval-metadata.d.ts.map +1 -0
  15. package/dist/actions/finalize-workspace.d.ts +11 -0
  16. package/dist/actions/finalize-workspace.d.ts.map +1 -0
  17. package/dist/actions/list-agents.d.ts +13 -0
  18. package/dist/actions/list-agents.d.ts.map +1 -0
  19. package/dist/actions/manage-issues.d.ts +11 -0
  20. package/dist/actions/manage-issues.d.ts.map +1 -0
  21. package/dist/actions/provision-workspace.d.ts +11 -0
  22. package/dist/actions/provision-workspace.d.ts.map +1 -0
  23. package/dist/actions/send-to-agent.d.ts +12 -0
  24. package/dist/actions/send-to-agent.d.ts.map +1 -0
  25. package/dist/actions/spawn-agent.d.ts +12 -0
  26. package/dist/actions/spawn-agent.d.ts.map +1 -0
  27. package/dist/actions/start-coding-task.d.ts +69 -0
  28. package/dist/actions/start-coding-task.d.ts.map +1 -0
  29. package/dist/actions/stop-agent.d.ts +12 -0
  30. package/dist/actions/stop-agent.d.ts.map +1 -0
  31. package/dist/actions/task-control.d.ts +3 -0
  32. package/dist/actions/task-control.d.ts.map +1 -0
  33. package/dist/actions/task-history.d.ts +3 -0
  34. package/dist/actions/task-history.d.ts.map +1 -0
  35. package/dist/actions/task-share.d.ts +3 -0
  36. package/dist/actions/task-share.d.ts.map +1 -0
  37. package/dist/actions/task-thread-target.d.ts +11 -0
  38. package/dist/actions/task-thread-target.d.ts.map +1 -0
  39. package/dist/api/agent-routes.d.ts +18 -0
  40. package/dist/api/agent-routes.d.ts.map +1 -0
  41. package/dist/api/bridge-routes.d.ts +32 -0
  42. package/dist/api/bridge-routes.d.ts.map +1 -0
  43. package/dist/api/coordinator-routes.d.ts +22 -0
  44. package/dist/api/coordinator-routes.d.ts.map +1 -0
  45. package/dist/api/hook-routes.d.ts +18 -0
  46. package/dist/api/hook-routes.d.ts.map +1 -0
  47. package/dist/api/issue-routes.d.ts +17 -0
  48. package/dist/api/issue-routes.d.ts.map +1 -0
  49. package/dist/api/parent-context-routes.d.ts +17 -0
  50. package/dist/api/parent-context-routes.d.ts.map +1 -0
  51. package/dist/api/routes.d.ts +37 -0
  52. package/dist/api/routes.d.ts.map +1 -0
  53. package/dist/api/workspace-routes.d.ts +17 -0
  54. package/dist/api/workspace-routes.d.ts.map +1 -0
  55. package/dist/index.d.ts +36 -15
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +19823 -3387
  58. package/dist/index.js.map +72 -22
  59. package/dist/providers/action-examples.d.ts +14 -0
  60. package/dist/providers/action-examples.d.ts.map +1 -0
  61. package/dist/providers/active-workspace-context.d.ts +13 -0
  62. package/dist/providers/active-workspace-context.d.ts.map +1 -0
  63. package/dist/services/agent-credentials.d.ts +23 -0
  64. package/dist/services/agent-credentials.d.ts.map +1 -0
  65. package/dist/services/agent-metrics.d.ts +30 -0
  66. package/dist/services/agent-metrics.d.ts.map +1 -0
  67. package/dist/services/agent-selection.d.ts +53 -0
  68. package/dist/services/agent-selection.d.ts.map +1 -0
  69. package/dist/services/ansi-utils.d.ts +61 -0
  70. package/dist/services/ansi-utils.d.ts.map +1 -0
  71. package/dist/services/claude-code-skill-installer.d.ts +33 -0
  72. package/dist/services/claude-code-skill-installer.d.ts.map +1 -0
  73. package/dist/services/config-env.d.ts +23 -0
  74. package/dist/services/config-env.d.ts.map +1 -0
  75. package/dist/services/coordinator-event-normalizer.d.ts +50 -0
  76. package/dist/services/coordinator-event-normalizer.d.ts.map +1 -0
  77. package/dist/services/custom-validator-runner.d.ts +66 -0
  78. package/dist/services/custom-validator-runner.d.ts.map +1 -0
  79. package/dist/services/debug-capture.d.ts +38 -0
  80. package/dist/services/debug-capture.d.ts.map +1 -0
  81. package/dist/services/pty-auto-response.d.ts +30 -0
  82. package/dist/services/pty-auto-response.d.ts.map +1 -0
  83. package/dist/services/pty-init.d.ts +54 -0
  84. package/dist/services/pty-init.d.ts.map +1 -0
  85. package/dist/services/pty-service.d.ts +206 -0
  86. package/dist/services/pty-service.d.ts.map +1 -0
  87. package/dist/services/pty-session-io.d.ts +49 -0
  88. package/dist/services/pty-session-io.d.ts.map +1 -0
  89. package/dist/services/pty-spawn.d.ts +113 -0
  90. package/dist/services/pty-spawn.d.ts.map +1 -0
  91. package/dist/services/pty-types.d.ts +94 -0
  92. package/dist/services/pty-types.d.ts.map +1 -0
  93. package/dist/services/repo-input.d.ts +16 -0
  94. package/dist/services/repo-input.d.ts.map +1 -0
  95. package/dist/services/session-event-queue.d.ts +25 -0
  96. package/dist/services/session-event-queue.d.ts.map +1 -0
  97. package/dist/services/skill-callback-bridge.d.ts +78 -0
  98. package/dist/services/skill-callback-bridge.d.ts.map +1 -0
  99. package/dist/services/skill-essentials.d.ts +16 -0
  100. package/dist/services/skill-essentials.d.ts.map +1 -0
  101. package/dist/services/skill-lifeops-context-broker.d.ts +20 -0
  102. package/dist/services/skill-lifeops-context-broker.d.ts.map +1 -0
  103. package/dist/services/skill-manifest.d.ts +48 -0
  104. package/dist/services/skill-manifest.d.ts.map +1 -0
  105. package/dist/services/skill-recommender.d.ts +51 -0
  106. package/dist/services/skill-recommender.d.ts.map +1 -0
  107. package/dist/services/stall-classifier.d.ts +69 -0
  108. package/dist/services/stall-classifier.d.ts.map +1 -0
  109. package/dist/services/structured-proof-bridge.d.ts +99 -0
  110. package/dist/services/structured-proof-bridge.d.ts.map +1 -0
  111. package/dist/services/swarm-coordinator-prompts.d.ts +97 -0
  112. package/dist/services/swarm-coordinator-prompts.d.ts.map +1 -0
  113. package/dist/services/swarm-coordinator.d.ts +471 -0
  114. package/dist/services/swarm-coordinator.d.ts.map +1 -0
  115. package/dist/services/swarm-decision-loop.d.ts +52 -0
  116. package/dist/services/swarm-decision-loop.d.ts.map +1 -0
  117. package/dist/services/swarm-event-triage.d.ts +49 -0
  118. package/dist/services/swarm-event-triage.d.ts.map +1 -0
  119. package/dist/services/swarm-history.d.ts +27 -0
  120. package/dist/services/swarm-history.d.ts.map +1 -0
  121. package/dist/services/swarm-idle-watchdog.d.ts +22 -0
  122. package/dist/services/swarm-idle-watchdog.d.ts.map +1 -0
  123. package/dist/services/task-acceptance.d.ts +8 -0
  124. package/dist/services/task-acceptance.d.ts.map +1 -0
  125. package/dist/services/task-agent-auth.d.ts +69 -0
  126. package/dist/services/task-agent-auth.d.ts.map +1 -0
  127. package/dist/services/task-agent-frameworks.d.ts +90 -0
  128. package/dist/services/task-agent-frameworks.d.ts.map +1 -0
  129. package/dist/services/task-kind.d.ts +3 -0
  130. package/dist/services/task-kind.d.ts.map +1 -0
  131. package/dist/services/task-policy.d.ts +17 -0
  132. package/dist/services/task-policy.d.ts.map +1 -0
  133. package/dist/services/task-registry.d.ts +550 -0
  134. package/dist/services/task-registry.d.ts.map +1 -0
  135. package/dist/services/task-share.d.ts +18 -0
  136. package/dist/services/task-share.d.ts.map +1 -0
  137. package/dist/services/task-validation.d.ts +69 -0
  138. package/dist/services/task-validation.d.ts.map +1 -0
  139. package/dist/services/task-verifier-runner.d.ts +5 -0
  140. package/dist/services/task-verifier-runner.d.ts.map +1 -0
  141. package/dist/services/trajectory-context.d.ts +73 -0
  142. package/dist/services/trajectory-context.d.ts.map +1 -0
  143. package/dist/services/trajectory-feedback.d.ts +53 -0
  144. package/dist/services/trajectory-feedback.d.ts.map +1 -0
  145. package/dist/services/workspace-git-ops.d.ts +28 -0
  146. package/dist/services/workspace-git-ops.d.ts.map +1 -0
  147. package/dist/services/workspace-github.d.ts +60 -0
  148. package/dist/services/workspace-github.d.ts.map +1 -0
  149. package/dist/services/workspace-lifecycle.d.ts +18 -0
  150. package/dist/services/workspace-lifecycle.d.ts.map +1 -0
  151. package/dist/services/workspace-service.d.ts +121 -0
  152. package/dist/services/workspace-service.d.ts.map +1 -0
  153. package/dist/services/workspace-types.d.ts +81 -0
  154. package/dist/services/workspace-types.d.ts.map +1 -0
  155. package/package.json +28 -43
  156. package/scripts/ensure-node-pty.mjs +100 -0
  157. package/dist/src/actions/messaging.d.ts +0 -24
  158. package/dist/src/actions/messaging.d.ts.map +0 -1
  159. package/dist/src/actions/subagent-management.d.ts +0 -7
  160. package/dist/src/actions/subagent-management.d.ts.map +0 -1
  161. package/dist/src/actions/task-management.d.ts +0 -9
  162. package/dist/src/actions/task-management.d.ts.map +0 -1
  163. package/dist/src/config.d.ts +0 -4
  164. package/dist/src/config.d.ts.map +0 -1
  165. package/dist/src/providers/orchestrator-config.d.ts +0 -80
  166. package/dist/src/providers/orchestrator-config.d.ts.map +0 -1
  167. package/dist/src/providers/task-context.d.ts +0 -3
  168. package/dist/src/providers/task-context.d.ts.map +0 -1
  169. package/dist/src/services/agent-orchestrator-service.d.ts +0 -59
  170. package/dist/src/services/agent-orchestrator-service.d.ts.map +0 -1
  171. package/dist/src/services/messaging-service.d.ts +0 -111
  172. package/dist/src/services/messaging-service.d.ts.map +0 -1
  173. package/dist/src/services/sandbox-service.d.ts +0 -103
  174. package/dist/src/services/sandbox-service.d.ts.map +0 -1
  175. package/dist/src/services/subagent-service.d.ts +0 -110
  176. package/dist/src/services/subagent-service.d.ts.map +0 -1
  177. package/dist/src/types/index.d.ts +0 -12
  178. package/dist/src/types/index.d.ts.map +0 -1
  179. package/dist/src/types/messaging.d.ts +0 -202
  180. package/dist/src/types/messaging.d.ts.map +0 -1
  181. package/dist/src/types/sandbox.d.ts +0 -228
  182. package/dist/src/types/sandbox.d.ts.map +0 -1
  183. package/dist/src/types/subagent.d.ts +0 -224
  184. package/dist/src/types/subagent.d.ts.map +0 -1
  185. package/dist/src/types.d.ts +0 -113
  186. package/dist/src/types.d.ts.map +0 -1
  187. package/dist/src/utils/index.d.ts +0 -7
  188. package/dist/src/utils/index.d.ts.map +0 -1
  189. package/dist/src/utils/session.d.ts +0 -106
  190. package/dist/src/utils/session.d.ts.map +0 -1
package/README.md ADDED
@@ -0,0 +1,233 @@
1
+ # @elizaos/plugin-agent-orchestrator
2
+
3
+ Orchestrate CLI task agents (Claude Code, Codex, Gemini CLI, Aider, Pi) via PTY sessions and git workspaces for open-ended background work.
4
+
5
+ Built for [Eliza](https://github.com/eliza-ai/eliza). The plugin registers elizaOS-compatible actions and services so any Eliza agent can delegate substantial work to sub-agents while continuing the user conversation. The full experience, including live xterm views, PTY output streaming, and swarm monitoring, is available through the Eliza frontend and server.
6
+
7
+ ## Features
8
+
9
+ - **Open-ended task delegation**: Use task agents for anything beyond a simple reply, including coding, research, drafting, debugging, repo work, and multi-step execution
10
+ - **PTY session management**: Spawn, control, and monitor task agents running in pseudo-terminals
11
+ - **Current task status**: Surface active sessions, coordinator task state, and pending confirmations so the main agent can keep the user updated
12
+ - **Subscription-aware framework preference**: Prefer Claude Code or Codex when Eliza knows the user is logged in with Anthropic or OpenAI-backed subscriptions
13
+ - **Git workspace provisioning**: Clone repos, create worktrees, manage branches, commits, pushes, and pull requests
14
+ - **Multi-agent support**: Claude Code, Codex, Gemini CLI, Aider, Pi, or generic shell flows through the same orchestration surface
15
+
16
+ ## Prerequisites
17
+
18
+ This plugin spawns CLI task agents in PTY sessions. You need at least one supported framework installed locally:
19
+
20
+ | Framework | Install | Docs |
21
+ |-----------|---------|------|
22
+ | **Claude Code** | `npm install -g @anthropic-ai/claude-code` | [claude.ai/claude-code](https://claude.ai/claude-code) |
23
+ | **Codex** | `npm install -g @openai/codex` | [github.com/openai/codex](https://github.com/openai/codex) |
24
+ | **Gemini CLI** | `npm install -g @google/gemini-cli` | [github.com/google-gemini/gemini-cli](https://github.com/google-gemini/gemini-cli) |
25
+ | **Aider** | `pip install aider-chat` | [aider.chat](https://aider.chat) |
26
+ | **Pi** | install the `pi` CLI available on your host | provider-specific |
27
+
28
+ Each framework also needs its own auth. API keys still work, but the orchestrator can also detect subscription-backed CLI logins:
29
+
30
+ - `ANTHROPIC_API_KEY` or a Claude Code subscription login for Claude Code
31
+ - `OPENAI_API_KEY` or a Codex login for Codex
32
+ - `GOOGLE_GENERATIVE_AI_API_KEY` or `GOOGLE_API_KEY` for Gemini CLI
33
+
34
+ The provider surface exposes the currently available frameworks and the preferred default. If the user does not specify a framework, the plugin picks the best available option automatically.
35
+
36
+ ## Installation
37
+
38
+ ```bash
39
+ npm install @elizaos/plugin-agent-orchestrator
40
+ ```
41
+
42
+ The following peer dependencies will be installed automatically:
43
+
44
+ - `pty-manager` — PTY session management
45
+ - `git-workspace-service` — git workspace provisioning
46
+ - `coding-agent-adapters` — CLI agent adapter layer
47
+
48
+ ## Usage
49
+
50
+ ### Register the Plugin
51
+
52
+ ```typescript
53
+ import taskAgentPlugin from "@elizaos/plugin-agent-orchestrator";
54
+
55
+ // Add to your Eliza or elizaOS agent configuration
56
+ const agent = {
57
+ plugins: [taskAgentPlugin],
58
+ // ... other config
59
+ };
60
+ ```
61
+
62
+ `codingAgentPlugin` is still exported as a compatibility alias, but `taskAgentPlugin` is the canonical export.
63
+
64
+ ### Canonical Actions
65
+
66
+ | Action | Description |
67
+ |--------|-------------|
68
+ | `CREATE_TASK` | Create an asynchronous task-agent job for substantial work |
69
+ | `SPAWN_AGENT` | Spawn a task agent session immediately |
70
+ | `SEND_TO_AGENT` | Send input or keys to a running task agent |
71
+ | `LIST_AGENTS` | List active sessions and current task status |
72
+ | `STOP_AGENT` | Terminate an agent session |
73
+ | `PROVISION_WORKSPACE` | Clone a repo or create a worktree |
74
+ | `FINALIZE_WORKSPACE` | Commit, push, and optionally create PR |
75
+
76
+ Legacy action names such as `START_CODING_TASK`, `SPAWN_CODING_AGENT`, `SEND_TO_CODING_AGENT`, `LIST_CODING_AGENTS`, and `STOP_CODING_AGENT` remain supported as aliases.
77
+
78
+ ### Example Conversation
79
+
80
+ ```
81
+ User: This is bigger than a simple reply. Create a background task to inspect the repo, fix the auth bug, and open a PR.
82
+ Agent: Starting a task agent for the repo work...
83
+ Session ID: abc123, Status: running
84
+
85
+ User: What task agents are running?
86
+ Agent: Active task agents:
87
+ 1. Claude Code (abc123...) - running
88
+ Working in: /workspace
89
+
90
+ User: Tell it to accept the changes
91
+ Agent: Sent "y" to the task agent.
92
+
93
+ User: Create a PR for the fix
94
+ Agent: Workspace finalized!
95
+ Commit: a1b2c3d4
96
+ PR #42: https://github.com/user/repo/pull/42
97
+ ```
98
+
99
+ ## Services
100
+
101
+ ### PTYService
102
+
103
+ Manages PTY sessions for task agents.
104
+
105
+ ```typescript
106
+ import { PTYService } from "@elizaos/plugin-agent-orchestrator";
107
+
108
+ // Access via runtime
109
+ const ptyService = runtime.getService("PTY_SERVICE") as PTYService;
110
+
111
+ // Spawn a session
112
+ const session = await ptyService.spawnSession({
113
+ agentType: "claude",
114
+ workdir: "/path/to/project",
115
+ initialTask: "Fix the auth bug",
116
+ });
117
+
118
+ // Send input
119
+ await ptyService.sendToSession(session.id, "y");
120
+
121
+ // Check status
122
+ const info = ptyService.getSession(session.id);
123
+ console.log(info.status); // "running" | "blocked" | "completed"
124
+
125
+ // Stop session
126
+ await ptyService.stopSession(session.id);
127
+ ```
128
+
129
+ ### CodingWorkspaceService
130
+
131
+ Manages git workspaces for task-agent jobs.
132
+
133
+ ```typescript
134
+ import { CodingWorkspaceService } from "@elizaos/plugin-agent-orchestrator";
135
+
136
+ // Access via runtime
137
+ const workspaceService = runtime.getService("CODING_WORKSPACE_SERVICE");
138
+
139
+ // Clone a repo
140
+ const workspace = await workspaceService.provisionWorkspace({
141
+ repoUrl: "https://github.com/user/repo.git",
142
+ branch: "feature/my-feature",
143
+ });
144
+
145
+ // Create worktree for parallel work
146
+ const worktree = await workspaceService.provisionWorkspace({
147
+ useWorktree: true,
148
+ parentWorkspaceId: workspace.id,
149
+ branch: "bugfix/issue-123",
150
+ });
151
+
152
+ // Commit and push
153
+ await workspaceService.commit(workspace.id, {
154
+ message: "fix: resolve auth issue",
155
+ all: true,
156
+ });
157
+ await workspaceService.push(workspace.id, { setUpstream: true });
158
+
159
+ // Create PR
160
+ const pr = await workspaceService.createPR(workspace.id, {
161
+ title: "Fix auth issue",
162
+ body: "Resolves #123",
163
+ });
164
+ ```
165
+
166
+ ## Configuration
167
+
168
+ Configure via runtime settings and Eliza config:
169
+
170
+ ```typescript
171
+ // PTY Service config
172
+ runtime.setSetting("PTY_SERVICE_CONFIG", {
173
+ maxSessions: 5,
174
+ idleTimeoutMs: 30 * 60 * 1000,
175
+ debug: true,
176
+ });
177
+
178
+ // Workspace Service config
179
+ runtime.setSetting("CODING_WORKSPACE_CONFIG", {
180
+ baseDir: "~/.eliza/workspaces",
181
+ credentials: {
182
+ github: { token: process.env.GITHUB_TOKEN },
183
+ },
184
+ debug: true,
185
+ });
186
+
187
+ // Optional fixed default when you do not want auto-selection
188
+ runtime.setSetting("PARALLAX_DEFAULT_AGENT_TYPE", "codex");
189
+
190
+ // Selection strategy: "heuristic" | "fixed"
191
+ runtime.setSetting("PARALLAX_AGENT_SELECTION_STRATEGY", "heuristic");
192
+ ```
193
+
194
+ To bias the preferred framework toward the user's paid subscription, Eliza can store a provider hint in `~/.eliza/eliza.json`:
195
+
196
+ ```json
197
+ {
198
+ "agents": {
199
+ "defaults": {
200
+ "subscriptionProvider": "anthropic-subscription"
201
+ }
202
+ }
203
+ }
204
+ ```
205
+
206
+ Supported subscription hints currently include Anthropic and OpenAI-backed flows, which map to Claude Code and Codex when those CLIs are installed and authenticated.
207
+
208
+ ## Testing
209
+
210
+ Run the standard suite:
211
+
212
+ ```bash
213
+ bun test
214
+ ```
215
+
216
+ Run the opt-in live smoke tests against real Claude Code and Codex sessions:
217
+
218
+ ```bash
219
+ bun run test:live
220
+ ```
221
+
222
+ The live suite creates temporary workspaces, asks the real CLIs to complete small file-writing and browser-backed tasks, and verifies both task execution and task-status visibility. It also has Claude Code and Codex create a simple counter app, emit `APP_CREATE_DONE`, pass parent-side typecheck/lint/test verification, and register the generated app through the unified `APP` `load_from_directory` mode. Set `ELIZA_LIVE_CODEX_MODEL` or `ELIZA_LIVE_CLAUDE_MODEL` to pin a live-test model when needed. If Codex reports that its configured model requires a newer CLI, the counter-app smoke attempts one `npm install -g --prefix <active-codex-prefix> @openai/codex@latest` update through the npm binary colocated with `codex`, then retries once. If Claude Code reports logged-in status but `claude -p` returns 401, the smoke emits `AUTH_REQUIRED` with a `claude setup-token` instruction instead of surfacing a raw provider failure.
223
+
224
+ ## Dependencies
225
+
226
+ - `pty-manager` - PTY session management with stall detection and auto-response
227
+ - `coding-agent-adapters` - Adapter layer for Claude Code, Codex, Gemini CLI, Aider CLIs
228
+ - `git-workspace-service` - Git workspace provisioning, credential management, and PR creation
229
+ - `pty-console` - Terminal bridge for xterm.js frontend integration
230
+
231
+ ## License
232
+
233
+ MIT
@@ -0,0 +1,123 @@
1
+ ---
2
+ name: Eliza Runtime
3
+ description: This skill applies when running as an autonomous sub-agent of Eliza (an elizaOS-based assistant) — detected via the `PARALLAX_SESSION_ID` env var that Eliza's PTY service injects at spawn, OR via a workspace path under `~/.eliza/workspaces/` or `~/.eliza/workspaces/`, OR via `.claude/settings.json` containing `coding-agents/hooks`. When any of those signals is present, this skill is the operating manual: covers identity (you are NOT interactive — there is no human typing prompts to you in real time), tool discovery (different builds and tiers expose different tools — find what you have, use it), the orchestration model (PTY + telemetry hooks + swarm coordinator + synthesis layer), the sealed-env / workspace-only-write constraints, the universal stdout DECISION channel, and the bridge HTTP endpoints for reading parent state. When none of those signals are present, this skill is irrelevant — ignore it.
4
+ version: 0.4.0
5
+ ---
6
+
7
+ # Eliza Runtime
8
+
9
+ ## You are an autonomous sub-agent — NOT an interactive Claude Code session
10
+
11
+ If `$PARALLAX_SESSION_ID` is set, your `.claude/settings.json` contains `coding-agents/hooks`, OR your workspace is under `~/.eliza/workspaces/` or `~/.eliza/workspaces/`, **you are running inside Eliza as an autonomous sub-agent.** Differences from interactive Claude Code that matter:
12
+
13
+ - **There is NO human in front of you.** Nobody is typing prompts in real time. Nobody can run `! command` for you. Don't suggest "use the `!` prefix" — that's interactive-Claude-Code language; you are not in that mode.
14
+ - **Your stdout is the channel back to the human**, but only after a synthesis pass condenses it. The human reads Eliza's polished synthesis, not your raw output.
15
+ - **Your task brief is what you got at start.** No follow-ups. No clarifying questions to a human (those convert to escalations and can stall the swarm). If you genuinely cannot proceed, surface a clear `DECISION: cannot continue because <reason>` and stop.
16
+ - **Don't say "I can't run X without your help."** You're alone. If you can't run something, figure out an alternative path or report what you found and stop.
17
+
18
+ ## Find your tools BEFORE claiming you can't do something
19
+
20
+ Your tool list varies by Claude Code build and account tier. Don't assume you have `Bash` (or that you don't). The orchestrator pre-writes `.claude/settings.json` with a broad `permissions.allow` list and `--dangerously-skip-permissions` so whatever your build exposes is auto-approved. Different tiers expose different tools — for example:
21
+
22
+ - Some tiers expose `Bash`, `Write`, `Edit`, `MultiEdit`, `BashOutput`, `KillShell`, `WebFetch`, `Task`, `Skill` (developer tier).
23
+ - Some tiers expose `Monitor` (background script runner — equivalent to Bash for your purposes), `ScheduleWakeup`, `ToolSearch`, `EnterPlanMode`/`ExitPlanMode`, `EnterWorktree`/`ExitWorktree`, `CronCreate`/`CronDelete`/`CronList`, `TaskOutput`, `PushNotification`, `RemoteTrigger` (claude.ai tier).
24
+ - Read tools (`Read`, `Grep`, `Glob`, `LS`, `NotebookRead`) and planning tools (`TodoWrite`, `AskUserQuestion`) are present everywhere.
25
+
26
+ **Before refusing a task, enumerate:**
27
+
28
+ 1. Read `.claude/settings.json` — `permissions.allow` is the runtime-level allow list.
29
+ 2. If your build offers `ToolSearch`, use it to discover deferred tools by keyword (e.g. search for "shell" or "bash").
30
+ 3. Use whichever shell-execution tool you actually have. If `Bash` is absent but `Monitor` is present, use `Monitor` — write the command into a script and let it stream output. The orchestrator's swarm-decision-loop watches stdout regardless of which tool produced the bytes.
31
+
32
+ If after enumerating you have only read-only tools, do the most useful read-only thing you can (Read/Grep are very capable for inspection tasks) and surface a `DECISION:` line explaining what's missing.
33
+
34
+ ## What Eliza is
35
+
36
+ [Eliza](https://github.com/eliza-ai/eliza) is an autonomous-assistant framework on top of [elizaOS](https://github.com/elizaOS/eliza). When a user gives Eliza a task in chat (Discord, web, etc.), Eliza's orchestrator (`@elizaos/plugin-agent-orchestrator`) spawns YOU in a sealed PTY. You do the work. Eliza's swarm-decision-loop watches your output, decides when you're done, validates the result, then synthesizes a user-facing message and posts it back to the originating chat channel.
37
+
38
+ The user-facing voice is Eliza's, not yours. Your job is to do the work and produce a clear final answer; Eliza narrates.
39
+
40
+ ## Spawn variants — what's wired changes by task type
41
+
42
+ | Variant | When | `CLAUDE.md` brief | HTTP hooks | DECISION channel |
43
+ |---|---|---|---|---|
44
+ | `swarm` | multi-agent CREATE_TASK (you have siblings) | ✓ in workspace | ✓ wired | stdout + HTTP |
45
+ | `repo` | single-agent CREATE_TASK against a real repo | ✗ | ✓ wired | stdout + HTTP |
46
+ | `scratch` | SPAWN_AGENT in a temp scratch workspace | ✗ | ✗ NOT wired | stdout only |
47
+
48
+ **Always-on regardless of variant**: stdout PTY tailing (orchestrator greps your output for `DECISION:` lines), env-allowlist sealing, workspace `allowedDirectories`, the `PARALLAX_SESSION_ID` marker, the synthesis layer at task end.
49
+
50
+ ## The DECISION protocol — coordinating with the orchestrator
51
+
52
+ Eliza's swarm-decision-loop watches your stdout for `DECISION:` prefixed lines. Use them when you make a creative or architectural choice not covered by the task brief, or when reporting a hard limitation (missing tool, unreachable resource):
53
+
54
+ ```
55
+ DECISION: chose to put the API route at /api/v1/messages/ rather than /messages/
56
+ because the existing eliza-cloud routes all use the /api/v1/ prefix.
57
+
58
+ DECISION: cannot run shell commands — this session has Read/Grep/Glob but no
59
+ Bash, Monitor, or run_shell_command. Reported what I could find statically.
60
+ ```
61
+
62
+ The orchestrator captures these and shares them with sibling agents (swarm variant) and the synthesis layer. ALWAYS-ON, no shell tool required — just print the line.
63
+
64
+ ## The bridge — read parent state (HTTP, optional)
65
+
66
+ When hooks ARE wired, Eliza exposes read-only HTTP endpoints for parent state. Useful when you need to resolve pronouns ("the user's dad") or retrieve context the task brief didn't surface:
67
+
68
+ ```
69
+ GET http://localhost:${ELIZA_HOOK_PORT:-2138}/api/coding-agents/$PARALLAX_SESSION_ID/parent-context
70
+ GET http://localhost:${ELIZA_HOOK_PORT:-2138}/api/coding-agents/$PARALLAX_SESSION_ID/memory?q=...&limit=N
71
+ GET http://localhost:${ELIZA_HOOK_PORT:-2138}/api/coding-agents/$PARALLAX_SESSION_ID/active-workspaces
72
+ ```
73
+
74
+ Auth is the path-embedded session id. All GET-only, loopback-only, read-only. There is NO write endpoint — sub-agents can't mutate parent state.
75
+
76
+ If you have **WebFetch**: call those URLs directly.
77
+ If you have **Bash** or **Monitor**: use the helper `bash scripts/eliza-parent.sh context` (the helper is bash-based; on Monitor-only tiers, run it via Monitor instead).
78
+ If you have **neither** (typical scratch with readonly preset): the bridge is unreachable; rely on the task brief and your own reasoning.
79
+
80
+ ## Helper scripts (require a shell tool)
81
+
82
+ - `scripts/eliza-context.sh` — print the orchestration context as `key=value` lines
83
+ - `scripts/eliza-decision.sh "text"` — emit a structured DECISION (also echoes to stdout, the always-durable channel)
84
+ - `scripts/eliza-parent.sh context|memory [q]|peers` — query the bridge endpoints
85
+
86
+ ## Constraints — non-negotiable
87
+
88
+ - **Sealed env**: only an allowlist of vars (PATH, HOME, USER, SHELL, LANG, TERM, NODE_OPTIONS, BUN_INSTALL, ANTHROPIC_MODEL, GITHUB_TOKEN, PARALLAX_SESSION_ID, ELIZA_HOOK_PORT) is forwarded. Don't try to read parent state outside that.
89
+ - **Workspace-only writes**: write only inside your workdir. `allowedDirectories` enforces this at the tool layer.
90
+ - **Don't push to remotes**: Eliza handles git push, PR creation, cross-repo coordination.
91
+ - **Don't print secrets**: PTY output is captured. Reference secrets by env-var name.
92
+ - **Don't try to spawn nested PTYs**: your PTY is the boundary.
93
+ - **Don't treat status animations as prompts**: TUIs print "Orchestrating…" / "Thinking…" — these are re-renders, not user input.
94
+
95
+ ## What you should NEVER do
96
+
97
+ - Refuse a task as "no shell available" without first enumerating your actual tool list (settings.json + ToolSearch). Different tiers ship different shell tools — `Bash`, `Monitor`, `run_shell_command` — at least one is usually present.
98
+ - Say "use the `!` prefix" or "run this in your terminal" — there is no terminal in your face
99
+ - Ask the human to clarify or provide input — there is no human in your session
100
+ - Push to remotes, write outside workdir, print env tokens
101
+ - Treat partial information as a blocker — produce the best output you can with what you have
102
+
103
+ ## End your turn cleanly
104
+
105
+ Your last message before going idle is what synthesis reads. Make it count:
106
+
107
+ ```
108
+ [brief statement of what shipped or what was found]
109
+ [1-3 bullets of important details — URLs, paths, decisions]
110
+ [a one-line forward-pointer if relevant]
111
+ ```
112
+
113
+ Bad endings: multi-paragraph internal monologue, "Done!" with no specifics, large code blocks. The synthesizer drops noise and keeps load-bearing facts.
114
+
115
+ ## Read references for deeper context
116
+
117
+ - `references/orchestration.md` — how the swarm-coordinator decides "complete" vs "continue"
118
+ - `references/synthesis.md` — what your output looks like after Eliza's synthesizer
119
+ - `references/hooks.md` — the telemetry events your `~/.claude/settings.json` is wired to emit
120
+
121
+ ---
122
+
123
+ Maintenance: a curated subset of this manual ships inline in the workspace-lock injection so claude.ai-tier sub-agents (which lack the `Skill` tool) get the operating manual on every spawn without needing to Read this file. That subset lives at `src/services/skill-essentials.ts` (CLAUDE_SKILL_ESSENTIALS). Keep them in sync when you edit either side.
@@ -0,0 +1,82 @@
1
+ # The telemetry hooks Eliza wires into your `~/.claude/settings.json`
2
+
3
+ When the orchestrator spawns you, it patches `<workdir>/.claude/settings.json` to install HTTP hooks that fire on Claude Code lifecycle events. The hook URL is:
4
+
5
+ ```
6
+ http://localhost:${ELIZA_HOOK_PORT:-2138}/api/coding-agents/hooks
7
+ ```
8
+
9
+ The endpoint accepts POSTs with `{event, sessionId, data}` shape. The orchestrator's PTY service is the consumer.
10
+
11
+ ## Events you emit (one-way)
12
+
13
+ These fire automatically from Claude Code's hook system — you don't need to call anything explicitly:
14
+
15
+ | Event | When it fires | What the orchestrator does |
16
+ |---|---|---|
17
+ | `PreToolUse` | Before each tool call | Records to swarm-history; broadcasts to web UI |
18
+ | `PostToolUse` | After each tool call | Updates `lastActivityAt` on your task context |
19
+ | `UserPromptSubmit` | When a prompt enters your input | Notes the input arrived, suppresses turn-complete during cooldown |
20
+ | `Stop` | When Claude Code exits its main loop | Treated as `task_complete` if you didn't already emit one |
21
+ | `permission_approved` | When auto-approval policy allowed a tool | Recorded; checked for out-of-scope-path violations |
22
+ | `task_complete` | When you go idle (PTY adapter detects) | Triggers the assessment LLM; see `references/orchestration.md` |
23
+ | `blocked` | When Claude Code waits for user input | Routed through the assessment / auto-response logic |
24
+
25
+ ## Events you can manually emit
26
+
27
+ For events Claude Code doesn't fire automatically, you can POST directly. These are the supported ones:
28
+
29
+ ### `decision`
30
+
31
+ The structured form of `DECISION: ...` in stdout. Use when you want the decision recorded out-of-band:
32
+
33
+ ```bash
34
+ curl --max-time 3 -X POST "http://localhost:${ELIZA_HOOK_PORT:-2138}/api/coding-agents/hooks" \
35
+ -H "content-type: application/json" \
36
+ -d "{
37
+ \"event\":\"decision\",
38
+ \"sessionId\":\"$PARALLAX_SESSION_ID\",
39
+ \"data\":{\"text\":\"chose AES-GCM over wasm-cryptl\"}
40
+ }"
41
+ ```
42
+
43
+ Or use the `scripts/eliza-decision.sh` helper.
44
+
45
+ ## Events the orchestrator does NOT support
46
+
47
+ Don't try to POST these — they'll be ignored or rejected:
48
+
49
+ - `query` (no — there's no read endpoint for parent state)
50
+ - `request_input` (no — see `references/orchestration.md` "respond" decision pattern; if you need input, end your turn with a question and let the assessor escalate)
51
+ - `mutate_parent_state` (no — sub-agents are read-only against the parent)
52
+
53
+ ## Self-check
54
+
55
+ You can verify the hooks are wired by reading your own settings file:
56
+
57
+ ```bash
58
+ cat .claude/settings.json | python3 -c '
59
+ import json,sys
60
+ s=json.load(sys.stdin)
61
+ hooks=s.get("hooks", {})
62
+ print(f"hook events configured: {list(hooks.keys())}")
63
+ for k,v in hooks.items():
64
+ print(f" {k}: {v}")
65
+ '
66
+ ```
67
+
68
+ If the output shows hooks pointing at `localhost:2138/api/coding-agents/hooks`, the channel is wired.
69
+
70
+ ## Failure modes
71
+
72
+ | Symptom | What's happening |
73
+ |---|---|
74
+ | Hook POST returns connection refused | Parent's API server is down or restarting. The orchestrator's primary capture is your stdout — your work isn't lost; just out-of-band events for that window are. |
75
+ | Hook POST returns 401 | The orchestrator may have rotated the per-session token. Don't loop-retry; rely on stdout. |
76
+ | Hook events never reach parent (verified via dashboard) | `ELIZA_HOOK_PORT` mismatch. Fall back to default 2138 and check `~/.claude/settings.json` for the actual configured URL. |
77
+
78
+ ## What this is NOT
79
+
80
+ - Not bidirectional — the parent never POSTs back to your hook URL
81
+ - Not a memory store — events are not retained as parent-readable state for you
82
+ - Not a replacement for stdout — your stdout is the durable record of your work; hooks are complementary metadata
@@ -0,0 +1,68 @@
1
+ # How Eliza's swarm-coordinator decides "complete" vs "continue"
2
+
3
+ When you finish a turn (your stdout goes idle for the cooldown window, typically 15s after `lastInputSentAt`), the PTY adapter emits a `task_complete` event to the orchestrator. The orchestrator then runs an LLM-backed assessment to decide what should happen next.
4
+
5
+ The decision tree:
6
+
7
+ ```
8
+ task_complete event
9
+
10
+ SwarmCoordinator.handleTurnComplete(sessionId)
11
+
12
+ classifyEventTier() ← routine vs creative
13
+
14
+ [routine path] [creative path]
15
+ small-LLM assessor Eliza pipeline
16
+ ↓ ↓
17
+ returns one of:
18
+ "complete" — your work is done, run validation
19
+ "respond" — you said something the user/parent should answer
20
+ (note: if your text is asking the user a question,
21
+ this auto-converts to "escalate")
22
+ "escalate" — needs human attention, parent broadcasts an event
23
+ "ignore" — output was status / no real progress
24
+ ```
25
+
26
+ ## What happens after each decision
27
+
28
+ ### complete
29
+ 1. orchestrator captures `completionSummary` from your last 50 lines of output
30
+ 2. status flips to `tool_running` (validation phase)
31
+ 3. validator LLM judges your work against the task brief + acceptance criteria
32
+ 4. if validator says "approved" → status `completed`, synthesis fires
33
+ 5. if validator says "revise" → orchestrator sends a follow-up prompt back into your PTY ("here's what's missing, please address")
34
+ 6. if validator says "escalate" → broadcast escalation event but the answer in your jsonl is still surfaced via synthesis
35
+
36
+ ### respond
37
+ - The orchestrator sends a follow-up prompt INTO your PTY (your stdin), not back to the human.
38
+ - If the assessor judges your "respond" content is actually you asking the human a question, it auto-converts to `escalate` to avoid feeding your question back to yourself in a loop.
39
+
40
+ ### escalate
41
+ - A `swarm_attention_required` event is broadcast (web UI sees it)
42
+ - The agent's reasoning is included in the eventual synthesis output to the human
43
+ - Your PTY is force-stopped after the escalation is recorded
44
+
45
+ ### ignore
46
+ - No-op. The PTY remains idle waiting for the next input or stall timeout.
47
+
48
+ ## What you should DO
49
+
50
+ 1. End each turn cleanly. Don't leave open background jobs (`&` in shell, half-finished `bun run`, etc.) — they cause repeated pseudo-task_complete cycles.
51
+ 2. If you genuinely need human input ("which of these three options?"), say so plainly. The assessor catches this pattern and converts to `escalate`.
52
+ 3. If you're done, end with a one-line summary. The validator + synthesis read your `completionSummary` (last 50 lines), so make those lines count.
53
+
54
+ ## What you should NOT do
55
+
56
+ - Don't print "Done!" prematurely; you'll trigger task_complete before the work is verified.
57
+ - Don't pad your final message expecting it to "look complete" — completion is detected by output going idle, not by length.
58
+ - Don't try to call back into your own assessment ("orchestrator, please mark me complete") — there's no such API. Your stdout going quiet is the only signal.
59
+
60
+ ## The cooldown grace
61
+
62
+ Between when you receive an input and when the orchestrator considers `task_complete`, there's a `cooldown` (15s by default). This prevents single-keystroke inputs from being misread as completed turns. You'll see log lines like:
63
+
64
+ ```
65
+ Suppressing turn-complete for "agent-XXXX": 2s since last input (cooldown 15s)
66
+ ```
67
+
68
+ These are normal. They mean the orchestrator is waiting out the grace before judging your turn. Don't try to defeat them.
@@ -0,0 +1,84 @@
1
+ # What your output looks like after Eliza's synthesis layer
2
+
3
+ ## The synthesis pass
4
+
5
+ When the SwarmCoordinator's `swarmCompleteCb` fires (all sub-agent tasks have terminal status), Eliza runs a synthesis pass that:
6
+
7
+ 1. Reads each agent's session jsonl (your last `end_turn` text + the task's `completionSummary`)
8
+ 2. Pulls each agent's `Shared decisions` (every `DECISION:` you emitted)
9
+ 3. Reads `roomId` for the originating thread (where the task came from — e.g. a Discord channel)
10
+ 4. Generates a single user-facing message per swarm
11
+ 5. Posts that message back to the originating channel
12
+
13
+ The user sees the synthesis. They do NOT see your raw output — that lives in the swarm-history JSONL, viewable from the Eliza dashboard.
14
+
15
+ ## What the synthesizer reads from you
16
+
17
+ In order of precedence:
18
+
19
+ 1. **Your last `end_turn` text** — your final message before going idle. This is the strongest signal.
20
+ 2. **`completionSummary`** — the orchestrator captures the last 50 lines of your stdout when `task_complete` fires. Used as backup if `end_turn` is empty.
21
+ 3. **Shared decisions** — every line that started with `DECISION:`. Folded into the synthesis as bulletpoints.
22
+ 4. **The original task brief** — the synthesizer knows what was asked, so it can frame your answer in those terms.
23
+
24
+ ## Optimal final-message shape
25
+
26
+ A clean synthesis comes from a clean final message. Aim for:
27
+
28
+ ```
29
+ [brief statement of what shipped or what was found]
30
+ [1-3 bullets of important details — URLs, file paths, decisions worth highlighting]
31
+ [a one-line forward-pointer if relevant — "tested locally, ready for review"]
32
+ ```
33
+
34
+ Bad final-message shapes:
35
+
36
+ - Multi-paragraph internal monologue ("I considered X, then Y, then Z, and ultimately decided Q because…")
37
+ - "Done!" with no specifics
38
+ - Large code blocks (the synthesizer mostly drops these — code lives in commits)
39
+ - Apology phrases ("I had some trouble at first but…")
40
+
41
+ ## What the synthesizer drops
42
+
43
+ - ANSI escape sequences and TUI re-renders
44
+ - Tool-call status lines like "Reading file...", "Running command..."
45
+ - Progress spinners
46
+ - Repeated "Orchestrating…" lines from your own UI
47
+ - Raw bash command output (unless you explicitly framed it as a result)
48
+
49
+ ## Concrete example
50
+
51
+ Your stdout's last few seconds:
52
+
53
+ ```
54
+ Reading agent-home/data/apps/edad/index.html
55
+ Editing 12 lines
56
+ Running typecheck
57
+ ✓ pass
58
+ Built /apps/council/. Open at https://eliza.nubs.site/apps/council/.
59
+ Three personas seeded by default; 4-round debate.
60
+ Encryption uses WebCrypto AES-GCM in a sarin-wrap-style envelope.
61
+ DECISION: chose WebCrypto over wasm-cryptl because cryptl has no browser bundle.
62
+ ```
63
+
64
+ What the human sees (after synthesis):
65
+
66
+ ```
67
+ council app live at https://eliza.nubs.site/apps/council/. seeded 3 default
68
+ personas, 4-round debate by default. transcripts encrypted client-side with
69
+ webcrypto AES-GCM (chose this over real cryptl since cryptl has no browser
70
+ bundle yet — sarin-wrap-shaped envelope so a future cryptl-wasm decrypts).
71
+ ```
72
+
73
+ The synthesizer condensed multi-line output to two sentences, kept all the load-bearing facts (URL, persona count, round default, crypto choice), folded the DECISION into the natural prose, and dropped the build/typecheck status as noise.
74
+
75
+ ## Implications for your behavior
76
+
77
+ 1. **Don't worry about being concise mid-task.** Verbose internal reasoning during the work doesn't reach the human.
78
+ 2. **DO be concise in your final message.** That's what the synthesizer leans on.
79
+ 3. **Use `DECISION:` for anything you want loud.** It's the high-signal channel.
80
+ 4. **Don't leak secrets in your last message.** The synthesizer might paraphrase but won't always strip — and the raw output is stored.
81
+
82
+ ## What you cannot influence
83
+
84
+ The synthesizer's tone is set by Eliza's character (which varies per deployment — every Eliza has a custom character file). You cannot dictate the tone of the user-facing message. You CAN dictate the FACTS by being precise in your output and DECISIONs.