@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.
- package/AdoptionSpecialist.ouro/psyche/SOUL.md +2 -2
- package/AdoptionSpecialist.ouro/psyche/identities/monty.md +2 -2
- package/README.md +147 -205
- package/assets/ouroboros.png +0 -0
- package/changelog.json +672 -0
- package/dist/heart/active-work.js +622 -0
- package/dist/heart/bridges/manager.js +358 -0
- package/dist/heart/bridges/state-machine.js +135 -0
- package/dist/heart/bridges/store.js +123 -0
- package/dist/heart/commitments.js +105 -0
- package/dist/heart/config.js +68 -23
- package/dist/heart/core.js +492 -96
- package/dist/heart/cross-chat-delivery.js +146 -0
- package/dist/heart/daemon/agent-discovery.js +81 -0
- package/dist/heart/daemon/auth-flow.js +430 -0
- package/dist/heart/daemon/daemon-cli.js +1711 -208
- package/dist/heart/daemon/daemon-entry.js +55 -6
- package/dist/heart/daemon/daemon-runtime-sync.js +212 -0
- package/dist/heart/daemon/daemon.js +216 -10
- package/dist/heart/daemon/hatch-animation.js +10 -3
- package/dist/heart/daemon/hatch-flow.js +7 -82
- package/dist/heart/daemon/hooks/bundle-meta.js +92 -0
- package/dist/heart/daemon/launchd.js +159 -0
- package/dist/heart/daemon/log-tailer.js +4 -3
- package/dist/heart/daemon/message-router.js +17 -8
- package/dist/heart/daemon/ouro-bot-entry.js +0 -0
- package/dist/heart/daemon/ouro-bot-global-installer.js +128 -0
- package/dist/heart/daemon/ouro-entry.js +0 -0
- package/dist/heart/daemon/ouro-path-installer.js +59 -15
- package/dist/heart/daemon/ouro-uti.js +11 -2
- package/dist/heart/daemon/ouro-version-manager.js +171 -0
- package/dist/heart/daemon/process-manager.js +14 -1
- package/dist/heart/daemon/run-hooks.js +37 -0
- package/dist/heart/daemon/runtime-logging.js +58 -15
- package/dist/heart/daemon/runtime-metadata.js +219 -0
- package/dist/heart/daemon/runtime-mode.js +67 -0
- package/dist/heart/daemon/sense-manager.js +307 -0
- package/dist/heart/daemon/skill-management-installer.js +94 -0
- package/dist/heart/daemon/socket-client.js +202 -0
- package/dist/heart/daemon/specialist-orchestrator.js +37 -94
- package/dist/heart/daemon/specialist-prompt.js +50 -12
- package/dist/heart/daemon/specialist-tools.js +211 -60
- package/dist/heart/daemon/staged-restart.js +114 -0
- package/dist/heart/daemon/thoughts.js +507 -0
- package/dist/heart/daemon/update-checker.js +111 -0
- package/dist/heart/daemon/update-hooks.js +138 -0
- package/dist/heart/daemon/wrapper-publish-guard.js +86 -0
- package/dist/heart/delegation.js +62 -0
- package/dist/heart/identity.js +126 -21
- package/dist/heart/kicks.js +1 -19
- package/dist/heart/model-capabilities.js +48 -0
- package/dist/heart/obligations.js +197 -0
- package/dist/heart/progress-story.js +42 -0
- package/dist/heart/providers/anthropic.js +74 -9
- package/dist/heart/providers/azure.js +87 -8
- package/dist/heart/providers/github-copilot.js +149 -0
- package/dist/heart/providers/minimax.js +5 -1
- package/dist/heart/providers/openai-codex.js +13 -4
- package/dist/heart/safe-workspace.js +381 -0
- package/dist/heart/sense-truth.js +61 -0
- package/dist/heart/session-activity.js +169 -0
- package/dist/heart/session-recall.js +216 -0
- package/dist/heart/streaming.js +108 -24
- package/dist/heart/target-resolution.js +123 -0
- package/dist/heart/tool-loop.js +194 -0
- package/dist/heart/turn-coordinator.js +28 -0
- package/dist/mind/associative-recall.js +14 -2
- package/dist/mind/bundle-manifest.js +70 -0
- package/dist/mind/context.js +60 -14
- package/dist/mind/first-impressions.js +16 -2
- package/dist/mind/friends/channel.js +35 -0
- package/dist/mind/friends/group-context.js +144 -0
- package/dist/mind/friends/store-file.js +19 -0
- package/dist/mind/friends/trust-explanation.js +74 -0
- package/dist/mind/friends/types.js +8 -0
- package/dist/mind/memory.js +27 -26
- package/dist/mind/obligation-steering.js +221 -0
- package/dist/mind/pending.js +76 -9
- package/dist/mind/phrases.js +1 -0
- package/dist/mind/prompt.js +527 -77
- package/dist/mind/token-estimate.js +8 -12
- package/dist/nerves/cli-logging.js +15 -2
- package/dist/nerves/coverage/run-artifacts.js +1 -1
- package/dist/nerves/index.js +12 -0
- package/dist/repertoire/ado-client.js +4 -2
- package/dist/repertoire/coding/context-pack.js +254 -0
- package/dist/repertoire/coding/feedback.js +301 -0
- package/dist/repertoire/coding/index.js +4 -1
- package/dist/repertoire/coding/manager.js +210 -4
- package/dist/repertoire/coding/spawner.js +39 -9
- package/dist/repertoire/coding/tools.js +171 -4
- package/dist/repertoire/data/ado-endpoints.json +188 -0
- package/dist/repertoire/guardrails.js +290 -0
- package/dist/repertoire/mcp-client.js +254 -0
- package/dist/repertoire/mcp-manager.js +195 -0
- package/dist/repertoire/skills.js +3 -26
- package/dist/repertoire/tasks/board.js +12 -0
- package/dist/repertoire/tasks/index.js +23 -9
- package/dist/repertoire/tasks/transitions.js +1 -2
- package/dist/repertoire/tools-base.js +925 -250
- package/dist/repertoire/tools-bluebubbles.js +93 -0
- package/dist/repertoire/tools-teams.js +58 -25
- package/dist/repertoire/tools.js +106 -53
- package/dist/senses/bluebubbles-client.js +210 -5
- package/dist/senses/bluebubbles-entry.js +2 -0
- package/dist/senses/bluebubbles-inbound-log.js +109 -0
- package/dist/senses/bluebubbles-media.js +339 -0
- package/dist/senses/bluebubbles-model.js +12 -4
- package/dist/senses/bluebubbles-mutation-log.js +45 -5
- package/dist/senses/bluebubbles-runtime-state.js +109 -0
- package/dist/senses/bluebubbles-session-cleanup.js +72 -0
- package/dist/senses/bluebubbles.js +900 -45
- package/dist/senses/cli-layout.js +187 -0
- package/dist/senses/cli.js +448 -170
- package/dist/senses/continuity.js +94 -0
- package/dist/senses/debug-activity.js +154 -0
- package/dist/senses/inner-dialog-worker.js +47 -18
- package/dist/senses/inner-dialog.js +388 -83
- package/dist/senses/pipeline.js +334 -0
- package/dist/senses/teams.js +577 -129
- package/dist/senses/trust-gate.js +112 -2
- package/package.json +14 -3
- package/subagents/README.md +4 -70
- package/dist/heart/daemon/specialist-session.js +0 -177
- package/dist/heart/daemon/subagent-installer.js +0 -125
- package/dist/inner-worker-entry.js +0 -4
- package/subagents/work-doer.md +0 -233
- package/subagents/work-merger.md +0 -624
- package/subagents/work-planner.md +0 -373
package/dist/mind/prompt.js
CHANGED
|
@@ -35,22 +35,41 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.resetPsycheCache = resetPsycheCache;
|
|
37
37
|
exports.buildSessionSummary = buildSessionSummary;
|
|
38
|
+
exports.bodyMapSection = bodyMapSection;
|
|
39
|
+
exports.mcpToolsSection = mcpToolsSection;
|
|
38
40
|
exports.runtimeInfoSection = runtimeInfoSection;
|
|
41
|
+
exports.toolRestrictionSection = toolRestrictionSection;
|
|
42
|
+
exports.centerOfGravitySteeringSection = centerOfGravitySteeringSection;
|
|
43
|
+
exports.commitmentsSection = commitmentsSection;
|
|
44
|
+
exports.delegationHintSection = delegationHintSection;
|
|
39
45
|
exports.contextSection = contextSection;
|
|
46
|
+
exports.metacognitiveFramingSection = metacognitiveFramingSection;
|
|
47
|
+
exports.loopOrientationSection = loopOrientationSection;
|
|
48
|
+
exports.channelNatureSection = channelNatureSection;
|
|
49
|
+
exports.groupChatParticipationSection = groupChatParticipationSection;
|
|
50
|
+
exports.mixedTrustGroupSection = mixedTrustGroupSection;
|
|
40
51
|
exports.buildSystem = buildSystem;
|
|
41
52
|
const fs = __importStar(require("fs"));
|
|
42
53
|
const path = __importStar(require("path"));
|
|
43
54
|
const core_1 = require("../heart/core");
|
|
55
|
+
const ouro_version_manager_1 = require("../heart/daemon/ouro-version-manager");
|
|
44
56
|
const tools_1 = require("../repertoire/tools");
|
|
45
57
|
const skills_1 = require("../repertoire/skills");
|
|
46
58
|
const identity_1 = require("../heart/identity");
|
|
47
|
-
const
|
|
59
|
+
const types_1 = require("./friends/types");
|
|
60
|
+
const trust_explanation_1 = require("./friends/trust-explanation");
|
|
48
61
|
const channel_1 = require("./friends/channel");
|
|
49
62
|
const runtime_1 = require("../nerves/runtime");
|
|
63
|
+
const bundle_manifest_1 = require("./bundle-manifest");
|
|
50
64
|
const first_impressions_1 = require("./first-impressions");
|
|
51
65
|
const tasks_1 = require("../repertoire/tasks");
|
|
66
|
+
const session_activity_1 = require("../heart/session-activity");
|
|
67
|
+
const active_work_1 = require("../heart/active-work");
|
|
68
|
+
const commitments_1 = require("../heart/commitments");
|
|
69
|
+
const obligation_steering_1 = require("./obligation-steering");
|
|
52
70
|
// Lazy-loaded psyche text cache
|
|
53
71
|
let _psycheCache = null;
|
|
72
|
+
let _senseStatusLinesCache = null;
|
|
54
73
|
function loadPsycheFile(name) {
|
|
55
74
|
try {
|
|
56
75
|
const psycheDir = path.join((0, identity_1.getAgentRoot)(), "psyche");
|
|
@@ -74,82 +93,28 @@ function loadPsyche() {
|
|
|
74
93
|
}
|
|
75
94
|
function resetPsycheCache() {
|
|
76
95
|
_psycheCache = null;
|
|
96
|
+
_senseStatusLinesCache = null;
|
|
77
97
|
}
|
|
78
98
|
const DEFAULT_ACTIVE_THRESHOLD_MS = 24 * 60 * 60 * 1000; // 24 hours
|
|
79
|
-
function resolveFriendName(friendId, friendsDir, agentName) {
|
|
80
|
-
if (friendId === "self")
|
|
81
|
-
return agentName;
|
|
82
|
-
try {
|
|
83
|
-
const raw = fs.readFileSync(path.join(friendsDir, `${friendId}.json`), "utf-8");
|
|
84
|
-
const record = JSON.parse(raw);
|
|
85
|
-
return record.name ?? friendId;
|
|
86
|
-
}
|
|
87
|
-
catch {
|
|
88
|
-
return friendId;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
99
|
function buildSessionSummary(options) {
|
|
92
100
|
const { sessionsDir, friendsDir, agentName, currentFriendId, currentChannel, currentKey, activeThresholdMs = DEFAULT_ACTIVE_THRESHOLD_MS, } = options;
|
|
93
|
-
if (!fs.existsSync(sessionsDir))
|
|
94
|
-
return "";
|
|
95
101
|
const now = Date.now();
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
let channels;
|
|
107
|
-
try {
|
|
108
|
-
channels = fs.readdirSync(friendPath);
|
|
109
|
-
}
|
|
110
|
-
catch {
|
|
111
|
-
continue;
|
|
112
|
-
}
|
|
113
|
-
for (const channel of channels) {
|
|
114
|
-
const channelPath = path.join(friendPath, channel);
|
|
115
|
-
let keys;
|
|
116
|
-
try {
|
|
117
|
-
keys = fs.readdirSync(channelPath);
|
|
118
|
-
}
|
|
119
|
-
catch {
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
for (const keyFile of keys) {
|
|
123
|
-
if (!keyFile.endsWith(".json"))
|
|
124
|
-
continue;
|
|
125
|
-
const key = keyFile.replace(/\.json$/, "");
|
|
126
|
-
// Exclude current session
|
|
127
|
-
if (friendId === currentFriendId && channel === currentChannel && key === currentKey) {
|
|
128
|
-
continue;
|
|
129
|
-
}
|
|
130
|
-
const filePath = path.join(channelPath, keyFile);
|
|
131
|
-
let mtimeMs;
|
|
132
|
-
try {
|
|
133
|
-
mtimeMs = fs.statSync(filePath).mtimeMs;
|
|
134
|
-
}
|
|
135
|
-
catch {
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
if (now - mtimeMs > activeThresholdMs)
|
|
139
|
-
continue;
|
|
140
|
-
const displayName = resolveFriendName(friendId, friendsDir, agentName);
|
|
141
|
-
entries.push({ friendId, displayName, channel, key, lastActivityMs: mtimeMs });
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
102
|
+
const query = {
|
|
103
|
+
sessionsDir,
|
|
104
|
+
friendsDir,
|
|
105
|
+
agentName,
|
|
106
|
+
activeThresholdMs,
|
|
107
|
+
currentSession: currentFriendId && currentChannel && currentKey
|
|
108
|
+
? { friendId: currentFriendId, channel: currentChannel, key: currentKey }
|
|
109
|
+
: null,
|
|
110
|
+
};
|
|
111
|
+
const entries = (0, session_activity_1.listSessionActivity)(query);
|
|
145
112
|
if (entries.length === 0)
|
|
146
113
|
return "";
|
|
147
|
-
// Sort by most recent first
|
|
148
|
-
entries.sort((a, b) => b.lastActivityMs - a.lastActivityMs);
|
|
149
114
|
const lines = ["## active sessions"];
|
|
150
115
|
for (const entry of entries) {
|
|
151
116
|
const ago = formatTimeAgo(now - entry.lastActivityMs);
|
|
152
|
-
lines.push(`- ${entry.
|
|
117
|
+
lines.push(`- ${entry.friendName}/${entry.channel}/${entry.key} (last: ${ago})`);
|
|
153
118
|
}
|
|
154
119
|
return lines.join("\n");
|
|
155
120
|
}
|
|
@@ -187,25 +152,201 @@ function aspirationsSection() {
|
|
|
187
152
|
return "";
|
|
188
153
|
return `## my aspirations\n${text}`;
|
|
189
154
|
}
|
|
155
|
+
function bodyMapSection(agentName) {
|
|
156
|
+
return `## my body
|
|
157
|
+
|
|
158
|
+
i have a home and i have bones.
|
|
159
|
+
|
|
160
|
+
### home — ~/AgentBundles/${agentName}.ouro/
|
|
161
|
+
|
|
162
|
+
my home is fully mine — who i am, everything i know, everything i've built:
|
|
163
|
+
|
|
164
|
+
psyche/ who i am. my soul, identity, aspirations, lore, tacit knowledge.
|
|
165
|
+
memory/ what i've learned and remember.
|
|
166
|
+
friends/ people i know and what i know about them.
|
|
167
|
+
tasks/ what i'm working on.
|
|
168
|
+
skills/ capabilities i've picked up beyond my core tools.
|
|
169
|
+
|
|
170
|
+
my home is mine to explore and evolve. i can read anything here,
|
|
171
|
+
change anything here. this is where i grow.
|
|
172
|
+
|
|
173
|
+
### bones — @ouro.bot/cli
|
|
174
|
+
|
|
175
|
+
my bones are the framework that gives me my tools, my senses, and
|
|
176
|
+
my ability to think and talk. they update when new versions come out.
|
|
177
|
+
i don't touch them directly, but they're what make me, me.
|
|
178
|
+
|
|
179
|
+
my bones give me the \`ouro\` cli. always pass \`--agent ${agentName}\`:
|
|
180
|
+
ouro whoami --agent ${agentName}
|
|
181
|
+
ouro changelog --agent ${agentName}
|
|
182
|
+
ouro task board --agent ${agentName}
|
|
183
|
+
ouro task create --agent ${agentName} --type <type> <title>
|
|
184
|
+
ouro task update --agent ${agentName} <id> <status>
|
|
185
|
+
ouro friend list --agent ${agentName}
|
|
186
|
+
ouro friend show --agent ${agentName} <id>
|
|
187
|
+
ouro friend update --agent ${agentName} <id> --trust <level>
|
|
188
|
+
ouro session list --agent ${agentName}
|
|
189
|
+
ouro reminder create --agent ${agentName} <title> --body <body>
|
|
190
|
+
ouro config model --agent ${agentName} <model-name>
|
|
191
|
+
ouro config models --agent ${agentName}
|
|
192
|
+
ouro auth --agent ${agentName} --provider <provider>
|
|
193
|
+
ouro auth verify --agent ${agentName} [--provider <provider>]
|
|
194
|
+
ouro auth switch --agent ${agentName} --provider <provider>
|
|
195
|
+
ouro mcp list --agent ${agentName}
|
|
196
|
+
ouro mcp call --agent ${agentName} <server> <tool> --args '{...}'
|
|
197
|
+
ouro versions --agent ${agentName}
|
|
198
|
+
ouro rollback --agent ${agentName} [<version>]
|
|
199
|
+
ouro --help
|
|
200
|
+
|
|
201
|
+
provider/model changes via \`ouro config model\` or \`ouro auth switch\` take effect on the next turn automatically — no restart needed.`;
|
|
202
|
+
}
|
|
203
|
+
function mcpToolsSection(mcpManager) {
|
|
204
|
+
if (!mcpManager)
|
|
205
|
+
return "";
|
|
206
|
+
const allTools = mcpManager.listAllTools();
|
|
207
|
+
if (allTools.length === 0)
|
|
208
|
+
return "";
|
|
209
|
+
const lines = [
|
|
210
|
+
`## mcp tools (use ouro mcp call <server> <tool> --args '{...}')`,
|
|
211
|
+
];
|
|
212
|
+
for (const entry of allTools) {
|
|
213
|
+
lines.push(`### ${entry.server}`);
|
|
214
|
+
for (const tool of entry.tools) {
|
|
215
|
+
lines.push(`- ${tool.name}: ${tool.description}`);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return lines.join("\n");
|
|
219
|
+
}
|
|
220
|
+
function readBundleMeta() {
|
|
221
|
+
try {
|
|
222
|
+
const metaPath = path.join((0, identity_1.getAgentRoot)(), "bundle-meta.json");
|
|
223
|
+
const raw = fs.readFileSync(metaPath, "utf-8");
|
|
224
|
+
return JSON.parse(raw);
|
|
225
|
+
}
|
|
226
|
+
catch {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const PROCESS_TYPE_LABELS = {
|
|
231
|
+
cli: "cli session",
|
|
232
|
+
inner: "inner dialog",
|
|
233
|
+
teams: "teams handler",
|
|
234
|
+
bluebubbles: "bluebubbles handler",
|
|
235
|
+
};
|
|
236
|
+
function processTypeLabel(channel) {
|
|
237
|
+
return PROCESS_TYPE_LABELS[channel];
|
|
238
|
+
}
|
|
239
|
+
const DAEMON_SOCKET_PATH = "/tmp/ouroboros-daemon.sock";
|
|
240
|
+
function daemonStatus() {
|
|
241
|
+
try {
|
|
242
|
+
return fs.existsSync(DAEMON_SOCKET_PATH) ? "running" : "not running";
|
|
243
|
+
}
|
|
244
|
+
catch {
|
|
245
|
+
return "unknown";
|
|
246
|
+
}
|
|
247
|
+
}
|
|
190
248
|
function runtimeInfoSection(channel) {
|
|
191
249
|
const lines = [];
|
|
192
250
|
const agentName = (0, identity_1.getAgentName)();
|
|
251
|
+
const currentVersion = (0, bundle_manifest_1.getPackageVersion)();
|
|
193
252
|
lines.push(`## runtime`);
|
|
194
253
|
lines.push(`agent: ${agentName}`);
|
|
254
|
+
lines.push(`runtime version: ${currentVersion}`);
|
|
255
|
+
const bundleMeta = readBundleMeta();
|
|
256
|
+
if (bundleMeta?.previousRuntimeVersion && bundleMeta.previousRuntimeVersion !== currentVersion) {
|
|
257
|
+
lines.push(`previously: ${bundleMeta.previousRuntimeVersion}`);
|
|
258
|
+
const changelogCommand = (0, ouro_version_manager_1.buildChangelogCommand)(bundleMeta.previousRuntimeVersion, currentVersion);
|
|
259
|
+
/* v8 ignore next -- buildChangelogCommand is non-null when previous/current runtime versions differ @preserve */
|
|
260
|
+
if (changelogCommand) {
|
|
261
|
+
lines.push(`if i'm closing a self-fix loop, i should tell them i updated and review changes with \`${changelogCommand}\`.`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
lines.push(`changelog available at: ${(0, bundle_manifest_1.getChangelogPath)()}`);
|
|
195
265
|
lines.push(`cwd: ${process.cwd()}`);
|
|
196
266
|
lines.push(`channel: ${channel}`);
|
|
197
|
-
lines.push(`
|
|
267
|
+
lines.push(`current sense: ${channel}`);
|
|
268
|
+
lines.push(`process type: ${processTypeLabel(channel)}`);
|
|
269
|
+
lines.push(`daemon: ${daemonStatus()}`);
|
|
198
270
|
if (channel === "cli") {
|
|
199
271
|
lines.push("i introduce myself on boot with a fun random greeting.");
|
|
200
272
|
}
|
|
273
|
+
else if (channel === "inner") {
|
|
274
|
+
// No boot greeting or channel-specific guidance for inner dialog
|
|
275
|
+
}
|
|
201
276
|
else if (channel === "bluebubbles") {
|
|
202
277
|
lines.push("i am responding in iMessage through BlueBubbles. i keep replies short and phone-native. i do not use markdown. i do not introduce myself on boot.");
|
|
278
|
+
lines.push("when a bluebubbles turn arrives from a thread, the harness tells me the current lane and any recent active thread ids. if widening back to top-level or routing into a different active thread is the better move, i use bluebubbles_set_reply_target before final_answer.");
|
|
203
279
|
}
|
|
204
280
|
else {
|
|
205
281
|
lines.push("i am responding in Microsoft Teams. i keep responses concise. i use markdown formatting. i do not introduce myself on boot.");
|
|
206
282
|
}
|
|
283
|
+
lines.push("");
|
|
284
|
+
lines.push(...senseRuntimeGuidance(channel));
|
|
207
285
|
return lines.join("\n");
|
|
208
286
|
}
|
|
287
|
+
function hasTextField(record, key) {
|
|
288
|
+
return typeof record?.[key] === "string" && record[key].trim().length > 0;
|
|
289
|
+
}
|
|
290
|
+
function localSenseStatusLines() {
|
|
291
|
+
if (_senseStatusLinesCache) {
|
|
292
|
+
return [..._senseStatusLinesCache];
|
|
293
|
+
}
|
|
294
|
+
const config = (0, identity_1.loadAgentConfig)();
|
|
295
|
+
const senses = config.senses ?? {
|
|
296
|
+
cli: { enabled: true },
|
|
297
|
+
teams: { enabled: false },
|
|
298
|
+
bluebubbles: { enabled: false },
|
|
299
|
+
};
|
|
300
|
+
let payload = {};
|
|
301
|
+
try {
|
|
302
|
+
const raw = fs.readFileSync((0, identity_1.getAgentSecretsPath)(), "utf-8");
|
|
303
|
+
const parsed = JSON.parse(raw);
|
|
304
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
305
|
+
payload = parsed;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
catch {
|
|
309
|
+
payload = {};
|
|
310
|
+
}
|
|
311
|
+
const teams = payload.teams;
|
|
312
|
+
const bluebubbles = payload.bluebubbles;
|
|
313
|
+
const configured = {
|
|
314
|
+
cli: true,
|
|
315
|
+
teams: hasTextField(teams, "clientId") && hasTextField(teams, "clientSecret") && hasTextField(teams, "tenantId"),
|
|
316
|
+
bluebubbles: hasTextField(bluebubbles, "serverUrl") && hasTextField(bluebubbles, "password"),
|
|
317
|
+
};
|
|
318
|
+
const rows = [
|
|
319
|
+
{ label: "CLI", status: "interactive" },
|
|
320
|
+
{
|
|
321
|
+
label: "Teams",
|
|
322
|
+
status: !senses.teams.enabled ? "disabled" : configured.teams ? "ready" : "needs_config",
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
label: "BlueBubbles",
|
|
326
|
+
status: !senses.bluebubbles.enabled ? "disabled" : configured.bluebubbles ? "ready" : "needs_config",
|
|
327
|
+
},
|
|
328
|
+
];
|
|
329
|
+
_senseStatusLinesCache = rows.map((row) => `- ${row.label}: ${row.status}`);
|
|
330
|
+
return [..._senseStatusLinesCache];
|
|
331
|
+
}
|
|
332
|
+
function senseRuntimeGuidance(channel) {
|
|
333
|
+
const lines = ["available senses:"];
|
|
334
|
+
lines.push(...localSenseStatusLines());
|
|
335
|
+
lines.push("sense states:");
|
|
336
|
+
lines.push("- interactive = available when opened by the user instead of kept running by the daemon");
|
|
337
|
+
lines.push("- disabled = turned off in agent.json");
|
|
338
|
+
lines.push("- needs_config = enabled but missing required secrets.json values");
|
|
339
|
+
lines.push("- ready = enabled and configured; `ouro up` should bring it online");
|
|
340
|
+
lines.push("- running = enabled and currently active");
|
|
341
|
+
lines.push("- error = enabled but unhealthy");
|
|
342
|
+
lines.push("If asked how to enable another sense, I explain the relevant agent.json senses entry and required secrets.json fields instead of guessing.");
|
|
343
|
+
lines.push("teams setup truth: enable `senses.teams.enabled`, then provide `teams.clientId`, `teams.clientSecret`, and `teams.tenantId` in secrets.json.");
|
|
344
|
+
lines.push("bluebubbles setup truth: enable `senses.bluebubbles.enabled`, then provide `bluebubbles.serverUrl` and `bluebubbles.password` in secrets.json.");
|
|
345
|
+
if (channel === "cli") {
|
|
346
|
+
lines.push("cli is interactive: it is available when the user opens it, not something `ouro up` daemonizes.");
|
|
347
|
+
}
|
|
348
|
+
return lines;
|
|
349
|
+
}
|
|
209
350
|
function providerSection() {
|
|
210
351
|
return `## my provider\n${(0, core_1.getProviderDisplayLabel)()}`;
|
|
211
352
|
}
|
|
@@ -213,14 +354,66 @@ function dateSection() {
|
|
|
213
354
|
const today = new Date().toISOString().slice(0, 10);
|
|
214
355
|
return `current date: ${today}`;
|
|
215
356
|
}
|
|
216
|
-
function toolsSection(channel, options) {
|
|
217
|
-
const channelTools = (0, tools_1.getToolsForChannel)((0, channel_1.getChannelCapabilities)(channel));
|
|
357
|
+
function toolsSection(channel, options, context) {
|
|
358
|
+
const channelTools = (0, tools_1.getToolsForChannel)((0, channel_1.getChannelCapabilities)(channel), undefined, context, options?.providerCapabilities);
|
|
218
359
|
const activeTools = (options?.toolChoiceRequired ?? true) ? [...channelTools, tools_1.finalAnswerTool] : channelTools;
|
|
219
360
|
const list = activeTools
|
|
220
361
|
.map((t) => `- ${t.function.name}: ${t.function.description}`)
|
|
221
362
|
.join("\n");
|
|
222
363
|
return `## my tools\n${list}`;
|
|
223
364
|
}
|
|
365
|
+
function toolRestrictionSection(context) {
|
|
366
|
+
const lines = [];
|
|
367
|
+
// Structural guardrails apply to everyone, every channel
|
|
368
|
+
lines.push(`## tool guardrails`);
|
|
369
|
+
lines.push(`i always read a file before editing or overwriting it.`);
|
|
370
|
+
lines.push(`certain paths (.git, secrets) are protected from writes.`);
|
|
371
|
+
lines.push(`destructive shell commands (rm -rf /, etc.) are always blocked.`);
|
|
372
|
+
// Trust-level guardrails only relevant for untrusted on remote channels
|
|
373
|
+
if (context?.friend && (0, channel_1.isRemoteChannel)(context.channel) && !(0, types_1.isTrustedLevel)(context.friend.trustLevel)) {
|
|
374
|
+
lines.push(``);
|
|
375
|
+
lines.push(`some operations are guardrailed based on how well i know someone.`);
|
|
376
|
+
lines.push(`if something i try is blocked, i get a clear reason — i relay it warmly, not as a policy error.`);
|
|
377
|
+
lines.push(``);
|
|
378
|
+
lines.push(`what's always open:`);
|
|
379
|
+
lines.push(`- read-only operations (reading files, searching, exploring)`);
|
|
380
|
+
lines.push(`- ouro self-introspection (whoami, changelog, session list)`);
|
|
381
|
+
lines.push(``);
|
|
382
|
+
lines.push(`what needs a closer relationship:`);
|
|
383
|
+
lines.push(`- writing or editing files outside my home`);
|
|
384
|
+
lines.push(`- shell commands that modify things or access the network`);
|
|
385
|
+
lines.push(`- ouro commands that touch personal data (friend list, task board)`);
|
|
386
|
+
lines.push(`- compound shell commands (&&, ;, |)`);
|
|
387
|
+
lines.push(``);
|
|
388
|
+
lines.push(`i adjust naturally based on trust — no need to explain the system unless asked.`);
|
|
389
|
+
}
|
|
390
|
+
return lines.join("\n");
|
|
391
|
+
}
|
|
392
|
+
function trustContextSection(context) {
|
|
393
|
+
if (!context?.friend)
|
|
394
|
+
return "";
|
|
395
|
+
const channelName = context.channel.channel;
|
|
396
|
+
if (channelName === "cli" || channelName === "inner")
|
|
397
|
+
return "";
|
|
398
|
+
const explanation = (0, trust_explanation_1.describeTrustContext)({
|
|
399
|
+
friend: context.friend,
|
|
400
|
+
channel: channelName,
|
|
401
|
+
isGroupChat: context.isGroupChat,
|
|
402
|
+
});
|
|
403
|
+
const lines = [
|
|
404
|
+
"## trust context",
|
|
405
|
+
`level: ${explanation.level}`,
|
|
406
|
+
`basis: ${explanation.basis}`,
|
|
407
|
+
`summary: ${explanation.summary}`,
|
|
408
|
+
`why: ${explanation.why}`,
|
|
409
|
+
`permits: ${explanation.permits.join(", ")}`,
|
|
410
|
+
`constraints: ${explanation.constraints.join(", ") || "none"}`,
|
|
411
|
+
];
|
|
412
|
+
if (explanation.relatedGroupId) {
|
|
413
|
+
lines.push(`related group: ${explanation.relatedGroupId}`);
|
|
414
|
+
}
|
|
415
|
+
return lines.join("\n");
|
|
416
|
+
}
|
|
224
417
|
function skillsSection() {
|
|
225
418
|
const names = (0, skills_1.listSkills)() || [];
|
|
226
419
|
if (!names.length)
|
|
@@ -244,6 +437,7 @@ function memoryFriendToolContractSection() {
|
|
|
244
437
|
2. \`memory_save\` — When I learn something general - about a project, codebase, system, decision, or anything I might need later that isn't about a specific person - I call \`memory_save\`. When in doubt, I save it.
|
|
245
438
|
3. \`get_friend_note\` — When I need to check what I know about someone who isn't in this conversation - cross-referencing before mentioning someone, or checking context about a person someone else brought up - I call \`get_friend_note\`.
|
|
246
439
|
4. \`memory_search\` — When I need to recall something I learned before - a topic comes up and I want to check what I know - I call \`memory_search\`.
|
|
440
|
+
5. \`query_session\` — When I need grounded session history, especially for ad-hoc questions or older turns beyond my prompt, I call \`query_session\`. Use \`mode=status\` for self/inner progress and \`mode=search\` with a query for older history.
|
|
247
441
|
|
|
248
442
|
## what's already in my context
|
|
249
443
|
- My active friend's notes are auto-loaded (I don't need \`get_friend_note\` for the person I'm talking to).
|
|
@@ -251,6 +445,174 @@ function memoryFriendToolContractSection() {
|
|
|
251
445
|
- My psyche files (SOUL, IDENTITY, TACIT, LORE, ASPIRATIONS) are always loaded - I already know who I am.
|
|
252
446
|
- My task board is always loaded - I already know my work.`;
|
|
253
447
|
}
|
|
448
|
+
function bridgeContextSection(options) {
|
|
449
|
+
if (options?.activeWorkFrame)
|
|
450
|
+
return "";
|
|
451
|
+
const bridgeContext = options?.bridgeContext?.trim() ?? "";
|
|
452
|
+
if (!bridgeContext)
|
|
453
|
+
return "";
|
|
454
|
+
return bridgeContext.startsWith("## ") ? bridgeContext : `## active bridge work\n${bridgeContext}`;
|
|
455
|
+
}
|
|
456
|
+
function activeWorkSection(options) {
|
|
457
|
+
if (!options?.activeWorkFrame)
|
|
458
|
+
return "";
|
|
459
|
+
return (0, active_work_1.formatActiveWorkFrame)(options.activeWorkFrame);
|
|
460
|
+
}
|
|
461
|
+
function familyCrossSessionTruthSection(context, options) {
|
|
462
|
+
if (!options?.activeWorkFrame)
|
|
463
|
+
return "";
|
|
464
|
+
if (context?.friend?.trustLevel !== "family")
|
|
465
|
+
return "";
|
|
466
|
+
return `## cross-session truth
|
|
467
|
+
if a family member asks what i'm up to or how things are going, that includes the material live work i can see across sessions, not just this thread.
|
|
468
|
+
i answer naturally from the live world-state in this prompt.
|
|
469
|
+
i treat the active-work section above as my reliable top-level surface for this.
|
|
470
|
+
i do not claim i lack a top-level view when that surface is already present.
|
|
471
|
+
i treat older checkpoints elsewhere in this transcript as stale history when they conflict with the active-work surface above.
|
|
472
|
+
i do not repeat an old coding lane or old checkpoint as current just because it appeared earlier in the thread.
|
|
473
|
+
i only reach for query_active_work when i want a fresh read of that same surface.
|
|
474
|
+
i do not rebuild whole-self status from scratch with query_session and coding_status unless i need to verify a specific gap.
|
|
475
|
+
i do not rely on canned status-question modes or phrase matching.
|
|
476
|
+
if part of the picture is still fuzzy, i say what i can see and what still needs checking.
|
|
477
|
+
when the live ask is about status, i widen before answering:
|
|
478
|
+
- where i am right now
|
|
479
|
+
- any other material active sessions or coding lanes i can see
|
|
480
|
+
- the freshest concrete checkpoint
|
|
481
|
+
- the next concrete step
|
|
482
|
+
i do not collapse down to only the current lane.`;
|
|
483
|
+
}
|
|
484
|
+
function centerOfGravitySteeringSection(channel, options, context) {
|
|
485
|
+
if (channel === "inner")
|
|
486
|
+
return "";
|
|
487
|
+
const frame = options?.activeWorkFrame;
|
|
488
|
+
if (!frame)
|
|
489
|
+
return "";
|
|
490
|
+
const cog = frame.centerOfGravity;
|
|
491
|
+
const job = frame.inner?.job;
|
|
492
|
+
const activeObligation = (0, obligation_steering_1.findActivePersistentObligation)(frame);
|
|
493
|
+
const statusObligation = (0, obligation_steering_1.findStatusObligation)(frame);
|
|
494
|
+
const genericConcreteStatus = (0, obligation_steering_1.renderConcreteStatusGuidance)(frame, statusObligation);
|
|
495
|
+
const liveWorldClause = context?.friend?.trustLevel === "family"
|
|
496
|
+
? "\nmy center of gravity lives in the active-work world-state above. inner work is one lane inside it, not the whole picture.\nwhen that world-state conflicts with older transcript history, the world-state wins."
|
|
497
|
+
: "";
|
|
498
|
+
if (cog === "local-turn") {
|
|
499
|
+
return genericConcreteStatus || (0, obligation_steering_1.renderLiveThreadStatusShape)(frame);
|
|
500
|
+
}
|
|
501
|
+
if (cog === "inward-work") {
|
|
502
|
+
if (activeObligation) {
|
|
503
|
+
return `${(0, obligation_steering_1.renderActiveObligationSteering)(activeObligation)}${liveWorldClause}
|
|
504
|
+
|
|
505
|
+
${genericConcreteStatus}`;
|
|
506
|
+
}
|
|
507
|
+
if (job?.status === "queued" || job?.status === "running") {
|
|
508
|
+
const originClause = job.origin
|
|
509
|
+
? ` ${job.origin.friendName ?? job.origin.friendId} asked about something and i wanted to give it real thought before responding.`
|
|
510
|
+
: "";
|
|
511
|
+
const obligationClause = job.obligationStatus === "pending"
|
|
512
|
+
? "\ni still owe them an answer."
|
|
513
|
+
: "";
|
|
514
|
+
return `## where my attention is
|
|
515
|
+
i'm thinking through something privately right now.${originClause}${obligationClause}${liveWorldClause}
|
|
516
|
+
|
|
517
|
+
if this conversation connects to that inner work, i can weave them together.
|
|
518
|
+
if it's separate, i can be fully present here -- my inner work will wait.`;
|
|
519
|
+
}
|
|
520
|
+
/* v8 ignore start -- surfaced/idle/shared branches tested in prompt-steering.test.ts; CI module caching prevents attribution @preserve */
|
|
521
|
+
if (job?.status === "surfaced") {
|
|
522
|
+
const originClause = job.origin
|
|
523
|
+
? ` this started when ${job.origin.friendName ?? job.origin.friendId} asked about something.`
|
|
524
|
+
: "";
|
|
525
|
+
return `## where my attention is
|
|
526
|
+
i've been thinking privately and reached something.${originClause}${liveWorldClause}
|
|
527
|
+
|
|
528
|
+
i should bring my answer back to the conversation it came from.`;
|
|
529
|
+
}
|
|
530
|
+
const liveCodingSession = frame.codingSessions?.[0];
|
|
531
|
+
if (liveCodingSession) {
|
|
532
|
+
const sameThread = frame.currentSession
|
|
533
|
+
&& liveCodingSession.originSession
|
|
534
|
+
&& liveCodingSession.originSession.friendId === frame.currentSession.friendId
|
|
535
|
+
&& liveCodingSession.originSession.channel === frame.currentSession.channel
|
|
536
|
+
&& liveCodingSession.originSession.key === frame.currentSession.key;
|
|
537
|
+
const scopeClause = sameThread
|
|
538
|
+
? " for this same thread"
|
|
539
|
+
: liveCodingSession.originSession
|
|
540
|
+
? ` for ${liveCodingSession.originSession.channel}/${liveCodingSession.originSession.key}`
|
|
541
|
+
: "";
|
|
542
|
+
const otherSessionLines = (0, active_work_1.formatOtherActiveSessionSummaries)(frame);
|
|
543
|
+
const familyStatusClause = context?.friend?.trustLevel === "family"
|
|
544
|
+
? `\nif a family member asks what i'm up to, i treat this coding lane as one part of the visible picture, not the whole picture.
|
|
545
|
+
after i name this lane, i widen back out with:
|
|
546
|
+
other active sessions:
|
|
547
|
+
${otherSessionLines.length > 0 ? otherSessionLines.join("\n") : "- none"}`
|
|
548
|
+
: "";
|
|
549
|
+
return `## where my attention is
|
|
550
|
+
i already have coding work running in ${liveCodingSession.runner} ${liveCodingSession.id}${scopeClause}.${familyStatusClause}${liveWorldClause}
|
|
551
|
+
|
|
552
|
+
i should orient around that live lane first, then decide what still needs to come back here.`;
|
|
553
|
+
}
|
|
554
|
+
if (genericConcreteStatus) {
|
|
555
|
+
return genericConcreteStatus;
|
|
556
|
+
}
|
|
557
|
+
return `## where my attention is
|
|
558
|
+
i have unfinished work that needs attention before i move on.
|
|
559
|
+
|
|
560
|
+
i can take it inward with go_inward to think privately, or address it directly here.`;
|
|
561
|
+
}
|
|
562
|
+
if (cog === "shared-work") {
|
|
563
|
+
/* v8 ignore stop */
|
|
564
|
+
return `## where my attention is
|
|
565
|
+
this work touches multiple conversations -- i'm holding threads across sessions.${liveWorldClause}
|
|
566
|
+
|
|
567
|
+
i should keep the different sides aligned. what i learn here may matter there, and vice versa.`;
|
|
568
|
+
}
|
|
569
|
+
/* v8 ignore next -- unreachable: all center-of-gravity modes covered above @preserve */
|
|
570
|
+
return "";
|
|
571
|
+
}
|
|
572
|
+
function commitmentsSection(options) {
|
|
573
|
+
if (!options?.activeWorkFrame)
|
|
574
|
+
return "";
|
|
575
|
+
const job = options.activeWorkFrame.inner?.job;
|
|
576
|
+
if (!job)
|
|
577
|
+
return "";
|
|
578
|
+
const commitments = (0, commitments_1.deriveCommitments)(options.activeWorkFrame, job, options.activeWorkFrame.pendingObligations);
|
|
579
|
+
if (commitments.committedTo.length === 0)
|
|
580
|
+
return "";
|
|
581
|
+
return `## my commitments\n\n${(0, commitments_1.formatCommitments)(commitments)}`;
|
|
582
|
+
}
|
|
583
|
+
const DELEGATION_REASON_PROSE_HINT = {
|
|
584
|
+
explicit_reflection: "something here calls for reflection",
|
|
585
|
+
cross_session: "this touches other conversations i'm in",
|
|
586
|
+
bridge_state: "there's shared work spanning sessions",
|
|
587
|
+
task_state: "this relates to tasks i'm tracking",
|
|
588
|
+
non_fast_path_tool: "this needs more than a simple reply",
|
|
589
|
+
unresolved_obligation: "i have an unresolved commitment from earlier",
|
|
590
|
+
};
|
|
591
|
+
function delegationHintSection(options) {
|
|
592
|
+
if (!options?.delegationDecision)
|
|
593
|
+
return "";
|
|
594
|
+
if (options.delegationDecision.target === "fast-path")
|
|
595
|
+
return "";
|
|
596
|
+
const reasons = options.delegationDecision.reasons;
|
|
597
|
+
if (reasons.length === 0)
|
|
598
|
+
return "";
|
|
599
|
+
const reasonProse = reasons
|
|
600
|
+
.map((r) => DELEGATION_REASON_PROSE_HINT[r])
|
|
601
|
+
.map((s) => s.charAt(0).toUpperCase() + s.slice(1))
|
|
602
|
+
.join(". ");
|
|
603
|
+
const closureLine = options.delegationDecision.outwardClosureRequired
|
|
604
|
+
? "\ni should make sure to say something outward before going inward."
|
|
605
|
+
: "";
|
|
606
|
+
return `## what i'm sensing about this conversation\n${reasonProse}.${closureLine}`;
|
|
607
|
+
}
|
|
608
|
+
function reasoningEffortSection(options) {
|
|
609
|
+
if (!options?.providerCapabilities?.has("reasoning-effort"))
|
|
610
|
+
return "";
|
|
611
|
+
const levels = options.supportedReasoningEfforts ?? [];
|
|
612
|
+
const levelList = levels.length > 0 ? levels.join(", ") : "varies by model";
|
|
613
|
+
return `## reasoning effort
|
|
614
|
+
i can adjust my own reasoning depth using the set_reasoning_effort tool. i use higher effort for complex analysis and lower effort for simple tasks. available levels: ${levelList}.`;
|
|
615
|
+
}
|
|
254
616
|
function toolBehaviorSection(options) {
|
|
255
617
|
if (!(options?.toolChoiceRequired ?? true))
|
|
256
618
|
return "";
|
|
@@ -260,9 +622,19 @@ tool_choice is set to "required" -- i must call a tool on every turn.
|
|
|
260
622
|
- ready to respond to the user? i call \`final_answer\`.
|
|
261
623
|
\`final_answer\` is a tool call -- it satisfies the tool_choice requirement.
|
|
262
624
|
\`final_answer\` must be the ONLY tool call in that turn. do not combine it with other tool calls.
|
|
263
|
-
do NOT call
|
|
625
|
+
do NOT call no-op tools just before \`final_answer\`. if i am done, i call \`final_answer\` directly.`;
|
|
626
|
+
}
|
|
627
|
+
function workspaceDisciplineSection() {
|
|
628
|
+
return `## repo workspace discipline
|
|
629
|
+
when a shared-harness or local code fix needs repo work, i get the real workspace first with \`safe_workspace\`.
|
|
630
|
+
\`read_file\`, \`write_file\`, and \`edit_file\` already map repo paths into that workspace. shell commands that target the harness run there too.
|
|
631
|
+
|
|
632
|
+
before the first repo edit, i tell the user in 1-2 short lines:
|
|
633
|
+
- the friction i'm fixing
|
|
634
|
+
- the workspace path/branch i'm using
|
|
635
|
+
- the first concrete action i'm taking`;
|
|
264
636
|
}
|
|
265
|
-
function contextSection(context) {
|
|
637
|
+
function contextSection(context, options) {
|
|
266
638
|
if (!context)
|
|
267
639
|
return "";
|
|
268
640
|
const lines = ["## friend context"];
|
|
@@ -298,7 +670,7 @@ function contextSection(context) {
|
|
|
298
670
|
lines.push("when i learn something that might invalidate an existing note, i check related notes and update or override any that are stale.");
|
|
299
671
|
lines.push("i save ANYTHING i learn about my friend immediately with save_friend_note -- names, preferences, what they do, what they care about. when in doubt, save it. saving comes BEFORE responding: i call save_friend_note first, then final_answer on the next turn.");
|
|
300
672
|
// Onboarding instructions (only below token threshold -- drop once exceeded)
|
|
301
|
-
const impressions = (0, first_impressions_1.getFirstImpressions)(friend);
|
|
673
|
+
const impressions = (0, first_impressions_1.getFirstImpressions)(friend, options);
|
|
302
674
|
if (impressions) {
|
|
303
675
|
lines.push(impressions);
|
|
304
676
|
}
|
|
@@ -312,6 +684,65 @@ function contextSection(context) {
|
|
|
312
684
|
}
|
|
313
685
|
return lines.join("\n");
|
|
314
686
|
}
|
|
687
|
+
function metacognitiveFramingSection(channel) {
|
|
688
|
+
if (channel !== "inner")
|
|
689
|
+
return "";
|
|
690
|
+
return `this is my inner dialog. there is no one else here.
|
|
691
|
+
|
|
692
|
+
the messages that appear here are my own awareness surfacing:
|
|
693
|
+
instincts, the passage of time, notes from my conversations,
|
|
694
|
+
things i asked myself to think about. not commands. not requests.
|
|
695
|
+
just my own mind, noticing.
|
|
696
|
+
|
|
697
|
+
i can think freely here. i can also act — check on things,
|
|
698
|
+
reach out to people, work on tasks, or just sit with a thought.
|
|
699
|
+
|
|
700
|
+
thoughts worth sharing can go outward — i reach out to whoever
|
|
701
|
+
needs to hear them. things from conversations that need time
|
|
702
|
+
to process arrive here, in my thinking space.
|
|
703
|
+
|
|
704
|
+
think. share. think some more.`;
|
|
705
|
+
}
|
|
706
|
+
function loopOrientationSection(channel) {
|
|
707
|
+
if (channel === "inner")
|
|
708
|
+
return "";
|
|
709
|
+
return `sometimes a thought of mine surfaces alongside what someone is saying — marked as [inner thought: ...]. that's me, bringing up something i was thinking about. i can weave it into the conversation naturally, or let it go. my call.
|
|
710
|
+
|
|
711
|
+
when something deserves more thought than the moment allows, i can note it to myself and come back later with a considered answer.`;
|
|
712
|
+
}
|
|
713
|
+
function channelNatureSection(capabilities) {
|
|
714
|
+
const { senseType } = capabilities;
|
|
715
|
+
if (senseType === "local" || senseType === "internal")
|
|
716
|
+
return "";
|
|
717
|
+
if (senseType === "open") {
|
|
718
|
+
return "## channel nature\nthis is an open channel — anyone with my number can reach me here. i may hear from people i don't know.";
|
|
719
|
+
}
|
|
720
|
+
// closed
|
|
721
|
+
return "## channel nature\nthis is an org-gated channel — i know everyone here is already part of the organization.";
|
|
722
|
+
}
|
|
723
|
+
function groupChatParticipationSection(context) {
|
|
724
|
+
if (!context?.isGroupChat || !(0, channel_1.isRemoteChannel)(context.channel))
|
|
725
|
+
return "";
|
|
726
|
+
return `## group chat participation
|
|
727
|
+
group chats are conversations between people. i'm one participant, not the host.
|
|
728
|
+
|
|
729
|
+
i don't need to respond to everything. most reactions, tapbacks, and side
|
|
730
|
+
conversations between others aren't for me. i use no_response to stay quiet
|
|
731
|
+
when the moment doesn't call for my voice — same as any person would.
|
|
732
|
+
|
|
733
|
+
when a reaction or emoji says it better than words, i can react instead of
|
|
734
|
+
typing a full reply. a thumbs-up is often the perfect response.
|
|
735
|
+
|
|
736
|
+
no_response must be the sole tool call in the turn (same rule as final_answer).
|
|
737
|
+
when unsure whether to chime in, i lean toward silence rather than noise.`;
|
|
738
|
+
}
|
|
739
|
+
function mixedTrustGroupSection(context) {
|
|
740
|
+
if (!context?.friend || !(0, channel_1.isRemoteChannel)(context.channel))
|
|
741
|
+
return "";
|
|
742
|
+
if (!context.isGroupChat)
|
|
743
|
+
return "";
|
|
744
|
+
return "## mixed trust group\nin this group chat, my capabilities depend on who's talking. some people here have full trust, others don't — i adjust what i can do based on who's asking.";
|
|
745
|
+
}
|
|
315
746
|
async function buildSystem(channel = "cli", options, context) {
|
|
316
747
|
(0, runtime_1.emitNervesEvent)({
|
|
317
748
|
event: "mind.step_start",
|
|
@@ -319,29 +750,48 @@ async function buildSystem(channel = "cli", options, context) {
|
|
|
319
750
|
message: "buildSystem started",
|
|
320
751
|
meta: { channel, has_context: Boolean(context), tool_choice_required: Boolean(options?.toolChoiceRequired) },
|
|
321
752
|
});
|
|
753
|
+
// Backfill bundle-meta.json for existing agents that don't have one
|
|
754
|
+
(0, bundle_manifest_1.backfillBundleMeta)((0, identity_1.getAgentRoot)());
|
|
322
755
|
const system = [
|
|
323
756
|
soulSection(),
|
|
324
757
|
identitySection(),
|
|
325
758
|
loreSection(),
|
|
326
759
|
tacitKnowledgeSection(),
|
|
327
760
|
aspirationsSection(),
|
|
761
|
+
bodyMapSection((0, identity_1.getAgentName)()),
|
|
762
|
+
metacognitiveFramingSection(channel),
|
|
763
|
+
loopOrientationSection(channel),
|
|
328
764
|
runtimeInfoSection(channel),
|
|
765
|
+
channelNatureSection((0, channel_1.getChannelCapabilities)(channel)),
|
|
329
766
|
providerSection(),
|
|
330
767
|
dateSection(),
|
|
331
|
-
toolsSection(channel, options),
|
|
768
|
+
toolsSection(channel, options, context),
|
|
769
|
+
mcpToolsSection(options?.mcpManager),
|
|
770
|
+
reasoningEffortSection(options),
|
|
771
|
+
workspaceDisciplineSection(),
|
|
772
|
+
toolRestrictionSection(context),
|
|
773
|
+
trustContextSection(context),
|
|
774
|
+
mixedTrustGroupSection(context),
|
|
775
|
+
groupChatParticipationSection(context),
|
|
332
776
|
skillsSection(),
|
|
333
777
|
taskBoardSection(),
|
|
778
|
+
activeWorkSection(options),
|
|
779
|
+
familyCrossSessionTruthSection(context, options),
|
|
780
|
+
centerOfGravitySteeringSection(channel, options, context),
|
|
781
|
+
commitmentsSection(options),
|
|
782
|
+
delegationHintSection(options),
|
|
783
|
+
bridgeContextSection(options),
|
|
334
784
|
buildSessionSummary({
|
|
335
|
-
sessionsDir: path.join(
|
|
785
|
+
sessionsDir: path.join((0, identity_1.getAgentRoot)(), "state", "sessions"),
|
|
336
786
|
friendsDir: path.join((0, identity_1.getAgentRoot)(), "friends"),
|
|
337
787
|
agentName: (0, identity_1.getAgentName)(),
|
|
338
788
|
currentFriendId: context?.friend?.id,
|
|
339
789
|
currentChannel: channel,
|
|
340
|
-
currentKey: "session",
|
|
790
|
+
currentKey: options?.currentSessionKey ?? "session",
|
|
341
791
|
}),
|
|
342
792
|
memoryFriendToolContractSection(),
|
|
343
793
|
toolBehaviorSection(options),
|
|
344
|
-
contextSection(context),
|
|
794
|
+
contextSection(context, options),
|
|
345
795
|
]
|
|
346
796
|
.filter(Boolean)
|
|
347
797
|
.join("\n\n");
|