Manuscript Offprint

arXiv:2609.01466

Parsing the Stream: A Live Trace Model for Long-Horizon Agents and Their Observers

Egor Pakhomov, Erik Nijkamp

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

A long-horizon agent’s trace outgrows both of its consumers: the human observer monitoring the run, and the agent itself, whose bounded context the trace must be folded back into. We present a live trace model, an append-only event ledger folded incrementally into typed run state and compiled into per-consumer views, and evaluate it for both consumers against deterministic ground truth. For the observer side, evaluated with an LLM reader as proxy, the compiled view answers monitoring questions using approximately 14×14\times and 15×15\times fewer input tokens (by reader) and at 5−7×5-7\times lower cost than a budget-capped single-call reading of the raw trace, with higher accuracy (0.85–0.87 versus 0.48). Because the questions were co-designed with the view schema, we treat the token and cost reduction, conditional on schema coverage, as the transferable result. For the agent, on 120-link sequential-dependency tasks, mechanisms that maintain the task’s running statistic in per-step state succeed where full-context prompting fails (30/30 versus 8/30 under a clean protocol, n = 30, labeled descriptive owing to benchmark-system co-development); a prompt-level scratchpad matches the fold’s accuracy at lower cost, and a two-arm decomposition attributes the fold’s accuracy to its deterministic aggregate and its cost advantage to its compactness. The fold’s remaining value over cheaper alternatives is deterministic auditability and serving the observer from the same state. We derive eleven candidate requirements for trace folding from observed failures and delimit them with an order-sensitive task family on which the fold ceases to help. Code, benchmarks, a regenerable synthetic corpus, and all workbench traces are released.

1 Introduction

A long-horizon agent run continuously produces a single artifact: its trace. Two consumers depend on this trace, and both are underserved by its raw form. The human observer needs to determine, mid-run, what the agent is doing, what has settled, and what remains pending; in our corpus, twelve real sessions total 112 MB, and a frontier-tier model reading their raw tails answers basic monitoring questions at 0.479 accuracy while consuming 779K input tokens across the twelve-transcript panel. The agent itself must fold the trace back into a bounded context window; on our sequential-dependency workbench, a full-context worker's cumulative billed input reaches 2.37M tokens at 120 links (per-call context approximately 33K tokens and growing) while its success rate falls to 7/30 under the development-era injected-error schedules (8/30 under the clean protocol of §5.2). The uncached flat arm bills 7.49perrun,whilethecachedconversationalvariantisinexpensive(approximately7.49 per run, while the cached conversational variant is inexpensive (approximately1.06) yet fails entirely (0/10); cost and failure are therefore separate problems, and neither form of full context addresses the latter.

Today these two consumers are served by two separate systems built over the same stream: observability tooling on one side and context management on the other. This paper models the trace once and compiles per-consumer views from a single substrate. The central measured claim is deliberately narrow: on accumulation tasks, a deterministic bounded fold of the trace shows no observed accuracy disadvantage, at the tested sample sizes, against an arm that retains full history alongside the harness-computed aggregate, at roughly one-quarter the cost, and, unlike equally accurate worker-side alternatives, serves a human observer from the same state with an auditable provenance trail.

The live trace model, implemented in tracelab, is a four-layer stack (Figure 1): an append-only ledger of typed events with byte-offset resume; a single-pass fold — the incremental reduction of the event stream into typed state — producing RunState (tools, files, turns, costs, and facts with source-scoped identity and deterministic aggregates); versioned derived nodes with an explicit validity lifecycle and hindsight re-parsing; and per-consumer compiled views, an observer page and a compact worker view, both compiled from the same state. A curator loop refreshes the worker's view from the worker's own recorded trace, so the system observes its own execution through the substrate it serves.

We make the following contributions, each grounded in the measurements that support it:

  1. The architecture: an incremental, resumable, cache-aware parse of an agent's stream, with design rules that each trace back to a measured failure (per-message usage deduplication that prevents up to 3.49×3.49 \times token-accounting inflation, terminal validity states that cannot be reopened, and hindsight re-parsing).

  2. Eleven requirements on the fold, each surfaced by a live failure during a sequential development ladder and pinned by a regression test or confirmation rerun, together with their measured boundary: an order-sensitive task family on which the fold's aggregates do not apply and it ceases to help ( §5.3§5.3).

  3. COMPREHEND, a live-run comprehension benchmark with mechanically generated questions and deterministic grading, whose corpus is fully regenerable from code: a seeded generator rebuilds twelve realistic sessions byte-identically, making the instrument fully auditable without releasing any real data.

  4. CONTINUE, a workbench isolating context policy under matched adversity (pre-committed error schedules, retry/repeat separation, costed protocol failures), with a family of controls comprising a scratchpad, a calculator tool, retrieval, observation masking in the style of [1], summarization in two configurations, and a masked-history-plus-notes hybrid (10/10 at 120 links).

  5. Economics with real accounting: prompt-cache read/write measurements showing that structure, not intent, determines caching behavior, and the parser's own inference budget treated as an experimental variable, with extractor availability as a first-class axis.

Section 2 situates the work; §3–4 describe the model and instruments; §5 reports results; §6 discusses; §7 states limitations; §8 lists artifacts. Appendix A carries the development history; Appendix B, protocol detail; Appendix C, the full cell inventory; Appendix D, cache accounting; Appendix E, COMPREHEND question detail.

References (29)