agent-recall-mcp 3.3.2 → 3.3.4
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/index.js +6 -13
- package/dist/index.js.map +1 -1
- package/dist/resources/journal-resources.d.ts.map +1 -1
- package/dist/resources/journal-resources.js +5 -29
- package/dist/resources/journal-resources.js.map +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/tools/alignment-check.d.ts.map +1 -1
- package/dist/tools/alignment-check.js +3 -54
- package/dist/tools/alignment-check.js.map +1 -1
- package/dist/tools/awareness-update.d.ts +2 -8
- package/dist/tools/awareness-update.d.ts.map +1 -1
- package/dist/tools/awareness-update.js +3 -66
- package/dist/tools/awareness-update.js.map +1 -1
- package/dist/tools/context-synthesize.d.ts.map +1 -1
- package/dist/tools/context-synthesize.js +6 -187
- package/dist/tools/context-synthesize.js.map +1 -1
- package/dist/tools/journal-archive.d.ts.map +1 -1
- package/dist/tools/journal-archive.js +3 -48
- package/dist/tools/journal-archive.js.map +1 -1
- package/dist/tools/journal-capture.d.ts.map +1 -1
- package/dist/tools/journal-capture.js +3 -60
- package/dist/tools/journal-capture.js.map +1 -1
- package/dist/tools/journal-cold-start.d.ts.map +1 -1
- package/dist/tools/journal-cold-start.js +10 -52
- package/dist/tools/journal-cold-start.js.map +1 -1
- package/dist/tools/journal-list.d.ts.map +1 -1
- package/dist/tools/journal-list.js +3 -23
- package/dist/tools/journal-list.js.map +1 -1
- package/dist/tools/journal-projects.d.ts.map +1 -1
- package/dist/tools/journal-projects.js +3 -16
- package/dist/tools/journal-projects.js.map +1 -1
- package/dist/tools/journal-read.d.ts.map +1 -1
- package/dist/tools/journal-read.js +5 -45
- package/dist/tools/journal-read.js.map +1 -1
- package/dist/tools/journal-rollup.d.ts +3 -0
- package/dist/tools/journal-rollup.d.ts.map +1 -0
- package/dist/tools/journal-rollup.js +21 -0
- package/dist/tools/journal-rollup.js.map +1 -0
- package/dist/tools/journal-search.d.ts.map +1 -1
- package/dist/tools/journal-search.js +3 -91
- package/dist/tools/journal-search.js.map +1 -1
- package/dist/tools/journal-state.d.ts +0 -3
- package/dist/tools/journal-state.d.ts.map +1 -1
- package/dist/tools/journal-state.js +5 -93
- package/dist/tools/journal-state.js.map +1 -1
- package/dist/tools/journal-write.d.ts.map +1 -1
- package/dist/tools/journal-write.js +3 -62
- package/dist/tools/journal-write.js.map +1 -1
- package/dist/tools/knowledge-read.d.ts.map +1 -1
- package/dist/tools/knowledge-read.js +3 -100
- package/dist/tools/knowledge-read.js.map +1 -1
- package/dist/tools/knowledge-write.d.ts.map +1 -1
- package/dist/tools/knowledge-write.js +3 -66
- package/dist/tools/knowledge-write.js.map +1 -1
- package/dist/tools/nudge.d.ts.map +1 -1
- package/dist/tools/nudge.js +3 -25
- package/dist/tools/nudge.js.map +1 -1
- package/dist/tools/palace-lint.d.ts +2 -6
- package/dist/tools/palace-lint.d.ts.map +1 -1
- package/dist/tools/palace-lint.js +3 -135
- package/dist/tools/palace-lint.js.map +1 -1
- package/dist/tools/palace-read.d.ts +2 -5
- package/dist/tools/palace-read.d.ts.map +1 -1
- package/dist/tools/palace-read.js +5 -62
- package/dist/tools/palace-read.js.map +1 -1
- package/dist/tools/palace-search.d.ts +2 -5
- package/dist/tools/palace-search.d.ts.map +1 -1
- package/dist/tools/palace-search.js +3 -66
- package/dist/tools/palace-search.js.map +1 -1
- package/dist/tools/palace-walk.d.ts +2 -11
- package/dist/tools/palace-walk.d.ts.map +1 -1
- package/dist/tools/palace-walk.js +3 -149
- package/dist/tools/palace-walk.js.map +1 -1
- package/dist/tools/palace-write.d.ts +2 -5
- package/dist/tools/palace-write.d.ts.map +1 -1
- package/dist/tools/palace-write.js +3 -90
- package/dist/tools/palace-write.js.map +1 -1
- package/dist/tools/recall-insight.d.ts +2 -8
- package/dist/tools/recall-insight.d.ts.map +1 -1
- package/dist/tools/recall-insight.js +3 -35
- package/dist/tools/recall-insight.js.map +1 -1
- package/package.json +9 -46
- package/README.md +0 -435
- package/dist/helpers/journal-files.d.ts +0 -30
- package/dist/helpers/journal-files.d.ts.map +0 -1
- package/dist/helpers/journal-files.js +0 -96
- package/dist/helpers/journal-files.js.map +0 -1
- package/dist/helpers/sections.d.ts +0 -12
- package/dist/helpers/sections.d.ts.map +0 -1
- package/dist/helpers/sections.js +0 -84
- package/dist/helpers/sections.js.map +0 -1
- package/dist/palace/awareness.d.ts +0 -67
- package/dist/palace/awareness.d.ts.map +0 -1
- package/dist/palace/awareness.js +0 -231
- package/dist/palace/awareness.js.map +0 -1
- package/dist/palace/consolidate.d.ts +0 -28
- package/dist/palace/consolidate.d.ts.map +0 -1
- package/dist/palace/consolidate.js +0 -129
- package/dist/palace/consolidate.js.map +0 -1
- package/dist/palace/fan-out.d.ts +0 -15
- package/dist/palace/fan-out.d.ts.map +0 -1
- package/dist/palace/fan-out.js +0 -78
- package/dist/palace/fan-out.js.map +0 -1
- package/dist/palace/graph.d.ts +0 -11
- package/dist/palace/graph.d.ts.map +0 -1
- package/dist/palace/graph.js +0 -59
- package/dist/palace/graph.js.map +0 -1
- package/dist/palace/identity.d.ts +0 -6
- package/dist/palace/identity.d.ts.map +0 -1
- package/dist/palace/identity.js +0 -18
- package/dist/palace/identity.js.map +0 -1
- package/dist/palace/index-manager.d.ts +0 -7
- package/dist/palace/index-manager.d.ts.map +0 -1
- package/dist/palace/index-manager.js +0 -46
- package/dist/palace/index-manager.js.map +0 -1
- package/dist/palace/insights-index.d.ts +0 -39
- package/dist/palace/insights-index.d.ts.map +0 -1
- package/dist/palace/insights-index.js +0 -101
- package/dist/palace/insights-index.js.map +0 -1
- package/dist/palace/log.d.ts +0 -9
- package/dist/palace/log.d.ts.map +0 -1
- package/dist/palace/log.js +0 -28
- package/dist/palace/log.js.map +0 -1
- package/dist/palace/obsidian.d.ts +0 -12
- package/dist/palace/obsidian.d.ts.map +0 -1
- package/dist/palace/obsidian.js +0 -76
- package/dist/palace/obsidian.js.map +0 -1
- package/dist/palace/rooms.d.ts +0 -14
- package/dist/palace/rooms.d.ts.map +0 -1
- package/dist/palace/rooms.js +0 -117
- package/dist/palace/rooms.js.map +0 -1
- package/dist/palace/salience.d.ts +0 -15
- package/dist/palace/salience.d.ts.map +0 -1
- package/dist/palace/salience.js +0 -33
- package/dist/palace/salience.js.map +0 -1
- package/dist/storage/fs-utils.d.ts +0 -8
- package/dist/storage/fs-utils.d.ts.map +0 -1
- package/dist/storage/fs-utils.js +0 -28
- package/dist/storage/fs-utils.js.map +0 -1
- package/dist/storage/paths.d.ts +0 -21
- package/dist/storage/paths.d.ts.map +0 -1
- package/dist/storage/paths.js +0 -59
- package/dist/storage/paths.js.map +0 -1
- package/dist/storage/project.d.ts +0 -17
- package/dist/storage/project.d.ts.map +0 -1
- package/dist/storage/project.js +0 -130
- package/dist/storage/project.js.map +0 -1
- package/dist/types.d.ts +0 -112
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -31
- package/dist/types.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
-
import { VERSION,
|
|
3
|
+
import { VERSION, getRoot, getLegacyRoot } from "agent-recall-core";
|
|
4
4
|
import { server } from "./server.js";
|
|
5
5
|
// Import all tool registrations
|
|
6
6
|
import { register as registerJournalRead } from "./tools/journal-read.js";
|
|
@@ -12,6 +12,7 @@ import { register as registerJournalSearch } from "./tools/journal-search.js";
|
|
|
12
12
|
import { register as registerJournalState } from "./tools/journal-state.js";
|
|
13
13
|
import { register as registerJournalColdStart } from "./tools/journal-cold-start.js";
|
|
14
14
|
import { register as registerJournalArchive } from "./tools/journal-archive.js";
|
|
15
|
+
import { register as registerJournalRollup } from "./tools/journal-rollup.js";
|
|
15
16
|
import { register as registerAlignmentCheck } from "./tools/alignment-check.js";
|
|
16
17
|
import { register as registerNudge } from "./tools/nudge.js";
|
|
17
18
|
import { register as registerContextSynthesize } from "./tools/context-synthesize.js";
|
|
@@ -25,9 +26,6 @@ import { register as registerPalaceSearch } from "./tools/palace-search.js";
|
|
|
25
26
|
import { register as registerAwarenessUpdate } from "./tools/awareness-update.js";
|
|
26
27
|
import { register as registerRecallInsight } from "./tools/recall-insight.js";
|
|
27
28
|
import { register as registerJournalResources } from "./resources/journal-resources.js";
|
|
28
|
-
// ---------------------------------------------------------------------------
|
|
29
|
-
// CLI flags (handle before MCP starts)
|
|
30
|
-
// ---------------------------------------------------------------------------
|
|
31
29
|
const args = process.argv.slice(2);
|
|
32
30
|
if (args.includes("--help") || args.includes("-h")) {
|
|
33
31
|
process.stdout.write(`agent-recall-mcp v${VERSION}
|
|
@@ -39,8 +37,8 @@ Usage:
|
|
|
39
37
|
npx agent-recall-mcp --help Show this help
|
|
40
38
|
npx agent-recall-mcp --list-tools List available MCP tools
|
|
41
39
|
|
|
42
|
-
Storage: ${
|
|
43
|
-
Legacy: ${
|
|
40
|
+
Storage: ${getRoot()}
|
|
41
|
+
Legacy: ${getLegacyRoot()}
|
|
44
42
|
|
|
45
43
|
All data stays local. No cloud, no telemetry.
|
|
46
44
|
`);
|
|
@@ -60,6 +58,7 @@ if (args.includes("--list-tools")) {
|
|
|
60
58
|
{ name: "journal_state", description: "Layer 1 JSON state: read/write structured session data (v3)" },
|
|
61
59
|
{ name: "journal_cold_start", description: "Cache-aware cold start: hot/warm/cold entries (v3)" },
|
|
62
60
|
{ name: "journal_archive", description: "Archive old entries to cold storage (v3)" },
|
|
61
|
+
{ name: "journal_rollup", description: "Condense old daily journals into weekly summaries (v3.4)" },
|
|
63
62
|
{ name: "knowledge_write", description: "Write a structured lesson to a category-specific knowledge file" },
|
|
64
63
|
{ name: "knowledge_read", description: "Read lessons from knowledge files, optionally filtered by project/category/query" },
|
|
65
64
|
{ name: "palace_read", description: "Read a room or list all rooms in the Memory Palace" },
|
|
@@ -73,9 +72,6 @@ if (args.includes("--list-tools")) {
|
|
|
73
72
|
process.stdout.write(JSON.stringify(tools, null, 2) + "\n");
|
|
74
73
|
process.exit(0);
|
|
75
74
|
}
|
|
76
|
-
// ---------------------------------------------------------------------------
|
|
77
|
-
// Register all tools
|
|
78
|
-
// ---------------------------------------------------------------------------
|
|
79
75
|
registerJournalRead(server);
|
|
80
76
|
registerJournalWrite(server);
|
|
81
77
|
registerJournalCapture(server);
|
|
@@ -85,6 +81,7 @@ registerJournalSearch(server);
|
|
|
85
81
|
registerJournalState(server);
|
|
86
82
|
registerJournalColdStart(server);
|
|
87
83
|
registerJournalArchive(server);
|
|
84
|
+
registerJournalRollup(server);
|
|
88
85
|
registerAlignmentCheck(server);
|
|
89
86
|
registerNudge(server);
|
|
90
87
|
registerContextSynthesize(server);
|
|
@@ -97,11 +94,7 @@ registerPalaceLint(server);
|
|
|
97
94
|
registerPalaceSearch(server);
|
|
98
95
|
registerAwarenessUpdate(server);
|
|
99
96
|
registerRecallInsight(server);
|
|
100
|
-
// Register resources
|
|
101
97
|
registerJournalResources(server);
|
|
102
|
-
// ---------------------------------------------------------------------------
|
|
103
|
-
// Start
|
|
104
|
-
// ---------------------------------------------------------------------------
|
|
105
98
|
async function main() {
|
|
106
99
|
const transport = new StdioServerTransport();
|
|
107
100
|
await server.connect(transport);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,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Root":"","sources":["../../src/resources/journal-resources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"journal-resources.d.ts","sourceRoot":"","sources":["../../src/resources/journal-resources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMzE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAoDhD"}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import * as fs from "node:fs";
|
|
3
3
|
import * as path from "node:path";
|
|
4
|
-
import { journalDir } from "
|
|
5
|
-
import { todayISO } from "../storage/fs-utils.js";
|
|
6
|
-
import { listAllProjects } from "../storage/project.js";
|
|
7
|
-
import { listJournalFiles, readJournalFile } from "../helpers/journal-files.js";
|
|
4
|
+
import { journalDir, todayISO, listAllProjects, listJournalFiles, readJournalFile } from "agent-recall-core";
|
|
8
5
|
export function register(server) {
|
|
9
|
-
// Resource: project index
|
|
10
6
|
server.registerResource("Journal Index", new ResourceTemplate("agent-recall://{project}/index", {
|
|
11
7
|
list: async () => {
|
|
12
8
|
const projects = listAllProjects();
|
|
@@ -28,15 +24,8 @@ export function register(server) {
|
|
|
28
24
|
else {
|
|
29
25
|
content = `# ${slug} — No journal index found\n`;
|
|
30
26
|
}
|
|
31
|
-
return {
|
|
32
|
-
contents: [{
|
|
33
|
-
uri: uri.href,
|
|
34
|
-
text: content,
|
|
35
|
-
mimeType: "text/markdown",
|
|
36
|
-
}],
|
|
37
|
-
};
|
|
27
|
+
return { contents: [{ uri: uri.href, text: content, mimeType: "text/markdown" }] };
|
|
38
28
|
});
|
|
39
|
-
// Resource: specific date entry
|
|
40
29
|
server.registerResource("Journal Entry", new ResourceTemplate("agent-recall://{project}/{date}", {
|
|
41
30
|
list: async () => {
|
|
42
31
|
const projects = listAllProjects();
|
|
@@ -44,29 +33,16 @@ export function register(server) {
|
|
|
44
33
|
for (const p of projects) {
|
|
45
34
|
const entries = listJournalFiles(p.slug).slice(0, 5);
|
|
46
35
|
for (const e of entries) {
|
|
47
|
-
resources.push({
|
|
48
|
-
uri: `agent-recall://${p.slug}/${e.date}`,
|
|
49
|
-
name: `${p.slug} — ${e.date}`,
|
|
50
|
-
mimeType: "text/markdown",
|
|
51
|
-
});
|
|
36
|
+
resources.push({ uri: `agent-recall://${p.slug}/${e.date}`, name: `${p.slug} — ${e.date}`, mimeType: "text/markdown" });
|
|
52
37
|
}
|
|
53
38
|
}
|
|
54
39
|
return { resources };
|
|
55
40
|
},
|
|
56
|
-
}), {
|
|
57
|
-
description: "A specific journal entry by date",
|
|
58
|
-
mimeType: "text/markdown",
|
|
59
|
-
}, async (uri, { project, date }) => {
|
|
41
|
+
}), { description: "A specific journal entry by date", mimeType: "text/markdown" }, async (uri, { project, date }) => {
|
|
60
42
|
const slug = Array.isArray(project) ? project[0] : (project || "unknown");
|
|
61
43
|
const entryDate = Array.isArray(date) ? date[0] : (date || todayISO());
|
|
62
44
|
const content = readJournalFile(slug, entryDate);
|
|
63
|
-
return {
|
|
64
|
-
contents: [{
|
|
65
|
-
uri: uri.href,
|
|
66
|
-
text: content || `# No entry for ${entryDate}\n`,
|
|
67
|
-
mimeType: "text/markdown",
|
|
68
|
-
}],
|
|
69
|
-
};
|
|
45
|
+
return { contents: [{ uri: uri.href, text: content || `# No entry for ${entryDate}\n`, mimeType: "text/markdown" }] };
|
|
70
46
|
});
|
|
71
47
|
}
|
|
72
48
|
//# sourceMappingURL=journal-resources.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journal-resources.js","sourceRoot":"","sources":["../../src/resources/journal-resources.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;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G,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE;QAC/B,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,SAAS,CAAC,CAAC;QAC1E,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,QAAQ,EAAE,CAAC,CAAC;QACvE,MAAM,OAAO,GAAG,eAAe,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QACjD,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,IAAI,kBAAkB,SAAS,IAAI,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,EAAE,CAAC;IACxH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/server.js
CHANGED
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IAClC,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alignment-check.d.ts","sourceRoot":"","sources":["../../src/tools/alignment-check.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"alignment-check.d.ts","sourceRoot":"","sources":["../../src/tools/alignment-check.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAmBhD"}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
-
import
|
|
3
|
-
import * as path from "node:path";
|
|
4
|
-
import { resolveProject } from "../storage/project.js";
|
|
5
|
-
import { journalDir, palaceDir } from "../storage/paths.js";
|
|
6
|
-
import { ensureDir, todayISO } from "../storage/fs-utils.js";
|
|
7
|
-
import { ensurePalaceInitialized, roomExists } from "../palace/rooms.js";
|
|
8
|
-
import { updatePalaceIndex } from "../palace/index-manager.js";
|
|
2
|
+
import { alignmentCheck } from "agent-recall-core";
|
|
9
3
|
export function register(server) {
|
|
10
4
|
server.registerTool("alignment_check", {
|
|
11
5
|
title: "Alignment Check",
|
|
@@ -21,53 +15,8 @@ export function register(server) {
|
|
|
21
15
|
project: z.string().default("auto"),
|
|
22
16
|
},
|
|
23
17
|
}, async ({ goal, confidence, assumptions, unclear, human_correction, delta, category, project }) => {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
const dir = journalDir(slug);
|
|
27
|
-
ensureDir(dir);
|
|
28
|
-
const time = new Date().toISOString().slice(11, 19);
|
|
29
|
-
const assumeStr = assumptions?.length ? assumptions.map(a => ` - ${a}`).join("\n") : " (none)";
|
|
30
|
-
let entry = `### Alignment (${time})\n`;
|
|
31
|
-
entry += `**Goal**: ${goal}\n**Confidence**: ${confidence}\n**Category**: ${category}\n`;
|
|
32
|
-
entry += `**Assumptions**:\n${assumeStr}\n`;
|
|
33
|
-
if (unclear)
|
|
34
|
-
entry += `**Unclear**: ${unclear}\n`;
|
|
35
|
-
if (human_correction)
|
|
36
|
-
entry += `**Human**: ${human_correction}\n**Delta**: ${delta || "not specified"}\n`;
|
|
37
|
-
entry += "\n";
|
|
38
|
-
const logPath = path.join(dir, `${date}-alignment.md`);
|
|
39
|
-
if (!fs.existsSync(logPath)) {
|
|
40
|
-
fs.writeFileSync(logPath, `# ${date} — Alignment Records\n\n---\n\n${entry}`, "utf-8");
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
fs.appendFileSync(logPath, entry, "utf-8");
|
|
44
|
-
}
|
|
45
|
-
// Palace integration: also write to alignment room
|
|
46
|
-
try {
|
|
47
|
-
ensurePalaceInitialized(slug);
|
|
48
|
-
if (roomExists(slug, "alignment")) {
|
|
49
|
-
const pd = palaceDir(slug);
|
|
50
|
-
const alignFile = path.join(pd, "rooms", "alignment", `${category}.md`);
|
|
51
|
-
ensureDir(path.dirname(alignFile));
|
|
52
|
-
const palaceEntry = `\n### ${date} ${time} — ${confidence}\n**Goal**: ${goal}\n`;
|
|
53
|
-
if (human_correction) {
|
|
54
|
-
const corrEntry = palaceEntry + `**Human correction**: ${human_correction}\n**Delta**: ${delta || "pending"}\n`;
|
|
55
|
-
if (fs.existsSync(alignFile)) {
|
|
56
|
-
fs.appendFileSync(alignFile, corrEntry, "utf-8");
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
fs.writeFileSync(alignFile, `# alignment / ${category}\n${corrEntry}`, "utf-8");
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
updatePalaceIndex(slug);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
catch {
|
|
66
|
-
// Palace integration is optional
|
|
67
|
-
}
|
|
68
|
-
return {
|
|
69
|
-
content: [{ type: "text", text: JSON.stringify({ success: true, date, confidence, delta: delta || "pending", file: logPath }) }],
|
|
70
|
-
};
|
|
18
|
+
const result = await alignmentCheck({ goal, confidence, assumptions, unclear, human_correction, delta, category, project });
|
|
19
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
71
20
|
});
|
|
72
21
|
}
|
|
73
22
|
//# sourceMappingURL=alignment-check.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alignment-check.js","sourceRoot":"","sources":["../../src/tools/alignment-check.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,
|
|
1
|
+
{"version":3,"file":"alignment-check.js","sourceRoot":"","sources":["../../src/tools/alignment-check.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,UAAU,QAAQ,CAAC,MAAiB;IACxC,MAAM,CAAC,YAAY,CAAC,iBAAiB,EAAE;QACrC,KAAK,EAAE,iBAAiB;QACxB,WAAW,EACT,oHAAoH;QACtH,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;YAC9D,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,oBAAoB,CAAC;YAC5E,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;YAC1E,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;YACrE,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;YACrF,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;YAC3D,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;YACzF,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;SACpC;KACF,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAClG,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;QAC5H,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;IAChF,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* Called at end of session. Merges new insights into the living awareness.md.
|
|
5
|
-
* The 200-line constraint forces compression and compounding.
|
|
6
|
-
*/
|
|
7
|
-
import type { ServerType } from "../server.js";
|
|
8
|
-
export declare function register(server: ServerType): void;
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
export declare function register(server: McpServer): void;
|
|
9
3
|
//# sourceMappingURL=awareness-update.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"awareness-update.d.ts","sourceRoot":"","sources":["../../src/tools/awareness-update.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"awareness-update.d.ts","sourceRoot":"","sources":["../../src/tools/awareness-update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAwBhD"}
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool: awareness_update — Update the awareness system with new insights.
|
|
3
|
-
*
|
|
4
|
-
* Called at end of session. Merges new insights into the living awareness.md.
|
|
5
|
-
* The 200-line constraint forces compression and compounding.
|
|
6
|
-
*/
|
|
7
1
|
import * as z from "zod/v4";
|
|
8
|
-
import {
|
|
9
|
-
import { addIndexedInsight } from "../palace/insights-index.js";
|
|
2
|
+
import { awarenessUpdate } from "agent-recall-core";
|
|
10
3
|
export function register(server) {
|
|
11
4
|
server.registerTool("awareness_update", {
|
|
12
5
|
title: "Update Awareness",
|
|
@@ -27,64 +20,8 @@ export function register(server) {
|
|
|
27
20
|
identity: z.string().optional().describe("Update user identity (only on first use or major change)"),
|
|
28
21
|
},
|
|
29
22
|
}, async ({ insights, trajectory, blind_spots, identity }) => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (!state) {
|
|
33
|
-
state = initAwareness(identity || "(unknown user)");
|
|
34
|
-
}
|
|
35
|
-
// Update identity if provided
|
|
36
|
-
if (identity) {
|
|
37
|
-
state.identity = identity;
|
|
38
|
-
}
|
|
39
|
-
// Process each insight
|
|
40
|
-
const results = [];
|
|
41
|
-
for (const insight of insights) {
|
|
42
|
-
const result = addInsight({
|
|
43
|
-
title: insight.title,
|
|
44
|
-
evidence: insight.evidence,
|
|
45
|
-
appliesWhen: insight.applies_when,
|
|
46
|
-
source: insight.source,
|
|
47
|
-
});
|
|
48
|
-
results.push({ title: insight.title, action: result.action });
|
|
49
|
-
// Also add to cross-project insights index
|
|
50
|
-
addIndexedInsight({
|
|
51
|
-
title: insight.title,
|
|
52
|
-
source: insight.source,
|
|
53
|
-
applies_when: insight.applies_when,
|
|
54
|
-
file: undefined,
|
|
55
|
-
severity: insight.severity,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
// Update trajectory
|
|
59
|
-
if (trajectory) {
|
|
60
|
-
state = readAwarenessState();
|
|
61
|
-
state.trajectory = trajectory;
|
|
62
|
-
}
|
|
63
|
-
// Update blind spots
|
|
64
|
-
if (blind_spots && blind_spots.length > 0) {
|
|
65
|
-
state = readAwarenessState();
|
|
66
|
-
state.blindSpots = blind_spots.slice(0, 5);
|
|
67
|
-
}
|
|
68
|
-
// Save and render
|
|
69
|
-
if (state) {
|
|
70
|
-
state.lastUpdated = new Date().toISOString();
|
|
71
|
-
const { writeAwarenessState } = await import("../palace/awareness.js");
|
|
72
|
-
writeAwarenessState(state);
|
|
73
|
-
renderAwareness(state);
|
|
74
|
-
}
|
|
75
|
-
// Detect compound insights
|
|
76
|
-
const compounds = detectCompoundInsights();
|
|
77
|
-
return {
|
|
78
|
-
content: [{
|
|
79
|
-
type: "text",
|
|
80
|
-
text: JSON.stringify({
|
|
81
|
-
success: true,
|
|
82
|
-
insights_processed: results,
|
|
83
|
-
compound_insights_detected: compounds.length,
|
|
84
|
-
total_insights: readAwarenessState()?.topInsights.length ?? 0,
|
|
85
|
-
}),
|
|
86
|
-
}],
|
|
87
|
-
};
|
|
23
|
+
const result = await awarenessUpdate({ insights, trajectory, blind_spots, identity });
|
|
24
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
88
25
|
});
|
|
89
26
|
}
|
|
90
27
|
//# sourceMappingURL=awareness-update.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"awareness-update.js","sourceRoot":"","sources":["../../src/tools/awareness-update.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"awareness-update.js","sourceRoot":"","sources":["../../src/tools/awareness-update.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,UAAU,QA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AE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,CAAC;QACtF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;IAChF,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-synthesize.d.ts","sourceRoot":"","sources":["../../src/tools/context-synthesize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"context-synthesize.d.ts","sourceRoot":"","sources":["../../src/tools/context-synthesize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAoBhD"}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
-
import
|
|
3
|
-
import * as path from "node:path";
|
|
4
|
-
import { resolveProject } from "../storage/project.js";
|
|
5
|
-
import { journalDir, palaceDir } from "../storage/paths.js";
|
|
6
|
-
import { ensureDir, todayISO } from "../storage/fs-utils.js";
|
|
7
|
-
import { listJournalFiles } from "../helpers/journal-files.js";
|
|
8
|
-
import { extractSection } from "../helpers/sections.js";
|
|
9
|
-
import { ensurePalaceInitialized, listRooms, roomExists, createRoom } from "../palace/rooms.js";
|
|
10
|
-
import { fanOut } from "../palace/fan-out.js";
|
|
11
|
-
import { generateFrontmatter } from "../palace/obsidian.js";
|
|
12
|
-
import { updatePalaceIndex } from "../palace/index-manager.js";
|
|
2
|
+
import { contextSynthesize } from "agent-recall-core";
|
|
13
3
|
export function register(server) {
|
|
14
4
|
server.registerTool("context_synthesize", {
|
|
15
5
|
title: "Synthesize Context",
|
|
@@ -22,183 +12,12 @@ export function register(server) {
|
|
|
22
12
|
consolidate: z.boolean().default(false).describe("Write synthesis results into palace rooms"),
|
|
23
13
|
project: z.string().default("auto"),
|
|
24
14
|
},
|
|
25
|
-
}, async ({ entries
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return { content: [{ type: "text", text: JSON.stringify({ error: `No entries for '${slug}'` }) }], isError: true };
|
|
15
|
+
}, async ({ entries, focus, include_palace, consolidate, project }) => {
|
|
16
|
+
const result = await contextSynthesize({ entries, focus, include_palace, consolidate, project });
|
|
17
|
+
if (result.error) {
|
|
18
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }], isError: true };
|
|
30
19
|
}
|
|
31
|
-
|
|
32
|
-
const data = [];
|
|
33
|
-
for (const entry of toRead) {
|
|
34
|
-
const content = fs.readFileSync(path.join(entry.dir, entry.file), "utf-8");
|
|
35
|
-
data.push({
|
|
36
|
-
date: entry.date,
|
|
37
|
-
brief: extractSection(content, "brief"),
|
|
38
|
-
decisions: extractSection(content, "decisions"),
|
|
39
|
-
blockers: extractSection(content, "blockers"),
|
|
40
|
-
next: extractSection(content, "next"),
|
|
41
|
-
observations: extractSection(content, "observations"),
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
let syn = `# L3 Synthesis — ${slug}\n`;
|
|
45
|
-
syn += `> ${toRead.length} entries: ${toRead[toRead.length - 1]?.date} → ${toRead[0]?.date}\n\n`;
|
|
46
|
-
// Goal evolution
|
|
47
|
-
if (focus === "full" || focus === "goals") {
|
|
48
|
-
syn += `## Goal Evolution\n\n`;
|
|
49
|
-
for (const e of data) {
|
|
50
|
-
if (e.brief)
|
|
51
|
-
syn += `**${e.date}**: ${e.brief.split("\n")[0]}\n`;
|
|
52
|
-
}
|
|
53
|
-
syn += "\n";
|
|
54
|
-
}
|
|
55
|
-
// Decisions
|
|
56
|
-
if (focus === "full" || focus === "decisions") {
|
|
57
|
-
syn += `## Decisions\n\n`;
|
|
58
|
-
const allDecisions = [];
|
|
59
|
-
for (const e of data) {
|
|
60
|
-
if (e.decisions)
|
|
61
|
-
allDecisions.push(`**${e.date}**:\n${e.decisions}\n`);
|
|
62
|
-
}
|
|
63
|
-
syn += allDecisions.length > 0 ? allDecisions.join("\n") : "(none recorded)\n";
|
|
64
|
-
if (allDecisions.length >= 2) {
|
|
65
|
-
syn += "\n### Potential Contradictions\n\n";
|
|
66
|
-
syn += "Review the decisions above. Flag if:\n";
|
|
67
|
-
syn += "- A decision from an earlier date was reversed without explanation\n";
|
|
68
|
-
syn += "- The same topic has conflicting approaches across dates\n";
|
|
69
|
-
syn += "- A goal stated in one entry differs from another\n\n";
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
// Blockers
|
|
73
|
-
if (focus === "full" || focus === "blockers") {
|
|
74
|
-
syn += `## Active Blockers\n\n`;
|
|
75
|
-
const latest = data.find(e => e.blockers);
|
|
76
|
-
syn += latest ? `**${latest.date}**:\n${latest.blockers}\n\n` : "(none)\n\n";
|
|
77
|
-
const oldBlockers = data.filter(e => e.blockers && e !== latest);
|
|
78
|
-
if (oldBlockers.length > 0) {
|
|
79
|
-
syn += "### Recurring Blockers (appeared in older entries too)\n\n";
|
|
80
|
-
for (const ob of oldBlockers.slice(0, 2)) {
|
|
81
|
-
syn += `**${ob.date}**: ${ob.blockers?.split("\n")[0] || ""}\n`;
|
|
82
|
-
}
|
|
83
|
-
syn += "\n";
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
// Observations
|
|
87
|
-
if (focus === "full") {
|
|
88
|
-
const obs = data.filter(e => e.observations);
|
|
89
|
-
if (obs.length > 0) {
|
|
90
|
-
syn += `## Patterns from Agent Observations\n\n`;
|
|
91
|
-
for (const o of obs.slice(0, 3)) {
|
|
92
|
-
syn += `**${o.date}**: ${o.observations?.split("\n").slice(0, 2).join(" ") || ""}\n`;
|
|
93
|
-
}
|
|
94
|
-
syn += "\n";
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
// Today's alignment
|
|
98
|
-
const alignPath = path.join(journalDir(slug), `${todayISO()}-alignment.md`);
|
|
99
|
-
if (fs.existsSync(alignPath)) {
|
|
100
|
-
const alignContent = fs.readFileSync(alignPath, "utf-8");
|
|
101
|
-
const checks = (alignContent.match(/### .*Alignment/g) || []).length;
|
|
102
|
-
const nudges = (alignContent.match(/### .*Nudge/g) || []).length;
|
|
103
|
-
const low = (alignContent.match(/Confidence: low/g) || []).length;
|
|
104
|
-
if (checks > 0 || nudges > 0) {
|
|
105
|
-
syn += `## Today's Alignment\n\n`;
|
|
106
|
-
syn += `- Alignment checks: ${checks}\n- Nudges: ${nudges}\n- Low confidence: ${low}\n\n`;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
// Palace room summaries
|
|
110
|
-
let palaceRoomCount = 0;
|
|
111
|
-
if (include_palace) {
|
|
112
|
-
try {
|
|
113
|
-
ensurePalaceInitialized(slug);
|
|
114
|
-
const rooms = listRooms(slug);
|
|
115
|
-
if (rooms.length > 0) {
|
|
116
|
-
syn += `## Memory Palace — Room Summaries\n\n`;
|
|
117
|
-
for (const room of rooms.slice(0, 5)) {
|
|
118
|
-
syn += `- **${room.name}** (salience: ${room.salience.toFixed(2)}) — ${room.description}\n`;
|
|
119
|
-
if (room.connections.length > 0) {
|
|
120
|
-
syn += ` Connected to: ${room.connections.join(", ")}\n`;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
syn += "\n";
|
|
124
|
-
palaceRoomCount = rooms.length;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
catch {
|
|
128
|
-
// Palace not initialized, skip
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
// Consolidation: write synthesis into palace rooms
|
|
132
|
-
let consolidated = 0;
|
|
133
|
-
if (consolidate) {
|
|
134
|
-
try {
|
|
135
|
-
ensurePalaceInitialized(slug);
|
|
136
|
-
const pd = palaceDir(slug);
|
|
137
|
-
const date = todayISO();
|
|
138
|
-
// Consolidate decisions → architecture room
|
|
139
|
-
const decisionsData = data.filter(e => e.decisions).map(e => `**${e.date}**: ${e.decisions}`).join("\n");
|
|
140
|
-
if (decisionsData) {
|
|
141
|
-
if (!roomExists(slug, "architecture")) {
|
|
142
|
-
createRoom(slug, "architecture", "Architecture", "Technical decisions and patterns", ["technical"]);
|
|
143
|
-
}
|
|
144
|
-
const decPath = path.join(pd, "rooms", "architecture", "decisions.md");
|
|
145
|
-
ensureDir(path.dirname(decPath));
|
|
146
|
-
const entry = `\n### Consolidated ${date}\n\n${decisionsData}\n`;
|
|
147
|
-
if (fs.existsSync(decPath)) {
|
|
148
|
-
fs.appendFileSync(decPath, entry, "utf-8");
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
const fm = generateFrontmatter({ room: "architecture", topic: "decisions", created: new Date().toISOString(), source: "consolidation" });
|
|
152
|
-
fs.writeFileSync(decPath, `${fm}# architecture / decisions\n${entry}`, "utf-8");
|
|
153
|
-
}
|
|
154
|
-
fanOut(slug, "architecture", "decisions", decisionsData, ["goals"], "high");
|
|
155
|
-
consolidated++;
|
|
156
|
-
}
|
|
157
|
-
// Consolidate goals → goals room
|
|
158
|
-
const goalsData = data.filter(e => e.brief).map(e => `**${e.date}**: ${e.brief?.split("\n")[0]}`).join("\n");
|
|
159
|
-
if (goalsData) {
|
|
160
|
-
const evoPath = path.join(pd, "rooms", "goals", "evolution.md");
|
|
161
|
-
ensureDir(path.dirname(evoPath));
|
|
162
|
-
const entry = `\n### Consolidated ${date}\n\n${goalsData}\n`;
|
|
163
|
-
if (fs.existsSync(evoPath)) {
|
|
164
|
-
fs.appendFileSync(evoPath, entry, "utf-8");
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
const fm = generateFrontmatter({ room: "goals", topic: "evolution", created: new Date().toISOString(), source: "consolidation" });
|
|
168
|
-
fs.writeFileSync(evoPath, `${fm}# goals / evolution\n${entry}`, "utf-8");
|
|
169
|
-
}
|
|
170
|
-
consolidated++;
|
|
171
|
-
}
|
|
172
|
-
// Consolidate blockers → blockers room
|
|
173
|
-
const blockersData = data.filter(e => e.blockers).map(e => `**${e.date}**: ${e.blockers?.split("\n")[0]}`).join("\n");
|
|
174
|
-
if (blockersData) {
|
|
175
|
-
const blkPath = path.join(pd, "rooms", "blockers", "history.md");
|
|
176
|
-
ensureDir(path.dirname(blkPath));
|
|
177
|
-
const entry = `\n### Consolidated ${date}\n\n${blockersData}\n`;
|
|
178
|
-
if (fs.existsSync(blkPath)) {
|
|
179
|
-
fs.appendFileSync(blkPath, entry, "utf-8");
|
|
180
|
-
}
|
|
181
|
-
else {
|
|
182
|
-
const fm = generateFrontmatter({ room: "blockers", topic: "history", created: new Date().toISOString(), source: "consolidation" });
|
|
183
|
-
fs.writeFileSync(blkPath, `${fm}# blockers / history\n${entry}`, "utf-8");
|
|
184
|
-
}
|
|
185
|
-
consolidated++;
|
|
186
|
-
}
|
|
187
|
-
updatePalaceIndex(slug);
|
|
188
|
-
}
|
|
189
|
-
catch {
|
|
190
|
-
// Consolidation is optional
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
return {
|
|
194
|
-
content: [{ type: "text", text: JSON.stringify({
|
|
195
|
-
project: slug,
|
|
196
|
-
entries_analyzed: toRead.length,
|
|
197
|
-
palace_rooms: palaceRoomCount,
|
|
198
|
-
consolidated,
|
|
199
|
-
synthesis: syn,
|
|
200
|
-
}) }],
|
|
201
|
-
};
|
|
20
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
202
21
|
});
|
|
203
22
|
}
|
|
204
23
|
//# sourceMappingURL=context-synthesize.js.map
|