Agent integration
Once installed (see Getting started), the git-span plugin provides:
- A touch hook — surfaces existing spans after supported reads and writes and repairs mechanically safe positional drift inline.
- Static planning and lifecycle hooks — capture bounded pre-state for supported writes, deduplicate context, warm up the CLI, and clean up session state.
- Three skills —
git-spanfor declaration, inspection, and focused reconciliation;review-notesfor adding and updating spans from commit notes and challenging shared assumptions; andreconcilefor multi-span triage. - An expert subagent where supported — Claude Code, Codex, and OpenCode ship one; Antigravity ships skills and hooks without a separate agent artifact.
The integrations use the same scriptable git span CLI available in a terminal or CI.
Touch hook
The touch pipeline observes supported file-affecting tools: Claude Code covers Read, Edit, Write, and Bash; Codex covers apply_patch and its shell/exec family; OpenCode covers bash, read, edit, write, and apply_patch; Antigravity covers run_command.
When a supported range intersects an existing anchor, the hook repairs verified exact-content relocations and emits a short notice wrapped in <git-span> tags. Initial clean touches identify the touched path and relevant spans; reads encountering drift identify the drifting anchors, reasons and span names. Writes use “Change introduced drift from” with the same evidence. Whole-file anchors remain bare paths. Whitespace edits and fuzzy candidates remain review obligations; matching anchors, hash refreshes and zero drift do not establish correctness.
Clean notices and write-drift notices recommend git span list <names>; read-drift notices recommend git span drift <names>. Each command's guidance appears once per session across paths, spans, repositories and recipients. Later notices retain their wrapper and substantive line. Broad reads use the same short notices and record delivery. Output omits trees, explanations, read-extent qualifications, incomplete-details messages and instructional footers.
Identical repeats are suppressed per repository, span and recipient. After prior delivery, a changed revision with genuine drift surfaces another short drift notice. A changed revision without current drift advances the baseline silently, including definition-only and opaque changes. Snapshot eviction or malformed state can cause another initial notice. Notices enumerate complete span identities and drift items in partitions targeting 1,536 bytes for broad reads and 8,192 bytes for targeted touches, including guidance. Aggregate output grows with enumeration size; an indivisible item or retrieval instruction exceeding its target is emitted intact with substantive content in its own wrapper.
Claude and Codex SessionStart reset exposure, including explicit compact/resume events. OpenCode and Antigravity have no wired compaction exposure reset. Guidance survives exposure resets, snapshot eviction and eager session-state cleanup, including Codex stops between turns. Separate session-keyed guidance directories refresh their modification time on activity and expire through TTL pruning; a new session identity starts fresh guidance. Use git span replace <name> <old-anchor> <new-anchor> to move an address and git span add <name> <anchor> to explicitly accept content at the same address; neither records semantic review.
Shell attribution uses bounded literal command intent and post-state evidence. Static planning captures only the pre-state needed for supported operations. Unproven dynamic paths, unsupported syntax, and inconclusive failed writes stay silent. Failed commands can surface a write only when the supported parser provides decisive post-state evidence; interrupted calls suppress attribution.
A missing git span binary, timeout, failed scan, or unexpected CLI result injects nothing and does not block the tool.
Human edits, unsupported tools, and inactive hooks can bypass this coverage. Run explicit git span drift checks or use CI to verify existing spans across the repository.
Suppression
.span/.hookignore suppresses selected spans by path in touch context. It does not change CLI output or anchor resolution. A missing or unreadable file applies no suppression.
Codex specifics
Installing the plugin leaves hooks inactive until the user reviews and trusts them through /hooks; see Getting started. Hash-stable hook filenames preserve an existing trust decision across plugin upgrades.
Shell envelopes' workdir selects the effective repository for planning and attribution. Patch planning and post-tool handling preserve the affected ranges, including supported failure-event attribution. Context arrives through additionalContext.
When Codex omits workdir from a Bash hook payload, the plugin recovers it from the original transcript call. Direct calls use matching call IDs; supported code-mode calls use uniquely matching literal commands and directories. Ambiguous or dynamic calls receive no attribution. The plugin leaves shell commands unchanged.
OpenCode specifics
OpenCode loads the npm plugin in-process without a trust-review step. tool.execute.before captures shell and patch plans; tool.execute.after appends <git-span> context to tool output. Declared shell working directories and session lifecycle keep plans scoped to the correct repository and tool call.
The adapter ignores failed tool results, so host-level failures such as invalid arguments, denied permission, or spawn errors receive no attribution. A numeric nonzero shell exit still reaches it, with exit-gated attribution; an exit: null result suppresses attribution like an interruption. The experimental execute tool is outside coverage. The plugin bounds its own CLI subprocesses because the host imposes no per-hook timeout.
Loading the plugin disables CLI update checks for the session. Set OPENCODE_GIT_SPAN_LOG_FILE to a path for JSONL hook diagnostics.
Antigravity specifics
Antigravity installs three skills and the workflow hooks without a marketplace or separate trust-review step. Empty PreToolUse responses mean denial on this host, so the retained pre-tool handlers return explicit allow decisions.
Only run_command has a pinned tool contract. Dedicated file-edit tools receive no touch attribution; explicit git span drift checks or CI verify their changes.
PostToolUse carries a step index rather than the original call or response. The plugin joins disk-backed pre-call state, queues rendered touch context, and delivers it after the invocation's tool batch as an ephemeral message. Successful calls provide no exit-code or response-derived read evidence. Failed calls never surface writes because there is no post-state evidence to verify.
Session note processing
Claude Code and Codex shell hooks record observed Git commits as session notes. Editing a file alone creates no commit note. Install the CLI and plugin from the same release; receipt coordination uses a native CLI lock helper.
All four hosts inspect a bounded, versioned notes response in the current repository and supplied workspace roots. Claude Code and Codex select recognized notes for their host/session; OpenCode and Antigravity retain repository-wide selection. Empty selection is normal. A lookup failure reports that commit notes could not be read.
On Claude Code and Codex, an ordinary Stop with matching notes asks for a forked subagent using review-notes. Stop continuations skip another request to avoid recursive blocking. Codex retires touch state on an empty stop or continuation and preserves it while span creation is requested or its lookup fails; Claude retires it at session end.
The hook prompt asks the subagent to extend existing spans or create missing coverage, validate anchors and whys against the current tree, remove only successfully processed notes, and leave edits unstaged. The parent must summarize validation, retained notes and incomplete scope. The review-notes skill lists notes, inspects commits, maintains spans and reports concrete shared-assumption concerns. It removes notes after validation or recorded evidence that no change was needed; it does not specify session selection or receipt matching.
Antigravity requests span creation once per conversation at an idle, successful model stop with repository notes. Its existing session guard survives call-scoped cleanup. Error and step-limit stops do not request span creation. Lookup failures report the notes read error without forcing repeated continuation.
OpenCode sends one synthetic root-session prompt per observed user turn through session.synthetic with resume: true. Synthetic prompts and child sessions do not recurse. Lookup failures produce a notes read error notice once for that turn; failed dispatch is logged without an automatic retry loop.
The enforcement backstop
Touch hooks provide context during supported reads and writes. They do not check a complete changeset at commit, push, or status time. Human edits, inactive hooks, unsupported tools, and host-level failures can leave existing spans drifting. CI & git integration covers git span drift as the check before merge.