Repository navigation
Conversation
Bundle + Package Summary:
|
| Area | Metric | Baseline | Current | Delta |
|---|---|---|---|---|
| Package | Packed tarball | 7.78 MB | 7.79 MB | +4.7 kB |
| Package | Unpacked publish size | 27.33 MB | 27.35 MB | +17.1 kB |
| Package | Installed footprint | 75.65 MB | 75.66 MB | +17.1 kB |
| Package | Published files | 4228 | 4249 | +21 |
| Package | Installed files | 8221 | 8242 | +21 |
| Package | Installed package instances | 34 | 34 | 0 |
| Package | Distinct installed package names | 32 | 32 | 0 |
| Package | Installed dependency edges | 51 | 51 | 0 |
| Package | Installed optional peer edges | 9 | 9 | 0 |
| Runtime | Unique function payloads | 2 | 2 | 0 |
| Runtime | Total function bytes | 20.92 MB | 20.93 MB | +3.8 kB |
| Runtime | Public routes | 18 | 18 | 0 |
Changed function payloads vs infra/compaction-progress (6cd2fd8) (2)
| Function | Status | Baseline | Current | Delta | Route changes |
|---|---|---|---|---|---|
functions/__server.func |
changed | 10.46 MB | 10.46 MB | +1.9 kB |
none |
functions/.well-known/workflow/v1/flow.func |
changed | 10.46 MB | 10.46 MB | +1.9 kB |
none |
eve init install
| Metric | Baseline | Current | Delta |
|---|---|---|---|
| Installed footprint | 114.03 MB | 114.05 MB | +17.1 kB |
| Installed packages | 97 | 97 | 0 |
| dependencies | 4 | 4 | 0 |
| devDependencies | 2 | 2 | 0 |
| Dependency package bytes | 45.73 MB | 45.75 MB | +17.1 kB |
| devDependency package bytes | 5.11 MB | 5.11 MB | 0 B ➖ |
Build Metadata
- Preset:
vercel - Nitro:
nitro@3.0.260903-beta - Output directory:
apps/fixtures/weather-agent/.vercel/output - Build metadata timestamp: 2026-10-26T14:57:34.427Z
- Route aliases: 18 public, 1 internal (19 total aliases)
- Vercel routes in config: 21
- Severity legend: 🔴 dominant/large, 🟠 notable, 🟡 watch, ⚪ small
Package Drill-Down
Package Details
- Package:
eve@0.83.2 - Package directory:
packages/eve - Tarball: 7.79 MB (
eve-0.83.2.tgz) - Unpacked payload: 27.35 MB across 4249 published files
- Installed footprint: 75.66 MB across 8242 installed files
- Installed root package: 27.35 MB
- Installed dependencies: 48.32 MB
- Installed package instances: 34
- Distinct installed package names: 32
- Installed dependency edges: 51
- Installed optional peer edges: 9
- Runtime dependencies: 2
- Peer dependencies: 7 (6 optional)
Installed footprint is measured from an isolated temporary npm install of the packed tarball.
Graph metrics read only package.json files in package directories directly beneath a node_modules boundary, including nested boundaries. Each directory is one package instance; distinct names come from those manifests. Dependency edges count each unique name in dependencies or optionalDependencies per instance; optional peer edges count peerDependencies marked optional.
Heavy installed dependencies
eve: 27.35 MB (36.1%)@rolldown/binding-linux-x64-gnu: 19.89 MB (26.3%)ai: 8.37 MB (11.1%)zod: 6.15 MB (8.1%)undici: 3.58 MB (4.7%)
Publish payload breakdown
Published file size
🟠 dist/src/compiled/shadcn-registry/index.js [#####...................] 3.85 MB 14.1%
🟠 dist/src/compiled/@photon-ai/chat-adapter-ime... [###.....................] 2.29 MB 8.4%
🟠 dist/src/compiled/run/index.js [#.......................] 1.00 MB 3.7%
🟡 dist/src/compiled/@vercel/blob/index.js [#.......................] 604.9 kB 2.2%
🟡 dist/src/compiled/_chunks/workflow/undici-D-I... [#.......................] 521.9 kB 1.9%
🔴 Other published files [########################] 19.08 MB 69.8%
Installed footprint breakdown
Installed package size
🔴 eve [########################] 27.35 MB 36.1%
🔴 @rolldown/binding-linux-x64-gnu [#################.......] 19.89 MB 26.3%
🔴 ai [#######.................] 8.37 MB 11.1%
🔴 zod [#####...................] 6.15 MB 8.1%
🟠 undici [###.....................] 3.58 MB 4.7%
🟠 nitro [##......................] 1.89 MB 2.5%
🔴 Other installed packages [#######.................] 8.43 MB 11.1%
Runtime dependencies (2)
| Package | Range | Notes |
|---|---|---|
nitro |
3.0.260903-beta |
|
undici |
8.10.2 |
Peer dependencies (7)
| Package | Range | Notes |
|---|---|---|
@opentelemetry/api |
^1.0.0 |
optional peer |
ai |
catalog: |
|
braintrust |
^3.0.0 |
optional peer |
chat |
^4.42.0 |
optional peer |
dd-trace |
^6.13.0 |
optional peer |
just-bash |
^3.1.0 |
optional peer |
next |
^16.0.0 |
optional peer |
eve init install drill-down
eve init install details
- Command:
eve init my-agent - Package manager:
npm - Installed footprint: 114.05 MB across 10159 installed files
- Installed packages: 97 total (91 transitive-only)
- dependencies: 4 direct packages totaling 45.75 MB
- devDependencies: 2 direct packages totaling 5.11 MB
- Other transitive package files: 63.18 MB
Installed footprint is measured from an isolated temporary eve init my-agent using the current packed eve tarball.
Heavy installed dependencies
@typescript/typescript-linux-x64: 27.95 MB (24.5%)eve: 27.35 MB (24.0%)@rolldown/binding-linux-x64-gnu: 19.89 MB (17.4%)zod: 9.76 MB (8.6%)ai: 8.37 MB (7.3%)
Installed footprint breakdown
Installed package size
🔴 @typescript/typescript-linux-x64 [########################] 27.95 MB 24.5%
🔴 eve [#######################.] 27.35 MB 24.0%
🔴 @rolldown/binding-linux-x64-gnu [#################.......] 19.89 MB 17.4%
🔴 zod [########................] 9.76 MB 8.6%
🔴 ai [#######.................] 8.37 MB 7.3%
🟠 undici [###.....................] 3.58 MB 3.1%
🔴 Other installed packages [###############.........] 17.16 MB 15.0%
dependencies (4)
| Package | Range | Installed size | Share |
|---|---|---|---|
@vercel/connect |
2.5.2 |
276.3 kB | 0.2% |
ai |
^7.0.137 |
8.37 MB | 7.3% |
eve |
file:eve-0.83.2.tgz |
27.35 MB | 24.0% |
zod |
4.5.4 |
9.76 MB | 8.6% |
devDependencies (2)
| Package | Range | Installed size | Share |
|---|---|---|---|
@types/node |
24.x |
2.61 MB | 2.3% |
typescript |
7.0.2 |
2.50 MB | 2.2% |
Function Drill-Down
Payload Size Graph
Unique function payload size and share of total
🔴 functions/.well-known/workflow/v1/flow.func [########################] 10.46 MB 50.0%
🔴 functions/__server.func [########################] 10.46 MB 50.0%
Top Function Payloads
🟠 functions/.well-known/workflow/v1/flow.func • 1 public route • 10.46 MB
| Metric | Value |
|---|---|
| Public routes | /.well-known/workflow/v1/flow |
| Runtime | nodejs24.x |
| Handler | index.mjs |
| Payload | 10.46 MB |
| Function files | 10.46 MB across 121 files |
| Traced dependencies | 0 B |
| Signal | 🟠 Bundled file _chunks/vercel.web.mjs is 2.49 MB (23.8%) |
🟠 🔎 Dependency Analysis
📦 Bundled files:
Bundled file size
🟠 _chunks/vercel.web.mjs [#############...........] 2.49 MB 23.8%
🟡 _libs/undici.mjs [#####...................] 994.5 kB 9.5%
🟡 _chunks/sandbox2.mjs [####....................] 815.0 kB 7.8%
🟡 _chunks/compiled-artifacts-instrumentation.mjs [####....................] 732.3 kB 7.0%
🟡 _chunks/token-util-Bla5Z0G9.mjs [####....................] 704.5 kB 6.7%
🔴 Other bundled files [########################] 4.72 MB 45.1%
🧾 Vercel Config
{
"handler": "index.mjs",
"launcherType": "Nodejs",
"shouldAddHelpers": false,
"supportsResponseStreaming": true,
"runtime": "nodejs24.x",
"maxDuration": "max",
"experimentalTriggers": [
{
"type": "queue/v2beta",
"topic": "__eve776561746865722d6167656e74_wkf_workflow_*",
"consumer": "default",
"retryAfterSeconds": 5,
"initialDelaySeconds": 0
}
],
"environment": {
"WORKFLOW_PRECONDITION_GUARD": "1"
}
}🟠 functions/__server.func • 17 public routes, 1 internal alias • 10.46 MB
| Metric | Value |
|---|---|
| Public routes | //.well-known/workflow/v1/webhook/[token]/eve/v1/callback/[token]/eve/v1/connections/[name]/callback/[attemptId]/[token]/eve/v1/connections/[name]/callback/[token]/eve/v1/health/eve/v1/info/eve/v1/session/eve/v1/session/[parentSessionId]/subagents/[callId]/[childSessionId]/stream/eve/v1/session/[sessionId]/eve/v1/session/[sessionId]/cancel/eve/v1/session/[sessionId]/clear/eve/v1/session/[sessionId]/compact/eve/v1/session/[sessionId]/reset/eve/v1/session/[sessionId]/stream/eve/v1/session/[sessionId]/stubs/eve/v1/task-input/[token] |
| Internal aliases | /__server |
| Runtime | nodejs24.x |
| Handler | index.mjs |
| Payload | 10.46 MB |
| Function files | 10.46 MB across 121 files |
| Traced dependencies | 0 B |
| Signal | 🟠 Bundled file _chunks/vercel.web.mjs is 2.49 MB (23.8%) |
🟠 🔎 Dependency Analysis
📦 Bundled files:
Bundled file size
🟠 _chunks/vercel.web.mjs [#############...........] 2.49 MB 23.8%
🟡 _libs/undici.mjs [#####...................] 994.5 kB 9.5%
🟡 _chunks/sandbox2.mjs [####....................] 815.0 kB 7.8%
🟡 _chunks/compiled-artifacts-instrumentation.mjs [####....................] 732.3 kB 7.0%
🟡 _chunks/token-util-Bla5Z0G9.mjs [####....................] 704.5 kB 6.7%
🔴 Other bundled files [########################] 4.72 MB 45.1%
🧾 Vercel Config
{
"handler": "index.mjs",
"launcherType": "Nodejs",
"shouldAddHelpers": false,
"supportsResponseStreaming": true,
"runtime": "nodejs24.x"
}Build Timing: e2e/fixtures/agent-tools-sandbox
This is an informational timing measurement inside eve build, from preflight through publication. Output-size measurement and profile writing are excluded.
Build mode: deployable Vercel build with sandbox template prewarm included.
- Build pipeline: 2.50 s -> 2.65 s (+146.0 ms) vs
infra/compaction-progress (6cd2fd8). - Timing is informational: shared GitHub runners are too variable for a hard timing budget.
Detailed phase timings vs `infra/compaction-progress (6cd2fd8)`
| Phase | Baseline | Current | Delta |
|---|---|---|---|
extension.check |
8.0 ms | 0.3 ms | -7.7 ms |
project.resolve |
0.3 ms | 0.2 ms | -0.1 ms |
workspace.create |
0.5 ms | 0.4 ms | -0.1 ms |
host.prepare |
353.3 ms | 389.7 ms | +36.4 ms |
vercel.service-prefix.resolve |
1.0 ms | 1.0 ms | 0.0 ms |
nitro.create |
422.6 ms | 440.3 ms | +17.7 ms |
sandbox.prewarm |
349.6 ms | 414.6 ms | +65.0 ms |
nitro.cache.prepare |
0.2 ms | 0.2 ms | 0.0 ms |
nitro.prepare |
0.5 ms | 0.5 ms | 0.0 ms |
nitro.public-assets |
0.6 ms | 0.6 ms | 0.0 ms |
nitro.prerender |
0.4 ms | 0.3 ms | -0.1 ms |
nitro.bundle |
1.22 s | 1.22 s | +1.9 ms |
nitro.cache.write |
0.2 ms | 0.2 ms | 0.0 ms |
vercel.workflow-function.materialize |
82.5 ms | 119.4 ms | +36.9 ms |
agent-summary.emit |
0.4 ms | 0.5 ms | +0.1 ms |
connect-manifest.emit |
0.2 ms | 0.2 ms | 0.0 ms |
nitro.close |
0.1 ms | 0.1 ms | 0.0 ms |
output.publish |
2.4 ms | 2.3 ms | -0.1 ms |
workspace.remove |
1.5 ms | 1.6 ms | +0.1 ms |
|
The split is right: the core keeps measurement, events, memory, failure and billing, the strategy decides whether to compact and how, and
Checked: 890 unit tests, the discover and step integration tests, |
|
All five points are addressed in a3ea1d3:
The compaction events now carry the configured compaction model id. For AI SDK model objects that's the same Unit tests across harness, compiler, discover and runtime pass, except the network-bound model-catalog test, which fails on the base branch too. The integration tests and the invariant guard pass. Looks good. |
| return { compacted: false, failure, messages: input.messages, session }; | ||
| } | ||
| messages = validateHarnessModelMessages([...canonical.memory, ...compactedOrdinary]); | ||
| messages = validateHarnessModelMessages([...canonical.memory, ...compacted]); | ||
|
|
||
| { |
There was a problem hiding this comment.
A custom strategy's output reaches this validation unchecked, and the validation runs outside the try, so a bad result isn't handled as a compaction failure.
CompactedHistoryis typed as plainModelMessage[], socheckpoint: [{ role: "user", content: "Earlier context: ..." }]type-checks. Here it throwsTypeError: Expected every user-role model message to have a kind.(harness/messages.ts:113-114).eve/compactionexports no way to build a kinded user message, so an author can't write a user-role checkpoint at all, even thoughstrategy.ts:33suggests "a marker".- The throw happens after
summaryUsagehas been folded into the localsession. On the manual path (compactHistory, ~L91-110),step.session = compacted.sessionnever runs, so a summary call that already succeeded is dropped from billing. That contradicts the docs: "Any thrown error fails the compaction the way a failed summary does." The same goes for a throwingshouldCompactat L195. - Nothing checks structure either. An orphan tool result, a tool call with no result, or a history ending on an assistant turn passes this check, gets emitted as
compaction.completed, and is saved. fixed-tail guards against these internally (withResumptionGuard,splitMessagesForCompaction), but custom strategies get no such guard.
Suggested fix: validate inside the try so any bad result becomes failure. Either tag untagged user messages in checkpoint as context.compaction (the way fixed-tail builds its marker), or narrow the public type to messages eve accepts. Also check tool-call/result pairing there, or document it as the strategy's job.
There was a problem hiding this comment.
Fixed in 865ce80: the strategy's result is validated inside the try with the rest of the compaction, so a bad result is reported as a compaction failure and the summary call is still billed. New integration test: a strategy that summarizes then returns a user message without a kind.
| | `shouldCompact(facts)` | Whether the next request needs compacting, from the numbers eve measured. | | ||
| | `compact(history, ctx)` | The messages that replace `history`. | | ||
|
|
||
| `facts` holds `inputTokens`, `requestEnvelopeTokens`, `threshold`, `recentWindowSize` and `reason`. A user-requested compaction (`reason: "manual"`) runs whatever `shouldCompact` returns. `history` is the conversation without memory records; eve places recalled memory ahead of the result, so a strategy never sees or reorders it. A user message you return needs a `kind`; build one with `createCompactionUserMessage(content)` from `eve/compaction`, for example to mark a checkpoint. |
There was a problem hiding this comment.
"runs whatever shouldCompact returns" reads as "runs if shouldCompact says so", but the code does the opposite: force short-circuits and shouldCompact is never called (step.ts:193-195, and the integration test passes shouldCompact: () => false and expects compact to run). Two independent reads of this PR took it the wrong way. Suggest: "A user-requested compaction (reason: \"manual\") calls compact without asking shouldCompact." strategy.ts:16 has the same wording.
There was a problem hiding this comment.
Fixed in 865ce80: the docs now say shouldCompact decides automatic compaction only, and a manual request (reason: "manual") runs compact without calling it.
| async "compaction.completed"() { | ||
| return { messages: [{ content: "PROFILE_VALUE=RECALLED", id: "profile" }] }; |
There was a problem hiding this comment.
compaction.completed returns the same content and id as turn.started, and the core already keeps canonical memory ahead of the strategy's result (step.ts:256-289). So the MEMORY_NOT_RECALLED_ONCE check in agent.ts:14 still passes if compaction-time recall never runs. That means the fixture doesn't prove the "memory still recalled" claim. Return a distinct value here (for example PROFILE_VALUE=RECALLED_AFTER_COMPACTION under the same id), then assert that value is visible and the turn-start value is gone.
There was a problem hiding this comment.
Fixed in 865ce80: the compaction.completed recall now returns its own record (PROFILE_RECALLED_AFTER_COMPACTION=YES, id profile-compaction), and the fixture's verify turn requires exactly one of it. The eval passes locally.
| }) | ||
| .strict(); | ||
|
|
||
| const compiledCompactionDefinitionSchema: z.ZodType<CompiledCompactionDefinition> = z |
There was a problem hiding this comment.
CompiledCompactionDefinition is ModuleSourceRef (L271), and this schema copies moduleSourceRefSchema (L371-378) field for field. Reuse it (compaction: moduleSourceRefSchema.nullable().default(null)) so the two copies can't drift. Also, a top-level compaction resource next to agent.compaction (model/threshold config, L632) is easy to mix up. A name like compactionStrategy would keep the two apart.
There was a problem hiding this comment.
Reused moduleSourceRefSchema and deleted the copy in 865ce80. I kept the top-level compaction name: it matches the other agent-file resources (memory) and renaming it changes the manifest shape for no behavior.
| resolveModel: config.resolveModel, | ||
| runtimeIdentity: config.runtimeIdentity, | ||
| session: step.session, | ||
| strategy: config.compactionStrategy ?? defaultCompactionStrategy, |
There was a problem hiding this comment.
The same config.compactionStrategy ?? defaultCompactionStrategy fallback appears at step.ts:105. maybeCompact is the shared boundary, so apply the default once there (strategy?: CompactionStrategy, defaulting to fixedTail()), or resolve it once when the harness config is built. Then default-strategy.ts, a one-line module, can go, and manual and automatic compaction can't end up with different defaults.
There was a problem hiding this comment.
Fixed in 865ce80: maybeCompact takes an optional strategy and defaults to fixedTail() once. default-strategy.ts is deleted and both call sites pass config.compactionStrategy as is.
|
|
||
| const COMPACTION_STRATEGIES_DIR = "packages/eve/src/harness/compaction/strategies/"; | ||
| const COMPACTION_STRATEGY_INTERNAL_RE = | ||
| /(?:from\s+|import\s*\()["']#harness\/compaction\/strategies\/[^"']+\/(?!index\.js["'])[^"'/]+["']/; |
There was a problem hiding this comment.
Rule 54 only matches #harness/compaction/strategies/... specifiers. A relative deep import like ../compaction/strategies/fixed-tail/engine.js gets past it, and harness code does use relative imports (model-call/call.ts imports ./failure.js). Either resolve the specifier against the importing file before matching, or also match /compaction/strategies/<name>/<not index.js> in relative specifiers.
There was a problem hiding this comment.
Fixed in 865ce80: rule 54 resolves #harness/ and relative specifiers against the importing file before matching, so ../compaction/strategies/fixed-tail/engine.js is flagged. Checked with a temporary file; it is removed.
a3ea1d3 to
865ce80
Compare
f574428 to
11fae60
Compare
9561da7 to
80478c3
Compare
80478c3 to
5ee1f6e
Compare
5ee1f6e to
ea1e943
Compare
0133c6c to
bce36a8
Compare
ea1e943 to
1c62b00
Compare
…rsized message Compaction kept re-triggering on every step when one current message filled the window. It now keeps a fixed-size tail, cuts the middle of an oversized current request, trims tail tool results when a summary runs, summarizes once, counts memory and client context as protected, and fails only when the system prompt, tools, memory and context alone exceed the limit. Signed-off-by: Rui Conti <ruiconti@gmail.com>
bce36a8 to
6cd2fd8
Compare
Adds a CompactionStrategy interface (shouldCompact, compact) with the fixed-tail strategy as the default, so an agent can replace how its history is compacted. The engine's fitting guarantees stay in the harness. Signed-off-by: Rui Conti <ruiconti@gmail.com>
1c62b00 to
6f2d21d
Compare
Compaction pipeline: before and after #5290 + #5332Compares eve In one line: before, one request near the context limit made eve compact on every step and never get under the threshold; after, compaction keeps a small fixed tail, cuts an oversized request in the middle, always fits its own output, and fails only when the system prompt, tools, memory and context alone fill the window. The pipeline now sits behind a The problem it fixesA session whose first user message was 408 KB (~164k provider tokens) compacted before every step and its input grew instead of shrinking: 182.9k, 186.9k, 187.0k ... 188.0k against a 180k threshold, $4.19 over 10 steps before it was killed. Two faults combined:
Before (main)Everything is core; there is no strategy seam. flowchart TD
T["shouldCompact: last provider count + estimate of new messages + prompt overhead > threshold<br/>step.ts:176 / engine.ts:67"] -->|over, or /compact| C
C["Cap older tool results to 2,000 chars, no model call<br/>engine.ts:122"] -->|fits| D[History replaced]
C -->|still over| S["Summarize the older region<br/>engine.ts:219"]
S --> K["Keep recent tail: up to 10 messages filling threshold minus a 2k reserve<br/>engine.ts:442"]
K --> R["Replay last string user message whole, never cut<br/>engine.ts:323"]
R -->|fits| D
R -->|over| X["Text-only tail, then tail - 1 and summarize again<br/>engine.ts:247-256"]
X -->|tail = 0| A["Return the text-only result even if over<br/>engine.ts:252"]
A -->|next step| T
S -. summarizer error .-> F["Error rethrown out of the step; the workflow retries it<br/>run.ts:136, 145"]
After (#5332 head)The core measures, decides when compaction may run, owns events, memory, billing and failure. The default flowchart TD
subgraph core
M["Measure: inputTokens, requestEnvelopeTokens incl. memory + client context, threshold<br/>step.ts:197-211"]
P["Fixed-part check: envelope + memory + context >= threshold -> error<br/>step.ts:57, 287"]
E["Prepend memory records, emit compaction.completed, recall memory<br/>step.ts:300-340"]
F["COMPACTION_FAILED: turn.failed then session.failed, no retry; summary usage kept<br/>failure.ts:207, call.ts:297"]
end
subgraph strategy["fixedTail strategy"]
Q["shouldCompact(args): inputTokens + overhead > threshold<br/>engine.ts:45"]
U["Find latest user request (any shape); over the tail budget -> keep first 20% / last 80%, middle to summarizer<br/>engine.ts:161, 429"]
C["No cut needed and not forced: cap older tool results, accept if fits<br/>engine.ts:179-202"]
S["Cap tool results everywhere incl. tail; floor check; summarize once<br/>engine.ts:206-241"]
K["Kept tail <= min(20k, threshold/2)<br/>engine.ts:642"]
X["Shrink: text-only tail -> no tail -> clip summary -> cut request, files become a note<br/>engine.ts:250-323"]
end
M -->|/compact skips| P
M --> Q -->|true| P --> U --> C
C -->|fits| E
C -->|over| S --> K --> X -->|fits| E
X -. nothing fits .-> F
P -. fixed part too big .-> F
The seam
What changed and why
The 408 KB case, real modelSame recipe both sides: sonnet-5.5, 200k window,
The "after" column was measured on #5290 at |
| import { defineCompaction } from "eve/compaction"; | ||
|
|
||
| export default defineCompaction({ | ||
| shouldCompact: (args) => args.inputTokens > args.threshold, |
There was a problem hiding this comment.
I think should be ctx and we need to make sure the current model is exposed, as well as its context window if available. We can also use this opportunity to not require a context window if we want. right now we fail build without it, maybe that is a good thing im not 100% sure.
| | `shouldCompact(args)` | Whether the next request needs compacting, from the numbers eve measured. | | ||
| | `compact(history, ctx)` | The messages that replace `history`. | | ||
|
|
||
| `args` holds `inputTokens`, `requestEnvelopeTokens`, `threshold`, `recentWindowSize` and `event`, the eve event that prompted the check (today only `{ type: "step.started" }`; new triggers add members). It decides automatic compaction only: a user-requested compaction runs `compact` without calling it, and `ctx.forced` is `true` there. `ctx` carries the same four numbers (no `event`), plus `forced`. `history` is the conversation without memory records; eve places recalled memory ahead of the result, so a strategy never sees or reorders it. A user message you return needs a `kind`; build one with `createCompactionUserMessage(content)` from `eve/compaction`, for example to mark a checkpoint. |
There was a problem hiding this comment.
threshold is very vague to me where does this come from what does it mean
An agent exports a compaction strategy from agent/compaction.ts. The core owns when compaction can run (a fixed 90% overflow guard, or a hook's ctx.compact()) and the events, memory, failure and billing around it; the strategy owns what the compacted history looks like. If a strategy's result is still over the guard, the default fixedTail() runs once on it. Adds ctx.view.context.inputTokens for hooks. Removes compaction.thresholdPercent. Supersedes #5332. Signed-off-by: Rui Conti <ruiconti@gmail.com>
|
Superseded by #5410, which rebuilds the compaction API as an authored strategy with ctx.compact(). |
Makes compaction a strategy an agent can replace. Stacked on #5290; retarget to main after it merges.
CompactionStrategy(shouldCompact(facts),compact(history, ctx)returning{checkpoint, kept}) inharness/compaction/strategy.ts. The core keeps measuring, the requested/completed events, memory capture and recall, failure and billing.compaction/strategies/fixed-tail/and is the default; also exported asfixedTail().agent/compaction.tswithdefineCompactionfromeve/compaction, discovered, compiled and resolved likememory.ts.index.jsmay be imported from outsidecompaction/strategies/.Checks: 883 harness tests, discover/compiler/runtime unchanged apart from 8 failures that also fail on #5290's branch; the three compaction evals pass unchanged; new e2e fixture
agent-compaction-strategy(own strategy, no summary, memory recalled once); real 408 KB run: 183,525 then 56.4k flat vs 56.1k on #5290 (+0.6%).