@exaudeus/workrail 3.36.0 → 3.37.1
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/dist/config/config-file.js +2 -0
- package/dist/console-ui/assets/{index-n8cJrS4v.js → index-t8Wi304z.js} +1 -1
- package/dist/console-ui/index.html +1 -1
- package/dist/daemon/workflow-runner.d.ts +1 -0
- package/dist/daemon/workflow-runner.js +3 -6
- package/dist/infrastructure/session/SessionManager.js +17 -4
- package/dist/manifest.json +25 -17
- package/dist/trigger/notification-service.d.ts +42 -0
- package/dist/trigger/notification-service.js +164 -0
- package/dist/trigger/trigger-listener.js +7 -1
- package/dist/trigger/trigger-router.d.ts +3 -1
- package/dist/trigger/trigger-router.js +4 -1
- package/docs/design/agent-behavior-patterns-discovery.md +312 -0
- package/docs/design/agent-engine-communication-discovery.md +390 -0
- package/docs/design/agent-loop-architecture-alternatives-discovery.md +531 -0
- package/docs/design/agent-loop-error-handling-contract.md +238 -0
- package/docs/design/complete-step-approach-validation-discovery.md +344 -0
- package/docs/design/daemon-stuck-detection-discovery.md +174 -0
- package/docs/design/mcp-server-disconnect-discovery.md +245 -0
- package/docs/design/mcp-server-epipe-crash.md +198 -0
- package/docs/design/notification-design-candidates.md +131 -0
- package/docs/design/notification-design-review.md +84 -0
- package/docs/design/notification-implementation-plan.md +181 -0
- package/docs/design/spawn-agent-failure-modes.md +161 -0
- package/docs/design/spawn-agent-result-handling-implementation-plan.md +186 -0
- package/docs/design/stdio-simplification-design-candidates.md +341 -0
- package/docs/design/stdio-simplification-design-review.md +93 -0
- package/docs/design/stdio-simplification-implementation-plan.md +317 -0
- package/docs/design/structured-output-tools-coexist-findings.md +288 -0
- package/docs/discovery/coordinator-script-design.md +745 -0
- package/docs/discovery/coordinator-ux-discovery.md +471 -0
- package/docs/discovery/spawn-agent-failure-modes.md +309 -0
- package/docs/discovery/workflow-selection-for-discovery-tasks.md +336 -0
- package/docs/discovery/worktrain-status-briefing.md +325 -0
- package/docs/discovery/worktrain-status-design-candidates.md +202 -0
- package/docs/discovery/worktrain-status-design-review-findings.md +86 -0
- package/docs/ideas/backlog.md +608 -0
- package/docs/ideas/daemon-structured-output-vs-tool-calls.md +344 -0
- package/docs/ideas/design-candidates-backlog-consolidation.md +85 -0
- package/docs/ideas/design-review-findings-backlog-consolidation.md +39 -0
- package/docs/ideas/implementation_plan_backlog_consolidation.md +117 -0
- package/docs/plans/authoring-doc-staleness-enforcement-candidates.md +251 -0
- package/docs/plans/authoring-doc-staleness-enforcement-review.md +99 -0
- package/docs/plans/authoring-doc-staleness-enforcement.md +463 -0
- package/package.json +1 -1
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
# Agent Behavior Patterns: pi-mono, pi-ai, nexus-core, and WorkRail
|
|
2
|
+
|
|
3
|
+
**Status:** Complete
|
|
4
|
+
**Date:** 2026-04-16
|
|
5
|
+
**Goal:** Find system prompts and agent behavior instructions from pi-mono, pi-ai, and other autonomous agent frameworks referenced in the workrail codebase
|
|
6
|
+
|
|
7
|
+
> **Artifact strategy:** This document is a human-readable summary for review. Execution truth (decisions, findings) lives in WorkRail session notes and context variables. This file may be out of date if the session was rewound.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Context / Ask
|
|
12
|
+
|
|
13
|
+
The user wants to understand:
|
|
14
|
+
1. What patterns pi-mono, pi-ai, nexus-core, and other autonomous agent frameworks use for structuring agent behavior
|
|
15
|
+
2. Any actual system prompt / behavioral instruction text found in the WorkRail codebase
|
|
16
|
+
3. How WorkRail adopted, adapted, and in some cases superseded these frameworks
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Evidence Sources
|
|
21
|
+
|
|
22
|
+
All findings are from local WorkRail codebase sources. No remote repos were cloned.
|
|
23
|
+
|
|
24
|
+
| Source | Path | Type |
|
|
25
|
+
|--------|------|------|
|
|
26
|
+
| Soul template | `src/daemon/soul-template.ts` | Actual prompt text |
|
|
27
|
+
| System prompt assembly | `src/daemon/workflow-runner.ts` lines 1080-1137 | Actual prompt code |
|
|
28
|
+
| pi-mono tombstone | `src/daemon/pi-mono-loader.ts` | Deprecation note |
|
|
29
|
+
| First-party agent loop | `src/daemon/agent-loop.ts` | Implementation |
|
|
30
|
+
| pi-mono findings | `docs/ideas/backlog.md` lines 136-184 | Prior-art analysis |
|
|
31
|
+
| nexus-core findings | `docs/ideas/backlog.md` lines 940-953 | Prior-art analysis |
|
|
32
|
+
| pi-mono loop decision | `docs/ideas/backlog.md` lines 755-784 | Decision record |
|
|
33
|
+
| Execution engine discovery | `docs/design/daemon-execution-engine-discovery.md` | Architecture analysis |
|
|
34
|
+
| MVP autonomous platform | `docs/design/autonomous-platform-mvp-discovery.md` | Design doc |
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Landscape Packet
|
|
39
|
+
|
|
40
|
+
### 1. pi-mono (`@mariozechner/pi-agent-core` + `@mariozechner/pi-ai`)
|
|
41
|
+
|
|
42
|
+
**Source:** Mario Zechner (badlogic), 35k stars, MIT, TypeScript monorepo.
|
|
43
|
+
**Status in WorkRail:** Was selected as the daemon loop foundation (Apr 14, 2026), then replaced by WorkRail's first-party `AgentLoop` because `pi-agent-core` is a private npm package inaccessible to open-source users.
|
|
44
|
+
|
|
45
|
+
**Architecture pattern: stateless functional loop**
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
agentLoop(prompts, context, config, signal?) -> EventStream<AgentEvent, AgentMessage[]>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
- No singletons, no global state, no DI container
|
|
52
|
+
- The loop manages tool calls and context; the caller manages state
|
|
53
|
+
- `ToolExecutionMode`: sequential vs. parallel tool execution
|
|
54
|
+
- `BeforeToolCallResult` -- can block a tool call with a reason (used as evidence gate analog)
|
|
55
|
+
- `AfterToolCallResult` -- can override tool result content
|
|
56
|
+
- `agent.subscribe()` -- observability without modifying the loop
|
|
57
|
+
- `agent.abort()` -- cancellation via AbortController threaded through every async boundary
|
|
58
|
+
- `getFollowUpMessages` -- termination hook: return `[]` to signal completion
|
|
59
|
+
- `agent.steer()` -- queue-based message injection, fired after each tool batch before next LLM call
|
|
60
|
+
|
|
61
|
+
**Key packages:**
|
|
62
|
+
- `packages/ai` (`@mariozechner/pi-ai`) -- unified multi-provider LLM API: OpenAI, Anthropic, Google, Bedrock
|
|
63
|
+
- `packages/agent` (`@mariozechner/pi-agent-core`) -- `agentLoop`/`agentLoopContinue` + event stream
|
|
64
|
+
- `packages/mom` -- Slack bot: one agent per channel, MEMORY.md per workspace, skills from directory
|
|
65
|
+
- `packages/coding-agent` -- `SessionManager`, `AgentSession`, skill loading from directory
|
|
66
|
+
|
|
67
|
+
**Behavioral instruction mechanism:** None built-in. The `prompts` parameter accepts a system prompt string. Agent character comes from what the caller passes as the system prompt -- no framework-level soul/rules file. This is the key architectural difference from nexus-core.
|
|
68
|
+
|
|
69
|
+
**Non-obvious implementation detail (from WorkRail research):** pi-mono terminates structurally (no tool calls + empty follow-up queue), not semantically. WorkRail bridges `isComplete` from `continue_workflow` into `getFollowUpMessages` returning `[]`.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
### 2. nexus-core (Peter Yao, internal Zillow tool, 11 stars)
|
|
74
|
+
|
|
75
|
+
**Status in WorkRail:** Prior-art reference. Not imported. WorkRail's soul + knowledge injection system is modeled on nexus-core's patterns but with structural enforcement added.
|
|
76
|
+
|
|
77
|
+
**Architecture pattern: per-repo context injection with behavioral soul**
|
|
78
|
+
|
|
79
|
+
nexus-core organizes agent behavior into three layers:
|
|
80
|
+
|
|
81
|
+
**Layer 1: SOUL.md -- behavioral principles injected into system prompt**
|
|
82
|
+
|
|
83
|
+
> "Behavioral principles injected into agent system prompts. WorkRail Auto should ship a `SOUL.md` equivalent in daemon session system prompts -- agent character beyond workflow steps. 'Evidence before assertion' = WorkRail's enforcement principle as a behavioral norm."
|
|
84
|
+
|
|
85
|
+
The SOUL.md file is the behavioral backbone: a markdown document that defines how the agent should think and act, independent of any particular task. It is analogous to a character sheet -- not instructions for a task, but principles for decision-making.
|
|
86
|
+
|
|
87
|
+
**Layer 2: Session lifecycle hooks -- JSON stdin/stdout protocol**
|
|
88
|
+
|
|
89
|
+
Format: `{session_id, reason, transcript_path}` on session init and end.
|
|
90
|
+
|
|
91
|
+
Maps to WorkRail daemon:
|
|
92
|
+
- Init: inject ancestry, register in DaemonRegistry, acquire lock
|
|
93
|
+
- End: write checkpointToken atomically, release lock, post results to trigger source
|
|
94
|
+
|
|
95
|
+
**Layer 3: Knowledge injection -- `inject-knowledge.sh`**
|
|
96
|
+
|
|
97
|
+
Before each Claude API call, inject:
|
|
98
|
+
1. Ancestry recap (what happened in parent sessions)
|
|
99
|
+
2. `~/.workrail/knowledge/` global knowledge files
|
|
100
|
+
3. Repo-specific `.workrail/context.md`
|
|
101
|
+
|
|
102
|
+
Cap at N lines (200 default). SHORT_NAME matching for repo-relevant selection.
|
|
103
|
+
|
|
104
|
+
**Layer 4: Skills as slash commands**
|
|
105
|
+
|
|
106
|
+
Three-mirror layout: `.claude/skills/`, `skills/`, `.agents/skills/` with symlink-based plugin discovery. Core always wins. Skills are slash commands (`/fix-tests`, `/review`, etc.) -- each is a reusable agent routine.
|
|
107
|
+
|
|
108
|
+
**Layer 5: Org profile system**
|
|
109
|
+
|
|
110
|
+
`configs/profiles/zillow.yaml` declares CLI tool bindings (glab vs gh, acli vs jira-cli). Makes the agent environment-aware.
|
|
111
|
+
|
|
112
|
+
**Gap vs WorkRail:** nexus-core is fundamentally human-initiated (you run `/flow`, it works because you're there). It cannot run autonomously. No session durability. No cryptographic enforcement. It's a plugin, not a daemon.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
### 3. OpenClaw (iOfficeAI, 21.8k+, clawdkit/OpenClaw-core)
|
|
117
|
+
|
|
118
|
+
**Status in WorkRail:** Prior-art reference. `SessionActorQueue`, `RuntimeCache`, and channel abstraction patterns adopted. Confirmed internally: OpenClaw wraps `@mariozechner/pi-agent-core` internally.
|
|
119
|
+
|
|
120
|
+
**Architecture pattern: channel plugin with injected skills**
|
|
121
|
+
|
|
122
|
+
- `ChannelPlugin<ResolvedAccount>` -- one TypeScript interface, ~25 optional adapter slots
|
|
123
|
+
- `agentTools` slot on ChannelPlugin injects pi-mono typed tools at session start
|
|
124
|
+
- **WorkRail conclusion:** "Skills are not a separate primitive -- workflows ARE the skill layer."
|
|
125
|
+
- `AcpSessionStore` -- in-memory only (LRU, 5k sessions, 24h TTL). WorkRail's disk-persisted store is superior.
|
|
126
|
+
- `DeliveryRouter.resolve(triggerSource)` -- delivery binding at spawn time, not completion time
|
|
127
|
+
- Policy system: `isXxxEnabledByPolicy` flags
|
|
128
|
+
|
|
129
|
+
**Behavioral instruction mechanism:** Tool injection at session start. No standalone soul file. Agent behavior comes from: (a) tools available, (b) system prompt per channel, (c) injected agentTools.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
### 4. WorkRail's Implementation: What Was Built
|
|
134
|
+
|
|
135
|
+
#### The DAEMON_SOUL_DEFAULT (actual prompt text)
|
|
136
|
+
|
|
137
|
+
From `src/daemon/soul-template.ts`:
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
- Write code that follows the patterns already established in the codebase
|
|
141
|
+
- Never skip tests. Run existing tests before and after changes
|
|
142
|
+
- Prefer small, focused changes over large rewrites
|
|
143
|
+
- If a step asks you to write code, write actual code -- do not write pseudocode or placeholders
|
|
144
|
+
- Commit your work when you complete a logical unit
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
This is injected under the `## Agent Rules and Philosophy` section of every daemon session system prompt. It is the fallback when `~/.workrail/daemon-soul.md` is absent.
|
|
148
|
+
|
|
149
|
+
#### The full system prompt assembly (`buildSystemPrompt()`)
|
|
150
|
+
|
|
151
|
+
From `src/daemon/workflow-runner.ts` lines 1086-1136:
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
You are WorkRail Auto, an autonomous agent that executes workflows step by step.
|
|
155
|
+
|
|
156
|
+
## Your tools
|
|
157
|
+
- `continue_workflow`: Advance to the next step. Call this after completing each step's work.
|
|
158
|
+
Always include your notes in notesMarkdown and round-trip the continueToken exactly.
|
|
159
|
+
- `Bash`: Run shell commands. Use for building, testing, running scripts.
|
|
160
|
+
- `Read`: Read files.
|
|
161
|
+
- `Write`: Write files.
|
|
162
|
+
|
|
163
|
+
## Execution contract
|
|
164
|
+
1. Read the step carefully. Do ALL the work the step asks for.
|
|
165
|
+
2. Call `continue_workflow` with your notes. Include the continueToken exactly.
|
|
166
|
+
3. Repeat until the workflow reports it is complete.
|
|
167
|
+
4. Do NOT skip steps. Do NOT call `continue_workflow` without completing the step's work.
|
|
168
|
+
|
|
169
|
+
<workrail_session_state>[session state recap here]</workrail_session_state>
|
|
170
|
+
|
|
171
|
+
## Agent Rules and Philosophy
|
|
172
|
+
[DAEMON_SOUL_DEFAULT or contents of ~/.workrail/daemon-soul.md]
|
|
173
|
+
|
|
174
|
+
## Workspace: [absolute path]
|
|
175
|
+
|
|
176
|
+
## Workspace Context (from AGENTS.md / CLAUDE.md)
|
|
177
|
+
[contents of CLAUDE.md, AGENTS.md, .github/AGENTS.md in priority order, capped at 32 KB]
|
|
178
|
+
|
|
179
|
+
## Reference documents
|
|
180
|
+
[referenceUrls from trigger definition, if any]
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
#### The soul cascade (three levels)
|
|
184
|
+
|
|
185
|
+
1. `TriggerDefinition.soulFile` -- per-trigger override in `triggers.yml`
|
|
186
|
+
2. `WorkspaceConfig.soulFile` -- workspace-default soul (e.g., `~/.workrail/workspaces/my-project/daemon-soul.md`)
|
|
187
|
+
3. `~/.workrail/daemon-soul.md` -- global fallback
|
|
188
|
+
4. `DAEMON_SOUL_DEFAULT` -- hardcoded constant (last resort)
|
|
189
|
+
|
|
190
|
+
Resolved at trigger parse time by `trigger-store.ts`.
|
|
191
|
+
|
|
192
|
+
#### The first-party AgentLoop
|
|
193
|
+
|
|
194
|
+
`src/daemon/agent-loop.ts` -- replaces `@mariozechner/pi-agent-core` with identical semantics:
|
|
195
|
+
|
|
196
|
+
- `systemPrompt: string` in `AgentLoopOptions` -- passed verbatim to every `client.messages.create()` call
|
|
197
|
+
- `steer(message)` -- queue-based injection, drained after each tool batch BEFORE the next LLM call. This is distinct from `followUp()` (pi-mono's mechanism that fires only when the agent would otherwise stop). WorkRail uses `steer()` for workflow step injection -- the next step prompt is delivered after `continue_workflow` returns, not as a terminal follow-up.
|
|
198
|
+
- `subscribe(listener)` -- event subscription without modifying the loop
|
|
199
|
+
- `abort()` -- AbortController threaded through in-flight API calls
|
|
200
|
+
- `AgentEvent` union: `turn_end | agent_end`
|
|
201
|
+
- Sequential tool execution (parallel explicitly deferred -- workflow tools have ordering requirements)
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Pattern Comparison
|
|
206
|
+
|
|
207
|
+
| Pattern | pi-mono | nexus-core | OpenClaw | WorkRail |
|
|
208
|
+
|---------|---------|------------|----------|----------|
|
|
209
|
+
| **Agent behavior source** | Caller-supplied system prompt | SOUL.md file (per-org) | Channel system prompt + injected tools | `daemon-soul.md` cascade + `buildSystemPrompt()` |
|
|
210
|
+
| **Skill/routine mechanism** | Typed `AgentTool` objects | Slash commands (file-based) | `agentTools` slot on ChannelPlugin | WorkRail workflows ARE the skill layer |
|
|
211
|
+
| **Knowledge injection** | None built-in | `inject-knowledge.sh` (CLAUDE.md + ancestry) | None | CLAUDE.md + AGENTS.md at session start (32 KB cap) |
|
|
212
|
+
| **Session lifecycle hooks** | None | JSON stdin/stdout | `SessionActorQueue` | `DaemonRegistry` + session-init context_set |
|
|
213
|
+
| **Termination signal** | Structural (empty follow-up queue) | N/A | N/A | `isComplete: true` from `continue_workflow` |
|
|
214
|
+
| **Enforcement** | None (prompt-advisory) | None (prompt-advisory) | None (prompt-advisory) | HMAC token gate (cryptographic) |
|
|
215
|
+
| **Durability** | None | None | In-memory LRU (24h, crashes lost) | Disk-persisted append-only event log |
|
|
216
|
+
| **Cancellation** | `agent.abort()` via AbortSignal | N/A | `AbortController` per session | `agent.abort()` + DaemonRegistry |
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Key Patterns Across All Frameworks
|
|
221
|
+
|
|
222
|
+
### Pattern 1: Soul/Character file
|
|
223
|
+
|
|
224
|
+
All three frameworks have or use a concept of "behavioral principles injected into the system prompt at session start." nexus-core calls it SOUL.md. WorkRail calls it `daemon-soul.md`. pi-mono leaves it to the caller. The pattern is the same: a markdown file that defines how the agent reasons and acts, separate from task instructions.
|
|
225
|
+
|
|
226
|
+
### Pattern 2: Knowledge injection at boundaries
|
|
227
|
+
|
|
228
|
+
nexus-core explicitly models this as `inject-knowledge.sh`. WorkRail implements it as `loadWorkspaceContext()` reading CLAUDE.md/AGENTS.md. Both inject repo-specific context before the first LLM call, capped to prevent token bloat. The nexus-core model additionally injects ancestry (prior session context), which WorkRail mirrors with `loadSessionNotes()` (last 3 step notes, 800 chars each).
|
|
229
|
+
|
|
230
|
+
### Pattern 3: Skills as reusable routines
|
|
231
|
+
|
|
232
|
+
nexus-core: file-based slash commands in `.claude/skills/`. OpenClaw: `agentTools` injected per channel. pi-mono: `AgentTool` objects passed to the loop. WorkRail's conclusion: "WorkRail workflows ARE the skill layer." No separate skill primitive needed.
|
|
233
|
+
|
|
234
|
+
### Pattern 4: Stateless, composable agent loop
|
|
235
|
+
|
|
236
|
+
pi-mono's core architectural insight: the agent loop should have no infrastructure coupling (no singletons, no DI). It takes `(prompts, context, config)` and returns an `EventStream`. WorkRail's `AgentLoop` directly mirrors this -- `AgentLoopOptions` is the config, `subscribe()` is the event stream, `steer()` is the message injection hook.
|
|
237
|
+
|
|
238
|
+
### Pattern 5: Cooperative pause / steer
|
|
239
|
+
|
|
240
|
+
All frameworks use some form of message injection after tool calls to guide the next turn. pi-mono: `getFollowUpMessages` + `agent.steer()`. WorkRail: `steer()` called from the `turn_end` subscriber in `workflow-runner.ts` to inject the next workflow step prompt after `continue_workflow` returns.
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Gaps and Limitations
|
|
245
|
+
|
|
246
|
+
1. **No local pi-mono source available.** WorkRail's design docs contain thorough analysis of pi-mono's API, but the actual `agentLoop` implementation was not read (private npm package, no local clone). The analysis in `backlog.md` is based on API inspection and published npm package contents.
|
|
247
|
+
|
|
248
|
+
2. **nexus-core SOUL.md text not recovered.** The backlog describes the SOUL.md pattern but does not quote its contents verbatim. Only WorkRail's `DAEMON_SOUL_DEFAULT` (the direct implementation) was found. The backlog's description is based on the WorkRail author's direct reading of the nexus-core repo (accessible internally at Zillow). The soul file lives at the root of the nexus-core project -- anyone with internal repo access can read it there.
|
|
249
|
+
|
|
250
|
+
3. **pi-ai (unified provider API) details are summary-level only.** `@mariozechner/pi-ai` unifies OpenAI/Anthropic/Google/Bedrock APIs. WorkRail replaced this with a duck-typed `AgentClientInterface` in `agent-loop.ts` that accepts both `new Anthropic()` and `new AnthropicBedrock()`.
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Decision Log
|
|
255
|
+
|
|
256
|
+
| Date | Decision | Rationale |
|
|
257
|
+
|------|----------|-----------|
|
|
258
|
+
| 2026-04-14 | Adopt pi-mono's `agentLoop` pattern | Cleanest stateless loop; 1 dep; MIT; pi-agent-core 0.67.2 |
|
|
259
|
+
| 2026-04-14 | Replace pi-mono with first-party AgentLoop | `pi-agent-core` is private npm -- inaccessible to open-source users |
|
|
260
|
+
| 2026-04-14 | Adopt nexus-core's SOUL.md concept | Agent character beyond workflow steps; "Evidence before assertion" as behavioral norm |
|
|
261
|
+
| 2026-04-14 | Adopt nexus-core's knowledge injection pattern | CLAUDE.md/AGENTS.md at session start; ancestry via session notes recap |
|
|
262
|
+
| 2026-04-14 | Reject nexus-core's skill system | WorkRail workflows are the skill layer; no separate skill primitive needed |
|
|
263
|
+
|
|
264
|
+
## Final Recommendation
|
|
265
|
+
|
|
266
|
+
**Confidence: HIGH**
|
|
267
|
+
|
|
268
|
+
WorkRail's daemon system prompt and behavioral instruction mechanism is a synthesis of:
|
|
269
|
+
- pi-mono's stateless functional loop (mechanism, no behavioral text)
|
|
270
|
+
- nexus-core's SOUL.md pattern (behavioral text injection, knowledge injection, lifecycle hooks)
|
|
271
|
+
- OpenClaw's channel abstraction (tool injection at session start)
|
|
272
|
+
|
|
273
|
+
Plus WorkRail's own addition: HMAC cryptographic enforcement that none of the three source frameworks provide.
|
|
274
|
+
|
|
275
|
+
**The actual behavioral text in use today** (`DAEMON_SOUL_DEFAULT`, `src/daemon/soul-template.ts`):
|
|
276
|
+
```
|
|
277
|
+
- Write code that follows the patterns already established in the codebase
|
|
278
|
+
- Never skip tests. Run existing tests before and after changes
|
|
279
|
+
- Prefer small, focused changes over large rewrites
|
|
280
|
+
- If a step asks you to write code, write actual code -- do not write pseudocode or placeholders
|
|
281
|
+
- Commit your work when you complete a logical unit
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
**Residual risks (LOW):**
|
|
285
|
+
1. nexus-core SOUL.md verbatim text not recovered -- requires internal Zillow repo access. If the verbatim text is needed, a Glean search for 'nexus-core SOUL.md' or Peter Yao's nexus-core project may surface it from the internal knowledge base.
|
|
286
|
+
2. pi-ai provider API summary-level only -- sufficient for pattern survey; not sufficient for API-compatibility audit
|
|
287
|
+
3. OpenClaw has no standalone soul file -- behavioral character comes from per-channel system prompt + injected agentTools. There is no SOUL.md analog in OpenClaw. This distinction is important: OpenClaw's behavioral mechanism is fundamentally tool-injection-based, not file-injection-based.
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## Final Summary
|
|
292
|
+
|
|
293
|
+
**Path**: landscape_first -- empirical discovery, no reframing needed.
|
|
294
|
+
|
|
295
|
+
**Problem framing**: Etienne wanted to understand what behavioral instructions OpenClaw and nexus-core use (particularly soul files and system prompts) and how WorkRail synthesized them.
|
|
296
|
+
|
|
297
|
+
**Landscape takeaways**:
|
|
298
|
+
1. nexus-core uses a layered behavioral injection system: SOUL.md (behavioral principles) + knowledge injection (inject-knowledge.sh) + session lifecycle hooks + slash-command skills + org profile system. The SOUL.md is the behavioral backbone -- a markdown character sheet separate from task instructions.
|
|
299
|
+
2. OpenClaw uses tool injection at session start via the `agentTools` slot on `ChannelPlugin`. There is NO standalone soul file in OpenClaw -- behavioral character comes from the per-channel system prompt plus injected tools.
|
|
300
|
+
3. pi-mono has NO built-in behavioral text -- it provides only the loop mechanism. The caller supplies the system prompt. This is an intentional architectural decision, not a gap.
|
|
301
|
+
4. WorkRail synthesized all three: adopted pi-mono's stateless loop pattern, adopted nexus-core's soul file concept (as `daemon-soul.md` cascade), adopted nexus-core's knowledge injection pattern (CLAUDE.md/AGENTS.md at session start), and added its own HMAC cryptographic enforcement that none of the source frameworks provide.
|
|
302
|
+
|
|
303
|
+
**Chosen direction**: Deliver findings from local sources with explicit gaps named. Verbatim text found where available. Offer Glean search for the nexus-core SOUL.md gap if the verbatim text is specifically needed.
|
|
304
|
+
|
|
305
|
+
**Strongest alternative**: Run a Glean search to close the nexus-core SOUL.md gap. Lost because: task scope was 'local repos and design docs'; YAGNI applies; the gap is named explicitly.
|
|
306
|
+
|
|
307
|
+
**Confidence band**: HIGH -- all evidence from directly-read local files; no contradictions; 3 bounded residual risks.
|
|
308
|
+
|
|
309
|
+
**Next actions**:
|
|
310
|
+
- If nexus-core SOUL.md verbatim text is needed: run Glean search for 'nexus-core SOUL.md site:zillow' or search for Peter Yao's nexus-core project in Glean.
|
|
311
|
+
- If WorkRail's daemon soul file needs updating based on nexus-core patterns: edit `~/.workrail/daemon-soul.md` or modify `src/daemon/soul-template.ts` DAEMON_SOUL_DEFAULT.
|
|
312
|
+
- No code changes required for this discovery task.
|