Context
The journal is written under <repoRoot>/aidd_docs/runs/, and repoRoot comes from git rev-parse --show-toplevel.
In a worktree, that resolves to the worktree, not the repository:
worktree root: /tmp/wt/feature ← what the hook resolves
common dir: /tmp/wt/main/.git ← the shared repository
main root: /tmp/wt/main
So each worktree keeps its own journal. Nobody decided that; it is what git resolution happens to give.
Why it matters now
Agent runners give each agent its own worktree — Orca sets ORCA_WORKTREE_ID and does exactly this. That is the shape this measurement will actually meet in the field.
Today, a report run in worktree A sees only A's journal. Sessions from worktree B still contribute their tokens — the sink is machine-level and pools everything — but with no step and no task. They read as unattributed, and nothing says why.
The decision to make
Both answers are defensible and they answer different questions:
- Per worktree. "What did this feature branch cost." Attribution stays with the work.
- Shared, at
git rev-parse --git-common-dir. "What did this project cost this week." One journal for every branch of one repository.
A third possibility is to record the worktree on the session_start line and let the reader choose, which keeps both questions answerable and costs one field.
Expected
Whatever is chosen is chosen, written down, and tested — not inherited from a git default.
Actual
Inherited from a git default, undocumented, and invisible in the output: a cross-worktree session is indistinguishable from a session no journal ever covered.
Cheap to change
Only attribution is per-worktree. The figures already pool machine-wide, so nothing measured is lost or has to be migrated whichever way this goes.
Relations
Context
The journal is written under
<repoRoot>/aidd_docs/runs/, andrepoRootcomes fromgit rev-parse --show-toplevel.In a worktree, that resolves to the worktree, not the repository:
So each worktree keeps its own journal. Nobody decided that; it is what git resolution happens to give.
Why it matters now
Agent runners give each agent its own worktree — Orca sets
ORCA_WORKTREE_IDand does exactly this. That is the shape this measurement will actually meet in the field.Today, a report run in worktree A sees only A's journal. Sessions from worktree B still contribute their tokens — the sink is machine-level and pools everything — but with no step and no task. They read as unattributed, and nothing says why.
The decision to make
Both answers are defensible and they answer different questions:
git rev-parse --git-common-dir. "What did this project cost this week." One journal for every branch of one repository.A third possibility is to record the worktree on the
session_startline and let the reader choose, which keeps both questions answerable and costs one field.Expected
Whatever is chosen is chosen, written down, and tested — not inherited from a git default.
Actual
Inherited from a git default, undocumented, and invisible in the output: a cross-worktree session is indistinguishable from a session no journal ever covered.
Cheap to change
Only attribution is per-worktree. The figures already pool machine-wide, so nothing measured is lost or has to be migrated whichever way this goes.
Relations