kodingo-core 0.2.5 → 0.3.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.
- package/dist/src/domain/memory/project-memory.d.ts +63 -1
- package/dist/src/domain/memory/project-memory.d.ts.map +1 -1
- package/dist/src/domain/memory/project-memory.js +30 -0
- package/dist/src/domain/memory/project-memory.js.map +1 -1
- package/dist/src/query/query-engine.d.ts +63 -0
- package/dist/src/query/query-engine.d.ts.map +1 -1
- package/dist/src/query/query-engine.js +46 -0
- package/dist/src/query/query-engine.js.map +1 -1
- package/package.json +1 -1
|
@@ -6,8 +6,40 @@ import { DecisionId } from "../decision/decision";
|
|
|
6
6
|
export type MemoryStatus = "proposed" | "affirmed" | "denied" | "ignored";
|
|
7
7
|
/**
|
|
8
8
|
* MVP memory types. (Aligned with current CLI usage.)
|
|
9
|
+
*
|
|
10
|
+
* "synthesis" is a real, already-live value at the database layer
|
|
11
|
+
* (kodingo-api's kodingo_memory CHECK constraint, and real rows created by
|
|
12
|
+
* synthesisService.ts/securityService.ts) — added here to close a real,
|
|
13
|
+
* confirmed gap: the type system didn't know about it, so
|
|
14
|
+
* rankMemoriesForQuery's per-type weighting could never actually be type-
|
|
15
|
+
* safe for a synthesis row, and nothing here could construct one correctly.
|
|
16
|
+
*/
|
|
17
|
+
export type MemoryType = "decision" | "note" | "context" | "synthesis";
|
|
18
|
+
/**
|
|
19
|
+
* Real, explicit evidentiary kind — deliberately NOT a duplicate of
|
|
20
|
+
* `status` (status is review state: proposed/affirmed/denied/ignored;
|
|
21
|
+
* this is about what KIND of evidence backs the memory at all, independent
|
|
22
|
+
* of whether it's been reviewed yet).
|
|
23
|
+
*
|
|
24
|
+
* "sourced": traceable to one real, specific event — a commit, PR, Slack/
|
|
25
|
+
* Teams message, ticket, document. Must carry a real `externalId` — see
|
|
26
|
+
* validateMemoryProvenance below, which is how that requirement is
|
|
27
|
+
* actually enforced, not just documented here.
|
|
28
|
+
*
|
|
29
|
+
* "derived": Kortex's own cross-referenced conclusion — a synthesis
|
|
30
|
+
* summary, a bulk-inferred pattern from static analysis. Legitimately has
|
|
31
|
+
* no single real source event, and is exempt from the externalId
|
|
32
|
+
* requirement by design, not by omission.
|
|
33
|
+
*
|
|
34
|
+
* Confirmed real motivating case: of 17,884 real captured memories in
|
|
35
|
+
* production, only ~5% carried a real externalId — not because most
|
|
36
|
+
* memories are legitimately source-less, but because most capture surfaces
|
|
37
|
+
* never consistently constructed one. This field makes the two real cases
|
|
38
|
+
* ("no source because none exists" vs "no source because nobody built it")
|
|
39
|
+
* mechanically distinguishable instead of both silently looking like a
|
|
40
|
+
* missing field.
|
|
9
41
|
*/
|
|
10
|
-
export type
|
|
42
|
+
export type EvidenceKind = "sourced" | "derived";
|
|
11
43
|
/**
|
|
12
44
|
* Signal categories used for deterministic confidence updates.
|
|
13
45
|
*/
|
|
@@ -35,6 +67,14 @@ export interface MemoryRecord {
|
|
|
35
67
|
title?: string;
|
|
36
68
|
tags: string[];
|
|
37
69
|
content: string;
|
|
70
|
+
/**
|
|
71
|
+
* Real, required evidentiary kind — see EvidenceKind. Required (not
|
|
72
|
+
* optional) so every real call site that constructs a MemoryRecord must
|
|
73
|
+
* make an explicit, honest choice rather than silently omitting it —
|
|
74
|
+
* the exact "mechanically impossible to skip" treatment this whole
|
|
75
|
+
* distinction exists for.
|
|
76
|
+
*/
|
|
77
|
+
evidenceKind: EvidenceKind;
|
|
38
78
|
status: MemoryStatus;
|
|
39
79
|
confidence: number;
|
|
40
80
|
createdAt: Date;
|
|
@@ -133,6 +173,7 @@ export declare function createProposedMemory(input: {
|
|
|
133
173
|
repo: string;
|
|
134
174
|
type: MemoryType;
|
|
135
175
|
content: string;
|
|
176
|
+
evidenceKind: EvidenceKind;
|
|
136
177
|
title?: string;
|
|
137
178
|
tags?: string[];
|
|
138
179
|
symbol?: string;
|
|
@@ -146,6 +187,27 @@ export declare function createProposedMemory(input: {
|
|
|
146
187
|
documentId?: string;
|
|
147
188
|
now?: Date;
|
|
148
189
|
}): MemoryRecord;
|
|
190
|
+
export interface ProvenanceValidationResult {
|
|
191
|
+
valid: boolean;
|
|
192
|
+
error?: string;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Real, mechanical enforcement of the sourced/derived distinction — pure
|
|
196
|
+
* domain logic, so it's the one real place this rule is expressed and
|
|
197
|
+
* every real capture surface (kodingo-api's routes/memory.ts,
|
|
198
|
+
* buildStateMachine.ts, slack.ts, teams.ts, KortexAgentPort, and any
|
|
199
|
+
* future surface) can call the SAME check instead of each reimplementing
|
|
200
|
+
* it slightly differently. A "sourced" memory must carry a real, non-empty
|
|
201
|
+
* externalId — not a placeholder, not merely present-but-meaningless (e.g.
|
|
202
|
+
* a bare capture timestamp with no real link back to what produced it).
|
|
203
|
+
* A "derived" memory is exempt by design: it's Kortex's own conclusion,
|
|
204
|
+
* not sourced to one event, and forcing a fake externalId onto it would
|
|
205
|
+
* just recreate the exact problem this exists to fix.
|
|
206
|
+
*/
|
|
207
|
+
export declare function validateMemoryProvenance(input: {
|
|
208
|
+
evidenceKind: EvidenceKind;
|
|
209
|
+
externalId?: string;
|
|
210
|
+
}): ProvenanceValidationResult;
|
|
149
211
|
/**
|
|
150
212
|
* Apply a signal to a memory record.
|
|
151
213
|
* This increases confidence deterministically, with saturation + diminishing returns.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-memory.d.ts","sourceRoot":"","sources":["../../../../src/domain/memory/project-memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE1E
|
|
1
|
+
{"version":3,"file":"project-memory.d.ts","sourceRoot":"","sources":["../../../../src/domain/memory/project-memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAA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,CAcV"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BASE_CONFIDENCE = void 0;
|
|
4
4
|
exports.isCanonical = isCanonical;
|
|
5
5
|
exports.createProposedMemory = createProposedMemory;
|
|
6
|
+
exports.validateMemoryProvenance = validateMemoryProvenance;
|
|
6
7
|
exports.applySignal = applySignal;
|
|
7
8
|
exports.affirm = affirm;
|
|
8
9
|
exports.ignore = ignore;
|
|
@@ -41,6 +42,7 @@ function createProposedMemory(input) {
|
|
|
41
42
|
title: input.title,
|
|
42
43
|
tags: input.tags ?? [],
|
|
43
44
|
content: input.content,
|
|
45
|
+
evidenceKind: input.evidenceKind,
|
|
44
46
|
status: "proposed",
|
|
45
47
|
confidence: exports.BASE_CONFIDENCE.proposed,
|
|
46
48
|
createdAt: now,
|
|
@@ -61,6 +63,34 @@ function createProposedMemory(input) {
|
|
|
61
63
|
documentId: input.documentId,
|
|
62
64
|
};
|
|
63
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Real, mechanical enforcement of the sourced/derived distinction — pure
|
|
68
|
+
* domain logic, so it's the one real place this rule is expressed and
|
|
69
|
+
* every real capture surface (kodingo-api's routes/memory.ts,
|
|
70
|
+
* buildStateMachine.ts, slack.ts, teams.ts, KortexAgentPort, and any
|
|
71
|
+
* future surface) can call the SAME check instead of each reimplementing
|
|
72
|
+
* it slightly differently. A "sourced" memory must carry a real, non-empty
|
|
73
|
+
* externalId — not a placeholder, not merely present-but-meaningless (e.g.
|
|
74
|
+
* a bare capture timestamp with no real link back to what produced it).
|
|
75
|
+
* A "derived" memory is exempt by design: it's Kortex's own conclusion,
|
|
76
|
+
* not sourced to one event, and forcing a fake externalId onto it would
|
|
77
|
+
* just recreate the exact problem this exists to fix.
|
|
78
|
+
*/
|
|
79
|
+
function validateMemoryProvenance(input) {
|
|
80
|
+
if (input.evidenceKind === "derived")
|
|
81
|
+
return { valid: true };
|
|
82
|
+
const id = input.externalId?.trim();
|
|
83
|
+
if (!id) {
|
|
84
|
+
return {
|
|
85
|
+
valid: false,
|
|
86
|
+
error: "A 'sourced' memory must include a real externalId — a genuine link back to what actually " +
|
|
87
|
+
"produced it (a commit, PR, message, ticket, document, or similar real reference). If this " +
|
|
88
|
+
"memory genuinely has no single real source — a synthesis summary, an inferred pattern — use " +
|
|
89
|
+
"evidenceKind: 'derived' instead of fabricating one.",
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return { valid: true };
|
|
93
|
+
}
|
|
64
94
|
/**
|
|
65
95
|
* Apply a signal to a memory record.
|
|
66
96
|
* This increases confidence deterministically, with saturation + diminishing returns.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-memory.js","sourceRoot":"","sources":["../../../../src/domain/memory/project-memory.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"project-memory.js","sourceRoot":"","sources":["../../../../src/domain/memory/project-memory.ts"],"names":[],"mappings":";;;AA0NA,kCAEC;AAED,oDAmDC;AAoBD,4DAkBC;AASD,kCA0CC;AAKD,wBAoBC;AAMD,wBASC;AAMD,oBAWC;AAWD,gEAoBC;AAWD,sDAkBC;AA5RD;;+DAE+D;AAE/D,MAAM,OAAO,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAEtD,QAAA,eAAe,GAAiC;IAC3D,QAAQ,EAAE,GAAG;IACb,OAAO,EAAE,GAAG;IACZ,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,GAAG;CACZ,CAAC;AAEF,MAAM,aAAa,GAAsC;IACvD,WAAW,EAAE,IAAI;IACjB,UAAU,EAAE,IAAI;IAChB,QAAQ,EAAE,IAAI;CACf,CAAC;AAEF,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAC/B,MAAM,4BAA4B,GAAG,CAAC,CAAC;AACvC,MAA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AC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACtC,IAAI,CAAC,CAAC,UAAU,KAAK,CAAC,CAAC,UAAU;YAAE,OAAO,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC;QACtE,OAAO,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IACvD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACR,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CAAC,MAIrC;IACC,MAAM,EAAE,YAAY,EAAE,wBAAwB,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;IAEvE,IAAI,YAAY,CAAC,MAAM,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAEnD,IACE,WAAW;QACX,YAAY,CAAC,WAAW;QACxB,WAAW,KAAK,YAAY,CAAC,WAAW,EACxC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,wBAAwB,GAAG,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -19,6 +19,18 @@ export interface QuerySource {
|
|
|
19
19
|
relevanceScore: number;
|
|
20
20
|
vectorScore: number;
|
|
21
21
|
domainScore: number;
|
|
22
|
+
/**
|
|
23
|
+
* Real Phase 2 decision-graph lookup result (resolved in kodingo-api,
|
|
24
|
+
* since this file is deliberately side-effect-free — no DB access here).
|
|
25
|
+
* Set when this source has been superseded by a newer memory, so
|
|
26
|
+
* buildQueryContext can say so explicitly rather than presenting stale
|
|
27
|
+
* information as current.
|
|
28
|
+
*/
|
|
29
|
+
supersededBy?: {
|
|
30
|
+
id: string;
|
|
31
|
+
content: string;
|
|
32
|
+
createdAt: Date;
|
|
33
|
+
};
|
|
22
34
|
}
|
|
23
35
|
export interface QueryResult {
|
|
24
36
|
answer: string;
|
|
@@ -26,6 +38,18 @@ export interface QueryResult {
|
|
|
26
38
|
intent: QueryIntent;
|
|
27
39
|
synthesisedAt: Date;
|
|
28
40
|
totalCandidates: number;
|
|
41
|
+
/**
|
|
42
|
+
* Present when this answer came from Phase 4's real agentic exploration
|
|
43
|
+
* (kodingo-api's queryAgent.ts) instead of Phase 3's single-pass retrieval
|
|
44
|
+
* — real usage/status from the actual run, for honest reporting, never a
|
|
45
|
+
* summary asserting success.
|
|
46
|
+
*/
|
|
47
|
+
agenticExploration?: {
|
|
48
|
+
turnsUsed: number;
|
|
49
|
+
totalInputTokens: number;
|
|
50
|
+
totalOutputTokens: number;
|
|
51
|
+
status: "completed" | "budget_exceeded" | "cancelled" | "error" | "stopped_at_checkpoint";
|
|
52
|
+
};
|
|
29
53
|
}
|
|
30
54
|
export interface SynthesisPort {
|
|
31
55
|
/**
|
|
@@ -55,6 +79,45 @@ export declare function rankMemoriesForQuery(candidates: Array<{
|
|
|
55
79
|
/**
|
|
56
80
|
* Builds the context string passed to the LLM for synthesis.
|
|
57
81
|
* Formats ranked memories into a structured prompt context.
|
|
82
|
+
*
|
|
83
|
+
* Real freshness/honesty additions (Phase 3): every source shows when it was
|
|
84
|
+
* actually captured (created_at) and its real evidenceKind, and a source
|
|
85
|
+
* that's been superseded (Phase 2 decision-graph edge, resolved by the
|
|
86
|
+
* caller — this file has no DB access) is marked STALE with a pointer to
|
|
87
|
+
* what replaced it, so the model can never present superseded information
|
|
88
|
+
* as current without visibly contradicting the context it was given.
|
|
58
89
|
*/
|
|
59
90
|
export declare function buildQueryContext(sources: QuerySource[], maxSources?: number): string;
|
|
91
|
+
export interface DecisionClaim {
|
|
92
|
+
/** One real, checkable statement — should be a single fact or assertion, not a whole paragraph. */
|
|
93
|
+
text: string;
|
|
94
|
+
/** Real memory ids (from the QuerySource list this was generated against) this claim is grounded in. */
|
|
95
|
+
sourceIds: string[];
|
|
96
|
+
/**
|
|
97
|
+
* "evidenced": directly supported by the cited source(s)' actual content.
|
|
98
|
+
* "inferred": a reasonable synthesis/interpretation that goes beyond what
|
|
99
|
+
* any single source literally states — still real reasoning, just
|
|
100
|
+
* honestly labelled as such rather than presented with false certainty.
|
|
101
|
+
*/
|
|
102
|
+
confidence: "evidenced" | "inferred";
|
|
103
|
+
}
|
|
104
|
+
export interface ClaimValidationResult {
|
|
105
|
+
claim: DecisionClaim;
|
|
106
|
+
valid: boolean;
|
|
107
|
+
/** Present when valid is false — why this claim was rejected. */
|
|
108
|
+
reason?: string;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Real, mechanical validation of claims against the real source list they
|
|
112
|
+
* were supposedly grounded in. Two things a model could get wrong that this
|
|
113
|
+
* catches structurally rather than trusting the model to have gotten right:
|
|
114
|
+
*
|
|
115
|
+
* 1. Citing a sourceId that doesn't correspond to any real retrieved source
|
|
116
|
+
* (a fabricated or hallucinated citation).
|
|
117
|
+
* 2. Marking a claim "evidenced" while citing zero real sources — evidenced
|
|
118
|
+
* is a claim about being grounded, so it must actually cite something
|
|
119
|
+
* real to earn that label. ("inferred" has no such requirement — by
|
|
120
|
+
* definition it may go beyond, or even cite zero, specific sources.)
|
|
121
|
+
*/
|
|
122
|
+
export declare function validateClaims(claims: DecisionClaim[], sources: QuerySource[]): ClaimValidationResult[];
|
|
60
123
|
//# sourceMappingURL=query-engine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-engine.d.ts","sourceRoot":"","sources":["../../../src/query/query-engine.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAIpE,MAAM,MAAM,eAAe,GACvB,SAAS,GACT,QAAQ,GACR,kBAAkB,GAClB,YAAY,GACZ,SAAS,CAAC;AAEd,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,eAAe,CAAC;IACtB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC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W,GAAG,iBAAiB,GAAG,WAAW,GAAG,OAAO,GAAG,uBAAuB,CAAC;KAC3F,CAAC;CACH;AAID,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,UAAU,CAAC,MAAM,EAAE;QACjB,MAAM,EAAE,WAAW,CAAC;QACpB,QAAQ,EAAE,YAAY,EAAE,CAAC;QACzB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACjC;AAmDD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,KAAK,CAAC;IAAE,MAAM,EAAE,YAAY,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,EAChE,MAAM,EAAE,WAAW,GAClB,WAAW,EAAE,CAoDf;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,WAAW,EAAE,EACtB,UAAU,SAAI,GACb,MAAM,CAoBR;AAYD,MAAM,WAAW,aAAa;IAC5B,mGAAmG;IACnG,IAAI,EAAE,MAAM,CAAC;IACb,wGAAwG;IACxG,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB;;;;;OAKG;IACH,UAAU,EAAE,WAAW,GAAG,UAAU,CAAC;CACtC;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,aAAa,CAAC;IACrB,KAAK,EAAE,OAAO,CAAC;IACf,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,aAAa,EAAE,EACvB,OAAO,EAAE,WAAW,EAAE,GACrB,qBAAqB,EAAE,CAuBzB"}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.rankMemoriesForQuery = rankMemoriesForQuery;
|
|
11
11
|
exports.buildQueryContext = buildQueryContext;
|
|
12
|
+
exports.validateClaims = validateClaims;
|
|
12
13
|
// ── Ranking ───────────────────────────────────────────────────────────────────
|
|
13
14
|
const STATUS_WEIGHT = {
|
|
14
15
|
affirmed: 1.0,
|
|
@@ -103,6 +104,13 @@ function rankMemoriesForQuery(candidates, intent) {
|
|
|
103
104
|
/**
|
|
104
105
|
* Builds the context string passed to the LLM for synthesis.
|
|
105
106
|
* Formats ranked memories into a structured prompt context.
|
|
107
|
+
*
|
|
108
|
+
* Real freshness/honesty additions (Phase 3): every source shows when it was
|
|
109
|
+
* actually captured (created_at) and its real evidenceKind, and a source
|
|
110
|
+
* that's been superseded (Phase 2 decision-graph edge, resolved by the
|
|
111
|
+
* caller — this file has no DB access) is marked STALE with a pointer to
|
|
112
|
+
* what replaced it, so the model can never present superseded information
|
|
113
|
+
* as current without visibly contradicting the context it was given.
|
|
106
114
|
*/
|
|
107
115
|
function buildQueryContext(sources, maxSources = 8) {
|
|
108
116
|
return sources
|
|
@@ -118,6 +126,10 @@ function buildQueryContext(sources, maxSources = 8) {
|
|
|
118
126
|
if (m.repo)
|
|
119
127
|
lines.push(`Repo: ${m.repo}`);
|
|
120
128
|
lines.push(`Type: ${m.type} | Status: ${m.status} | Confidence: ${Math.round(m.confidence * 100)}%`);
|
|
129
|
+
lines.push(`Captured: ${new Date(m.createdAt).toISOString().slice(0, 10)} | Evidence: ${m.evidenceKind}${m.evidenceKind === "sourced" && m.externalId ? ` (${m.externalId})` : ""}`);
|
|
130
|
+
if (s.supersededBy) {
|
|
131
|
+
lines.push(`⚠ STALE — superseded on ${new Date(s.supersededBy.createdAt).toISOString().slice(0, 10)} by a newer decision: "${s.supersededBy.content.slice(0, 200)}". Do not present this source's content as the current state of things without noting it has been superseded.`);
|
|
132
|
+
}
|
|
121
133
|
if (m.tags?.length)
|
|
122
134
|
lines.push(`Tags: ${m.tags.join(", ")}`);
|
|
123
135
|
lines.push(`Content: ${m.content}`);
|
|
@@ -125,4 +137,38 @@ function buildQueryContext(sources, maxSources = 8) {
|
|
|
125
137
|
})
|
|
126
138
|
.join("\n\n---\n\n");
|
|
127
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Real, mechanical validation of claims against the real source list they
|
|
142
|
+
* were supposedly grounded in. Two things a model could get wrong that this
|
|
143
|
+
* catches structurally rather than trusting the model to have gotten right:
|
|
144
|
+
*
|
|
145
|
+
* 1. Citing a sourceId that doesn't correspond to any real retrieved source
|
|
146
|
+
* (a fabricated or hallucinated citation).
|
|
147
|
+
* 2. Marking a claim "evidenced" while citing zero real sources — evidenced
|
|
148
|
+
* is a claim about being grounded, so it must actually cite something
|
|
149
|
+
* real to earn that label. ("inferred" has no such requirement — by
|
|
150
|
+
* definition it may go beyond, or even cite zero, specific sources.)
|
|
151
|
+
*/
|
|
152
|
+
function validateClaims(claims, sources) {
|
|
153
|
+
const realIds = new Set(sources.map((s) => s.memory.id));
|
|
154
|
+
return claims.map((claim) => {
|
|
155
|
+
const fabricatedIds = claim.sourceIds.filter((id) => !realIds.has(id));
|
|
156
|
+
const realSourceCount = claim.sourceIds.length - fabricatedIds.length;
|
|
157
|
+
if (fabricatedIds.length > 0) {
|
|
158
|
+
return {
|
|
159
|
+
claim,
|
|
160
|
+
valid: false,
|
|
161
|
+
reason: `cites ${fabricatedIds.length} source id(s) not present among the real retrieved sources: ${fabricatedIds.join(", ")}`,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
if (claim.confidence === "evidenced" && realSourceCount === 0) {
|
|
165
|
+
return {
|
|
166
|
+
claim,
|
|
167
|
+
valid: false,
|
|
168
|
+
reason: "marked 'evidenced' but cites no real source — evidenced claims must be grounded in at least one real source, otherwise use 'inferred'",
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
return { claim, valid: true };
|
|
172
|
+
});
|
|
173
|
+
}
|
|
128
174
|
//# sourceMappingURL=query-engine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-engine.js","sourceRoot":"","sources":["../../../src/query/query-engine.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;
|
|
1
|
+
{"version":3,"file":"query-engine.js","sourceRoot":"","sources":["../../../src/query/query-engine.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAiIH,oDAuDC;AAaD,8CAuBC;AA6CD,wCA0BC;AA3ND,iFAAiF;AAEjF,MAAM,aAAa,GAA2B;IAC5C,QAAQ,EAAE,GAAG;IACb,QAAQ,EAAE,GAAG;IACb,OAAO,EAAG,GAAG;IACb,MAAM,EAAI,GAAG;CACd,CAAC;AAEF,MAAM,kBAAkB,GAA2C;IACjE,2EAA2E;IAC3E,yEAAyE;IACzE,4EAA4E;IAC5E,uEAAuE;IACvE,uEAAuE;IACvE,qEAAqE;IACrE,sBAAsB;IACtB,OAAO,EAAE;QACP,SAAS,EAAE,GAAG;QACd,QAAQ,EAAG,GAAG;QACd,OAAO,EAAI,GAAG;QACd,IAAI,EAAO,GAAG;KACf;IACD,MAAM,EAAE;QACN,OAAO,EAAI,GAAG;QACd,QAAQ,EAAG,GAAG;QACd,SAAS,EAAE,IAAI;QACf,IAAI,EAAO,GAAG;KACf;IACD,gBAAgB,EAAE;QAChB,QAAQ,EAAG,GAAG;QACd,SAAS,EAAE,IAAI;QACf,IAAI,EAAO,GAAG;QACd,OAAO,EAAI,GAAG;KACf;IACD,UAAU,EAAE;QACV,QAAQ,EAAG,GAAG;QACd,SAAS,EAAE,IAAI;QACf,OAAO,EAAI,GAAG;QACd,IAAI,EAAO,GAAG;KACf;IACD,OAAO,EAAE;QACP,SAAS,EAAE,GAAG;QACd,QAAQ,EAAG,GAAG;QACd,OAAO,EAAI,GAAG;QACd,IAAI,EAAO,GAAG;KACf;CACF,CAAC;AAEF;;;;;;;GAOG;AACH,SAAgB,oBAAoB,CAClC,UAAgE,EAChE,MAAmB;IAEnB,MAAM,aAAa,GAAG,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,kBAAkB,CAAC,OAAO,CAAC;I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