arXiv(opens in a new tab)cs.CRSep 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2609.10416

TrajMark: Ownership Attribution and Segment-Level Tamper Localization for Coding-Agent Trajectories

Bokang Zeng, Zheng Gao, Xiaoyu Li, Xiaoyan Feng, Jiaojiao Jiang

Bokang Zeng

School of Computer Science

and Engineering

University of New South Wales

Sydney, Australia

bokang.zeng@student.unsw.edu.au

Zheng Gao

School of Computer Science

and Engineering

University of New South Wales

Sydney, Australia

zheng.gao1@unsw.edu.au

Xiaoyu Li

School of Computer Science

and Engineering

University of New South Wales

Sydney, Australia

xiaoyu.li2@unsw.edu.au

Xiaoyan Feng

School of Information and

Communication Technology

Griffith University

Brisbane, Australia

xiaoyan.feng@griffithuni.edu.au

Jiaojiao Jiang

School of Computer Science

and Engineering

University of New South Wales

Sydney, Australia

jiaojiao.jiang@unsw.edu.au

ABSTRACT

Watermarking the final patch produced by a coding agent provides provenance evidence for the submitted artifact, but does not authenticate the visible process that produced it. Recent behavioral watermarking methods extend provenance to agent trajectories by embedding ownership evidence into observable actions. However, these methods primarily provide a global detection or identifier-recovery signal, so a locally edited trajectory may retain sufficient ownership evidence without revealing which protected region has become inconsistent. To address this limitation, we propose TrajMark, a training-free, symmetric-key, visible-only trajectory watermarking framework that separates robust ownership attribution from fragile local integrity verification. Our framework consists of two complementary layers: a sparse owner layer that encodes a six-bit deployment identifier by rewriting a keyed subset of naturally occurring READ actions into masked linear equations, and a localization layer that inserts linked Q12 ordinary, group, and terminal seals to commit to protected critical-action segments. This separation allows ownership evidence to accumulate robustly across trajectories, while local modifications perturb nearby keyed commitments and expose the affected protocol region. We further provide a design-level analysis of owner recoverability, integrity collision probability, structural overhead, and localization behavior. Across three coding-agent frameworks and three LLMs, TrajMark recovers the exact owner in all evaluated clean full-watermark batches. Under exhaustive eligible single-site attacks it detects 95.5%–100% of edits, and under random single-action corruption it localizes 95.8% of modified sites to an accepted protocol region rather than to the individual action. Owner marking adds no trajectory actions; the integrity layer adds explicit read-only seals, and matched Pass@1 is 26.9% versus 26.3% for unwatermarked runs. Overall, TrajMark preserves robust batch-level ownership evidence while providing segment-level tamper detection and localization.

Keywords coding agents, behavioral watermarking, provenance, ownership attribution, tamper detection, trajectory localization

1 Introduction

Coding agents [1, 2] are increasingly used for software-engineering tasks such as automated bug fixing, test generation, and repository maintenance. Unlike conventional code-generation systems, a coding-agent run produces more than a final patch: it leaves a visible trajectory, an ordered record of observable actions including repository exploration, search, file reads, edits, test executions, reproductions, and final submission. As such trajectories are increasingly retained or released for auditing and provenance, two questions become fundamental: who produced the trajectory, and whether the released trajectory has been modified after generation. Reliable provenance therefore requires protecting not only the final software artifact, but also the visible process that produced it.

Existing watermarking mechanisms primarily protect generated content rather than the underlying execution process. Token-level watermarks embed provenance signals into generated text [3, 4], code watermarks modify source-code structure or lexical choices [5], and cryptographic signatures can authenticate a submitted patch. These approaches provide evidence about what was produced, but not about how it was produced. The same patch may arise from substantially different debugging trajectories, while a released action record may be selectively rewritten without changing the final patch. Consequently, artifact-level provenance alone cannot authenticate the visible development process.

Behavioral watermarking for agents takes an important step toward process-level provenance by embedding ownership evidence directly into agent actions. AgentMark and AGENTWM encode identifiers through behavioral or tool-execution choices [6, 7]; ActHook studies keyed hook behavior in agent trajectories [8]; and SeqWM introduces sequential transition patterns designed to retain watermark detection under trajectory corruption [9]. These methods demonstrate that an agent's behavior, rather than only its textual output, can serve as a watermark carrier. However, their verification signals are primarily global: they determine whether a trajectory or collection of trajectories carries a watermark, or recover an embedded identifier. A global ownership signal may therefore remain detectable even after part of the released trajectory has been rewritten, without revealing which protected region has become inconsistent.

This limitation exposes a more fundamental tension in trajectory provenance: ownership and integrity require different evidence structures. Ownership evidence should be robust: it should accumulate across naturally varying trajectories and remain recoverable when individual actions are missing, altered, or provide limited evidence. Tamper-localization evidence should instead be fragile: modifying a protected region should disturb a nearby commitment and thereby reveal where the inconsistency occurred. Attempting to use a single global watermark signal for both objectives conflates these opposing requirements.

Our key observation is therefore that trajectory provenance should not be represented by a single homogeneous watermark channel. Instead, robust ownership attribution and fragile local integrity should be treated as complementary but explicitly separated protocol layers. Under such a design, ownership evidence can remain stable under partial corruption, while local edits deliberately disrupt region-specific commitments. This separation allows a verifier to retain confidence about whose trajectory collection it is while simultaneously identifying where an individual released trajectory has become inconsistent.

Motivated by this principle, we propose TrajMark, a training-free, visible-only trajectory-watermarking framework for coding agents. TrajMark operates on a public canonical projection of observable actions rather than assuming access to the complete semantics or hidden state of an execution. Its owner layer embeds a six-bit deployment identifier into a keyed subset of naturally occurring READ actions. Letting the deployment identifier lie in GF(2)⁶, each selected normalized filename contributes a masked linear equation over GF(2) with a nonzero coefficient row. The equation is encoded by rewriting only the READ subtype while preserving its semantic family and file target. Because these carriers reuse actions that the agent already intended to execute, owner-only mode introduces no additional trajectory steps, while sparse equations can be aggregated across multiple trajectories for batch-level identifier recovery.

In parallel, the integrity and localization layer introduces deliberately fragile commitments around critical portions of the visible trajectory. TrajMark partitions the canonical action stream into protected segments and emits linked Q12 ordinary seals at eligible critical-segment boundaries. Pairs of ordinary seals are protected by group commitments, and a terminal seal closes the remaining suffix and observed seal sequence. Consequently, an eligible modification to a protected segment changes the inputs to one or more nearby keyed commitments, which can cause the corresponding ordinary, group, or terminal replay check to become inconsistent. The two layers thus serve complementary purposes: ownership evidence is sparse and redundant across trajectories, whereas integrity evidence is intentionally sensitive to local structural changes.

Verification requires only the published visible trajectory, a secret key, and public canonicalization rules. It does not rely on model logits, hidden reasoning, private wrapper metadata, authenticated side information, or access to the original execution environment. The verifier reconstructs the ownership equations from visible READ actions and independently replays the ordinary, group, and terminal seal protocol. It therefore produces two distinct outputs: a batch-level deployment-identifier decision and trajectory-level alarms identifying the protected segment, segment pair, or suffix whose keyed replay has become inconsistent. Importantly, TrajMark authenticates this public canonical projection rather than claiming to reconstruct deleted content or certify the complete semantics of an execution.

We implement TrajMark across three independently engineered coding-agent frameworks and evaluate it with three LLMs. Across all 27 evaluated full-watermark agent–provider–seed groups, the visible-only decoder recovers the exact embedded six-bit identifier. Under exhaustive eligible single-site attacks, TrajMark detects 95.5%–100% of edits across the nine agent–LLM conditions; for random one-action payload corruption, accepted localization covers 95.8% of eligible modified sites, while matched Pass@1 reaches 26.9% versus 26.3% without watermarking. These results demonstrate that robust ownership attribution and fragile local integrity can coexist within the same visible coding-agent trajectory without requiring model retraining or hidden verifier inputs.

We summarize our contributions as follows:

  • Problem and design principle. We formulate coding-agent trajectory provenance over a public canonical projection of released action records and identify the fundamental distinction between robust batch-level ownership attribution and fragile trajectory-level integrity.
  • Framework. We propose TrajMark, a training-free, visible-only framework that combines sparse filename-indexed linear ownership equations over natural READ actions with linked Q12 ordinary, group, and terminal commitments. This two-layer design enables batch-level owner recovery together with protocol-level tamper localization.
  • Analysis and empirical evaluation. We provide a design-level analysis of owner recoverability, integrity collision behavior, structural overhead, and localization, and conduct an extensive evaluation across three coding-agent frameworks and three LLMs, covering exact identifier recovery, random trajectory corruption, exhaustive single-site tampering, protocol-unit localization, structural cost, and repository-level task performance.

References (54)