agent-recall-core 3.4.38 → 3.4.39
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 +1 -1
- package/dist/host-profile.d.ts +69 -0
- package/dist/host-profile.d.ts.map +1 -0
- package/dist/host-profile.js +107 -0
- package/dist/host-profile.js.map +1 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/storage/corrections.d.ts +128 -0
- package/dist/storage/corrections.d.ts.map +1 -1
- package/dist/storage/corrections.js +562 -147
- package/dist/storage/corrections.js.map +1 -1
- package/dist/storage/lifecycle-telemetry.d.ts +56 -0
- package/dist/storage/lifecycle-telemetry.d.ts.map +1 -0
- package/dist/storage/lifecycle-telemetry.js +134 -0
- package/dist/storage/lifecycle-telemetry.js.map +1 -0
- package/dist/storage/sanitize.d.ts +2 -1
- package/dist/storage/sanitize.d.ts.map +1 -1
- package/dist/storage/sanitize.js +19 -2
- package/dist/storage/sanitize.js.map +1 -1
- package/dist/storage/session.d.ts +25 -1
- package/dist/storage/session.d.ts.map +1 -1
- package/dist/storage/session.js +60 -1
- package/dist/storage/session.js.map +1 -1
- package/dist/tools-logic/check-action.d.ts.map +1 -1
- package/dist/tools-logic/check-action.js +97 -3
- package/dist/tools-logic/check-action.js.map +1 -1
- package/dist/tools-logic/check.d.ts +22 -0
- package/dist/tools-logic/check.d.ts.map +1 -1
- package/dist/tools-logic/check.js +31 -1
- package/dist/tools-logic/check.js.map +1 -1
- package/dist/tools-logic/session-end.d.ts.map +1 -1
- package/dist/tools-logic/session-end.js +49 -4
- package/dist/tools-logic/session-end.js.map +1 -1
- package/dist/tools-logic/session-start.d.ts.map +1 -1
- package/dist/tools-logic/session-start.js +29 -6
- package/dist/tools-logic/session-start.js.map +1 -1
- package/dist/tools-logic/smart-recall.d.ts +93 -1
- package/dist/tools-logic/smart-recall.d.ts.map +1 -1
- package/dist/tools-logic/smart-recall.js +199 -11
- package/dist/tools-logic/smart-recall.js.map +1 -1
- package/dist/tools-logic/smart-remember.d.ts.map +1 -1
- package/dist/tools-logic/smart-remember.js +12 -0
- package/dist/tools-logic/smart-remember.js.map +1 -1
- package/dist/tools-logic/store-doctor.d.ts +1 -1
- package/dist/tools-logic/store-doctor.d.ts.map +1 -1
- package/dist/tools-logic/store-doctor.js +64 -0
- package/dist/tools-logic/store-doctor.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/package.json +4 -3
- package/dist/tools-logic/brief.d.ts +0 -84
- package/dist/tools-logic/brief.d.ts.map +0 -1
- package/dist/tools-logic/brief.js +0 -193
- package/dist/tools-logic/brief.js.map +0 -1
- package/dist/tools-logic/dashboard-export.d.ts +0 -130
- package/dist/tools-logic/dashboard-export.d.ts.map +0 -1
- package/dist/tools-logic/dashboard-export.js +0 -485
- package/dist/tools-logic/dashboard-export.js.map +0 -1
- package/dist/tools-logic/memory-query.d.ts +0 -43
- package/dist/tools-logic/memory-query.d.ts.map +0 -1
- package/dist/tools-logic/memory-query.js +0 -77
- package/dist/tools-logic/memory-query.js.map +0 -1
- package/dist/tools-logic/project-status.d.ts +0 -24
- package/dist/tools-logic/project-status.d.ts.map +0 -1
- package/dist/tools-logic/project-status.js +0 -155
- package/dist/tools-logic/project-status.js.map +0 -1
|
@@ -1,485 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* dashboard_export — V8 finding: AgentRecall's dashboard is human-only HTML.
|
|
3
|
-
* No structured view the agent can fetch to inspect its own memory in one call.
|
|
4
|
-
*
|
|
5
|
-
* This tool emits ~/.agent-recall/dashboard.json — stable schema, all-projects
|
|
6
|
-
* snapshot, suitable for both the HTML dashboard (consumed via fetch) and any
|
|
7
|
-
* agent wanting a one-call self-inspection of memory state.
|
|
8
|
-
*/
|
|
9
|
-
import * as fs from "node:fs";
|
|
10
|
-
import * as path from "node:path";
|
|
11
|
-
import * as os from "node:os";
|
|
12
|
-
import { getRoot } from "../types.js";
|
|
13
|
-
import { listJournalFiles } from "../helpers/journal-files.js";
|
|
14
|
-
import { buildRecentActivity } from "../helpers/activity-feed.js";
|
|
15
|
-
import { readActiveCorrections, getCorrectionKPIs } from "../storage/corrections.js";
|
|
16
|
-
import { listMilestones, summarize as summarizeMilestone } from "../palace/pipeline.js";
|
|
17
|
-
import { listRooms } from "../palace/rooms.js";
|
|
18
|
-
import { listSkills } from "../palace/skills.js";
|
|
19
|
-
import { readAwarenessState } from "../palace/awareness.js";
|
|
20
|
-
import { palaceDir } from "../storage/paths.js";
|
|
21
|
-
import { readGraph } from "../palace/graph.js";
|
|
22
|
-
import { buildIndexEntry } from "../naming.js";
|
|
23
|
-
// Non-project directories that leak into ~/.agent-recall/projects/ — filesystem
|
|
24
|
-
// path fragments, accidental cwd-derived slugs, scaffolds, and test fixtures.
|
|
25
|
-
// Mirrors the CLI status board (ar-sync-status.py SKIP_SLUGS) so the dashboard
|
|
26
|
-
// and the terminal board agree on what counts as a real project.
|
|
27
|
-
const NON_PROJECT_SLUGS = new Set([
|
|
28
|
-
"build",
|
|
29
|
-
"Downloads",
|
|
30
|
-
"Projects",
|
|
31
|
-
"default",
|
|
32
|
-
"runtime",
|
|
33
|
-
"monitor",
|
|
34
|
-
"mcp",
|
|
35
|
-
"phase-1",
|
|
36
|
-
"this-project-does-not-exist-xyz",
|
|
37
|
-
"not-a-real-project-xyz",
|
|
38
|
-
]);
|
|
39
|
-
const UUID_SLUG_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
40
|
-
/**
|
|
41
|
-
* A slug is a real project only if it isn't a dotdir / underscore-dir / leaked
|
|
42
|
-
* filename / UUID / known non-project. Structural rules first (cheap, robust),
|
|
43
|
-
* then the explicit denylist.
|
|
44
|
-
*/
|
|
45
|
-
function isRealProjectSlug(slug) {
|
|
46
|
-
if (!slug || slug.startsWith(".") || slug.startsWith("_"))
|
|
47
|
-
return false;
|
|
48
|
-
if (slug.endsWith(".md"))
|
|
49
|
-
return false;
|
|
50
|
-
if (UUID_SLUG_RE.test(slug))
|
|
51
|
-
return false;
|
|
52
|
-
if (NON_PROJECT_SLUGS.has(slug))
|
|
53
|
-
return false;
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
/** True if a project has substantive memory: at least one journal entry OR at
|
|
57
|
-
* least one palace topic file. Broader than journal-only (a palace-only project
|
|
58
|
-
* — real for some agent workflows — still appears), but excludes empty scaffolds
|
|
59
|
-
* and corrections-only-with-nothing-else dirs (a single stray correction and no
|
|
60
|
-
* journal/palace is too thin to be a project). For this install the result
|
|
61
|
-
* matches the arstatus CLI board. */
|
|
62
|
-
function hasRealMemory(slug, projectDir) {
|
|
63
|
-
if (listJournalFiles(slug).length > 0)
|
|
64
|
-
return true;
|
|
65
|
-
// Palace: any room with at least one topic file (a .md that isn't the README scaffold).
|
|
66
|
-
try {
|
|
67
|
-
const roomsDir = path.join(projectDir, "palace", "rooms");
|
|
68
|
-
for (const room of fs.readdirSync(roomsDir)) {
|
|
69
|
-
const roomPath = path.join(roomsDir, room);
|
|
70
|
-
// Skip non-directory entries (stray files leaked to rooms/ level)
|
|
71
|
-
try {
|
|
72
|
-
if (!fs.statSync(roomPath).isDirectory())
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
catch {
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
// Skip dirs without _room.json (not real rooms)
|
|
79
|
-
if (!fs.existsSync(path.join(roomPath, "_room.json")))
|
|
80
|
-
continue;
|
|
81
|
-
const files = fs.readdirSync(roomPath);
|
|
82
|
-
if (files.some((f) => f.endsWith(".md") && f !== "README.md"))
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
catch {
|
|
87
|
-
/* no palace dir — fall through */
|
|
88
|
-
}
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Scan for real projects that have actual memory to show. Inclusion requires a
|
|
93
|
-
* structurally-valid slug AND real memory in at least one layer. Empty scaffolds
|
|
94
|
-
* and path-leak junk are excluded so the dashboard shows only genuine projects;
|
|
95
|
-
* for this install the result matches the arstatus CLI board.
|
|
96
|
-
*/
|
|
97
|
-
function listAllProjectsForDashboard() {
|
|
98
|
-
const projectsDir = path.join(getRoot(), "projects");
|
|
99
|
-
if (!fs.existsSync(projectsDir))
|
|
100
|
-
return [];
|
|
101
|
-
const out = [];
|
|
102
|
-
for (const slug of fs.readdirSync(projectsDir)) {
|
|
103
|
-
if (!isRealProjectSlug(slug))
|
|
104
|
-
continue;
|
|
105
|
-
const projectDir = path.join(projectsDir, slug);
|
|
106
|
-
try {
|
|
107
|
-
if (!fs.statSync(projectDir).isDirectory())
|
|
108
|
-
continue;
|
|
109
|
-
}
|
|
110
|
-
catch {
|
|
111
|
-
continue; // broken/dangling symlink — skip rather than throw
|
|
112
|
-
}
|
|
113
|
-
if (!hasRealMemory(slug, projectDir))
|
|
114
|
-
continue;
|
|
115
|
-
out.push(slug);
|
|
116
|
-
}
|
|
117
|
-
return out.sort();
|
|
118
|
-
}
|
|
119
|
-
// ---------------------------------------------------------------------------
|
|
120
|
-
// FEED 1: 14-day dream health heatmap
|
|
121
|
-
// ---------------------------------------------------------------------------
|
|
122
|
-
const DREAMS_DIR = path.join(os.homedir(), ".aam", "dreams");
|
|
123
|
-
const HEATMAP_DAYS = 14;
|
|
124
|
-
const DREAM_BANNER_THRESHOLD = 2;
|
|
125
|
-
function dateNDaysAgo(n) {
|
|
126
|
-
const d = new Date();
|
|
127
|
-
d.setDate(d.getDate() - n);
|
|
128
|
-
return d.toISOString().slice(0, 10);
|
|
129
|
-
}
|
|
130
|
-
function isDreamSuccess(logPath) {
|
|
131
|
-
try {
|
|
132
|
-
const content = fs.readFileSync(logPath, "utf-8");
|
|
133
|
-
return /Dream(?:\s+run)?\s+complete/i.test(content);
|
|
134
|
-
}
|
|
135
|
-
catch {
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
function buildDreamHealth14Days() {
|
|
140
|
-
const cells = [];
|
|
141
|
-
let successCount = 0;
|
|
142
|
-
let failCount = 0;
|
|
143
|
-
let lastFailDate = null;
|
|
144
|
-
let lastSuccessDate = null;
|
|
145
|
-
// Build cells oldest→newest: index 0 = (HEATMAP_DAYS-1) days ago, index 13 = yesterday
|
|
146
|
-
// "Today" is in-progress, so we always stop at yesterday (i=1).
|
|
147
|
-
for (let i = HEATMAP_DAYS; i >= 1; i--) {
|
|
148
|
-
const dateStr = dateNDaysAgo(i);
|
|
149
|
-
if (!fs.existsSync(DREAMS_DIR)) {
|
|
150
|
-
cells.push({ date: dateStr, status: "none" });
|
|
151
|
-
continue;
|
|
152
|
-
}
|
|
153
|
-
const logPath = path.join(DREAMS_DIR, `run-${dateStr}.log`);
|
|
154
|
-
if (!fs.existsSync(logPath)) {
|
|
155
|
-
cells.push({ date: dateStr, status: "none" });
|
|
156
|
-
continue;
|
|
157
|
-
}
|
|
158
|
-
if (isDreamSuccess(logPath)) {
|
|
159
|
-
cells.push({ date: dateStr, status: "ok" });
|
|
160
|
-
successCount++;
|
|
161
|
-
// Loop goes oldest→newest (i decreases). Overwrite every time so the
|
|
162
|
-
// final value is the most-recent (largest date) success encountered.
|
|
163
|
-
lastSuccessDate = dateStr;
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
cells.push({ date: dateStr, status: "fail" });
|
|
167
|
-
failCount++;
|
|
168
|
-
// Same: overwrite to keep the most-recent failure date.
|
|
169
|
-
lastFailDate = dateStr;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
// Compute consecutive failures (from most recent cell backwards)
|
|
173
|
-
let consecutiveFailures = 0;
|
|
174
|
-
for (let i = cells.length - 1; i >= 0; i--) {
|
|
175
|
-
if (cells[i].status === "fail") {
|
|
176
|
-
consecutiveFailures++;
|
|
177
|
-
}
|
|
178
|
-
else if (cells[i].status === "ok") {
|
|
179
|
-
break;
|
|
180
|
-
}
|
|
181
|
-
// "none" breaks the streak too (no run = unknown health)
|
|
182
|
-
else {
|
|
183
|
-
break;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
let banner = null;
|
|
187
|
-
if (consecutiveFailures >= DREAM_BANNER_THRESHOLD) {
|
|
188
|
-
const lastSuccess = lastSuccessDate ?? `>${HEATMAP_DAYS} days ago`;
|
|
189
|
-
banner =
|
|
190
|
-
`⚠ Dream cron failed ${consecutiveFailures} nights in a row ` +
|
|
191
|
-
`(last success: ${lastSuccess}). The awareness backfill is broken — ` +
|
|
192
|
-
`check ~/.aam/dreams/run-${lastFailDate}.log for auth or network errors.`;
|
|
193
|
-
}
|
|
194
|
-
return {
|
|
195
|
-
cells,
|
|
196
|
-
success_count: successCount,
|
|
197
|
-
fail_count: failCount,
|
|
198
|
-
last_fail_date: lastFailDate,
|
|
199
|
-
last_success_date: lastSuccessDate,
|
|
200
|
-
banner,
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
// ---------------------------------------------------------------------------
|
|
204
|
-
// FEED 3: palace graph edges (per-project)
|
|
205
|
-
// ---------------------------------------------------------------------------
|
|
206
|
-
function buildPalaceEdges(slug) {
|
|
207
|
-
try {
|
|
208
|
-
const pd = palaceDir(slug);
|
|
209
|
-
const graph = readGraph(pd);
|
|
210
|
-
const seen = new Set();
|
|
211
|
-
const edges = [];
|
|
212
|
-
for (const edge of graph.edges) {
|
|
213
|
-
// Extract room-level slug (first path segment)
|
|
214
|
-
const source = edge.from.split("/")[0];
|
|
215
|
-
const target = edge.to.split("/")[0];
|
|
216
|
-
// Drop self-loops
|
|
217
|
-
if (source === target)
|
|
218
|
-
continue;
|
|
219
|
-
// Dedupe by source+target+type
|
|
220
|
-
const key = `${source}::${target}::${edge.type}`;
|
|
221
|
-
if (seen.has(key))
|
|
222
|
-
continue;
|
|
223
|
-
seen.add(key);
|
|
224
|
-
edges.push({ source, target, type: edge.type, weight: edge.weight });
|
|
225
|
-
}
|
|
226
|
-
return edges;
|
|
227
|
-
}
|
|
228
|
-
catch {
|
|
229
|
-
return [];
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
function countTopicsInRoom(slug, room) {
|
|
233
|
-
try {
|
|
234
|
-
const dir = path.join(palaceDir(slug), "rooms", room.slug);
|
|
235
|
-
if (!fs.existsSync(dir))
|
|
236
|
-
return 0;
|
|
237
|
-
return fs.readdirSync(dir).filter((f) => f.endsWith(".md") && f !== "README.md").length;
|
|
238
|
-
}
|
|
239
|
-
catch {
|
|
240
|
-
return 0;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
function snapshotProject(slug) {
|
|
244
|
-
const journals = listJournalFiles(slug);
|
|
245
|
-
const dates = journals.map((j) => j.date).filter(Boolean).sort();
|
|
246
|
-
const first = dates[0] ?? null;
|
|
247
|
-
const last = dates[dates.length - 1] ?? null;
|
|
248
|
-
const rooms = listRooms(slug);
|
|
249
|
-
const milestones = listMilestones(slug);
|
|
250
|
-
const closed = milestones.filter((m) => m.meta.status === "closed");
|
|
251
|
-
const active = milestones.find((m) => m.meta.status === "active") ?? null;
|
|
252
|
-
const abandoned = milestones.filter((m) => m.meta.status === "abandoned").length;
|
|
253
|
-
const lastClosed = closed[closed.length - 1];
|
|
254
|
-
const corrections = readActiveCorrections(slug);
|
|
255
|
-
const p0Active = corrections.filter((c) => c.severity === "p0").length;
|
|
256
|
-
const kpis = getCorrectionKPIs(slug);
|
|
257
|
-
const skills = listSkills(slug);
|
|
258
|
-
// Note: readAwarenessState() returns GLOBAL awareness (not per-project).
|
|
259
|
-
// Until upstream supports per-project, every project snapshot carries the
|
|
260
|
-
// same global top. Field renamed to global_insights_top to make this honest.
|
|
261
|
-
const awareness = readAwarenessState();
|
|
262
|
-
const globalInsightsTop = (awareness?.topInsights ?? [])
|
|
263
|
-
.slice(0, 5)
|
|
264
|
-
.map((i) => ({
|
|
265
|
-
title: i.title.slice(0, 200),
|
|
266
|
-
confirmations: i.confirmations ?? 1,
|
|
267
|
-
severity: i.severity ?? "important",
|
|
268
|
-
}));
|
|
269
|
-
// Null when retrieved === 0 — no fake claims before real outcome data exists
|
|
270
|
-
const alignmentPrecision = kpis.retrieved > 0 ? kpis.precision : null;
|
|
271
|
-
// FEED 2 — recent activity (20 events, newest-first)
|
|
272
|
-
const recentActivity = buildRecentActivity(slug, 20);
|
|
273
|
-
// FEED 3 — palace graph edges
|
|
274
|
-
const palaceEdges = buildPalaceEdges(slug);
|
|
275
|
-
return {
|
|
276
|
-
slug,
|
|
277
|
-
total_sessions: journals.length,
|
|
278
|
-
first_session: first,
|
|
279
|
-
last_session: last,
|
|
280
|
-
rooms: rooms.map((r) => ({
|
|
281
|
-
slug: r.slug,
|
|
282
|
-
name: r.name,
|
|
283
|
-
salience: r.salience,
|
|
284
|
-
updated: r.updated,
|
|
285
|
-
topic_count: countTopicsInRoom(slug, r),
|
|
286
|
-
})),
|
|
287
|
-
skills_count: skills.length,
|
|
288
|
-
pipeline: {
|
|
289
|
-
total: milestones.length,
|
|
290
|
-
closed: closed.length,
|
|
291
|
-
active: active ? 1 : 0,
|
|
292
|
-
abandoned,
|
|
293
|
-
active_phase: active?.meta.phase ?? null,
|
|
294
|
-
last_synthesis: lastClosed && lastClosed.sections.synthesis && lastClosed.sections.synthesis !== "(in progress)"
|
|
295
|
-
? lastClosed.sections.synthesis
|
|
296
|
-
: null,
|
|
297
|
-
spine: milestones.map(summarizeMilestone),
|
|
298
|
-
},
|
|
299
|
-
corrections: {
|
|
300
|
-
total: corrections.length,
|
|
301
|
-
p0_active: p0Active,
|
|
302
|
-
kpis,
|
|
303
|
-
},
|
|
304
|
-
global_insights_top: globalInsightsTop,
|
|
305
|
-
// Back-compat field (bare number)
|
|
306
|
-
alignment_precision: alignmentPrecision,
|
|
307
|
-
// FEED 4 — full alignment object (additive)
|
|
308
|
-
alignment: {
|
|
309
|
-
precision: alignmentPrecision,
|
|
310
|
-
retrieved: kpis.retrieved,
|
|
311
|
-
heeded: kpis.heeded,
|
|
312
|
-
recurred: kpis.recurred,
|
|
313
|
-
},
|
|
314
|
-
// FEED 2
|
|
315
|
-
recent_activity: recentActivity,
|
|
316
|
-
// FEED 3
|
|
317
|
-
palace_edges: palaceEdges,
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Build the canonical naming index — includes both already-canonical files
|
|
322
|
-
* AND legacy files (journal/, palace/pipeline/, palace/skills/, corrections/),
|
|
323
|
-
* synthesizing canonical entries from legacy filenames where possible.
|
|
324
|
-
*
|
|
325
|
-
* This means agents can query the index uniformly even before migration,
|
|
326
|
-
* and the new naming grammar acts as a *view* on top of existing storage.
|
|
327
|
-
*/
|
|
328
|
-
function buildNamingIndex(snapshots) {
|
|
329
|
-
const root = getRoot();
|
|
330
|
-
const index = [];
|
|
331
|
-
for (const snap of snapshots) {
|
|
332
|
-
const projDir = path.join(root, "projects", snap.slug);
|
|
333
|
-
// 1) Pipeline (legacy NNNN-slug.md) — synthesize narrative type
|
|
334
|
-
const pipeDir = path.join(projDir, "palace", "pipeline");
|
|
335
|
-
if (fs.existsSync(pipeDir)) {
|
|
336
|
-
for (const f of fs.readdirSync(pipeDir)) {
|
|
337
|
-
if (!f.endsWith(".md") || !/^\d+-/.test(f))
|
|
338
|
-
continue;
|
|
339
|
-
const base = f.replace(/\.md$/, "");
|
|
340
|
-
const dash = base.indexOf("-");
|
|
341
|
-
const order = base.slice(0, dash);
|
|
342
|
-
const slug = base.slice(dash + 1).toLowerCase().replace(/[^a-z0-9-]/g, "-");
|
|
343
|
-
index.push({
|
|
344
|
-
canonical_path: `projects/${snap.slug}/narrative/${order.padStart(4, "0")}--${slug}.md`,
|
|
345
|
-
legacy_path: `projects/${snap.slug}/palace/pipeline/${f}`,
|
|
346
|
-
scope: "project",
|
|
347
|
-
project: snap.slug,
|
|
348
|
-
type: "narrative",
|
|
349
|
-
topic: null,
|
|
350
|
-
temporal: order.padStart(4, "0"),
|
|
351
|
-
slug,
|
|
352
|
-
updated_at: fs.statSync(path.join(pipeDir, f)).mtime.toISOString(),
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
// 2) Skills (NNNN-slug.md) — procedural
|
|
357
|
-
const skillsDir = path.join(projDir, "palace", "skills");
|
|
358
|
-
if (fs.existsSync(skillsDir)) {
|
|
359
|
-
for (const f of fs.readdirSync(skillsDir)) {
|
|
360
|
-
if (!f.endsWith(".md") || !/^\d+-/.test(f))
|
|
361
|
-
continue;
|
|
362
|
-
const base = f.replace(/\.md$/, "");
|
|
363
|
-
const dash = base.indexOf("-");
|
|
364
|
-
const order = base.slice(0, dash);
|
|
365
|
-
const slug = base.slice(dash + 1).toLowerCase().replace(/[^a-z0-9-]/g, "-");
|
|
366
|
-
index.push({
|
|
367
|
-
canonical_path: `projects/${snap.slug}/procedural/${order.padStart(4, "0")}--${slug}.md`,
|
|
368
|
-
legacy_path: `projects/${snap.slug}/palace/skills/${f}`,
|
|
369
|
-
scope: "project",
|
|
370
|
-
project: snap.slug,
|
|
371
|
-
type: "procedural",
|
|
372
|
-
topic: null,
|
|
373
|
-
temporal: order.padStart(4, "0"),
|
|
374
|
-
slug,
|
|
375
|
-
updated_at: fs.statSync(path.join(skillsDir, f)).mtime.toISOString(),
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
// 3) Journal (YYYY-MM-DD*.md) — episodic
|
|
380
|
-
const journalDir = path.join(projDir, "journal");
|
|
381
|
-
if (fs.existsSync(journalDir)) {
|
|
382
|
-
for (const f of fs.readdirSync(journalDir)) {
|
|
383
|
-
if (!f.endsWith(".md"))
|
|
384
|
-
continue;
|
|
385
|
-
const dateMatch = f.match(/^(\d{4}-\d{2}-\d{2})/);
|
|
386
|
-
if (!dateMatch)
|
|
387
|
-
continue;
|
|
388
|
-
const date = dateMatch[1];
|
|
389
|
-
const rest = f.slice(date.length).replace(/^[-_.]+|\.md$/g, "");
|
|
390
|
-
const slug = rest ? rest.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "") || "session" : "session";
|
|
391
|
-
index.push({
|
|
392
|
-
canonical_path: `projects/${snap.slug}/episodic/${date}--${slug}.md`,
|
|
393
|
-
legacy_path: `projects/${snap.slug}/journal/${f}`,
|
|
394
|
-
scope: "project",
|
|
395
|
-
project: snap.slug,
|
|
396
|
-
type: "episodic",
|
|
397
|
-
topic: null,
|
|
398
|
-
temporal: date,
|
|
399
|
-
slug,
|
|
400
|
-
updated_at: fs.statSync(path.join(journalDir, f)).mtime.toISOString(),
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
// 4) Corrections (YYYY-MM-DD-rule-slug.json) — correction type
|
|
405
|
-
const corrDir = path.join(projDir, "corrections");
|
|
406
|
-
if (fs.existsSync(corrDir)) {
|
|
407
|
-
for (const f of fs.readdirSync(corrDir)) {
|
|
408
|
-
if (!f.endsWith(".json"))
|
|
409
|
-
continue;
|
|
410
|
-
const m = f.match(/^(\d{4}-\d{2}-\d{2})-(.+)\.json$/);
|
|
411
|
-
if (!m)
|
|
412
|
-
continue;
|
|
413
|
-
const [, date, raw] = m;
|
|
414
|
-
const slug = raw.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "") || "correction";
|
|
415
|
-
index.push({
|
|
416
|
-
canonical_path: `projects/${snap.slug}/correction/${date}--${slug}.md`,
|
|
417
|
-
legacy_path: `projects/${snap.slug}/corrections/${f}`,
|
|
418
|
-
scope: "project",
|
|
419
|
-
project: snap.slug,
|
|
420
|
-
type: "correction",
|
|
421
|
-
topic: null,
|
|
422
|
-
temporal: date,
|
|
423
|
-
slug,
|
|
424
|
-
updated_at: fs.statSync(path.join(corrDir, f)).mtime.toISOString(),
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
// 5) Any already-canonical files in new dirs (forward-compat)
|
|
429
|
-
for (const sub of ["episodic", "semantic", "procedural", "narrative", "correction"]) {
|
|
430
|
-
const dir = path.join(projDir, sub);
|
|
431
|
-
if (!fs.existsSync(dir))
|
|
432
|
-
continue;
|
|
433
|
-
for (const f of fs.readdirSync(dir)) {
|
|
434
|
-
if (!f.endsWith(".md"))
|
|
435
|
-
continue;
|
|
436
|
-
const fullPath = path.relative(root, path.join(dir, f));
|
|
437
|
-
const entry = buildIndexEntry(fullPath);
|
|
438
|
-
if (entry) {
|
|
439
|
-
entry.updated_at = fs.statSync(path.join(dir, f)).mtime.toISOString();
|
|
440
|
-
index.push(entry);
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
return index;
|
|
446
|
-
}
|
|
447
|
-
export async function dashboardExport(input) {
|
|
448
|
-
const root = getRoot();
|
|
449
|
-
const projects = listAllProjectsForDashboard();
|
|
450
|
-
const snapshots = projects.map(snapshotProject);
|
|
451
|
-
const namingIndex = buildNamingIndex(snapshots);
|
|
452
|
-
const awareness = readAwarenessState();
|
|
453
|
-
// FEED 1 — machine-global dream health heatmap
|
|
454
|
-
const dreamHealth = buildDreamHealth14Days();
|
|
455
|
-
const snapshot = {
|
|
456
|
-
generated_at: new Date().toISOString(),
|
|
457
|
-
schema_version: 1,
|
|
458
|
-
projects: snapshots,
|
|
459
|
-
global: {
|
|
460
|
-
project_count: projects.length,
|
|
461
|
-
awareness_insight_count: (awareness?.topInsights ?? []).length,
|
|
462
|
-
naming_index_count: namingIndex.length,
|
|
463
|
-
},
|
|
464
|
-
naming_index: namingIndex,
|
|
465
|
-
dream_health: dreamHealth,
|
|
466
|
-
};
|
|
467
|
-
const jsonPath = path.join(root, "dashboard.json");
|
|
468
|
-
// Atomic write
|
|
469
|
-
const tmp = `${jsonPath}.tmp.${process.pid}.${Date.now()}`;
|
|
470
|
-
fs.writeFileSync(tmp, JSON.stringify(snapshot, null, 2), { encoding: "utf-8", mode: 0o600 });
|
|
471
|
-
fs.renameSync(tmp, jsonPath);
|
|
472
|
-
const limit = input.inline_index_limit ?? 200;
|
|
473
|
-
const trimmed = {
|
|
474
|
-
...snapshot,
|
|
475
|
-
naming_index: snapshot.naming_index.slice(0, limit),
|
|
476
|
-
};
|
|
477
|
-
return {
|
|
478
|
-
success: true,
|
|
479
|
-
json_path: jsonPath,
|
|
480
|
-
generated_at: snapshot.generated_at,
|
|
481
|
-
project_count: projects.length,
|
|
482
|
-
snapshot: trimmed,
|
|
483
|
-
};
|
|
484
|
-
}
|
|
485
|
-
//# sourceMappingURL=dashboard-export.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard-export.js","sourceRoot":"","sources":["../../src/tools-logic/dashboard-export.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAsB,MAAM,6BAA6B,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAsB,MAAM,2BAA2B,CAAC;AACzG,OAAO,EAAE,cAAc,EAAE,SAAS,IAAI,kBAAkB,EAAyB,MAAM,uBAAuB,CAAC;AAC/G,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAyB,MAAM,cAA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called mid-task:
|
|
5
|
-
* "I'm about to do X — what should I know?"
|
|
6
|
-
*
|
|
7
|
-
* Returns high/medium confidence results as the primary list. When the primary
|
|
8
|
-
* filter is empty (the match exists but is only low-confidence), the BRIDGE
|
|
9
|
-
* (Wave 4) attaches the verbatim drill-down source under `fallback` instead of
|
|
10
|
-
* silently suppressing it — so the agent gets the lossless source plus a
|
|
11
|
-
* "verify before relying" caution rather than a bare "nothing found" string.
|
|
12
|
-
*/
|
|
13
|
-
import { type BridgedSource } from "./smart-recall.js";
|
|
14
|
-
export interface MemoryQueryInput {
|
|
15
|
-
/** Describe what you're about to do or decide. e.g. "push to npm" or "modify auth middleware" */
|
|
16
|
-
intent: string;
|
|
17
|
-
project?: string;
|
|
18
|
-
/** Minimum confidence to include in results. Default: "medium" */
|
|
19
|
-
min_confidence?: "high" | "medium" | "low";
|
|
20
|
-
/** Max results. Default: 5 */
|
|
21
|
-
limit?: number;
|
|
22
|
-
}
|
|
23
|
-
export interface MemoryQueryItem {
|
|
24
|
-
id: string;
|
|
25
|
-
source: "palace" | "journal" | "insight";
|
|
26
|
-
title: string;
|
|
27
|
-
excerpt: string;
|
|
28
|
-
confidence: string;
|
|
29
|
-
room?: string;
|
|
30
|
-
}
|
|
31
|
-
export interface MemoryQueryResult {
|
|
32
|
-
intent: string;
|
|
33
|
-
project: string;
|
|
34
|
-
results: MemoryQueryItem[];
|
|
35
|
-
/** True when no memory passed the confidence threshold for the primary list. */
|
|
36
|
-
empty: boolean;
|
|
37
|
-
guidance?: string;
|
|
38
|
-
/** Verbatim drill-down source attached when the primary filter was empty but a
|
|
39
|
-
* low-confidence match exists (Wave 4 bridge). */
|
|
40
|
-
fallback?: BridgedSource[];
|
|
41
|
-
}
|
|
42
|
-
export declare function memoryQuery(input: MemoryQueryInput): Promise<MemoryQueryResult>;
|
|
43
|
-
//# sourceMappingURL=memory-query.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memory-query.d.ts","sourceRoot":"","sources":["../../src/tools-logic/memory-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAe,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAOpE,MAAM,WAAW,gBAAgB;IAC/B,iGAAiG;IACjG,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kEAAkE;IAClE,cAAc,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IAC3C,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,gFAAgF;IAChF,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;uDACmD;IACnD,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC;CAC5B;AAgBD,wBAAsB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAuDrF"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* memory_query — on-demand, intent-scoped recall.
|
|
3
|
-
*
|
|
4
|
-
* Unlike `recall` (general search), this is called mid-task:
|
|
5
|
-
* "I'm about to do X — what should I know?"
|
|
6
|
-
*
|
|
7
|
-
* Returns high/medium confidence results as the primary list. When the primary
|
|
8
|
-
* filter is empty (the match exists but is only low-confidence), the BRIDGE
|
|
9
|
-
* (Wave 4) attaches the verbatim drill-down source under `fallback` instead of
|
|
10
|
-
* silently suppressing it — so the agent gets the lossless source plus a
|
|
11
|
-
* "verify before relying" caution rather than a bare "nothing found" string.
|
|
12
|
-
*/
|
|
13
|
-
import { smartRecall } from "./smart-recall.js";
|
|
14
|
-
import { resolveProject } from "../storage/project.js";
|
|
15
|
-
// ---------------------------------------------------------------------------
|
|
16
|
-
// Score threshold per confidence level
|
|
17
|
-
// ---------------------------------------------------------------------------
|
|
18
|
-
const CONFIDENCE_THRESHOLD = {
|
|
19
|
-
high: 0.10,
|
|
20
|
-
medium: 0.05,
|
|
21
|
-
low: 0.03,
|
|
22
|
-
};
|
|
23
|
-
// ---------------------------------------------------------------------------
|
|
24
|
-
// Main
|
|
25
|
-
// ---------------------------------------------------------------------------
|
|
26
|
-
export async function memoryQuery(input) {
|
|
27
|
-
const project = await resolveProject(input.project);
|
|
28
|
-
const minScore = CONFIDENCE_THRESHOLD[input.min_confidence ?? "medium"] ?? 0.05;
|
|
29
|
-
const limit = input.limit ?? 5;
|
|
30
|
-
const recalled = await smartRecall({
|
|
31
|
-
query: input.intent,
|
|
32
|
-
project,
|
|
33
|
-
limit: limit * 2, // over-fetch then filter by confidence
|
|
34
|
-
drilldown: true, // bridge: attach verbatim source for low-confidence hits
|
|
35
|
-
});
|
|
36
|
-
const filtered = recalled.results
|
|
37
|
-
.filter((r) => r.score >= minScore)
|
|
38
|
-
.slice(0, limit)
|
|
39
|
-
.map((r) => ({
|
|
40
|
-
id: r.id,
|
|
41
|
-
source: r.source,
|
|
42
|
-
title: r.title,
|
|
43
|
-
excerpt: r.excerpt,
|
|
44
|
-
confidence: r.confidence,
|
|
45
|
-
room: r.room,
|
|
46
|
-
}));
|
|
47
|
-
if (filtered.length > 0) {
|
|
48
|
-
return {
|
|
49
|
-
intent: input.intent,
|
|
50
|
-
project,
|
|
51
|
-
results: filtered,
|
|
52
|
-
empty: false,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
// Primary filter empty — fall back to the bridged verbatim source if the
|
|
56
|
-
// model tier had a low-confidence match worth drilling into.
|
|
57
|
-
const fallback = recalled.bridged;
|
|
58
|
-
if (fallback && fallback.length > 0) {
|
|
59
|
-
return {
|
|
60
|
-
intent: input.intent,
|
|
61
|
-
project,
|
|
62
|
-
results: [],
|
|
63
|
-
empty: true,
|
|
64
|
-
fallback,
|
|
65
|
-
guidance: `Low-confidence match — verbatim source attached; verify before relying.`,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
return {
|
|
69
|
-
intent: input.intent,
|
|
70
|
-
project,
|
|
71
|
-
results: [],
|
|
72
|
-
empty: true,
|
|
73
|
-
fallback: [],
|
|
74
|
-
guidance: `No memory found relevant to: "${input.intent}". This may be a new area — proceed with standard caution.`,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
//# sourceMappingURL=memory-query.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memory-query.js","sourceRoot":"","sources":["../../src/tools-logic/memory-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAsB,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAqCvD,8EAA8E;AAC9E,uCAAuC;AACvC,8EAA8E;AAE9E,MAAM,oBAAoB,GAA2B;IACnD,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,IAAI;IACZ,GAAG,EAAE,IAAI;CACV,CAAC;AAEF,8EAA8E;AAC9E,OAAO;AACP,8EAA8E;AAE9E,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,KAAuB;IACvD,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACpD,MAAM,QAAQ,GAAG,oBAAoB,CAAC,KAAK,CAAC,cAAc,IAAI,QAAQ,CAAC,IAAI,IAAI,CAAC;IAChF,MAAM,KAAK,G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KAAK,CAAC,MAAM;QACpB,OAAO;QACP,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,EAAE;QACZ,QAAQ,EAAE,iCAAiC,KAAK,CAAC,MAAM,4DAA4D;KACpH,CAAC;AACJ,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* project_status — one-call operational briefing for any agent landing in a long project.
|
|
3
|
-
*
|
|
4
|
-
* Synthesizes: last trajectory, active blockers, next steps, palace room freshness.
|
|
5
|
-
* Target: orient in seconds without reading multiple sources.
|
|
6
|
-
*/
|
|
7
|
-
export interface ProjectStatusInput {
|
|
8
|
-
project?: string;
|
|
9
|
-
}
|
|
10
|
-
export interface ProjectStatusResult {
|
|
11
|
-
project: string;
|
|
12
|
-
last_trajectory: string | null;
|
|
13
|
-
active_blockers: string[];
|
|
14
|
-
next_steps: string[];
|
|
15
|
-
last_journal_date: string | null;
|
|
16
|
-
palace_rooms: Array<{
|
|
17
|
-
name: string;
|
|
18
|
-
updated: string;
|
|
19
|
-
stale: boolean;
|
|
20
|
-
}>;
|
|
21
|
-
summary_line: string;
|
|
22
|
-
}
|
|
23
|
-
export declare function projectStatus(input: ProjectStatusInput): Promise<ProjectStatusResult>;
|
|
24
|
-
//# sourceMappingURL=project-status.d.ts.map
|