Commit e8d5ca4
feat: breadcrumb fallback for post-exit agent detection (#3)
When an agent session is closed before the human runs `git commit` or
when the command is run from a separate terminal, live process detection
may not find the right co-author. This is at present a common "agent
finishes work, human reviews, then commits" flow on laptops.
So as a solution, this PR proposes a breadcrumb fallback process. If
live detection fails, the code will check agent state files already on
disk.
This currently two agents but more can be supported through config
changes :
- **Claude Code** — scans `~/.claude/projects/` for recent `.jsonl`
files with a `cwd` matching the repo
- **Codex** — scans `~/.codex/sessions/` the same way
Rest of the agents can be added after testing.
**NOTE** This is a heuristic based approach and so its imperfect, but
will improve attritbution. To improve accuracy, the code only ever looks
back ~2 hrs and for sessions that worked on the same folders.
We could have also check if the files being edited in the session match
the session but I found this to slow down git commits by 200%. It wasn't
noticeable on my laptop but may not work as well on other hardware. It
also creates a stronger dependency on vendor session files and paths
that may change in future, so I've left it out for now.
## Test run (from a terminal with no agent in the process tree)
```
....
=== Breadcrumb Fallback ===
Claude Code breadcrumb dir: /Users/rishibaldawa/.claude/projects
...aittributor/224254e5-...jsonl cwd: /Users/rishibaldawa/Development/aittributor
Codex breadcrumb dir: /Users/rishibaldawa/.codex/sessions
...rollout-2026-02-12T06-06-09-...jsonl cwd: /Users/rishibaldawa/Development/aittributor
Claude Code <noreply@anthropic.com>
Codex <noreply@openai.com>
```
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent c8ebd0f commit e8d5ca4
File tree
8 files changed
+860
-221
lines changed- src
8 files changed
+860
-221
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
0 commit comments