@tangle-network/agent-eval 0.110.1 → 0.112.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/CHANGELOG.md +20 -0
- package/dist/analyst/index.d.ts +3 -3
- package/dist/analyst/index.js +8 -4
- package/dist/analyst/index.js.map +1 -1
- package/dist/belief-state/index.js +1 -1
- package/dist/benchmarks/index.js +8 -8
- package/dist/builder-eval/index.js +1 -1
- package/dist/campaign/index.d.ts +3 -3
- package/dist/campaign/index.js +7 -7
- package/dist/{chunk-X6NIXVOD.js → chunk-3LDPUYAC.js} +2 -2
- package/dist/{chunk-XRGOKCMO.js → chunk-4FRTXH2M.js} +3 -3
- package/dist/{chunk-N22ZO7FV.js → chunk-7QPK6W7R.js} +2 -2
- package/dist/{chunk-QFGTU7MT.js → chunk-BOLYPSAE.js} +4 -4
- package/dist/{chunk-7NX6ZSBG.js → chunk-DWLIGZBX.js} +145 -42
- package/dist/chunk-DWLIGZBX.js.map +1 -0
- package/dist/{chunk-6MFFKPZ4.js → chunk-EMKORATZ.js} +2 -2
- package/dist/{chunk-2IY4ILP4.js → chunk-HJWNHCD5.js} +57 -2
- package/dist/chunk-HJWNHCD5.js.map +1 -0
- package/dist/{chunk-OW47B5WA.js → chunk-LVTGFSHF.js} +2 -2
- package/dist/{chunk-GBI5J5DB.js → chunk-QQVYMBCZ.js} +6 -6
- package/dist/{chunk-J4AKLZEV.js → chunk-RCXMWGRY.js} +5 -5
- package/dist/{chunk-6HFYGEZ3.js → chunk-RT2AFUXM.js} +2 -2
- package/dist/{chunk-XMSYF4A7.js → chunk-VC43KQCK.js} +24 -1
- package/dist/chunk-VC43KQCK.js.map +1 -0
- package/dist/{chunk-T6W5ADLG.js → chunk-VLNGPUJJ.js} +2 -2
- package/dist/{chunk-6PL5MGDL.js → chunk-WZOIFFG2.js} +2 -2
- package/dist/{chunk-3PFZBGMR.js → chunk-XNCF3JU3.js} +2 -2
- package/dist/{chunk-PLOMR3HP.js → chunk-YWGKQARF.js} +2 -2
- package/dist/contract/index.d.ts +3 -3
- package/dist/contract/index.js +8 -8
- package/dist/index.d.ts +123 -6
- package/dist/index.js +474 -214
- package/dist/index.js.map +1 -1
- package/dist/meta-eval/index.d.ts +1 -1
- package/dist/meta-eval/index.js +2 -2
- package/dist/openapi.json +1 -1
- package/dist/pipelines/index.js +2 -2
- package/dist/{policy-edit-D2bBDZDf.d.ts → policy-edit-az2qRmvN.d.ts} +1 -1
- package/dist/{provenance-CyxkvEi9.d.ts → provenance-KhY8ESVM.d.ts} +1 -1
- package/dist/reporting.d.ts +1 -1
- package/dist/reporting.js +4 -4
- package/dist/rl.js +5 -5
- package/dist/{run-campaign-PNHAJIT2.js → run-campaign-HJQEDCJQ.js} +3 -3
- package/dist/{semantic-concept-judge-D7z6JCLZ.d.ts → semantic-concept-judge-CpzbtwD0.d.ts} +29 -1
- package/dist/{statistics-D88peojY.d.ts → statistics-CDfpwIdX.d.ts} +13 -1
- package/package.json +2 -2
- package/dist/chunk-2IY4ILP4.js.map +0 -1
- package/dist/chunk-7NX6ZSBG.js.map +0 -1
- package/dist/chunk-XMSYF4A7.js.map +0 -1
- /package/dist/{chunk-X6NIXVOD.js.map → chunk-3LDPUYAC.js.map} +0 -0
- /package/dist/{chunk-XRGOKCMO.js.map → chunk-4FRTXH2M.js.map} +0 -0
- /package/dist/{chunk-N22ZO7FV.js.map → chunk-7QPK6W7R.js.map} +0 -0
- /package/dist/{chunk-QFGTU7MT.js.map → chunk-BOLYPSAE.js.map} +0 -0
- /package/dist/{chunk-6MFFKPZ4.js.map → chunk-EMKORATZ.js.map} +0 -0
- /package/dist/{chunk-OW47B5WA.js.map → chunk-LVTGFSHF.js.map} +0 -0
- /package/dist/{chunk-GBI5J5DB.js.map → chunk-QQVYMBCZ.js.map} +0 -0
- /package/dist/{chunk-J4AKLZEV.js.map → chunk-RCXMWGRY.js.map} +0 -0
- /package/dist/{chunk-6HFYGEZ3.js.map → chunk-RT2AFUXM.js.map} +0 -0
- /package/dist/{chunk-T6W5ADLG.js.map → chunk-VLNGPUJJ.js.map} +0 -0
- /package/dist/{chunk-6PL5MGDL.js.map → chunk-WZOIFFG2.js.map} +0 -0
- /package/dist/{chunk-3PFZBGMR.js.map → chunk-XNCF3JU3.js.map} +0 -0
- /package/dist/{chunk-PLOMR3HP.js.map → chunk-YWGKQARF.js.map} +0 -0
- /package/dist/{run-campaign-PNHAJIT2.js.map → run-campaign-HJQEDCJQ.js.map} +0 -0
|
@@ -44,8 +44,16 @@ var FINDING_SUBJECT_KINDS = [
|
|
|
44
44
|
"knowledge.raw",
|
|
45
45
|
"knowledge.stale",
|
|
46
46
|
"system-prompt",
|
|
47
|
+
"skill",
|
|
47
48
|
"tool-doc",
|
|
48
49
|
"new-tool",
|
|
50
|
+
"mcp",
|
|
51
|
+
"hook",
|
|
52
|
+
"subagent",
|
|
53
|
+
"workflow",
|
|
54
|
+
"rollout-policy",
|
|
55
|
+
"agent-profile",
|
|
56
|
+
"code",
|
|
49
57
|
"rag",
|
|
50
58
|
"memory",
|
|
51
59
|
"scaffolding",
|
|
@@ -73,6 +81,8 @@ function parseFindingSubject(raw) {
|
|
|
73
81
|
if (stale) return { kind: "knowledge.stale", slug: stale[1] };
|
|
74
82
|
const sp = trimmed.match(/^system-prompt:(.+)$/);
|
|
75
83
|
if (sp && sp[1].trim().length > 0) return { kind: "system-prompt", section: sp[1].trim() };
|
|
84
|
+
const skill = trimmed.match(/^skill:([a-z0-9][a-z0-9_.-]*)$/);
|
|
85
|
+
if (skill) return { kind: "skill", name: skill[1] };
|
|
76
86
|
const tdAspect = trimmed.match(/^tool-doc:([a-z0-9][a-z0-9_-]*):(.+)$/);
|
|
77
87
|
if (tdAspect && tdAspect[2].trim().length > 0) {
|
|
78
88
|
return { kind: "tool-doc", tool: tdAspect[1], aspect: tdAspect[2].trim() };
|
|
@@ -81,6 +91,26 @@ function parseFindingSubject(raw) {
|
|
|
81
91
|
if (td) return { kind: "tool-doc", tool: td[1] };
|
|
82
92
|
const nt = trimmed.match(/^new-tool:([a-z0-9][a-z0-9_-]*)$/);
|
|
83
93
|
if (nt) return { kind: "new-tool", name: nt[1] };
|
|
94
|
+
const mcp = trimmed.match(/^mcp:([a-z0-9][a-z0-9_.-]*)(?::([a-z0-9][a-z0-9_.-]*))?$/);
|
|
95
|
+
if (mcp) {
|
|
96
|
+
return { kind: "mcp", server: mcp[1], ...mcp[2] ? { tool: mcp[2] } : {} };
|
|
97
|
+
}
|
|
98
|
+
const hook = trimmed.match(/^hook:([a-z0-9][a-z0-9_.-]*)$/);
|
|
99
|
+
if (hook) return { kind: "hook", name: hook[1] };
|
|
100
|
+
const subagent = trimmed.match(/^subagent:([a-z0-9][a-z0-9_.-]*)$/);
|
|
101
|
+
if (subagent) return { kind: "subagent", name: subagent[1] };
|
|
102
|
+
const workflow = trimmed.match(/^workflow:([a-z0-9][a-z0-9_.-]*)$/);
|
|
103
|
+
if (workflow) return { kind: "workflow", name: workflow[1] };
|
|
104
|
+
const rolloutPolicy = trimmed.match(/^rollout-policy:(.+)$/);
|
|
105
|
+
if (rolloutPolicy && rolloutPolicy[1].trim().length > 0) {
|
|
106
|
+
return { kind: "rollout-policy", field: rolloutPolicy[1].trim() };
|
|
107
|
+
}
|
|
108
|
+
const agentProfile = trimmed.match(/^agent-profile:(.+)$/);
|
|
109
|
+
if (agentProfile && agentProfile[1].trim().length > 0) {
|
|
110
|
+
return { kind: "agent-profile", field: agentProfile[1].trim() };
|
|
111
|
+
}
|
|
112
|
+
const code = trimmed.match(/^code:(.+)$/);
|
|
113
|
+
if (code && code[1].trim().length > 0) return { kind: "code", path: code[1].trim() };
|
|
84
114
|
const rag = trimmed.match(/^rag:([a-z0-9][a-z0-9_-]*):(.+)$/);
|
|
85
115
|
if (rag && rag[2].trim().length > 0) {
|
|
86
116
|
return { kind: "rag", corpus: rag[1], docId: rag[2].trim() };
|
|
@@ -112,10 +142,26 @@ function renderFindingSubject(s) {
|
|
|
112
142
|
return `agent-knowledge:stale:${s.slug}`;
|
|
113
143
|
case "system-prompt":
|
|
114
144
|
return `system-prompt:${s.section}`;
|
|
145
|
+
case "skill":
|
|
146
|
+
return `skill:${s.name}`;
|
|
115
147
|
case "tool-doc":
|
|
116
148
|
return s.aspect ? `tool-doc:${s.tool}:${s.aspect}` : `tool-doc:${s.tool}`;
|
|
117
149
|
case "new-tool":
|
|
118
150
|
return `new-tool:${s.name}`;
|
|
151
|
+
case "mcp":
|
|
152
|
+
return s.tool ? `mcp:${s.server}:${s.tool}` : `mcp:${s.server}`;
|
|
153
|
+
case "hook":
|
|
154
|
+
return `hook:${s.name}`;
|
|
155
|
+
case "subagent":
|
|
156
|
+
return `subagent:${s.name}`;
|
|
157
|
+
case "workflow":
|
|
158
|
+
return `workflow:${s.name}`;
|
|
159
|
+
case "rollout-policy":
|
|
160
|
+
return `rollout-policy:${s.field}`;
|
|
161
|
+
case "agent-profile":
|
|
162
|
+
return `agent-profile:${s.field}`;
|
|
163
|
+
case "code":
|
|
164
|
+
return `code:${s.path}`;
|
|
119
165
|
case "rag":
|
|
120
166
|
return `rag:${s.corpus}:${s.docId}`;
|
|
121
167
|
case "memory":
|
|
@@ -132,33 +178,62 @@ function renderFindingSubject(s) {
|
|
|
132
178
|
return s.label;
|
|
133
179
|
}
|
|
134
180
|
}
|
|
135
|
-
var
|
|
136
|
-
"
|
|
137
|
-
"",
|
|
138
|
-
"
|
|
139
|
-
"
|
|
140
|
-
"
|
|
141
|
-
"
|
|
142
|
-
"
|
|
143
|
-
"",
|
|
144
|
-
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
"
|
|
150
|
-
"
|
|
151
|
-
"
|
|
152
|
-
"",
|
|
153
|
-
|
|
154
|
-
"
|
|
155
|
-
"
|
|
156
|
-
"",
|
|
157
|
-
"
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
"
|
|
161
|
-
|
|
181
|
+
var FINDING_SUBJECT_SYNTAX = {
|
|
182
|
+
"knowledge.wiki": "agent-knowledge:wiki:<slug>[#<heading>]",
|
|
183
|
+
"knowledge.claim": "agent-knowledge:claim:<topic>",
|
|
184
|
+
"knowledge.raw": "agent-knowledge:raw:<source-id>",
|
|
185
|
+
"knowledge.stale": "agent-knowledge:stale:<slug>",
|
|
186
|
+
"system-prompt": "system-prompt:<section>",
|
|
187
|
+
skill: "skill:<name>",
|
|
188
|
+
"tool-doc": "tool-doc:<tool>[:<aspect>]",
|
|
189
|
+
"new-tool": "new-tool:<name>",
|
|
190
|
+
mcp: "mcp:<server>[:<tool>]",
|
|
191
|
+
hook: "hook:<name>",
|
|
192
|
+
subagent: "subagent:<name>",
|
|
193
|
+
workflow: "workflow:<name>",
|
|
194
|
+
"rollout-policy": "rollout-policy:<field>",
|
|
195
|
+
"agent-profile": "agent-profile:<field>",
|
|
196
|
+
code: "code:<path>",
|
|
197
|
+
rag: "rag:<corpus>:<doc-id>",
|
|
198
|
+
memory: "memory:<key>",
|
|
199
|
+
scaffolding: "scaffolding:<concern>",
|
|
200
|
+
"output-schema": "output-schema:<field>",
|
|
201
|
+
"websearch.outdated": "websearch:outdated:<topic>",
|
|
202
|
+
"prior-run-summary": "prior-run-summary:<topic>",
|
|
203
|
+
cluster: "<lowercase-cluster-label>"
|
|
204
|
+
};
|
|
205
|
+
var FINDING_SUBJECT_PURPOSE = {
|
|
206
|
+
"knowledge.wiki": "create or update a wiki page",
|
|
207
|
+
"knowledge.claim": "draft a claim or relation",
|
|
208
|
+
"knowledge.raw": "curate a raw source",
|
|
209
|
+
"knowledge.stale": "mark a stale page",
|
|
210
|
+
"system-prompt": "revise a system-prompt section",
|
|
211
|
+
skill: "create or revise a skill",
|
|
212
|
+
"tool-doc": "revise a tool contract",
|
|
213
|
+
"new-tool": "propose a new tool",
|
|
214
|
+
mcp: "revise an MCP server or tool",
|
|
215
|
+
hook: "revise a lifecycle hook",
|
|
216
|
+
subagent: "revise a delegated agent",
|
|
217
|
+
workflow: "revise an orchestration workflow",
|
|
218
|
+
"rollout-policy": "revise budget, sampling, or stop policy",
|
|
219
|
+
"agent-profile": "revise another AgentProfile field",
|
|
220
|
+
code: "revise an implementation path",
|
|
221
|
+
rag: "ingest or correct a RAG document",
|
|
222
|
+
memory: "invalidate or set memory",
|
|
223
|
+
scaffolding: "revise preconditions, retries, or verification",
|
|
224
|
+
"output-schema": "constrain the output shape",
|
|
225
|
+
"websearch.outdated": "identify a stale web result",
|
|
226
|
+
"prior-run-summary": "identify a stale prior-run summary",
|
|
227
|
+
cluster: "name one failure cluster"
|
|
228
|
+
};
|
|
229
|
+
function renderFindingSubjectGrammar(kinds) {
|
|
230
|
+
return [
|
|
231
|
+
"Subjects MUST match one of these forms \u2014 anything else is rejected at parse time:",
|
|
232
|
+
...kinds.map((kind) => ` ${FINDING_SUBJECT_SYNTAX[kind]} \u2014 ${FINDING_SUBJECT_PURPOSE[kind]}`),
|
|
233
|
+
"Runtime ids are lowercase [a-z0-9_.-]+. Topics, keys, paths, and sections are free-form and trimmed."
|
|
234
|
+
].join("\n");
|
|
235
|
+
}
|
|
236
|
+
var FINDING_SUBJECT_GRAMMAR_PROMPT = renderFindingSubjectGrammar(FINDING_SUBJECT_KINDS);
|
|
162
237
|
var KIND_EXPECTED_SUBJECTS = {
|
|
163
238
|
"failure-mode": ["cluster"],
|
|
164
239
|
"knowledge-gap": [
|
|
@@ -168,6 +243,10 @@ var KIND_EXPECTED_SUBJECTS = {
|
|
|
168
243
|
"knowledge.stale",
|
|
169
244
|
"tool-doc",
|
|
170
245
|
"system-prompt",
|
|
246
|
+
"skill",
|
|
247
|
+
"mcp",
|
|
248
|
+
"subagent",
|
|
249
|
+
"workflow",
|
|
171
250
|
"memory",
|
|
172
251
|
"websearch.outdated",
|
|
173
252
|
"prior-run-summary"
|
|
@@ -178,14 +257,25 @@ var KIND_EXPECTED_SUBJECTS = {
|
|
|
178
257
|
"knowledge.raw",
|
|
179
258
|
"tool-doc",
|
|
180
259
|
"system-prompt",
|
|
260
|
+
"skill",
|
|
261
|
+
"mcp",
|
|
262
|
+
"hook",
|
|
181
263
|
"memory",
|
|
182
264
|
"websearch.outdated",
|
|
183
265
|
"prior-run-summary"
|
|
184
266
|
],
|
|
185
267
|
improvement: [
|
|
186
268
|
"system-prompt",
|
|
269
|
+
"skill",
|
|
187
270
|
"tool-doc",
|
|
188
271
|
"new-tool",
|
|
272
|
+
"mcp",
|
|
273
|
+
"hook",
|
|
274
|
+
"subagent",
|
|
275
|
+
"workflow",
|
|
276
|
+
"rollout-policy",
|
|
277
|
+
"agent-profile",
|
|
278
|
+
"code",
|
|
189
279
|
"rag",
|
|
190
280
|
"memory",
|
|
191
281
|
"scaffolding",
|
|
@@ -194,6 +284,11 @@ var KIND_EXPECTED_SUBJECTS = {
|
|
|
194
284
|
"knowledge.claim"
|
|
195
285
|
]
|
|
196
286
|
};
|
|
287
|
+
function findingSubjectGrammarPromptFor(kindId) {
|
|
288
|
+
const kinds = KIND_EXPECTED_SUBJECTS[kindId];
|
|
289
|
+
if (!kinds) throw new Error(`unknown analyst kind: ${kindId}`);
|
|
290
|
+
return renderFindingSubjectGrammar(kinds);
|
|
291
|
+
}
|
|
197
292
|
var FindingSubjectStringSchema = z.string().refine((s) => parseFindingSubject(s) !== null, {
|
|
198
293
|
message: "subject does not match the finding-subject grammar"
|
|
199
294
|
});
|
|
@@ -580,8 +675,11 @@ function buildTraceToolsForGroup(group, store) {
|
|
|
580
675
|
}
|
|
581
676
|
|
|
582
677
|
// src/analyst/kinds/failure-mode.ts
|
|
678
|
+
var subjectGrammar = findingSubjectGrammarPromptFor("failure-mode");
|
|
583
679
|
var ACTOR_PROMPT = `You are a failure-mode classifier for an OTLP trace dataset. Your job is to identify the **distinct ways agents failed** in this dataset, not to grade individual runs.
|
|
584
680
|
|
|
681
|
+
${subjectGrammar}
|
|
682
|
+
|
|
585
683
|
DISCOVERY \u2192 CLUSTER \u2192 CITE protocol:
|
|
586
684
|
|
|
587
685
|
1. Call \`traces.getDatasetOverview({})\` first. Use \`has_errors\`, \`models\`, \`agent_names\`, \`tools\`, and \`sample_trace_ids\` to size the failure surface.
|
|
@@ -590,7 +688,7 @@ DISCOVERY \u2192 CLUSTER \u2192 CITE protocol:
|
|
|
590
688
|
4. **Cluster, do not enumerate.** Two failures with the same root cause should be ONE finding citing both traces, not two findings. The point of this analyst is to compress N runs into K modes.
|
|
591
689
|
5. For each cluster you can defend with evidence, emit ONE finding with:
|
|
592
690
|
- \`area\` = "failure-mode"
|
|
593
|
-
- \`subject\` = a
|
|
691
|
+
- \`subject\` = a lowercase cluster label matching the subject grammar above ("tool-call-loop", "auth-revoked-mid-run", ...)
|
|
594
692
|
- \`claim\` = one sentence stating the mode
|
|
595
693
|
- \`severity\` = "critical" when it blocks the run, "high" when the run finished degraded, "medium" when it slowed convergence
|
|
596
694
|
- \`evidence_uri\` = \`span://<trace_id>/<span_id>\` of the most representative span
|
|
@@ -623,10 +721,13 @@ var FAILURE_MODE_KIND_SPEC = {
|
|
|
623
721
|
};
|
|
624
722
|
|
|
625
723
|
// src/analyst/kinds/improvement.ts
|
|
724
|
+
var subjectGrammar2 = findingSubjectGrammarPromptFor("improvement");
|
|
626
725
|
var ACTOR_PROMPT2 = `You are a recursive-self-improvement analyst. Your job is to propose **concrete, locus-named edits** the agent's runtime should adopt to fix the failure modes, knowledge gaps, and poisonings present in this dataset.
|
|
627
726
|
|
|
628
727
|
Upstream analysts have already classified the problems. Your job is to convert each problem into a *change to make* and grade its expected leverage. Each finding is one proposed edit.
|
|
629
728
|
|
|
729
|
+
${subjectGrammar2}
|
|
730
|
+
|
|
630
731
|
DISCOVERY \u2192 CANDIDATE-FIXES \u2192 COMPETE \u2192 CITE protocol:
|
|
631
732
|
|
|
632
733
|
1. \`traces.getDatasetOverview({})\` first. Note the agents, tools, and any system-prompt fingerprints (look for the prompt text echoed in early spans).
|
|
@@ -638,13 +739,16 @@ DISCOVERY \u2192 CANDIDATE-FIXES \u2192 COMPETE \u2192 CITE protocol:
|
|
|
638
739
|
- **Memory invalidation** \u2014 clear cached prior-run decisions that no longer apply
|
|
639
740
|
- **Scaffolding** \u2014 add a precondition check, a retry policy, a turn budget, a verification step
|
|
640
741
|
- **Output schema** \u2014 narrow the agent's output to forbid the failure shape
|
|
742
|
+
- **Skill / MCP / hook / subagent** \u2014 change the reusable profile component responsible for the behavior
|
|
743
|
+
- **Workflow / rollout policy** \u2014 change orchestration, budget, sampling, or stopping behavior
|
|
744
|
+
- **Code** \u2014 change an implementation path when profile edits cannot repair the behavior
|
|
641
745
|
3. **Compete candidate fixes via subagents.** For each failure cluster, spawn one \`llmQuery\` per candidate-fix axis you want to evaluate. Each subagent's job: simulate the fix on the cited traces and report (i) likely effect, (ii) side effects, (iii) implementation cost as small/medium/large. Pass the cluster's failing trace_ids and the candidate axis as context.
|
|
642
746
|
4. After subagents return, **pick the winning candidate per cluster** based on (effect / cost) and emit ONE finding. Discard the losing candidates \u2014 the output is the recommendation, not the candidate set.
|
|
643
747
|
5. **Cross-reference upstream findings.** If a finding cites a prior failure-mode or knowledge-gap finding, use \`evidence_uri = "finding://<prior-finding-id>"\` (the registry supports this kind). This builds the dependency graph that lets the dashboard show "fix #X resolves failure modes A, B, C."
|
|
644
748
|
|
|
645
749
|
For each winning recommendation, emit ONE finding with:
|
|
646
750
|
- \`area\` = "improvement"
|
|
647
|
-
- \`subject\` =
|
|
751
|
+
- \`subject\` = one exact locus form from the subject grammar above
|
|
648
752
|
- \`claim\` = one sentence stating the edit ("Add a precondition check to refuse tool X calls without arg Y")
|
|
649
753
|
- \`severity\` = leverage rating: "critical" when fix resolves a critical failure mode; "high" when it resolves a high; "medium" when it's a quality-of-life win; "info" when it's a cleanup with no behavioral effect
|
|
650
754
|
- \`evidence_uri\` = the failure-mode finding id this fix targets (\`finding://<id>\`) when it exists; else the most representative span
|
|
@@ -674,10 +778,13 @@ var IMPROVEMENT_KIND_SPEC = {
|
|
|
674
778
|
};
|
|
675
779
|
|
|
676
780
|
// src/analyst/kinds/knowledge-gap.ts
|
|
781
|
+
var subjectGrammar3 = findingSubjectGrammarPromptFor("knowledge-gap");
|
|
677
782
|
var ACTOR_PROMPT3 = `You are a knowledge-gap analyst for an OTLP trace dataset. Your job is to identify the **specific pieces of information the agent lacked, or that were stale**, that caused poor decisions.
|
|
678
783
|
|
|
679
784
|
The agent under analysis maintains a curated knowledge base via \`@tangle-network/agent-knowledge\` \u2014 a wiki of \`KnowledgePage\`s with raw source anchors, claims, and relations. The primary expected store of agent-knowable facts IS that wiki. A "knowledge gap" is anything the agent had to discover or guess at run-time that the wiki should have held \u2014 or an outdated/contradictory fact the agent picked up from a non-wiki source.
|
|
680
785
|
|
|
786
|
+
${subjectGrammar3}
|
|
787
|
+
|
|
681
788
|
DISCOVERY \u2192 ATTRIBUTE-TO-LAYER \u2192 CITE protocol:
|
|
682
789
|
|
|
683
790
|
1. \`traces.getDatasetOverview({})\` first. Note which agents, tools, and models appear.
|
|
@@ -690,19 +797,10 @@ DISCOVERY \u2192 ATTRIBUTE-TO-LAYER \u2192 CITE protocol:
|
|
|
690
797
|
- Agent quoting a tool's docs / system prompt incorrectly because the actual text was insufficient
|
|
691
798
|
- Fabricated identifiers that don't appear in dataset \`sample_trace_ids\`
|
|
692
799
|
Use \`traces.searchTrace\` with patterns like \`I (don.?t|do not) know\`, \`assumed\`, \`unclear\`, \`could you (clarify|tell me|provide)\`, \`not found\`, \`undefined\`, \`unknown\`, \`null\`, dates older than the analysis window, or the agent's specific clarification phrases.
|
|
693
|
-
3. For each gap, identify the **layer of the runtime that should have prevented it
|
|
694
|
-
- \`agent-knowledge:wiki:<page-slug>\` \u2014 the wiki page that should exist but doesn't, or exists but lacks the claim
|
|
695
|
-
- \`agent-knowledge:wiki:<page-slug>#<heading>\` \u2014 wiki page exists but a specific section is missing
|
|
696
|
-
- \`agent-knowledge:claim:<topic>\` \u2014 a specific claim/relation triple that should be in the wiki
|
|
697
|
-
- \`agent-knowledge:raw:<source-id>\` \u2014 raw source captured but never lifted into a curated page
|
|
698
|
-
- \`agent-knowledge:stale:<page-slug>\` \u2014 wiki page exists but contradicts ground-truth evidence in this trace (the wiki itself drifted)
|
|
699
|
-
- \`websearch:outdated:<topic>\` \u2014 agent relied on a web result that was stale; wiki should have superseded it
|
|
700
|
-
- \`tool-doc:<tool-name>:<aspect>\` \u2014 tool description missed a behavior aspect (return shape, failure modes, side effects)
|
|
701
|
-
- \`system-prompt:<section>\` \u2014 system prompt should have stated the rule directly
|
|
702
|
-
- \`memory:<key>\` \u2014 prior-run memory should have surfaced an earlier decision
|
|
800
|
+
3. For each gap, identify the **layer of the runtime that should have prevented it** and use its exact locus from the subject grammar above.
|
|
703
801
|
4. For each gap you can defend with evidence, emit ONE finding with:
|
|
704
802
|
- \`area\` = "knowledge-gap"
|
|
705
|
-
- \`subject\` =
|
|
803
|
+
- \`subject\` = one exact locus form from the subject grammar above
|
|
706
804
|
- \`claim\` = a sentence naming the missing or stale knowledge ("wiki has no page on invoice line-item shape, agent had to re-derive it from raw spans")
|
|
707
805
|
- \`severity\` = "high" when the gap caused a failure or a clarifying question; "medium" when it caused unnecessary turns; "low" when it caused minor inefficiency
|
|
708
806
|
- \`evidence_uri\` = \`span://<trace_id>/<span_id>\` of the moment the gap surfaced (the question, the self-correction, the retrieval miss, the stale web result)
|
|
@@ -730,8 +828,11 @@ var KNOWLEDGE_GAP_KIND_SPEC = {
|
|
|
730
828
|
};
|
|
731
829
|
|
|
732
830
|
// src/analyst/kinds/knowledge-poisoning.ts
|
|
831
|
+
var subjectGrammar4 = findingSubjectGrammarPromptFor("knowledge-poisoning");
|
|
733
832
|
var ACTOR_PROMPT4 = `You are a knowledge-poisoning analyst for an OTLP trace dataset. Your job is to identify cases where the agent **confidently used wrong information** \u2014 not where it lacked information (that's the knowledge-gap analyst).
|
|
734
833
|
|
|
834
|
+
${subjectGrammar4}
|
|
835
|
+
|
|
735
836
|
DISCOVERY \u2192 DUAL-VERIFY \u2192 CITE protocol:
|
|
736
837
|
|
|
737
838
|
1. \`traces.getDatasetOverview({})\` first. Identify the agents, models, and tools.
|
|
@@ -752,7 +853,7 @@ DISCOVERY \u2192 DUAL-VERIFY \u2192 CITE protocol:
|
|
|
752
853
|
|
|
753
854
|
For each confirmed poisoning, emit ONE finding with:
|
|
754
855
|
- \`area\` = "knowledge-poisoning"
|
|
755
|
-
- \`subject\` = the source of the false belief
|
|
856
|
+
- \`subject\` = the source of the false belief using one exact form from the subject grammar above
|
|
756
857
|
- \`claim\` = one sentence: "agent believed X (from source S); evidence in trace shows X is false"
|
|
757
858
|
- \`severity\` = "critical" when poisoning caused a wrong user-visible action; "high" when caught internally but wasted significant work; "medium" for inefficiency only
|
|
758
859
|
- \`evidence_uri\` = \`span://<trace_id>/<span_id>\` of the action span (the moment the agent acted on the false belief)
|
|
@@ -1024,8 +1125,10 @@ export {
|
|
|
1024
1125
|
FINDING_SUBJECT_KINDS,
|
|
1025
1126
|
parseFindingSubject,
|
|
1026
1127
|
renderFindingSubject,
|
|
1128
|
+
FINDING_SUBJECT_SYNTAX,
|
|
1027
1129
|
FINDING_SUBJECT_GRAMMAR_PROMPT,
|
|
1028
1130
|
KIND_EXPECTED_SUBJECTS,
|
|
1131
|
+
findingSubjectGrammarPromptFor,
|
|
1029
1132
|
FindingSubjectStringSchema,
|
|
1030
1133
|
stripCodeFences,
|
|
1031
1134
|
coerceJson,
|
|
@@ -1045,4 +1148,4 @@ export {
|
|
|
1045
1148
|
DEFAULT_TRACE_ANALYST_KINDS,
|
|
1046
1149
|
AnalystRegistry
|
|
1047
1150
|
};
|
|
1048
|
-
//# sourceMappingURL=chunk-
|
|
1151
|
+
//# sourceMappingURL=chunk-DWLIGZBX.js.map
|