@askexenow/exe-os 0.9.34 → 0.9.36
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/dist/bin/backfill-conversations.js +212 -11
- package/dist/bin/backfill-responses.js +212 -11
- package/dist/bin/backfill-vectors.js +14 -3
- package/dist/bin/cleanup-stale-review-tasks.js +224 -12
- package/dist/bin/cli.js +265 -23
- package/dist/bin/exe-agent.js +1 -1
- package/dist/bin/exe-assign.js +217 -12
- package/dist/bin/exe-boot.js +25 -4
- package/dist/bin/exe-call.js +7 -5
- package/dist/bin/exe-dispatch.js +229 -13
- package/dist/bin/exe-doctor.js +14 -3
- package/dist/bin/exe-export-behaviors.js +301 -14
- package/dist/bin/exe-forget.js +245 -21
- package/dist/bin/exe-gateway.js +229 -13
- package/dist/bin/exe-heartbeat.js +224 -12
- package/dist/bin/exe-kill.js +224 -12
- package/dist/bin/exe-launch-agent.js +177 -9
- package/dist/bin/exe-link.js +8 -0
- package/dist/bin/exe-new-employee.js +26 -2
- package/dist/bin/exe-pending-messages.js +224 -12
- package/dist/bin/exe-pending-notifications.js +224 -12
- package/dist/bin/exe-pending-reviews.js +224 -12
- package/dist/bin/exe-rename.js +9 -1
- package/dist/bin/exe-review.js +224 -12
- package/dist/bin/exe-search.js +246 -21
- package/dist/bin/exe-session-cleanup.js +229 -13
- package/dist/bin/exe-start-codex.js +161 -5
- package/dist/bin/exe-start-opencode.js +172 -5
- package/dist/bin/exe-status.js +224 -12
- package/dist/bin/exe-team.js +224 -12
- package/dist/bin/git-sweep.js +229 -13
- package/dist/bin/graph-backfill.js +94 -3
- package/dist/bin/graph-export.js +224 -12
- package/dist/bin/install.js +25 -1
- package/dist/bin/intercom-check.js +229 -13
- package/dist/bin/scan-tasks.js +229 -13
- package/dist/bin/setup.js +15 -5
- package/dist/bin/shard-migrate.js +94 -3
- package/dist/gateway/index.js +229 -13
- package/dist/hooks/bug-report-worker.js +229 -13
- package/dist/hooks/codex-stop-task-finalizer.js +224 -12
- package/dist/hooks/commit-complete.js +229 -13
- package/dist/hooks/error-recall.js +246 -21
- package/dist/hooks/ingest.js +224 -12
- package/dist/hooks/instructions-loaded.js +224 -12
- package/dist/hooks/notification.js +224 -12
- package/dist/hooks/post-compact.js +224 -12
- package/dist/hooks/post-tool-combined.js +246 -21
- package/dist/hooks/pre-compact.js +229 -13
- package/dist/hooks/pre-tool-use.js +234 -18
- package/dist/hooks/prompt-submit.js +346 -23
- package/dist/hooks/session-end.js +229 -13
- package/dist/hooks/session-start.js +418 -42
- package/dist/hooks/stop.js +224 -12
- package/dist/hooks/subagent-stop.js +224 -12
- package/dist/hooks/summary-worker.js +15 -2
- package/dist/index.js +229 -13
- package/dist/lib/cloud-sync.js +8 -0
- package/dist/lib/consolidation.js +3 -1
- package/dist/lib/database.js +8 -0
- package/dist/lib/db.js +8 -0
- package/dist/lib/device-registry.js +8 -0
- package/dist/lib/employee-templates.js +7 -5
- package/dist/lib/exe-daemon.js +1776 -1433
- package/dist/lib/hybrid-search.js +246 -21
- package/dist/lib/schedules.js +14 -3
- package/dist/lib/store.js +217 -12
- package/dist/lib/tasks.js +5 -1
- package/dist/lib/tmux-routing.js +5 -1
- package/dist/mcp/server.js +331 -37
- package/dist/mcp/tools/create-task.js +5 -1
- package/dist/mcp/tools/update-task.js +5 -1
- package/dist/runtime/index.js +229 -13
- package/dist/tui/App.js +229 -13
- package/package.json +1 -1
- package/src/commands/exe/save.md +48 -0
package/dist/bin/exe-dispatch.js
CHANGED
|
@@ -2867,6 +2867,14 @@ async function ensureSchema() {
|
|
|
2867
2867
|
);
|
|
2868
2868
|
} catch {
|
|
2869
2869
|
}
|
|
2870
|
+
try {
|
|
2871
|
+
await client.execute(
|
|
2872
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_scoped_content_hash
|
|
2873
|
+
ON memories(content_hash, agent_id, project_name, memory_type)
|
|
2874
|
+
WHERE content_hash IS NOT NULL`
|
|
2875
|
+
);
|
|
2876
|
+
} catch {
|
|
2877
|
+
}
|
|
2870
2878
|
await client.executeMultiple(`
|
|
2871
2879
|
CREATE TABLE IF NOT EXISTS entities (
|
|
2872
2880
|
id TEXT PRIMARY KEY,
|
|
@@ -6399,7 +6407,11 @@ function spawnEmployee(employeeName2, exeSession2, projectDir2, opts) {
|
|
|
6399
6407
|
}
|
|
6400
6408
|
if (!useExeAgent && !useCodex && !useOpencode && !useBinSymlink) {
|
|
6401
6409
|
if (agentRtConfig.runtime === "claude" && agentRtConfig.model) {
|
|
6402
|
-
|
|
6410
|
+
let ccModel = agentRtConfig.model.replace(/(\d+)\.(\d+)/g, "$1-$2");
|
|
6411
|
+
if (/claude-(opus|sonnet)-4-[6-9]/.test(ccModel) && !ccModel.includes("[1m]")) {
|
|
6412
|
+
ccModel += "[1m]";
|
|
6413
|
+
}
|
|
6414
|
+
envPrefix = `${envPrefix} ANTHROPIC_MODEL=${ccModel}`;
|
|
6403
6415
|
}
|
|
6404
6416
|
}
|
|
6405
6417
|
let spawnCommand;
|
|
@@ -6713,6 +6725,197 @@ var init_keychain = __esm({
|
|
|
6713
6725
|
}
|
|
6714
6726
|
});
|
|
6715
6727
|
|
|
6728
|
+
// src/lib/memory-write-governor.ts
|
|
6729
|
+
import { createHash } from "crypto";
|
|
6730
|
+
function normalizeMemoryText(text) {
|
|
6731
|
+
return text.replace(/\r\n/g, "\n").replace(/[ \t]+$/gm, "").replace(/\n{4,}/g, "\n\n\n").trim();
|
|
6732
|
+
}
|
|
6733
|
+
function classifyMemoryType(input) {
|
|
6734
|
+
if (input.memory_type && input.memory_type.trim()) return input.memory_type.trim();
|
|
6735
|
+
const tool = input.tool_name.toLowerCase();
|
|
6736
|
+
const text = input.raw_text.toLowerCase();
|
|
6737
|
+
if (tool.includes("store_decision") || tool.includes("decision")) return "decision";
|
|
6738
|
+
if (tool.includes("commit") || text.includes("adr-") || text.includes("architectural decision")) return "adr";
|
|
6739
|
+
if (tool.includes("store_behavior") || tool.includes("behavior")) return "behavior";
|
|
6740
|
+
if (tool.includes("global_procedure") || text.includes("organization-wide procedures")) return "procedure";
|
|
6741
|
+
if (tool.includes("send_whatsapp") || tool.includes("conversation")) return "conversation";
|
|
6742
|
+
if (tool === "store_memory" || tool === "manual") return "observation";
|
|
6743
|
+
return "raw";
|
|
6744
|
+
}
|
|
6745
|
+
function shouldDropMemory(text) {
|
|
6746
|
+
const normalized = normalizeMemoryText(text);
|
|
6747
|
+
if (normalized.length < 10) return { drop: true, reason: "too_short" };
|
|
6748
|
+
if (NOISE_DROP_PATTERNS.some((pattern) => pattern.test(normalized))) {
|
|
6749
|
+
return { drop: true, reason: "known_boilerplate_noise" };
|
|
6750
|
+
}
|
|
6751
|
+
return { drop: false };
|
|
6752
|
+
}
|
|
6753
|
+
function shouldSkipEmbedding(input) {
|
|
6754
|
+
const type = classifyMemoryType(input);
|
|
6755
|
+
if (HIGH_VALUE_SUPERSESSION_TYPES.has(type)) return false;
|
|
6756
|
+
if (type === "raw" && input.raw_text.length > 2e4) return true;
|
|
6757
|
+
if (SKIP_EMBED_PATTERNS.some((pattern) => pattern.test(input.raw_text))) return true;
|
|
6758
|
+
return false;
|
|
6759
|
+
}
|
|
6760
|
+
function hashMemoryContent(text) {
|
|
6761
|
+
return createHash("sha256").update(normalizeMemoryText(text)).digest("hex");
|
|
6762
|
+
}
|
|
6763
|
+
function scopedDedupArgs(input) {
|
|
6764
|
+
return [input.contentHash, input.agentId, input.projectName, input.memoryType];
|
|
6765
|
+
}
|
|
6766
|
+
function governMemoryRecord(record) {
|
|
6767
|
+
const normalized = normalizeMemoryText(record.raw_text);
|
|
6768
|
+
const memoryType = classifyMemoryType({
|
|
6769
|
+
raw_text: normalized,
|
|
6770
|
+
agent_id: record.agent_id,
|
|
6771
|
+
project_name: record.project_name,
|
|
6772
|
+
tool_name: record.tool_name,
|
|
6773
|
+
memory_type: record.memory_type
|
|
6774
|
+
});
|
|
6775
|
+
const drop = shouldDropMemory(normalized);
|
|
6776
|
+
const skipEmbedding = shouldSkipEmbedding({
|
|
6777
|
+
raw_text: normalized,
|
|
6778
|
+
agent_id: record.agent_id,
|
|
6779
|
+
project_name: record.project_name,
|
|
6780
|
+
tool_name: record.tool_name,
|
|
6781
|
+
memory_type: memoryType
|
|
6782
|
+
});
|
|
6783
|
+
return {
|
|
6784
|
+
record: {
|
|
6785
|
+
...record,
|
|
6786
|
+
raw_text: normalized,
|
|
6787
|
+
memory_type: memoryType,
|
|
6788
|
+
vector: skipEmbedding ? null : record.vector
|
|
6789
|
+
},
|
|
6790
|
+
contentHash: hashMemoryContent(normalized),
|
|
6791
|
+
shouldDrop: drop.drop,
|
|
6792
|
+
dropReason: drop.reason,
|
|
6793
|
+
skipEmbedding,
|
|
6794
|
+
hygiene: {
|
|
6795
|
+
dedup: true,
|
|
6796
|
+
supersession: HIGH_VALUE_SUPERSESSION_TYPES.has(memoryType)
|
|
6797
|
+
}
|
|
6798
|
+
};
|
|
6799
|
+
}
|
|
6800
|
+
async function findScopedDuplicate(input) {
|
|
6801
|
+
const { getClient: getClient2 } = await Promise.resolve().then(() => (init_database(), database_exports));
|
|
6802
|
+
const client = getClient2();
|
|
6803
|
+
const args = scopedDedupArgs(input);
|
|
6804
|
+
let sql = `SELECT id FROM memories
|
|
6805
|
+
WHERE content_hash = ?
|
|
6806
|
+
AND agent_id = ?
|
|
6807
|
+
AND project_name = ?
|
|
6808
|
+
AND COALESCE(memory_type, 'raw') = ?
|
|
6809
|
+
AND COALESCE(status, 'active') != 'deleted'`;
|
|
6810
|
+
if (input.excludeId) {
|
|
6811
|
+
sql += " AND id != ?";
|
|
6812
|
+
args.push(input.excludeId);
|
|
6813
|
+
}
|
|
6814
|
+
sql += " ORDER BY timestamp DESC LIMIT 1";
|
|
6815
|
+
const result2 = await client.execute({ sql, args });
|
|
6816
|
+
return result2.rows[0]?.id ? String(result2.rows[0].id) : null;
|
|
6817
|
+
}
|
|
6818
|
+
async function runPostWriteMemoryHygiene(memoryId) {
|
|
6819
|
+
try {
|
|
6820
|
+
const { getClient: getClient2 } = await Promise.resolve().then(() => (init_database(), database_exports));
|
|
6821
|
+
const client = getClient2();
|
|
6822
|
+
const current = await client.execute({
|
|
6823
|
+
sql: `SELECT id, agent_id, project_name, memory_type, content_hash, supersedes_id,
|
|
6824
|
+
importance, timestamp
|
|
6825
|
+
FROM memories
|
|
6826
|
+
WHERE id = ?
|
|
6827
|
+
LIMIT 1`,
|
|
6828
|
+
args: [memoryId]
|
|
6829
|
+
});
|
|
6830
|
+
const row = current.rows[0];
|
|
6831
|
+
if (!row) return;
|
|
6832
|
+
const memoryType = String(row.memory_type ?? "raw");
|
|
6833
|
+
const contentHash = row.content_hash ? String(row.content_hash) : null;
|
|
6834
|
+
const agentId = String(row.agent_id);
|
|
6835
|
+
const projectName = String(row.project_name);
|
|
6836
|
+
if (contentHash) {
|
|
6837
|
+
await client.execute({
|
|
6838
|
+
sql: `UPDATE memories
|
|
6839
|
+
SET status = 'deleted',
|
|
6840
|
+
outcome = COALESCE(outcome, 'superseded')
|
|
6841
|
+
WHERE id != ?
|
|
6842
|
+
AND content_hash = ?
|
|
6843
|
+
AND agent_id = ?
|
|
6844
|
+
AND project_name = ?
|
|
6845
|
+
AND COALESCE(memory_type, 'raw') = ?
|
|
6846
|
+
AND COALESCE(status, 'active') = 'active'`,
|
|
6847
|
+
args: [memoryId, contentHash, agentId, projectName, memoryType]
|
|
6848
|
+
});
|
|
6849
|
+
}
|
|
6850
|
+
const supersedesId = row.supersedes_id ? String(row.supersedes_id) : null;
|
|
6851
|
+
if (supersedesId && HIGH_VALUE_SUPERSESSION_TYPES.has(memoryType)) {
|
|
6852
|
+
const old = await client.execute({
|
|
6853
|
+
sql: `SELECT importance FROM memories WHERE id = ? LIMIT 1`,
|
|
6854
|
+
args: [supersedesId]
|
|
6855
|
+
});
|
|
6856
|
+
const oldImportance = Number(old.rows[0]?.importance ?? 0);
|
|
6857
|
+
const newImportance = Number(row.importance ?? 0);
|
|
6858
|
+
await client.batch([
|
|
6859
|
+
{
|
|
6860
|
+
sql: `UPDATE memories
|
|
6861
|
+
SET status = 'archived',
|
|
6862
|
+
outcome = COALESCE(outcome, 'superseded')
|
|
6863
|
+
WHERE id = ?`,
|
|
6864
|
+
args: [supersedesId]
|
|
6865
|
+
},
|
|
6866
|
+
{
|
|
6867
|
+
sql: `UPDATE memories
|
|
6868
|
+
SET importance = MAX(COALESCE(importance, 5), ?),
|
|
6869
|
+
parent_memory_id = COALESCE(parent_memory_id, ?)
|
|
6870
|
+
WHERE id = ?`,
|
|
6871
|
+
args: [Math.max(oldImportance, newImportance), supersedesId, memoryId]
|
|
6872
|
+
}
|
|
6873
|
+
], "write");
|
|
6874
|
+
}
|
|
6875
|
+
} catch (err) {
|
|
6876
|
+
process.stderr.write(
|
|
6877
|
+
`[memory-governor] post-write hygiene failed for ${memoryId}: ${err instanceof Error ? err.message : String(err)}
|
|
6878
|
+
`
|
|
6879
|
+
);
|
|
6880
|
+
}
|
|
6881
|
+
}
|
|
6882
|
+
function schedulePostWriteMemoryHygiene(memoryIds) {
|
|
6883
|
+
if (process.env.EXE_SKIP_MEMORY_HYGIENE === "1") return;
|
|
6884
|
+
if (memoryIds.length === 0) return;
|
|
6885
|
+
const run = () => {
|
|
6886
|
+
void Promise.all(memoryIds.map((id) => runPostWriteMemoryHygiene(id)));
|
|
6887
|
+
};
|
|
6888
|
+
if (typeof setImmediate === "function") setImmediate(run);
|
|
6889
|
+
else setTimeout(run, 0);
|
|
6890
|
+
}
|
|
6891
|
+
var HIGH_VALUE_SUPERSESSION_TYPES, NOISE_DROP_PATTERNS, SKIP_EMBED_PATTERNS;
|
|
6892
|
+
var init_memory_write_governor = __esm({
|
|
6893
|
+
"src/lib/memory-write-governor.ts"() {
|
|
6894
|
+
"use strict";
|
|
6895
|
+
HIGH_VALUE_SUPERSESSION_TYPES = /* @__PURE__ */ new Set([
|
|
6896
|
+
"decision",
|
|
6897
|
+
"adr",
|
|
6898
|
+
"behavior",
|
|
6899
|
+
"procedure"
|
|
6900
|
+
]);
|
|
6901
|
+
NOISE_DROP_PATTERNS = [
|
|
6902
|
+
/^\s*\[📋\s+\d+\s+reviews?\s+pending\b/im,
|
|
6903
|
+
/^\s*<system-reminder>[\s\S]*?<\/system-reminder>\s*$/im,
|
|
6904
|
+
/^\s*The UserPromptSubmit hook checks the DB for new tasks/im,
|
|
6905
|
+
/^\s*Intercom is a speedup, not delivery/im,
|
|
6906
|
+
/^\s*Context bar reads as USAGE not remaining/im
|
|
6907
|
+
];
|
|
6908
|
+
SKIP_EMBED_PATTERNS = [
|
|
6909
|
+
/tmux capture-pane\b/i,
|
|
6910
|
+
/docker ps\b/i,
|
|
6911
|
+
/docker images\b/i,
|
|
6912
|
+
/git status\b/i,
|
|
6913
|
+
/grep .*node_modules/i,
|
|
6914
|
+
/npm (install|ci)\b[\s\S]*(added \d+ packages|audited \d+ packages)/i
|
|
6915
|
+
];
|
|
6916
|
+
}
|
|
6917
|
+
});
|
|
6918
|
+
|
|
6716
6919
|
// src/lib/shard-manager.ts
|
|
6717
6920
|
var shard_manager_exports = {};
|
|
6718
6921
|
__export(shard_manager_exports, {
|
|
@@ -6877,7 +7080,8 @@ async function ensureShardSchema(client) {
|
|
|
6877
7080
|
}
|
|
6878
7081
|
for (const idx of [
|
|
6879
7082
|
"CREATE INDEX IF NOT EXISTS idx_memories_tier ON memories(tier)",
|
|
6880
|
-
"CREATE INDEX IF NOT EXISTS idx_memories_supersedes ON memories(supersedes_id) WHERE supersedes_id IS NOT NULL"
|
|
7083
|
+
"CREATE INDEX IF NOT EXISTS idx_memories_supersedes ON memories(supersedes_id) WHERE supersedes_id IS NOT NULL",
|
|
7084
|
+
"CREATE INDEX IF NOT EXISTS idx_memories_scoped_content_hash ON memories(content_hash, agent_id, project_name, memory_type) WHERE content_hash IS NOT NULL"
|
|
6881
7085
|
]) {
|
|
6882
7086
|
try {
|
|
6883
7087
|
await client.execute(idx);
|
|
@@ -7071,7 +7275,7 @@ var init_platform_procedures = __esm({
|
|
|
7071
7275
|
title: "Chain of command \u2014 who talks to whom",
|
|
7072
7276
|
domain: "workflow",
|
|
7073
7277
|
priority: "p0",
|
|
7074
|
-
content: "Founder -> COO -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the
|
|
7278
|
+
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."
|
|
7075
7279
|
},
|
|
7076
7280
|
{
|
|
7077
7281
|
title: "Single dispatch path \u2014 create_task only",
|
|
@@ -7302,7 +7506,6 @@ __export(store_exports, {
|
|
|
7302
7506
|
vectorToBlob: () => vectorToBlob,
|
|
7303
7507
|
writeMemory: () => writeMemory
|
|
7304
7508
|
});
|
|
7305
|
-
import { createHash } from "crypto";
|
|
7306
7509
|
function isBusyError2(err) {
|
|
7307
7510
|
if (err instanceof Error) {
|
|
7308
7511
|
const msg = err.message.toLowerCase();
|
|
@@ -7416,17 +7619,24 @@ async function writeMemory(record) {
|
|
|
7416
7619
|
`Expected ${EMBEDDING_DIM}-dim vector, got ${record.vector.length}`
|
|
7417
7620
|
);
|
|
7418
7621
|
}
|
|
7419
|
-
const
|
|
7420
|
-
if (
|
|
7622
|
+
const governed = governMemoryRecord(record);
|
|
7623
|
+
if (governed.shouldDrop) return;
|
|
7624
|
+
record = governed.record;
|
|
7625
|
+
const contentHash = governed.contentHash;
|
|
7626
|
+
const memoryType = record.memory_type ?? "raw";
|
|
7627
|
+
if (_pendingRecords.some(
|
|
7628
|
+
(r) => r.content_hash === contentHash && r.agent_id === record.agent_id && r.project_name === record.project_name && (r.memory_type ?? "raw") === memoryType
|
|
7629
|
+
)) {
|
|
7421
7630
|
return;
|
|
7422
7631
|
}
|
|
7423
7632
|
try {
|
|
7424
|
-
const
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7633
|
+
const existing = await findScopedDuplicate({
|
|
7634
|
+
contentHash,
|
|
7635
|
+
agentId: record.agent_id,
|
|
7636
|
+
projectName: record.project_name,
|
|
7637
|
+
memoryType
|
|
7428
7638
|
});
|
|
7429
|
-
if (existing
|
|
7639
|
+
if (existing) return;
|
|
7430
7640
|
} catch {
|
|
7431
7641
|
}
|
|
7432
7642
|
const dbRow = {
|
|
@@ -7457,7 +7667,7 @@ async function writeMemory(record) {
|
|
|
7457
7667
|
tier: record.tier ?? classifyTier(record),
|
|
7458
7668
|
supersedes_id: record.supersedes_id ?? null,
|
|
7459
7669
|
draft: record.draft ? 1 : 0,
|
|
7460
|
-
memory_type:
|
|
7670
|
+
memory_type: memoryType,
|
|
7461
7671
|
trajectory: record.trajectory ? JSON.stringify(record.trajectory) : null,
|
|
7462
7672
|
content_hash: contentHash,
|
|
7463
7673
|
intent: record.intent ?? null,
|
|
@@ -7616,6 +7826,7 @@ async function flushBatch() {
|
|
|
7616
7826
|
const globalClient = getClient();
|
|
7617
7827
|
const globalStmts = batch.map(buildStmt);
|
|
7618
7828
|
await globalClient.batch(globalStmts, "write");
|
|
7829
|
+
schedulePostWriteMemoryHygiene(batch.map((row) => row.id));
|
|
7619
7830
|
_pendingRecords.splice(0, batch.length);
|
|
7620
7831
|
try {
|
|
7621
7832
|
const { isShardingEnabled: isShardingEnabled2, getReadyShardClient: getReadyShardClient2 } = await Promise.resolve().then(() => (init_shard_manager(), shard_manager_exports));
|
|
@@ -7736,7 +7947,11 @@ async function searchMemories(queryVector, agentId, options) {
|
|
|
7736
7947
|
sql += ` AND timestamp >= ?`;
|
|
7737
7948
|
args.push(options.since);
|
|
7738
7949
|
}
|
|
7739
|
-
if (options?.
|
|
7950
|
+
if (options?.memoryTypes && options.memoryTypes.length > 0) {
|
|
7951
|
+
const uniqueTypes = [...new Set(options.memoryTypes)];
|
|
7952
|
+
sql += ` AND memory_type IN (${uniqueTypes.map(() => "?").join(",")})`;
|
|
7953
|
+
args.push(...uniqueTypes);
|
|
7954
|
+
} else if (options?.memoryType) {
|
|
7740
7955
|
sql += ` AND memory_type = ?`;
|
|
7741
7956
|
args.push(options.memoryType);
|
|
7742
7957
|
}
|
|
@@ -7874,6 +8089,7 @@ var init_store = __esm({
|
|
|
7874
8089
|
init_keychain();
|
|
7875
8090
|
init_config();
|
|
7876
8091
|
init_state_bus();
|
|
8092
|
+
init_memory_write_governor();
|
|
7877
8093
|
INIT_MAX_RETRIES = 3;
|
|
7878
8094
|
INIT_RETRY_DELAY_MS = 1e3;
|
|
7879
8095
|
_pendingRecords = [];
|
package/dist/bin/exe-doctor.js
CHANGED
|
@@ -2073,6 +2073,14 @@ async function ensureSchema() {
|
|
|
2073
2073
|
);
|
|
2074
2074
|
} catch {
|
|
2075
2075
|
}
|
|
2076
|
+
try {
|
|
2077
|
+
await client.execute(
|
|
2078
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_scoped_content_hash
|
|
2079
|
+
ON memories(content_hash, agent_id, project_name, memory_type)
|
|
2080
|
+
WHERE content_hash IS NOT NULL`
|
|
2081
|
+
);
|
|
2082
|
+
} catch {
|
|
2083
|
+
}
|
|
2076
2084
|
await client.executeMultiple(`
|
|
2077
2085
|
CREATE TABLE IF NOT EXISTS entities (
|
|
2078
2086
|
id TEXT PRIMARY KEY,
|
|
@@ -2742,7 +2750,8 @@ async function ensureShardSchema(client) {
|
|
|
2742
2750
|
}
|
|
2743
2751
|
for (const idx of [
|
|
2744
2752
|
"CREATE INDEX IF NOT EXISTS idx_memories_tier ON memories(tier)",
|
|
2745
|
-
"CREATE INDEX IF NOT EXISTS idx_memories_supersedes ON memories(supersedes_id) WHERE supersedes_id IS NOT NULL"
|
|
2753
|
+
"CREATE INDEX IF NOT EXISTS idx_memories_supersedes ON memories(supersedes_id) WHERE supersedes_id IS NOT NULL",
|
|
2754
|
+
"CREATE INDEX IF NOT EXISTS idx_memories_scoped_content_hash ON memories(content_hash, agent_id, project_name, memory_type) WHERE content_hash IS NOT NULL"
|
|
2746
2755
|
]) {
|
|
2747
2756
|
try {
|
|
2748
2757
|
await client.execute(idx);
|
|
@@ -2936,7 +2945,7 @@ var init_platform_procedures = __esm({
|
|
|
2936
2945
|
title: "Chain of command \u2014 who talks to whom",
|
|
2937
2946
|
domain: "workflow",
|
|
2938
2947
|
priority: "p0",
|
|
2939
|
-
content: "Founder -> COO -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the
|
|
2948
|
+
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."
|
|
2940
2949
|
},
|
|
2941
2950
|
{
|
|
2942
2951
|
title: "Single dispatch path \u2014 create_task only",
|
|
@@ -3368,7 +3377,6 @@ import os6 from "os";
|
|
|
3368
3377
|
// src/lib/store.ts
|
|
3369
3378
|
init_memory();
|
|
3370
3379
|
init_database();
|
|
3371
|
-
import { createHash } from "crypto";
|
|
3372
3380
|
|
|
3373
3381
|
// src/lib/keychain.ts
|
|
3374
3382
|
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
|
|
@@ -3601,6 +3609,9 @@ var StateBus = class {
|
|
|
3601
3609
|
};
|
|
3602
3610
|
var orgBus = new StateBus();
|
|
3603
3611
|
|
|
3612
|
+
// src/lib/memory-write-governor.ts
|
|
3613
|
+
import { createHash } from "crypto";
|
|
3614
|
+
|
|
3604
3615
|
// src/lib/store.ts
|
|
3605
3616
|
var INIT_MAX_RETRIES = 3;
|
|
3606
3617
|
var INIT_RETRY_DELAY_MS = 1e3;
|