---
title: "coding.sh attribution · coding.sh docs"
description: "Which agent session wrote the lines each commit added; export them as Agent Trace. sh attribution and its subcommands, from its own --help."
canonical: https://coding.sh/docs/cli/attribution
human_url: https://coding.sh/docs/cli/attribution
markdown_url: https://coding.sh/docs/cli/attribution.md
agents_url: https://coding.sh/agents.md
llms_url: https://coding.sh/llms.txt
updated: 2026-11-11
---

# coding.sh attribution

Which agent session wrote the lines each commit added; export them as Agent Trace. sh attribution and its subcommands, from its own --help.

coding.sh attribution --help

```
coding.sh attribution [action] [options]

  Which agent session wrote the lines each commit added; export them as Agent Trace

Commands
  export        Print one Agent Trace record (agent-trace.dev, RFC 0.1.0) per commit with agent lines, as JSONL

Options
      --repo <DIR>    A directory in the git repository (default: the current one)
      --rev <REV>     Branch or commit to walk back from (default: HEAD)
      --since <WHEN>  Only commits after this time: 30d, 12h or a date in local time (default: the first captured session in the repo)
      --all           Also list commits with no agent lines
  -n, --limit <N>     Maximum rows (default: 50)
      --fresh         Wait for every pending capture to be ingested (default: answer after 1.5 s)

Examples
  coding.sh attribution
  coding.sh attribution --since 7d --rev main
  coding.sh attribution --json

Notes
  Matches the lines each commit added to the lines each captured session added: the diff from its start state to its end snapshot, kept only for files its tools named or when it ran a shell or subagent call, and its own edit tool calls for the files that diff does not hold. A whole-file match (patch id) or a same-file line match counts; moved long lines count at lower confidence; braces and blank lines only follow a matched neighbor. A rebased commit still matches.
  A session gets credit for commits authored or committed from its start to 21 days later; of two sessions that wrote a line, the later one. Lines no session wrote belong to no session: a person wrote them, or an agent coding.sh did not capture. A session that ran a shell or subagent call can still be credited a file a person wrote in the same window, at lower confidence.
  Reads git only (log, diff, blame, notes). git-ai notes (refs/notes/ai), when present, credit lines no captured session matched. Each commit's result is kept in the store's key/value table.
  --json: one document with totals, the sessions credited and per commit its attributions (path, line ranges, session, agent, model, confidence, method). export --json: {version, records}.
```

## `coding.sh attribution export`

Print one Agent Trace record (agent-trace.dev, RFC 0.1.0) per commit with agent lines, as JSONL.

coding.sh attribution export --help

```
coding.sh attribution export [options]

  Print one Agent Trace record (agent-trace.dev, RFC 0.1.0) per commit with agent lines, as JSONL

Options
      --format <FORMAT>   Output format (default: agent-trace)
  -o, --out <FILE>        Write the records to FILE instead of stdout and print its path
      --viewer-url <URL>  Viewer base URL for each session link (default: http://127.0.0.1:4319)
      --repo <DIR>        A directory in the git repository (default: the current one)
      --rev <REV>         Branch or commit to walk back from (default: HEAD)
      --since <WHEN>      Only commits after this time: 30d, 12h or a date in local time (default: the first captured session in the repo)
      --fresh             Wait for every pending capture to be ingested (default: answer after 1.5 s)

Examples
  coding.sh attribution export > agent-trace.jsonl
  coding.sh attribution export --since 30d --out trace.jsonl
  coding.sh attribution export --json
```

[All commands](https://coding.sh/docs/cli) · [Global options](https://coding.sh/docs/cli#global)

To set coding.sh up for a user, follow the agent workflow at [/agents.md](https://coding.sh/agents.md).
