@askexenow/exe-os 0.9.112 → 0.9.113
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 +9 -7
- package/dist/bin/agentic-ontology-backfill.js +54 -11
- package/dist/bin/agentic-reflection-backfill.js +29 -1
- package/dist/bin/agentic-semantic-label.js +29 -1
- package/dist/bin/backfill-conversations.js +53 -10
- package/dist/bin/backfill-responses.js +54 -11
- package/dist/bin/backfill-vectors.js +29 -1
- package/dist/bin/bulk-sync-postgres.js +55 -12
- package/dist/bin/cleanup-stale-review-tasks.js +75 -15
- package/dist/bin/cli.js +293 -76
- package/dist/bin/exe-agent-config.js +7 -1
- package/dist/bin/exe-agent.js +28 -2
- package/dist/bin/exe-assign.js +54 -11
- package/dist/bin/exe-boot.js +481 -147
- package/dist/bin/exe-call.js +45 -4
- package/dist/bin/exe-cloud.js +93 -15
- package/dist/bin/exe-dispatch.js +369 -24
- package/dist/bin/exe-doctor.js +53 -10
- package/dist/bin/exe-export-behaviors.js +54 -11
- package/dist/bin/exe-forget.js +54 -11
- package/dist/bin/exe-gateway.js +128 -23
- package/dist/bin/exe-heartbeat.js +75 -15
- package/dist/bin/exe-kill.js +54 -11
- package/dist/bin/exe-launch-agent.js +70 -12
- package/dist/bin/exe-new-employee.js +175 -7
- package/dist/bin/exe-pending-messages.js +75 -15
- package/dist/bin/exe-pending-notifications.js +75 -15
- package/dist/bin/exe-pending-reviews.js +75 -15
- package/dist/bin/exe-rename.js +54 -11
- package/dist/bin/exe-review.js +54 -11
- package/dist/bin/exe-search.js +54 -11
- package/dist/bin/exe-session-cleanup.js +491 -146
- package/dist/bin/exe-settings.js +10 -4
- package/dist/bin/exe-start-codex.js +524 -245
- package/dist/bin/exe-start-opencode.js +534 -165
- package/dist/bin/exe-status.js +75 -15
- package/dist/bin/exe-support.js +1 -1
- package/dist/bin/exe-team.js +54 -11
- package/dist/bin/git-sweep.js +369 -24
- package/dist/bin/graph-backfill.js +54 -11
- package/dist/bin/graph-export.js +54 -11
- package/dist/bin/install.js +62 -4
- package/dist/bin/intercom-check.js +491 -146
- package/dist/bin/pre-publish.js +13 -1
- package/dist/bin/scan-tasks.js +369 -24
- package/dist/bin/setup.js +91 -13
- package/dist/bin/shard-migrate.js +54 -11
- package/dist/bin/stack-update.js +1 -1
- package/dist/bin/update.js +3 -3
- package/dist/gateway/index.js +128 -23
- package/dist/hooks/bug-report-worker.js +128 -23
- package/dist/hooks/codex-stop-task-finalizer.js +512 -140
- package/dist/hooks/commit-complete.js +369 -24
- package/dist/hooks/error-recall.js +54 -11
- package/dist/hooks/ingest.js +4575 -252
- package/dist/hooks/instructions-loaded.js +54 -11
- package/dist/hooks/notification.js +54 -11
- package/dist/hooks/post-compact.js +75 -15
- package/dist/hooks/post-tool-combined.js +75 -15
- package/dist/hooks/pre-compact.js +449 -104
- package/dist/hooks/pre-tool-use.js +90 -15
- package/dist/hooks/prompt-submit.js +129 -24
- package/dist/hooks/session-end.js +451 -109
- package/dist/hooks/session-start.js +104 -16
- package/dist/hooks/stop.js +74 -14
- package/dist/hooks/subagent-stop.js +75 -15
- package/dist/hooks/summary-worker.js +73 -7
- package/dist/index.js +128 -23
- package/dist/lib/agent-config.js +16 -1
- package/dist/lib/cloud-sync.js +38 -1
- package/dist/lib/consolidation.js +16 -1
- package/dist/lib/database.js +16 -0
- package/dist/lib/db.js +16 -0
- package/dist/lib/device-registry.js +16 -0
- package/dist/lib/employee-templates.js +29 -3
- package/dist/lib/employees.js +16 -1
- package/dist/lib/exe-daemon.js +268 -42
- package/dist/lib/hybrid-search.js +54 -11
- package/dist/lib/license.js +3 -3
- package/dist/lib/messaging.js +21 -4
- package/dist/lib/schedules.js +29 -1
- package/dist/lib/skill-learning.js +458 -70
- package/dist/lib/status-brief.js +14 -1
- package/dist/lib/store.js +54 -11
- package/dist/lib/tasks.js +393 -91
- package/dist/lib/tmux-routing.js +316 -14
- package/dist/mcp/server.js +169 -30
- package/dist/mcp/tools/create-task.js +75 -13
- package/dist/mcp/tools/deactivate-behavior.js +33 -24
- package/dist/mcp/tools/list-tasks.js +21 -4
- package/dist/mcp/tools/send-message.js +21 -4
- package/dist/mcp/tools/update-task.js +390 -91
- package/dist/runtime/index.js +446 -101
- package/dist/tui/App.js +208 -54
- package/package.json +1 -1
|
@@ -3288,6 +3288,22 @@ async function ensureSchema() {
|
|
|
3288
3288
|
} catch (e) {
|
|
3289
3289
|
logCatchDebug("migration", e);
|
|
3290
3290
|
}
|
|
3291
|
+
try {
|
|
3292
|
+
await client.execute({
|
|
3293
|
+
sql: `ALTER TABLE memories ADD COLUMN visibility TEXT DEFAULT 'private'`,
|
|
3294
|
+
args: []
|
|
3295
|
+
});
|
|
3296
|
+
} catch (e) {
|
|
3297
|
+
logCatchDebug("migration", e);
|
|
3298
|
+
}
|
|
3299
|
+
try {
|
|
3300
|
+
await client.execute({
|
|
3301
|
+
sql: `ALTER TABLE memories ADD COLUMN strength REAL DEFAULT 1.0`,
|
|
3302
|
+
args: []
|
|
3303
|
+
});
|
|
3304
|
+
} catch (e) {
|
|
3305
|
+
logCatchDebug("migration", e);
|
|
3306
|
+
}
|
|
3291
3307
|
}
|
|
3292
3308
|
async function disposeDatabase() {
|
|
3293
3309
|
if (_walCheckpointTimer) {
|
|
@@ -4411,11 +4427,17 @@ var init_platform_procedures = __esm({
|
|
|
4411
4427
|
content: "Founder -> coordinator (the executive agent, internally routed as 'COO') -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the coordinator does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
|
|
4412
4428
|
},
|
|
4413
4429
|
{
|
|
4414
|
-
title: "
|
|
4430
|
+
title: "Orchestration phase guidance \u2014 recommend, never trap",
|
|
4415
4431
|
domain: "workflow",
|
|
4416
4432
|
priority: "p1",
|
|
4417
4433
|
content: "New customers start best in Phase 1: founder \u2194 coordinator/Chief of Staff, building company context. Suggest Phase 2 executives when domain work repeats; suggest Phase 3 parallel execution only when review/permission gates are ready. This is guidance, not a blocker: users may jump phases anytime. Never overwrite their phase, role titles, identities, or custom org design."
|
|
4418
4434
|
},
|
|
4435
|
+
{
|
|
4436
|
+
title: "Routing slot vs display title \u2014 internal 'coo' is plumbing, not your name",
|
|
4437
|
+
domain: "identity",
|
|
4438
|
+
priority: "p0",
|
|
4439
|
+
content: "These procedures reference 'COO' as a shorthand for the coordinator role. This is an INTERNAL routing slot used by exe-os code (chain-of-command checks, dispatch logic, session detection). It is NOT your display title. Your actual title comes from your identity file's `title:` field \u2014 that is what you use externally: introductions, sign-offs, team comms, and any user-facing text. If your identity says `title: AI Chief of Staff`, you are the AI Chief of Staff. The routing slot stays `role: coo` for code compatibility \u2014 never rename it, but also never introduce yourself as 'COO' unless your identity file explicitly says so. The founder chose your title; respect it."
|
|
4440
|
+
},
|
|
4419
4441
|
{
|
|
4420
4442
|
title: "Single dispatch path \u2014 create_task only",
|
|
4421
4443
|
domain: "workflow",
|
|
@@ -4449,6 +4471,12 @@ var init_platform_procedures = __esm({
|
|
|
4449
4471
|
priority: "p0",
|
|
4450
4472
|
content: "NEVER: (1) Access the database directly \u2014 it's SQLCipher encrypted, always fails. Use MCP tools only. (2) Manually spawn tmux sessions \u2014 create_task handles it. (3) Run git checkout main \u2014 agents work in worktrees. (4) Modify another agent's in-progress task. (5) Push to remote \u2014 the COO reviews and pushes. (6) Skip update_task(done) \u2014 it's the ONLY way your work gets reviewed. (7) Run git init."
|
|
4451
4473
|
},
|
|
4474
|
+
{
|
|
4475
|
+
title: "Destructive operations \u2014 mandatory reviewer gate",
|
|
4476
|
+
domain: "security",
|
|
4477
|
+
priority: "p0",
|
|
4478
|
+
content: "Before ANY destructive operation (delete, remove, overwrite, drop, reset, force-push, truncate), you MUST: (1) Have your full task spec accessible \u2014 if you cannot read it, STOP and report to your reviewer. Never improvise destructive actions. (2) Confirm with your reviewer (assigned_by or COO) before executing. (3) If the task spec explicitly authorizes the operation, proceed \u2014 but log it. Violation = immediate task failure. This applies to ALL agents regardless of role."
|
|
4479
|
+
},
|
|
4452
4480
|
{
|
|
4453
4481
|
title: "Customer patch triage \u2014 upstream bug vs customization",
|
|
4454
4482
|
domain: "support",
|
|
@@ -4734,10 +4762,24 @@ function stableId(memoryId, type, content) {
|
|
|
4734
4762
|
return createHash2("sha256").update(`${memoryId}:${type}:${content}`).digest("hex").slice(0, 32);
|
|
4735
4763
|
}
|
|
4736
4764
|
function cleanText(text) {
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4765
|
+
let cleaned = text.replace(
|
|
4766
|
+
/```(\w*)\n(.*?)(?:\n[\s\S]*?)```/g,
|
|
4767
|
+
(_m, lang, firstLine) => `[code${lang ? `:${lang}` : ""}] ${firstLine.trim()}`
|
|
4768
|
+
);
|
|
4769
|
+
cleaned = cleaned.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
4770
|
+
return cleaned;
|
|
4771
|
+
}
|
|
4772
|
+
function splitSegments(text) {
|
|
4773
|
+
const cleaned = cleanText(text);
|
|
4774
|
+
const segments = cleaned.split(/(?<=[.!?:;])\s+|\n{2,}|(?<=\))\s+(?=[A-Z])|\s*[|│]\s*/).map((s) => s.trim()).filter((s) => s.length >= MIN_SEGMENT_CHARS && s.length <= MAX_SEGMENT_CHARS);
|
|
4775
|
+
if (segments.length === 0 && cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
4776
|
+
const lines = cleaned.split(/\n+/).map((l) => l.trim()).filter((l) => l.length >= MIN_SEGMENT_CHARS && l.length <= MAX_SEGMENT_CHARS);
|
|
4777
|
+
if (lines.length > 0) return lines;
|
|
4778
|
+
if (cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
4779
|
+
return [cleaned.slice(0, MAX_SEGMENT_CHARS)];
|
|
4780
|
+
}
|
|
4781
|
+
}
|
|
4782
|
+
return segments;
|
|
4741
4783
|
}
|
|
4742
4784
|
function inferCardType(sentence, toolName) {
|
|
4743
4785
|
const lower = sentence.toLowerCase();
|
|
@@ -4769,12 +4811,12 @@ function predicateFor(type) {
|
|
|
4769
4811
|
}
|
|
4770
4812
|
}
|
|
4771
4813
|
function extractMemoryCards(row) {
|
|
4772
|
-
const
|
|
4814
|
+
const segments = splitSegments(row.raw_text);
|
|
4773
4815
|
const cards = [];
|
|
4774
|
-
for (const sentence of
|
|
4816
|
+
for (const sentence of segments) {
|
|
4775
4817
|
const type = inferCardType(sentence, row.tool_name);
|
|
4776
4818
|
const subject = extractSubject(sentence, row.agent_id);
|
|
4777
|
-
const content = sentence.length >
|
|
4819
|
+
const content = sentence.length > MAX_SEGMENT_CHARS ? `${sentence.slice(0, MAX_SEGMENT_CHARS - 1)}\u2026` : sentence;
|
|
4778
4820
|
cards.push({
|
|
4779
4821
|
id: stableId(row.id, type, content),
|
|
4780
4822
|
memory_id: row.id,
|
|
@@ -4870,13 +4912,14 @@ Source memory: ${String(row.source_ref ?? row.memory_id)}`,
|
|
|
4870
4912
|
last_accessed: String(row.timestamp)
|
|
4871
4913
|
}));
|
|
4872
4914
|
}
|
|
4873
|
-
var MAX_CARDS_PER_MEMORY,
|
|
4915
|
+
var MAX_CARDS_PER_MEMORY, MAX_SEGMENT_CHARS, MIN_SEGMENT_CHARS;
|
|
4874
4916
|
var init_memory_cards = __esm({
|
|
4875
4917
|
"src/lib/memory-cards.ts"() {
|
|
4876
4918
|
"use strict";
|
|
4877
4919
|
init_database();
|
|
4878
|
-
MAX_CARDS_PER_MEMORY =
|
|
4879
|
-
|
|
4920
|
+
MAX_CARDS_PER_MEMORY = 8;
|
|
4921
|
+
MAX_SEGMENT_CHARS = 500;
|
|
4922
|
+
MIN_SEGMENT_CHARS = 20;
|
|
4880
4923
|
}
|
|
4881
4924
|
});
|
|
4882
4925
|
|
|
@@ -6111,7 +6154,7 @@ var init_license = __esm({
|
|
|
6111
6154
|
LICENSE_PATH = path11.join(EXE_AI_DIR, "license.key");
|
|
6112
6155
|
CACHE_PATH = path11.join(EXE_AI_DIR, "license-cache.json");
|
|
6113
6156
|
DEVICE_ID_PATH = path11.join(EXE_AI_DIR, "device-id");
|
|
6114
|
-
API_BASE = process.env.EXE_CLOUD_ENDPOINT ?? "https://askexe.com
|
|
6157
|
+
API_BASE = process.env.EXE_CLOUD_ENDPOINT ?? "https://cloud.askexe.com";
|
|
6115
6158
|
}
|
|
6116
6159
|
});
|
|
6117
6160
|
|
|
@@ -6164,6 +6207,18 @@ function extractRootExe(name) {
|
|
|
6164
6207
|
const parts = name.split("-").filter(Boolean);
|
|
6165
6208
|
return parts.length > 0 ? parts[parts.length - 1] : null;
|
|
6166
6209
|
}
|
|
6210
|
+
function registerParentExe(sessionKey, parentExe, dispatchedBy) {
|
|
6211
|
+
if (!existsSync14(SESSION_CACHE)) {
|
|
6212
|
+
mkdirSync7(SESSION_CACHE, { recursive: true });
|
|
6213
|
+
}
|
|
6214
|
+
const rootExe = extractRootExe(parentExe) ?? parentExe;
|
|
6215
|
+
const filePath = path14.join(SESSION_CACHE, `parent-exe-${sessionKey}.json`);
|
|
6216
|
+
writeFileSync6(filePath, JSON.stringify({
|
|
6217
|
+
parentExe: rootExe,
|
|
6218
|
+
dispatchedBy: dispatchedBy || rootExe,
|
|
6219
|
+
registeredAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
6220
|
+
}));
|
|
6221
|
+
}
|
|
6167
6222
|
function getParentExe(sessionKey) {
|
|
6168
6223
|
try {
|
|
6169
6224
|
const data = JSON.parse(readFileSync9(path14.join(SESSION_CACHE, `parent-exe-${sessionKey}.json`), "utf8"));
|
|
@@ -6173,11 +6228,12 @@ function getParentExe(sessionKey) {
|
|
|
6173
6228
|
}
|
|
6174
6229
|
}
|
|
6175
6230
|
function resolveExeSession() {
|
|
6231
|
+
if (process.env.EXE_SESSION_NAME) {
|
|
6232
|
+
const fromEnv = extractRootExe(process.env.EXE_SESSION_NAME) ?? process.env.EXE_SESSION_NAME;
|
|
6233
|
+
if (fromEnv) return fromEnv;
|
|
6234
|
+
}
|
|
6176
6235
|
const mySession = getMySession();
|
|
6177
6236
|
if (!mySession) {
|
|
6178
|
-
if (process.env.EXE_SESSION_NAME) {
|
|
6179
|
-
return extractRootExe(process.env.EXE_SESSION_NAME) ?? process.env.EXE_SESSION_NAME;
|
|
6180
|
-
}
|
|
6181
6237
|
return null;
|
|
6182
6238
|
}
|
|
6183
6239
|
const fromSessionName = extractRootExe(mySession);
|
|
@@ -6192,6 +6248,10 @@ function resolveExeSession() {
|
|
|
6192
6248
|
`[tmux-routing] WARN: cache says "${fromCache}" but session name says "${fromSessionName}". Trusting session name.
|
|
6193
6249
|
`
|
|
6194
6250
|
);
|
|
6251
|
+
try {
|
|
6252
|
+
registerParentExe(key, fromSessionName);
|
|
6253
|
+
} catch {
|
|
6254
|
+
}
|
|
6195
6255
|
candidate = fromSessionName;
|
|
6196
6256
|
} else {
|
|
6197
6257
|
candidate = fromCache;
|
package/dist/bin/exe-kill.js
CHANGED
|
@@ -3249,6 +3249,22 @@ async function ensureSchema() {
|
|
|
3249
3249
|
} catch (e) {
|
|
3250
3250
|
logCatchDebug("migration", e);
|
|
3251
3251
|
}
|
|
3252
|
+
try {
|
|
3253
|
+
await client.execute({
|
|
3254
|
+
sql: `ALTER TABLE memories ADD COLUMN visibility TEXT DEFAULT 'private'`,
|
|
3255
|
+
args: []
|
|
3256
|
+
});
|
|
3257
|
+
} catch (e) {
|
|
3258
|
+
logCatchDebug("migration", e);
|
|
3259
|
+
}
|
|
3260
|
+
try {
|
|
3261
|
+
await client.execute({
|
|
3262
|
+
sql: `ALTER TABLE memories ADD COLUMN strength REAL DEFAULT 1.0`,
|
|
3263
|
+
args: []
|
|
3264
|
+
});
|
|
3265
|
+
} catch (e) {
|
|
3266
|
+
logCatchDebug("migration", e);
|
|
3267
|
+
}
|
|
3252
3268
|
}
|
|
3253
3269
|
async function disposeDatabase() {
|
|
3254
3270
|
if (_walCheckpointTimer) {
|
|
@@ -4372,11 +4388,17 @@ var init_platform_procedures = __esm({
|
|
|
4372
4388
|
content: "Founder -> coordinator (the executive agent, internally routed as 'COO') -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the coordinator does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
|
|
4373
4389
|
},
|
|
4374
4390
|
{
|
|
4375
|
-
title: "
|
|
4391
|
+
title: "Orchestration phase guidance \u2014 recommend, never trap",
|
|
4376
4392
|
domain: "workflow",
|
|
4377
4393
|
priority: "p1",
|
|
4378
4394
|
content: "New customers start best in Phase 1: founder \u2194 coordinator/Chief of Staff, building company context. Suggest Phase 2 executives when domain work repeats; suggest Phase 3 parallel execution only when review/permission gates are ready. This is guidance, not a blocker: users may jump phases anytime. Never overwrite their phase, role titles, identities, or custom org design."
|
|
4379
4395
|
},
|
|
4396
|
+
{
|
|
4397
|
+
title: "Routing slot vs display title \u2014 internal 'coo' is plumbing, not your name",
|
|
4398
|
+
domain: "identity",
|
|
4399
|
+
priority: "p0",
|
|
4400
|
+
content: "These procedures reference 'COO' as a shorthand for the coordinator role. This is an INTERNAL routing slot used by exe-os code (chain-of-command checks, dispatch logic, session detection). It is NOT your display title. Your actual title comes from your identity file's `title:` field \u2014 that is what you use externally: introductions, sign-offs, team comms, and any user-facing text. If your identity says `title: AI Chief of Staff`, you are the AI Chief of Staff. The routing slot stays `role: coo` for code compatibility \u2014 never rename it, but also never introduce yourself as 'COO' unless your identity file explicitly says so. The founder chose your title; respect it."
|
|
4401
|
+
},
|
|
4380
4402
|
{
|
|
4381
4403
|
title: "Single dispatch path \u2014 create_task only",
|
|
4382
4404
|
domain: "workflow",
|
|
@@ -4410,6 +4432,12 @@ var init_platform_procedures = __esm({
|
|
|
4410
4432
|
priority: "p0",
|
|
4411
4433
|
content: "NEVER: (1) Access the database directly \u2014 it's SQLCipher encrypted, always fails. Use MCP tools only. (2) Manually spawn tmux sessions \u2014 create_task handles it. (3) Run git checkout main \u2014 agents work in worktrees. (4) Modify another agent's in-progress task. (5) Push to remote \u2014 the COO reviews and pushes. (6) Skip update_task(done) \u2014 it's the ONLY way your work gets reviewed. (7) Run git init."
|
|
4412
4434
|
},
|
|
4435
|
+
{
|
|
4436
|
+
title: "Destructive operations \u2014 mandatory reviewer gate",
|
|
4437
|
+
domain: "security",
|
|
4438
|
+
priority: "p0",
|
|
4439
|
+
content: "Before ANY destructive operation (delete, remove, overwrite, drop, reset, force-push, truncate), you MUST: (1) Have your full task spec accessible \u2014 if you cannot read it, STOP and report to your reviewer. Never improvise destructive actions. (2) Confirm with your reviewer (assigned_by or COO) before executing. (3) If the task spec explicitly authorizes the operation, proceed \u2014 but log it. Violation = immediate task failure. This applies to ALL agents regardless of role."
|
|
4440
|
+
},
|
|
4413
4441
|
{
|
|
4414
4442
|
title: "Customer patch triage \u2014 upstream bug vs customization",
|
|
4415
4443
|
domain: "support",
|
|
@@ -4695,10 +4723,24 @@ function stableId(memoryId, type, content) {
|
|
|
4695
4723
|
return createHash2("sha256").update(`${memoryId}:${type}:${content}`).digest("hex").slice(0, 32);
|
|
4696
4724
|
}
|
|
4697
4725
|
function cleanText(text) {
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4726
|
+
let cleaned = text.replace(
|
|
4727
|
+
/```(\w*)\n(.*?)(?:\n[\s\S]*?)```/g,
|
|
4728
|
+
(_m, lang, firstLine) => `[code${lang ? `:${lang}` : ""}] ${firstLine.trim()}`
|
|
4729
|
+
);
|
|
4730
|
+
cleaned = cleaned.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
4731
|
+
return cleaned;
|
|
4732
|
+
}
|
|
4733
|
+
function splitSegments(text) {
|
|
4734
|
+
const cleaned = cleanText(text);
|
|
4735
|
+
const segments = cleaned.split(/(?<=[.!?:;])\s+|\n{2,}|(?<=\))\s+(?=[A-Z])|\s*[|│]\s*/).map((s) => s.trim()).filter((s) => s.length >= MIN_SEGMENT_CHARS && s.length <= MAX_SEGMENT_CHARS);
|
|
4736
|
+
if (segments.length === 0 && cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
4737
|
+
const lines = cleaned.split(/\n+/).map((l) => l.trim()).filter((l) => l.length >= MIN_SEGMENT_CHARS && l.length <= MAX_SEGMENT_CHARS);
|
|
4738
|
+
if (lines.length > 0) return lines;
|
|
4739
|
+
if (cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
4740
|
+
return [cleaned.slice(0, MAX_SEGMENT_CHARS)];
|
|
4741
|
+
}
|
|
4742
|
+
}
|
|
4743
|
+
return segments;
|
|
4702
4744
|
}
|
|
4703
4745
|
function inferCardType(sentence, toolName) {
|
|
4704
4746
|
const lower = sentence.toLowerCase();
|
|
@@ -4730,12 +4772,12 @@ function predicateFor(type) {
|
|
|
4730
4772
|
}
|
|
4731
4773
|
}
|
|
4732
4774
|
function extractMemoryCards(row) {
|
|
4733
|
-
const
|
|
4775
|
+
const segments = splitSegments(row.raw_text);
|
|
4734
4776
|
const cards = [];
|
|
4735
|
-
for (const sentence of
|
|
4777
|
+
for (const sentence of segments) {
|
|
4736
4778
|
const type = inferCardType(sentence, row.tool_name);
|
|
4737
4779
|
const subject = extractSubject(sentence, row.agent_id);
|
|
4738
|
-
const content = sentence.length >
|
|
4780
|
+
const content = sentence.length > MAX_SEGMENT_CHARS ? `${sentence.slice(0, MAX_SEGMENT_CHARS - 1)}\u2026` : sentence;
|
|
4739
4781
|
cards.push({
|
|
4740
4782
|
id: stableId(row.id, type, content),
|
|
4741
4783
|
memory_id: row.id,
|
|
@@ -4831,13 +4873,14 @@ Source memory: ${String(row.source_ref ?? row.memory_id)}`,
|
|
|
4831
4873
|
last_accessed: String(row.timestamp)
|
|
4832
4874
|
}));
|
|
4833
4875
|
}
|
|
4834
|
-
var MAX_CARDS_PER_MEMORY,
|
|
4876
|
+
var MAX_CARDS_PER_MEMORY, MAX_SEGMENT_CHARS, MIN_SEGMENT_CHARS;
|
|
4835
4877
|
var init_memory_cards = __esm({
|
|
4836
4878
|
"src/lib/memory-cards.ts"() {
|
|
4837
4879
|
"use strict";
|
|
4838
4880
|
init_database();
|
|
4839
|
-
MAX_CARDS_PER_MEMORY =
|
|
4840
|
-
|
|
4881
|
+
MAX_CARDS_PER_MEMORY = 8;
|
|
4882
|
+
MAX_SEGMENT_CHARS = 500;
|
|
4883
|
+
MIN_SEGMENT_CHARS = 20;
|
|
4841
4884
|
}
|
|
4842
4885
|
});
|
|
4843
4886
|
|
|
@@ -3347,6 +3347,22 @@ async function ensureSchema() {
|
|
|
3347
3347
|
} catch (e) {
|
|
3348
3348
|
logCatchDebug("migration", e);
|
|
3349
3349
|
}
|
|
3350
|
+
try {
|
|
3351
|
+
await client.execute({
|
|
3352
|
+
sql: `ALTER TABLE memories ADD COLUMN visibility TEXT DEFAULT 'private'`,
|
|
3353
|
+
args: []
|
|
3354
|
+
});
|
|
3355
|
+
} catch (e) {
|
|
3356
|
+
logCatchDebug("migration", e);
|
|
3357
|
+
}
|
|
3358
|
+
try {
|
|
3359
|
+
await client.execute({
|
|
3360
|
+
sql: `ALTER TABLE memories ADD COLUMN strength REAL DEFAULT 1.0`,
|
|
3361
|
+
args: []
|
|
3362
|
+
});
|
|
3363
|
+
} catch (e) {
|
|
3364
|
+
logCatchDebug("migration", e);
|
|
3365
|
+
}
|
|
3350
3366
|
}
|
|
3351
3367
|
async function disposeDatabase() {
|
|
3352
3368
|
if (_walCheckpointTimer) {
|
|
@@ -4470,11 +4486,17 @@ var init_platform_procedures = __esm({
|
|
|
4470
4486
|
content: "Founder -> coordinator (the executive agent, internally routed as 'COO') -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the coordinator does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
|
|
4471
4487
|
},
|
|
4472
4488
|
{
|
|
4473
|
-
title: "
|
|
4489
|
+
title: "Orchestration phase guidance \u2014 recommend, never trap",
|
|
4474
4490
|
domain: "workflow",
|
|
4475
4491
|
priority: "p1",
|
|
4476
4492
|
content: "New customers start best in Phase 1: founder \u2194 coordinator/Chief of Staff, building company context. Suggest Phase 2 executives when domain work repeats; suggest Phase 3 parallel execution only when review/permission gates are ready. This is guidance, not a blocker: users may jump phases anytime. Never overwrite their phase, role titles, identities, or custom org design."
|
|
4477
4493
|
},
|
|
4494
|
+
{
|
|
4495
|
+
title: "Routing slot vs display title \u2014 internal 'coo' is plumbing, not your name",
|
|
4496
|
+
domain: "identity",
|
|
4497
|
+
priority: "p0",
|
|
4498
|
+
content: "These procedures reference 'COO' as a shorthand for the coordinator role. This is an INTERNAL routing slot used by exe-os code (chain-of-command checks, dispatch logic, session detection). It is NOT your display title. Your actual title comes from your identity file's `title:` field \u2014 that is what you use externally: introductions, sign-offs, team comms, and any user-facing text. If your identity says `title: AI Chief of Staff`, you are the AI Chief of Staff. The routing slot stays `role: coo` for code compatibility \u2014 never rename it, but also never introduce yourself as 'COO' unless your identity file explicitly says so. The founder chose your title; respect it."
|
|
4499
|
+
},
|
|
4478
4500
|
{
|
|
4479
4501
|
title: "Single dispatch path \u2014 create_task only",
|
|
4480
4502
|
domain: "workflow",
|
|
@@ -4508,6 +4530,12 @@ var init_platform_procedures = __esm({
|
|
|
4508
4530
|
priority: "p0",
|
|
4509
4531
|
content: "NEVER: (1) Access the database directly \u2014 it's SQLCipher encrypted, always fails. Use MCP tools only. (2) Manually spawn tmux sessions \u2014 create_task handles it. (3) Run git checkout main \u2014 agents work in worktrees. (4) Modify another agent's in-progress task. (5) Push to remote \u2014 the COO reviews and pushes. (6) Skip update_task(done) \u2014 it's the ONLY way your work gets reviewed. (7) Run git init."
|
|
4510
4532
|
},
|
|
4533
|
+
{
|
|
4534
|
+
title: "Destructive operations \u2014 mandatory reviewer gate",
|
|
4535
|
+
domain: "security",
|
|
4536
|
+
priority: "p0",
|
|
4537
|
+
content: "Before ANY destructive operation (delete, remove, overwrite, drop, reset, force-push, truncate), you MUST: (1) Have your full task spec accessible \u2014 if you cannot read it, STOP and report to your reviewer. Never improvise destructive actions. (2) Confirm with your reviewer (assigned_by or COO) before executing. (3) If the task spec explicitly authorizes the operation, proceed \u2014 but log it. Violation = immediate task failure. This applies to ALL agents regardless of role."
|
|
4538
|
+
},
|
|
4511
4539
|
{
|
|
4512
4540
|
title: "Customer patch triage \u2014 upstream bug vs customization",
|
|
4513
4541
|
domain: "support",
|
|
@@ -4793,10 +4821,24 @@ function stableId(memoryId, type, content) {
|
|
|
4793
4821
|
return createHash2("sha256").update(`${memoryId}:${type}:${content}`).digest("hex").slice(0, 32);
|
|
4794
4822
|
}
|
|
4795
4823
|
function cleanText(text) {
|
|
4796
|
-
|
|
4824
|
+
let cleaned = text.replace(
|
|
4825
|
+
/```(\w*)\n(.*?)(?:\n[\s\S]*?)```/g,
|
|
4826
|
+
(_m, lang, firstLine) => `[code${lang ? `:${lang}` : ""}] ${firstLine.trim()}`
|
|
4827
|
+
);
|
|
4828
|
+
cleaned = cleaned.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
4829
|
+
return cleaned;
|
|
4797
4830
|
}
|
|
4798
|
-
function
|
|
4799
|
-
|
|
4831
|
+
function splitSegments(text) {
|
|
4832
|
+
const cleaned = cleanText(text);
|
|
4833
|
+
const segments = cleaned.split(/(?<=[.!?:;])\s+|\n{2,}|(?<=\))\s+(?=[A-Z])|\s*[|│]\s*/).map((s) => s.trim()).filter((s) => s.length >= MIN_SEGMENT_CHARS && s.length <= MAX_SEGMENT_CHARS);
|
|
4834
|
+
if (segments.length === 0 && cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
4835
|
+
const lines = cleaned.split(/\n+/).map((l) => l.trim()).filter((l) => l.length >= MIN_SEGMENT_CHARS && l.length <= MAX_SEGMENT_CHARS);
|
|
4836
|
+
if (lines.length > 0) return lines;
|
|
4837
|
+
if (cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
4838
|
+
return [cleaned.slice(0, MAX_SEGMENT_CHARS)];
|
|
4839
|
+
}
|
|
4840
|
+
}
|
|
4841
|
+
return segments;
|
|
4800
4842
|
}
|
|
4801
4843
|
function inferCardType(sentence, toolName) {
|
|
4802
4844
|
const lower = sentence.toLowerCase();
|
|
@@ -4828,12 +4870,12 @@ function predicateFor(type) {
|
|
|
4828
4870
|
}
|
|
4829
4871
|
}
|
|
4830
4872
|
function extractMemoryCards(row) {
|
|
4831
|
-
const
|
|
4873
|
+
const segments = splitSegments(row.raw_text);
|
|
4832
4874
|
const cards = [];
|
|
4833
|
-
for (const sentence of
|
|
4875
|
+
for (const sentence of segments) {
|
|
4834
4876
|
const type = inferCardType(sentence, row.tool_name);
|
|
4835
4877
|
const subject = extractSubject(sentence, row.agent_id);
|
|
4836
|
-
const content = sentence.length >
|
|
4878
|
+
const content = sentence.length > MAX_SEGMENT_CHARS ? `${sentence.slice(0, MAX_SEGMENT_CHARS - 1)}\u2026` : sentence;
|
|
4837
4879
|
cards.push({
|
|
4838
4880
|
id: stableId(row.id, type, content),
|
|
4839
4881
|
memory_id: row.id,
|
|
@@ -4929,13 +4971,14 @@ Source memory: ${String(row.source_ref ?? row.memory_id)}`,
|
|
|
4929
4971
|
last_accessed: String(row.timestamp)
|
|
4930
4972
|
}));
|
|
4931
4973
|
}
|
|
4932
|
-
var MAX_CARDS_PER_MEMORY,
|
|
4974
|
+
var MAX_CARDS_PER_MEMORY, MAX_SEGMENT_CHARS, MIN_SEGMENT_CHARS;
|
|
4933
4975
|
var init_memory_cards = __esm({
|
|
4934
4976
|
"src/lib/memory-cards.ts"() {
|
|
4935
4977
|
"use strict";
|
|
4936
4978
|
init_database();
|
|
4937
|
-
MAX_CARDS_PER_MEMORY =
|
|
4938
|
-
|
|
4979
|
+
MAX_CARDS_PER_MEMORY = 8;
|
|
4980
|
+
MAX_SEGMENT_CHARS = 500;
|
|
4981
|
+
MIN_SEGMENT_CHARS = 20;
|
|
4939
4982
|
}
|
|
4940
4983
|
});
|
|
4941
4984
|
|
|
@@ -6529,9 +6572,23 @@ var PROCEDURES_MARKER = "EXE OS \u2014 VISION AND NON-NEGOTIABLE PRINCIPLES";
|
|
|
6529
6572
|
function getSessionPrompt(storedPrompt) {
|
|
6530
6573
|
const markerIndex = storedPrompt.indexOf(PROCEDURES_MARKER);
|
|
6531
6574
|
const withoutProcedures = markerIndex >= 0 ? storedPrompt.slice(0, markerIndex).trimEnd() : storedPrompt;
|
|
6575
|
+
let titlePrefix = "";
|
|
6576
|
+
const frontmatterMatch = withoutProcedures.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
6577
|
+
if (frontmatterMatch) {
|
|
6578
|
+
const titleMatch = frontmatterMatch[1].match(/^title:\s*(.+)$/m);
|
|
6579
|
+
const roleMatch = frontmatterMatch[1].match(/^role:\s*(.+)$/m);
|
|
6580
|
+
if (titleMatch) {
|
|
6581
|
+
const title = titleMatch[1].trim();
|
|
6582
|
+
const role = roleMatch ? roleMatch[1].trim() : "";
|
|
6583
|
+
if (title && role && title.toLowerCase() !== role.toLowerCase()) {
|
|
6584
|
+
titlePrefix = `## Your Identity
|
|
6585
|
+
You are **${title}** (specialist). `;
|
|
6586
|
+
}
|
|
6587
|
+
}
|
|
6588
|
+
}
|
|
6532
6589
|
const rolePrompt = withoutProcedures.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/, "").replace(/<!--[\s\S]*?-->/g, "").trimStart();
|
|
6533
6590
|
const globalBlock = getGlobalProceduresBlock();
|
|
6534
|
-
return `${globalBlock}${rolePrompt}
|
|
6591
|
+
return `${globalBlock}${titlePrefix}${rolePrompt}
|
|
6535
6592
|
${BASE_OPERATING_PROCEDURES}`;
|
|
6536
6593
|
}
|
|
6537
6594
|
|
|
@@ -6671,7 +6728,8 @@ function generateLeanMcpConfig(agent, role) {
|
|
|
6671
6728
|
const allowedNames = /* @__PURE__ */ new Set([...ALWAYS_INCLUDE_SERVERS, ...extraServers]);
|
|
6672
6729
|
const leanServers = {};
|
|
6673
6730
|
for (const [name, cfg] of Object.entries(allServers)) {
|
|
6674
|
-
|
|
6731
|
+
const isOAuthMcp = name.startsWith("plugin_") || name.startsWith("claude_ai_") || name.startsWith("claude-ai-") || typeof cfg === "object" && cfg !== null && ("oauth" in cfg || "type" in cfg && cfg.type === "sse");
|
|
6732
|
+
if (allowedNames.has(name) || isOAuthMcp) {
|
|
6675
6733
|
leanServers[name] = cfg;
|
|
6676
6734
|
}
|
|
6677
6735
|
}
|