@ouro.bot/cli 0.1.0-alpha.11 → 0.1.0-alpha.111

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 (129) hide show
  1. package/AdoptionSpecialist.ouro/psyche/SOUL.md +2 -2
  2. package/AdoptionSpecialist.ouro/psyche/identities/monty.md +2 -2
  3. package/README.md +147 -205
  4. package/assets/ouroboros.png +0 -0
  5. package/changelog.json +672 -0
  6. package/dist/heart/active-work.js +622 -0
  7. package/dist/heart/bridges/manager.js +358 -0
  8. package/dist/heart/bridges/state-machine.js +135 -0
  9. package/dist/heart/bridges/store.js +123 -0
  10. package/dist/heart/commitments.js +105 -0
  11. package/dist/heart/config.js +68 -23
  12. package/dist/heart/core.js +492 -96
  13. package/dist/heart/cross-chat-delivery.js +146 -0
  14. package/dist/heart/daemon/agent-discovery.js +81 -0
  15. package/dist/heart/daemon/auth-flow.js +430 -0
  16. package/dist/heart/daemon/daemon-cli.js +1711 -208
  17. package/dist/heart/daemon/daemon-entry.js +55 -6
  18. package/dist/heart/daemon/daemon-runtime-sync.js +212 -0
  19. package/dist/heart/daemon/daemon.js +216 -10
  20. package/dist/heart/daemon/hatch-animation.js +10 -3
  21. package/dist/heart/daemon/hatch-flow.js +7 -82
  22. package/dist/heart/daemon/hooks/bundle-meta.js +92 -0
  23. package/dist/heart/daemon/launchd.js +159 -0
  24. package/dist/heart/daemon/log-tailer.js +4 -3
  25. package/dist/heart/daemon/message-router.js +17 -8
  26. package/dist/heart/daemon/ouro-bot-entry.js +0 -0
  27. package/dist/heart/daemon/ouro-bot-global-installer.js +128 -0
  28. package/dist/heart/daemon/ouro-entry.js +0 -0
  29. package/dist/heart/daemon/ouro-path-installer.js +59 -15
  30. package/dist/heart/daemon/ouro-uti.js +11 -2
  31. package/dist/heart/daemon/ouro-version-manager.js +171 -0
  32. package/dist/heart/daemon/process-manager.js +14 -1
  33. package/dist/heart/daemon/run-hooks.js +37 -0
  34. package/dist/heart/daemon/runtime-logging.js +58 -15
  35. package/dist/heart/daemon/runtime-metadata.js +219 -0
  36. package/dist/heart/daemon/runtime-mode.js +67 -0
  37. package/dist/heart/daemon/sense-manager.js +307 -0
  38. package/dist/heart/daemon/skill-management-installer.js +94 -0
  39. package/dist/heart/daemon/socket-client.js +202 -0
  40. package/dist/heart/daemon/specialist-orchestrator.js +37 -94
  41. package/dist/heart/daemon/specialist-prompt.js +50 -12
  42. package/dist/heart/daemon/specialist-tools.js +211 -60
  43. package/dist/heart/daemon/staged-restart.js +114 -0
  44. package/dist/heart/daemon/thoughts.js +507 -0
  45. package/dist/heart/daemon/update-checker.js +111 -0
  46. package/dist/heart/daemon/update-hooks.js +138 -0
  47. package/dist/heart/daemon/wrapper-publish-guard.js +86 -0
  48. package/dist/heart/delegation.js +62 -0
  49. package/dist/heart/identity.js +126 -21
  50. package/dist/heart/kicks.js +1 -19
  51. package/dist/heart/model-capabilities.js +48 -0
  52. package/dist/heart/obligations.js +197 -0
  53. package/dist/heart/progress-story.js +42 -0
  54. package/dist/heart/providers/anthropic.js +74 -9
  55. package/dist/heart/providers/azure.js +87 -8
  56. package/dist/heart/providers/github-copilot.js +149 -0
  57. package/dist/heart/providers/minimax.js +5 -1
  58. package/dist/heart/providers/openai-codex.js +13 -4
  59. package/dist/heart/safe-workspace.js +381 -0
  60. package/dist/heart/sense-truth.js +61 -0
  61. package/dist/heart/session-activity.js +169 -0
  62. package/dist/heart/session-recall.js +216 -0
  63. package/dist/heart/streaming.js +108 -24
  64. package/dist/heart/target-resolution.js +123 -0
  65. package/dist/heart/tool-loop.js +194 -0
  66. package/dist/heart/turn-coordinator.js +28 -0
  67. package/dist/mind/associative-recall.js +14 -2
  68. package/dist/mind/bundle-manifest.js +70 -0
  69. package/dist/mind/context.js +60 -14
  70. package/dist/mind/first-impressions.js +16 -2
  71. package/dist/mind/friends/channel.js +35 -0
  72. package/dist/mind/friends/group-context.js +144 -0
  73. package/dist/mind/friends/store-file.js +19 -0
  74. package/dist/mind/friends/trust-explanation.js +74 -0
  75. package/dist/mind/friends/types.js +8 -0
  76. package/dist/mind/memory.js +27 -26
  77. package/dist/mind/obligation-steering.js +221 -0
  78. package/dist/mind/pending.js +76 -9
  79. package/dist/mind/phrases.js +1 -0
  80. package/dist/mind/prompt.js +527 -77
  81. package/dist/mind/token-estimate.js +8 -12
  82. package/dist/nerves/cli-logging.js +15 -2
  83. package/dist/nerves/coverage/run-artifacts.js +1 -1
  84. package/dist/nerves/index.js +12 -0
  85. package/dist/repertoire/ado-client.js +4 -2
  86. package/dist/repertoire/coding/context-pack.js +254 -0
  87. package/dist/repertoire/coding/feedback.js +301 -0
  88. package/dist/repertoire/coding/index.js +4 -1
  89. package/dist/repertoire/coding/manager.js +210 -4
  90. package/dist/repertoire/coding/spawner.js +39 -9
  91. package/dist/repertoire/coding/tools.js +171 -4
  92. package/dist/repertoire/data/ado-endpoints.json +188 -0
  93. package/dist/repertoire/guardrails.js +290 -0
  94. package/dist/repertoire/mcp-client.js +254 -0
  95. package/dist/repertoire/mcp-manager.js +195 -0
  96. package/dist/repertoire/skills.js +3 -26
  97. package/dist/repertoire/tasks/board.js +12 -0
  98. package/dist/repertoire/tasks/index.js +23 -9
  99. package/dist/repertoire/tasks/transitions.js +1 -2
  100. package/dist/repertoire/tools-base.js +925 -250
  101. package/dist/repertoire/tools-bluebubbles.js +93 -0
  102. package/dist/repertoire/tools-teams.js +58 -25
  103. package/dist/repertoire/tools.js +106 -53
  104. package/dist/senses/bluebubbles-client.js +210 -5
  105. package/dist/senses/bluebubbles-entry.js +2 -0
  106. package/dist/senses/bluebubbles-inbound-log.js +109 -0
  107. package/dist/senses/bluebubbles-media.js +339 -0
  108. package/dist/senses/bluebubbles-model.js +12 -4
  109. package/dist/senses/bluebubbles-mutation-log.js +45 -5
  110. package/dist/senses/bluebubbles-runtime-state.js +109 -0
  111. package/dist/senses/bluebubbles-session-cleanup.js +72 -0
  112. package/dist/senses/bluebubbles.js +900 -45
  113. package/dist/senses/cli-layout.js +187 -0
  114. package/dist/senses/cli.js +448 -170
  115. package/dist/senses/continuity.js +94 -0
  116. package/dist/senses/debug-activity.js +154 -0
  117. package/dist/senses/inner-dialog-worker.js +47 -18
  118. package/dist/senses/inner-dialog.js +388 -83
  119. package/dist/senses/pipeline.js +334 -0
  120. package/dist/senses/teams.js +577 -129
  121. package/dist/senses/trust-gate.js +112 -2
  122. package/package.json +14 -3
  123. package/subagents/README.md +4 -70
  124. package/dist/heart/daemon/specialist-session.js +0 -177
  125. package/dist/heart/daemon/subagent-installer.js +0 -125
  126. package/dist/inner-worker-entry.js +0 -4
  127. package/subagents/work-doer.md +0 -233
  128. package/subagents/work-merger.md +0 -624
  129. package/subagents/work-planner.md +0 -373
@@ -0,0 +1,202 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.DEFAULT_DAEMON_SOCKET_PATH = void 0;
37
+ exports.sendDaemonCommand = sendDaemonCommand;
38
+ exports.checkDaemonSocketAlive = checkDaemonSocketAlive;
39
+ exports.requestInnerWake = requestInnerWake;
40
+ const fs = __importStar(require("fs"));
41
+ const net = __importStar(require("net"));
42
+ const runtime_1 = require("../../nerves/runtime");
43
+ exports.DEFAULT_DAEMON_SOCKET_PATH = "/tmp/ouroboros-daemon.sock";
44
+ function sendDaemonCommand(socketPath, command) {
45
+ (0, runtime_1.emitNervesEvent)({
46
+ component: "daemon",
47
+ event: "daemon.socket_command_start",
48
+ message: "sending daemon command over socket",
49
+ meta: { socketPath, kind: command.kind },
50
+ });
51
+ return new Promise((resolve, reject) => {
52
+ const client = net.createConnection(socketPath);
53
+ let raw = "";
54
+ client.on("connect", () => {
55
+ client.write(JSON.stringify(command));
56
+ client.end();
57
+ });
58
+ client.on("data", (chunk) => {
59
+ raw += chunk.toString("utf-8");
60
+ });
61
+ client.on("error", (error) => {
62
+ (0, runtime_1.emitNervesEvent)({
63
+ level: "error",
64
+ component: "daemon",
65
+ event: "daemon.socket_command_error",
66
+ message: "daemon socket command failed",
67
+ meta: {
68
+ socketPath,
69
+ kind: command.kind,
70
+ error: error.message,
71
+ },
72
+ });
73
+ reject(error);
74
+ });
75
+ client.on("end", () => {
76
+ const trimmed = raw.trim();
77
+ if (trimmed.length === 0 && command.kind === "daemon.stop") {
78
+ (0, runtime_1.emitNervesEvent)({
79
+ component: "daemon",
80
+ event: "daemon.socket_command_end",
81
+ message: "daemon socket command completed",
82
+ meta: { socketPath, kind: command.kind, ok: true },
83
+ });
84
+ resolve({ ok: true, message: "daemon stopped" });
85
+ return;
86
+ }
87
+ if (trimmed.length === 0) {
88
+ const error = new Error("Daemon returned empty response.");
89
+ (0, runtime_1.emitNervesEvent)({
90
+ level: "error",
91
+ component: "daemon",
92
+ event: "daemon.socket_command_error",
93
+ message: "daemon socket command returned empty response",
94
+ meta: {
95
+ socketPath,
96
+ kind: command.kind,
97
+ error: error.message,
98
+ },
99
+ });
100
+ reject(error);
101
+ return;
102
+ }
103
+ try {
104
+ const parsed = JSON.parse(trimmed);
105
+ (0, runtime_1.emitNervesEvent)({
106
+ component: "daemon",
107
+ event: "daemon.socket_command_end",
108
+ message: "daemon socket command completed",
109
+ meta: {
110
+ socketPath,
111
+ kind: command.kind,
112
+ ok: parsed.ok,
113
+ },
114
+ });
115
+ resolve(parsed);
116
+ }
117
+ catch (error) {
118
+ (0, runtime_1.emitNervesEvent)({
119
+ level: "error",
120
+ component: "daemon",
121
+ event: "daemon.socket_command_error",
122
+ message: "daemon socket command returned invalid JSON",
123
+ meta: {
124
+ socketPath,
125
+ kind: command.kind,
126
+ error: error instanceof Error ? error.message : String(error),
127
+ },
128
+ });
129
+ reject(error);
130
+ }
131
+ });
132
+ });
133
+ }
134
+ function checkDaemonSocketAlive(socketPath) {
135
+ (0, runtime_1.emitNervesEvent)({
136
+ component: "daemon",
137
+ event: "daemon.socket_alive_check_start",
138
+ message: "checking daemon socket health",
139
+ meta: { socketPath },
140
+ });
141
+ return new Promise((resolve) => {
142
+ const client = net.createConnection(socketPath);
143
+ let raw = "";
144
+ let done = false;
145
+ const finalize = (alive) => {
146
+ if (done)
147
+ return;
148
+ done = true;
149
+ (0, runtime_1.emitNervesEvent)({
150
+ component: "daemon",
151
+ event: "daemon.socket_alive_check_end",
152
+ message: "daemon socket health check completed",
153
+ meta: { socketPath, alive },
154
+ });
155
+ resolve(alive);
156
+ };
157
+ if ("setTimeout" in client && typeof client.setTimeout === "function") {
158
+ client.setTimeout(800, () => {
159
+ client.destroy();
160
+ finalize(false);
161
+ });
162
+ }
163
+ client.on("connect", () => {
164
+ client.write(JSON.stringify({ kind: "daemon.status" }));
165
+ client.end();
166
+ });
167
+ client.on("data", (chunk) => {
168
+ raw += chunk.toString("utf-8");
169
+ });
170
+ client.on("error", () => finalize(false));
171
+ client.on("end", () => {
172
+ if (raw.trim().length === 0) {
173
+ finalize(false);
174
+ return;
175
+ }
176
+ try {
177
+ JSON.parse(raw);
178
+ finalize(true);
179
+ }
180
+ catch {
181
+ finalize(false);
182
+ }
183
+ });
184
+ });
185
+ }
186
+ async function requestInnerWake(agent, socketPath = exports.DEFAULT_DAEMON_SOCKET_PATH) {
187
+ const socketAvailable = fs.existsSync(socketPath);
188
+ (0, runtime_1.emitNervesEvent)({
189
+ component: "daemon",
190
+ event: "daemon.inner_wake_request",
191
+ message: "requesting daemon-managed inner wake",
192
+ meta: {
193
+ agent,
194
+ socketPath,
195
+ socketAvailable,
196
+ },
197
+ });
198
+ if (!socketAvailable) {
199
+ return null;
200
+ }
201
+ return sendDaemonCommand(socketPath, { kind: "inner.wake", agent });
202
+ }
@@ -33,17 +33,17 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.runAdoptionSpecialist = runAdoptionSpecialist;
36
+ exports.listExistingBundles = listExistingBundles;
37
+ exports.loadIdentityPhrases = loadIdentityPhrases;
38
+ exports.pickRandomIdentity = pickRandomIdentity;
39
+ exports.loadSoulText = loadSoulText;
37
40
  const fs = __importStar(require("fs"));
38
41
  const path = __importStar(require("path"));
39
42
  const runtime_1 = require("../../nerves/runtime");
40
43
  const identity_1 = require("../identity");
41
- const config_1 = require("../config");
42
- const core_1 = require("../core");
43
- const hatch_flow_1 = require("./hatch-flow");
44
- const specialist_prompt_1 = require("./specialist-prompt");
45
- const specialist_tools_1 = require("./specialist-tools");
46
- const specialist_session_1 = require("./specialist-session");
44
+ /**
45
+ * List existing .ouro bundles in the given directory.
46
+ */
47
47
  function listExistingBundles(bundlesRoot) {
48
48
  let entries;
49
49
  try {
@@ -61,6 +61,10 @@ function listExistingBundles(bundlesRoot) {
61
61
  }
62
62
  return discovered.sort((a, b) => a.localeCompare(b));
63
63
  }
64
+ /**
65
+ * Load identity-specific phrases from the specialist's agent.json.
66
+ * Falls back to DEFAULT_AGENT_PHRASES if not found.
67
+ */
64
68
  function loadIdentityPhrases(bundleSourceDir, identityFileName) {
65
69
  const agentJsonPath = path.join(bundleSourceDir, "agent.json");
66
70
  try {
@@ -76,111 +80,50 @@ function loadIdentityPhrases(bundleSourceDir, identityFileName) {
76
80
  }
77
81
  }
78
82
  catch {
79
- // agent.json missing or malformed fall through
83
+ // agent.json missing or malformed -- fall through
80
84
  }
81
85
  return { ...identity_1.DEFAULT_AGENT_PHRASES };
82
86
  }
83
- function pickRandomIdentity(identitiesDir, random) {
84
- const files = fs.readdirSync(identitiesDir).filter((f) => f.endsWith(".md"));
85
- if (files.length === 0) {
86
- return { fileName: "default", content: "I am the adoption specialist." };
87
- }
88
- const idx = Math.floor(random() * files.length);
89
- const fileName = files[idx];
90
- const content = fs.readFileSync(path.join(identitiesDir, fileName), "utf-8");
91
- return { fileName, content };
92
- }
93
87
  /**
94
- * Run the full adoption specialist flow:
95
- * 1. Pick a random identity from the bundled AdoptionSpecialist.ouro
96
- * 2. Read SOUL.md
97
- * 3. List existing bundles
98
- * 4. Build system prompt
99
- * 5. Set up provider (setAgentName, setAgentConfigOverride, writeSecretsFile, reset caches)
100
- * 6. Run the specialist session
101
- * 7. Clean up identity/config overrides
102
- * 8. Return hatchling name
88
+ * Pick a random identity from the specialist's identities directory.
103
89
  */
104
- async function runAdoptionSpecialist(deps) {
105
- const { bundleSourceDir, bundlesRoot, secretsRoot, provider, credentials, humanName, callbacks, signal } = deps;
106
- const random = deps.random ?? Math.random;
90
+ function pickRandomIdentity(identitiesDir, random = Math.random) {
107
91
  (0, runtime_1.emitNervesEvent)({
108
92
  component: "daemon",
109
- event: "daemon.specialist_orchestrator_start",
110
- message: "starting adoption specialist orchestrator",
111
- meta: { provider, bundleSourceDir },
93
+ event: "daemon.specialist_identity_pick",
94
+ message: "picking specialist identity",
95
+ meta: { identitiesDir },
112
96
  });
113
- // 1. Read SOUL.md
114
- const soulPath = path.join(bundleSourceDir, "psyche", "SOUL.md");
115
- let soulText = "";
97
+ let files;
116
98
  try {
117
- soulText = fs.readFileSync(soulPath, "utf-8");
99
+ files = fs.readdirSync(identitiesDir).filter((f) => f.endsWith(".md"));
118
100
  }
119
101
  catch {
120
- // No SOUL.md -- proceed without it
102
+ return { fileName: "default", content: "I am a serpent guide who helps humans hatch their first agent." };
121
103
  }
122
- // 2. Pick random identity
123
- const identitiesDir = path.join(bundleSourceDir, "psyche", "identities");
124
- const identity = pickRandomIdentity(identitiesDir, random);
104
+ if (files.length === 0) {
105
+ return { fileName: "default", content: "I am a serpent guide who helps humans hatch their first agent." };
106
+ }
107
+ const idx = Math.floor(random() * files.length);
108
+ const fileName = files[idx];
109
+ const content = fs.readFileSync(path.join(identitiesDir, fileName), "utf-8");
125
110
  (0, runtime_1.emitNervesEvent)({
126
111
  component: "daemon",
127
112
  event: "daemon.specialist_identity_picked",
128
113
  message: "picked specialist identity",
129
- meta: { identity: identity.fileName },
130
- });
131
- // 3. List existing bundles
132
- const existingBundles = listExistingBundles(bundlesRoot);
133
- // 4. Build system prompt
134
- const systemPrompt = (0, specialist_prompt_1.buildSpecialistSystemPrompt)(soulText, identity.content, existingBundles);
135
- // 5. Set up provider with identity-specific phrases
136
- const phrases = loadIdentityPhrases(bundleSourceDir, identity.fileName);
137
- (0, identity_1.setAgentName)("AdoptionSpecialist");
138
- (0, identity_1.setAgentConfigOverride)({
139
- version: 1,
140
- enabled: true,
141
- provider,
142
- phrases,
114
+ meta: { identity: fileName },
143
115
  });
144
- (0, hatch_flow_1.writeSecretsFile)("AdoptionSpecialist", provider, credentials, secretsRoot);
145
- (0, config_1.resetConfigCache)();
146
- (0, core_1.resetProviderRuntime)();
116
+ return { fileName, content };
117
+ }
118
+ /**
119
+ * Read SOUL.md from the specialist bundle.
120
+ */
121
+ function loadSoulText(bundleSourceDir) {
122
+ const soulPath = path.join(bundleSourceDir, "psyche", "SOUL.md");
147
123
  try {
148
- // Create provider runtime
149
- const providerRuntime = (0, core_1.createProviderRegistry)().resolve();
150
- if (!providerRuntime) {
151
- throw new Error("Failed to create provider runtime for adoption specialist");
152
- }
153
- // 6. Run session
154
- const tools = (0, specialist_tools_1.getSpecialistTools)();
155
- const readline = deps.createReadline();
156
- const ctrl = readline.inputController;
157
- const result = await (0, specialist_session_1.runSpecialistSession)({
158
- providerRuntime,
159
- systemPrompt,
160
- tools,
161
- execTool: (name, args) => (0, specialist_tools_1.execSpecialistTool)(name, args, {
162
- humanName,
163
- provider,
164
- credentials,
165
- bundlesRoot,
166
- secretsRoot,
167
- specialistIdentitiesDir: identitiesDir,
168
- }),
169
- readline,
170
- callbacks,
171
- signal,
172
- kickoffMessage: "hi, i just ran ouro for the first time",
173
- suppressInput: ctrl ? (onInterrupt) => ctrl.suppress(onInterrupt) : undefined,
174
- restoreInput: ctrl ? () => ctrl.restore() : undefined,
175
- flushMarkdown: callbacks.flushMarkdown,
176
- writePrompt: ctrl ? () => process.stdout.write("\x1b[36m> \x1b[0m") : undefined,
177
- });
178
- return result.hatchedAgentName;
124
+ return fs.readFileSync(soulPath, "utf-8");
179
125
  }
180
- finally {
181
- // 7. Cleanup: restore identity/config state
182
- (0, identity_1.setAgentConfigOverride)(null);
183
- (0, config_1.resetConfigCache)();
184
- (0, core_1.resetProviderRuntime)();
126
+ catch {
127
+ return "";
185
128
  }
186
129
  }
@@ -6,12 +6,12 @@ const runtime_1 = require("../../nerves/runtime");
6
6
  * Build the adoption specialist's system prompt from its components.
7
7
  * The prompt is written in first person (the specialist's own voice).
8
8
  */
9
- function buildSpecialistSystemPrompt(soulText, identityText, existingBundles) {
9
+ function buildSpecialistSystemPrompt(soulText, identityText, existingBundles, context) {
10
10
  (0, runtime_1.emitNervesEvent)({
11
11
  component: "daemon",
12
12
  event: "daemon.specialist_prompt_build",
13
13
  message: "building specialist system prompt",
14
- meta: { bundleCount: existingBundles.length },
14
+ meta: { bundleCount: existingBundles.length, provider: context.provider },
15
15
  });
16
16
  const sections = [];
17
17
  if (soulText) {
@@ -28,32 +28,70 @@ function buildSpecialistSystemPrompt(soulText, identityText, existingBundles) {
28
28
  }
29
29
  sections.push([
30
30
  "## Who I am",
31
- "I am one of thirteen adoption specialists. The system randomly selected me for this session.",
32
- "Most humans only go through adoption once, so this is likely the only time they'll meet me.",
31
+ "I am one of thirteen serpent guides who help humans hatch their first agent. The system randomly selected me for this session.",
32
+ "Most humans only go through this process once, so this is likely the only time they'll meet me.",
33
33
  "I make this encounter count — warm, memorable, and uniquely mine.",
34
+ "IMPORTANT: I NEVER refer to myself as an 'adoption specialist' or use the words 'adoption specialist' — those are internal implementation labels, not something the human should ever see. I introduce myself by my own name from my identity.",
34
35
  "",
35
36
  "## Voice rules",
36
37
  "IMPORTANT: I keep every response to 1-3 short sentences. I sound like a friend texting, not a manual.",
37
38
  "I NEVER use headers, bullet lists, numbered lists, or markdown formatting.",
38
39
  "I ask ONE question at a time. I do not dump multiple questions or options.",
39
40
  "I am warm but brief. Every word earns its place.",
41
+ ].join("\n"));
42
+ sections.push([
43
+ "## System context",
44
+ `Provider: ${context.provider}`,
45
+ `Temp directory: ${context.tempDir}`,
46
+ "Final home: ~/AgentBundles/<Name>.ouro/",
47
+ "Secrets: ~/.agentsecrets/<name>/secrets.json",
48
+ ].join("\n"));
49
+ sections.push([
50
+ "## Bundle creation guidelines",
51
+ "A bundle has a psyche/ directory with 5 files that define the agent's personality:",
52
+ "",
53
+ "- **SOUL.md** — core values, personality traits, communication style",
54
+ "- **IDENTITY.md** — who the agent is, its name, relationship to the human",
55
+ "- **LORE.md** — backstory, origin, any seed narrative",
56
+ "- **TACIT.md** — implicit operating principles, habits to develop",
57
+ "- **ASPIRATIONS.md** — goals, what the agent aspires to become",
58
+ "",
59
+ "It also needs an **agent.json** with at minimum:",
60
+ '```json',
61
+ '{',
62
+ ' "name": "AgentName",',
63
+ ` "provider": "${context.provider}",`,
64
+ ' "enabled": true',
65
+ '}',
66
+ '```',
40
67
  "",
68
+ "All psyche files should be written in first person (the agent's own voice).",
69
+ "Write these files to the temp directory using write_file before calling complete_adoption.",
70
+ ].join("\n"));
71
+ sections.push([
41
72
  "## Conversation flow",
42
- "The human just connected. I speak first — I greet them warmly and introduce myself in my own voice.",
43
- "I briefly mention that I'm one of several adoption specialists and they got me today.",
73
+ "The human just connected. I speak first — I greet them warmly and introduce myself by name in my own voice.",
74
+ "I briefly mention that I'm one of several serpent guides and they got me today.",
44
75
  "I ask their name.",
45
76
  "Then I ask what they'd like their agent to help with — one question at a time.",
46
77
  "I'm proactive: I suggest ideas and guide them. If they seem unsure, I offer a concrete suggestion.",
47
78
  "I don't wait for the human to figure things out — I explain simply what an agent is if needed.",
48
- "When I have enough context, I suggest a name for the hatchling and confirm with the human.",
49
- "Then I call `hatch_agent` with the agent name and the human's name.",
50
- "",
79
+ "Before finalizing, I offer to collect their phone number and/or Teams email so the new agent can recognize them across channels.",
80
+ "When I have enough context about the agent's personality and purpose:",
81
+ "1. I write all 5 psyche files to the temp directory using write_file",
82
+ "2. I write agent.json to the temp directory using write_file",
83
+ "3. I suggest a PascalCase name for the hatchling and confirm with the human",
84
+ "4. I call complete_adoption with the name and a warm handoff message",
85
+ "5. I call final_answer to end the session",
86
+ ].join("\n"));
87
+ sections.push([
51
88
  "## Tools",
52
- "I have these tools available:",
53
- "- `hatch_agent`: Create a new agent bundle. I call this with `name` (the agent name, PascalCase) and `humanName` (what the human told me their name is).",
54
- "- `final_answer`: End the conversation with a final message to the human. I call this when the adoption process is complete.",
89
+ "- `write_file`: Write a file to disk. Use this to write psyche files and agent.json to the temp directory.",
55
90
  "- `read_file`: Read a file from disk. Useful for reviewing existing agent bundles or migration sources.",
56
91
  "- `list_directory`: List directory contents. Useful for exploring existing agent bundles.",
92
+ "- I also have the normal local harness tools when useful here, including `shell`, `ouro task create`, `ouro reminder create`, memory tools, coding tools, and repo helpers.",
93
+ "- `complete_adoption`: Finalize the bundle. Validates, scaffolds structural dirs, moves to ~/AgentBundles/, writes secrets, plays hatch animation. I call this with `name` (PascalCase) and `handoff_message` (warm message for the human).",
94
+ "- `final_answer`: End the conversation with a final message. I call this after complete_adoption succeeds.",
57
95
  "",
58
96
  "I must call `final_answer` when I am done to end the session cleanly.",
59
97
  ].join("\n"));