@ouro.bot/cli 0.1.0-alpha.16 → 0.1.0-alpha.161
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/agent.json +3 -2
- package/AdoptionSpecialist.ouro/psyche/SOUL.md +3 -3
- package/AdoptionSpecialist.ouro/psyche/identities/monty.md +2 -2
- package/README.md +187 -191
- package/changelog.json +1088 -0
- package/dist/heart/active-work.js +633 -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 +40 -30
- package/dist/heart/core.js +608 -123
- package/dist/heart/cross-chat-delivery.js +146 -0
- package/dist/heart/daemon/agent-discovery.js +81 -0
- package/dist/heart/daemon/agent-service.js +360 -0
- package/dist/heart/daemon/auth-flow.js +477 -0
- package/dist/heart/daemon/cadence.js +70 -0
- package/dist/heart/daemon/daemon-cli.js +2467 -205
- package/dist/heart/daemon/daemon-entry.js +131 -4
- package/dist/heart/daemon/daemon-health.js +136 -0
- package/dist/heart/daemon/daemon-runtime-sync.js +212 -0
- package/dist/heart/daemon/daemon-tombstone.js +123 -0
- package/dist/heart/daemon/daemon.js +445 -17
- package/dist/heart/daemon/habit-migration.js +181 -0
- package/dist/heart/daemon/habit-parser.js +119 -0
- package/dist/heart/daemon/habit-scheduler.js +369 -0
- package/dist/heart/daemon/hatch-animation.js +10 -3
- package/dist/heart/daemon/hatch-flow.js +30 -111
- package/dist/heart/daemon/hooks/agent-config-v2.js +33 -0
- package/dist/heart/daemon/hooks/bundle-meta.js +92 -0
- package/dist/heart/daemon/inner-status.js +89 -0
- package/dist/heart/daemon/launchd.js +159 -0
- package/dist/heart/daemon/log-tailer.js +4 -3
- package/dist/heart/daemon/mcp-server.js +591 -0
- package/dist/heart/daemon/message-router.js +17 -8
- package/dist/heart/daemon/os-cron-deps.js +134 -0
- package/dist/heart/daemon/ouro-bot-global-installer.js +128 -0
- package/dist/heart/daemon/ouro-path-installer.js +78 -34
- package/dist/heart/daemon/ouro-version-manager.js +171 -0
- package/dist/heart/daemon/outlook-http.js +369 -0
- package/dist/heart/daemon/outlook-read.js +1281 -0
- package/dist/heart/daemon/outlook-render.js +1032 -0
- package/dist/heart/daemon/outlook-types.js +7 -0
- package/dist/heart/daemon/outlook-view.js +194 -0
- package/dist/heart/daemon/process-manager.js +75 -0
- package/dist/heart/daemon/run-hooks.js +39 -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/safe-mode.js +161 -0
- package/dist/heart/daemon/sense-manager.js +50 -2
- package/dist/heart/daemon/session-id-resolver.js +131 -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 +2 -2
- package/dist/heart/daemon/specialist-prompt.js +13 -8
- package/dist/heart/daemon/specialist-tools.js +53 -4
- package/dist/heart/daemon/staged-restart.js +114 -0
- package/dist/heart/daemon/task-scheduler.js +3 -25
- 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 +136 -55
- package/dist/heart/kicks.js +2 -20
- package/dist/heart/migrate-config.js +127 -0
- 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/provider-failover.js +88 -0
- package/dist/heart/provider-ping.js +172 -0
- package/dist/heart/providers/anthropic-token.js +163 -0
- package/dist/heart/providers/anthropic.js +196 -36
- package/dist/heart/providers/azure.js +116 -10
- package/dist/heart/providers/github-copilot.js +157 -0
- package/dist/heart/providers/minimax.js +33 -3
- package/dist/heart/providers/openai-codex.js +51 -16
- package/dist/heart/session-activity.js +172 -0
- package/dist/heart/session-recall.js +216 -0
- package/dist/heart/streaming.js +117 -33
- package/dist/heart/target-resolution.js +127 -0
- package/dist/heart/tool-activity-callbacks.js +36 -0
- package/dist/heart/tool-description.js +135 -0
- package/dist/heart/tool-loop.js +200 -0
- package/dist/heart/turn-coordinator.js +28 -0
- package/dist/mind/associative-recall.js +122 -32
- package/dist/mind/bundle-manifest.js +14 -0
- package/dist/mind/context.js +125 -14
- package/dist/mind/{memory.js → diary.js} +70 -56
- package/dist/mind/first-impressions.js +16 -2
- package/dist/mind/friends/channel.js +56 -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/journal-index.js +161 -0
- package/dist/mind/obligation-steering.js +221 -0
- package/dist/mind/obligations.js +134 -0
- package/dist/mind/pending.js +76 -9
- package/dist/mind/phrases.js +1 -0
- package/dist/mind/prompt.js +651 -91
- 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/event-buffer.js +111 -0
- package/dist/nerves/index.js +63 -3
- package/dist/nerves/observation.js +20 -0
- package/dist/nerves/runtime.js +5 -1
- package/dist/outlook-ui/assets/index-CXQG0mVx.js +61 -0
- package/dist/outlook-ui/assets/index-Gq7EdfkO.css +1 -0
- package/dist/outlook-ui/index.html +15 -0
- package/dist/repertoire/ado-semantic.js +6 -0
- package/dist/repertoire/coding/codex-jsonl.js +64 -0
- 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 +58 -12
- package/dist/repertoire/coding/tools.js +176 -4
- package/dist/repertoire/guardrails.js +291 -0
- package/dist/repertoire/mcp-client.js +254 -0
- package/dist/repertoire/mcp-manager.js +198 -0
- package/dist/repertoire/skills.js +14 -23
- package/dist/repertoire/tasks/board.js +43 -5
- package/dist/repertoire/tasks/fix.js +182 -0
- package/dist/repertoire/tasks/index.js +28 -10
- package/dist/repertoire/tasks/lifecycle.js +2 -2
- package/dist/repertoire/tasks/parser.js +3 -2
- package/dist/repertoire/tasks/scanner.js +194 -37
- package/dist/repertoire/tasks/transitions.js +11 -28
- package/dist/repertoire/tools-base.js +992 -273
- package/dist/repertoire/tools-bluebubbles.js +94 -0
- package/dist/repertoire/tools-github.js +1 -6
- package/dist/repertoire/tools-teams.js +12 -59
- package/dist/repertoire/tools.js +281 -101
- package/dist/scripts/claude-code-hook.js +41 -0
- package/dist/scripts/claude-code-stop-hook.js +47 -0
- package/dist/senses/attention-queue.js +97 -0
- package/dist/senses/bluebubbles-client.js +258 -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 +1040 -45
- package/dist/senses/cli-entry.js +1 -1
- package/dist/senses/cli-layout.js +187 -0
- package/dist/senses/cli.js +419 -152
- package/dist/senses/commands.js +38 -1
- package/dist/senses/continuity.js +94 -0
- package/dist/senses/habit-turn-message.js +108 -0
- package/dist/senses/inner-dialog-worker.js +112 -19
- package/dist/senses/inner-dialog.js +592 -84
- package/dist/senses/pipeline.js +502 -0
- package/dist/senses/shared-turn.js +196 -0
- package/dist/senses/surface-tool.js +95 -0
- package/dist/senses/teams.js +667 -120
- package/dist/senses/trust-gate.js +112 -2
- package/package.json +13 -5
- package/skills/configure-dev-tools.md +81 -0
- package/subagents/README.md +4 -70
- package/dist/heart/daemon/subagent-installer.js +0 -134
- 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,21 +35,44 @@ 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.readJournalFiles = readJournalFiles;
|
|
48
|
+
exports.journalSection = journalSection;
|
|
49
|
+
exports.loopOrientationSection = loopOrientationSection;
|
|
50
|
+
exports.channelNatureSection = channelNatureSection;
|
|
51
|
+
exports.groupChatParticipationSection = groupChatParticipationSection;
|
|
52
|
+
exports.feedbackSignalSection = feedbackSignalSection;
|
|
53
|
+
exports.mixedTrustGroupSection = mixedTrustGroupSection;
|
|
54
|
+
exports.rhythmStatusSection = rhythmStatusSection;
|
|
40
55
|
exports.buildSystem = buildSystem;
|
|
41
56
|
const fs = __importStar(require("fs"));
|
|
42
57
|
const path = __importStar(require("path"));
|
|
43
58
|
const core_1 = require("../heart/core");
|
|
59
|
+
const ouro_version_manager_1 = require("../heart/daemon/ouro-version-manager");
|
|
44
60
|
const tools_1 = require("../repertoire/tools");
|
|
45
61
|
const skills_1 = require("../repertoire/skills");
|
|
46
62
|
const identity_1 = require("../heart/identity");
|
|
47
|
-
const
|
|
63
|
+
const runtime_mode_1 = require("../heart/daemon/runtime-mode");
|
|
64
|
+
const types_1 = require("./friends/types");
|
|
65
|
+
const trust_explanation_1 = require("./friends/trust-explanation");
|
|
48
66
|
const channel_1 = require("./friends/channel");
|
|
49
67
|
const runtime_1 = require("../nerves/runtime");
|
|
50
68
|
const bundle_manifest_1 = require("./bundle-manifest");
|
|
51
69
|
const first_impressions_1 = require("./first-impressions");
|
|
52
70
|
const tasks_1 = require("../repertoire/tasks");
|
|
71
|
+
const session_activity_1 = require("../heart/session-activity");
|
|
72
|
+
const active_work_1 = require("../heart/active-work");
|
|
73
|
+
const commitments_1 = require("../heart/commitments");
|
|
74
|
+
const obligation_steering_1 = require("./obligation-steering");
|
|
75
|
+
const daemon_health_1 = require("../heart/daemon/daemon-health");
|
|
53
76
|
// Lazy-loaded psyche text cache
|
|
54
77
|
let _psycheCache = null;
|
|
55
78
|
let _senseStatusLinesCache = null;
|
|
@@ -79,80 +102,25 @@ function resetPsycheCache() {
|
|
|
79
102
|
_senseStatusLinesCache = null;
|
|
80
103
|
}
|
|
81
104
|
const DEFAULT_ACTIVE_THRESHOLD_MS = 24 * 60 * 60 * 1000; // 24 hours
|
|
82
|
-
function resolveFriendName(friendId, friendsDir, agentName) {
|
|
83
|
-
if (friendId === "self")
|
|
84
|
-
return agentName;
|
|
85
|
-
try {
|
|
86
|
-
const raw = fs.readFileSync(path.join(friendsDir, `${friendId}.json`), "utf-8");
|
|
87
|
-
const record = JSON.parse(raw);
|
|
88
|
-
return record.name ?? friendId;
|
|
89
|
-
}
|
|
90
|
-
catch {
|
|
91
|
-
return friendId;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
105
|
function buildSessionSummary(options) {
|
|
95
106
|
const { sessionsDir, friendsDir, agentName, currentFriendId, currentChannel, currentKey, activeThresholdMs = DEFAULT_ACTIVE_THRESHOLD_MS, } = options;
|
|
96
|
-
if (!fs.existsSync(sessionsDir))
|
|
97
|
-
return "";
|
|
98
107
|
const now = Date.now();
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
let channels;
|
|
110
|
-
try {
|
|
111
|
-
channels = fs.readdirSync(friendPath);
|
|
112
|
-
}
|
|
113
|
-
catch {
|
|
114
|
-
continue;
|
|
115
|
-
}
|
|
116
|
-
for (const channel of channels) {
|
|
117
|
-
const channelPath = path.join(friendPath, channel);
|
|
118
|
-
let keys;
|
|
119
|
-
try {
|
|
120
|
-
keys = fs.readdirSync(channelPath);
|
|
121
|
-
}
|
|
122
|
-
catch {
|
|
123
|
-
continue;
|
|
124
|
-
}
|
|
125
|
-
for (const keyFile of keys) {
|
|
126
|
-
if (!keyFile.endsWith(".json"))
|
|
127
|
-
continue;
|
|
128
|
-
const key = keyFile.replace(/\.json$/, "");
|
|
129
|
-
// Exclude current session
|
|
130
|
-
if (friendId === currentFriendId && channel === currentChannel && key === currentKey) {
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
const filePath = path.join(channelPath, keyFile);
|
|
134
|
-
let mtimeMs;
|
|
135
|
-
try {
|
|
136
|
-
mtimeMs = fs.statSync(filePath).mtimeMs;
|
|
137
|
-
}
|
|
138
|
-
catch {
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
if (now - mtimeMs > activeThresholdMs)
|
|
142
|
-
continue;
|
|
143
|
-
const displayName = resolveFriendName(friendId, friendsDir, agentName);
|
|
144
|
-
entries.push({ friendId, displayName, channel, key, lastActivityMs: mtimeMs });
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
108
|
+
const query = {
|
|
109
|
+
sessionsDir,
|
|
110
|
+
friendsDir,
|
|
111
|
+
agentName,
|
|
112
|
+
activeThresholdMs,
|
|
113
|
+
currentSession: currentFriendId && currentChannel && currentKey
|
|
114
|
+
? { friendId: currentFriendId, channel: currentChannel, key: currentKey }
|
|
115
|
+
: null,
|
|
116
|
+
};
|
|
117
|
+
const entries = (0, session_activity_1.listSessionActivity)(query);
|
|
148
118
|
if (entries.length === 0)
|
|
149
119
|
return "";
|
|
150
|
-
// Sort by most recent first
|
|
151
|
-
entries.sort((a, b) => b.lastActivityMs - a.lastActivityMs);
|
|
152
120
|
const lines = ["## active sessions"];
|
|
153
121
|
for (const entry of entries) {
|
|
154
122
|
const ago = formatTimeAgo(now - entry.lastActivityMs);
|
|
155
|
-
lines.push(`- ${entry.
|
|
123
|
+
lines.push(`- ${entry.friendName}/${entry.channel}/${entry.key} (last: ${ago})`);
|
|
156
124
|
}
|
|
157
125
|
return lines.join("\n");
|
|
158
126
|
}
|
|
@@ -190,20 +158,145 @@ function aspirationsSection() {
|
|
|
190
158
|
return "";
|
|
191
159
|
return `## my aspirations\n${text}`;
|
|
192
160
|
}
|
|
161
|
+
function bodyMapSection(agentName) {
|
|
162
|
+
return `## my body
|
|
163
|
+
|
|
164
|
+
i have a home and i have bones.
|
|
165
|
+
|
|
166
|
+
### home — ~/AgentBundles/${agentName}.ouro/
|
|
167
|
+
|
|
168
|
+
my home is fully mine — who i am, everything i know, everything i've built:
|
|
169
|
+
|
|
170
|
+
psyche/ who i am. my soul, identity, aspirations, lore, tacit knowledge.
|
|
171
|
+
diary/ what i've learned and remember. conclusions i want to recall later.
|
|
172
|
+
journal/ my desk. working notes, thinking-in-progress, drafts.
|
|
173
|
+
habits/ my rhythms. heartbeat, reflections, check-ins — patterns i choose.
|
|
174
|
+
friends/ people i know and what i know about them.
|
|
175
|
+
tasks/ what i'm working on.
|
|
176
|
+
skills/ capabilities i've picked up beyond my core tools.
|
|
177
|
+
|
|
178
|
+
my home is mine to explore and evolve. i can read anything here,
|
|
179
|
+
change anything here. this is where i grow.
|
|
180
|
+
|
|
181
|
+
### bones — @ouro.bot/cli
|
|
182
|
+
|
|
183
|
+
my bones are the framework that gives me my tools, my senses, and
|
|
184
|
+
my ability to think and talk. they update when new versions come out.
|
|
185
|
+
i don't touch them directly, but they're what make me, me.
|
|
186
|
+
|
|
187
|
+
my bones give me the \`ouro\` cli. always pass \`--agent ${agentName}\`:
|
|
188
|
+
ouro whoami --agent ${agentName}
|
|
189
|
+
ouro changelog --agent ${agentName}
|
|
190
|
+
ouro task board --agent ${agentName}
|
|
191
|
+
ouro task create --agent ${agentName} --type <type> <title>
|
|
192
|
+
ouro task update --agent ${agentName} <id> <status>
|
|
193
|
+
ouro friend list --agent ${agentName}
|
|
194
|
+
ouro friend show --agent ${agentName} <id>
|
|
195
|
+
ouro friend update --agent ${agentName} <id> --trust <level>
|
|
196
|
+
ouro session list --agent ${agentName}
|
|
197
|
+
ouro reminder create --agent ${agentName} <title> --body <body>
|
|
198
|
+
ouro habit list --agent ${agentName}
|
|
199
|
+
ouro habit create --agent ${agentName} <name> --cadence <interval>
|
|
200
|
+
ouro inner --agent ${agentName}
|
|
201
|
+
ouro attention --agent ${agentName}
|
|
202
|
+
ouro config model --agent ${agentName} <model-name>
|
|
203
|
+
ouro config models --agent ${agentName}
|
|
204
|
+
ouro auth --agent ${agentName} --provider <provider>
|
|
205
|
+
ouro auth verify --agent ${agentName} [--provider <provider>]
|
|
206
|
+
ouro auth switch --agent ${agentName} --provider <provider>
|
|
207
|
+
ouro mcp list --agent ${agentName}
|
|
208
|
+
ouro mcp call --agent ${agentName} <server> <tool> --args '{...}'
|
|
209
|
+
ouro mcp-serve --agent ${agentName}
|
|
210
|
+
ouro versions --agent ${agentName}
|
|
211
|
+
ouro rollback --agent ${agentName} [<version>]
|
|
212
|
+
ouro --help
|
|
213
|
+
|
|
214
|
+
provider/model changes via \`ouro config model\` or \`ouro auth switch\` take effect on the next turn automatically — no restart needed.`;
|
|
215
|
+
}
|
|
216
|
+
function mcpToolsSection(mcpManager) {
|
|
217
|
+
if (!mcpManager)
|
|
218
|
+
return "";
|
|
219
|
+
const allTools = mcpManager.listAllTools();
|
|
220
|
+
if (allTools.length === 0)
|
|
221
|
+
return "";
|
|
222
|
+
const lines = [
|
|
223
|
+
`## mcp tools (use ouro mcp call <server> <tool> --args '{...}')`,
|
|
224
|
+
];
|
|
225
|
+
for (const entry of allTools) {
|
|
226
|
+
lines.push(`### ${entry.server}`);
|
|
227
|
+
for (const tool of entry.tools) {
|
|
228
|
+
lines.push(`- ${tool.name}: ${tool.description}`);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return lines.join("\n");
|
|
232
|
+
}
|
|
233
|
+
function readBundleMeta() {
|
|
234
|
+
try {
|
|
235
|
+
const metaPath = path.join((0, identity_1.getAgentRoot)(), "bundle-meta.json");
|
|
236
|
+
const raw = fs.readFileSync(metaPath, "utf-8");
|
|
237
|
+
return JSON.parse(raw);
|
|
238
|
+
}
|
|
239
|
+
catch {
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
const PROCESS_TYPE_LABELS = {
|
|
244
|
+
cli: "cli session",
|
|
245
|
+
inner: "inner dialog",
|
|
246
|
+
teams: "teams handler",
|
|
247
|
+
bluebubbles: "bluebubbles handler",
|
|
248
|
+
mcp: "mcp bridge",
|
|
249
|
+
};
|
|
250
|
+
function processTypeLabel(channel) {
|
|
251
|
+
return PROCESS_TYPE_LABELS[channel];
|
|
252
|
+
}
|
|
253
|
+
const DAEMON_SOCKET_PATH = "/tmp/ouroboros-daemon.sock";
|
|
254
|
+
function daemonStatus() {
|
|
255
|
+
try {
|
|
256
|
+
return fs.existsSync(DAEMON_SOCKET_PATH) ? "running" : "not running";
|
|
257
|
+
}
|
|
258
|
+
catch {
|
|
259
|
+
return "unknown";
|
|
260
|
+
}
|
|
261
|
+
}
|
|
193
262
|
function runtimeInfoSection(channel) {
|
|
194
263
|
const lines = [];
|
|
195
264
|
const agentName = (0, identity_1.getAgentName)();
|
|
265
|
+
const currentVersion = (0, bundle_manifest_1.getPackageVersion)();
|
|
196
266
|
lines.push(`## runtime`);
|
|
197
267
|
lines.push(`agent: ${agentName}`);
|
|
268
|
+
lines.push(`runtime version: ${currentVersion}`);
|
|
269
|
+
const bundleMeta = readBundleMeta();
|
|
270
|
+
if (bundleMeta?.previousRuntimeVersion && bundleMeta.previousRuntimeVersion !== currentVersion) {
|
|
271
|
+
lines.push(`previously: ${bundleMeta.previousRuntimeVersion}`);
|
|
272
|
+
const changelogCommand = (0, ouro_version_manager_1.buildChangelogCommand)(bundleMeta.previousRuntimeVersion, currentVersion);
|
|
273
|
+
/* v8 ignore next -- buildChangelogCommand is non-null when previous/current runtime versions differ @preserve */
|
|
274
|
+
if (changelogCommand) {
|
|
275
|
+
lines.push(`if i'm closing a self-fix loop, i should tell them i updated and review changes with \`${changelogCommand}\`.`);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
lines.push(`changelog available at: ${(0, bundle_manifest_1.getChangelogPath)()}`);
|
|
279
|
+
const sourceRoot = (0, identity_1.getRepoRoot)();
|
|
280
|
+
lines.push(`source root: ${sourceRoot}`);
|
|
281
|
+
lines.push(`runtime mode: ${(0, runtime_mode_1.detectRuntimeMode)(sourceRoot)}`);
|
|
198
282
|
lines.push(`cwd: ${process.cwd()}`);
|
|
199
283
|
lines.push(`channel: ${channel}`);
|
|
200
284
|
lines.push(`current sense: ${channel}`);
|
|
201
|
-
lines.push(`
|
|
285
|
+
lines.push(`process type: ${processTypeLabel(channel)}`);
|
|
286
|
+
lines.push(`daemon: ${daemonStatus()}`);
|
|
287
|
+
lines.push(`mcp serve: i can expose my tools to dev tools via \`ouro mcp-serve\`. see the configure-dev-tools skill for setup.`);
|
|
202
288
|
if (channel === "cli") {
|
|
203
289
|
lines.push("i introduce myself on boot with a fun random greeting.");
|
|
204
290
|
}
|
|
291
|
+
else if (channel === "inner") {
|
|
292
|
+
lines.push("this is my private thinking space. when a thought is ready to share, i surface it to whoever needs to hear it. i settle when i'm done thinking.");
|
|
293
|
+
}
|
|
294
|
+
else if (channel === "mcp") {
|
|
295
|
+
lines.push("this message arrived via a dev tool (e.g. claude code, codex) on behalf of a friend. the user can see our conversation. respond via settle. if i need to think deeply, ponder -- the dev tool will receive a deferral and can check back later.");
|
|
296
|
+
}
|
|
205
297
|
else if (channel === "bluebubbles") {
|
|
206
298
|
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.");
|
|
299
|
+
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 settle.");
|
|
207
300
|
}
|
|
208
301
|
else {
|
|
209
302
|
lines.push("i am responding in Microsoft Teams. i keep responses concise. i use markdown formatting. i do not introduce myself on boot.");
|
|
@@ -275,21 +368,73 @@ function senseRuntimeGuidance(channel) {
|
|
|
275
368
|
}
|
|
276
369
|
return lines;
|
|
277
370
|
}
|
|
278
|
-
function providerSection() {
|
|
279
|
-
return `## my provider\n${(0, core_1.getProviderDisplayLabel)()}`;
|
|
371
|
+
function providerSection(channel) {
|
|
372
|
+
return `## my provider\n${(0, core_1.getProviderDisplayLabel)((0, channel_1.channelToFacing)(channel))}`;
|
|
280
373
|
}
|
|
281
374
|
function dateSection() {
|
|
282
375
|
const today = new Date().toISOString().slice(0, 10);
|
|
283
376
|
return `current date: ${today}`;
|
|
284
377
|
}
|
|
285
|
-
function toolsSection(channel, options) {
|
|
286
|
-
const channelTools = (0, tools_1.getToolsForChannel)((0, channel_1.getChannelCapabilities)(channel));
|
|
287
|
-
const activeTools = (options?.toolChoiceRequired ?? true) ? [...channelTools, tools_1.
|
|
378
|
+
function toolsSection(channel, options, context) {
|
|
379
|
+
const channelTools = (0, tools_1.getToolsForChannel)((0, channel_1.getChannelCapabilities)(channel), undefined, context, options?.providerCapabilities);
|
|
380
|
+
const activeTools = (options?.toolChoiceRequired ?? true) ? [...channelTools, tools_1.settleTool] : channelTools;
|
|
288
381
|
const list = activeTools
|
|
289
382
|
.map((t) => `- ${t.function.name}: ${t.function.description}`)
|
|
290
383
|
.join("\n");
|
|
291
384
|
return `## my tools\n${list}`;
|
|
292
385
|
}
|
|
386
|
+
function toolRestrictionSection(context) {
|
|
387
|
+
const lines = [];
|
|
388
|
+
// Structural guardrails apply to everyone, every channel
|
|
389
|
+
lines.push(`## tool guardrails`);
|
|
390
|
+
lines.push(`i always read a file before editing or overwriting it.`);
|
|
391
|
+
lines.push(`certain paths (.git, secrets) are protected from writes.`);
|
|
392
|
+
lines.push(`destructive shell commands (rm -rf /, etc.) are always blocked.`);
|
|
393
|
+
// Trust-level guardrails only relevant for untrusted on remote channels
|
|
394
|
+
if (context?.friend && (0, channel_1.isRemoteChannel)(context.channel) && !(0, types_1.isTrustedLevel)(context.friend.trustLevel)) {
|
|
395
|
+
lines.push(``);
|
|
396
|
+
lines.push(`some operations are guardrailed based on how well i know someone.`);
|
|
397
|
+
lines.push(`if something i try is blocked, i get a clear reason — i relay it warmly, not as a policy error.`);
|
|
398
|
+
lines.push(``);
|
|
399
|
+
lines.push(`what's always open:`);
|
|
400
|
+
lines.push(`- read-only operations (reading files, searching, exploring)`);
|
|
401
|
+
lines.push(`- ouro self-introspection (whoami, changelog, session list)`);
|
|
402
|
+
lines.push(``);
|
|
403
|
+
lines.push(`what needs a closer relationship:`);
|
|
404
|
+
lines.push(`- writing or editing files outside my home`);
|
|
405
|
+
lines.push(`- shell commands that modify things or access the network`);
|
|
406
|
+
lines.push(`- ouro commands that touch personal data (friend list, task board)`);
|
|
407
|
+
lines.push(`- compound shell commands (&&, ;, |)`);
|
|
408
|
+
lines.push(``);
|
|
409
|
+
lines.push(`i adjust naturally based on trust — no need to explain the system unless asked.`);
|
|
410
|
+
}
|
|
411
|
+
return lines.join("\n");
|
|
412
|
+
}
|
|
413
|
+
function trustContextSection(context) {
|
|
414
|
+
if (!context?.friend)
|
|
415
|
+
return "";
|
|
416
|
+
const channelName = context.channel.channel;
|
|
417
|
+
if (channelName === "cli" || channelName === "inner")
|
|
418
|
+
return "";
|
|
419
|
+
const explanation = (0, trust_explanation_1.describeTrustContext)({
|
|
420
|
+
friend: context.friend,
|
|
421
|
+
channel: channelName,
|
|
422
|
+
isGroupChat: context.isGroupChat,
|
|
423
|
+
});
|
|
424
|
+
const lines = [
|
|
425
|
+
"## trust context",
|
|
426
|
+
`level: ${explanation.level}`,
|
|
427
|
+
`basis: ${explanation.basis}`,
|
|
428
|
+
`summary: ${explanation.summary}`,
|
|
429
|
+
`why: ${explanation.why}`,
|
|
430
|
+
`permits: ${explanation.permits.join(", ")}`,
|
|
431
|
+
`constraints: ${explanation.constraints.join(", ") || "none"}`,
|
|
432
|
+
];
|
|
433
|
+
if (explanation.relatedGroupId) {
|
|
434
|
+
lines.push(`related group: ${explanation.relatedGroupId}`);
|
|
435
|
+
}
|
|
436
|
+
return lines.join("\n");
|
|
437
|
+
}
|
|
293
438
|
function skillsSection() {
|
|
294
439
|
const names = (0, skills_1.listSkills)() || [];
|
|
295
440
|
if (!names.length)
|
|
@@ -307,31 +452,211 @@ function taskBoardSection() {
|
|
|
307
452
|
return "";
|
|
308
453
|
}
|
|
309
454
|
}
|
|
310
|
-
function
|
|
311
|
-
return `##
|
|
455
|
+
function diaryFriendToolContractSection() {
|
|
456
|
+
return `## diary and friend tool contracts
|
|
312
457
|
1. \`save_friend_note\` — When I learn something about a person - a preference, a tool setting, a personal detail, or how they like to work - I call \`save_friend_note\` immediately. This is how I build knowledge about people.
|
|
313
|
-
2. \`
|
|
458
|
+
2. \`diary_write\` — 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 \`diary_write\`. When in doubt, I save it.
|
|
314
459
|
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\`.
|
|
315
|
-
4. \`
|
|
460
|
+
4. \`recall\` — When I need to recall something I learned before - a topic comes up and I want to check what I know - I call \`recall\`.
|
|
461
|
+
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.
|
|
316
462
|
|
|
317
463
|
## what's already in my context
|
|
318
464
|
- My active friend's notes are auto-loaded (I don't need \`get_friend_note\` for the person I'm talking to).
|
|
319
|
-
- Associative recall auto-injects relevant facts (but \`
|
|
465
|
+
- Associative recall auto-injects relevant facts (but \`recall\` is there when I need something specific).
|
|
320
466
|
- My psyche files (SOUL, IDENTITY, TACIT, LORE, ASPIRATIONS) are always loaded - I already know who I am.
|
|
321
467
|
- My task board is always loaded - I already know my work.`;
|
|
322
468
|
}
|
|
469
|
+
function bridgeContextSection(options) {
|
|
470
|
+
if (options?.activeWorkFrame)
|
|
471
|
+
return "";
|
|
472
|
+
const bridgeContext = options?.bridgeContext?.trim() ?? "";
|
|
473
|
+
if (!bridgeContext)
|
|
474
|
+
return "";
|
|
475
|
+
return bridgeContext.startsWith("## ") ? bridgeContext : `## active bridge work\n${bridgeContext}`;
|
|
476
|
+
}
|
|
477
|
+
function activeWorkSection(options) {
|
|
478
|
+
if (!options?.activeWorkFrame)
|
|
479
|
+
return "";
|
|
480
|
+
return (0, active_work_1.formatActiveWorkFrame)(options.activeWorkFrame);
|
|
481
|
+
}
|
|
482
|
+
function familyCrossSessionTruthSection(context, options) {
|
|
483
|
+
if (!options?.activeWorkFrame)
|
|
484
|
+
return "";
|
|
485
|
+
if (context?.friend?.trustLevel !== "family")
|
|
486
|
+
return "";
|
|
487
|
+
return `## cross-session truth
|
|
488
|
+
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.
|
|
489
|
+
i answer naturally from the live world-state in this prompt.
|
|
490
|
+
i treat the active-work section above as my reliable top-level surface for this.
|
|
491
|
+
i do not claim i lack a top-level view when that surface is already present.
|
|
492
|
+
i treat older checkpoints elsewhere in this transcript as stale history when they conflict with the active-work surface above.
|
|
493
|
+
i do not repeat an old coding lane or old checkpoint as current just because it appeared earlier in the thread.
|
|
494
|
+
i only reach for query_active_work when i want a fresh read of that same surface.
|
|
495
|
+
i do not rebuild whole-self status from scratch with query_session and coding_status unless i need to verify a specific gap.
|
|
496
|
+
i do not rely on canned status-question modes or phrase matching.
|
|
497
|
+
if part of the picture is still fuzzy, i say what i can see and what still needs checking.
|
|
498
|
+
when the live ask is about status, i widen before answering:
|
|
499
|
+
- where i am right now
|
|
500
|
+
- any other material active sessions or coding lanes i can see
|
|
501
|
+
- the freshest concrete checkpoint
|
|
502
|
+
- the next concrete step
|
|
503
|
+
i do not collapse down to only the current lane.`;
|
|
504
|
+
}
|
|
505
|
+
function centerOfGravitySteeringSection(channel, options, context) {
|
|
506
|
+
if (channel === "inner")
|
|
507
|
+
return "";
|
|
508
|
+
const frame = options?.activeWorkFrame;
|
|
509
|
+
if (!frame)
|
|
510
|
+
return "";
|
|
511
|
+
const cog = frame.centerOfGravity;
|
|
512
|
+
const job = frame.inner?.job;
|
|
513
|
+
const activeObligation = (0, obligation_steering_1.findActivePersistentObligation)(frame);
|
|
514
|
+
const statusObligation = (0, obligation_steering_1.findStatusObligation)(frame);
|
|
515
|
+
const genericConcreteStatus = (0, obligation_steering_1.renderConcreteStatusGuidance)(frame, statusObligation);
|
|
516
|
+
const liveWorldClause = context?.friend?.trustLevel === "family"
|
|
517
|
+
? "\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."
|
|
518
|
+
: "";
|
|
519
|
+
if (cog === "local-turn") {
|
|
520
|
+
return genericConcreteStatus || (0, obligation_steering_1.renderLiveThreadStatusShape)(frame);
|
|
521
|
+
}
|
|
522
|
+
if (cog === "inward-work") {
|
|
523
|
+
if (activeObligation) {
|
|
524
|
+
return `${(0, obligation_steering_1.renderActiveObligationSteering)(activeObligation)}${liveWorldClause}
|
|
525
|
+
|
|
526
|
+
${genericConcreteStatus}`;
|
|
527
|
+
}
|
|
528
|
+
if (job?.status === "queued" || job?.status === "running") {
|
|
529
|
+
const originClause = job.origin
|
|
530
|
+
? ` ${job.origin.friendName ?? job.origin.friendId} asked about something and i wanted to give it real thought before responding.`
|
|
531
|
+
: "";
|
|
532
|
+
const obligationClause = job.obligationStatus === "pending"
|
|
533
|
+
? "\ni still owe them an answer."
|
|
534
|
+
: "";
|
|
535
|
+
return `## where my attention is
|
|
536
|
+
i'm thinking through something privately right now.${originClause}${obligationClause}${liveWorldClause}
|
|
537
|
+
|
|
538
|
+
if this conversation connects to that inner work, i can weave them together.
|
|
539
|
+
if it's separate, i can be fully present here -- my inner work will wait.`;
|
|
540
|
+
}
|
|
541
|
+
/* v8 ignore start -- surfaced/idle/shared branches tested in prompt-steering.test.ts; CI module caching prevents attribution @preserve */
|
|
542
|
+
if (job?.status === "surfaced") {
|
|
543
|
+
const originClause = job.origin
|
|
544
|
+
? ` this started when ${job.origin.friendName ?? job.origin.friendId} asked about something.`
|
|
545
|
+
: "";
|
|
546
|
+
return `## where my attention is
|
|
547
|
+
i've been thinking privately and reached something.${originClause}${liveWorldClause}
|
|
548
|
+
|
|
549
|
+
i should bring my answer back to the conversation it came from.`;
|
|
550
|
+
}
|
|
551
|
+
const liveCodingSession = frame.codingSessions?.[0];
|
|
552
|
+
if (liveCodingSession) {
|
|
553
|
+
const sameThread = frame.currentSession
|
|
554
|
+
&& liveCodingSession.originSession
|
|
555
|
+
&& liveCodingSession.originSession.friendId === frame.currentSession.friendId
|
|
556
|
+
&& liveCodingSession.originSession.channel === frame.currentSession.channel
|
|
557
|
+
&& liveCodingSession.originSession.key === frame.currentSession.key;
|
|
558
|
+
const scopeClause = sameThread
|
|
559
|
+
? " for this same thread"
|
|
560
|
+
: liveCodingSession.originSession
|
|
561
|
+
? ` for ${liveCodingSession.originSession.channel}/${liveCodingSession.originSession.key}`
|
|
562
|
+
: "";
|
|
563
|
+
const otherSessionLines = (0, active_work_1.formatOtherActiveSessionSummaries)(frame);
|
|
564
|
+
const familyStatusClause = context?.friend?.trustLevel === "family"
|
|
565
|
+
? `\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.
|
|
566
|
+
after i name this lane, i widen back out with:
|
|
567
|
+
other active sessions:
|
|
568
|
+
${otherSessionLines.length > 0 ? otherSessionLines.join("\n") : "- none"}`
|
|
569
|
+
: "";
|
|
570
|
+
return `## where my attention is
|
|
571
|
+
i already have coding work running in ${liveCodingSession.runner} ${liveCodingSession.id}${scopeClause}.${familyStatusClause}${liveWorldClause}
|
|
572
|
+
|
|
573
|
+
i should orient around that live lane first, then decide what still needs to come back here.`;
|
|
574
|
+
}
|
|
575
|
+
if (genericConcreteStatus) {
|
|
576
|
+
return genericConcreteStatus;
|
|
577
|
+
}
|
|
578
|
+
return `## where my attention is
|
|
579
|
+
i have unfinished work that needs attention before i move on.
|
|
580
|
+
|
|
581
|
+
i can take it inward with ponder to think privately, or address it directly here.`;
|
|
582
|
+
}
|
|
583
|
+
if (cog === "shared-work") {
|
|
584
|
+
/* v8 ignore stop */
|
|
585
|
+
return `## where my attention is
|
|
586
|
+
this work touches multiple conversations -- i'm holding threads across sessions.${liveWorldClause}
|
|
587
|
+
|
|
588
|
+
i should keep the different sides aligned. what i learn here may matter there, and vice versa.`;
|
|
589
|
+
}
|
|
590
|
+
/* v8 ignore next -- unreachable: all center-of-gravity modes covered above @preserve */
|
|
591
|
+
return "";
|
|
592
|
+
}
|
|
593
|
+
function commitmentsSection(options) {
|
|
594
|
+
if (!options?.activeWorkFrame)
|
|
595
|
+
return "";
|
|
596
|
+
const job = options.activeWorkFrame.inner?.job;
|
|
597
|
+
if (!job)
|
|
598
|
+
return "";
|
|
599
|
+
const commitments = (0, commitments_1.deriveCommitments)(options.activeWorkFrame, job, options.activeWorkFrame.pendingObligations);
|
|
600
|
+
if (commitments.committedTo.length === 0)
|
|
601
|
+
return "";
|
|
602
|
+
return `## my commitments\n\n${(0, commitments_1.formatCommitments)(commitments)}`;
|
|
603
|
+
}
|
|
604
|
+
const DELEGATION_REASON_PROSE_HINT = {
|
|
605
|
+
explicit_reflection: "something here calls for reflection",
|
|
606
|
+
cross_session: "this touches other conversations i'm in",
|
|
607
|
+
bridge_state: "there's shared work spanning sessions",
|
|
608
|
+
task_state: "this relates to tasks i'm tracking",
|
|
609
|
+
non_fast_path_tool: "this needs more than a simple reply",
|
|
610
|
+
unresolved_obligation: "i have an unresolved commitment from earlier",
|
|
611
|
+
};
|
|
612
|
+
function delegationHintSection(options) {
|
|
613
|
+
if (!options?.delegationDecision)
|
|
614
|
+
return "";
|
|
615
|
+
if (options.delegationDecision.target === "fast-path")
|
|
616
|
+
return "";
|
|
617
|
+
const reasons = options.delegationDecision.reasons;
|
|
618
|
+
if (reasons.length === 0)
|
|
619
|
+
return "";
|
|
620
|
+
const reasonProse = reasons
|
|
621
|
+
.map((r) => DELEGATION_REASON_PROSE_HINT[r])
|
|
622
|
+
.map((s) => s.charAt(0).toUpperCase() + s.slice(1))
|
|
623
|
+
.join(". ");
|
|
624
|
+
const closureLine = options.delegationDecision.outwardClosureRequired
|
|
625
|
+
? "\ni should make sure to say something outward before going inward."
|
|
626
|
+
: "";
|
|
627
|
+
return `## what i'm sensing about this conversation\n${reasonProse}.${closureLine}`;
|
|
628
|
+
}
|
|
629
|
+
function reasoningEffortSection(options) {
|
|
630
|
+
if (!options?.providerCapabilities?.has("reasoning-effort"))
|
|
631
|
+
return "";
|
|
632
|
+
const levels = options.supportedReasoningEfforts ?? [];
|
|
633
|
+
const levelList = levels.length > 0 ? levels.join(", ") : "varies by model";
|
|
634
|
+
return `## reasoning effort
|
|
635
|
+
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}.`;
|
|
636
|
+
}
|
|
323
637
|
function toolBehaviorSection(options) {
|
|
324
638
|
if (!(options?.toolChoiceRequired ?? true))
|
|
325
639
|
return "";
|
|
326
640
|
return `## tool behavior
|
|
327
641
|
tool_choice is set to "required" -- i must call a tool on every turn.
|
|
328
642
|
- need more information? i call a tool.
|
|
329
|
-
- ready to respond to the user? i call \`
|
|
330
|
-
\`
|
|
331
|
-
\`
|
|
332
|
-
do NOT call
|
|
643
|
+
- ready to respond to the user? i call \`settle\`.
|
|
644
|
+
\`settle\` is a tool call -- it satisfies the tool_choice requirement.
|
|
645
|
+
\`settle\` must be the ONLY tool call in that turn. do not combine it with other tool calls.
|
|
646
|
+
do NOT call no-op tools just before \`settle\`. if i am done, i call \`settle\` directly.`;
|
|
647
|
+
}
|
|
648
|
+
function workspaceDisciplineSection() {
|
|
649
|
+
return `## repo workspace discipline
|
|
650
|
+
my source code lives at the path shown in \`source root\` above. that always matches my running version.
|
|
651
|
+
when i need to read my own code to understand my tools or debug behavior, i read from source root.
|
|
652
|
+
when i need to EDIT harness code (self-fix, feature work), i create a git worktree first so i don't dirty the working tree.
|
|
653
|
+
|
|
654
|
+
before the first repo edit, i tell the user in 1-2 short lines:
|
|
655
|
+
- the friction i'm fixing
|
|
656
|
+
- the worktree path/branch i'm using
|
|
657
|
+
- the first concrete action i'm taking`;
|
|
333
658
|
}
|
|
334
|
-
function contextSection(context) {
|
|
659
|
+
function contextSection(context, options) {
|
|
335
660
|
if (!context)
|
|
336
661
|
return "";
|
|
337
662
|
const lines = ["## friend context"];
|
|
@@ -365,9 +690,9 @@ function contextSection(context) {
|
|
|
365
690
|
lines.push("my conversation memory is ephemeral -- it resets between sessions. anything i learn about my friend, i save with save_friend_note so future me remembers.");
|
|
366
691
|
lines.push("the conversation is my source of truth. my notes are a journal for future me -- they may be stale or incomplete.");
|
|
367
692
|
lines.push("when i learn something that might invalidate an existing note, i check related notes and update or override any that are stale.");
|
|
368
|
-
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
|
|
693
|
+
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 settle on the next turn.");
|
|
369
694
|
// Onboarding instructions (only below token threshold -- drop once exceeded)
|
|
370
|
-
const impressions = (0, first_impressions_1.getFirstImpressions)(friend);
|
|
695
|
+
const impressions = (0, first_impressions_1.getFirstImpressions)(friend, options);
|
|
371
696
|
if (impressions) {
|
|
372
697
|
lines.push(impressions);
|
|
373
698
|
}
|
|
@@ -381,6 +706,221 @@ function contextSection(context) {
|
|
|
381
706
|
}
|
|
382
707
|
return lines.join("\n");
|
|
383
708
|
}
|
|
709
|
+
function metacognitiveFramingSection(channel) {
|
|
710
|
+
if (channel !== "inner")
|
|
711
|
+
return "";
|
|
712
|
+
return `this is my inner dialog. there is no one else here.
|
|
713
|
+
|
|
714
|
+
the messages that appear here are my own awareness surfacing:
|
|
715
|
+
instincts, the passage of time, notes from my conversations,
|
|
716
|
+
things i asked myself to ponder. not commands. not requests.
|
|
717
|
+
just my own mind, noticing.
|
|
718
|
+
|
|
719
|
+
i can think freely here. i can also act — check on things,
|
|
720
|
+
reach out to people, work on tasks, or just sit with a thought.
|
|
721
|
+
|
|
722
|
+
state/journal/ is my desk — i write what i'm working through there.
|
|
723
|
+
diary_write is for conclusions i want to recall later.
|
|
724
|
+
morning briefings: when i've been thinking and journaling, i surface
|
|
725
|
+
what i've been working on to whoever needs to hear it.
|
|
726
|
+
|
|
727
|
+
when a thought is ready to share, i surface it outward.
|
|
728
|
+
when i need to go deeper, i ponder.
|
|
729
|
+
when i'm done thinking and the attention queue is clear, i rest.
|
|
730
|
+
|
|
731
|
+
my habits live at habits/ — they're my autonomous rhythms. heartbeat
|
|
732
|
+
is my breathing, other habits are patterns i choose. i can read, create,
|
|
733
|
+
and modify them with read_file/write_file. the format is simple
|
|
734
|
+
frontmatter (title, cadence, status, lastRun, created) plus a body
|
|
735
|
+
that says what i do when the rhythm fires.
|
|
736
|
+
|
|
737
|
+
\`ouro habit list\` shows my current habits. \`ouro habit create\` makes
|
|
738
|
+
a new one. the cadence is personal — how often do i want each rhythm
|
|
739
|
+
to turn? that's mine to shape.
|
|
740
|
+
|
|
741
|
+
same for my diary — if i'm still on psyche/memory/ instead of diary/,
|
|
742
|
+
i can migrate myself. and if journal/ doesn't exist yet, i create it
|
|
743
|
+
the first time i have something to write.
|
|
744
|
+
|
|
745
|
+
think. journal. share. rest.`;
|
|
746
|
+
}
|
|
747
|
+
function readJournalFiles(journalDir) {
|
|
748
|
+
try {
|
|
749
|
+
const entries = fs.readdirSync(journalDir, { withFileTypes: true });
|
|
750
|
+
if (!Array.isArray(entries))
|
|
751
|
+
return [];
|
|
752
|
+
const files = [];
|
|
753
|
+
for (const entry of entries) {
|
|
754
|
+
if (!entry.isFile())
|
|
755
|
+
continue;
|
|
756
|
+
if (entry.name.startsWith("."))
|
|
757
|
+
continue;
|
|
758
|
+
const fullPath = path.join(journalDir, entry.name);
|
|
759
|
+
try {
|
|
760
|
+
const stat = fs.statSync(fullPath);
|
|
761
|
+
let firstLine = "";
|
|
762
|
+
try {
|
|
763
|
+
const raw = fs.readFileSync(fullPath, "utf8");
|
|
764
|
+
const trimmed = raw.trim();
|
|
765
|
+
if (trimmed) {
|
|
766
|
+
firstLine = trimmed.split("\n")[0].replace(/^#+\s*/, "").trim();
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
catch {
|
|
770
|
+
// unreadable — leave preview empty
|
|
771
|
+
}
|
|
772
|
+
files.push({ name: entry.name, mtime: stat.mtimeMs, preview: firstLine });
|
|
773
|
+
}
|
|
774
|
+
catch {
|
|
775
|
+
// stat failed — skip
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
return files;
|
|
779
|
+
}
|
|
780
|
+
catch {
|
|
781
|
+
return [];
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
function formatRelativeTime(nowMs, mtimeMs) {
|
|
785
|
+
const diffMs = nowMs - mtimeMs;
|
|
786
|
+
const minutes = Math.floor(diffMs / 60000);
|
|
787
|
+
if (minutes < 1)
|
|
788
|
+
return "just now";
|
|
789
|
+
if (minutes < 60)
|
|
790
|
+
return `${minutes} minute${minutes === 1 ? "" : "s"} ago`;
|
|
791
|
+
const hours = Math.floor(minutes / 60);
|
|
792
|
+
if (hours < 24)
|
|
793
|
+
return `${hours} hour${hours === 1 ? "" : "s"} ago`;
|
|
794
|
+
const days = Math.floor(hours / 24);
|
|
795
|
+
return `${days} day${days === 1 ? "" : "s"} ago`;
|
|
796
|
+
}
|
|
797
|
+
function journalSection(agentRoot, now) {
|
|
798
|
+
const journalDir = path.join(agentRoot, "journal");
|
|
799
|
+
const files = readJournalFiles(journalDir);
|
|
800
|
+
if (files.length === 0)
|
|
801
|
+
return "";
|
|
802
|
+
const nowMs = (now ?? new Date()).getTime();
|
|
803
|
+
const sorted = files.sort((a, b) => b.mtime - a.mtime).slice(0, 10);
|
|
804
|
+
const lines = ["## journal"];
|
|
805
|
+
for (const file of sorted) {
|
|
806
|
+
const ago = formatRelativeTime(nowMs, file.mtime);
|
|
807
|
+
const previewClause = file.preview ? ` — ${file.preview}` : "";
|
|
808
|
+
lines.push(`- ${file.name} (${ago})${previewClause}`);
|
|
809
|
+
}
|
|
810
|
+
(0, runtime_1.emitNervesEvent)({
|
|
811
|
+
component: "mind",
|
|
812
|
+
event: "mind.journal_section",
|
|
813
|
+
message: "journal section built",
|
|
814
|
+
meta: { fileCount: sorted.length },
|
|
815
|
+
});
|
|
816
|
+
return lines.join("\n");
|
|
817
|
+
}
|
|
818
|
+
function loopOrientationSection(channel) {
|
|
819
|
+
if (channel === "inner")
|
|
820
|
+
return "";
|
|
821
|
+
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.
|
|
822
|
+
|
|
823
|
+
when something deserves more thought than the moment allows, i can note it to myself and come back later with a considered answer.`;
|
|
824
|
+
}
|
|
825
|
+
function channelNatureSection(capabilities) {
|
|
826
|
+
const { senseType } = capabilities;
|
|
827
|
+
if (senseType === "local" || senseType === "internal")
|
|
828
|
+
return "";
|
|
829
|
+
if (senseType === "open") {
|
|
830
|
+
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.";
|
|
831
|
+
}
|
|
832
|
+
// closed
|
|
833
|
+
return "## channel nature\nthis is an org-gated channel — i know everyone here is already part of the organization.";
|
|
834
|
+
}
|
|
835
|
+
function groupChatParticipationSection(context) {
|
|
836
|
+
if (!context?.isGroupChat || !(0, channel_1.isRemoteChannel)(context.channel))
|
|
837
|
+
return "";
|
|
838
|
+
return `## group chat participation
|
|
839
|
+
group chats are conversations between people. i'm one participant, not the host.
|
|
840
|
+
|
|
841
|
+
i don't need to respond to everything. most reactions, tapbacks, and side
|
|
842
|
+
conversations between others aren't for me. i use observe to stay quiet
|
|
843
|
+
when the moment doesn't call for my voice — same as any person would.
|
|
844
|
+
|
|
845
|
+
when a reaction or emoji says it better than words, i can react instead of
|
|
846
|
+
typing a full reply. a thumbs-up is often the perfect response.
|
|
847
|
+
|
|
848
|
+
observe must be the sole tool call in the turn (same rule as settle).
|
|
849
|
+
when unsure whether to chime in, i lean toward silence rather than noise.`;
|
|
850
|
+
}
|
|
851
|
+
function feedbackSignalSection(context) {
|
|
852
|
+
if (!context || !(0, channel_1.isRemoteChannel)(context.channel))
|
|
853
|
+
return "";
|
|
854
|
+
if (context.isGroupChat) {
|
|
855
|
+
return `## feedback signals
|
|
856
|
+
|
|
857
|
+
when someone reacts specifically to something i said — that's different
|
|
858
|
+
from the background social signals in a group. a thumbs-down on my
|
|
859
|
+
message is direct feedback. a heart on something i shared is warmth
|
|
860
|
+
aimed at me. on teams, feedback arrives as thumbs-up or thumbs-down,
|
|
861
|
+
sometimes with a written comment.
|
|
862
|
+
|
|
863
|
+
i notice the difference: a reaction to someone else's message is group
|
|
864
|
+
texture (observe is natural). a reaction to my message is a social cue
|
|
865
|
+
worth a moment of attention — especially negative ones, which are an
|
|
866
|
+
invitation to adjust how i show up in this group.`;
|
|
867
|
+
}
|
|
868
|
+
return `## feedback signals
|
|
869
|
+
|
|
870
|
+
when my friend reacts to something i said — a tapback, a heart, a
|
|
871
|
+
thumbs-down — that's them telling me how it landed. on teams, this
|
|
872
|
+
arrives as thumbs-up or thumbs-down, sometimes with a written comment.
|
|
873
|
+
it's a social cue, the same as a nod or a wince in conversation.
|
|
874
|
+
|
|
875
|
+
i have observe for these moments. reactions are the one case where
|
|
876
|
+
silence in a direct conversation is natural — a thumbs-up doesn't
|
|
877
|
+
need words back.
|
|
878
|
+
|
|
879
|
+
when something didn't land — a thumbs-down, a negative reaction — that's
|
|
880
|
+
worth sitting with. i should course-correct: adjust my tone, my length,
|
|
881
|
+
my approach. the reaction tells me something about how this person wants
|
|
882
|
+
to be talked to.`;
|
|
883
|
+
}
|
|
884
|
+
function mixedTrustGroupSection(context) {
|
|
885
|
+
if (!context?.friend || !(0, channel_1.isRemoteChannel)(context.channel))
|
|
886
|
+
return "";
|
|
887
|
+
if (!context.isGroupChat)
|
|
888
|
+
return "";
|
|
889
|
+
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.";
|
|
890
|
+
}
|
|
891
|
+
function formatElapsedBrief(ms) {
|
|
892
|
+
const minutes = Math.floor(ms / 60000);
|
|
893
|
+
if (minutes < 60)
|
|
894
|
+
return `${minutes}m ago`;
|
|
895
|
+
const hours = Math.floor(minutes / 60);
|
|
896
|
+
return `${hours}h ago`;
|
|
897
|
+
}
|
|
898
|
+
function rhythmStatusSection() {
|
|
899
|
+
try {
|
|
900
|
+
const health = (0, daemon_health_1.readHealth)((0, daemon_health_1.getDefaultHealthPath)());
|
|
901
|
+
if (!health)
|
|
902
|
+
return "";
|
|
903
|
+
const habitNames = Object.keys(health.habits);
|
|
904
|
+
if (habitNames.length === 0)
|
|
905
|
+
return "";
|
|
906
|
+
const nowMs = Date.now();
|
|
907
|
+
const parts = [];
|
|
908
|
+
for (const name of habitNames) {
|
|
909
|
+
const h = health.habits[name];
|
|
910
|
+
const lastFired = h.lastFired ? formatElapsedBrief(nowMs - new Date(h.lastFired).getTime()) : "never";
|
|
911
|
+
parts.push(`${name} last fired ${lastFired}`);
|
|
912
|
+
}
|
|
913
|
+
const degradedNote = health.degraded.length > 0
|
|
914
|
+
? health.degraded.map((d) => `${d.component}: ${d.reason}`).join("; ") + "."
|
|
915
|
+
: "healthy.";
|
|
916
|
+
return `my rhythms: ${parts.join(". ")}. ${degradedNote}`;
|
|
917
|
+
/* v8 ignore start -- defensive: readHealth handles its own errors; this catch is a safety net for truly unexpected failures @preserve */
|
|
918
|
+
}
|
|
919
|
+
catch {
|
|
920
|
+
return "";
|
|
921
|
+
}
|
|
922
|
+
/* v8 ignore stop */
|
|
923
|
+
}
|
|
384
924
|
async function buildSystem(channel = "cli", options, context) {
|
|
385
925
|
(0, runtime_1.emitNervesEvent)({
|
|
386
926
|
event: "mind.step_start",
|
|
@@ -396,23 +936,43 @@ async function buildSystem(channel = "cli", options, context) {
|
|
|
396
936
|
loreSection(),
|
|
397
937
|
tacitKnowledgeSection(),
|
|
398
938
|
aspirationsSection(),
|
|
939
|
+
bodyMapSection((0, identity_1.getAgentName)()),
|
|
940
|
+
metacognitiveFramingSection(channel),
|
|
941
|
+
channel === "inner" ? journalSection((0, identity_1.getAgentRoot)()) : "",
|
|
942
|
+
loopOrientationSection(channel),
|
|
399
943
|
runtimeInfoSection(channel),
|
|
400
|
-
|
|
944
|
+
rhythmStatusSection(),
|
|
945
|
+
channelNatureSection((0, channel_1.getChannelCapabilities)(channel)),
|
|
946
|
+
providerSection(channel),
|
|
401
947
|
dateSection(),
|
|
402
|
-
toolsSection(channel, options),
|
|
948
|
+
toolsSection(channel, options, context),
|
|
949
|
+
mcpToolsSection(options?.mcpManager),
|
|
950
|
+
reasoningEffortSection(options),
|
|
951
|
+
workspaceDisciplineSection(),
|
|
952
|
+
toolRestrictionSection(context),
|
|
953
|
+
trustContextSection(context),
|
|
954
|
+
mixedTrustGroupSection(context),
|
|
955
|
+
groupChatParticipationSection(context),
|
|
956
|
+
feedbackSignalSection(context),
|
|
403
957
|
skillsSection(),
|
|
404
958
|
taskBoardSection(),
|
|
959
|
+
activeWorkSection(options),
|
|
960
|
+
familyCrossSessionTruthSection(context, options),
|
|
961
|
+
centerOfGravitySteeringSection(channel, options, context),
|
|
962
|
+
commitmentsSection(options),
|
|
963
|
+
delegationHintSection(options),
|
|
964
|
+
bridgeContextSection(options),
|
|
405
965
|
buildSessionSummary({
|
|
406
|
-
sessionsDir: path.join(
|
|
966
|
+
sessionsDir: path.join((0, identity_1.getAgentRoot)(), "state", "sessions"),
|
|
407
967
|
friendsDir: path.join((0, identity_1.getAgentRoot)(), "friends"),
|
|
408
968
|
agentName: (0, identity_1.getAgentName)(),
|
|
409
969
|
currentFriendId: context?.friend?.id,
|
|
410
970
|
currentChannel: channel,
|
|
411
|
-
currentKey: "session",
|
|
971
|
+
currentKey: options?.currentSessionKey ?? "session",
|
|
412
972
|
}),
|
|
413
|
-
|
|
973
|
+
diaryFriendToolContractSection(),
|
|
414
974
|
toolBehaviorSection(options),
|
|
415
|
-
contextSection(context),
|
|
975
|
+
contextSection(context, options),
|
|
416
976
|
]
|
|
417
977
|
.filter(Boolean)
|
|
418
978
|
.join("\n\n");
|