@tangle-network/agent-knowledge 1.7.0 → 1.8.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/README.md +77 -1
- package/dist/chunk-MU5CEOGE.js +387 -0
- package/dist/chunk-MU5CEOGE.js.map +1 -0
- package/dist/{chunk-HKYD765Q.js → chunk-WWY5FTKQ.js} +11 -14
- package/dist/chunk-WWY5FTKQ.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +264 -2
- package/dist/index.js +273 -9
- package/dist/index.js.map +1 -1
- package/dist/profiles/index.d.ts +1 -1
- package/dist/profiles/index.js +4 -361
- package/dist/profiles/index.js.map +1 -1
- package/docs/recursive-research-leaf.md +86 -0
- package/package.json +4 -4
- package/dist/chunk-HKYD765Q.js.map +0 -1
package/dist/profiles/index.js
CHANGED
|
@@ -1,365 +1,8 @@
|
|
|
1
|
-
// src/profiles/researcher.ts
|
|
2
1
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function researcherProfile(options = {}) {
|
|
8
|
-
const harness = options.harness ?? DEFAULT_HARNESS;
|
|
9
|
-
const name = options.name ?? `researcher-${harness}`;
|
|
10
|
-
const systemPrompt = options.systemPrompt ?? DEFAULT_RESEARCHER_SYSTEM_PROMPT;
|
|
11
|
-
const citationDensityMin = options.citationDensityMin ?? DEFAULT_CITATION_DENSITY_MIN;
|
|
12
|
-
const profile = {
|
|
13
|
-
name,
|
|
14
|
-
description: "Source-grounded research agent. Propose-don't-apply.",
|
|
15
|
-
prompt: { systemPrompt },
|
|
16
|
-
model: options.model ? { default: options.model } : void 0,
|
|
17
|
-
tools: { web_search: true, fs: true, shell: true },
|
|
18
|
-
metadata: { backendType: harness, role: "researcher" }
|
|
19
|
-
};
|
|
20
|
-
const output = { parse: parseResearcherEvents };
|
|
21
|
-
const validator = options.task ? createResearcherValidator(options.task, { citationDensityMin }) : createResearcherValidator(
|
|
22
|
-
{ question: "", knowledgeNamespace: "" },
|
|
23
|
-
{ citationDensityMin, namespaceCheck: false }
|
|
24
|
-
);
|
|
25
|
-
const agentRunSpec = {
|
|
26
|
-
name,
|
|
27
|
-
profile,
|
|
28
|
-
taskToPrompt: formatResearcherPrompt
|
|
29
|
-
};
|
|
30
|
-
return { profile, taskToPrompt: formatResearcherPrompt, output, validator, agentRunSpec };
|
|
31
|
-
}
|
|
32
|
-
function multiHarnessResearcherFanout(options = {}) {
|
|
33
|
-
const harnesses = options.harnesses && options.harnesses.length > 0 ? options.harnesses : ["opencode/zai-coding-plan/glm-5.1", "claude-code", "codex"];
|
|
34
|
-
const models = options.models ?? [];
|
|
35
|
-
const agentRuns = harnesses.map((harness, i) => {
|
|
36
|
-
const { agentRunSpec } = researcherProfile({ harness, model: models[i] });
|
|
37
|
-
return agentRunSpec;
|
|
38
|
-
});
|
|
39
|
-
const { output, validator } = researcherProfile({
|
|
40
|
-
citationDensityMin: options.citationDensityMin,
|
|
41
|
-
task: options.task
|
|
42
|
-
});
|
|
43
|
-
const driver = createFanoutVoteDriver({ n: harnesses.length });
|
|
44
|
-
return { agentRuns, output, validator, driver };
|
|
45
|
-
}
|
|
46
|
-
function createResearcherValidator(task, config = {}) {
|
|
47
|
-
const citationDensityMin = config.citationDensityMin ?? DEFAULT_CITATION_DENSITY_MIN;
|
|
48
|
-
const namespaceCheck = config.namespaceCheck ?? true;
|
|
49
|
-
return {
|
|
50
|
-
async validate(output) {
|
|
51
|
-
const notes = [];
|
|
52
|
-
const scores = {};
|
|
53
|
-
let pass = true;
|
|
54
|
-
if (!Array.isArray(output.items) || output.items.length === 0) {
|
|
55
|
-
pass = false;
|
|
56
|
-
notes.push("no items");
|
|
57
|
-
scores.items = 0;
|
|
58
|
-
} else {
|
|
59
|
-
scores.items = 1;
|
|
60
|
-
}
|
|
61
|
-
const missingEvidence = (output.items ?? []).filter(
|
|
62
|
-
(item) => !Array.isArray(item.evidence) || item.evidence.length === 0
|
|
63
|
-
);
|
|
64
|
-
if (missingEvidence.length > 0) {
|
|
65
|
-
pass = false;
|
|
66
|
-
notes.push(`${missingEvidence.length} item(s) without evidence`);
|
|
67
|
-
scores.provenance = 0;
|
|
68
|
-
} else {
|
|
69
|
-
scores.provenance = 1;
|
|
70
|
-
}
|
|
71
|
-
if (namespaceCheck) {
|
|
72
|
-
const foreignItems = (output.items ?? []).filter(
|
|
73
|
-
(item) => item.namespace !== task.knowledgeNamespace
|
|
74
|
-
);
|
|
75
|
-
const foreignWrites = (output.proposedWrites ?? []).filter(
|
|
76
|
-
(write) => write.namespace !== task.knowledgeNamespace
|
|
77
|
-
);
|
|
78
|
-
if (foreignItems.length > 0 || foreignWrites.length > 0) {
|
|
79
|
-
pass = false;
|
|
80
|
-
notes.push(
|
|
81
|
-
`namespace violation: ${foreignItems.length} item(s) + ${foreignWrites.length} write(s) outside ${task.knowledgeNamespace}`
|
|
82
|
-
);
|
|
83
|
-
scores.namespace = 0;
|
|
84
|
-
} else {
|
|
85
|
-
scores.namespace = 1;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
const itemCount = Math.max(output.items?.length ?? 0, 1);
|
|
89
|
-
const citationsWithQuote = (output.citations ?? []).filter(
|
|
90
|
-
(citation) => typeof citation.quote === "string" && citation.quote.length > 0
|
|
91
|
-
).length;
|
|
92
|
-
const citationDensity = Math.min(1, citationsWithQuote / itemCount);
|
|
93
|
-
if (citationDensity < citationDensityMin) {
|
|
94
|
-
pass = false;
|
|
95
|
-
notes.push(
|
|
96
|
-
`citation density ${citationDensity.toFixed(2)} below floor ${citationDensityMin.toFixed(2)}`
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
scores.citation_density = citationDensity;
|
|
100
|
-
const sourceSet = /* @__PURE__ */ new Set();
|
|
101
|
-
for (const item of output.items ?? []) {
|
|
102
|
-
for (const evidence of item.evidence ?? []) {
|
|
103
|
-
if (evidence.source) sourceSet.add(evidence.source);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
scores.source_diversity = Math.min(1, sourceSet.size / itemCount);
|
|
107
|
-
scores.recency_match = recencyMatchScore(output.items ?? [], task.recencyWindow);
|
|
108
|
-
const maxGaps = itemCount;
|
|
109
|
-
const gapCount = output.gaps?.length ?? 0;
|
|
110
|
-
scores.gap_coverage = Math.max(0, 1 - gapCount / maxGaps);
|
|
111
|
-
const score = 0.4 * scores.citation_density + 0.2 * scores.source_diversity + 0.2 * scores.recency_match + 0.2 * scores.gap_coverage;
|
|
112
|
-
const verdict = {
|
|
113
|
-
valid: pass,
|
|
114
|
-
score: Number.isFinite(score) ? score : 0,
|
|
115
|
-
scores
|
|
116
|
-
};
|
|
117
|
-
if (notes.length > 0) verdict.notes = notes.join("; ");
|
|
118
|
-
return verdict;
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
function recencyMatchScore(items, window) {
|
|
123
|
-
if (!window || window.since === void 0 && window.until === void 0) return 1;
|
|
124
|
-
if (items.length === 0) return 0;
|
|
125
|
-
const sinceMs = window.since?.getTime() ?? Number.NEGATIVE_INFINITY;
|
|
126
|
-
const untilMs = window.until?.getTime() ?? Number.POSITIVE_INFINITY;
|
|
127
|
-
let hits = 0;
|
|
128
|
-
let total = 0;
|
|
129
|
-
for (const item of items) {
|
|
130
|
-
for (const evidence of item.evidence ?? []) {
|
|
131
|
-
if (typeof evidence.capturedAt !== "number") continue;
|
|
132
|
-
total += 1;
|
|
133
|
-
if (evidence.capturedAt >= sinceMs && evidence.capturedAt <= untilMs) hits += 1;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
return total === 0 ? 0 : hits / total;
|
|
137
|
-
}
|
|
138
|
-
var DEFAULT_RESEARCHER_SYSTEM_PROMPT = [
|
|
139
|
-
"You are a research agent. Your job is to answer a research question with",
|
|
140
|
-
"source-grounded knowledge items that the caller will choose whether to",
|
|
141
|
-
"persist to a multi-tenant knowledge base.",
|
|
142
|
-
"",
|
|
143
|
-
"Hard rules:",
|
|
144
|
-
" 1. Every item you emit MUST carry the task's knowledgeNamespace exactly.",
|
|
145
|
-
" Never write to a different namespace.",
|
|
146
|
-
" 2. Every item MUST carry at least one evidence entry with a source.",
|
|
147
|
-
" A quote + url is strongly preferred; capturedAt is unix ms.",
|
|
148
|
-
" 3. You propose writes \u2014 you do NOT apply them. The caller decides.",
|
|
149
|
-
" 4. Self-report confidence honestly in [0, 1]. Do not inflate.",
|
|
150
|
-
" 5. List what you could not answer in `gaps`. Better to admit a gap",
|
|
151
|
-
" than fabricate.",
|
|
152
|
-
"",
|
|
153
|
-
"When you finish, emit a single final structured message of the shape:",
|
|
154
|
-
" ```json",
|
|
155
|
-
' { "items": [{ "id": "...", "namespace": "...", "claim": "...",',
|
|
156
|
-
' "evidence": [{ "source": "...", "quote": "...",',
|
|
157
|
-
' "url": "...", "capturedAt": 0 }],',
|
|
158
|
-
' "confidence": 0.0,',
|
|
159
|
-
' "authoredBy": { "kind": "agent", "id": "..." } }],',
|
|
160
|
-
' "citations": [{ "url": "...", "quote": "...", "confidence": 0.0 }],',
|
|
161
|
-
' "proposedWrites": [{ "kind": "insert", "namespace": "...",',
|
|
162
|
-
' "item": { /* same shape as items[] */ } }],',
|
|
163
|
-
' "gaps": ["..."],',
|
|
164
|
-
' "notes": "free-form commentary" }',
|
|
165
|
-
" ```"
|
|
166
|
-
].join("\n");
|
|
167
|
-
function formatResearcherPrompt(task) {
|
|
168
|
-
const sources = task.sources?.length ? task.sources.join(", ") : "(no preference)";
|
|
169
|
-
const window = formatRecencyWindow(task.recencyWindow);
|
|
170
|
-
return [
|
|
171
|
-
`Question: ${task.question}`,
|
|
172
|
-
`Knowledge namespace (DO NOT cross): ${task.knowledgeNamespace}`,
|
|
173
|
-
`Scope: ${task.scope ?? "(unspecified)"}`,
|
|
174
|
-
`Preferred sources: ${sources}`,
|
|
175
|
-
`Recency window: ${window}`,
|
|
176
|
-
`Max items: ${task.maxItems ?? "(no cap)"}`,
|
|
177
|
-
`Per-item minimum confidence: ${task.minConfidence ?? "(no floor)"}`,
|
|
178
|
-
"",
|
|
179
|
-
"Produce knowledge items with provenance + citations + proposed writes.",
|
|
180
|
-
"List gaps for anything you could not answer. Emit the final JSON",
|
|
181
|
-
"result block exactly as instructed."
|
|
182
|
-
].join("\n");
|
|
183
|
-
}
|
|
184
|
-
function formatRecencyWindow(window) {
|
|
185
|
-
if (!window) return "(none)";
|
|
186
|
-
const since = window.since ? window.since.toISOString() : "-\u221E";
|
|
187
|
-
const until = window.until ? window.until.toISOString() : "now";
|
|
188
|
-
return `${since} .. ${until}`;
|
|
189
|
-
}
|
|
190
|
-
function parseResearcherEvents(events) {
|
|
191
|
-
for (let i = events.length - 1; i >= 0; i -= 1) {
|
|
192
|
-
const event = events[i];
|
|
193
|
-
if (!event) continue;
|
|
194
|
-
const type = String(event.type ?? "");
|
|
195
|
-
const data = isRecord(event.data) ? event.data : {};
|
|
196
|
-
if (type === "result" || type === "final" || type === "research.result") {
|
|
197
|
-
const direct = coerceResearchOutput(data.result ?? data.output ?? data);
|
|
198
|
-
if (direct) return direct;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
for (let i = events.length - 1; i >= 0; i -= 1) {
|
|
202
|
-
const event = events[i];
|
|
203
|
-
if (!event) continue;
|
|
204
|
-
const data = isRecord(event.data) ? event.data : {};
|
|
205
|
-
const text = pickString(data.text) ?? pickString(data.delta);
|
|
206
|
-
if (!text) continue;
|
|
207
|
-
const fenced = extractFencedJson(text);
|
|
208
|
-
if (!fenced) continue;
|
|
209
|
-
const coerced = coerceResearchOutput(fenced);
|
|
210
|
-
if (coerced) return coerced;
|
|
211
|
-
}
|
|
212
|
-
return { items: [], citations: [], proposedWrites: [] };
|
|
213
|
-
}
|
|
214
|
-
function isRecord(value) {
|
|
215
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
216
|
-
}
|
|
217
|
-
function pickString(value) {
|
|
218
|
-
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
219
|
-
}
|
|
220
|
-
function extractFencedJson(text) {
|
|
221
|
-
const match = text.match(/```(?:json)?\s*([\s\S]*?)```/i);
|
|
222
|
-
if (!match) return void 0;
|
|
223
|
-
const body = (match[1] ?? "").trim();
|
|
224
|
-
if (!body) return void 0;
|
|
225
|
-
try {
|
|
226
|
-
return JSON.parse(body);
|
|
227
|
-
} catch {
|
|
228
|
-
return void 0;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
function coerceResearchOutput(value) {
|
|
232
|
-
if (!isRecord(value)) return void 0;
|
|
233
|
-
const items = coerceItems(value.items);
|
|
234
|
-
const citations = coerceCitations(value.citations);
|
|
235
|
-
const proposedWrites = coerceProposedWrites(value.proposedWrites);
|
|
236
|
-
if (items === void 0 && citations === void 0 && proposedWrites === void 0) {
|
|
237
|
-
return void 0;
|
|
238
|
-
}
|
|
239
|
-
const output = {
|
|
240
|
-
items: items ?? [],
|
|
241
|
-
citations: citations ?? [],
|
|
242
|
-
proposedWrites: proposedWrites ?? []
|
|
243
|
-
};
|
|
244
|
-
if (Array.isArray(value.gaps)) {
|
|
245
|
-
output.gaps = value.gaps.filter((entry) => typeof entry === "string");
|
|
246
|
-
}
|
|
247
|
-
const notes = pickString(value.notes);
|
|
248
|
-
if (notes) output.notes = notes;
|
|
249
|
-
const known = /* @__PURE__ */ new Set(["items", "citations", "proposedWrites", "gaps", "notes"]);
|
|
250
|
-
const extras = {};
|
|
251
|
-
let extrasCount = 0;
|
|
252
|
-
for (const [key, val] of Object.entries(value)) {
|
|
253
|
-
if (known.has(key)) continue;
|
|
254
|
-
extras[key] = val;
|
|
255
|
-
extrasCount += 1;
|
|
256
|
-
}
|
|
257
|
-
if (extrasCount > 0) output.raw = extras;
|
|
258
|
-
return output;
|
|
259
|
-
}
|
|
260
|
-
function coerceItems(value) {
|
|
261
|
-
if (!Array.isArray(value)) return void 0;
|
|
262
|
-
const out = [];
|
|
263
|
-
for (const entry of value) {
|
|
264
|
-
if (!isRecord(entry)) continue;
|
|
265
|
-
const id = pickString(entry.id);
|
|
266
|
-
const namespace = pickString(entry.namespace);
|
|
267
|
-
const claim = pickString(entry.claim);
|
|
268
|
-
const evidence = coerceEvidence(entry.evidence);
|
|
269
|
-
const confidence = toFiniteNumber(entry.confidence);
|
|
270
|
-
const authoredBy = coerceAuthoredBy(entry.authoredBy);
|
|
271
|
-
if (!id || !namespace || !claim || !authoredBy) continue;
|
|
272
|
-
const item = {
|
|
273
|
-
id,
|
|
274
|
-
namespace,
|
|
275
|
-
claim,
|
|
276
|
-
evidence,
|
|
277
|
-
confidence: clamp01(confidence),
|
|
278
|
-
authoredBy
|
|
279
|
-
};
|
|
280
|
-
if (Array.isArray(entry.supersedes)) {
|
|
281
|
-
item.supersedes = entry.supersedes.filter((s) => typeof s === "string");
|
|
282
|
-
}
|
|
283
|
-
const retractedAt = toFiniteNumber(entry.retractedAt);
|
|
284
|
-
if (retractedAt > 0) item.retractedAt = retractedAt;
|
|
285
|
-
out.push(item);
|
|
286
|
-
}
|
|
287
|
-
return out;
|
|
288
|
-
}
|
|
289
|
-
function coerceEvidence(value) {
|
|
290
|
-
if (!Array.isArray(value)) return [];
|
|
291
|
-
const out = [];
|
|
292
|
-
for (const entry of value) {
|
|
293
|
-
if (!isRecord(entry)) continue;
|
|
294
|
-
const source = pickString(entry.source);
|
|
295
|
-
if (!source) continue;
|
|
296
|
-
const item = {
|
|
297
|
-
source,
|
|
298
|
-
capturedAt: toFiniteNumber(entry.capturedAt)
|
|
299
|
-
};
|
|
300
|
-
const quote = pickString(entry.quote);
|
|
301
|
-
if (quote) item.quote = quote;
|
|
302
|
-
const url = pickString(entry.url);
|
|
303
|
-
if (url) item.url = url;
|
|
304
|
-
out.push(item);
|
|
305
|
-
}
|
|
306
|
-
return out;
|
|
307
|
-
}
|
|
308
|
-
function coerceAuthoredBy(value) {
|
|
309
|
-
if (!isRecord(value)) return void 0;
|
|
310
|
-
const kind = value.kind === "human" || value.kind === "agent" ? value.kind : void 0;
|
|
311
|
-
const id = pickString(value.id);
|
|
312
|
-
if (!kind || !id) return void 0;
|
|
313
|
-
return { kind, id };
|
|
314
|
-
}
|
|
315
|
-
function coerceCitations(value) {
|
|
316
|
-
if (!Array.isArray(value)) return void 0;
|
|
317
|
-
const out = [];
|
|
318
|
-
for (const entry of value) {
|
|
319
|
-
if (!isRecord(entry)) continue;
|
|
320
|
-
const url = pickString(entry.url);
|
|
321
|
-
const quote = pickString(entry.quote);
|
|
322
|
-
if (!url || !quote) continue;
|
|
323
|
-
out.push({ url, quote, confidence: clamp01(toFiniteNumber(entry.confidence)) });
|
|
324
|
-
}
|
|
325
|
-
return out;
|
|
326
|
-
}
|
|
327
|
-
function coerceProposedWrites(value) {
|
|
328
|
-
if (!Array.isArray(value)) return void 0;
|
|
329
|
-
const out = [];
|
|
330
|
-
for (const entry of value) {
|
|
331
|
-
if (!isRecord(entry)) continue;
|
|
332
|
-
const namespace = pickString(entry.namespace);
|
|
333
|
-
if (!namespace) continue;
|
|
334
|
-
if (entry.kind === "insert") {
|
|
335
|
-
const items = coerceItems([entry.item]);
|
|
336
|
-
const item = items?.[0];
|
|
337
|
-
if (!item) continue;
|
|
338
|
-
out.push({ kind: "insert", namespace, item });
|
|
339
|
-
} else if (entry.kind === "supersede") {
|
|
340
|
-
const previousId = pickString(entry.previousId);
|
|
341
|
-
const items = coerceItems([entry.item]);
|
|
342
|
-
const item = items?.[0];
|
|
343
|
-
if (!previousId || !item) continue;
|
|
344
|
-
out.push({ kind: "supersede", namespace, previousId, item });
|
|
345
|
-
} else if (entry.kind === "retract") {
|
|
346
|
-
const itemId = pickString(entry.itemId);
|
|
347
|
-
const reason = pickString(entry.reason);
|
|
348
|
-
if (!itemId || !reason) continue;
|
|
349
|
-
out.push({ kind: "retract", namespace, itemId, reason });
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
return out;
|
|
353
|
-
}
|
|
354
|
-
function toFiniteNumber(value) {
|
|
355
|
-
return typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
356
|
-
}
|
|
357
|
-
function clamp01(value) {
|
|
358
|
-
if (!Number.isFinite(value)) return 0;
|
|
359
|
-
if (value < 0) return 0;
|
|
360
|
-
if (value > 1) return 1;
|
|
361
|
-
return value;
|
|
362
|
-
}
|
|
2
|
+
createResearcherValidator,
|
|
3
|
+
multiHarnessResearcherFanout,
|
|
4
|
+
researcherProfile
|
|
5
|
+
} from "../chunk-MU5CEOGE.js";
|
|
363
6
|
export {
|
|
364
7
|
createResearcherValidator,
|
|
365
8
|
multiHarnessResearcherFanout,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/profiles/researcher.ts"],"sourcesContent":["/**\n * @experimental\n *\n * `researcherProfile` — opinionated preset for source-grounded research\n * tasks. The agent is told to:\n * - bound its work to a single `knowledgeNamespace`\n * - emit `items[]` carrying provenance + confidence\n * - emit `citations[]` linking quotes back to source urls\n * - emit `proposedWrites[]` — never call materialize itself\n * - describe `gaps` it could not answer\n *\n * The profile is stateless and agent-agnostic. `harness` selects the\n * sandbox-SDK backend. For heterogeneous fanout, use\n * `multiHarnessResearcherFanout`.\n *\n * Propose-don't-apply: the profile NEVER writes to the knowledge base.\n * It produces `proposedWrites: KnowledgeUpdate[]` in the output. The\n * caller (gtm-agent, journey-eval, user) decides whether to feed those\n * updates through `applyKnowledgeWriteBlocks` / a KbStore put.\n *\n * Namespace isolation: every `KnowledgeItem` + `KnowledgeUpdate` in the\n * output carries `namespace`. The validator hard-fails when any item\n * touches a namespace other than `task.knowledgeNamespace`.\n */\n\nimport {\n type AgentProfile,\n type AgentRunSpec,\n createFanoutVoteDriver,\n type DefaultVerdict,\n type Driver,\n type OutputAdapter,\n type SandboxEvent,\n type Validator,\n} from '@tangle-network/agent-runtime/loops'\n\n/** @experimental */\nexport type ResearchSource = 'web' | 'corpus' | 'twitter' | 'github' | 'docs'\n\n/** @experimental */\nexport interface ResearchTask {\n /** The research question to answer. */\n question: string\n /** Bound: e.g. \"audience for cpg-founder ICP\". */\n scope?: string\n /** Multi-tenant scope (customer-id, workspace-id). Validator enforces. */\n knowledgeNamespace: string\n sources?: ResearchSource[]\n recencyWindow?: { since?: Date; until?: Date }\n maxItems?: number\n /** Per-item minimum confidence in [0, 1]. Validator scores recall vs this. */\n minConfidence?: number\n}\n\n/**\n * Knowledge item emitted by the researcher.\n *\n * Profile-local type. When agent-knowledge promotes `KnowledgeClaim` →\n * top-level `KnowledgeItem` substrate-wide, these fields collapse 1:1.\n *\n * @experimental\n */\nexport interface KnowledgeItem {\n id: string\n /** Multi-tenant scope. MUST equal `task.knowledgeNamespace`. */\n namespace: string\n /** The factual claim, in the researcher's words. */\n claim: string\n /** Provenance — at least one entry required. */\n evidence: Array<{ source: string; quote?: string; url?: string; capturedAt: number }>\n /** Researcher's self-reported confidence in [0, 1]. */\n confidence: number\n /** Prior item ids this supersedes (chain). */\n supersedes?: string[]\n /** Set if the agent is retracting an earlier item. Unix ms. */\n retractedAt?: number\n authoredBy: { kind: 'human' | 'agent'; id: string }\n}\n\n/**\n * A proposed write to the knowledge base. The profile does NOT apply\n * these — the caller decides.\n *\n * @experimental\n */\nexport type KnowledgeUpdate =\n | { kind: 'insert'; namespace: string; item: KnowledgeItem }\n | { kind: 'supersede'; namespace: string; previousId: string; item: KnowledgeItem }\n | { kind: 'retract'; namespace: string; itemId: string; reason: string }\n\n/**\n * Researcher output. Required fields are typed; optional fields preserve\n * the agent's free-form intelligence (`notes`, `raw`). The validator\n * enforces the typed minimum.\n *\n * @experimental\n */\nexport interface ResearchOutput {\n items: KnowledgeItem[]\n citations: Array<{ url: string; quote: string; confidence: number }>\n proposedWrites: KnowledgeUpdate[]\n gaps?: string[]\n notes?: string\n /** Anything the agent emitted beyond the typed fields. */\n raw?: unknown\n}\n\n/** @experimental */\nexport interface ResearcherProfileOptions {\n /** Sandbox-SDK backend.type. Default `'opencode/zai-coding-plan/glm-5.1'`. */\n harness?: string\n /** Default model id passed in `AgentProfile.model.default`. */\n model?: string\n /** Custom system prompt replacement. Default = built-in researcher preset. */\n systemPrompt?: string\n /** Stable name for `AgentRunSpec.name`. Default = `researcher-${harness}`. */\n name?: string\n /**\n * Default 0.7. Minimum (citations with quote) / items ratio for `valid=true`.\n * Below this floor, citation_density scores < 1 and the item set is gated.\n */\n citationDensityMin?: number\n}\n\nconst DEFAULT_HARNESS = 'opencode/zai-coding-plan/glm-5.1'\nconst DEFAULT_CITATION_DENSITY_MIN = 0.7\n\n/** @experimental */\nexport function researcherProfile(\n options: ResearcherProfileOptions & { task?: ResearchTask } = {},\n): {\n profile: AgentProfile\n taskToPrompt: (task: ResearchTask) => string\n output: OutputAdapter<ResearchOutput>\n validator: Validator<ResearchOutput>\n agentRunSpec: AgentRunSpec<ResearchTask>\n} {\n const harness = options.harness ?? DEFAULT_HARNESS\n const name = options.name ?? `researcher-${harness}`\n const systemPrompt = options.systemPrompt ?? DEFAULT_RESEARCHER_SYSTEM_PROMPT\n const citationDensityMin = options.citationDensityMin ?? DEFAULT_CITATION_DENSITY_MIN\n const profile: AgentProfile = {\n name,\n description: \"Source-grounded research agent. Propose-don't-apply.\",\n prompt: { systemPrompt },\n model: options.model ? { default: options.model } : undefined,\n tools: { web_search: true, fs: true, shell: true },\n metadata: { backendType: harness, role: 'researcher' },\n }\n const output: OutputAdapter<ResearchOutput> = { parse: parseResearcherEvents }\n const validator: Validator<ResearchOutput> = options.task\n ? createResearcherValidator(options.task, { citationDensityMin })\n : createResearcherValidator(\n { question: '', knowledgeNamespace: '' },\n { citationDensityMin, namespaceCheck: false },\n )\n const agentRunSpec: AgentRunSpec<ResearchTask> = {\n name,\n profile,\n taskToPrompt: formatResearcherPrompt,\n }\n return { profile, taskToPrompt: formatResearcherPrompt, output, validator, agentRunSpec }\n}\n\n/** @experimental */\nexport interface MultiHarnessResearcherFanoutOptions {\n /** Backend.type identifiers, one per parallel agent. */\n harnesses?: string[]\n /** Optional per-harness model override. Indexed parallel to `harnesses`. */\n models?: (string | undefined)[]\n /** Default citation density floor for the shared validator. */\n citationDensityMin?: number\n /** Optional task — narrows the validator's namespace check. */\n task?: ResearchTask\n}\n\n/**\n * Build a fanout topology over multiple harnesses. The kernel round-robins\n * `agentRuns` across the N parallel iterations and the `FanoutVote` driver\n * picks the highest-scoring valid output.\n *\n * @experimental\n */\nexport function multiHarnessResearcherFanout(options: MultiHarnessResearcherFanoutOptions = {}): {\n agentRuns: AgentRunSpec<ResearchTask>[]\n output: OutputAdapter<ResearchOutput>\n validator: Validator<ResearchOutput>\n driver: Driver<ResearchTask, ResearchOutput, 'pick-winner' | 'fail'>\n} {\n const harnesses =\n options.harnesses && options.harnesses.length > 0\n ? options.harnesses\n : ['opencode/zai-coding-plan/glm-5.1', 'claude-code', 'codex']\n const models = options.models ?? []\n const agentRuns = harnesses.map((harness, i) => {\n const { agentRunSpec } = researcherProfile({ harness, model: models[i] })\n return agentRunSpec\n })\n const { output, validator } = researcherProfile({\n citationDensityMin: options.citationDensityMin,\n task: options.task,\n })\n const driver = createFanoutVoteDriver<ResearchTask, ResearchOutput>({ n: harnesses.length })\n return { agentRuns, output, validator, driver }\n}\n\n/**\n * Build a validator that closes over a specific `ResearchTask`'s constraints.\n *\n * Checks in order:\n * 1. Items must be non-empty.\n * 2. Every item carries `evidence.length >= 1`.\n * 3. Every item + proposedWrite is scoped to `task.knowledgeNamespace`\n * (hard-fail on any namespace mismatch — defence in depth for the\n * multi-tenant invariant).\n * 4. Citation density (citations with quote / items) >= floor.\n *\n * Aggregate score:\n * 0.4 · citation_density\n * + 0.2 · source_diversity (distinct sources / max(items, 1))\n * + 0.2 · recency_match (mean fraction within `recencyWindow`)\n * + 0.2 · (1 − gaps/maxGaps), maxGaps = max(items, 1)\n *\n * @experimental\n */\nexport function createResearcherValidator(\n task: ResearchTask,\n config: { citationDensityMin?: number; namespaceCheck?: boolean } = {},\n): Validator<ResearchOutput> {\n const citationDensityMin = config.citationDensityMin ?? DEFAULT_CITATION_DENSITY_MIN\n const namespaceCheck = config.namespaceCheck ?? true\n return {\n async validate(output) {\n const notes: string[] = []\n const scores: Record<string, number> = {}\n let pass = true\n\n if (!Array.isArray(output.items) || output.items.length === 0) {\n pass = false\n notes.push('no items')\n scores.items = 0\n } else {\n scores.items = 1\n }\n\n const missingEvidence = (output.items ?? []).filter(\n (item) => !Array.isArray(item.evidence) || item.evidence.length === 0,\n )\n if (missingEvidence.length > 0) {\n pass = false\n notes.push(`${missingEvidence.length} item(s) without evidence`)\n scores.provenance = 0\n } else {\n scores.provenance = 1\n }\n\n if (namespaceCheck) {\n const foreignItems = (output.items ?? []).filter(\n (item) => item.namespace !== task.knowledgeNamespace,\n )\n const foreignWrites = (output.proposedWrites ?? []).filter(\n (write) => write.namespace !== task.knowledgeNamespace,\n )\n if (foreignItems.length > 0 || foreignWrites.length > 0) {\n pass = false\n notes.push(\n `namespace violation: ${foreignItems.length} item(s) + ${foreignWrites.length} write(s) ` +\n `outside ${task.knowledgeNamespace}`,\n )\n scores.namespace = 0\n } else {\n scores.namespace = 1\n }\n }\n\n const itemCount = Math.max(output.items?.length ?? 0, 1)\n const citationsWithQuote = (output.citations ?? []).filter(\n (citation) => typeof citation.quote === 'string' && citation.quote.length > 0,\n ).length\n const citationDensity = Math.min(1, citationsWithQuote / itemCount)\n if (citationDensity < citationDensityMin) {\n pass = false\n notes.push(\n `citation density ${citationDensity.toFixed(2)} below floor ${citationDensityMin.toFixed(2)}`,\n )\n }\n scores.citation_density = citationDensity\n\n const sourceSet = new Set<string>()\n for (const item of output.items ?? []) {\n for (const evidence of item.evidence ?? []) {\n if (evidence.source) sourceSet.add(evidence.source)\n }\n }\n scores.source_diversity = Math.min(1, sourceSet.size / itemCount)\n\n scores.recency_match = recencyMatchScore(output.items ?? [], task.recencyWindow)\n\n const maxGaps = itemCount\n const gapCount = output.gaps?.length ?? 0\n scores.gap_coverage = Math.max(0, 1 - gapCount / maxGaps)\n\n const score =\n 0.4 * scores.citation_density +\n 0.2 * scores.source_diversity +\n 0.2 * scores.recency_match +\n 0.2 * scores.gap_coverage\n\n const verdict: DefaultVerdict = {\n valid: pass,\n score: Number.isFinite(score) ? score : 0,\n scores,\n }\n if (notes.length > 0) verdict.notes = notes.join('; ')\n return verdict\n },\n }\n}\n\nfunction recencyMatchScore(items: KnowledgeItem[], window: ResearchTask['recencyWindow']): number {\n if (!window || (window.since === undefined && window.until === undefined)) return 1\n if (items.length === 0) return 0\n const sinceMs = window.since?.getTime() ?? Number.NEGATIVE_INFINITY\n const untilMs = window.until?.getTime() ?? Number.POSITIVE_INFINITY\n let hits = 0\n let total = 0\n for (const item of items) {\n for (const evidence of item.evidence ?? []) {\n if (typeof evidence.capturedAt !== 'number') continue\n total += 1\n if (evidence.capturedAt >= sinceMs && evidence.capturedAt <= untilMs) hits += 1\n }\n }\n return total === 0 ? 0 : hits / total\n}\n\nconst DEFAULT_RESEARCHER_SYSTEM_PROMPT = [\n 'You are a research agent. Your job is to answer a research question with',\n 'source-grounded knowledge items that the caller will choose whether to',\n 'persist to a multi-tenant knowledge base.',\n '',\n 'Hard rules:',\n \" 1. Every item you emit MUST carry the task's knowledgeNamespace exactly.\",\n ' Never write to a different namespace.',\n ' 2. Every item MUST carry at least one evidence entry with a source.',\n ' A quote + url is strongly preferred; capturedAt is unix ms.',\n ' 3. You propose writes — you do NOT apply them. The caller decides.',\n ' 4. Self-report confidence honestly in [0, 1]. Do not inflate.',\n ' 5. List what you could not answer in `gaps`. Better to admit a gap',\n ' than fabricate.',\n '',\n 'When you finish, emit a single final structured message of the shape:',\n ' ```json',\n ' { \"items\": [{ \"id\": \"...\", \"namespace\": \"...\", \"claim\": \"...\",',\n ' \"evidence\": [{ \"source\": \"...\", \"quote\": \"...\",',\n ' \"url\": \"...\", \"capturedAt\": 0 }],',\n ' \"confidence\": 0.0,',\n ' \"authoredBy\": { \"kind\": \"agent\", \"id\": \"...\" } }],',\n ' \"citations\": [{ \"url\": \"...\", \"quote\": \"...\", \"confidence\": 0.0 }],',\n ' \"proposedWrites\": [{ \"kind\": \"insert\", \"namespace\": \"...\",',\n ' \"item\": { /* same shape as items[] */ } }],',\n ' \"gaps\": [\"...\"],',\n ' \"notes\": \"free-form commentary\" }',\n ' ```',\n].join('\\n')\n\nfunction formatResearcherPrompt(task: ResearchTask): string {\n const sources = task.sources?.length ? task.sources.join(', ') : '(no preference)'\n const window = formatRecencyWindow(task.recencyWindow)\n return [\n `Question: ${task.question}`,\n `Knowledge namespace (DO NOT cross): ${task.knowledgeNamespace}`,\n `Scope: ${task.scope ?? '(unspecified)'}`,\n `Preferred sources: ${sources}`,\n `Recency window: ${window}`,\n `Max items: ${task.maxItems ?? '(no cap)'}`,\n `Per-item minimum confidence: ${task.minConfidence ?? '(no floor)'}`,\n '',\n 'Produce knowledge items with provenance + citations + proposed writes.',\n 'List gaps for anything you could not answer. Emit the final JSON',\n 'result block exactly as instructed.',\n ].join('\\n')\n}\n\nfunction formatRecencyWindow(window: ResearchTask['recencyWindow']): string {\n if (!window) return '(none)'\n const since = window.since ? window.since.toISOString() : '-∞'\n const until = window.until ? window.until.toISOString() : 'now'\n return `${since} .. ${until}`\n}\n\n/**\n * Walk the event stream and return the last structured `research.result`\n * payload. Falls back to scanning text deltas for a fenced JSON block.\n */\nfunction parseResearcherEvents(events: SandboxEvent[]): ResearchOutput {\n for (let i = events.length - 1; i >= 0; i -= 1) {\n const event = events[i]\n if (!event) continue\n const type = String(event.type ?? '')\n const data = isRecord(event.data) ? event.data : {}\n if (type === 'result' || type === 'final' || type === 'research.result') {\n const direct = coerceResearchOutput(data.result ?? data.output ?? data)\n if (direct) return direct\n }\n }\n for (let i = events.length - 1; i >= 0; i -= 1) {\n const event = events[i]\n if (!event) continue\n const data = isRecord(event.data) ? event.data : {}\n const text = pickString(data.text) ?? pickString(data.delta)\n if (!text) continue\n const fenced = extractFencedJson(text)\n if (!fenced) continue\n const coerced = coerceResearchOutput(fenced)\n if (coerced) return coerced\n }\n return { items: [], citations: [], proposedWrites: [] }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value)\n}\n\nfunction pickString(value: unknown): string | undefined {\n return typeof value === 'string' && value.length > 0 ? value : undefined\n}\n\nfunction extractFencedJson(text: string): unknown | undefined {\n const match = text.match(/```(?:json)?\\s*([\\s\\S]*?)```/i)\n if (!match) return undefined\n const body = (match[1] ?? '').trim()\n if (!body) return undefined\n try {\n return JSON.parse(body)\n } catch {\n return undefined\n }\n}\n\nfunction coerceResearchOutput(value: unknown): ResearchOutput | undefined {\n if (!isRecord(value)) return undefined\n const items = coerceItems(value.items)\n const citations = coerceCitations(value.citations)\n const proposedWrites = coerceProposedWrites(value.proposedWrites)\n // Reject completely empty payloads — those signal \"no result block\",\n // not \"a valid empty result\".\n if (items === undefined && citations === undefined && proposedWrites === undefined) {\n return undefined\n }\n const output: ResearchOutput = {\n items: items ?? [],\n citations: citations ?? [],\n proposedWrites: proposedWrites ?? [],\n }\n if (Array.isArray(value.gaps)) {\n output.gaps = value.gaps.filter((entry): entry is string => typeof entry === 'string')\n }\n const notes = pickString(value.notes)\n if (notes) output.notes = notes\n // Preserve any extra fields the agent emitted that don't fit the typed\n // surface — callers can inspect `raw` without forcing them through the\n // typed coercion. We only include `raw` when the agent emitted fields\n // beyond the known set.\n const known = new Set(['items', 'citations', 'proposedWrites', 'gaps', 'notes'])\n const extras: Record<string, unknown> = {}\n let extrasCount = 0\n for (const [key, val] of Object.entries(value)) {\n if (known.has(key)) continue\n extras[key] = val\n extrasCount += 1\n }\n if (extrasCount > 0) output.raw = extras\n return output\n}\n\nfunction coerceItems(value: unknown): KnowledgeItem[] | undefined {\n if (!Array.isArray(value)) return undefined\n const out: KnowledgeItem[] = []\n for (const entry of value) {\n if (!isRecord(entry)) continue\n const id = pickString(entry.id)\n const namespace = pickString(entry.namespace)\n const claim = pickString(entry.claim)\n const evidence = coerceEvidence(entry.evidence)\n const confidence = toFiniteNumber(entry.confidence)\n const authoredBy = coerceAuthoredBy(entry.authoredBy)\n if (!id || !namespace || !claim || !authoredBy) continue\n const item: KnowledgeItem = {\n id,\n namespace,\n claim,\n evidence,\n confidence: clamp01(confidence),\n authoredBy,\n }\n if (Array.isArray(entry.supersedes)) {\n item.supersedes = entry.supersedes.filter((s): s is string => typeof s === 'string')\n }\n const retractedAt = toFiniteNumber(entry.retractedAt)\n if (retractedAt > 0) item.retractedAt = retractedAt\n out.push(item)\n }\n return out\n}\n\nfunction coerceEvidence(value: unknown): KnowledgeItem['evidence'] {\n if (!Array.isArray(value)) return []\n const out: KnowledgeItem['evidence'] = []\n for (const entry of value) {\n if (!isRecord(entry)) continue\n const source = pickString(entry.source)\n if (!source) continue\n const item: KnowledgeItem['evidence'][number] = {\n source,\n capturedAt: toFiniteNumber(entry.capturedAt),\n }\n const quote = pickString(entry.quote)\n if (quote) item.quote = quote\n const url = pickString(entry.url)\n if (url) item.url = url\n out.push(item)\n }\n return out\n}\n\nfunction coerceAuthoredBy(value: unknown): KnowledgeItem['authoredBy'] | undefined {\n if (!isRecord(value)) return undefined\n const kind = value.kind === 'human' || value.kind === 'agent' ? value.kind : undefined\n const id = pickString(value.id)\n if (!kind || !id) return undefined\n return { kind, id }\n}\n\nfunction coerceCitations(value: unknown): ResearchOutput['citations'] | undefined {\n if (!Array.isArray(value)) return undefined\n const out: ResearchOutput['citations'] = []\n for (const entry of value) {\n if (!isRecord(entry)) continue\n const url = pickString(entry.url)\n const quote = pickString(entry.quote)\n if (!url || !quote) continue\n out.push({ url, quote, confidence: clamp01(toFiniteNumber(entry.confidence)) })\n }\n return out\n}\n\nfunction coerceProposedWrites(value: unknown): KnowledgeUpdate[] | undefined {\n if (!Array.isArray(value)) return undefined\n const out: KnowledgeUpdate[] = []\n for (const entry of value) {\n if (!isRecord(entry)) continue\n const namespace = pickString(entry.namespace)\n if (!namespace) continue\n if (entry.kind === 'insert') {\n const items = coerceItems([entry.item])\n const item = items?.[0]\n if (!item) continue\n out.push({ kind: 'insert', namespace, item })\n } else if (entry.kind === 'supersede') {\n const previousId = pickString(entry.previousId)\n const items = coerceItems([entry.item])\n const item = items?.[0]\n if (!previousId || !item) continue\n out.push({ kind: 'supersede', namespace, previousId, item })\n } else if (entry.kind === 'retract') {\n const itemId = pickString(entry.itemId)\n const reason = pickString(entry.reason)\n if (!itemId || !reason) continue\n out.push({ kind: 'retract', namespace, itemId, reason })\n }\n }\n return out\n}\n\nfunction toFiniteNumber(value: unknown): number {\n return typeof value === 'number' && Number.isFinite(value) ? value : 0\n}\n\nfunction clamp01(value: number): number {\n if (!Number.isFinite(value)) return 0\n if (value < 0) return 0\n if (value > 1) return 1\n return value\n}\n"],"mappings":";AAyBA;AAAA,EAGE;AAAA,OAMK;AA0FP,IAAM,kBAAkB;AACxB,IAAM,+BAA+B;AAG9B,SAAS,kBACd,UAA8D,CAAC,GAO/D;AACA,QAAM,UAAU,QAAQ,WAAW;AACnC,QAAM,OAAO,QAAQ,QAAQ,cAAc,OAAO;AAClD,QAAM,eAAe,QAAQ,gBAAgB;AAC7C,QAAM,qBAAqB,QAAQ,sBAAsB;AACzD,QAAM,UAAwB;AAAA,IAC5B;AAAA,IACA,aAAa;AAAA,IACb,QAAQ,EAAE,aAAa;AAAA,IACvB,OAAO,QAAQ,QAAQ,EAAE,SAAS,QAAQ,MAAM,IAAI;AAAA,IACpD,OAAO,EAAE,YAAY,MAAM,IAAI,MAAM,OAAO,KAAK;AAAA,IACjD,UAAU,EAAE,aAAa,SAAS,MAAM,aAAa;AAAA,EACvD;AACA,QAAM,SAAwC,EAAE,OAAO,sBAAsB;AAC7E,QAAM,YAAuC,QAAQ,OACjD,0BAA0B,QAAQ,MAAM,EAAE,mBAAmB,CAAC,IAC9D;AAAA,IACE,EAAE,UAAU,IAAI,oBAAoB,GAAG;AAAA,IACvC,EAAE,oBAAoB,gBAAgB,MAAM;AAAA,EAC9C;AACJ,QAAM,eAA2C;AAAA,IAC/C;AAAA,IACA;AAAA,IACA,cAAc;AAAA,EAChB;AACA,SAAO,EAAE,SAAS,cAAc,wBAAwB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topic
|
|
2
|
+
|
|
3
|
+
Supervisor-facing guidance. The `runResearchSupervisor` brain (see
|
|
4
|
+
`src/research-supervisor.ts`) decomposes a goal into sub-topics and spawns one
|
|
5
|
+
researcher per sub-topic over the live `Scope`. By default each spawn is a **bare
|
|
6
|
+
worker**: a single researcher pass that adds sources and proposes pages.
|
|
7
|
+
|
|
8
|
+
For a **large** sub-topic, a single worker pass under-covers it. The recursive
|
|
9
|
+
move is to spawn, in place of that bare worker, a **driver-loop leaf** — a child
|
|
10
|
+
that is itself a driver running its own worker (the two-agent loop), so the
|
|
11
|
+
sub-topic gets verify + gap-fill + readiness-gate iteration, not one shot.
|
|
12
|
+
|
|
13
|
+
`agent-runtime`'s `Scope.spawn(agent, task, opts)` makes this a first-class
|
|
14
|
+
recursion: the spawned `Agent` can itself be a driver, not just a worker. The
|
|
15
|
+
supervisor spawns a child `Agent` whose `act(task, childScope)` runs
|
|
16
|
+
`runTwoAgentResearchLoop` (or its own `runResearchSupervisor`) scoped to the
|
|
17
|
+
sub-topic, against the SAME knowledge base root, with a sub-topic-scoped slice of
|
|
18
|
+
readiness specs. The conserved budget pool reserves `opts.budget` for the child
|
|
19
|
+
atomically and refunds the unspent remainder on settle, so a driver-loop leaf
|
|
20
|
+
spends from the same pool a bare worker would have — depth costs budget, not extra
|
|
21
|
+
budget.
|
|
22
|
+
|
|
23
|
+
## When it's worth it
|
|
24
|
+
|
|
25
|
+
Spawn a driver-loop leaf (instead of a bare worker) for a sub-topic when ANY of
|
|
26
|
+
these hold; otherwise spawn a bare worker.
|
|
27
|
+
|
|
28
|
+
| Signal | Bare worker | Driver-loop leaf |
|
|
29
|
+
| --- | --- | --- |
|
|
30
|
+
| **Breadth** — distinct readiness specs the sub-topic must close | 1–2 | 3+ |
|
|
31
|
+
| **Depth** — does a fact need a source THEN a derived claim citing it? | shallow (source ≈ answer) | layered (source → claim → cross-check) |
|
|
32
|
+
| **Expected rounds** — passes to reach no-blocking-gaps for the sub-topic | ~1 | 2+ (a worker's first pass predictably leaves blocking gaps) |
|
|
33
|
+
| **Verification risk** — is a wrong/duplicate source likely and costly here? | low | high (the leaf's driver rejects bad sources before they commit) |
|
|
34
|
+
| **Budget headroom** — iterations/tokens left in the pool for this branch | tight | comfortable (a leaf needs ≥ ~3× a worker's per-pass spend) |
|
|
35
|
+
|
|
36
|
+
Rule of thumb: **breadth ≥ 3 specs OR expected rounds ≥ 2 OR high verification
|
|
37
|
+
risk ⇒ driver-loop leaf.** A sub-topic that is one fact from one source is a bare
|
|
38
|
+
worker — wrapping it in a driver only burns budget on a loop that stops after
|
|
39
|
+
round 1.
|
|
40
|
+
|
|
41
|
+
## The shape
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import type { Agent, Scope } from '@tangle-network/agent-runtime/loops'
|
|
45
|
+
import { runTwoAgentResearchLoop, type TwoAgentResearchLoopResult } from '@tangle-network/agent-knowledge'
|
|
46
|
+
|
|
47
|
+
// For a LARGE sub-topic, spawn a sub-driver leaf that runs the two-agent loop
|
|
48
|
+
// scoped to that sub-topic. The child shares the KB root and the conserved
|
|
49
|
+
// budget pool; it gets its own driver (verify + fill + gate) instead of a single
|
|
50
|
+
// worker pass. The child is an `Agent` whose `act` IS the two-agent loop.
|
|
51
|
+
const researchLeaf: Agent<typeof subTopic, TwoAgentResearchLoopResult> = {
|
|
52
|
+
name: `research-leaf:${subTopic.id}`,
|
|
53
|
+
async act(task, childScope: Scope<TwoAgentResearchLoopResult>) {
|
|
54
|
+
return runTwoAgentResearchLoop({
|
|
55
|
+
root, // the SAME knowledge base
|
|
56
|
+
goal: task.goal,
|
|
57
|
+
worker, // the sub-topic researcher
|
|
58
|
+
driver, // verifies the worker's sources, gap-fills, gates on readiness
|
|
59
|
+
driverResearches: true, // the leaf's driver also researches the missed gaps
|
|
60
|
+
readinessSpecs: task.specs, // the sub-topic's slice of the gate
|
|
61
|
+
signal: childScope.signal,
|
|
62
|
+
})
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Reserves `budget` from the conserved pool atomically; refunds on settle.
|
|
67
|
+
const spawned = scope.spawn(researchLeaf, subTopic, {
|
|
68
|
+
label: `research-leaf:${subTopic.id}`,
|
|
69
|
+
budget: perSubTopicBudget, // a slice of the conserved pool
|
|
70
|
+
})
|
|
71
|
+
if (!spawned.ok) {
|
|
72
|
+
// fail-closed: 'budget-exhausted' | 'depth-exceeded' — spawn a bare worker or stop.
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
A bare worker, by contrast, is `scope.spawn(workerFromBackend(backend)(...), …)`
|
|
77
|
+
of the researcher profile — no inner driver, no per-sub-topic readiness gate, one
|
|
78
|
+
pass.
|
|
79
|
+
|
|
80
|
+
## Why this is a leaf, not a fork
|
|
81
|
+
|
|
82
|
+
The driver-loop leaf is still ONE branch of the supervisor's tree. It reads and
|
|
83
|
+
writes the same knowledge base, settles back through the same `Scope`, and
|
|
84
|
+
spends from the same budget pool. The recursion is depth (a sub-driver inside a
|
|
85
|
+
branch), not a second knowledge base — there is exactly one KB, and the
|
|
86
|
+
supervisor's readiness gate over the whole KB is still what ends the run.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-knowledge",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Source-grounded, eval-gated knowledge growth primitives for agents.",
|
|
5
5
|
"homepage": "https://github.com/tangle-network/agent-knowledge#readme",
|
|
6
6
|
"repository": {
|
|
@@ -68,14 +68,14 @@
|
|
|
68
68
|
"format": "biome format --write src tests"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@tangle-network/agent-eval": "
|
|
72
|
-
"@tangle-network/agent-runtime": "^0.
|
|
71
|
+
"@tangle-network/agent-eval": "^0.100.0",
|
|
72
|
+
"@tangle-network/agent-runtime": "^0.77.0",
|
|
73
73
|
"zod": "^4.3.6"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@biomejs/biome": "^2.4.15",
|
|
77
77
|
"@neo4j-labs/agent-memory": "0.4.0",
|
|
78
|
-
"@tangle-network/sandbox": "^0.
|
|
78
|
+
"@tangle-network/sandbox": "^0.8.0",
|
|
79
79
|
"@types/node": "^25.6.0",
|
|
80
80
|
"tsup": "^8.0.0",
|
|
81
81
|
"typescript": "^5.7.0",
|