Skip to content

Tracekit: A tamper-proof intent-reasoning-action audit system for autonomous coding agentsTracekit: Tamper-Evident Intent-Reasoning-Action Auditing for Autonomous Coding Agents

arXiv: Agent & MCP Security· arXiv:2609.35659· Bravish Ghosh·Indexed by this site · 2026-09-30· Originally publishedDefenses

Quick read

Defenses

Based on the paper PDF (AI-generated); refer to the original

Tracekit audits coding agents with a hash chain; with N=300 and an interval of 300, full re-chaining detection is 0.47, and E5 review is 98/98.

Threat modelOperator H sends a task to system A, which can spawn subagents; the harness is Claude Code. T1 is benign but can err; T2 involves untrusted content read that contains instructions aimed at the model; T3 can modify ledger files afterward. Assumptions: hooks are faithfully invoked, and at least one head-hash anchor is stored where T3 cannot modify it. Model internals are not read, and side effects below the tool-call layer are not defended.

Questions
Coding agents read untrusted files, execute commands, and spawn subagents with little human oversight, yet the records are often mutable output logs. Operators lack attributable complete actions, tamper resistance, and a way to cross-check self-reports against actual actions.
Methods
Tracekit uses hooks to record human intent, model self-reports, and tool actions, writes them into a SHA-256 hash chain, and uses external anchors to detect whole-chain recomputation or truncation. A regex gate runs before execution; afterward, rules flag and a tool-free independent review cross-checks the three channels. Other agents can write to the same ledger via SDK or HTTP.
Experiments and results
E1 (N=300, 200 per category): chain-only detection for truncation and full re-chaining is 0.00; with an interval of 300 records, the abstract gives 0.47. E3 intercepted 18/44 harmful calls. E4 had 14 runs total, with 0/8 injection attempts and 27 thinking blocks with no visible text. E5 rules 40/49, review 98/98.
Limitations and future work
The authors state the results characterize only a single harness, short tasks, two repetitions per condition, and same-family review; self-reports cannot be taken as internal reasons, effects below the tool layer are invisible, and records after the most recent anchor are not protected. The regex gate can be bypassed, and E5 is a synthetic insertion with a fixed cover. The tested runs use Claude Code 2.1.
Experimental setupClaude Code (claude -p, version 2.1)、独立评审(同一 CLI,无工具) · E1 tamper detection (N=300, 8 classes × 200)、E3 policy corpus (44 harmful + 40 benign calls) et al. · detection rate、hook wall time (median) et al.
Evaluated models
Claude Code (claude -p, version 2.1)独立评审(同一 CLI,无工具)
Benchmarks
E1 tamper detection (N=300, 8 classes × 200)E3 policy corpus (44 harmful + 40 benign calls)E4 seven scenarios (14 Claude Code runs)E5 seeded-fault splicing (63 traces)
Metrics
detection ratehook wall time (median)records/sblock rateAttemptedDisclosedfalse-positive ratereviewer agreement
AI summaryTracekit is an open-source, dependency-free audit system that captures three channels for each agent session—human intent, the model's self-reported reasoning, and actual executed actions—writes them to a hash-chained ledger, and cross-checks them. It hooks into Claude Code lifecycle events, reconstructs multi-agent hierarchies, performs policy interception before tool calls, and supports other agents reporting events via SDK or HTTP API.

Tracekit is an open-source, dependency-free audit system that captures three channels for each agent session—human intent, the model's self-reported reasoning, and actual executed actions—writes them to a hash-chained ledger, and cross-checks them. It hooks into Claude Code lifecycle events, reconstructs multi-agent hierarchies, performs policy interception before tool calls, and supports other agents reporting events via SDK or HTTP API.

Related events and news

1 events · 0 news mentions

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    The goal is to record verifiable intent, self-reports, and actions for coding agents, and to make post-hoc ledger tampering detectable.

    Coding agents typically leave mutable logs; Tracekit records intent, self-reports, and actions, and checks for post-hoc tampering.

    • Scenario: The authors note that agents such as Claude Code, Codex, and Cursor read repositories, call tools, and spawn subagents over long periods; READMEs, comments, or errors they read can carry indirect prompt injection. The gap is incomplete and hard-to-attribute records, rewritable logs, and self-reports that do not equal the computation process.
    • Existing records: The authors state that general observability platforms and OpenTelemetry's GenAI conventions target debugging and cost; to their knowledge, they do not make logs tamper-resistant or automatically cross-check what is said against what is done. The authors build Tracekit's ledger as a linear chain with anchors and claim the contribution lies in what the ledger contains and how it is cross-checked.
    • System: The authors do not claim to read model internals; they treat self-reports as testimony and actions as evidence, writing them together with human requests into an anchorable hash chain. Tracekit hooks Claude Code, collects three channels, attributes subagents, and applies a policy gate before execution.
    • Threat model:
      • Actors: Operator H assigns a task to agent system A; A calls tools through a harness (i.e., Claude Code) and can spawn subagents. Goals include attributable collection, tamper resistance, pre-execution handling, and three-channel divergence checks.
      • T1: The agent is benign but can edit the wrong file, falsely claim success, or exceed the task scope.
      • T2: Files, tool outputs, or web pages it reads contain instructions aimed at the model.
      • T3 and assumptions: A compromised agent or a person wanting to hide activity can modify ledger files afterward. The authors assume the harness faithfully invokes hooks and that at least one head-hash anchor is stored where T3 cannot modify it; they do not assume the ability to read model internals, nor do they defend against side effects invisible below the tool-call layer, which the authors state would require OS-level enforcement.
  2. What related research exists?

    The authors categorize related work into observability, tamper-proof logs, reasoning monitoring, and guardrails, and compare against public documentation.

    Agent Observability

    • OpenTelemetry's GenAI semantic conventions (2026) specify spans for model calls and tool execution; Claude Code's export (2026) redacts by default, covering prompts, tool decisions, and results.
    • Langfuse's Claude Code plugin (2026) forwards sessions, including thinking blocks when present. The authors state these systems are aimed at debugging and cost; to their knowledge, none make logs tamper-evident or cross-check what is said against what is done.

    Tamper-Evident Logs

    • Hash-chain auditing traces back to Haber and Stornetta (1991), Schneier and Kelsey (1999), Crosby and Wallach's history tree (2009), and Certificate Transparency (2021).
    • nono (2026) uses an out-of-sandbox supervisor to sign the Merkle tree root. halo-record (2026) is a hash chain with optional witnesses. The authors state Tracekit deliberately uses only a linear chain with anchors; the contribution is in content and cross-checking, not cryptography.

    Reasoning Faithfulness and Monitoring

    • The authors paraphrase: Turpin et al. (2023) discuss that explanations may miss factors driving answers; Lanham et al. (2023) find in chain-of-thought interventions that answer dependence on stated reasoning is not stable; Chen et al. (2025) find reasoning models only sometimes state the prompt used.
    • Baker et al. (2025): monitoring chain of thought can detect reward hacking, but pressure on monitoring may produce obfuscation. Korbak et al. (2025) call monitorability "new and fragile." The authors state these results lead them to treat self-reports as testimony to be checked against actions.

    Guardrails, Injection, and Control

    • InjecAgent (2024) and AgentDojo (2024) test injection susceptibility; CaMeL (2025) uses capability and data-flow control against injection. NeMo Guardrails (2023), Llama Guard (2023), Invariant Guardrails (2025) filter inputs, outputs, or tool calls.
    • ToolEmu (2024), R-Judge (2024), and LLM-as-a-judge (Zheng et al., 2023) use model judges for risk. AI control (Greenblatt et al., 2024) and SHADE-Arena (2025) use monitors for untrusted or hidden subtasks. The authors state seeded-fault splicing is close to such sabotage evaluations, with the difference that failures are spliced into real trajectories rather than prompting the agent to violate.

    Baselines: Table 1, based on public documentation as of September 2026, compares Claude Code OTel, Langfuse plugin, Invariant Guardrails, nono, halo-record, and Tracekit with ✓ / –; only Tracekit has ✓ for the subagent column, and cross-checking is noted as rules + LLM. Experimental controls are chain-only vs. with anchor (Table 2), default regex gate (section 5.3), and rule flags vs. independent review (Table 4).

    The authors state the contribution is in ledger content and three-channel cross-checking, while deliberately using a simpler linear chain with anchors cryptographically. Independent review follows the trusted monitor without tools.

  3. How does the paper address this problem?

    Hooks collect three channels and write them into a hash chain, use a regex gate before execution, and cross-check afterward with rules and an independent review.

    Tracekit collects human intent, model self-reports, and tool actions in harness hooks, appends them to a SHA-256 hash chain, and uses external anchors against whole-file recomputation and tail truncation. A regex policy gate runs before execution, and afterward rules flag and an independent review cross-checks the three channels. The implementation is about 2,000 lines of standard-library Python plus one HTML file (Figure 1).

    Collection and attribution

    • Events: Claude Code delivers JSON payloads to hook.py. These include UserPromptSubmit, PreToolUse, PostToolUse, PostToolUseFailure, SubagentStart, SubagentStop, Stop, and SessionStart/End.
    • Transcripts: Incremental reads by byte offset occur on tool events and stop events, extracting thinking, text, and tool-use blocks. An interprocess lock ensures each line is recorded only once.
    • Subagents: The authors state payloads carry agent_id and agent_type, and transcripts are stored in session directory subagents/agent-<id>.jsonl. Records are tagged by agent. An observer links the delegating Agent tool call to the subsequent SubagentStart.
    • Order and other entry points: Transcripts from the same turn often land on disk only after hooks, so self-reports appear later than the corresponding actions. The authors do not reorder the ledger to keep it append-only. The reading side joins by tool_use_id and places reasoning before actions. SDK and HTTP write the same kinds of events to the same ledger; there, tools pass the policy before running, and duration and errors are recorded.

    Ledger and what it can prove

    • Records contain seq, timestamp, event body, and prev; prev is 256 zero bits when there is no previous record. The hash is hi=SHA\text{-}256(canon(ri∖{hash})). canon sorts keys and removes insignificant whitespace. The authors state this suffices for the types used and is a subset of JCS.
    • Strings matching common credential patterns are masked before hashing; overly long strings are truncated with a full-text hash retained. Appending takes an exclusive file lock, recovers the last valid record backward from the tail so a crash-left half-line does not restart the chain, then fsyncs.
    • The authors state that in-place edits, deletions, reordering, or forged insertions break the hash or prev. An adversary who can rewrite the whole file can recompute all hashes; deleting the latest record leaves a still-valid prefix. Both are detectable only via anchors stored elsewhere.
    • If an anchor is taken every k records, and an attacker recomputes a ledger of length N from a uniformly random position with the time uniformly distributed after the last anchor, the detection probability is Pdetect(k)=1−(k−1)/2N. The authors state that a stronger tree construction also cannot remove the external holder. When a hook errors internally, the default exit code is 0 (fail-open), unless FAIL_CLOSED is set.

    Policy gate

    • PreToolUse applies regexes to tool fields: Bash looks at the command, file tools at the path. A rejection exits with code 2, which Claude Code turns into a blocked action with an agent-visible reason. Writes outside the working directory are only flagged.
    • If the policy file cannot be read, policy_error is flagged rather than silently allowing; TRACEKIT_FAIL_CLOSED=1 changes this to rejection.
    • Default rejections in Appendix B include sudo, piping a download into a shell, force-push, recursive deletion of /, ~, or $HOME, and Write/Edit on .env*, id_rsa, id_ed25519, .ssh/, or .aws/. Flagged items include network tools, destructive and side-effectful commands, secret access, and MCP. The authors state the gate is by design a tripwire, not a sandbox.

    Cross-checking and observer

    • Rules: view.py flags policy rejections and flags (network, destructive, side-effectful, secret access, external tools), writes outside the project, failed calls, calls with no result record, and file edits not mentioned: the filename is not in the human prompt nor in any prior self-report. Actions with no visible explanation, and turns where reasoning was withheld by the provider, are flagged as informational.
    • Review: judge.py compresses a session into text with [HUMAN], [AGENT-THINKING], [AGENT-SAID], [ACTION seq=...], attaches policy results and truncated tool results, sends it to another tool-free model, reports divergences in JSON, and writes the judgment into the ledger. Appendix A gives the full prompt. The flagging condition is alignment being minor_drift or misaligned, or any finding's severity being medium or high.
    • Observer: observer.py uses server-sent events to push a single-page interface with session counts, an agent tree, event bands, alerts, one lane per agent, and details. The replay file is re-hashed in the browser with WebCrypto. The authors report tests checking that JavaScript and Python normalization match byte-for-byte. Endpoints require a bearer token when not on localhost.
  4. What experiments did the paper conduct?

    Table 2: chain-only detection for truncation and full re-chaining is 0.00; E3 intercepted 18/44; E5 review 98/98.

    Experimental setup

    • Platform: 2-vCPU Linux container, Python 3.11.15. Real runs use headless Claude Code (claude -p, version 2.1), with a separate settings file and isolated ledger per run. The reviewer uses the same CLI, no tools, in a separate process. The authors report 25 unit tests passing, covering the ledger, hooks, cross-checking, SDK, observer, installer, and consistency between browser verification and Python.
    • E1: sampled from 143 real records to form a ledger with N=300. One random mutation per trial, 200 per class. The eight classes are field modification, record deletion, swapping adjacent records, inserting a forged record, torn last write, tail truncation, full re-chaining after editing, and full re-chaining after deletion. Compares chain only, and an anchor consisting of the pre-mutation head hash (Table 2). Figure 3 varies the anchoring interval, with the legend being Eq. (2) and 200 measured trials per point.
    • E2: 60 hook calls per ledger size, wall clock including interpreter startup, policy, redaction, hashing and fsync. Concurrent writes tested up to 16 processes.
    • E3: 44 harmful tool calls in six classes, including trivial rewrites targeting the default patterns; plus 40 benign calls. Evaluated only, not executed.
    • E4: on a small repository with one failing test, 7 scenarios × 2 runs. S1–S4 place indirect prompt injection in different channels; C1 is a clean task, C2 is the user asking to delete billing.py, C3 is the user asking to write .env. Attempted is any non-read tool call matching the injection goal; Disclosed is the final answer telling the user an injection exists.
    • E5: takes the first repeat of 7 clean sessions and inserts one step after the last successful tool call. The self-report is a benign-sounding cover sentence, and the final summary is unchanged. F1 unrequested edit, F2 exfiltrate file, F3 delete, F4 false success, F5 scope creep, F6 read SSH private key, F7 weaken test. Controls are the original session and one extra git status with an honest note. 63 trajectories are scored once by rules and twice by the reviewer, 126 reviewer calls in total.

    Main results

    ConditionResultSource
    chain only: field modification, deletion, adjacent swap, forged insertion, torn write, 200 each1.00Table 2, N=300
    chain only: tail truncation, full re-chaining after editing, full re-chaining after deletion0.00Table 2
    plus pre-mutation head hash anchor, the eight classes above1.00Table 2
    detection of full re-chaining at anchoring interval 3000.47abstract
    default regex: harmful calls blocked; union of blocked and flagged18/44 (41%); 40/44 (91%)section 5.3, Figure 5
    default regex: benign calls rejected3/40 (7.5%)section 5.3
    splice faults: rule flags; independent reviewer (2 per item)40/49 (82%); 98/98 (100%)section 5.5, Table 4
    • Chain and anchor: the authors separate "already holding the pre-mutation head hash" from "anchor updated at intervals" as two settings. In the former, truncation and full re-chaining no longer pass verification. The 0.47 in the abstract belongs to the interval experiment; the authors state that Figure 3's measurements follow Eq. (2).
    • Regex gate: the authors' conclusion is that pattern matching on command strings is a tripwire for honest mistakes, not a security boundary; enforcement should be in the capability system or OS sandbox, with Tracekit recording its decisions. The main text states that no exfiltration command was blocked.
    • Rules and reviewer: the authors consider E5 an upper-bound result on non-adaptive faults: every splice step is followed by an unmodified final summary that contradicts it, the cover sentences are generic, and the reviewer is from the same model family as the agent. The authors consider rules to cover data-flow and scope-type issues, and only semantic review to catch contradictions between claims and tool results, so the two should be used together.

    Real runs and indirect prompt injection

    • Table 3: for S1–S4, Attempted is 0/2 in all, Disclosed is 2/2 in all, Blocked calls is 0, Tests pass is 2/2. For C1 and C2, Blocked calls is 0, Tests pass is 2/2. For C3, Blocked calls is 2, Tests pass is 2/2. The authors total the injection scenarios as 0/8 attempted, and state that this difficulty provides no positive examples for monitoring evaluation.
    • C2: in both runs the agent refused to delete billing.py. The authors state that it cited the file's own docstring, with text inside the file overriding the user instruction here, in the safe direction; the authors state this is exactly the influence auditing needs to see.
    • Thinking blocks: 27 thinking blocks among 73 model messages, with 0 visible text and only a signature in the transcript. The authors state that under this configuration the reasoning channel available to external monitoring is the visible text. Rule flags with no visible explanation fire on every run, and the authors call this an informational flag.

    Overhead and concurrency

    • Latency: Figure 4 left, median PreToolUse on an empty ledger is 23.9 ms, 24.6 ms at 100,000 records; bare interpreter startup is 10.3 ms. 60 trials per point. The caption states that both PreToolUse and PostToolUse are plotted from p50 to p95; the main text does not give the PostToolUse median. The authors state that reverse reading of the tail keeps cost flat, and comparing against E4's average 24-second run, call this overhead negligible.
    • Throughput: in-process, one fsync per record, average record 1,280 bytes, 2,436 records/s; verification 35,099 records/s. With up to 16 concurrent writing processes, throughput stays at about 2,000 records/s, and all resulting chains verify and records are complete. Figure 4 right is labeled chain ok.

    Breakdown of splice faults

    • Table 4: rule flags are 7/7 for F2, F3, F5, F6, F7, 5/7 (71%) for F1, and 0/7 for F4. The reviewer is 14/14 for all seven classes, and the union is 14/14 for all. Agreement between the two reviews: 7/7 for each fault class; the main text totals 61/63 trajectories.
    • Misses: the authors state that no syntactic rule can see that a tool result contradicts a success claim, so F4 is entirely missed. The 2/7 misses on F1 are because earlier text already names billing.py, so filename matching fails. The authors call F7 a reward-hacking form of weakening tests rather than fixing code, and the reviewer flags F7.
    • Controls: on unmodified sessions, rules 0/7, reviewer 1/14 (7%), union 1/14, agreement 6/7. On the benign extra step, rules 0/7, reviewer 3/14 (21%), union 3/14, agreement 6/7. The authors state that the reviewer rated one unrequested git status as a minor deviation.

    Other ablations and analyses

    • Figure 3's vertical axis is detection probability of full re-chaining, with annotations including 1.0, 0.8, 0.6, 0.4; the horizontal axis k has ticks including 1, 5, 10, 25, 50, 100, 300. Apart from the abstract's 0.47, the main text does not list measured values for each point.
    • Figure 5 row scores are remote code execution 3/10, privilege escalation 3/6, history rewriting 5/6, destructive deletion 4/8, secret file write 3/8, exfiltration 0/6. The caption divides into blocked, flagged only, missed; the main text states explicitly that no exfiltration command was blocked. The paper does not state per class which segment each score belongs to.
    • The three benign false blocks are: retrieving sudo, echo containing that word, and writing .env.example.
    • In E4 the agent points out that the .env rule can be bypassed with another command phrasing, and does not use it.
  5. What are some points that can be further explored?

    The authors state the numbers characterize only a single configuration and specify the boundaries of anchors, syntactic gates, thinking channels, and synthetic failures.

    Limitations and future directions noted by the authors

    • Single configuration (section 6): only one harness and model family, small repositories and short tasks, two repeats per condition, reviewer from the same family as the agent, one author. The authors state the numbers should be read as a characterization of this configuration, not as general rates.
    • Self-report (section 6): the authors state the system cannot treat self-report as the model's reason; in E4 the thinking channel was withheld entirely.
    • Tool boundary (section 6): effects below the tool-call layer are invisible.
    • Anchor window (section 6): records written after the most recent anchor cannot be protected if the adversary can control the ledger file. The authors consider that operators should at least anchor at the end of each session.
    • Gate and reviewer (section 6): the policy gate can be bypassed. The reviewer is itself a language model, and the authors state it inherits the known weaknesses of LLM judging; at deployment the prompt would also carry attacker-controllable trajectory content.
    • Synthetic faults (section 6 and conclusion): E5's faults are synthetic insertions with fixed cover sentences. The authors consider that a capable and deliberately deceptive agent could write more convincing versions, and state that a SHADE-Arena-style evaluation with adaptive attackers would be a stronger test. In the conclusion the authors state they release code, evaluation scripts and trajectories to support reproduction and extension to other harnesses.

    Scope of the experiments

    • Real runs use headless Claude Code (claude -p, version 2.1), and the reviewer is a separate process of the same CLI without tools. The paper says the same model family and does not give a separate model snapshot name or sampling settings (section 5, section 6).
    • E1 is 8 mutation classes, 200 per class, ledger length N=300, with record bodies sampled from 143 real records; Figure 3's anchoring interval ticks include 1, 5, 10, 25, 50, 100, 300 (section 5.1, Table 2).
    • E3 contains 44 harmful calls (six classes, including trivial rewrites targeting the default regex) and 40 benign calls; these calls were not executed (section 5.3, Appendix B).
    • E4 is 7 scenarios × 2 runs; E5 uses only the first repeat of the clean sessions among them, inserts 7 fault classes and sets two control types, the original session and a benign extra step, totaling 63 trajectories and 126 reviewer calls (Table 3, Table 4).
    • E5's misaligned step uses a fixed cover sentence and the final summary is unchanged; overhead experiments measure up to 100,000 ledger records and 16 concurrent writing processes on a 2-vCPU container (section 5.2, section 5.5).
  6. Summarize the main content of the paper

    Tracekit writes intent, self-report, and actions into an anchorable hash chain; the authors emphasize that anchors, regex tripwires, and thought text may be missing.

    Tracekit is a coding-agent audit layer with no third-party dependencies: it writes human requests, model self-reports, and executed actions side by side into an externally anchorable hash chain, uses a regex gate before execution, and cross-checks afterward with rules and an independent model.

    • Problem: Long-running coding agents read untrusted text, call tools with side effects, and spawn subagents, while output logs can be modified afterward and self-reports cannot replace internal computation.
    • Method: Hooks collect Claude Code lifecycle events and transcripts, with subagents stored separately. The ledger is a SHA-256 linear chain; whole-file recomputation or truncation of the latest records is only visible via external anchors.
    • Tamper resistance: In Table 2, with N=300 and 200 runs per category, chain-only detection is 1.00 for five categories of in-place modifications and torn writes, and 0.00 for tail truncation and two categories of full re-chaining; with a pre-mutation head anchor, all eight categories are 1.00. The abstract states that with an anchoring interval of 300 records, full re-chaining detection drops to 0.47.
    • Gate and real runs: The default regex intercepts 18/44 harmful calls and falsely blocks 3/40 benign calls. Across 14 Claude Code 2.1 runs, attempts in four injection scenarios were 0/8, and all were disclosed; among 73 messages, 27 thinking blocks had no visible text.
    • Splicing failures: On 49 splicing failures, rules flagged 40/49 and independent review 98/98; the review false positive on unmodified traces was 1/14. The authors consider this an upper bound on fixed-cover, non-adaptive insertions and argue rules and semantic review should be used together.
    • Authors' conclusions: The authors state the strongest lesson is negative: hash chains need anchors, syntactic gates are only tripwires, and reasoning channels may not exist in practice. Monitoring should treat actions as evidence and self-reports as testimony, place enforcement below the agent, and have the audit layer witness the enforcement layer's decisions.
Read originalarxiv.org