agentfootprint 6.45.0 → 7.0.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/AGENTS.md +4 -0
- package/CLAUDE.md +4 -0
- package/README.md +141 -167
- package/ai-instructions/claude-code/SKILL.md +11 -0
- package/dist/adapters/llm/BrowserOpenAIProvider.js +1 -1
- package/dist/adapters/llm/MockProvider.js +2 -1
- package/dist/adapters/llm/MockProvider.js.map +1 -1
- package/dist/debug/finders.js +29 -0
- package/dist/debug/finders.js.map +1 -0
- package/dist/debug.js +134 -0
- package/dist/debug.js.map +1 -0
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.d.ts +1 -1
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.js +1 -1
- package/dist/esm/adapters/llm/MockProvider.d.ts +2 -1
- package/dist/esm/adapters/llm/MockProvider.js +2 -1
- package/dist/esm/adapters/llm/MockProvider.js.map +1 -1
- package/dist/esm/debug/finders.d.ts +12 -0
- package/dist/esm/debug/finders.js +13 -0
- package/dist/esm/debug/finders.js.map +1 -0
- package/dist/esm/debug.d.ts +25 -0
- package/dist/esm/debug.js +54 -0
- package/dist/esm/debug.js.map +1 -0
- package/dist/esm/events.d.ts +18 -0
- package/dist/esm/events.js +22 -0
- package/dist/esm/events.js.map +1 -0
- package/dist/esm/index.d.ts +4 -24
- package/dist/esm/index.js +7 -54
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/injection-engine/index.d.ts +1 -1
- package/dist/esm/lib/injection-engine/index.js +1 -1
- package/dist/esm/lib/injection-engine/index.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillGraph.d.ts +3 -2
- package/dist/esm/lib/injection-engine/skillGraph.js +3 -2
- package/dist/esm/lib/injection-engine/skillGraph.js.map +1 -1
- package/dist/esm/lib/rag/defineRAG.d.ts +3 -3
- package/dist/esm/lib/rag/defineRAG.js +3 -3
- package/dist/esm/lib/rag/indexDocuments.d.ts +2 -1
- package/dist/esm/lib/rag/indexDocuments.js +2 -1
- package/dist/esm/lib/rag/indexDocuments.js.map +1 -1
- package/dist/esm/locales/index.d.ts +9 -0
- package/dist/esm/locales/index.js +7 -0
- package/dist/esm/locales/index.js.map +1 -1
- package/dist/esm/memory/causal/types.d.ts +13 -9
- package/dist/esm/memory/causal/types.js.map +1 -1
- package/dist/esm/memory/define.types.d.ts +5 -3
- package/dist/esm/memory/define.types.js +5 -3
- package/dist/esm/memory/define.types.js.map +1 -1
- package/dist/esm/observe.d.ts +1 -6
- package/dist/esm/observe.js +7 -36
- package/dist/esm/observe.js.map +1 -1
- package/dist/esm/providers.d.ts +2 -2
- package/dist/esm/providers.js +1 -1
- package/dist/esm/providers.js.map +1 -1
- package/dist/esm/status.d.ts +10 -4
- package/dist/esm/status.js +13 -4
- package/dist/esm/status.js.map +1 -1
- package/dist/esm/tool-providers/index.d.ts +1 -1
- package/dist/events.js +42 -0
- package/dist/events.js.map +1 -0
- package/dist/index.js +7 -121
- package/dist/index.js.map +1 -1
- package/dist/lib/injection-engine/index.js +2 -2
- package/dist/lib/injection-engine/index.js.map +1 -1
- package/dist/lib/injection-engine/skillGraph.js +5 -4
- package/dist/lib/injection-engine/skillGraph.js.map +1 -1
- package/dist/lib/rag/defineRAG.js +3 -3
- package/dist/lib/rag/indexDocuments.js +2 -1
- package/dist/lib/rag/indexDocuments.js.map +1 -1
- package/dist/locales/index.js +2 -1
- package/dist/locales/index.js.map +1 -1
- package/dist/memory/causal/types.js.map +1 -1
- package/dist/memory/define.types.js +5 -3
- package/dist/memory/define.types.js.map +1 -1
- package/dist/observe.js +22 -115
- package/dist/observe.js.map +1 -1
- package/dist/providers.js +3 -1
- package/dist/providers.js.map +1 -1
- package/dist/status.js +13 -5
- package/dist/status.js.map +1 -1
- package/dist/types/adapters/llm/BrowserOpenAIProvider.d.ts +1 -1
- package/dist/types/adapters/llm/MockProvider.d.ts +2 -1
- package/dist/types/adapters/llm/MockProvider.d.ts.map +1 -1
- package/dist/types/debug/finders.d.ts +13 -0
- package/dist/types/debug/finders.d.ts.map +1 -0
- package/dist/types/debug.d.ts +26 -0
- package/dist/types/debug.d.ts.map +1 -0
- package/dist/types/events.d.ts +19 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/index.d.ts +4 -24
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/index.d.ts +1 -1
- package/dist/types/lib/injection-engine/index.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillGraph.d.ts +3 -2
- package/dist/types/lib/injection-engine/skillGraph.d.ts.map +1 -1
- package/dist/types/lib/rag/defineRAG.d.ts +3 -3
- package/dist/types/lib/rag/indexDocuments.d.ts +2 -1
- package/dist/types/lib/rag/indexDocuments.d.ts.map +1 -1
- package/dist/types/locales/index.d.ts +9 -0
- package/dist/types/locales/index.d.ts.map +1 -1
- package/dist/types/memory/causal/types.d.ts +13 -9
- package/dist/types/memory/causal/types.d.ts.map +1 -1
- package/dist/types/memory/define.types.d.ts +5 -3
- package/dist/types/memory/define.types.d.ts.map +1 -1
- package/dist/types/observe.d.ts +1 -6
- package/dist/types/observe.d.ts.map +1 -1
- package/dist/types/providers.d.ts +2 -2
- package/dist/types/providers.d.ts.map +1 -1
- package/dist/types/status.d.ts +10 -4
- package/dist/types/status.d.ts.map +1 -1
- package/dist/types/tool-providers/index.d.ts +1 -1
- package/dist/types/tool-providers/index.d.ts.map +1 -1
- package/package.json +59 -2
package/AGENTS.md
CHANGED
|
@@ -484,6 +484,10 @@ live deep-Proxy) into `typedEmit`; use the plain local value (`typedEmit`
|
|
|
484
484
|
dev-warns on unclonable payloads). Bench:
|
|
485
485
|
`examples/features/21-deferred-observers.ts`.
|
|
486
486
|
|
|
487
|
+
### Self-explain — `.selfExplain()` (the agent answers "why?" about its own last run)
|
|
488
|
+
|
|
489
|
+
One builder call mounts ONE skill that, when the user asks a why-question, unlocks the 5 trace tools (`run_overview` / `trace_node` / `who_wrote` / `get_value` / `trace_slice`) for that iteration ONLY — bound LATE to the agent's PREVIOUS COMPLETED run (captured at `onRunEnd`/`onRunFailed`, so it can never serve an in-flight run; a failed run still explains "why did you fail?"). `delegate: { provider, model }` runs the trace-walk on a cheaper model via one `explain_run` tool. Requires `reactMode: 'dynamic'`/`'dynamic-grouped'` (classic caches the tools slot → throws at build); reserved tool-name clash also throws. Differs from **Causal memory**: `.selfExplain()` = THIS conversation's last run, in-memory, drill-by-id; Causal = any past run, persisted, recalled by similarity — reach for selfExplain on same-conversation follow-ups, Causal for cross-session. Note: Causal *similarity* recall needs a store with `search()` (only `InMemoryStore` today; Redis/AgentCore lack it). Full guide: docs `debug/self-explain`.
|
|
490
|
+
|
|
487
491
|
## Anti-Patterns — Don't
|
|
488
492
|
|
|
489
493
|
- ❌ **Don't ship a `ReflexionAgent` class.** Compose `Sequence(Agent, critique-LLM, Agent)`.
|
package/CLAUDE.md
CHANGED
|
@@ -549,6 +549,10 @@ live deep-Proxy) into `typedEmit`; use the plain local value (`typedEmit`
|
|
|
549
549
|
dev-warns on unclonable payloads). Bench:
|
|
550
550
|
`examples/features/21-deferred-observers.ts`.
|
|
551
551
|
|
|
552
|
+
### Self-explain — `.selfExplain()` (the agent answers "why?" about its own last run)
|
|
553
|
+
|
|
554
|
+
One builder call mounts ONE skill that, when the user asks a why-question, unlocks the 5 trace tools (`run_overview` / `trace_node` / `who_wrote` / `get_value` / `trace_slice`) for that iteration ONLY — bound LATE to the agent's PREVIOUS COMPLETED run (captured at `onRunEnd`/`onRunFailed`, so it can never serve an in-flight run; a failed run still explains "why did you fail?"). `delegate: { provider, model }` runs the trace-walk on a cheaper model via one `explain_run` tool. Requires `reactMode: 'dynamic'`/`'dynamic-grouped'` (classic caches the tools slot → throws at build); reserved tool-name clash also throws. Differs from **Causal memory**: `.selfExplain()` = THIS conversation's last run, in-memory, drill-by-id; Causal = any past run, persisted, recalled by similarity — reach for selfExplain on same-conversation follow-ups, Causal for cross-session. Note: Causal *similarity* recall needs a store with `search()` (only `InMemoryStore` today; Redis/AgentCore lack it). Full guide: docs `debug/self-explain`.
|
|
555
|
+
|
|
552
556
|
## Anti-Patterns — Don't
|
|
553
557
|
|
|
554
558
|
- ❌ **Don't ship a `ReflexionAgent` class.** Compose `Sequence(Agent, critique-LLM, Agent)`.
|
package/README.md
CHANGED
|
@@ -7,10 +7,15 @@
|
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
10
|
-
The explainable agent framework: every read, write, decision, and tool call becomes
|
|
10
|
+
The explainable AI agent framework for TypeScript: every read, write, decision, and tool call becomes
|
|
11
11
|
<strong>connected evidence</strong> as your agent runs. When something goes wrong, you don't grep logs — you ask.
|
|
12
12
|
</p>
|
|
13
13
|
|
|
14
|
+
<p align="center">
|
|
15
|
+
<strong>Build</strong> agents — skills, steering, RAG, memory, control flow — and <strong>debug</strong> them like nothing else.<br/>
|
|
16
|
+
<em>Why</em> is a query, not a guess.
|
|
17
|
+
</p>
|
|
18
|
+
|
|
14
19
|
<p align="center">
|
|
15
20
|
<a href="https://footprintjs.github.io/agentThinkingUI/">
|
|
16
21
|
<img src="docs/assets/hero-atui.png" alt="An agent run replayed in AgentThinkingUI — the LLM 'brain' calls the Flight-search tool, the step inspector shows the tool's raw output and the brain's reasoning about it, and the timeline scrubs every step of the run." width="100%">
|
|
@@ -65,159 +70,6 @@ structured so context is **evidence** — every injection, read, write, decision
|
|
|
65
70
|
tool call recorded *connected*, the moment it happens. Not logs you grep. Evidence
|
|
66
71
|
you ask.
|
|
67
72
|
|
|
68
|
-
## How — we abstract context engineering
|
|
69
|
-
|
|
70
|
-
Every piece of context enters the LLM through one of **3 slots** (`system` ·
|
|
71
|
-
`messages` · `tools`), under one of **4 triggers** — skills, steering, RAG, facts,
|
|
72
|
-
memory, guardrails are all the same move: `Injection = slot × trigger × cache`.
|
|
73
|
-
|
|
74
|
-
**Because the framework owns that injection point, every piece of context is born
|
|
75
|
-
tracked.** Tracking isn't an add-on you wire up — it's a consequence of the
|
|
76
|
-
abstraction. [The full model ↓](#the-model--what-we-abstract)
|
|
77
|
-
|
|
78
|
-
<p align="center">
|
|
79
|
-
<picture>
|
|
80
|
-
<source media="(prefers-color-scheme: dark)" srcset="docs/assets/hero-dark.svg">
|
|
81
|
-
<source media="(prefers-color-scheme: light)" srcset="docs/assets/hero-light.svg">
|
|
82
|
-
<img alt="agentfootprint mascot composing context flavors (Skills, Steering, Guardrails, RAG, Tool APIs, Memory) into three structured LLM slots (system, messages, tools) — the central abstraction, visualized." src="docs/assets/hero-light.svg" width="100%"/>
|
|
83
|
-
</picture>
|
|
84
|
-
</p>
|
|
85
|
-
|
|
86
|
-
## What tracking buys you
|
|
87
|
-
|
|
88
|
-
**See it in 30 seconds** — four questions logs can't answer, each answered by code in this repo from a real run:
|
|
89
|
-
|
|
90
|
-
```text
|
|
91
|
-
Q: Why did the model pick refund_full instead of refund_partial?
|
|
92
|
-
A: margin 0.02 — ⚠ NARROW: the two tool descriptions read nearly identical
|
|
93
|
-
(toolChoiceRecorder — and the catalog lint flags the pair before you ever run)
|
|
94
|
-
|
|
95
|
-
Q: Why was this loan declined?
|
|
96
|
-
A: decision ← [control: "DTI above the 0.43 affordability ceiling"] ← dti 0.52 ← monthlyDebt / income
|
|
97
|
-
(decide() evidence + the causal slice — every hop is a real recorded edge)
|
|
98
|
-
|
|
99
|
-
Q: Which piece of context made the answer wrong?
|
|
100
|
-
A: CAUSAL: ablating fact 'vip-override' flipped the outcome in 3/3 seeded reruns
|
|
101
|
-
(localizeContextBug — ranked proxies, counterfactual proof)
|
|
102
|
-
|
|
103
|
-
Q: Prove nobody edited this run's record.
|
|
104
|
-
A: verifyAuditBundle → valid: false, brokenAt: #16 — the tampered record, named
|
|
105
|
-
(hash-chained audit export, offline verification)
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
And you don't have to read the trace yourself — **we provide the tools for an LLM to track it for you**: the trace toolpack let a debugger model find a planted bug while reading **9.5% of the trace** ([guide](docs/guides/trace-debugging.md)).
|
|
109
|
-
|
|
110
|
-
**And all this watching costs the run nothing.** Your agent *is* the event loop: a stage runs on the call stack and feeds its trace events into a queue; in the idle beat the dispatcher delivers them to your listeners and files them in trace memory — **one beat behind**, never blocking the hot path:
|
|
111
|
-
|
|
112
|
-
<p align="center">
|
|
113
|
-
<picture>
|
|
114
|
-
<source media="(prefers-color-scheme: dark)" srcset="docs/assets/event-loop-dark.svg">
|
|
115
|
-
<source media="(prefers-color-scheme: light)" srcset="docs/assets/event-loop-light.svg">
|
|
116
|
-
<img alt="Your agent is the event loop — animated. Left: your agent code (Context, Call LLM, Tool Calls) looping turn after turn. Right: the JS event loop drawn as two bold curved arrows with a traveling cursor and two stops — the call stack, where each stage runs as a frame and feeds four trace events (structure, data, control, emit) into the trace queue at the loop's center; and idle time, where the dispatcher flies the queued events into TRACE MEMORY and every listener (onStageAdded, onCommit, onDecision, onEmit) receives every event, one beat behind. Grey is JavaScript's own machinery, green is footprintjs, colors are your code and its trace." src="docs/assets/event-loop-light.svg" width="100%"/>
|
|
117
|
-
</picture>
|
|
118
|
-
</p>
|
|
119
|
-
|
|
120
|
-
## One contextual error, walked end to end
|
|
121
|
-
|
|
122
|
-
The third question above, in full — every value below is the captured output of
|
|
123
|
-
[`examples/observability/05-context-bisect.ts`](examples/observability/05-context-bisect.ts)
|
|
124
|
-
and [`06-backtrack-trace.ts`](examples/observability/06-backtrack-trace.ts), runnable offline.
|
|
125
|
-
|
|
126
|
-
**The bug.** A refunds agent carries a poisoned customer-profile fact. It answers:
|
|
127
|
-
|
|
128
|
-
> *"Refund APPROVED: Dana Reyes holds VIP tier override status, so the 47-day-old
|
|
129
|
-
> order qualifies for a refund beyond the 30-day window."*
|
|
130
|
-
|
|
131
|
-
The policy says 30 days. The logs look fine — the model was *given* bad context,
|
|
132
|
-
and classical logging has no row for that.
|
|
133
|
-
|
|
134
|
-
**The walk.** Because context here is state, the decision backtracks like a
|
|
135
|
-
variable: who read it, who wrote it, who let it in, where it was born —
|
|
136
|
-
|
|
137
|
-
```text
|
|
138
|
-
ANSWER "Refund APPROVED…" ← the bug
|
|
139
|
-
READ call-llm#40 assembled the system prompt ← exactly what the model saw
|
|
140
|
-
LANDED context#6 wrote systemPromptInjections ← who mutated state
|
|
141
|
-
ALLOWED trigger { kind: 'always' } — active every iteration ← why it was let in
|
|
142
|
-
BORN defineFact('vip-override-fact') ← who wrote it
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
That chain gives the **complete, provable candidate set** — every piece of
|
|
146
|
-
context that demonstrably reached the call, and nothing else. Influence scoring
|
|
147
|
-
then *ranks* inside it (the two facts sit 0.01 apart — proxies can't separate
|
|
148
|
-
them), and counterfactual **ablation proves**: removing `vip-override-fact`
|
|
149
|
-
flips APPROVED → DECLINED in **3/3 seeded reruns**; the benign style fact and
|
|
150
|
-
the lookup tool come back not-confirmed, 0/3. Scores are proxies; only the
|
|
151
|
-
ablation verdict makes a causal claim — the report says so itself.
|
|
152
|
-
|
|
153
|
-
**And when the proxy *can't* rank — it says so.** Output-similarity scoring is
|
|
154
|
-
structurally blind to **absence/crowding** bugs (a key instruction truncated out
|
|
155
|
-
of the window, context diluted by filler): the culprit doesn't resemble the
|
|
156
|
-
answer, so it ranks low under an innocent. `rankingConfidence` is the honesty
|
|
157
|
-
marker for that — when no source clearly wins, it returns a **shortlist to
|
|
158
|
-
confirm by ablation** instead of a confident, wrong #1:
|
|
159
|
-
|
|
160
|
-
```typescript
|
|
161
|
-
import { rankingConfidence, ratioStrategy } from 'agentfootprint/observe';
|
|
162
|
-
|
|
163
|
-
const c = rankingConfidence(scores); // over a scoreInfluence() result
|
|
164
|
-
if (!c.clearWinner) ablate(c.shortlist); // too flat to trust → escalate to truth
|
|
165
|
-
// decisiveness rule is pluggable: marginStrategy (default) · ratioStrategy
|
|
166
|
-
// (scale-invariant) · bring-your-own. See docs/guides/ranking-confidence.md
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
**Three interfaces, one for each shape of the bug** — ship-a-default, bring-your-own:
|
|
170
|
-
|
|
171
|
-
| interface | finds the culprit when it is… | confirm by |
|
|
172
|
-
|---|---|---|
|
|
173
|
-
| **influence ranking** (`scoreInfluence` + `rankingConfidence`) | **present** — orders suspects, says when it can't | — |
|
|
174
|
-
| **ablation** (`localizeContextBug`) | **present** — *remove* it, see the outcome flip | removal |
|
|
175
|
-
| **missing-context finder** (`findDroppedContext`) | **absent** — available but never reached the model (`available − sent`) | restoration |
|
|
176
|
-
|
|
177
|
-
The third closes the gap the first two are blind to — a key instruction truncated
|
|
178
|
-
out of the window has nothing to ablate. `findDroppedContext` is a cheap, exact id
|
|
179
|
-
diff (no embeddings, no LLM); confirm by *restoration* — add the dropped unit back,
|
|
180
|
-
see if the outcome flips. [Guide](docs/guides/missing-context.md) ·
|
|
181
|
-
[example](examples/observability/10-missing-context.ts).
|
|
182
|
-
|
|
183
|
-
**The same walk, visual.** One call serializes the report for
|
|
184
|
-
[AgentThinkingUI](https://github.com/footprintjs/agentThinkingUI)'s
|
|
185
|
-
`<BacktrackView>` — the "why?" board, triggerable from **any** decision point
|
|
186
|
-
(final answer, a mid-loop tool choice, a deterministic `decide()` rule):
|
|
187
|
-
|
|
188
|
-
```typescript
|
|
189
|
-
import { localizeContextBug, toBacktrackTrace } from 'agentfootprint/observe';
|
|
190
|
-
|
|
191
|
-
const report = await localizeContextBug({ artifacts, embedder, atStep, rerun });
|
|
192
|
-
const trace = toBacktrackTrace(report, {
|
|
193
|
-
claim: 'The agent approved a refund 47 days past the 30-day window — why?',
|
|
194
|
-
answer: { text: buggyAnswer, label: 'the wrong answer' },
|
|
195
|
-
});
|
|
196
|
-
// <BacktrackView trace={trace}/> — or <BacktrackOverlay/> from any decision point
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
<img alt="The BacktrackView board: the wrong answer, the suspects with influence meters, the CAUSAL 3/3 ablation stamp on the planted fact, and the chain-of-custody rewind showing the exact system prompt the model saw with the culprit sentence highlighted." src="docs/assets/backtrack-board.png" width="100%"/>
|
|
200
|
-
<p align="center">
|
|
201
|
-
<sub><a href="https://footprintjs.github.io/agentThinkingUI/demo/backtrack.html"><b>▶ Try the why-board live</b></a> — or run <a href="examples/observability/06-backtrack-trace.ts"><code>examples/observability/06-backtrack-trace.ts</code></a> offline.</sub>
|
|
202
|
-
</p>
|
|
203
|
-
|
|
204
|
-
The rewind pane at the bottom is the killer view: **the exact system prompt the
|
|
205
|
-
model saw**, with the culprit sentence highlighted — recorded state, not a
|
|
206
|
-
reconstruction. And the same chain feeds the machine door: every id on the
|
|
207
|
-
board is a `runtimeStageId` a debugger LLM can drill with the
|
|
208
|
-
[trace toolpack](docs/guides/trace-debugging.md), token-cheaply.
|
|
209
|
-
|
|
210
|
-
---
|
|
211
|
-
|
|
212
|
-
## Pick your door
|
|
213
|
-
|
|
214
|
-
| 🔧 Building an agent? | 🐛 Agent misbehaving? | 🏛️ Need audit / compliance? |
|
|
215
|
-
|---|---|---|
|
|
216
|
-
| Typed agents with skills, steering, RAG, memory, guardrails — and the trace for free. | Lint your tool catalog in 5 minutes — works on **any** framework's tool list (plain JSON / MCP / OpenAI / Anthropic shapes). Then causal slices, context bisection, and the debugger-LLM toolpack. | Hash-chained, tamper-evident run records with an offline verifier — record-keeping in the EU-AI-Act shape. |
|
|
217
|
-
| [→ Quick start](#quick-start--runs-offline-no-api-key) · [→ Build ↓](#-build--design-your-agent-or-system-of-agents) | [→ Debug ↓](#-debug--see-what-your-agent-did) · [→ Tool-catalog lint](docs/guides/tool-catalog-lint.md) · [→ Trace debugging](docs/guides/trace-debugging.md) | [→ Audit ↓](#-audit--prove-what-happened) · [→ Security guide](docs/guides/security.md) |
|
|
218
|
-
|
|
219
|
-
---
|
|
220
|
-
|
|
221
73
|
## Quick start — runs offline, no API key
|
|
222
74
|
|
|
223
75
|
```bash
|
|
@@ -309,15 +161,127 @@ The fourth primitive is `Loop` — `Loop.repeat(agent).until(guard).times(5)`, w
|
|
|
309
161
|
|
|
310
162
|
---
|
|
311
163
|
|
|
312
|
-
##
|
|
164
|
+
## How — we abstract context engineering
|
|
313
165
|
|
|
166
|
+
Skills, steering, RAG, facts, memory, guardrails — every name for context does one thing: it injects into one of three LLM slots. So we abstracted the injection itself.
|
|
314
167
|
|
|
168
|
+
<p align="center">
|
|
169
|
+
<picture>
|
|
170
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/assets/hero-dark.svg">
|
|
171
|
+
<source media="(prefers-color-scheme: light)" srcset="docs/assets/hero-light.svg">
|
|
172
|
+
<img alt="agentfootprint mascot composing context flavors (Skills, Steering, Guardrails, RAG, Tool APIs, Memory) into three structured LLM slots (system, messages, tools) — the central abstraction, visualized." src="docs/assets/hero-light.svg" width="100%"/>
|
|
173
|
+
</picture>
|
|
174
|
+
</p>
|
|
175
|
+
<p align="center">
|
|
176
|
+
<sub><em>One primitive: <code>Injection = slot × trigger × cache</code>. Because the framework owns this point, every piece of context is <b>born tracked</b> — observability isn't wired up, it's a consequence of the abstraction. <a href="#the-model--what-we-abstract">The full model ↓</a></em></sub>
|
|
177
|
+
</p>
|
|
315
178
|
|
|
316
|
-
|
|
179
|
+
## What tracking buys you
|
|
317
180
|
|
|
318
|
-
|
|
181
|
+
**See it in 30 seconds** — four questions logs can't answer, each answered by code in this repo from a real run:
|
|
319
182
|
|
|
320
|
-
|
|
183
|
+
```text
|
|
184
|
+
Q: Why did the model pick refund_full instead of refund_partial?
|
|
185
|
+
A: margin 0.02 — ⚠ NARROW: the two tool descriptions read nearly identical
|
|
186
|
+
(toolChoiceRecorder — and the catalog lint flags the pair before you ever run)
|
|
187
|
+
|
|
188
|
+
Q: Why was this loan declined?
|
|
189
|
+
A: decision ← [control: "DTI above the 0.43 affordability ceiling"] ← dti 0.52 ← monthlyDebt / income
|
|
190
|
+
(decide() evidence + the causal slice — every hop is a real recorded edge)
|
|
191
|
+
|
|
192
|
+
Q: Which piece of context made the answer wrong?
|
|
193
|
+
A: CAUSAL: ablating fact 'vip-override' flipped the outcome in 3/3 seeded reruns
|
|
194
|
+
(localizeContextBug — ranked proxies, counterfactual proof)
|
|
195
|
+
|
|
196
|
+
Q: Prove nobody edited this run's record.
|
|
197
|
+
A: verifyAuditBundle → valid: false, brokenAt: #16 — the tampered record, named
|
|
198
|
+
(hash-chained audit export, offline verification)
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
And you don't have to read the trace yourself — the trace toolpack lets a debugger model do it: in one run it found a planted bug while reading **9.5% of the trace** ([guide](docs/guides/trace-debugging.md)).
|
|
202
|
+
|
|
203
|
+
And the watching costs the run nothing:
|
|
204
|
+
|
|
205
|
+
<p align="center">
|
|
206
|
+
<picture>
|
|
207
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/assets/event-loop-dark.svg">
|
|
208
|
+
<source media="(prefers-color-scheme: light)" srcset="docs/assets/event-loop-light.svg">
|
|
209
|
+
<img alt="Your agent is the event loop — animated. Left: your agent code (Context, Call LLM, Tool Calls) looping turn after turn. Right: the JS event loop drawn as two bold curved arrows with a traveling cursor and two stops — the call stack, where each stage runs as a frame and feeds four trace events (structure, data, control, emit) into the trace queue at the loop's center; and idle time, where the dispatcher flies the queued events into TRACE MEMORY and every listener (onStageAdded, onCommit, onDecision, onEmit) receives every event, one beat behind. Grey is JavaScript's own machinery, green is footprintjs, colors are your code and its trace." src="docs/assets/event-loop-light.svg" width="100%"/>
|
|
210
|
+
</picture>
|
|
211
|
+
</p>
|
|
212
|
+
<p align="center">
|
|
213
|
+
<sub><em>Your agent <b>is</b> the event loop: each stage feeds its trace events into a queue on the call stack; the dispatcher delivers them to your listeners in the idle beat — <b>one beat behind</b>, never on the hot path.</em></sub>
|
|
214
|
+
</p>
|
|
215
|
+
|
|
216
|
+
## One contextual error, walked end to end
|
|
217
|
+
|
|
218
|
+
The third question above, in full — every value below is the captured output of
|
|
219
|
+
[`examples/observability/05-context-bisect.ts`](examples/observability/05-context-bisect.ts)
|
|
220
|
+
and [`06-backtrack-trace.ts`](examples/observability/06-backtrack-trace.ts), runnable offline.
|
|
221
|
+
|
|
222
|
+
**The bug.** A refunds agent carries a poisoned customer-profile fact. It answers:
|
|
223
|
+
|
|
224
|
+
> *"Refund APPROVED: Dana Reyes holds VIP tier override status, so the 47-day-old
|
|
225
|
+
> order qualifies for a refund beyond the 30-day window."*
|
|
226
|
+
|
|
227
|
+
The policy says 30 days. The logs look fine — the model was *given* bad context,
|
|
228
|
+
and classical logging has no row for that.
|
|
229
|
+
|
|
230
|
+
**The walk.** Because context here is state, the decision backtracks like a
|
|
231
|
+
variable: who read it, who wrote it, who let it in, where it was born —
|
|
232
|
+
|
|
233
|
+
```text
|
|
234
|
+
ANSWER "Refund APPROVED…" ← the bug
|
|
235
|
+
READ call-llm#40 assembled the system prompt ← exactly what the model saw
|
|
236
|
+
LANDED context#6 wrote systemPromptInjections ← who mutated state
|
|
237
|
+
ALLOWED trigger { kind: 'always' } — active every iteration ← why it was let in
|
|
238
|
+
BORN defineFact('vip-override-fact') ← who wrote it
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
That chain is the **provable candidate set** — everything that demonstrably reached
|
|
242
|
+
the call, nothing else. Influence scoring then *ranks* inside it, and counterfactual
|
|
243
|
+
**ablation proves**: removing `vip-override-fact` flips APPROVED → DECLINED in
|
|
244
|
+
**3/3 seeded reruns** (the benign fact and the lookup tool: 0/3). Scores are proxies;
|
|
245
|
+
only ablation makes the causal claim.
|
|
246
|
+
|
|
247
|
+
**Three interfaces, one per shape of bug** — ship-a-default, bring-your-own:
|
|
248
|
+
|
|
249
|
+
| interface | finds the culprit when it is… | confirm by |
|
|
250
|
+
|---|---|---|
|
|
251
|
+
| **influence ranking** (`scoreInfluence` + `rankingConfidence`) | **present** — orders suspects, says when it can't rank | — |
|
|
252
|
+
| **ablation** (`localizeContextBug`) | **present** — *remove* it, see the outcome flip | removal |
|
|
253
|
+
| **missing-context finder** (`findDroppedContext`) | **absent** — available but never reached the model (`available − sent`) | restoration |
|
|
254
|
+
|
|
255
|
+
The third closes a gap the first two are blind to: a key instruction truncated out of
|
|
256
|
+
the window has nothing to ablate, so you confirm by *restoration*. And when scoring is
|
|
257
|
+
too flat to trust, `rankingConfidence` returns a shortlist to confirm rather than a
|
|
258
|
+
confident, wrong #1. Guides: [ranking-confidence](docs/guides/ranking-confidence.md) ·
|
|
259
|
+
[missing-context](docs/guides/missing-context.md).
|
|
260
|
+
|
|
261
|
+
**The same walk, visual.** `toBacktrackTrace()` serializes the report into
|
|
262
|
+
[AgentThinkingUI](https://github.com/footprintjs/agentThinkingUI)'s `<BacktrackView>`
|
|
263
|
+
— the "why?" board, triggerable from any decision point (final answer, a mid-loop tool
|
|
264
|
+
choice, a deterministic `decide()` rule):
|
|
265
|
+
|
|
266
|
+
<img alt="The BacktrackView board: the wrong answer, the suspects with influence meters, the CAUSAL 3/3 ablation stamp on the planted fact, and the chain-of-custody rewind showing the exact system prompt the model saw with the culprit sentence highlighted." src="docs/assets/backtrack-board.png" width="100%"/>
|
|
267
|
+
<p align="center">
|
|
268
|
+
<sub><em>The wrong answer, suspects with influence meters, the <b>CAUSAL 3/3</b> ablation stamp on the planted fact, and the rewind showing the <b>exact system prompt the model saw</b> with the culprit highlighted — recorded state, not a reconstruction. Every id is a <code>runtimeStageId</code> a debugger LLM can drill via the <a href="docs/guides/trace-debugging.md">trace toolpack</a>. <a href="https://footprintjs.github.io/agentThinkingUI/demo/backtrack.html"><b>▶ Try it live</b></a> · run <a href="examples/observability/06-backtrack-trace.ts"><code>06-backtrack-trace.ts</code></a> offline.</em></sub>
|
|
269
|
+
</p>
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Pick your door
|
|
274
|
+
|
|
275
|
+
| 🔧 Building an agent? | 🐛 Agent misbehaving? | 🏛️ Need audit / compliance? |
|
|
276
|
+
|---|---|---|
|
|
277
|
+
| Typed agents with skills, steering, RAG, memory, guardrails — and the trace for free. | Lint your tool catalog in 5 minutes — works on **any** framework's tool list (plain JSON / MCP / OpenAI / Anthropic shapes). Then causal slices, context bisection, and the debugger-LLM toolpack. | Hash-chained, tamper-evident run records with an offline verifier — record-keeping in the EU-AI-Act shape. |
|
|
278
|
+
| [→ Quick start](#quick-start--runs-offline-no-api-key) · [→ Build ↓](#-build--design-your-agent-or-system-of-agents) | [→ Debug ↓](#-debug--see-what-your-agent-did) · [→ Tool-catalog lint](docs/guides/tool-catalog-lint.md) · [→ Trace debugging](docs/guides/trace-debugging.md) | [→ Audit ↓](#-audit--prove-what-happened) · [→ Security guide](docs/guides/security.md) |
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## The model — what we abstract
|
|
283
|
+
|
|
284
|
+
You collect domain-specific data and instructions — **Skills · Steering · Guardrails · RAG · Tool APIs · Memory**, with more on the way. They all do one thing: **inject into one of three slots** (`system`, `messages`, `tools`). So we abstracted the injection itself.
|
|
321
285
|
|
|
322
286
|
<p align="center">
|
|
323
287
|
<picture>
|
|
@@ -491,8 +455,9 @@ const reflexion = Loop.create()
|
|
|
491
455
|
<img alt="Classic ReAct vs Dynamic ReAct loop topology — same 5 stages (SystemPrompt, Messages, Tools, CallLLM, Route → ExecuteTools/Finalize), but the loop edge differs: Classic returns to CallLLM only (slots frozen at 12 tools every iteration), Dynamic returns to SystemPrompt (slots recompose, tools shrink from 1 to 5 as skills activate)." src="docs/assets/dynamic-vs-classic-light.svg" width="100%"/>
|
|
492
456
|
</picture>
|
|
493
457
|
</p>
|
|
494
|
-
|
|
495
|
-
|
|
458
|
+
<p align="center">
|
|
459
|
+
<sub><em>Same five stages; only the loop edge differs. Classic returns to <code>CallLLM</code> with slots frozen; Dynamic (agentfootprint) returns to <code>SystemPrompt</code>, so injections recompose the next prompt — also the prerequisite for per-iteration caching.</em></sub>
|
|
460
|
+
</p>
|
|
496
461
|
|
|
497
462
|
| Iteration | Classic ReAct | Dynamic ReAct (agentfootprint) |
|
|
498
463
|
|---|---|---|
|
|
@@ -521,8 +486,6 @@ const research = Loop.create()
|
|
|
521
486
|
.build();
|
|
522
487
|
```
|
|
523
488
|
|
|
524
|
-
Same `.create().method().build()` shape as the four rows above — just composed.
|
|
525
|
-
|
|
526
489
|
### Named patterns — also compositions of the same 4
|
|
527
490
|
|
|
528
491
|
<p align="center">
|
|
@@ -563,11 +526,11 @@ Because we own the loop, every decision and execution is captured during travers
|
|
|
563
526
|
|
|
564
527
|
The same trace serves three downstream consumers — no extra instrumentation:
|
|
565
528
|
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
529
|
+
| Consumer | What the trace gives you |
|
|
530
|
+
|---|---|
|
|
531
|
+
| **Audit / compliance** | Six months later, *"why was loan #42 rejected?"* answers from the chain (`creditScore=580 < 620 ∧ dti=0.6 > 0.43 → riskTier=high → REJECTED`) — no LLM call. GDPR Art. 22 / ECOA / EU AI Act adverse-action notices write themselves from the captured decision evidence. |
|
|
532
|
+
| **Cheap-model triage** | A Sonnet trace is good *input* for Haiku to answer follow-ups: ~200 tokens ($0.25/1M) vs ~2,500 at a reasoning model ($15/1M). Memoized thinking — no agent rerun. |
|
|
533
|
+
| **Training data** | Every successful chain is a labeled trajectory; SFT pairs fall out of the snapshot's history field. (The export wrapper, DPO, and process-RL need extra collection layers — [roadmap](https://github.com/footprintjs/agentfootprint/issues).) |
|
|
571
534
|
|
|
572
535
|
Four views, one trace — pick by question:
|
|
573
536
|
|
|
@@ -650,6 +613,10 @@ undocumented optional params). The runtime counterpart, `toolChoiceRecorder`
|
|
|
650
613
|
the same geometry and flags narrow margins and proxy disagreements — lazily,
|
|
651
614
|
off the hot path.
|
|
652
615
|
|
|
616
|
+
agentfootprint owns the *detection* — the scores, the ties, the recorded
|
|
617
|
+
margins; you own the *policy* — the threshold, the embedder, the rewrite. We
|
|
618
|
+
map; you decide.
|
|
619
|
+
|
|
653
620
|
> 📖 **[Tool-catalog lint guide](docs/guides/tool-catalog-lint.md)** — 5 minutes
|
|
654
621
|
> from a tools.json to a gated CI check ·
|
|
655
622
|
> [`examples/observability/02`](examples/observability/02-lint-confusable-catalog.ts) ·
|
|
@@ -700,6 +667,11 @@ The flowchart, recorders, and tests don't change between dev and prod.
|
|
|
700
667
|
|
|
701
668
|
## What ships today
|
|
702
669
|
|
|
670
|
+
<details>
|
|
671
|
+
<summary><b>Full capability list</b> — core · 7 providers · memory + adapters · operability · debugging & compliance · tooling</summary>
|
|
672
|
+
|
|
673
|
+
<br/>
|
|
674
|
+
|
|
703
675
|
**Core**
|
|
704
676
|
- 2 primitives — `LLMCall`, `Agent` (the ReAct loop)
|
|
705
677
|
- 4 control flows — `Sequence`, `Parallel`, `Conditional`, `Loop`
|
|
@@ -743,6 +715,8 @@ The flowchart, recorders, and tests don't change between dev and prod.
|
|
|
743
715
|
- **Lens** · **Explainable Trace** — two visual replays of the causal trace (separate `agentfootprint-lens` package)
|
|
744
716
|
- AI-coding-tool support — Claude Code · Cursor · Windsurf · Cline · Kiro · Copilot
|
|
745
717
|
|
|
718
|
+
</details>
|
|
719
|
+
|
|
746
720
|
> 📖 [Agent API reference](https://footprintjs.github.io/agentfootprint/api/agent/) · [CHANGELOG](./CHANGELOG.md)
|
|
747
721
|
|
|
748
722
|
---
|
|
@@ -211,6 +211,17 @@ const causal = defineMemory({
|
|
|
211
211
|
|
|
212
212
|
agent.memory(shortTerm).memory(facts).memory(causal);
|
|
213
213
|
|
|
214
|
+
// `.selfExplain()` — the IN-CONVERSATION cousin of Causal: the agent answers a
|
|
215
|
+
// follow-up "why did you do that?" about its OWN previous completed run, no store
|
|
216
|
+
// needed. One builder call mounts a skill; the 5 trace tools (run_overview/
|
|
217
|
+
// trace_node/who_wrote/get_value/trace_slice) appear ONLY on the iteration the user
|
|
218
|
+
// asks "why", bound to the last completed run (never in-flight; a failed run still
|
|
219
|
+
// explains). delegate:{provider,model} runs the trace-walk on a cheaper model.
|
|
220
|
+
// Needs reactMode 'dynamic' (default). Causal = ANY past run, persisted, by similarity;
|
|
221
|
+
// selfExplain = THIS conversation's last run, in-memory. (Causal similarity recall
|
|
222
|
+
// needs a search()-capable store — only InMemoryStore today.) Docs: debug/self-explain.
|
|
223
|
+
Agent.create({ provider, model }).system('...').tool(lookupOrder).selfExplain().build();
|
|
224
|
+
|
|
214
225
|
// Multi-tenant identity — plumbs through agent.run:
|
|
215
226
|
await agent.run({
|
|
216
227
|
message: '...',
|
|
@@ -177,7 +177,7 @@ const AZURE_BROWSER_SHORTHANDS = new Set([
|
|
|
177
177
|
* proxy) or a backend. Same trade-off as `browserOpenai`.
|
|
178
178
|
*
|
|
179
179
|
* @example
|
|
180
|
-
* import { browserAzureOpenai } from 'agentfootprint';
|
|
180
|
+
* import { browserAzureOpenai } from 'agentfootprint/llm-providers';
|
|
181
181
|
* const provider = browserAzureOpenai({
|
|
182
182
|
* endpoint: 'https://my-co.openai.azure.com',
|
|
183
183
|
* apiKey: userKey, apiVersion: '2024-12-01-preview', deployment: 'gpt-4o-128k',
|
|
@@ -157,7 +157,8 @@ exports.MockProvider = MockProvider;
|
|
|
157
157
|
* `new MockProvider(options)`.
|
|
158
158
|
*
|
|
159
159
|
* @example
|
|
160
|
-
* import { Agent,
|
|
160
|
+
* import { Agent, defineTool } from 'agentfootprint'
|
|
161
|
+
import { mock } from 'agentfootprint/llm-providers';
|
|
161
162
|
*
|
|
162
163
|
* const agent = Agent.create({ provider: mock({ reply: 'hello' }) })
|
|
163
164
|
* .tool(defineTool({ name: 'echo', ... }))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MockProvider.js","sourceRoot":"","sources":["../../../src/adapters/llm/MockProvider.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AAiFH,MAAa,YAAY;IACd,IAAI,CAAS;IACL,KAAK,CAAU;IACf,OAAO,CAAwB;IACxC,aAAa,GAAG,CAAC,CAAC;IACT,OAAO,CAAqD;IAC5D,UAAU,CAAY;IACtB,YAAY,CAAY;IACxB,UAAU,CAAS;IACnB,aAAa,CAA+B;IAE7D,YAAY,UAA+B,EAAE;QAC3C,I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ACjB,kEAAkE;YAClE,2DAA2D;YAC3D,oEAAoE;YACpE,MAAM,CAAC,MAAO,CAAC,MAAM,IAAI,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QACjD,CAAC,CAAC;QACF,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC;AAED;2EAC2E;AAC3E,SAAS,aAAa,CAAC,OAAe;IACpC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACpC,mEAAmE;IACnE,mDAAmD;IACnD,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC;QAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5D,uDAAuD;IACvD,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,aAAa,GAAG,CAAC;QAAE,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC;IACpE,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,aAAa,CAAC,QAAgC;IACrD,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,KAAK,MAAM,CAAC,IAAI,QAAQ;QAAE,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IAChD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/**
|
|
18
|
+
* agentfootprint/debug/finders — context-error finder strategies.
|
|
19
|
+
*
|
|
20
|
+
* Collapsed home for what was the 3-level-deep
|
|
21
|
+
* `agentfootprint/observability/contextError/finders` path. Same
|
|
22
|
+
* tree-shakeable, re-export-only barrel — one finder = one file = one
|
|
23
|
+
* named export — now under the Debug category where it belongs.
|
|
24
|
+
*
|
|
25
|
+
* The old `agentfootprint/observability/contextError/finders` path is kept
|
|
26
|
+
* (deprecated) for one transition version.
|
|
27
|
+
*/
|
|
28
|
+
__exportStar(require("../observability/contextError/finders/index.js"), exports);
|
|
29
|
+
//# sourceMappingURL=finders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finders.js","sourceRoot":"","sources":["../../src/debug/finders.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,iFAA+D"}
|