daftari 1.21.0 → 1.23.0

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.
Files changed (95) hide show
  1. package/CHANGELOG.md +62 -1
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +7 -0
  4. package/dist/cli.js.map +1 -1
  5. package/dist/consolidate/admit.d.ts +15 -0
  6. package/dist/consolidate/admit.d.ts.map +1 -0
  7. package/dist/consolidate/admit.js +176 -0
  8. package/dist/consolidate/admit.js.map +1 -0
  9. package/dist/consolidate/birth.d.ts +79 -0
  10. package/dist/consolidate/birth.d.ts.map +1 -0
  11. package/dist/consolidate/birth.js +315 -0
  12. package/dist/consolidate/birth.js.map +1 -0
  13. package/dist/consolidate/clocks.d.ts +15 -0
  14. package/dist/consolidate/clocks.d.ts.map +1 -0
  15. package/dist/consolidate/clocks.js +127 -0
  16. package/dist/consolidate/clocks.js.map +1 -0
  17. package/dist/consolidate/constants.d.ts +26 -0
  18. package/dist/consolidate/constants.d.ts.map +1 -0
  19. package/dist/consolidate/constants.js +83 -0
  20. package/dist/consolidate/constants.js.map +1 -0
  21. package/dist/consolidate/decorrelation.d.ts +69 -0
  22. package/dist/consolidate/decorrelation.d.ts.map +1 -0
  23. package/dist/consolidate/decorrelation.js +287 -0
  24. package/dist/consolidate/decorrelation.js.map +1 -0
  25. package/dist/consolidate/derivation-prompt.d.ts +28 -0
  26. package/dist/consolidate/derivation-prompt.d.ts.map +1 -0
  27. package/dist/consolidate/derivation-prompt.js +72 -0
  28. package/dist/consolidate/derivation-prompt.js.map +1 -0
  29. package/dist/consolidate/edge-write.d.ts +9 -0
  30. package/dist/consolidate/edge-write.d.ts.map +1 -0
  31. package/dist/consolidate/edge-write.js +59 -0
  32. package/dist/consolidate/edge-write.js.map +1 -0
  33. package/dist/consolidate/envelope.d.ts +27 -0
  34. package/dist/consolidate/envelope.d.ts.map +1 -0
  35. package/dist/consolidate/envelope.js +90 -0
  36. package/dist/consolidate/envelope.js.map +1 -0
  37. package/dist/consolidate/index.d.ts +2 -0
  38. package/dist/consolidate/index.d.ts.map +1 -0
  39. package/dist/consolidate/index.js +531 -0
  40. package/dist/consolidate/index.js.map +1 -0
  41. package/dist/consolidate/priority.d.ts +25 -0
  42. package/dist/consolidate/priority.d.ts.map +1 -0
  43. package/dist/consolidate/priority.js +103 -0
  44. package/dist/consolidate/priority.js.map +1 -0
  45. package/dist/consolidate/revision.d.ts +81 -0
  46. package/dist/consolidate/revision.d.ts.map +1 -0
  47. package/dist/consolidate/revision.js +274 -0
  48. package/dist/consolidate/revision.js.map +1 -0
  49. package/dist/consolidate/state.d.ts +10 -0
  50. package/dist/consolidate/state.d.ts.map +1 -0
  51. package/dist/consolidate/state.js +54 -0
  52. package/dist/consolidate/state.js.map +1 -0
  53. package/dist/curation/edges.d.ts +5 -0
  54. package/dist/curation/edges.d.ts.map +1 -1
  55. package/dist/curation/edges.js +82 -9
  56. package/dist/curation/edges.js.map +1 -1
  57. package/dist/curation/shadow.d.ts +30 -0
  58. package/dist/curation/shadow.d.ts.map +1 -1
  59. package/dist/curation/shadow.js +84 -26
  60. package/dist/curation/shadow.js.map +1 -1
  61. package/dist/curation/staged-actions.d.ts +2 -0
  62. package/dist/curation/staged-actions.d.ts.map +1 -1
  63. package/dist/curation/staged-actions.js +8 -0
  64. package/dist/curation/staged-actions.js.map +1 -1
  65. package/dist/curation/tension.d.ts +1 -0
  66. package/dist/curation/tension.d.ts.map +1 -1
  67. package/dist/curation/tension.js +8 -0
  68. package/dist/curation/tension.js.map +1 -1
  69. package/dist/curation/vault-docs.d.ts +2 -1
  70. package/dist/curation/vault-docs.d.ts.map +1 -1
  71. package/dist/curation/vault-docs.js +1 -0
  72. package/dist/curation/vault-docs.js.map +1 -1
  73. package/dist/eval/llm.d.ts +3 -1
  74. package/dist/eval/llm.d.ts.map +1 -1
  75. package/dist/eval/llm.js +6 -2
  76. package/dist/eval/llm.js.map +1 -1
  77. package/dist/index.js +1 -1
  78. package/dist/storage/index-db.d.ts +2 -0
  79. package/dist/storage/index-db.d.ts.map +1 -1
  80. package/dist/storage/index-db.js +14 -9
  81. package/dist/storage/index-db.js.map +1 -1
  82. package/dist/tools/curation.d.ts.map +1 -1
  83. package/dist/tools/curation.js +16 -2
  84. package/dist/tools/curation.js.map +1 -1
  85. package/dist/tools/edges.d.ts.map +1 -1
  86. package/dist/tools/edges.js +1 -0
  87. package/dist/tools/edges.js.map +1 -1
  88. package/dist/tools/staged-actions.d.ts.map +1 -1
  89. package/dist/tools/staged-actions.js +2 -0
  90. package/dist/tools/staged-actions.js.map +1 -1
  91. package/dist/utils/git.d.ts +1 -0
  92. package/dist/utils/git.d.ts.map +1 -1
  93. package/dist/utils/git.js +19 -0
  94. package/dist/utils/git.js.map +1 -1
  95. package/package.json +1 -1
@@ -0,0 +1,315 @@
1
+ // Birth mode (spec §4.0, brief item 1). For an unprocessed doc, retrieve its
2
+ // top-K embedding neighbors and ask the LLM — with a foundational-ordering
3
+ // prompt, both docs' content loaded — whether it has a load-bearing derivation
4
+ // with each neighbor and which is the premise; emit edge_observe for survivors,
5
+ // log the full top-K + outcomes to the birth trace for post-hoc recall@K
6
+ // evaluation, and return the content hash so the caller can advance
7
+ // `consolidate-state.json`'s birth-processed map.
8
+ //
9
+ // Direction is elicited in BOTH orders per neighbor (option c, design §3.1
10
+ // amendment): agreement ⇒ a trusted directed edge; an explicit `symmetric` or
11
+ // an order-disagreement ⇒ a canonical-sorted *pending* edge (premiseVote
12
+ // "symmetric", direction-unconfirmed) plus an interpretive tension for human
13
+ // adjudication. The gate showed ambiguous real-prose pairs return a confident
14
+ // but order-dependent direction rather than `symmetric`, so both orders are
15
+ // required to catch that.
16
+ //
17
+ // One pass per neighbor — NOT a panel (the panel is revision-mode, §4.1).
18
+ // Birth seeds k=0 candidates; subsequent revision passes earn strength.
19
+ import { createHash } from "node:crypto";
20
+ import { appendFileSync, mkdirSync } from "node:fs";
21
+ import { join, posix } from "node:path";
22
+ import { err, ok } from "../frontmatter/types.js";
23
+ import { CONSOLIDATE_AGENT } from "./constants.js";
24
+ import { DERIVATION_SYSTEM, DERIVATION_VERDICT_SCHEMA, derivationUserBody, parseDerivationVerdict, } from "./derivation-prompt.js";
25
+ // --- canonicalization --------------------------------------------------------
26
+ // Same canon() as src/consolidate/index.ts uses. Path-aliasing is the bug
27
+ // class that bit edge store + merge + Stage 1; every keyed boundary
28
+ // canonicalizes (memory: canonicalize-path-keys).
29
+ function canon(p) {
30
+ return posix.normalize(p).replace(/^\.\//, "");
31
+ }
32
+ // Map an order-1 verdict (A=doc, B=neighbor) to a real-world premise.
33
+ function realWorldPremise1(v) {
34
+ if (!v.related)
35
+ return "unrelated";
36
+ if (v.premise === "symmetric")
37
+ return "symmetric";
38
+ if (v.premise === "A")
39
+ return "doc";
40
+ if (v.premise === "B")
41
+ return "neighbor";
42
+ return "unrelated";
43
+ }
44
+ // Map an order-2 verdict (A=neighbor, B=doc) to a real-world premise.
45
+ function realWorldPremise2(v) {
46
+ if (!v.related)
47
+ return "unrelated";
48
+ if (v.premise === "symmetric")
49
+ return "symmetric";
50
+ if (v.premise === "A")
51
+ return "neighbor";
52
+ if (v.premise === "B")
53
+ return "doc";
54
+ return "unrelated";
55
+ }
56
+ // Reconcile both orders into a single edge decision. Conservative on existence
57
+ // (either order saying "unrelated" ⇒ no edge); any explicit symmetric ⇒ pending;
58
+ // agreement on the premise ⇒ directed; disagreement (one says doc, the other
59
+ // neighbor) ⇒ pending-contested.
60
+ export function reconcileDirection(order1, order2) {
61
+ const r1 = realWorldPremise1(order1);
62
+ const r2 = realWorldPremise2(order2);
63
+ if (r1 === "unrelated" || r2 === "unrelated")
64
+ return { kind: "unrelated" };
65
+ if (r1 === "symmetric" || r2 === "symmetric")
66
+ return { kind: "symmetric", contested: false };
67
+ if (r1 === r2)
68
+ return { kind: "directed", premise: r1 };
69
+ return { kind: "symmetric", contested: true };
70
+ }
71
+ // --- prompt input bounding ---------------------------------------------------
72
+ // Truncate doc content for the prompt. Birth doesn't need the whole doc —
73
+ // the central claim is usually in the first ~1500 chars; a longer corpus
74
+ // is calibration noise + cost. Tunable from constants if needed.
75
+ const MAX_DOC_CHARS = 1500;
76
+ function truncate(s) {
77
+ return s.length <= MAX_DOC_CHARS ? s : `${s.slice(0, MAX_DOC_CHARS)}\n…[truncated]`;
78
+ }
79
+ // Defensive wrapper around the injected admit. The live makeAdmit (Task 7) does
80
+ // I/O — reads provenance / decay / tension state — so it can throw (network,
81
+ // config, fs). The house style is no-throw from this loop: a thrown admit must
82
+ // NOT crash the whole birth pass (losing every neighbor's verdict + the trace).
83
+ // Treat a throw as a refusal on the invariants gate (fail-closed: never write
84
+ // when the gate couldn't be evaluated), recorded like any other gated outcome.
85
+ async function safeAdmit(admit, action) {
86
+ try {
87
+ return await admit(action);
88
+ }
89
+ catch (e) {
90
+ return {
91
+ admit: false,
92
+ gate: "invariants",
93
+ reason: `admit threw: ${e instanceof Error ? e.message : String(e)}`,
94
+ impact: 0,
95
+ };
96
+ }
97
+ }
98
+ // A non-empty one-line claim snippet for the tension record (addTension rejects
99
+ // empty claims). Falls back to the path when the content is blank.
100
+ function claimSnippet(content, fallback) {
101
+ const line = content.split("\n").find((l) => l.trim().length > 0);
102
+ const snip = (line ?? "").trim().slice(0, 200);
103
+ return snip.length > 0 ? snip : `(no readable content: ${fallback})`;
104
+ }
105
+ // --- birth pass --------------------------------------------------------------
106
+ export async function birthOne(doc, deps, opts) {
107
+ const docPath = canon(doc.relPath);
108
+ const contentHash = createHash("sha256").update(doc.content).digest("hex").slice(0, 16);
109
+ const docContent = truncate(doc.content);
110
+ const neighborsRes = await deps.searchNeighbors(docPath, 20);
111
+ if (!neighborsRes.ok)
112
+ return neighborsRes;
113
+ const neighbors = neighborsRes.value.map(canon).filter((n) => n !== docPath);
114
+ const verdicts = [];
115
+ const observations = [];
116
+ let gatedCount = 0;
117
+ let llmCalls = 0;
118
+ let inputTokens = 0;
119
+ let outputTokens = 0;
120
+ for (const neighbor of neighbors) {
121
+ // Each neighbor needs both orders; stop if we can't afford the pair.
122
+ if (llmCalls + 2 > opts.budgetRemaining)
123
+ break;
124
+ const nc = await deps.loadNeighborContent(neighbor);
125
+ if (!nc.ok) {
126
+ verdicts.push({ neighbor, error: `load failed: ${nc.error.message}` });
127
+ continue;
128
+ }
129
+ const neighborContent = truncate(nc.value);
130
+ // Order 1: DOC A = this doc, DOC B = neighbor.
131
+ const r1 = await deps.llm.completeJson({
132
+ model: opts.model,
133
+ system: DERIVATION_SYSTEM,
134
+ user: derivationUserBody(docPath, docContent, neighbor, neighborContent),
135
+ schema: DERIVATION_VERDICT_SCHEMA,
136
+ temperature: 0,
137
+ });
138
+ llmCalls++;
139
+ if (!r1.ok) {
140
+ verdicts.push({ neighbor, error: r1.error.message });
141
+ continue;
142
+ }
143
+ inputTokens += r1.value.input_tokens;
144
+ outputTokens += r1.value.output_tokens;
145
+ const p1 = parseDerivationVerdict(r1.value.parsed);
146
+ if (!p1.ok) {
147
+ verdicts.push({ neighbor, error: p1.error.message });
148
+ continue;
149
+ }
150
+ // Order 2: DOC A = neighbor, DOC B = this doc.
151
+ const r2 = await deps.llm.completeJson({
152
+ model: opts.model,
153
+ system: DERIVATION_SYSTEM,
154
+ user: derivationUserBody(neighbor, neighborContent, docPath, docContent),
155
+ schema: DERIVATION_VERDICT_SCHEMA,
156
+ temperature: 0,
157
+ });
158
+ llmCalls++;
159
+ if (!r2.ok) {
160
+ verdicts.push({ neighbor, error: r2.error.message });
161
+ continue;
162
+ }
163
+ inputTokens += r2.value.input_tokens;
164
+ outputTokens += r2.value.output_tokens;
165
+ const p2 = parseDerivationVerdict(r2.value.parsed);
166
+ if (!p2.ok) {
167
+ verdicts.push({ neighbor, error: p2.error.message });
168
+ continue;
169
+ }
170
+ const outcome = reconcileDirection(p1.value, p2.value);
171
+ const reason = p1.value.reason;
172
+ if (outcome.kind === "unrelated") {
173
+ verdicts.push({ neighbor, related: false, direction: "none", premise: null, reason });
174
+ continue;
175
+ }
176
+ if (outcome.kind === "directed") {
177
+ // Premise is materialized on `to` (clocks: from depends on to). doc-premise
178
+ // ⇒ to=doc, from=neighbor; neighbor-premise ⇒ to=neighbor, from=doc.
179
+ const [from, to] = outcome.premise === "doc" ? [neighbor, docPath] : [docPath, neighbor];
180
+ // Consult the envelope ONCE for this neighbor's edge-action. On refuse:
181
+ // record a gated verdict, count it, and skip the write entirely.
182
+ const verdict = await safeAdmit(deps.admit, {
183
+ action: "edge-observe",
184
+ fromPath: from,
185
+ toPath: to,
186
+ });
187
+ if (!verdict.admit) {
188
+ verdicts.push({
189
+ neighbor,
190
+ related: true,
191
+ direction: "directed",
192
+ premise: outcome.premise,
193
+ reason,
194
+ gated: true,
195
+ gate: verdict.gate,
196
+ });
197
+ gatedCount++;
198
+ continue;
199
+ }
200
+ verdicts.push({
201
+ neighbor,
202
+ related: true,
203
+ direction: "directed",
204
+ premise: outcome.premise,
205
+ reason,
206
+ });
207
+ const obs = await deps.observe({
208
+ fromPath: from,
209
+ toPath: to,
210
+ observedBy: opts.agent,
211
+ blind: true,
212
+ axis: "prompt",
213
+ premiseVote: "to",
214
+ note: `birth: ${reason}`,
215
+ });
216
+ if (!obs.ok) {
217
+ verdicts.push({ neighbor, error: `observe failed: ${obs.error.message}` });
218
+ continue;
219
+ }
220
+ observations.push({ from, to });
221
+ continue;
222
+ }
223
+ // symmetric — a canonical-sorted pending edge (direction unconfirmed) so
224
+ // re-observation lands on the same key, plus an interpretive tension.
225
+ const [from, to] = [docPath, neighbor].sort();
226
+ const which = outcome.contested ? "contested" : "mutual";
227
+ // Consult the envelope ONCE for this neighbor's edge-action. On refuse:
228
+ // record a gated verdict, count it, and skip BOTH the observe AND the
229
+ // direction-pending tension (no write of any kind).
230
+ const symVerdict = await safeAdmit(deps.admit, {
231
+ action: "edge-observe",
232
+ fromPath: from,
233
+ toPath: to,
234
+ });
235
+ if (!symVerdict.admit) {
236
+ verdicts.push({
237
+ neighbor,
238
+ related: true,
239
+ direction: "symmetric",
240
+ premise: null,
241
+ reason,
242
+ gated: true,
243
+ gate: symVerdict.gate,
244
+ });
245
+ gatedCount++;
246
+ continue;
247
+ }
248
+ verdicts.push({ neighbor, related: true, direction: "symmetric", premise: null, reason });
249
+ const obs = await deps.observe({
250
+ fromPath: from,
251
+ toPath: to,
252
+ observedBy: opts.agent,
253
+ blind: true,
254
+ axis: "prompt",
255
+ premiseVote: "symmetric",
256
+ note: `birth/symmetric(${which}): ${reason}`,
257
+ });
258
+ if (!obs.ok) {
259
+ verdicts.push({ neighbor, error: `observe failed: ${obs.error.message}` });
260
+ continue;
261
+ }
262
+ observations.push({ from, to });
263
+ const tension = await deps.recordTension({
264
+ title: `direction-pending (${which}): ${from} ↔ ${to}`,
265
+ kind: "interpretive",
266
+ sourceA: docPath,
267
+ claimA: claimSnippet(doc.content, docPath),
268
+ sourceB: neighbor,
269
+ claimB: claimSnippet(nc.value, neighbor),
270
+ loggedBy: opts.agent,
271
+ });
272
+ if (!tension.ok) {
273
+ verdicts.push({ neighbor, error: `tension failed: ${tension.error.message}` });
274
+ }
275
+ }
276
+ const traceRes = await deps.recordBirthTrace({
277
+ at: new Date().toISOString().replace(/\.\d{3}Z$/, "Z"),
278
+ docPath,
279
+ contentHash,
280
+ topK: neighbors,
281
+ axis: opts.axis,
282
+ model: opts.model,
283
+ verdicts,
284
+ });
285
+ return ok({
286
+ docPath,
287
+ contentHash,
288
+ neighbors,
289
+ verdicts,
290
+ observations,
291
+ gatedCount,
292
+ llmCalls,
293
+ inputTokens,
294
+ outputTokens,
295
+ traceWritten: traceRes.ok,
296
+ ...(traceRes.ok ? {} : { traceError: traceRes.error.message }),
297
+ });
298
+ }
299
+ // --- the CLI-wired trace recorder --------------------------------------------
300
+ export function birthTracePath(vaultRoot) {
301
+ return join(vaultRoot, ".daftari", "birth-trace.jsonl");
302
+ }
303
+ export async function appendBirthTrace(vaultRoot, row) {
304
+ try {
305
+ mkdirSync(join(vaultRoot, ".daftari"), { recursive: true });
306
+ appendFileSync(birthTracePath(vaultRoot), `${JSON.stringify(row)}\n`);
307
+ return ok(undefined);
308
+ }
309
+ catch (e) {
310
+ return err(new Error(`cannot record birth trace: ${e instanceof Error ? e.message : String(e)}`));
311
+ }
312
+ }
313
+ // Re-exported so the CLI doesn't have to import it from constants alone.
314
+ export { CONSOLIDATE_AGENT };
315
+ //# sourceMappingURL=birth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"birth.js","sourceRoot":"","sources":["../../src/consolidate/birth.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,2EAA2E;AAC3E,+EAA+E;AAC/E,gFAAgF;AAChF,yEAAyE;AACzE,oEAAoE;AACpE,kDAAkD;AAClD,EAAE;AACF,2EAA2E;AAC3E,8EAA8E;AAC9E,yEAAyE;AACzE,6EAA6E;AAC7E,8EAA8E;AAC9E,4EAA4E;AAC5E,0BAA0B;AAC1B,EAAE;AACF,0EAA0E;AAC1E,wEAAwE;AAExE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAIxC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAe,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAkC,MAAM,gBAAgB,CAAC;AACnF,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EAEzB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AA+FhC,gFAAgF;AAEhF,0EAA0E;AAC1E,oEAAoE;AACpE,kDAAkD;AAClD,SAAS,KAAK,CAAC,CAAS;IACtB,OAAO,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AACjD,CAAC;AASD,sEAAsE;AACtE,SAAS,iBAAiB,CAAC,CAAoB;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CAAC;QACR,OAAO;QACP,WAAW;QACX,SAAS;QACT,QAAQ;QACR,YAAY;QACZ,UAAU;QACV,QAAQ;QACR,WAAW;QACX,YAAY;QACZ,YAAY,EAAE,QAAQ,CAAC,EAAE;QACzB,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;KAC/D,CAAC,CAAC;AACL,CAAC;AAED,gFAAgF;AAEhF,MAAM,UAAU,cAAc,CAAC,SAAiB;IAC9C,OAAO,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE,mBAAmB,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,SAAiB,EACjB,GAAkB;IAElB,IAAI,CAAC;QACH,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,cAAc,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACtE,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC;IACvB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,GAAG,CACR,IAAI,KAAK,CAAC,8BAA8B,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CACtF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,yEAAyE;AACzE,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { type DerivesFromEdge } from "../curation/edges.js";
2
+ export type DueReason = "backstop" | "decay" | "event";
3
+ export interface DueEdge {
4
+ fromPath: string;
5
+ toPath: string;
6
+ strength: number;
7
+ reason: DueReason;
8
+ }
9
+ export declare function decayBackstopDue(edges: DerivesFromEdge[], now: Date): DueEdge[];
10
+ export declare function eventDue(changedPaths: string[], edges: DerivesFromEdge[]): DueEdge[];
11
+ export declare function birthQueue(docs: Array<{
12
+ relPath: string;
13
+ content: string;
14
+ }>, birthProcessed: Record<string, string>): string[];
15
+ //# sourceMappingURL=clocks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clocks.d.ts","sourceRoot":"","sources":["../../src/consolidate/clocks.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,eAAe,EAAc,MAAM,sBAAsB,CAAC;AAQxE,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC;AACvD,MAAM,WAAW,OAAO;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,SAAS,CAAC;CACnB;AAUD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,EAAE,EAAE,GAAG,EAAE,IAAI,GAAG,OAAO,EAAE,CAsB/E;AAqBD,wBAAgB,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,eAAe,EAAE,GAAG,OAAO,EAAE,CAmDpF;AAKD,wBAAgB,UAAU,CACxB,IAAI,EAAE,KAAK,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,EACjD,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACrC,MAAM,EAAE,CAIV"}
@@ -0,0 +1,127 @@
1
+ // The three session-start clocks (spec §3.1), as pure functions over injected
2
+ // edges/docs — no I/O, so they are exhaustively testable with a fixed `now`.
3
+ // The I/O wrapper that feeds them is runConsolidate (index.ts).
4
+ //
5
+ // NOTE (Stage 1 scope): the decay clock keys off edge aged-strength only. The
6
+ // spec's TTL-on-docs input (`ttl_days` frontmatter feeding the same clock) is
7
+ // deferred to a later stage; it is additive and does not change the edge math.
8
+ import { EDGE_K_CAP } from "../curation/edges.js";
9
+ import { CONSOLIDATE_MAX_INTERVAL_DAYS, CONSOLIDATE_PATH_STRENGTH_FLOOR, reviewIntervalDays, } from "./constants.js";
10
+ import { docContentHash } from "./state.js";
11
+ const MS_PER_DAY = 86_400_000;
12
+ function daysBetween(thenISO, now) {
13
+ return (now.getTime() - new Date(thenISO).getTime()) / MS_PER_DAY;
14
+ }
15
+ // Decay + backstop clocks. Backstop dominates (it is the guarantee): an edge past
16
+ // the max-interval cap is backstop-overdue regardless of strength; otherwise an
17
+ // edge past its strength-scaled review interval is decay-due.
18
+ export function decayBackstopDue(edges, now) {
19
+ const out = [];
20
+ for (const e of edges) {
21
+ if (e.status === "revoked")
22
+ continue;
23
+ // Direction-unconfirmed edges are not trusted to bear triggers (spec §3.4);
24
+ // they stay visible as undirected relationships but never become due.
25
+ if (e.directionVerdict === "symmetric")
26
+ continue;
27
+ // Clamp at 0: a future-dated lastRederived (clock skew) yields a negative age;
28
+ // either way such an edge is fresh, not due (consistent with priority.ts ageOf).
29
+ const age = Math.max(0, daysBetween(e.lastRederived, now));
30
+ if (age >= CONSOLIDATE_MAX_INTERVAL_DAYS) {
31
+ out.push({
32
+ fromPath: e.fromPath,
33
+ toPath: e.toPath,
34
+ strength: e.strength,
35
+ reason: "backstop",
36
+ });
37
+ }
38
+ else if (age >= reviewIntervalDays(e.strength)) {
39
+ out.push({ fromPath: e.fromPath, toPath: e.toPath, strength: e.strength, reason: "decay" });
40
+ }
41
+ }
42
+ return out;
43
+ }
44
+ const edgeKey = (from, to) => `${from}\n${to}`;
45
+ // Event clock: forward walk from changed premises over derives_from edges. An
46
+ // edge (from → to) means `from` depends on `to`; a changed `to` makes `from` due.
47
+ //
48
+ // Attenuation: edge `strength` is the aged value in [0, EDGE_K_CAP] (k·decay), so
49
+ // a strong edge has strength > 1 — multiplying raw strengths would *amplify* the
50
+ // signal and never hit the floor. We normalize each hop to a factor in [0,1]
51
+ // (strength / EDGE_K_CAP): a fully-earned edge passes the change-signal undimmed,
52
+ // a weak/aged edge attenuates it. Reach = ∏(factors); a path stops below the
53
+ // floor (spec §3.1, C-Q2).
54
+ //
55
+ // Max-product relaxation: a node can be reached by several paths with different
56
+ // products. We keep the BEST (largest) product per node and re-expand when a
57
+ // strictly larger product arrives — a plain visited-on-first-touch guard would
58
+ // prune a node's descendants using whatever (possibly weaker) path reached it
59
+ // first, which is order-dependent and wrongly drops reachable edges. Dedup is by
60
+ // the full edge (from,to): two distinct edges sharing a `from` (a←b and a←c) are
61
+ // separate review units (§4) and must both surface.
62
+ export function eventDue(changedPaths, edges) {
63
+ const byPremise = new Map();
64
+ for (const e of edges) {
65
+ if (e.status === "revoked")
66
+ continue;
67
+ // Direction-unconfirmed edges don't propagate change signals (spec §3.4):
68
+ // we can't trust which endpoint is the premise, so a change on either side
69
+ // must not fabricate a due dependent.
70
+ if (e.directionVerdict === "symmetric")
71
+ continue;
72
+ const list = byPremise.get(e.toPath) ?? [];
73
+ list.push(e);
74
+ byPremise.set(e.toPath, list);
75
+ }
76
+ const due = new Map();
77
+ const bestProduct = new Map();
78
+ const queue = [];
79
+ for (const p of changedPaths) {
80
+ if ((bestProduct.get(p) ?? -1) < 1) {
81
+ bestProduct.set(p, 1);
82
+ queue.push({ path: p, product: 1 });
83
+ }
84
+ }
85
+ // Hard stop: products only decrease (factors ≤ 1) and we re-enqueue only on
86
+ // strict improvement, so this converges; the cap is a defensive backstop.
87
+ const maxExpansions = edges.length * edges.length + edges.length + changedPaths.length + 16;
88
+ let head = 0;
89
+ let expansions = 0;
90
+ while (head < queue.length && expansions < maxExpansions) {
91
+ const item = queue[head++];
92
+ if (!item)
93
+ break;
94
+ expansions += 1;
95
+ if (item.product < (bestProduct.get(item.path) ?? 0))
96
+ continue; // stale entry
97
+ for (const e of byPremise.get(item.path) ?? []) {
98
+ const factor = Math.min(Math.max(e.strength / EDGE_K_CAP, 0), 1);
99
+ const carried = item.product * factor;
100
+ if (carried < CONSOLIDATE_PATH_STRENGTH_FLOOR)
101
+ continue; // signal faded
102
+ const key = edgeKey(e.fromPath, e.toPath);
103
+ if (!due.has(key)) {
104
+ due.set(key, {
105
+ fromPath: e.fromPath,
106
+ toPath: e.toPath,
107
+ strength: e.strength,
108
+ reason: "event",
109
+ });
110
+ }
111
+ if (carried > (bestProduct.get(e.fromPath) ?? 0)) {
112
+ bestProduct.set(e.fromPath, carried);
113
+ queue.push({ path: e.fromPath, product: carried });
114
+ }
115
+ }
116
+ }
117
+ return [...due.values()];
118
+ }
119
+ // Birth queue: docs never processed, or whose content changed since (edited ⇒
120
+ // re-birth, spec §4.0). Stage 1 only computes this; it never marks anything
121
+ // processed (no births are executed — that is Stage 2).
122
+ export function birthQueue(docs, birthProcessed) {
123
+ return docs
124
+ .filter((d) => birthProcessed[d.relPath] !== docContentHash(d.content))
125
+ .map((d) => d.relPath);
126
+ }
127
+ //# sourceMappingURL=clocks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clocks.js","sourceRoot":"","sources":["../../src/consolidate/clocks.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,6EAA6E;AAC7E,gEAAgE;AAChE,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAE/E,OAAO,EAAwB,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EACL,6BAA6B,EAC7B,+BAA+B,EAC/B,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAU5C,MAAM,UAAU,GAAG,UAAU,CAAC;AAC9B,SAAS,WAAW,CAAC,OAAe,EAAE,GAAS;IAC7C,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,UAAU,CAAC;AACpE,CAAC;AAED,kFAAkF;AACl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AAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;gBACjD,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;gBACrC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;YACrD,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;AAC3B,CAAC;AAED,8EAA8E;AAC9E,4EAA4E;AAC5E,wDAAwD;AACxD,MAAM,UAAU,UAAU,CACxB,IAAiD,EACjD,cAAsC;IAEtC,OAAO,IAAI;SACR,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;SACtE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,26 @@
1
+ export declare const CONSOLIDATE_MIN_INTERVAL_DAYS = 1;
2
+ export declare const CONSOLIDATE_MAX_INTERVAL_DAYS = 90;
3
+ export declare function reviewIntervalDays(strength: number): number;
4
+ export declare const CONSOLIDATE_PATH_STRENGTH_FLOOR = 0.1;
5
+ export declare const CONSOLIDATE_SLICE_FRACTIONS: {
6
+ readonly backstop: 0.25;
7
+ readonly main: 0.45;
8
+ readonly periphery: 0.15;
9
+ readonly birth: 0.15;
10
+ };
11
+ export declare const CONSOLIDATE_DEFAULT_BUDGET = 50;
12
+ export declare const CONSOLIDATE_PANEL_SIZE = 2;
13
+ export declare const CONSOLIDATE_BIRTH_TOP_K = 20;
14
+ export declare const CONSOLIDATE_DEFAULT_MODEL = "claude-haiku-4-5-20251001";
15
+ export declare const CONSOLIDATE_AGENT = "agent:curation-loop";
16
+ export declare const CONSOLIDATE_PROMPT_TEMPLATES: readonly ["forward", "reverse", "contrast"];
17
+ export type ConsolidatePromptTemplate = (typeof CONSOLIDATE_PROMPT_TEMPLATES)[number];
18
+ export declare const CONSOLIDATE_DECORRELATION_MIN_LIFT = 0.05;
19
+ export declare const CONSOLIDATE_DIRECTION_MIN_ACCURACY = 0.85;
20
+ export declare const CONSOLIDATE_PRICING_PER_MTOKEN: Record<string, {
21
+ input: number;
22
+ output: number;
23
+ }>;
24
+ export declare function isModelPriced(model: string): boolean;
25
+ export declare function estimateCostUSD(model: string, inputTokens: number, outputTokens: number): number;
26
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/consolidate/constants.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,6BAA6B,IAAI,CAAC;AAC/C,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAEhD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG3D;AAID,eAAO,MAAM,+BAA+B,MAAM,CAAC;AAKnD,eAAO,MAAM,2BAA2B;;;;;CAK9B,CAAC;AAIX,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAM7C,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAIxC,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAK1C,eAAO,MAAM,yBAAyB,8BAA8B,CAAC;AAMrE,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AAOvD,eAAO,MAAM,4BAA4B,6CAA8C,CAAC;AACxF,MAAM,MAAM,yBAAyB,GAAG,CAAC,OAAO,4BAA4B,CAAC,CAAC,MAAM,CAAC,CAAC;AAOtF,eAAO,MAAM,kCAAkC,OAAO,CAAC;AAKvD,eAAO,MAAM,kCAAkC,OAAO,CAAC;AAQvD,eAAO,MAAM,8BAA8B,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAI5F,CAAC;AAGF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAQhG"}
@@ -0,0 +1,83 @@
1
+ // Provisional scheduler constants. EVERY value here is a calibration target
2
+ // (spec §10 — calibrate from shadow data); the loop runs on these placeholders
3
+ // until Stage 5. Single-sourced + exported so calibration has one home, mirroring
4
+ // EDGE_* / SHADOW_* in the curation layer.
5
+ // Review interval f(aged strength): MIN · 2^strength, hard-capped by MAX (the
6
+ // max-interval backstop — nothing rests longer than this without re-derivation).
7
+ export const CONSOLIDATE_MIN_INTERVAL_DAYS = 1;
8
+ export const CONSOLIDATE_MAX_INTERVAL_DAYS = 90; // aligns with EDGE_HALF_LIFE_DAYS
9
+ export function reviewIntervalDays(strength) {
10
+ const grown = CONSOLIDATE_MIN_INTERVAL_DAYS * 2 ** Math.max(0, strength);
11
+ return Math.min(grown, CONSOLIDATE_MAX_INTERVAL_DAYS);
12
+ }
13
+ // Event-blast attenuation: a forward path's reach = ∏(edge strengths); it stops
14
+ // where the product drops below this floor (spec §3.1, C-Q2).
15
+ export const CONSOLIDATE_PATH_STRENGTH_FLOOR = 0.1;
16
+ // Compute-budget partition (spec §3.3). Fractions of the per-session budget.
17
+ // backstop is GUARANTEED; periphery is blast-blind fairness; birth is one-time
18
+ // cold-start population. Provisional — tuned against B coverage metrics (§6.2).
19
+ export const CONSOLIDATE_SLICE_FRACTIONS = {
20
+ backstop: 0.25,
21
+ main: 0.45,
22
+ periphery: 0.15,
23
+ birth: 0.15,
24
+ };
25
+ // Stage 1 has no LLM calls, so "budget" = max queue items emitted per session.
26
+ // With Component A (Stage 2) this becomes the re-derivation-call cap.
27
+ export const CONSOLIDATE_DEFAULT_BUDGET = 50;
28
+ // --- Stage 2 (Component A) ----------------------------------------------------
29
+ // Panel size M: votes cast per due edge per session (spec §4.1, brief item 2).
30
+ // Starting M=2 — provisional, TBD — calibrate from shadow data.
31
+ export const CONSOLIDATE_PANEL_SIZE = 2;
32
+ // Birth-mode neighbor retrieval: top-K embedding neighbors per unprocessed doc
33
+ // (spec §4.0). 20 = the K in the §10.2 recall@20 kill condition.
34
+ export const CONSOLIDATE_BIRTH_TOP_K = 20;
35
+ // Default LLM model for re-derivation. Haiku 4.5 — cheapest tier where the
36
+ // task is "detect derivation," not "subtle reasoning." Override via the
37
+ // DAFTARI_CONSOLIDATE_MODEL env var when calibrating against bigger models.
38
+ export const CONSOLIDATE_DEFAULT_MODEL = "claude-haiku-4-5-20251001";
39
+ // The agent principal Stage 2 attributes its writes to (spec §8). The server
40
+ // is started as `--user agent:curation-loop --role curation-loop`; this string
41
+ // is the free-text `agent` claim on edge_observe/contest (the authenticated
42
+ // principal is recorded separately by the shadow path).
43
+ export const CONSOLIDATE_AGENT = "agent:curation-loop";
44
+ // Prompt-framing axis (v1 = the only varied axis, see brief item 3). Three
45
+ // deterministic templates that re-derive the same edge claim from different
46
+ // directions. Each template is independent of the others by *framing*, not
47
+ // by model or input — whether that is enough to decorrelate votes is the
48
+ // load-bearing question the decorrelation report (brief item 8) decides.
49
+ export const CONSOLIDATE_PROMPT_TEMPLATES = ["forward", "reverse", "contrast"];
50
+ // Decorrelation lift (brief item 8 / spec §10.2). `majority_accuracy −
51
+ // max(single_vote_accuracy)`. Retained as an informational metric: under the
52
+ // foundational-ordering prompt (which replaced the prompt-framing axes) the
53
+ // axes send an identical deterministic prompt, so lift is ~0 by construction —
54
+ // confirming the axes no longer decorrelate, the verdict doc's conclusion.
55
+ export const CONSOLIDATE_DECORRELATION_MIN_LIFT = 0.05;
56
+ // The report's PASS gate is now ACCURACY, not lift (spec §5 — it measures the
57
+ // foundational prompt's direction-recovery accuracy on the fixture). Matches the
58
+ // real-prose gate's 85% directional kill condition.
59
+ export const CONSOLIDATE_DIRECTION_MIN_ACCURACY = 0.85;
60
+ // LLM pricing — USD per million tokens, current as of 2026-06-16 for
61
+ // claude-haiku-4-5-20251001. VERIFY against current pricing before reading the
62
+ // cost-USD figure as gospel; this table is a recoverable mistake (the raw
63
+ // token counts ARE logged into the shadow journal, so historical sessions can
64
+ // be re-costed when prices move). Override per-model via the table; unknown
65
+ // models fall back to Haiku pricing with a flag in the report.
66
+ export const CONSOLIDATE_PRICING_PER_MTOKEN = {
67
+ "claude-haiku-4-5-20251001": { input: 1.0, output: 5.0 },
68
+ "claude-sonnet-4-6": { input: 3.0, output: 15.0 },
69
+ "claude-opus-4-8": { input: 15.0, output: 75.0 },
70
+ };
71
+ // True when the model has its own pricing row (vs falling back to Haiku rates).
72
+ export function isModelPriced(model) {
73
+ return Object.hasOwn(CONSOLIDATE_PRICING_PER_MTOKEN, model);
74
+ }
75
+ export function estimateCostUSD(model, inputTokens, outputTokens) {
76
+ const p = CONSOLIDATE_PRICING_PER_MTOKEN[model] ??
77
+ CONSOLIDATE_PRICING_PER_MTOKEN["claude-haiku-4-5-20251001"];
78
+ // Clamp negatives: a bad token count must not produce a negative "cost".
79
+ const inTok = Math.max(0, inputTokens);
80
+ const outTok = Math.max(0, outputTokens);
81
+ return (inTok * p.input + outTok * p.output) / 1_000_000;
82
+ }
83
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/consolidate/constants.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,+EAA+E;AAC/E,kFAAkF;AAClF,2CAA2C;AAE3C,8EAA8E;AAC9E,iFAAiF;AACjF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAC/C,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,CAAC,CAAC,kCAAkC;AAEnF,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IACjD,MAAM,KAAK,GAAG,6BAA6B,GAAG,CA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