@edihasaj/recall 0.8.6 → 0.8.8
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 +3 -0
- package/dist/{chunk-OR6VZZI6.js → chunk-246257OY.js} +3 -3
- package/dist/{chunk-BJTLWRZH.js → chunk-3GRPT3EJ.js} +2 -2
- package/dist/{chunk-V4UAYWKI.js → chunk-7HXPR2BW.js} +90 -18
- package/dist/chunk-7HXPR2BW.js.map +1 -0
- package/dist/{chunk-DYAQ4RKX.js → chunk-BB66SNQU.js} +6 -6
- package/dist/chunk-BB66SNQU.js.map +1 -0
- package/dist/{chunk-G5IAOZAL.js → chunk-IZSEBIZH.js} +9 -3
- package/dist/chunk-IZSEBIZH.js.map +1 -0
- package/dist/{chunk-A4ES3H4Y.js → chunk-K3SFQAT4.js} +3 -2
- package/dist/chunk-K3SFQAT4.js.map +1 -0
- package/dist/{chunk-BHTIIKRB.js → chunk-KCSMBLOA.js} +4 -4
- package/dist/{chunk-QJTP6OIZ.js → chunk-LV262EKS.js} +126 -9
- package/dist/{chunk-QJTP6OIZ.js.map → chunk-LV262EKS.js.map} +1 -1
- package/dist/{chunk-EYMC2PDI.js → chunk-LWCBXHOI.js} +2 -2
- package/dist/{chunk-4VBHVY3D.js → chunk-NTUQTB4R.js} +3 -3
- package/dist/{chunk-SAVLATC5.js → chunk-OGBKDDEL.js} +18 -7
- package/dist/chunk-OGBKDDEL.js.map +1 -0
- package/dist/{chunk-WC7S7BOP.js → chunk-W373TA62.js} +287 -43
- package/dist/chunk-W373TA62.js.map +1 -0
- package/dist/{chunk-BUUVZQEV.js → chunk-XWMPT4KC.js} +73 -7
- package/dist/chunk-XWMPT4KC.js.map +1 -0
- package/dist/{cleanup-MPSAZNDH.js → cleanup-KRK5B3AD.js} +6 -6
- package/dist/cli.js +92 -24
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +35 -20
- package/dist/daemon.js.map +1 -1
- package/dist/{dispatcher-RCCPGNDO.js → dispatcher-JQIVQUIM.js} +6 -6
- package/dist/{embeddings-MNNECV6B.js → embeddings-GYY66SAT.js} +3 -3
- package/dist/{ingest-KVLFQ6J7.js → ingest-27GZFC7Y.js} +6 -6
- package/dist/mcp.js +10 -10
- package/dist/{quality-OXFQ7JXM.js → quality-3SIDIPJV.js} +7 -7
- package/dist/retrieval-MXYJRAEW.js +13 -0
- package/dist/{store-KU5H2RA2.js → store-PRLXSOOC.js} +3 -3
- package/dist/{tasks-SCYA2PJJ.js → tasks-43I6WNJS.js} +6 -6
- package/dist/{usage-VVXTCJHT.js → usage-KHOLIR3S.js} +3 -3
- package/drizzle/0010_value_retrieval_snapshots.sql +6 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +1 -1
- package/dist/chunk-A4ES3H4Y.js.map +0 -1
- package/dist/chunk-BUUVZQEV.js.map +0 -1
- package/dist/chunk-DYAQ4RKX.js.map +0 -1
- package/dist/chunk-G5IAOZAL.js.map +0 -1
- package/dist/chunk-SAVLATC5.js.map +0 -1
- package/dist/chunk-V4UAYWKI.js.map +0 -1
- package/dist/chunk-WC7S7BOP.js.map +0 -1
- package/dist/retrieval-27YV546Y.js +0 -13
- /package/dist/{chunk-OR6VZZI6.js.map → chunk-246257OY.js.map} +0 -0
- /package/dist/{chunk-BJTLWRZH.js.map → chunk-3GRPT3EJ.js.map} +0 -0
- /package/dist/{chunk-BHTIIKRB.js.map → chunk-KCSMBLOA.js.map} +0 -0
- /package/dist/{chunk-EYMC2PDI.js.map → chunk-LWCBXHOI.js.map} +0 -0
- /package/dist/{chunk-4VBHVY3D.js.map → chunk-NTUQTB4R.js.map} +0 -0
- /package/dist/{cleanup-MPSAZNDH.js.map → cleanup-KRK5B3AD.js.map} +0 -0
- /package/dist/{dispatcher-RCCPGNDO.js.map → dispatcher-JQIVQUIM.js.map} +0 -0
- /package/dist/{embeddings-MNNECV6B.js.map → embeddings-GYY66SAT.js.map} +0 -0
- /package/dist/{ingest-KVLFQ6J7.js.map → ingest-27GZFC7Y.js.map} +0 -0
- /package/dist/{quality-OXFQ7JXM.js.map → quality-3SIDIPJV.js.map} +0 -0
- /package/dist/{retrieval-27YV546Y.js.map → retrieval-MXYJRAEW.js.map} +0 -0
- /package/dist/{store-KU5H2RA2.js.map → store-PRLXSOOC.js.map} +0 -0
- /package/dist/{tasks-SCYA2PJJ.js.map → tasks-43I6WNJS.js.map} +0 -0
- /package/dist/{usage-VVXTCJHT.js.map → usage-KHOLIR3S.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
dispatchCodexNotify,
|
|
4
4
|
ensureDailyBackup,
|
|
5
|
+
executeAssistantCompletionHook,
|
|
5
6
|
executePromptHook,
|
|
6
7
|
executeSessionEndHook,
|
|
7
8
|
executeSessionStartHook,
|
|
@@ -22,7 +23,7 @@ import {
|
|
|
22
23
|
readCodexSessionStartInputFromStdin,
|
|
23
24
|
readCodexToolInputFromStdin,
|
|
24
25
|
restoreBackup
|
|
25
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-7HXPR2BW.js";
|
|
26
27
|
import {
|
|
27
28
|
RECALL_DB_USER_VERSION,
|
|
28
29
|
compileContext,
|
|
@@ -39,6 +40,7 @@ import {
|
|
|
39
40
|
formatMetricsReport,
|
|
40
41
|
formatPruneReport,
|
|
41
42
|
formatRetrievalEvalReport,
|
|
43
|
+
formatValueRetrievalEvalReport,
|
|
42
44
|
getDbPath,
|
|
43
45
|
getDbUserVersion,
|
|
44
46
|
getSignalStats,
|
|
@@ -56,14 +58,16 @@ import {
|
|
|
56
58
|
resetDb,
|
|
57
59
|
resolveApproval,
|
|
58
60
|
runRetrievalEval,
|
|
61
|
+
runValueRetrievalEval,
|
|
59
62
|
scanAndStore,
|
|
60
63
|
searchHistorySnippets,
|
|
61
64
|
signalOutcomeFallback,
|
|
62
65
|
startEvalSession,
|
|
66
|
+
summarizeValueRetrievalEval,
|
|
63
67
|
togglePolicy,
|
|
64
68
|
writeRepoContextArtifact
|
|
65
|
-
} from "./chunk-
|
|
66
|
-
import "./chunk-
|
|
69
|
+
} from "./chunk-LV262EKS.js";
|
|
70
|
+
import "./chunk-W373TA62.js";
|
|
67
71
|
import "./chunk-PUMEMKGF.js";
|
|
68
72
|
import {
|
|
69
73
|
autoResolveContradictions,
|
|
@@ -82,7 +86,7 @@ import {
|
|
|
82
86
|
recordAudit,
|
|
83
87
|
resolveContradiction,
|
|
84
88
|
rollbackMemory
|
|
85
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-BB66SNQU.js";
|
|
86
90
|
import {
|
|
87
91
|
confirmMemory,
|
|
88
92
|
createMemory,
|
|
@@ -91,8 +95,8 @@ import {
|
|
|
91
95
|
listRepos,
|
|
92
96
|
queryMemories,
|
|
93
97
|
rejectMemory
|
|
94
|
-
} from "./chunk-
|
|
95
|
-
import "./chunk-
|
|
98
|
+
} from "./chunk-NTUQTB4R.js";
|
|
99
|
+
import "./chunk-3GRPT3EJ.js";
|
|
96
100
|
import {
|
|
97
101
|
bootstrapEmbeddings,
|
|
98
102
|
ensureEmbeddingProviderReady,
|
|
@@ -105,13 +109,13 @@ import {
|
|
|
105
109
|
searchMemoryFtsIndex,
|
|
106
110
|
semanticSearch,
|
|
107
111
|
verifyEmbeddings
|
|
108
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-K3SFQAT4.js";
|
|
109
113
|
import {
|
|
110
114
|
eq,
|
|
111
115
|
gt,
|
|
112
116
|
memories,
|
|
113
117
|
syncState
|
|
114
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-IZSEBIZH.js";
|
|
115
119
|
import {
|
|
116
120
|
init_keychain,
|
|
117
121
|
keychain_exports
|
|
@@ -2563,6 +2567,21 @@ hookCmd.command("tool").description("Record a completed tool invocation").option
|
|
|
2563
2567
|
};
|
|
2564
2568
|
await executeToolHook(input);
|
|
2565
2569
|
}));
|
|
2570
|
+
hookCmd.command("assistant").description("Record assistant completion text and infer which injected memories were used").option("--text <text>", "Assistant completion text; reads stdin if omitted").option("--repo <repo>", "Repository slug").option("--repo-path <path>", "Repository path").option("--session <id>", "Session ID").option("--path <path>", "File path context").option("--agent <agent>", "Agent name").option("--memory <id>", "Explicit injected memory ID used by the completion", collectMemoryIds, []).action(safeHookAction("assistant", async (opts) => {
|
|
2571
|
+
const stdinText = opts.text ? null : await readStdinText();
|
|
2572
|
+
const text = opts.text ?? stdinText;
|
|
2573
|
+
if (!text) throw new Error("text is required (pass --text or pipe completion text on stdin)");
|
|
2574
|
+
const memoryIds = opts.memory.length > 0 ? resolveMemoryIdPrefixes(opts.memory) : [];
|
|
2575
|
+
await executeAssistantCompletionHook({
|
|
2576
|
+
text,
|
|
2577
|
+
repo: opts.repo,
|
|
2578
|
+
repo_path: opts.repoPath,
|
|
2579
|
+
session_id: opts.session,
|
|
2580
|
+
path: opts.path,
|
|
2581
|
+
agent: opts.agent,
|
|
2582
|
+
memory_ids: memoryIds
|
|
2583
|
+
});
|
|
2584
|
+
}));
|
|
2566
2585
|
hookCmd.command("session-start").description("Record session start").option("--session <id>", "Session ID").option("--agent <agent>", "Agent name").option("--repo <repo>", "Repository slug").option("--repo-path <path>", "Repository path").option("--path <path>", "File path context").option("--claude-code-stdin", "Read Claude Code hook JSON from stdin").option("--codex-stdin", "Read Codex hook JSON from stdin").action(safeHookAction("session-start", async (opts) => {
|
|
2567
2586
|
const stdinAgent = opts.claudeCodeStdin ? "claude-code" : opts.codexStdin ? "codex" : null;
|
|
2568
2587
|
const input = stdinAgent === "claude-code" ? await readClaudeCodeSessionStartInputFromStdin() : stdinAgent === "codex" ? await readCodexSessionStartInputFromStdin() : {
|
|
@@ -3021,6 +3040,36 @@ evalCmd.command("retrieval").description("Run retrieval eval fixtures against ba
|
|
|
3021
3040
|
}
|
|
3022
3041
|
console.log(formatRetrievalEvalReport(report));
|
|
3023
3042
|
});
|
|
3043
|
+
evalCmd.command("value-retrieval").description("Run retrieval eval cases synthesized from recent value telemetry").option("-r, --repo <repo>", "Filter value events by repo").option("--since <iso>", "Window start (default: last 14 days)").option("--limit <n>", "Max value events to inspect", "50").option("-p, --provider <providers>", "Providers to compare (comma-separated: current,nomic,multilingual-e5,bge-small-en-v1.5)", "current").option("--snapshot", "Persist this value retrieval eval into quality snapshot history").option("--note <text>", "Optional note attached to a snapshot").option("--json", "Emit raw JSON report").action(async (opts) => {
|
|
3044
|
+
const db = initDb();
|
|
3045
|
+
const providers = String(opts.provider).split(",").map((value) => value.trim()).filter(Boolean);
|
|
3046
|
+
const report = await runValueRetrievalEval(db, {
|
|
3047
|
+
repo: opts.repo,
|
|
3048
|
+
sinceIso: opts.since,
|
|
3049
|
+
limit: parseInt(opts.limit, 10),
|
|
3050
|
+
providers
|
|
3051
|
+
});
|
|
3052
|
+
let snapshot = null;
|
|
3053
|
+
if (opts.snapshot) {
|
|
3054
|
+
const { computeQualityReport, recordQualitySnapshot } = await import("./quality-3SIDIPJV.js");
|
|
3055
|
+
const qualityReport = computeQualityReport(db, { sinceIso: report.since });
|
|
3056
|
+
snapshot = recordQualitySnapshot(
|
|
3057
|
+
db,
|
|
3058
|
+
qualityReport,
|
|
3059
|
+
opts.note ?? "value-retrieval",
|
|
3060
|
+
summarizeValueRetrievalEval(report)
|
|
3061
|
+
);
|
|
3062
|
+
}
|
|
3063
|
+
if (opts.json) {
|
|
3064
|
+
console.log(JSON.stringify(snapshot ? { snapshot, report } : report, null, 2));
|
|
3065
|
+
return;
|
|
3066
|
+
}
|
|
3067
|
+
console.log(formatValueRetrievalEvalReport(report));
|
|
3068
|
+
if (snapshot) {
|
|
3069
|
+
console.log("");
|
|
3070
|
+
console.log(`Recorded quality snapshot ${snapshot.id.slice(0, 8)} value_recall=${(snapshot.value_eval_recall_at_k * 100).toFixed(1)}% at ${snapshot.taken_at.slice(0, 19)}`);
|
|
3071
|
+
}
|
|
3072
|
+
});
|
|
3024
3073
|
var embeddingsCmd = program.command("embeddings").description("Manage canonical embedding state");
|
|
3025
3074
|
embeddingsCmd.command("setup").description("Pre-fetch the active embedding model into the local cache").action(async () => {
|
|
3026
3075
|
const config = loadEmbeddingConfigFromEnv();
|
|
@@ -3488,13 +3537,13 @@ uiCmd.command("status").description("Show WebUI status").option("--daemon-port <
|
|
|
3488
3537
|
var graphCmd = program.command("graph").description("Inspect and rebuild the knowledge graph (entities + relations)");
|
|
3489
3538
|
graphCmd.command("stats").description("Show entity/relation counts").action(async () => {
|
|
3490
3539
|
const db = initDb();
|
|
3491
|
-
const { countEntities, countRelations } = await import("./store-
|
|
3540
|
+
const { countEntities, countRelations } = await import("./store-PRLXSOOC.js");
|
|
3492
3541
|
console.log(`entities: ${countEntities(db)}`);
|
|
3493
3542
|
console.log(`relations: ${countRelations(db)}`);
|
|
3494
3543
|
});
|
|
3495
3544
|
graphCmd.command("backfill").description("Run the heuristic extractor over every active memory (idempotent)").option("--repo <repo>", "Limit to a single repo").option("--limit <n>", "Cap rows processed", "10000").action(async (opts) => {
|
|
3496
3545
|
const db = initDb();
|
|
3497
|
-
const { ingestMemoryHeuristic } = await import("./ingest-
|
|
3546
|
+
const { ingestMemoryHeuristic } = await import("./ingest-27GZFC7Y.js");
|
|
3498
3547
|
const rows = queryMemories(db, {
|
|
3499
3548
|
repo: opts.repo,
|
|
3500
3549
|
status: "active",
|
|
@@ -3513,7 +3562,7 @@ graphCmd.command("backfill").description("Run the heuristic extractor over every
|
|
|
3513
3562
|
});
|
|
3514
3563
|
graphCmd.command("entities").description("List entities").option("--repo <repo>", "Filter by repo").option("--kind <kind>", "Filter by entity kind").option("--search <q>", "Substring filter on name").option("--limit <n>", "Max rows", "50").action(async (opts) => {
|
|
3515
3564
|
const db = initDb();
|
|
3516
|
-
const { listEntities } = await import("./store-
|
|
3565
|
+
const { listEntities } = await import("./store-PRLXSOOC.js");
|
|
3517
3566
|
const rows = listEntities(db, {
|
|
3518
3567
|
repo: opts.repo,
|
|
3519
3568
|
kind: opts.kind,
|
|
@@ -3532,8 +3581,8 @@ graphCmd.command("entities").description("List entities").option("--repo <repo>"
|
|
|
3532
3581
|
});
|
|
3533
3582
|
graphCmd.command("query <query...>").description("Run graph-aware retrieval for a query").option("--repo <repo>", "Restrict to repo").option("--hops <n>", "Graph hops", "2").option("--limit <n>", "Max hits", "10").action(async (queryTokens, opts) => {
|
|
3534
3583
|
const db = initDb();
|
|
3535
|
-
const { graphQuery } = await import("./retrieval-
|
|
3536
|
-
const { loadEmbeddingConfigFromEnv: loadEmbeddingConfigFromEnv2 } = await import("./embeddings-
|
|
3584
|
+
const { graphQuery } = await import("./retrieval-MXYJRAEW.js");
|
|
3585
|
+
const { loadEmbeddingConfigFromEnv: loadEmbeddingConfigFromEnv2 } = await import("./embeddings-GYY66SAT.js");
|
|
3537
3586
|
const embeddingConfig = loadEmbeddingConfigFromEnv2();
|
|
3538
3587
|
const result = await graphQuery(db, queryTokens.join(" "), embeddingConfig, {
|
|
3539
3588
|
repo: opts.repo,
|
|
@@ -3549,7 +3598,7 @@ graphCmd.command("query <query...>").description("Run graph-aware retrieval for
|
|
|
3549
3598
|
});
|
|
3550
3599
|
var maintenanceCmd = program.command("maintenance").description("Inspect and manage the delegated maintenance task queue");
|
|
3551
3600
|
maintenanceCmd.command("stats").description("Show backlog counts, completion stats, and mean latency").action(async () => {
|
|
3552
|
-
const { getTaskStats } = await import("./tasks-
|
|
3601
|
+
const { getTaskStats } = await import("./tasks-43I6WNJS.js");
|
|
3553
3602
|
const db = initDb();
|
|
3554
3603
|
const stats = getTaskStats(db);
|
|
3555
3604
|
console.log(`Total tasks: ${stats.total}`);
|
|
@@ -3575,7 +3624,7 @@ maintenanceCmd.command("stats").description("Show backlog counts, completion sta
|
|
|
3575
3624
|
}
|
|
3576
3625
|
});
|
|
3577
3626
|
maintenanceCmd.command("list").description("List tasks (default: pending)").option("-s, --status <status>", "pending|claimed|completed|abandoned", "pending").option("-k, --kind <kind>", "Filter by kind").option("-r, --repo <repo>", "Filter by repo").option("-n, --limit <n>", "Max entries", "20").action(async (opts) => {
|
|
3578
|
-
const { listTasks } = await import("./tasks-
|
|
3627
|
+
const { listTasks } = await import("./tasks-43I6WNJS.js");
|
|
3579
3628
|
const db = initDb();
|
|
3580
3629
|
const tasks = listTasks(db, {
|
|
3581
3630
|
status: opts.status,
|
|
@@ -3597,7 +3646,7 @@ maintenanceCmd.command("list").description("List tasks (default: pending)").opti
|
|
|
3597
3646
|
}
|
|
3598
3647
|
});
|
|
3599
3648
|
maintenanceCmd.command("drop").description("Delete a task by id (or id prefix)").argument("<task-id>", "Task id or prefix").action(async (taskIdArg) => {
|
|
3600
|
-
const { deleteTask, listTasks } = await import("./tasks-
|
|
3649
|
+
const { deleteTask, listTasks } = await import("./tasks-43I6WNJS.js");
|
|
3601
3650
|
const db = initDb();
|
|
3602
3651
|
const all = listTasks(db, { limit: 1e4 });
|
|
3603
3652
|
const matches = all.filter((t) => t.id === taskIdArg || t.id.startsWith(taskIdArg));
|
|
@@ -3703,8 +3752,8 @@ credentialsCmd.command("clear").description("Remove provider credentials from th
|
|
|
3703
3752
|
else console.log(`No ${provider} credentials found in Keychain.`);
|
|
3704
3753
|
});
|
|
3705
3754
|
maintenanceCmd.command("dispatch").description("Run the daemon-owned dispatcher once against pending maintenance tasks (requires a configured LLM provider)").option("--provider <provider>", "openai|anthropic|azure-openai (defaults to whichever is configured)").option("--model <model>", "Model override").option("--kind <kind>", "Restrict to a single task kind (repeatable)", (value, acc = []) => [...acc, value], []).option("--repo <repo>", "Restrict to a single repo").option("--max <n>", "Max tasks to run this round", "5").option("--dry-run", "Show which tasks would be dispatched; do not call the LLM").option("--preview", "Show the actual prompts that would be sent (no provider needed; no LLM call)").option("--json", "Emit the raw JSON report").action(async (opts) => {
|
|
3706
|
-
const { dispatchPendingTasks, formatDispatchReport, buildPrompt } = await import("./dispatcher-
|
|
3707
|
-
const { listTasks } = await import("./tasks-
|
|
3755
|
+
const { dispatchPendingTasks, formatDispatchReport, buildPrompt } = await import("./dispatcher-JQIVQUIM.js");
|
|
3756
|
+
const { listTasks } = await import("./tasks-43I6WNJS.js");
|
|
3708
3757
|
const db = initDb();
|
|
3709
3758
|
if (opts.preview) {
|
|
3710
3759
|
const pending = listTasks(db, {
|
|
@@ -3761,7 +3810,7 @@ ${p.prompt.max_output_tokens}
|
|
|
3761
3810
|
console.log(formatDispatchReport(report));
|
|
3762
3811
|
});
|
|
3763
3812
|
maintenanceCmd.command("cleanup").description("Run deterministic, LLM-free cleanup for duplicate, low-quality, stale, and mis-scoped memories").option("--apply", "Persist changes (default is dry-run)").option("--only <action>", "Restrict to one action: dedupe_exact_merge|reject_fragment_candidate|promote_repeat_correction|suppress_unproductive_command|globalize_cross_repo|reject_test_fixture_repo|reject_invalid_scope").option("--revert <run-id>", "Revert a previous cleanup run (id or 8-char prefix)").option("--list", "List recent cleanup runs").option("--json", "Emit the raw JSON report").action(async (opts) => {
|
|
3764
|
-
const { runDeterministicCleanup, formatCleanupReport, revertCleanupRun, listCleanupRuns } = await import("./cleanup-
|
|
3813
|
+
const { runDeterministicCleanup, formatCleanupReport, revertCleanupRun, listCleanupRuns } = await import("./cleanup-KRK5B3AD.js");
|
|
3765
3814
|
const db = initDb();
|
|
3766
3815
|
if (opts.list) {
|
|
3767
3816
|
const runs = listCleanupRuns(db);
|
|
@@ -3808,14 +3857,14 @@ maintenanceCmd.command("cleanup").description("Run deterministic, LLM-free clean
|
|
|
3808
3857
|
}
|
|
3809
3858
|
console.log(formatCleanupReport(report));
|
|
3810
3859
|
});
|
|
3811
|
-
maintenanceCmd.command("quality").description("Show injection outcome distribution and followed-rate over a window").option("--since <iso>", "Window start (default: last 14 days)").option("--snapshot", "Persist this report as a baseline for later comparison").option("--note <text>", "Optional note attached to a snapshot").option("--history", "List recent snapshots and the diff against the latest one").option("--json", "Emit raw JSON").action(async (opts) => {
|
|
3860
|
+
maintenanceCmd.command("quality").description("Show injection outcome distribution and followed-rate over a window").option("--since <iso>", "Window start (default: last 14 days)").option("--snapshot", "Persist this report as a baseline for later comparison").option("--value-eval", "Include telemetry-derived retrieval eval metrics when snapshotting").option("--note <text>", "Optional note attached to a snapshot").option("--history", "List recent snapshots and the diff against the latest one").option("--json", "Emit raw JSON").action(async (opts) => {
|
|
3812
3861
|
const {
|
|
3813
3862
|
computeQualityReport,
|
|
3814
3863
|
formatQualityReport,
|
|
3815
3864
|
recordQualitySnapshot,
|
|
3816
3865
|
listQualitySnapshots,
|
|
3817
3866
|
diffQualitySnapshots
|
|
3818
|
-
} = await import("./quality-
|
|
3867
|
+
} = await import("./quality-3SIDIPJV.js");
|
|
3819
3868
|
const db = initDb();
|
|
3820
3869
|
if (opts.history) {
|
|
3821
3870
|
const snaps = listQualitySnapshots(db);
|
|
@@ -3829,7 +3878,8 @@ maintenanceCmd.command("quality").description("Show injection outcome distributi
|
|
|
3829
3878
|
}
|
|
3830
3879
|
for (const s of snaps) {
|
|
3831
3880
|
const rate = s.followed_rate_resolved != null ? `${(s.followed_rate_resolved * 100).toFixed(1)}%` : "n/a";
|
|
3832
|
-
|
|
3881
|
+
const valueRecall = `${(s.value_eval_recall_at_k * 100).toFixed(1)}%`;
|
|
3882
|
+
console.log(`${s.taken_at.slice(0, 19)} followed=${rate} value_recall=${valueRecall} value_cases=${s.value_eval_cases} resolved=${s.injections_resolved} history=${s.history_injections_total} rules=${s.active_rule_count} cand=${s.candidate_correction_count}${s.notes ? ` (${s.notes})` : ""}`);
|
|
3833
3883
|
}
|
|
3834
3884
|
if (snaps.length >= 2) {
|
|
3835
3885
|
const diff = diffQualitySnapshots(snaps[snaps.length - 1], snaps[0]);
|
|
@@ -3843,12 +3893,19 @@ maintenanceCmd.command("quality").description("Show injection outcome distributi
|
|
|
3843
3893
|
console.log(` candidates: ${diff.candidate_delta >= 0 ? "+" : ""}${diff.candidate_delta}`);
|
|
3844
3894
|
console.log(` history injects: ${diff.history_injections_delta >= 0 ? "+" : ""}${diff.history_injections_delta}`);
|
|
3845
3895
|
console.log(` history snippets:${diff.history_snippets_delta >= 0 ? "+" : ""}${diff.history_snippets_delta}`);
|
|
3896
|
+
console.log(` value cases: ${diff.value_eval_cases_delta >= 0 ? "+" : ""}${diff.value_eval_cases_delta}`);
|
|
3897
|
+
console.log(` value recall: ${diff.value_eval_recall_at_k_delta_pp >= 0 ? "+" : ""}${diff.value_eval_recall_at_k_delta_pp.toFixed(1)}pp`);
|
|
3898
|
+
console.log(` value mrr: ${diff.value_eval_mrr_delta >= 0 ? "+" : ""}${diff.value_eval_mrr_delta.toFixed(3)}`);
|
|
3899
|
+
console.log(` value override: ${diff.value_eval_override_rate_delta_pp >= 0 ? "+" : ""}${diff.value_eval_override_rate_delta_pp.toFixed(1)}pp`);
|
|
3846
3900
|
}
|
|
3847
3901
|
return;
|
|
3848
3902
|
}
|
|
3849
3903
|
const report = computeQualityReport(db, { sinceIso: opts.since });
|
|
3850
3904
|
if (opts.snapshot) {
|
|
3851
|
-
const
|
|
3905
|
+
const valueEval = opts.valueEval ? summarizeValueRetrievalEval(await runValueRetrievalEval(db, {
|
|
3906
|
+
sinceIso: report.window_start
|
|
3907
|
+
})) : void 0;
|
|
3908
|
+
const row = recordQualitySnapshot(db, report, opts.note, valueEval);
|
|
3852
3909
|
if (opts.json) {
|
|
3853
3910
|
console.log(JSON.stringify({ snapshot: row, report }, null, 2));
|
|
3854
3911
|
return;
|
|
@@ -3865,7 +3922,7 @@ maintenanceCmd.command("quality").description("Show injection outcome distributi
|
|
|
3865
3922
|
console.log(formatQualityReport(report));
|
|
3866
3923
|
});
|
|
3867
3924
|
maintenanceCmd.command("usage").description("Summarize LLM API usage (tokens, cost) across recent maintenance runs").option("--since <iso>", "Window start (default: last 30 days)").option("--limit <n>", "Recent-call rows to show", "10").option("--json", "Emit raw JSON summary").action(async (opts) => {
|
|
3868
|
-
const { summarizeUsage, formatUsageReport } = await import("./usage-
|
|
3925
|
+
const { summarizeUsage, formatUsageReport } = await import("./usage-KHOLIR3S.js");
|
|
3869
3926
|
const db = initDb();
|
|
3870
3927
|
const summary = summarizeUsage(db, {
|
|
3871
3928
|
sinceIso: opts.since,
|
|
@@ -3914,6 +3971,17 @@ function formatAgentName(agent) {
|
|
|
3914
3971
|
function collectAgents(value, previous) {
|
|
3915
3972
|
return [...previous, value];
|
|
3916
3973
|
}
|
|
3974
|
+
function collectMemoryIds(value, previous) {
|
|
3975
|
+
return [...previous, value];
|
|
3976
|
+
}
|
|
3977
|
+
function resolveMemoryIdPrefixes(prefixes) {
|
|
3978
|
+
const db = initDb();
|
|
3979
|
+
return prefixes.map((prefix) => {
|
|
3980
|
+
const mem = findByPrefix(db, prefix);
|
|
3981
|
+
if (!mem) throw new Error(`Memory not found: ${prefix}`);
|
|
3982
|
+
return mem.id;
|
|
3983
|
+
});
|
|
3984
|
+
}
|
|
3917
3985
|
async function confirmSetupWrite(scope) {
|
|
3918
3986
|
const { createInterface } = await import("readline/promises");
|
|
3919
3987
|
const rl = createInterface({
|