Skip to content

feat: v0.16.0 — session attribution (user, process ancestry, agent provider)#32

Merged
Siddhant-K-code merged 2 commits into
mainfrom
feat/v0.16.0-session-attribution
Apr 11, 2026
Merged

feat: v0.16.0 — session attribution (user, process ancestry, agent provider)#32
Siddhant-K-code merged 2 commits into
mainfrom
feat/v0.16.0-session-attribution

Conversation

@Siddhant-K-code
Copy link
Copy Markdown
Owner

Closes #22

What

Adds attribution.py that captures who/what started a session and stores it in SessionMeta.attribution.

Captured fields

Field Source
os_user pwd.getpwuid / $USER
hostname socket.gethostname()
pid / ppid os.getpid() / os.getppid()
process_ancestry /proc/<pid>/comm chain (Linux)
agent_provider env vars (ANTHROPIC_API_KEY, CURSOR_SESSION_ID, etc.) + process names
git_repo/branch/commit git remote get-url / rev-parse
working_dir os.getcwd()

hooks.py calls collect_attribution() on every session-start event. Attribution is written to meta.json and never modified.

Tests

tests/test_attribution.py — 8 tests.

Ona and others added 2 commits April 11, 2026 16:31
…rovider

Adds attribution.py with collect_attribution() that captures OS user,
hostname, PID/PPID, process ancestry chain, agent provider (detected
from env vars and process names), and git context (repo, branch, commit).

Attribution is stored in SessionMeta.attribution dict and written to
meta.json at session start. hooks.py now calls collect_attribution()
on every session-start event.

Closes #22

Co-authored-by: Ona <no-reply@ona.com>
__dataclass_fields__ is an implementation detail. dataclasses.fields()
is the public API and works correctly across Python 3.10–3.13.

Co-authored-by: Ona <no-reply@ona.com>
@Siddhant-K-code Siddhant-K-code merged commit f24004f into main Apr 11, 2026
4 checks passed
@Siddhant-K-code Siddhant-K-code deleted the feat/v0.16.0-session-attribution branch April 11, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v0.16.0: Session attribution - record spawning user, process ancestry, and agent provider

1 participant