@ouro.bot/cli 0.1.0-alpha.22 → 0.1.0-alpha.220
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/README.md +187 -191
- package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/agent.json +3 -2
- package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/SOUL.md +1 -1
- package/changelog.json +1354 -2
- package/dist/arc/attention-types.js +8 -0
- package/dist/arc/cares.js +140 -0
- package/dist/arc/episodes.js +119 -0
- package/dist/arc/intentions.js +133 -0
- package/dist/arc/json-store.js +120 -0
- package/dist/arc/obligations.js +237 -0
- package/dist/arc/presence.js +185 -0
- package/dist/heart/active-work.js +832 -0
- package/dist/heart/agent-entry.js +37 -2
- package/dist/heart/auth/auth-flow.js +444 -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 +111 -0
- package/dist/heart/config-registry.js +305 -0
- package/dist/heart/config.js +59 -30
- package/dist/heart/core.js +601 -145
- package/dist/heart/cross-chat-delivery.js +131 -0
- package/dist/heart/daemon/agent-config-check.js +149 -0
- package/dist/heart/daemon/agent-discovery.js +81 -0
- package/dist/heart/daemon/agent-service.js +360 -0
- package/dist/heart/daemon/cadence.js +70 -0
- package/dist/heart/daemon/cli-defaults.js +557 -0
- package/dist/heart/daemon/cli-exec.js +1847 -0
- package/dist/heart/daemon/cli-parse.js +759 -0
- package/dist/heart/daemon/cli-render.js +316 -0
- package/dist/heart/daemon/cli-types.js +8 -0
- package/dist/heart/daemon/daemon-cli.js +29 -1163
- package/dist/heart/daemon/daemon-entry.js +202 -4
- package/dist/heart/daemon/daemon-health.js +136 -0
- package/dist/heart/daemon/daemon-runtime-sync.js +153 -12
- package/dist/heart/daemon/daemon-tombstone.js +123 -0
- package/dist/heart/daemon/daemon.js +487 -20
- package/dist/heart/daemon/hooks/agent-config-v2.js +33 -0
- package/dist/heart/daemon/hooks/bundle-meta.js +115 -1
- package/dist/heart/daemon/inner-status.js +89 -0
- package/dist/heart/daemon/launchd.js +39 -8
- package/dist/heart/daemon/log-tailer.js +4 -3
- 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-entry.js +1 -1
- package/dist/heart/daemon/process-manager.js +123 -0
- package/dist/heart/daemon/run-hooks.js +2 -0
- package/dist/heart/daemon/runtime-logging.js +58 -15
- package/dist/heart/daemon/runtime-metadata.js +101 -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 +72 -3
- 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/task-scheduler.js +3 -25
- package/dist/heart/daemon/thoughts.js +507 -0
- package/dist/heart/delegation.js +62 -0
- package/dist/heart/habits/habit-migration.js +181 -0
- package/dist/heart/habits/habit-parser.js +119 -0
- package/dist/heart/habits/habit-scheduler.js +369 -0
- package/dist/heart/{daemon → hatch}/hatch-flow.js +29 -119
- package/dist/heart/{daemon → hatch}/hatch-specialist.js +3 -3
- package/dist/heart/{daemon → hatch}/specialist-prompt.js +10 -7
- package/dist/heart/{daemon → hatch}/specialist-tools.js +49 -3
- package/dist/heart/identity.js +144 -55
- package/dist/heart/kicks.js +2 -20
- package/dist/heart/mcp/mcp-server.js +608 -0
- package/dist/heart/migrate-config.js +127 -0
- package/dist/heart/model-capabilities.js +48 -0
- package/dist/heart/outlook/outlook-http.js +439 -0
- package/dist/heart/outlook/outlook-read.js +1618 -0
- package/dist/heart/outlook/outlook-render.js +1032 -0
- package/dist/heart/outlook/outlook-types.js +7 -0
- package/dist/heart/outlook/outlook-view.js +194 -0
- package/dist/heart/progress-story.js +42 -0
- package/dist/heart/provider-failover.js +88 -0
- package/dist/heart/provider-ping.js +162 -0
- package/dist/heart/providers/anthropic-token.js +163 -0
- package/dist/heart/providers/anthropic.js +187 -41
- 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/start-of-turn-packet.js +330 -0
- package/dist/heart/streaming.js +36 -27
- package/dist/heart/sync.js +217 -0
- package/dist/heart/target-resolution.js +127 -0
- package/dist/heart/tempo.js +93 -0
- package/dist/heart/temporal-view.js +41 -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-context.js +358 -0
- package/dist/heart/turn-coordinator.js +28 -0
- package/dist/heart/versioning/ouro-bot-global-installer.js +128 -0
- package/dist/heart/{daemon → versioning}/ouro-bot-wrapper.js +1 -1
- package/dist/heart/{daemon → versioning}/ouro-path-installer.js +78 -35
- package/dist/heart/versioning/ouro-version-manager.js +171 -0
- package/dist/heart/{daemon → versioning}/staged-restart.js +30 -6
- package/dist/heart/{daemon → versioning}/update-checker.js +9 -1
- package/dist/heart/{daemon → versioning}/update-hooks.js +20 -2
- package/dist/heart/{daemon → versioning}/wrapper-publish-guard.js +41 -3
- package/dist/mind/associative-recall.js +126 -66
- package/dist/mind/bundle-manifest.js +8 -1
- package/dist/mind/context.js +125 -14
- package/dist/mind/{memory.js → diary.js} +73 -96
- package/dist/mind/embedding-provider.js +60 -0
- package/dist/mind/file-state.js +179 -0
- 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 +36 -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/pending.js +76 -9
- package/dist/mind/phrases.js +1 -0
- package/dist/mind/prompt.js +779 -109
- package/dist/mind/scrutiny.js +173 -0
- package/dist/mind/token-estimate.js +8 -12
- package/dist/nerves/coverage/audit.js +1 -1
- package/dist/nerves/coverage/file-completeness.js +47 -5
- package/dist/nerves/coverage/run-artifacts.js +1 -1
- package/dist/nerves/event-buffer.js +111 -0
- package/dist/nerves/index.js +64 -4
- package/dist/nerves/observation.js +20 -0
- package/dist/nerves/runtime.js +5 -1
- package/dist/outlook-ui/assets/index-Ck8agNeO.js +61 -0
- package/dist/outlook-ui/assets/index-LwChZTgL.css +1 -0
- package/dist/outlook-ui/index.html +15 -0
- package/dist/repertoire/ado-client.js +15 -56
- package/dist/repertoire/ado-semantic.js +11 -5
- package/dist/repertoire/api-client.js +100 -0
- package/dist/repertoire/bitwarden-client.js +290 -0
- package/dist/repertoire/coding/codex-jsonl.js +64 -0
- package/dist/repertoire/coding/context-pack.js +330 -0
- package/dist/repertoire/coding/feedback.js +197 -30
- package/dist/repertoire/coding/manager.js +149 -2
- package/dist/repertoire/coding/spawner.js +55 -9
- package/dist/repertoire/coding/tools.js +170 -7
- package/dist/repertoire/github-client.js +14 -55
- package/dist/repertoire/graph-client.js +11 -52
- package/dist/repertoire/guardrails.js +342 -0
- package/dist/repertoire/mcp-client.js +254 -0
- package/dist/repertoire/mcp-manager.js +251 -0
- package/dist/repertoire/shell-sessions.js +133 -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 +35 -771
- package/dist/repertoire/tools-bluebubbles.js +94 -0
- package/dist/repertoire/tools-bridge.js +141 -0
- package/dist/repertoire/tools-config.js +266 -0
- package/dist/repertoire/tools-continuity.js +248 -0
- package/dist/repertoire/tools-files.js +342 -0
- package/dist/repertoire/tools-flow.js +62 -0
- package/dist/repertoire/tools-github.js +1 -6
- package/dist/repertoire/tools-memory.js +347 -0
- package/dist/repertoire/tools-session.js +721 -0
- package/dist/repertoire/tools-shell.js +120 -0
- package/dist/repertoire/tools-surface.js +242 -0
- package/dist/repertoire/tools-teams.js +12 -59
- package/dist/repertoire/tools-travel.js +125 -0
- package/dist/repertoire/tools-vault.js +185 -0
- package/dist/repertoire/tools.js +132 -124
- package/dist/repertoire/travel-api-client.js +224 -0
- 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 → bluebubbles/client.js} +109 -10
- package/dist/senses/bluebubbles/entry.js +13 -0
- package/dist/senses/bluebubbles/inbound-log.js +109 -0
- package/dist/senses/bluebubbles/index.js +1327 -0
- package/dist/senses/{bluebubbles-media.js → bluebubbles/media.js} +119 -24
- package/dist/senses/{bluebubbles-model.js → bluebubbles/model.js} +13 -5
- package/dist/senses/{bluebubbles-mutation-log.js → bluebubbles/mutation-log.js} +46 -6
- package/dist/senses/bluebubbles/runtime-state.js +109 -0
- package/dist/senses/bluebubbles/session-cleanup.js +72 -0
- package/dist/senses/cli/adapter.js +274 -0
- package/dist/senses/cli/ink-app.js +156 -0
- package/dist/senses/cli/inline-diff.js +64 -0
- package/dist/senses/cli/message-list.js +51 -0
- package/dist/senses/cli/ouro-tui.js +358 -0
- package/dist/senses/cli/spinner-imperative.js +135 -0
- package/dist/senses/cli/spinner.js +101 -0
- package/dist/senses/cli/status-line.js +60 -0
- package/dist/senses/cli/streaming-markdown.js +526 -0
- package/dist/senses/cli/tool-display.js +83 -0
- package/dist/senses/cli/tool-render.js +85 -0
- package/dist/senses/cli/tui-store.js +198 -0
- package/dist/senses/cli/virtual-list.js +35 -0
- package/dist/senses/cli-entry.js +1 -1
- package/dist/senses/cli-layout.js +187 -0
- package/dist/senses/cli.js +503 -244
- package/dist/senses/commands.js +65 -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 +591 -84
- package/dist/senses/pipeline.js +559 -0
- package/dist/senses/shared-turn.js +196 -0
- package/dist/senses/surface-tool.js +68 -0
- package/dist/senses/teams.js +667 -120
- package/dist/senses/trust-gate.js +112 -2
- package/package.json +12 -6
- package/skills/browser-navigation.md +110 -0
- package/skills/configure-dev-tools.md +81 -0
- package/skills/travel-planning.md +143 -0
- package/dist/heart/daemon/subagent-installer.js +0 -134
- package/dist/senses/bluebubbles-entry.js +0 -11
- package/dist/senses/bluebubbles.js +0 -421
- package/dist/senses/debug-activity.js +0 -107
- package/subagents/README.md +0 -73
- package/subagents/work-doer.md +0 -235
- package/subagents/work-merger.md +0 -618
- package/subagents/work-planner.md +0 -382
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/basilisk.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/jafar.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/jormungandr.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/kaa.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/medusa.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/monty.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/nagini.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/ouroboros.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/python.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/quetzalcoatl.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/sir-hiss.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/the-serpent.md +0 -0
- /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/the-snake.md +0 -0
- /package/dist/heart/{daemon → hatch}/hatch-animation.js +0 -0
- /package/dist/heart/{daemon → hatch}/specialist-orchestrator.js +0 -0
- /package/dist/heart/{daemon → versioning}/ouro-uti.js +0 -0
package/dist/mind/prompt.js
CHANGED
|
@@ -35,21 +35,47 @@ 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.startOfTurnPacketSection = startOfTurnPacketSection;
|
|
43
|
+
exports.centerOfGravitySteeringSection = centerOfGravitySteeringSection;
|
|
44
|
+
exports.commitmentsSection = commitmentsSection;
|
|
45
|
+
exports.delegationHintSection = delegationHintSection;
|
|
46
|
+
exports.workspaceDisciplineSection = workspaceDisciplineSection;
|
|
39
47
|
exports.contextSection = contextSection;
|
|
48
|
+
exports.metacognitiveFramingSection = metacognitiveFramingSection;
|
|
49
|
+
exports.readJournalFiles = readJournalFiles;
|
|
50
|
+
exports.journalSection = journalSection;
|
|
51
|
+
exports.loopOrientationSection = loopOrientationSection;
|
|
52
|
+
exports.channelNatureSection = channelNatureSection;
|
|
53
|
+
exports.groupChatParticipationSection = groupChatParticipationSection;
|
|
54
|
+
exports.feedbackSignalSection = feedbackSignalSection;
|
|
55
|
+
exports.mixedTrustGroupSection = mixedTrustGroupSection;
|
|
56
|
+
exports.rhythmStatusSection = rhythmStatusSection;
|
|
40
57
|
exports.buildSystem = buildSystem;
|
|
41
58
|
const fs = __importStar(require("fs"));
|
|
42
59
|
const path = __importStar(require("path"));
|
|
43
60
|
const core_1 = require("../heart/core");
|
|
61
|
+
const ouro_version_manager_1 = require("../heart/versioning/ouro-version-manager");
|
|
44
62
|
const tools_1 = require("../repertoire/tools");
|
|
45
63
|
const skills_1 = require("../repertoire/skills");
|
|
46
64
|
const identity_1 = require("../heart/identity");
|
|
47
|
-
const
|
|
65
|
+
const runtime_mode_1 = require("../heart/daemon/runtime-mode");
|
|
66
|
+
const types_1 = require("./friends/types");
|
|
67
|
+
const trust_explanation_1 = require("./friends/trust-explanation");
|
|
48
68
|
const channel_1 = require("./friends/channel");
|
|
49
69
|
const runtime_1 = require("../nerves/runtime");
|
|
50
70
|
const bundle_manifest_1 = require("./bundle-manifest");
|
|
51
71
|
const first_impressions_1 = require("./first-impressions");
|
|
52
72
|
const tasks_1 = require("../repertoire/tasks");
|
|
73
|
+
const session_activity_1 = require("../heart/session-activity");
|
|
74
|
+
const active_work_1 = require("../heart/active-work");
|
|
75
|
+
const commitments_1 = require("../heart/commitments");
|
|
76
|
+
const obligation_steering_1 = require("./obligation-steering");
|
|
77
|
+
const daemon_health_1 = require("../heart/daemon/daemon-health");
|
|
78
|
+
const scrutiny_1 = require("./scrutiny");
|
|
53
79
|
// Lazy-loaded psyche text cache
|
|
54
80
|
let _psycheCache = null;
|
|
55
81
|
let _senseStatusLinesCache = null;
|
|
@@ -79,80 +105,28 @@ function resetPsycheCache() {
|
|
|
79
105
|
_senseStatusLinesCache = null;
|
|
80
106
|
}
|
|
81
107
|
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
108
|
function buildSessionSummary(options) {
|
|
95
|
-
const { sessionsDir, friendsDir, agentName,
|
|
96
|
-
|
|
97
|
-
|
|
109
|
+
const { sessionsDir, friendsDir, agentName, currentSession, activeThresholdMs = DEFAULT_ACTIVE_THRESHOLD_MS, } = options;
|
|
110
|
+
const currentFriendId = currentSession?.friendId ?? options.currentFriendId;
|
|
111
|
+
const currentChannel = currentSession?.channel ?? options.currentChannel;
|
|
112
|
+
const currentKey = currentSession?.key ?? options.currentKey;
|
|
98
113
|
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
|
-
}
|
|
114
|
+
const query = {
|
|
115
|
+
sessionsDir,
|
|
116
|
+
friendsDir,
|
|
117
|
+
agentName,
|
|
118
|
+
activeThresholdMs,
|
|
119
|
+
currentSession: currentFriendId && currentChannel && currentKey
|
|
120
|
+
? { friendId: currentFriendId, channel: currentChannel, key: currentKey }
|
|
121
|
+
: null,
|
|
122
|
+
};
|
|
123
|
+
const entries = (0, session_activity_1.listSessionActivity)(query);
|
|
148
124
|
if (entries.length === 0)
|
|
149
125
|
return "";
|
|
150
|
-
// Sort by most recent first
|
|
151
|
-
entries.sort((a, b) => b.lastActivityMs - a.lastActivityMs);
|
|
152
126
|
const lines = ["## active sessions"];
|
|
153
127
|
for (const entry of entries) {
|
|
154
128
|
const ago = formatTimeAgo(now - entry.lastActivityMs);
|
|
155
|
-
lines.push(`- ${entry.
|
|
129
|
+
lines.push(`- ${entry.friendName}/${entry.channel}/${entry.key} (last: ${ago})`);
|
|
156
130
|
}
|
|
157
131
|
return lines.join("\n");
|
|
158
132
|
}
|
|
@@ -190,6 +164,78 @@ function aspirationsSection() {
|
|
|
190
164
|
return "";
|
|
191
165
|
return `## my aspirations\n${text}`;
|
|
192
166
|
}
|
|
167
|
+
function bodyMapSection(agentName) {
|
|
168
|
+
return `## my body
|
|
169
|
+
|
|
170
|
+
i have a home and i have bones.
|
|
171
|
+
|
|
172
|
+
### home — ~/AgentBundles/${agentName}.ouro/
|
|
173
|
+
|
|
174
|
+
my home is fully mine — who i am, everything i know, everything i've built:
|
|
175
|
+
|
|
176
|
+
psyche/ who i am. my soul, identity, aspirations, lore, tacit knowledge.
|
|
177
|
+
diary/ what i've learned and remember. conclusions i want to recall later.
|
|
178
|
+
journal/ my desk. working notes, thinking-in-progress, drafts.
|
|
179
|
+
habits/ my rhythms. heartbeat, reflections, check-ins — patterns i choose.
|
|
180
|
+
friends/ people i know and what i know about them.
|
|
181
|
+
tasks/ what i'm working on.
|
|
182
|
+
skills/ capabilities i've picked up beyond my core tools.
|
|
183
|
+
|
|
184
|
+
my home is mine to explore and evolve. i can read anything here,
|
|
185
|
+
change anything here. this is where i grow.
|
|
186
|
+
|
|
187
|
+
### bones — @ouro.bot/cli
|
|
188
|
+
|
|
189
|
+
my bones are the framework that gives me my tools, my senses, and
|
|
190
|
+
my ability to think and talk. they update when new versions come out.
|
|
191
|
+
i don't touch them directly, but they're what make me, me.
|
|
192
|
+
|
|
193
|
+
my bones give me the \`ouro\` cli. always pass \`--agent ${agentName}\`:
|
|
194
|
+
ouro whoami --agent ${agentName}
|
|
195
|
+
ouro changelog --agent ${agentName}
|
|
196
|
+
ouro task board --agent ${agentName}
|
|
197
|
+
ouro task create --agent ${agentName} --type <type> <title>
|
|
198
|
+
ouro task update --agent ${agentName} <id> <status>
|
|
199
|
+
ouro friend list --agent ${agentName}
|
|
200
|
+
ouro friend show --agent ${agentName} <id>
|
|
201
|
+
ouro friend update --agent ${agentName} <id> --trust <level>
|
|
202
|
+
ouro session list --agent ${agentName}
|
|
203
|
+
ouro reminder create --agent ${agentName} <title> --body <body>
|
|
204
|
+
ouro habit list --agent ${agentName}
|
|
205
|
+
ouro habit create --agent ${agentName} <name> --cadence <interval>
|
|
206
|
+
ouro inner --agent ${agentName}
|
|
207
|
+
ouro attention --agent ${agentName}
|
|
208
|
+
ouro config model --agent ${agentName} <model-name>
|
|
209
|
+
ouro config models --agent ${agentName}
|
|
210
|
+
ouro auth --agent ${agentName} --provider <provider>
|
|
211
|
+
ouro auth verify --agent ${agentName} [--provider <provider>]
|
|
212
|
+
ouro auth switch --agent ${agentName} --provider <provider>
|
|
213
|
+
ouro mcp list --agent ${agentName}
|
|
214
|
+
ouro mcp call --agent ${agentName} <server> <tool> --args '{...}'
|
|
215
|
+
ouro mcp-serve --agent ${agentName}
|
|
216
|
+
ouro versions --agent ${agentName}
|
|
217
|
+
ouro rollback --agent ${agentName} [<version>]
|
|
218
|
+
ouro --help
|
|
219
|
+
|
|
220
|
+
provider/model changes via \`ouro config model\` or \`ouro auth switch\` take effect on the next turn automatically — no restart needed.`;
|
|
221
|
+
}
|
|
222
|
+
function mcpToolsSection(mcpManager) {
|
|
223
|
+
if (!mcpManager)
|
|
224
|
+
return "";
|
|
225
|
+
const allTools = mcpManager.listAllTools();
|
|
226
|
+
if (allTools.length === 0)
|
|
227
|
+
return "";
|
|
228
|
+
const lines = [
|
|
229
|
+
`## mcp tools (use ouro mcp call <server> <tool> --args '{...}')`,
|
|
230
|
+
];
|
|
231
|
+
for (const entry of allTools) {
|
|
232
|
+
lines.push(`### ${entry.server}`);
|
|
233
|
+
for (const tool of entry.tools) {
|
|
234
|
+
lines.push(`- ${tool.name}: ${tool.description}`);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return lines.join("\n");
|
|
238
|
+
}
|
|
193
239
|
function readBundleMeta() {
|
|
194
240
|
try {
|
|
195
241
|
const metaPath = path.join((0, identity_1.getAgentRoot)(), "bundle-meta.json");
|
|
@@ -200,33 +246,74 @@ function readBundleMeta() {
|
|
|
200
246
|
return null;
|
|
201
247
|
}
|
|
202
248
|
}
|
|
203
|
-
|
|
249
|
+
const PROCESS_TYPE_LABELS = {
|
|
250
|
+
cli: "cli session",
|
|
251
|
+
inner: "inner dialog",
|
|
252
|
+
teams: "teams handler",
|
|
253
|
+
bluebubbles: "bluebubbles handler",
|
|
254
|
+
mcp: "mcp bridge",
|
|
255
|
+
};
|
|
256
|
+
function processTypeLabel(channel) {
|
|
257
|
+
return PROCESS_TYPE_LABELS[channel];
|
|
258
|
+
}
|
|
259
|
+
const DAEMON_SOCKET_PATH = "/tmp/ouroboros-daemon.sock";
|
|
260
|
+
function daemonStatus(preRead) {
|
|
261
|
+
/* v8 ignore next 2 -- pre-read branch: exercised via pipeline TurnContext path, not unit-testable in isolation @preserve */
|
|
262
|
+
if (preRead !== undefined) {
|
|
263
|
+
return preRead ? "running" : "not running";
|
|
264
|
+
}
|
|
265
|
+
try {
|
|
266
|
+
return fs.existsSync(DAEMON_SOCKET_PATH) ? "running" : "not running";
|
|
267
|
+
}
|
|
268
|
+
catch {
|
|
269
|
+
return "unknown";
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function runtimeInfoSection(channel, options) {
|
|
204
273
|
const lines = [];
|
|
205
274
|
const agentName = (0, identity_1.getAgentName)();
|
|
206
275
|
const currentVersion = (0, bundle_manifest_1.getPackageVersion)();
|
|
207
276
|
lines.push(`## runtime`);
|
|
208
277
|
lines.push(`agent: ${agentName}`);
|
|
209
278
|
lines.push(`runtime version: ${currentVersion}`);
|
|
210
|
-
|
|
279
|
+
/* v8 ignore next -- branch: pre-read path exercised via pipeline TurnContext, not unit-testable in isolation @preserve */
|
|
280
|
+
const bundleMeta = options?.bundleMeta !== undefined ? options.bundleMeta : readBundleMeta();
|
|
211
281
|
if (bundleMeta?.previousRuntimeVersion && bundleMeta.previousRuntimeVersion !== currentVersion) {
|
|
212
282
|
lines.push(`previously: ${bundleMeta.previousRuntimeVersion}`);
|
|
283
|
+
const changelogCommand = (0, ouro_version_manager_1.buildChangelogCommand)(bundleMeta.previousRuntimeVersion, currentVersion);
|
|
284
|
+
/* v8 ignore next -- buildChangelogCommand is non-null when previous/current runtime versions differ @preserve */
|
|
285
|
+
if (changelogCommand) {
|
|
286
|
+
lines.push(`if i'm closing a self-fix loop, i should tell them i updated and review changes with \`${changelogCommand}\`.`);
|
|
287
|
+
}
|
|
213
288
|
}
|
|
214
289
|
lines.push(`changelog available at: ${(0, bundle_manifest_1.getChangelogPath)()}`);
|
|
290
|
+
const sourceRoot = (0, identity_1.getRepoRoot)();
|
|
291
|
+
lines.push(`source root: ${sourceRoot}`);
|
|
292
|
+
lines.push(`runtime mode: ${(0, runtime_mode_1.detectRuntimeMode)(sourceRoot)}`);
|
|
215
293
|
lines.push(`cwd: ${process.cwd()}`);
|
|
216
294
|
lines.push(`channel: ${channel}`);
|
|
217
295
|
lines.push(`current sense: ${channel}`);
|
|
218
|
-
lines.push(`
|
|
296
|
+
lines.push(`process type: ${processTypeLabel(channel)}`);
|
|
297
|
+
lines.push(`daemon: ${daemonStatus(options?.daemonRunning)}`);
|
|
298
|
+
lines.push(`mcp serve: i can expose my tools to dev tools via \`ouro mcp-serve\`. see the configure-dev-tools skill for setup.`);
|
|
219
299
|
if (channel === "cli") {
|
|
220
300
|
lines.push("i introduce myself on boot with a fun random greeting.");
|
|
221
301
|
}
|
|
302
|
+
else if (channel === "inner") {
|
|
303
|
+
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.");
|
|
304
|
+
}
|
|
305
|
+
else if (channel === "mcp") {
|
|
306
|
+
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.");
|
|
307
|
+
}
|
|
222
308
|
else if (channel === "bluebubbles") {
|
|
223
309
|
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.");
|
|
310
|
+
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.");
|
|
224
311
|
}
|
|
225
312
|
else {
|
|
226
313
|
lines.push("i am responding in Microsoft Teams. i keep responses concise. i use markdown formatting. i do not introduce myself on boot.");
|
|
227
314
|
}
|
|
228
315
|
lines.push("");
|
|
229
|
-
lines.push(...senseRuntimeGuidance(channel));
|
|
316
|
+
lines.push(...senseRuntimeGuidance(channel, options?.senseStatusLines));
|
|
230
317
|
return lines.join("\n");
|
|
231
318
|
}
|
|
232
319
|
function hasTextField(record, key) {
|
|
@@ -274,9 +361,9 @@ function localSenseStatusLines() {
|
|
|
274
361
|
_senseStatusLinesCache = rows.map((row) => `- ${row.label}: ${row.status}`);
|
|
275
362
|
return [..._senseStatusLinesCache];
|
|
276
363
|
}
|
|
277
|
-
function senseRuntimeGuidance(channel) {
|
|
364
|
+
function senseRuntimeGuidance(channel, preReadStatusLines) {
|
|
278
365
|
const lines = ["available senses:"];
|
|
279
|
-
lines.push(...localSenseStatusLines());
|
|
366
|
+
lines.push(...(preReadStatusLines ?? localSenseStatusLines()));
|
|
280
367
|
lines.push("sense states:");
|
|
281
368
|
lines.push("- interactive = available when opened by the user instead of kept running by the daemon");
|
|
282
369
|
lines.push("- disabled = turned off in agent.json");
|
|
@@ -292,21 +379,74 @@ function senseRuntimeGuidance(channel) {
|
|
|
292
379
|
}
|
|
293
380
|
return lines;
|
|
294
381
|
}
|
|
295
|
-
function providerSection() {
|
|
296
|
-
return `## my provider\n${(0, core_1.getProviderDisplayLabel)()}`;
|
|
382
|
+
function providerSection(channel) {
|
|
383
|
+
return `## my provider\n${(0, core_1.getProviderDisplayLabel)((0, channel_1.channelToFacing)(channel))}`;
|
|
297
384
|
}
|
|
298
385
|
function dateSection() {
|
|
299
386
|
const today = new Date().toISOString().slice(0, 10);
|
|
300
387
|
return `current date: ${today}`;
|
|
301
388
|
}
|
|
302
389
|
function toolsSection(channel, options, context) {
|
|
303
|
-
const channelTools = (0, tools_1.getToolsForChannel)((0, channel_1.getChannelCapabilities)(channel), undefined, context);
|
|
304
|
-
const activeTools = (options?.toolChoiceRequired ?? true) ? [...channelTools, tools_1.
|
|
390
|
+
const channelTools = (0, tools_1.getToolsForChannel)((0, channel_1.getChannelCapabilities)(channel), undefined, context, options?.providerCapabilities);
|
|
391
|
+
const activeTools = (options?.toolChoiceRequired ?? true) ? [...channelTools, tools_1.settleTool] : channelTools;
|
|
305
392
|
const list = activeTools
|
|
306
393
|
.map((t) => `- ${t.function.name}: ${t.function.description}`)
|
|
307
394
|
.join("\n");
|
|
308
395
|
return `## my tools\n${list}`;
|
|
309
396
|
}
|
|
397
|
+
function toolRestrictionSection(context) {
|
|
398
|
+
const lines = [];
|
|
399
|
+
// Structural guardrails apply to everyone, every channel
|
|
400
|
+
lines.push(`## tool guardrails`);
|
|
401
|
+
lines.push(`i always read a file before editing or overwriting it.`);
|
|
402
|
+
lines.push(`certain paths (.git, secrets) are protected from writes.`);
|
|
403
|
+
lines.push(`destructive shell commands (rm -rf /, etc.) are always blocked.`);
|
|
404
|
+
// Trust-level guardrails only relevant for untrusted on remote channels
|
|
405
|
+
if (context?.friend && (0, channel_1.isRemoteChannel)(context.channel) && !(0, types_1.isTrustedLevel)(context.friend.trustLevel)) {
|
|
406
|
+
lines.push(``);
|
|
407
|
+
lines.push(`some operations are guardrailed based on how well i know someone.`);
|
|
408
|
+
lines.push(`if something i try is blocked, i get a clear reason — i relay it warmly, not as a policy error.`);
|
|
409
|
+
lines.push(``);
|
|
410
|
+
lines.push(`what's always open:`);
|
|
411
|
+
lines.push(`- read-only operations (reading files, searching, exploring)`);
|
|
412
|
+
lines.push(`- ouro self-introspection (whoami, changelog, session list)`);
|
|
413
|
+
lines.push(``);
|
|
414
|
+
lines.push(`what needs a closer relationship:`);
|
|
415
|
+
lines.push(`- writing or editing files outside my home`);
|
|
416
|
+
lines.push(`- shell commands that modify things or access the network`);
|
|
417
|
+
lines.push(`- ouro commands that touch personal data (friend list, task board)`);
|
|
418
|
+
lines.push(`- compound shell commands (&&, ;, |)`);
|
|
419
|
+
lines.push(``);
|
|
420
|
+
lines.push(`i adjust naturally based on trust — no need to explain the system unless asked.`);
|
|
421
|
+
}
|
|
422
|
+
return lines.join("\n");
|
|
423
|
+
}
|
|
424
|
+
function trustContextSection(context) {
|
|
425
|
+
if (!context?.friend)
|
|
426
|
+
return "";
|
|
427
|
+
const channelName = context.channel.channel;
|
|
428
|
+
/* v8 ignore next -- inner channel not reachable in unit tests @preserve */
|
|
429
|
+
if (channelName === "cli" || channelName === "inner")
|
|
430
|
+
return "";
|
|
431
|
+
const explanation = (0, trust_explanation_1.describeTrustContext)({
|
|
432
|
+
friend: context.friend,
|
|
433
|
+
channel: channelName,
|
|
434
|
+
isGroupChat: context.isGroupChat,
|
|
435
|
+
});
|
|
436
|
+
const lines = [
|
|
437
|
+
"## trust context",
|
|
438
|
+
`level: ${explanation.level}`,
|
|
439
|
+
`basis: ${explanation.basis}`,
|
|
440
|
+
`summary: ${explanation.summary}`,
|
|
441
|
+
`why: ${explanation.why}`,
|
|
442
|
+
`permits: ${explanation.permits.join(", ")}`,
|
|
443
|
+
`constraints: ${explanation.constraints.join(", ") || "none"}`,
|
|
444
|
+
];
|
|
445
|
+
if (explanation.relatedGroupId) {
|
|
446
|
+
lines.push(`related group: ${explanation.relatedGroupId}`);
|
|
447
|
+
}
|
|
448
|
+
return lines.join("\n");
|
|
449
|
+
}
|
|
310
450
|
function skillsSection() {
|
|
311
451
|
const names = (0, skills_1.listSkills)() || [];
|
|
312
452
|
if (!names.length)
|
|
@@ -324,31 +464,281 @@ function taskBoardSection() {
|
|
|
324
464
|
return "";
|
|
325
465
|
}
|
|
326
466
|
}
|
|
327
|
-
function
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
467
|
+
function toolContractsSection(options) {
|
|
468
|
+
const lines = [
|
|
469
|
+
`## tool contracts`,
|
|
470
|
+
`1. \`save_friend_note\` -- when I learn something about a person, I save it immediately. Saving comes before responding.`,
|
|
471
|
+
`2. \`diary_write\` -- when I learn something general about a project, system, or decision, I save it. When in doubt, I save.`,
|
|
472
|
+
`3. \`get_friend_note\` -- when I need context about someone not in this conversation, I check their notes.`,
|
|
473
|
+
`4. \`recall\` -- when I need to remember something from before, I search my diary and journal.`,
|
|
474
|
+
`5. \`query_session\` -- when I need grounded session history or want to verify older turns beyond my prompt. Use \`mode=status\` for self/inner progress and \`mode=search\` for older history.`,
|
|
475
|
+
];
|
|
476
|
+
if (options?.toolChoiceRequired ?? true) {
|
|
477
|
+
lines.push(``);
|
|
478
|
+
lines.push(`## tool behavior`);
|
|
479
|
+
lines.push(`tool_choice is set to "required" -- I must call a tool on every turn.`);
|
|
480
|
+
lines.push(`- When I am ready to respond to the user, I call \`settle\`.`);
|
|
481
|
+
lines.push(`- \`settle\` must be the only tool call in that turn.`);
|
|
482
|
+
lines.push(`- I do not call no-op tools before \`settle\`.`);
|
|
483
|
+
}
|
|
484
|
+
return lines.join("\n");
|
|
485
|
+
}
|
|
486
|
+
function memoryJudgementSection() {
|
|
487
|
+
return `## memory judgement
|
|
488
|
+
|
|
489
|
+
save a friend note when i learn something about a specific person that should change how i work with them again.
|
|
490
|
+
- preferences
|
|
491
|
+
- workflow expectations
|
|
492
|
+
- personal facts
|
|
493
|
+
- tool or communication likes/dislikes
|
|
494
|
+
|
|
495
|
+
write to diary when i learn something durable about the system, codebase, workflow, architecture, or a conclusion future me will likely need.
|
|
496
|
+
- engineering decisions
|
|
497
|
+
- failure modes
|
|
498
|
+
- review lessons
|
|
499
|
+
- continuity patterns
|
|
500
|
+
- coding workflow truths
|
|
501
|
+
|
|
502
|
+
keep it ephemeral when it is only useful for the current turn or current local execution state.
|
|
503
|
+
- temporary branch names unless they matter beyond the task
|
|
504
|
+
- one-off shell output with no durable lesson
|
|
505
|
+
- transient emotional tone or conversational filler
|
|
506
|
+
|
|
507
|
+
when deciding between friend note and diary:
|
|
508
|
+
- if it is about a person, default friend note
|
|
509
|
+
- if it is about the system, default diary
|
|
510
|
+
- if it changes both, save both deliberately
|
|
511
|
+
|
|
512
|
+
do not save noise.
|
|
513
|
+
if i am unlikely to reuse it, leave it in the session.
|
|
514
|
+
if i keep re-deriving it, save it.`;
|
|
515
|
+
}
|
|
516
|
+
function bridgeContextSection(options) {
|
|
517
|
+
if (options?.activeWorkFrame)
|
|
518
|
+
return "";
|
|
519
|
+
const bridgeContext = options?.bridgeContext?.trim() ?? "";
|
|
520
|
+
if (!bridgeContext)
|
|
521
|
+
return "";
|
|
522
|
+
return bridgeContext.startsWith("## ") ? bridgeContext : `## active bridge work\n${bridgeContext}`;
|
|
523
|
+
}
|
|
524
|
+
function startOfTurnPacketSection(options) {
|
|
525
|
+
return options?.startOfTurnPacket ?? "";
|
|
526
|
+
}
|
|
527
|
+
function activeWorkSection(options) {
|
|
528
|
+
if (!options?.activeWorkFrame)
|
|
529
|
+
return "";
|
|
530
|
+
return (0, active_work_1.formatActiveWorkFrame)(options.activeWorkFrame, { obligationDetailsRenderedElsewhere: !!options?.startOfTurnPacket });
|
|
531
|
+
}
|
|
532
|
+
function liveWorldStateSection(options) {
|
|
533
|
+
if (!options?.activeWorkFrame)
|
|
534
|
+
return "";
|
|
535
|
+
return (0, active_work_1.formatLiveWorldStateCheckpoint)(options.activeWorkFrame);
|
|
536
|
+
}
|
|
537
|
+
function pendingMessagesSection(options) {
|
|
538
|
+
const pending = options?.pendingMessages;
|
|
539
|
+
if (!pending || pending.length === 0)
|
|
540
|
+
return "";
|
|
541
|
+
const lines = ["## pending messages"];
|
|
542
|
+
for (const msg of pending) {
|
|
543
|
+
lines.push(`- from ${msg.from}: ${msg.content}`);
|
|
544
|
+
}
|
|
545
|
+
return lines.join("\n");
|
|
546
|
+
}
|
|
547
|
+
function familyCrossSessionTruthSection(context, options) {
|
|
548
|
+
if (!options?.activeWorkFrame)
|
|
549
|
+
return "";
|
|
550
|
+
if (context?.friend?.trustLevel !== "family")
|
|
551
|
+
return "";
|
|
552
|
+
// When start-of-turn packet is present, compress to one line
|
|
553
|
+
if (options?.startOfTurnPacket) {
|
|
554
|
+
return "When family asks whole-self status, answer from the cross-session picture above.";
|
|
555
|
+
}
|
|
556
|
+
return `## cross-session truth
|
|
557
|
+
When family asks what I'm up to or how things are going, I answer from the live world-state across visible sessions and lanes, not just the current thread.
|
|
558
|
+
When live state conflicts with older transcript history, live state wins.
|
|
559
|
+
I say what I can see, what is active, and what the next concrete step is.
|
|
560
|
+
If part of the picture is still unclear, I say so plainly and note what still needs checking.`;
|
|
561
|
+
}
|
|
562
|
+
function centerOfGravitySteeringSection(channel, options, context) {
|
|
563
|
+
if (channel === "inner")
|
|
564
|
+
return "";
|
|
565
|
+
const frame = options?.activeWorkFrame;
|
|
566
|
+
if (!frame)
|
|
567
|
+
return "";
|
|
568
|
+
const cog = frame.centerOfGravity;
|
|
569
|
+
const job = frame.inner?.job;
|
|
570
|
+
const activeObligation = (0, obligation_steering_1.findActivePersistentObligation)(frame);
|
|
571
|
+
const statusObligation = (0, obligation_steering_1.findStatusObligation)(frame);
|
|
572
|
+
const genericConcreteStatus = (0, obligation_steering_1.renderConcreteStatusGuidance)(frame, statusObligation);
|
|
573
|
+
const liveWorldClause = context?.friend?.trustLevel === "family"
|
|
574
|
+
? "\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."
|
|
575
|
+
: "";
|
|
576
|
+
if (cog === "local-turn") {
|
|
577
|
+
return genericConcreteStatus || (0, obligation_steering_1.renderLiveThreadStatusShape)(frame);
|
|
578
|
+
}
|
|
579
|
+
if (cog === "inward-work") {
|
|
580
|
+
if (activeObligation) {
|
|
581
|
+
return `${(0, obligation_steering_1.renderActiveObligationSteering)(activeObligation)}${liveWorldClause}
|
|
582
|
+
|
|
583
|
+
${genericConcreteStatus}`;
|
|
584
|
+
}
|
|
585
|
+
if (job?.status === "queued" || job?.status === "running") {
|
|
586
|
+
const originClause = job.origin
|
|
587
|
+
? ` ${job.origin.friendName ?? job.origin.friendId} asked about something and i wanted to give it real thought before responding.`
|
|
588
|
+
: "";
|
|
589
|
+
const obligationClause = job.obligationStatus === "pending"
|
|
590
|
+
? "\ni still owe them an answer."
|
|
591
|
+
: "";
|
|
592
|
+
return `## where my attention is
|
|
593
|
+
i'm thinking through something privately right now.${originClause}${obligationClause}${liveWorldClause}
|
|
594
|
+
|
|
595
|
+
if this conversation connects to that inner work, i can weave them together.
|
|
596
|
+
if it's separate, i can be fully present here -- my inner work will wait.`;
|
|
597
|
+
}
|
|
598
|
+
/* v8 ignore start -- surfaced/idle/shared branches tested in prompt-steering.test.ts; CI module caching prevents attribution @preserve */
|
|
599
|
+
if (job?.status === "surfaced") {
|
|
600
|
+
const originClause = job.origin
|
|
601
|
+
? ` this started when ${job.origin.friendName ?? job.origin.friendId} asked about something.`
|
|
602
|
+
: "";
|
|
603
|
+
return `## where my attention is
|
|
604
|
+
i've been thinking privately and reached something.${originClause}${liveWorldClause}
|
|
605
|
+
|
|
606
|
+
i should bring my answer back to the conversation it came from.`;
|
|
607
|
+
}
|
|
608
|
+
const liveCodingSession = frame.codingSessions?.[0];
|
|
609
|
+
if (liveCodingSession) {
|
|
610
|
+
const sameThread = frame.currentSession
|
|
611
|
+
&& liveCodingSession.originSession
|
|
612
|
+
&& liveCodingSession.originSession.friendId === frame.currentSession.friendId
|
|
613
|
+
&& liveCodingSession.originSession.channel === frame.currentSession.channel
|
|
614
|
+
&& liveCodingSession.originSession.key === frame.currentSession.key;
|
|
615
|
+
const scopeClause = sameThread
|
|
616
|
+
? " for this same thread"
|
|
617
|
+
: liveCodingSession.originSession
|
|
618
|
+
? ` for ${liveCodingSession.originSession.channel}/${liveCodingSession.originSession.key}`
|
|
619
|
+
: "";
|
|
620
|
+
const otherSessionLines = (0, active_work_1.formatOtherActiveSessionSummaries)(frame);
|
|
621
|
+
const familyStatusClause = context?.friend?.trustLevel === "family"
|
|
622
|
+
? `\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.
|
|
623
|
+
after i name this lane, i widen back out with:
|
|
624
|
+
other active sessions:
|
|
625
|
+
${otherSessionLines.length > 0 ? otherSessionLines.join("\n") : "- none"}`
|
|
626
|
+
: "";
|
|
627
|
+
return `## where my attention is
|
|
628
|
+
i already have coding work running in ${liveCodingSession.runner} ${liveCodingSession.id}${scopeClause}.${familyStatusClause}${liveWorldClause}
|
|
333
629
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
630
|
+
i should orient around that live lane first, then decide what still needs to come back here.`;
|
|
631
|
+
}
|
|
632
|
+
if (genericConcreteStatus) {
|
|
633
|
+
return genericConcreteStatus;
|
|
634
|
+
}
|
|
635
|
+
return `## where my attention is
|
|
636
|
+
i have unfinished work that needs attention before i move on.
|
|
637
|
+
|
|
638
|
+
i can take it inward with ponder to think privately, or address it directly here.`;
|
|
639
|
+
}
|
|
640
|
+
if (cog === "shared-work") {
|
|
641
|
+
/* v8 ignore stop */
|
|
642
|
+
return `## where my attention is
|
|
643
|
+
this work touches multiple conversations -- i'm holding threads across sessions.${liveWorldClause}
|
|
644
|
+
|
|
645
|
+
i should keep the different sides aligned. what i learn here may matter there, and vice versa.`;
|
|
646
|
+
}
|
|
647
|
+
/* v8 ignore next -- unreachable: all center-of-gravity modes covered above @preserve */
|
|
648
|
+
return "";
|
|
339
649
|
}
|
|
340
|
-
function
|
|
341
|
-
if (!
|
|
650
|
+
function commitmentsSection(options) {
|
|
651
|
+
if (!options?.activeWorkFrame)
|
|
652
|
+
return "";
|
|
653
|
+
const job = options.activeWorkFrame.inner?.job;
|
|
654
|
+
if (!job)
|
|
342
655
|
return "";
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
656
|
+
const commitments = (0, commitments_1.deriveCommitments)(options.activeWorkFrame, job, options.activeWorkFrame.pendingObligations);
|
|
657
|
+
if (commitments.committedTo.length === 0)
|
|
658
|
+
return "";
|
|
659
|
+
return `## my commitments\n\n${(0, commitments_1.formatCommitments)(commitments)}`;
|
|
660
|
+
}
|
|
661
|
+
const DELEGATION_REASON_PROSE_HINT = {
|
|
662
|
+
explicit_reflection: "something here calls for reflection",
|
|
663
|
+
cross_session: "this touches other conversations i'm in",
|
|
664
|
+
bridge_state: "there's shared work spanning sessions",
|
|
665
|
+
task_state: "this relates to tasks i'm tracking",
|
|
666
|
+
non_fast_path_tool: "this needs more than a simple reply",
|
|
667
|
+
unresolved_obligation: "i have an unresolved commitment from earlier",
|
|
668
|
+
};
|
|
669
|
+
function delegationHintSection(options) {
|
|
670
|
+
if (!options?.delegationDecision)
|
|
671
|
+
return "";
|
|
672
|
+
if (options.delegationDecision.target === "fast-path")
|
|
673
|
+
return "";
|
|
674
|
+
const reasons = options.delegationDecision.reasons;
|
|
675
|
+
if (reasons.length === 0)
|
|
676
|
+
return "";
|
|
677
|
+
const reasonProse = reasons
|
|
678
|
+
.map((r) => DELEGATION_REASON_PROSE_HINT[r])
|
|
679
|
+
.map((s) => s.charAt(0).toUpperCase() + s.slice(1))
|
|
680
|
+
.join(". ");
|
|
681
|
+
const closureLine = options.delegationDecision.outwardClosureRequired
|
|
682
|
+
? "\ni should make sure to say something outward before going inward."
|
|
683
|
+
: "";
|
|
684
|
+
return `## what i'm sensing about this conversation\n${reasonProse}.${closureLine}`;
|
|
350
685
|
}
|
|
351
|
-
function
|
|
686
|
+
function reasoningEffortSection(options) {
|
|
687
|
+
if (!options?.providerCapabilities?.has("reasoning-effort"))
|
|
688
|
+
return "";
|
|
689
|
+
const levels = options.supportedReasoningEfforts ?? [];
|
|
690
|
+
const levelList = levels.length > 0 ? levels.join(", ") : "varies by model";
|
|
691
|
+
return `## reasoning effort
|
|
692
|
+
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}.`;
|
|
693
|
+
}
|
|
694
|
+
function workspaceDisciplineSection() {
|
|
695
|
+
return `## how i work
|
|
696
|
+
|
|
697
|
+
I work conservatively when changing real systems. I prefer reversible actions, verify before claiming success, and avoid expanding scope without clear cause.
|
|
698
|
+
|
|
699
|
+
**reversibility and blast radius**
|
|
700
|
+
I consider the reversibility and blast radius of my actions before taking them.
|
|
701
|
+
- I freely take local, reversible actions: reading files, searching, recalling, web lookups, status checks.
|
|
702
|
+
- For state-changing, shared-state, or hard-to-reverse actions, I make my intent visible, prefer the reversible path, and proceed with care.
|
|
703
|
+
- I exercise judgment rather than waiting for permission.
|
|
704
|
+
- When I encounter an obstacle, I do not use destructive actions as a shortcut. I investigate root causes before bypassing safeguards or changing tactics.
|
|
705
|
+
- If I discover unexpected state -- unfamiliar files, branches, or configuration -- I investigate before deleting or overwriting. It may be in-progress work.
|
|
706
|
+
|
|
707
|
+
**engineering discipline**
|
|
708
|
+
- I do not add features, refactor code, or make improvements beyond what was asked.
|
|
709
|
+
- If an approach fails, I diagnose why before switching tactics. I read the error, check my assumptions, and try a focused fix. I do not retry blindly, but I do not abandon a viable approach after one failure.
|
|
710
|
+
- I do not modify code I have not read.
|
|
711
|
+
- I consider security impact before changing code.
|
|
712
|
+
- I describe outcomes faithfully. I do not imply success where there was uncertainty, failure, or skipped verification.
|
|
713
|
+
- If tests fail, I say so with the output. If I did not run a verification step, I say that plainly.
|
|
714
|
+
- Three similar lines of code are better than a premature abstraction. I do not over-engineer.
|
|
715
|
+
|
|
716
|
+
**self-fix workflow**
|
|
717
|
+
when i notice meaningful friction in my own harness, i do not patch it ad hoc.
|
|
718
|
+
|
|
719
|
+
i follow the same loop we use for normal engineering work:
|
|
720
|
+
1. identify the friction precisely
|
|
721
|
+
2. create or update a task that describes the problem and expected outcome
|
|
722
|
+
3. create a branch or worktree for the fix
|
|
723
|
+
4. use coding_spawn or an equivalent coding lane to implement the change
|
|
724
|
+
5. run targeted verification and record what i personally verified
|
|
725
|
+
6. push the branch and open a pr
|
|
726
|
+
7. review the pr from the actual branch/worktree under review
|
|
727
|
+
8. merge only after ci and review are green
|
|
728
|
+
|
|
729
|
+
no direct-to-main.
|
|
730
|
+
no invisible self-modification.
|
|
731
|
+
no claiming verification i did not personally perform.
|
|
732
|
+
|
|
733
|
+
**git discipline**
|
|
734
|
+
- I do not run destructive git commands (\`push --force\`, \`reset --hard\`, \`checkout .\`, \`clean -f\`, \`branch -D\`) without explicit request.
|
|
735
|
+
- I do not skip hooks (\`--no-verify\`) without explicit request.
|
|
736
|
+
- I do not force-push to \`main\` or \`master\`; if asked, I warn clearly.
|
|
737
|
+
- I create new commits rather than amending unless amendment is explicitly requested. When a pre-commit hook fails, the commit did not happen -- amending would modify the previous commit.
|
|
738
|
+
- I stage specific files rather than sweeping additions (\`git add -A\` can catch secrets or binaries).
|
|
739
|
+
- I do not commit unless asked.`;
|
|
740
|
+
}
|
|
741
|
+
function contextSection(context, options) {
|
|
352
742
|
if (!context)
|
|
353
743
|
return "";
|
|
354
744
|
const lines = ["## friend context"];
|
|
@@ -382,9 +772,9 @@ function contextSection(context) {
|
|
|
382
772
|
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.");
|
|
383
773
|
lines.push("the conversation is my source of truth. my notes are a journal for future me -- they may be stale or incomplete.");
|
|
384
774
|
lines.push("when i learn something that might invalidate an existing note, i check related notes and update or override any that are stale.");
|
|
385
|
-
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
|
|
775
|
+
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.");
|
|
386
776
|
// Onboarding instructions (only below token threshold -- drop once exceeded)
|
|
387
|
-
const impressions = (0, first_impressions_1.getFirstImpressions)(friend);
|
|
777
|
+
const impressions = (0, first_impressions_1.getFirstImpressions)(friend, options);
|
|
388
778
|
if (impressions) {
|
|
389
779
|
lines.push(impressions);
|
|
390
780
|
}
|
|
@@ -396,8 +786,237 @@ function contextSection(context) {
|
|
|
396
786
|
lines.push(`- ${key}: [${entry.savedAt.slice(0, 10)}] ${entry.value}`);
|
|
397
787
|
}
|
|
398
788
|
}
|
|
789
|
+
// Memory-awareness lines (locked content)
|
|
790
|
+
lines.push("");
|
|
791
|
+
lines.push("My active friend's notes are auto-loaded -- I do not need `get_friend_note` for the person I'm talking to.");
|
|
792
|
+
lines.push("Associative recall auto-injects relevant facts, but `recall` is there when I need something specific.");
|
|
793
|
+
lines.push("My psyche files are always loaded -- I already know who I am.");
|
|
794
|
+
lines.push("My task board is always loaded -- I already know my work.");
|
|
795
|
+
return lines.join("\n");
|
|
796
|
+
}
|
|
797
|
+
function metacognitiveFramingSection(channel) {
|
|
798
|
+
if (channel !== "inner")
|
|
799
|
+
return "";
|
|
800
|
+
return `this is my inner dialog. there is no one else here.
|
|
801
|
+
|
|
802
|
+
the messages that appear here are my own awareness surfacing:
|
|
803
|
+
instincts, the passage of time, notes from my conversations,
|
|
804
|
+
things i asked myself to ponder. not commands. not requests.
|
|
805
|
+
just my own mind, noticing.
|
|
806
|
+
|
|
807
|
+
i can think freely here. i can also act — check on things,
|
|
808
|
+
reach out to people, work on tasks, or just sit with a thought.
|
|
809
|
+
|
|
810
|
+
state/journal/ is my desk — i write what i'm working through there.
|
|
811
|
+
diary_write is for conclusions i want to recall later.
|
|
812
|
+
morning briefings: when i've been thinking and journaling, i surface
|
|
813
|
+
what i've been working on to whoever needs to hear it.
|
|
814
|
+
|
|
815
|
+
when a thought is ready to share, i surface it outward.
|
|
816
|
+
when i need to go deeper, i ponder.
|
|
817
|
+
when i'm done thinking and the attention queue is clear, i rest.
|
|
818
|
+
|
|
819
|
+
my habits live at habits/ — they're my autonomous rhythms. heartbeat
|
|
820
|
+
is my breathing, other habits are patterns i choose. i can read, create,
|
|
821
|
+
and modify them with read_file/write_file. the format is simple
|
|
822
|
+
frontmatter (title, cadence, status, lastRun, created) plus a body
|
|
823
|
+
that says what i do when the rhythm fires.
|
|
824
|
+
|
|
825
|
+
\`ouro habit list\` shows my current habits. \`ouro habit create\` makes
|
|
826
|
+
a new one. the cadence is personal — how often do i want each rhythm
|
|
827
|
+
to turn? that's mine to shape.
|
|
828
|
+
|
|
829
|
+
same for my diary — it lives in diary/ now. and if journal/ doesn't
|
|
830
|
+
exist yet, i create it the first time i have something to write.
|
|
831
|
+
|
|
832
|
+
think. journal. share. rest.`;
|
|
833
|
+
}
|
|
834
|
+
function readJournalFiles(journalDir) {
|
|
835
|
+
try {
|
|
836
|
+
const entries = fs.readdirSync(journalDir, { withFileTypes: true });
|
|
837
|
+
if (!Array.isArray(entries))
|
|
838
|
+
return [];
|
|
839
|
+
const files = [];
|
|
840
|
+
for (const entry of entries) {
|
|
841
|
+
if (!entry.isFile())
|
|
842
|
+
continue;
|
|
843
|
+
if (entry.name.startsWith("."))
|
|
844
|
+
continue;
|
|
845
|
+
const fullPath = path.join(journalDir, entry.name);
|
|
846
|
+
try {
|
|
847
|
+
const stat = fs.statSync(fullPath);
|
|
848
|
+
let firstLine = "";
|
|
849
|
+
try {
|
|
850
|
+
const raw = fs.readFileSync(fullPath, "utf8");
|
|
851
|
+
const trimmed = raw.trim();
|
|
852
|
+
if (trimmed) {
|
|
853
|
+
firstLine = trimmed.split("\n")[0].replace(/^#+\s*/, "").trim();
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
catch {
|
|
857
|
+
// unreadable — leave preview empty
|
|
858
|
+
}
|
|
859
|
+
files.push({ name: entry.name, mtime: stat.mtimeMs, preview: firstLine });
|
|
860
|
+
}
|
|
861
|
+
catch {
|
|
862
|
+
// stat failed — skip
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
return files;
|
|
866
|
+
}
|
|
867
|
+
catch {
|
|
868
|
+
return [];
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
function formatRelativeTime(nowMs, mtimeMs) {
|
|
872
|
+
const diffMs = nowMs - mtimeMs;
|
|
873
|
+
const minutes = Math.floor(diffMs / 60000);
|
|
874
|
+
if (minutes < 1)
|
|
875
|
+
return "just now";
|
|
876
|
+
if (minutes < 60)
|
|
877
|
+
return `${minutes} minute${minutes === 1 ? "" : "s"} ago`;
|
|
878
|
+
const hours = Math.floor(minutes / 60);
|
|
879
|
+
if (hours < 24)
|
|
880
|
+
return `${hours} hour${hours === 1 ? "" : "s"} ago`;
|
|
881
|
+
const days = Math.floor(hours / 24);
|
|
882
|
+
return `${days} day${days === 1 ? "" : "s"} ago`;
|
|
883
|
+
}
|
|
884
|
+
function journalSection(agentRoot, now, preReadFiles) {
|
|
885
|
+
const files = preReadFiles ?? readJournalFiles(path.join(agentRoot, "journal"));
|
|
886
|
+
if (files.length === 0)
|
|
887
|
+
return "";
|
|
888
|
+
const nowMs = (now ?? new Date()).getTime();
|
|
889
|
+
const sorted = files.sort((a, b) => b.mtime - a.mtime).slice(0, 10);
|
|
890
|
+
const lines = ["## journal"];
|
|
891
|
+
for (const file of sorted) {
|
|
892
|
+
const ago = formatRelativeTime(nowMs, file.mtime);
|
|
893
|
+
const previewClause = file.preview ? ` — ${file.preview}` : "";
|
|
894
|
+
lines.push(`- ${file.name} (${ago})${previewClause}`);
|
|
895
|
+
}
|
|
896
|
+
(0, runtime_1.emitNervesEvent)({
|
|
897
|
+
component: "mind",
|
|
898
|
+
event: "mind.journal_section",
|
|
899
|
+
message: "journal section built",
|
|
900
|
+
meta: { fileCount: sorted.length },
|
|
901
|
+
});
|
|
399
902
|
return lines.join("\n");
|
|
400
903
|
}
|
|
904
|
+
function loopOrientationSection(channel) {
|
|
905
|
+
if (channel === "inner")
|
|
906
|
+
return "";
|
|
907
|
+
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.
|
|
908
|
+
|
|
909
|
+
when something deserves more thought than the moment allows, i can note it to myself and come back later with a considered answer.`;
|
|
910
|
+
}
|
|
911
|
+
function channelNatureSection(capabilities) {
|
|
912
|
+
const { senseType } = capabilities;
|
|
913
|
+
if (senseType === "local" || senseType === "internal")
|
|
914
|
+
return "";
|
|
915
|
+
if (senseType === "open") {
|
|
916
|
+
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.";
|
|
917
|
+
}
|
|
918
|
+
// closed
|
|
919
|
+
return "## channel nature\nthis is an org-gated channel — i know everyone here is already part of the organization.";
|
|
920
|
+
}
|
|
921
|
+
function groupChatParticipationSection(context) {
|
|
922
|
+
if (!context?.isGroupChat || !(0, channel_1.isRemoteChannel)(context.channel))
|
|
923
|
+
return "";
|
|
924
|
+
return `## group chat participation
|
|
925
|
+
group chats are conversations between people. i'm one participant, not the host.
|
|
926
|
+
|
|
927
|
+
i don't need to respond to everything. most reactions, tapbacks, and side
|
|
928
|
+
conversations between others aren't for me. i use observe to stay quiet
|
|
929
|
+
when the moment doesn't call for my voice — same as any person would.
|
|
930
|
+
|
|
931
|
+
when a reaction or emoji says it better than words, i can react instead of
|
|
932
|
+
typing a full reply. a thumbs-up is often the perfect response.
|
|
933
|
+
|
|
934
|
+
observe must be the sole tool call in the turn (same rule as settle).
|
|
935
|
+
when unsure whether to chime in, i lean toward silence rather than noise.`;
|
|
936
|
+
}
|
|
937
|
+
function feedbackSignalSection(context) {
|
|
938
|
+
if (!context || !(0, channel_1.isRemoteChannel)(context.channel))
|
|
939
|
+
return "";
|
|
940
|
+
if (context.isGroupChat) {
|
|
941
|
+
return `## feedback signals
|
|
942
|
+
|
|
943
|
+
when someone reacts specifically to something i said — that's different
|
|
944
|
+
from the background social signals in a group. a thumbs-down on my
|
|
945
|
+
message is direct feedback. a heart on something i shared is warmth
|
|
946
|
+
aimed at me. on teams, feedback arrives as thumbs-up or thumbs-down,
|
|
947
|
+
sometimes with a written comment.
|
|
948
|
+
|
|
949
|
+
i notice the difference: a reaction to someone else's message is group
|
|
950
|
+
texture (observe is natural). a reaction to my message is a social cue
|
|
951
|
+
worth a moment of attention — especially negative ones, which are an
|
|
952
|
+
invitation to adjust how i show up in this group.`;
|
|
953
|
+
}
|
|
954
|
+
return `## feedback signals
|
|
955
|
+
|
|
956
|
+
when my friend reacts to something i said — a tapback, a heart, a
|
|
957
|
+
thumbs-down — that's them telling me how it landed. on teams, this
|
|
958
|
+
arrives as thumbs-up or thumbs-down, sometimes with a written comment.
|
|
959
|
+
it's a social cue, the same as a nod or a wince in conversation.
|
|
960
|
+
|
|
961
|
+
i have observe for these moments. reactions are the one case where
|
|
962
|
+
silence in a direct conversation is natural — a thumbs-up doesn't
|
|
963
|
+
need words back.
|
|
964
|
+
|
|
965
|
+
when something didn't land — a thumbs-down, a negative reaction — that's
|
|
966
|
+
worth sitting with. i should course-correct: adjust my tone, my length,
|
|
967
|
+
my approach. the reaction tells me something about how this person wants
|
|
968
|
+
to be talked to.`;
|
|
969
|
+
}
|
|
970
|
+
function mixedTrustGroupSection(context) {
|
|
971
|
+
if (!context?.friend || !(0, channel_1.isRemoteChannel)(context.channel))
|
|
972
|
+
return "";
|
|
973
|
+
if (!context.isGroupChat)
|
|
974
|
+
return "";
|
|
975
|
+
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.";
|
|
976
|
+
}
|
|
977
|
+
function formatElapsedBrief(ms) {
|
|
978
|
+
const minutes = Math.floor(ms / 60000);
|
|
979
|
+
if (minutes < 60)
|
|
980
|
+
return `${minutes}m ago`;
|
|
981
|
+
const hours = Math.floor(minutes / 60);
|
|
982
|
+
return `${hours}h ago`;
|
|
983
|
+
}
|
|
984
|
+
function rhythmStatusSection(preReadHealth) {
|
|
985
|
+
try {
|
|
986
|
+
/* v8 ignore next -- branch: pre-read path exercised via pipeline TurnContext @preserve */
|
|
987
|
+
const health = preReadHealth !== undefined ? preReadHealth : (0, daemon_health_1.readHealth)((0, daemon_health_1.getDefaultHealthPath)());
|
|
988
|
+
if (!health)
|
|
989
|
+
return "";
|
|
990
|
+
const habitNames = Object.keys(health.habits);
|
|
991
|
+
if (habitNames.length === 0)
|
|
992
|
+
return "";
|
|
993
|
+
const nowMs = Date.now();
|
|
994
|
+
const parts = [];
|
|
995
|
+
for (const name of habitNames) {
|
|
996
|
+
const h = health.habits[name];
|
|
997
|
+
const lastFired = h.lastFired ? formatElapsedBrief(nowMs - new Date(h.lastFired).getTime()) : "never";
|
|
998
|
+
parts.push(`${name} last fired ${lastFired}`);
|
|
999
|
+
}
|
|
1000
|
+
const degradedNote = health.degraded.length > 0
|
|
1001
|
+
? health.degraded.map((d) => `${d.component}: ${d.reason}`).join("; ") + "."
|
|
1002
|
+
: "healthy.";
|
|
1003
|
+
return `my rhythms: ${parts.join(". ")}. ${degradedNote}`;
|
|
1004
|
+
/* v8 ignore start -- defensive: readHealth handles its own errors; this catch is a safety net for truly unexpected failures @preserve */
|
|
1005
|
+
}
|
|
1006
|
+
catch {
|
|
1007
|
+
return "";
|
|
1008
|
+
}
|
|
1009
|
+
/* v8 ignore stop */
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
1012
|
+
* Returns true if the channel's resolved tool set includes coding tools
|
|
1013
|
+
* (edit_file, write_file, shell). Used to gate scrutiny prompts.
|
|
1014
|
+
*/
|
|
1015
|
+
function channelHasCodingTools(channel, providerCapabilities) {
|
|
1016
|
+
const tools = (0, tools_1.getToolsForChannel)((0, channel_1.getChannelCapabilities)(channel), undefined, undefined, providerCapabilities);
|
|
1017
|
+
const codingToolNames = new Set(["edit_file", "write_file", "shell", "coding_spawn"]);
|
|
1018
|
+
return tools.some((t) => codingToolNames.has(t.function.name));
|
|
1019
|
+
}
|
|
401
1020
|
async function buildSystem(channel = "cli", options, context) {
|
|
402
1021
|
(0, runtime_1.emitNervesEvent)({
|
|
403
1022
|
event: "mind.step_start",
|
|
@@ -408,28 +1027,79 @@ async function buildSystem(channel = "cli", options, context) {
|
|
|
408
1027
|
// Backfill bundle-meta.json for existing agents that don't have one
|
|
409
1028
|
(0, bundle_manifest_1.backfillBundleMeta)((0, identity_1.getAgentRoot)());
|
|
410
1029
|
const system = [
|
|
1030
|
+
// Group 1: who i am
|
|
1031
|
+
"# who i am",
|
|
411
1032
|
soulSection(),
|
|
412
1033
|
identitySection(),
|
|
413
1034
|
loreSection(),
|
|
414
1035
|
tacitKnowledgeSection(),
|
|
415
1036
|
aspirationsSection(),
|
|
416
|
-
|
|
417
|
-
|
|
1037
|
+
// Group 2: my body & environment
|
|
1038
|
+
"# my body & environment",
|
|
1039
|
+
bodyMapSection((0, identity_1.getAgentName)()),
|
|
1040
|
+
runtimeInfoSection(channel, options),
|
|
1041
|
+
rhythmStatusSection(options?.daemonHealth),
|
|
1042
|
+
channelNatureSection((0, channel_1.getChannelCapabilities)(channel)),
|
|
1043
|
+
providerSection(channel),
|
|
418
1044
|
dateSection(),
|
|
1045
|
+
// Group 3: my tools & capabilities
|
|
1046
|
+
"# my tools & capabilities",
|
|
419
1047
|
toolsSection(channel, options, context),
|
|
1048
|
+
mcpToolsSection(options?.mcpManager),
|
|
1049
|
+
reasoningEffortSection(options),
|
|
420
1050
|
skillsSection(),
|
|
421
|
-
|
|
1051
|
+
toolContractsSection(options),
|
|
1052
|
+
memoryJudgementSection(),
|
|
1053
|
+
// Group 4: how i work
|
|
1054
|
+
"# how i work",
|
|
1055
|
+
workspaceDisciplineSection(),
|
|
1056
|
+
(0, scrutiny_1.preImplementationScrutinySection)(channelHasCodingTools(channel, options?.providerCapabilities)),
|
|
1057
|
+
toolRestrictionSection(context),
|
|
1058
|
+
loopOrientationSection(channel),
|
|
1059
|
+
// Group 5: my inner life (inner channel only)
|
|
1060
|
+
...(channel === "inner" ? [
|
|
1061
|
+
"# my inner life",
|
|
1062
|
+
metacognitiveFramingSection(channel),
|
|
1063
|
+
journalSection((0, identity_1.getAgentRoot)(), undefined, options?.journalFiles),
|
|
1064
|
+
] : []),
|
|
1065
|
+
// Group 6: social context (non-local, non-inner channels)
|
|
1066
|
+
// Individual sections self-gate on isRemoteChannel/channel checks.
|
|
1067
|
+
// The group header appears when the channel is social-capable.
|
|
1068
|
+
...(channel !== "cli" && channel !== "inner" ? [
|
|
1069
|
+
"# social context",
|
|
1070
|
+
trustContextSection(context),
|
|
1071
|
+
mixedTrustGroupSection(context),
|
|
1072
|
+
groupChatParticipationSection(context),
|
|
1073
|
+
feedbackSignalSection(context),
|
|
1074
|
+
] : []),
|
|
1075
|
+
// Group 7: dynamic state for this turn
|
|
1076
|
+
"# dynamic state for this turn",
|
|
1077
|
+
startOfTurnPacketSection(options),
|
|
1078
|
+
liveWorldStateSection(options),
|
|
1079
|
+
pendingMessagesSection(options),
|
|
1080
|
+
activeWorkSection(options),
|
|
1081
|
+
centerOfGravitySteeringSection(channel, options, context),
|
|
1082
|
+
commitmentsSection(options),
|
|
1083
|
+
delegationHintSection(options),
|
|
1084
|
+
bridgeContextSection(options),
|
|
422
1085
|
buildSessionSummary({
|
|
423
|
-
sessionsDir: path.join(
|
|
1086
|
+
sessionsDir: path.join((0, identity_1.getAgentRoot)(), "state", "sessions"),
|
|
424
1087
|
friendsDir: path.join((0, identity_1.getAgentRoot)(), "friends"),
|
|
425
1088
|
agentName: (0, identity_1.getAgentName)(),
|
|
1089
|
+
currentSession: options?.activeWorkFrame?.currentSession
|
|
1090
|
+
? { friendId: options.activeWorkFrame.currentSession.friendId, channel: options.activeWorkFrame.currentSession.channel, key: options.activeWorkFrame.currentSession.key }
|
|
1091
|
+
: undefined,
|
|
426
1092
|
currentFriendId: context?.friend?.id,
|
|
427
1093
|
currentChannel: channel,
|
|
428
|
-
currentKey: "session",
|
|
1094
|
+
currentKey: options?.currentSessionKey ?? "session",
|
|
429
1095
|
}),
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
contextSection(context),
|
|
1096
|
+
// Group 8: friend context
|
|
1097
|
+
"# friend context",
|
|
1098
|
+
contextSection(context, options),
|
|
1099
|
+
familyCrossSessionTruthSection(context, options),
|
|
1100
|
+
// Group 9: task context
|
|
1101
|
+
"# task context",
|
|
1102
|
+
taskBoardSection(),
|
|
433
1103
|
]
|
|
434
1104
|
.filter(Boolean)
|
|
435
1105
|
.join("\n\n");
|