agentdir-cli 0.7.8__tar.gz → 0.9.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. {agentdir_cli-0.7.8/src/agentdir_cli.egg-info → agentdir_cli-0.9.0}/PKG-INFO +191 -19
  2. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/README.md +190 -18
  3. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/AGENTIC_CODING.md +81 -20
  4. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/INSTALL.md +26 -14
  5. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/PI_PACKAGE.md +2 -2
  6. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/PRD.md +74 -9
  7. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/RELEASING.md +45 -16
  8. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/TECH_BRIEF.md +67 -14
  9. agentdir_cli-0.9.0/docs/investigations/2026-08-19-agentdir-read-loop-dogfood.md +1690 -0
  10. agentdir_cli-0.9.0/docs/releases/v0.8.0.md +125 -0
  11. agentdir_cli-0.9.0/docs/releases/v0.9.0.md +51 -0
  12. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/examples/dogfood-session.sh +1 -1
  13. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/package.json +2 -2
  14. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/pyproject.toml +1 -1
  15. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/scripts/install.sh +2 -2
  16. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/scripts/rollback.sh +1 -1
  17. agentdir_cli-0.9.0/skills/agentdir/SKILL.md +102 -0
  18. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/__init__.py +1 -1
  19. agentdir_cli-0.9.0/src/agentdir/audit.py +745 -0
  20. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/capture.py +11 -1
  21. agentdir_cli-0.9.0/src/agentdir/claims.py +154 -0
  22. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/cli.py +394 -26
  23. agentdir_cli-0.9.0/src/agentdir/context.py +1007 -0
  24. agentdir_cli-0.9.0/src/agentdir/context_expansion.py +1498 -0
  25. agentdir_cli-0.9.0/src/agentdir/context_projection.py +132 -0
  26. agentdir_cli-0.9.0/src/agentdir/context_repository.py +555 -0
  27. agentdir_cli-0.9.0/src/agentdir/context_review.py +500 -0
  28. agentdir_cli-0.9.0/src/agentdir/context_selection.py +869 -0
  29. agentdir_cli-0.9.0/src/agentdir/control.py +1698 -0
  30. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/doctor.py +98 -5
  31. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/envelope.py +20 -1
  32. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/federation.py +2 -2
  33. agentdir_cli-0.9.0/src/agentdir/git.py +93 -0
  34. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/hooks.py +102 -6
  35. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/index.py +69 -23
  36. agentdir_cli-0.9.0/src/agentdir/locking.py +48 -0
  37. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/memory.py +264 -36
  38. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/rendering.py +71 -1
  39. agentdir_cli-0.9.0/src/agentdir/review.py +1024 -0
  40. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/secrets.py +2 -2
  41. agentdir_cli-0.9.0/src/agentdir/sessions.py +614 -0
  42. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/skills.py +94 -17
  43. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/store.py +40 -14
  44. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0/src/agentdir_cli.egg-info}/PKG-INFO +191 -19
  45. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir_cli.egg-info/SOURCES.txt +21 -1
  46. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/tests/test_agent_first.py +659 -5
  47. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/tests/test_agent_trust.py +11 -0
  48. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/tests/test_audit.py +352 -3
  49. agentdir_cli-0.9.0/tests/test_claim_polarity.py +141 -0
  50. agentdir_cli-0.9.0/tests/test_context_concurrency.py +683 -0
  51. agentdir_cli-0.9.0/tests/test_context_expansion.py +1080 -0
  52. agentdir_cli-0.9.0/tests/test_context_federation.py +437 -0
  53. agentdir_cli-0.9.0/tests/test_context_protocol.py +949 -0
  54. agentdir_cli-0.9.0/tests/test_context_review.py +904 -0
  55. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/tests/test_environment.py +2 -1
  56. agentdir_cli-0.9.0/tests/test_evidence_classification.py +433 -0
  57. agentdir_cli-0.9.0/tests/test_header_folding.py +87 -0
  58. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/tests/test_install_script.py +1 -1
  59. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/tests/test_pi_package.py +12 -4
  60. agentdir_cli-0.9.0/tests/test_structured_claims.py +179 -0
  61. agentdir_cli-0.9.0/tests/test_vector_memory.py +1473 -0
  62. agentdir_cli-0.9.0/tests/test_worktrees.py +638 -0
  63. agentdir_cli-0.7.8/skills/agentdir/SKILL.md +0 -73
  64. agentdir_cli-0.7.8/src/agentdir/audit.py +0 -360
  65. agentdir_cli-0.7.8/src/agentdir/context.py +0 -655
  66. agentdir_cli-0.7.8/src/agentdir/control.py +0 -732
  67. agentdir_cli-0.7.8/src/agentdir/git.py +0 -45
  68. agentdir_cli-0.7.8/src/agentdir/review.py +0 -305
  69. agentdir_cli-0.7.8/src/agentdir/sessions.py +0 -176
  70. agentdir_cli-0.7.8/tests/test_vector_memory.py +0 -713
  71. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/LICENSE +0 -0
  72. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/MANIFEST.in +0 -0
  73. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/DEMO.md +0 -0
  74. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/assets/agentdir-overview.png +0 -0
  75. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/investigations/2026-05-12-cross-repo-ergonomics-lanes.md +0 -0
  76. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/investigations/2026-05-12-rag-vector-scenarios.md +0 -0
  77. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/releases/v0.1.0.md +0 -0
  78. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/releases/v0.1.1.md +0 -0
  79. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/releases/v0.2.0.md +0 -0
  80. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/releases/v0.3.0.md +0 -0
  81. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/releases/v0.3.1.md +0 -0
  82. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/releases/v0.3.2.md +0 -0
  83. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/releases/v0.3.3.md +0 -0
  84. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/releases/v0.3.4.md +0 -0
  85. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/releases/v0.4.0.md +0 -0
  86. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/releases/v0.5.0.md +0 -0
  87. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/releases/v0.5.1.md +0 -0
  88. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/releases/v0.5.2.md +0 -0
  89. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/releases/v0.5.3.md +0 -0
  90. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/releases/v0.6.0.md +0 -0
  91. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/releases/v0.7.0.md +0 -0
  92. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/releases/v0.7.1.md +0 -0
  93. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/releases/v0.7.2.md +0 -0
  94. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/releases/v0.7.3.md +0 -0
  95. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/releases/v0.7.4.md +0 -0
  96. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/releases/v0.7.5.md +0 -0
  97. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/releases/v0.7.6.md +0 -0
  98. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/releases/v0.7.7.md +0 -0
  99. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/docs/releases/v0.7.8.md +0 -0
  100. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/setup.cfg +0 -0
  101. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/__main__.py +0 -0
  102. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/actors.py +0 -0
  103. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/artifacts.py +0 -0
  104. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/daemon.py +0 -0
  105. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/environment.py +0 -0
  106. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/events.py +0 -0
  107. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/fsutil.py +0 -0
  108. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/gitignore.py +0 -0
  109. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/mailbox.py +0 -0
  110. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/query.py +0 -0
  111. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/redaction.py +0 -0
  112. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/replay.py +0 -0
  113. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/retention.py +0 -0
  114. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir/upgrade.py +0 -0
  115. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir_cli.egg-info/dependency_links.txt +0 -0
  116. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir_cli.egg-info/entry_points.txt +0 -0
  117. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir_cli.egg-info/requires.txt +0 -0
  118. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/src/agentdir_cli.egg-info/top_level.txt +0 -0
  119. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/tests/test_truncation.py +0 -0
  120. {agentdir_cli-0.7.8 → agentdir_cli-0.9.0}/tests/test_v1_behavior.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentdir-cli
3
- Version: 0.7.8
3
+ Version: 0.9.0
4
4
  Summary: Local-first Maildir-inspired work mailstore for software agents
5
5
  Author: AgentDir Contributors
6
6
  License-Expression: MIT
@@ -34,13 +34,17 @@ Dynamic: license-file
34
34
  # AgentDir
35
35
 
36
36
  <p align="center">
37
- <img src="https://raw.githubusercontent.com/jstxn/agentdir/main/docs/assets/agentdir-overview.png" alt="AgentDir turns agent work into a saved trail, searchable memory, and proof for engineers." />
37
+ <img src="docs/assets/agentdir-agent-trace-demo.gif" alt="AgentDir records observable agent reasoning artifacts, tool calls, evidence, and handoffs across Codex, Claude, Pi, and other coding agents." />
38
38
  </p>
39
39
 
40
40
  <p align="center">
41
41
  <strong>Local-first memory and evidence for agentic engineering.</strong>
42
42
  </p>
43
43
 
44
+ <p align="center">
45
+ <a href="https://github.com/jstxn/agentdir/actions/workflows/ci.yml"><img src="https://github.com/jstxn/agentdir/actions/workflows/ci.yml/badge.svg" alt="CI status" /></a>
46
+ </p>
47
+
44
48
  AgentDir is a flight recorder for coding agents. It lets agents record what
45
49
  happened during a software task, then gives engineers a clean way to inspect,
46
50
  replay, search, and audit that work later.
@@ -77,7 +81,7 @@ AgentDir gives those answers a local, durable home.
77
81
  | Replayable sessions | Inspect the task, decisions, commands, outputs, blockers, summaries, and handoffs after the fact. |
78
82
  | Local-first storage | Records live in the repo-local `.agentdir` directory by default. No hosted service is required. |
79
83
  | Rebuildable memory | Raw event files are the source of truth. SQLite search and memory indexes can be rebuilt. |
80
- | Context lineage | Agents can emit context packs, then record which retrieved sources were consumed or cited. |
84
+ | Context lineage | Agents review a bounded briefing, then record which sources were used, dismissed, skipped, or cited. |
81
85
  | Cross-repo memory | Explicitly registered AgentDir roots can be searched together without moving canonical records. |
82
86
  | Secret-aware persistence | Common secret-like patterns are redacted before storage, with scan and cleanup commands for older records. |
83
87
 
@@ -103,10 +107,12 @@ Use AgentDir only when you want the trail.
103
107
  The agent handles the recording surface:
104
108
 
105
109
  ```bash
106
- agentdir work start "fix checkout failure" --emit-context
110
+ agentdir work start "fix checkout failure"
111
+ agentdir work context --expand 1
112
+ agentdir work context --use 1 --reason "prior checkout pattern informs the plan"
107
113
  agentdir run -- pytest -q
108
114
  agentdir audit session
109
- agentdir work finish --json
115
+ agentdir work finish --json --brief
110
116
  ```
111
117
 
112
118
  ## Install
@@ -156,7 +162,7 @@ available automatically during coding tasks:
156
162
  Package page: [@jstxn/agentdir-pi](https://pi.dev/packages/@jstxn/agentdir-pi)
157
163
 
158
164
  ```bash
159
- pi install npm:@jstxn/agentdir-pi@0.7.8
165
+ pi install npm:@jstxn/agentdir-pi@0.9.0
160
166
  # or install directly from a local checkout / release tag:
161
167
  pi install /absolute/path/to/agentdir
162
168
  pi install git:github.com/jstxn/agentdir@<tag-or-commit>
@@ -179,7 +185,7 @@ Coding agents use the non-interactive form below so `.agentdir/` is ignored at
179
185
  the user level without creating a repository `.gitignore` change:
180
186
 
181
187
  ```bash
182
- agentdir adopt --gitignore user
188
+ agentdir adopt --if-needed --gitignore user
183
189
  ```
184
190
 
185
191
  This is intentionally boring setup. It prepares the repository once, then agents
@@ -261,6 +267,39 @@ directory is `.git/hooks` by default and follows `core.hooksPath` or linked
261
267
  worktree configuration. In rulesync repos, the source rule replaces the listed
262
268
  project guidance files as the managed source of truth.
263
269
 
270
+ ## Git Worktrees
271
+
272
+ A repository has one store, shared by every `git worktree` checkout. Commands
273
+ run inside a linked worktree resolve to the main working tree's `.agentdir`, so
274
+ evidence and memory from all worktrees stay searchable together instead of
275
+ fragmenting into one store per branch.
276
+
277
+ Each worktree still keeps its own active session, so parallel agents in
278
+ different worktrees do not overwrite each other.
279
+
280
+ Agents should probe the resolved store instead of checking whether the current
281
+ checkout contains a physical `.agentdir`:
282
+
283
+ ```bash
284
+ agentdir root --require --quiet
285
+ ```
286
+
287
+ A zero exit means the local or shared store is ready. Exit 3 means the agent can
288
+ run `agentdir adopt --if-needed --gitignore user`. In a restricted linked
289
+ worktree that cannot write the shared Git hooks directory, it can retry with
290
+ `--no-hooks`; adoption preflights the hook target before creating the store or
291
+ writing guidance files.
292
+
293
+ Two cases keep a store inside the worktree instead:
294
+
295
+ ```bash
296
+ # a store already present in the worktree always wins
297
+ AGENTDIR_WORKTREE_STORE=local agentdir adopt # or opt out explicitly
298
+ ```
299
+
300
+ `agentdir doctor` warns when a worktree holds a store separate from the main
301
+ one and names the command that joins them for search.
302
+
264
303
  ## Inspect A Session
265
304
 
266
305
  Most users will not need these commands every day, but they are the reason
@@ -275,11 +314,18 @@ agentdir replay
275
314
  agentdir memory search "checkout failure"
276
315
  ```
277
316
 
317
+ Without `--session`, the review commands use the active session when one
318
+ exists, then fall back to the latest completed session for the current
319
+ worktree. `status` keeps `session.current` reserved for active work and reports
320
+ the historical projection separately as `session.latest` and
321
+ `evidence.session_id`.
322
+
278
323
  For final-answer support:
279
324
 
280
325
  ```bash
281
326
  agentdir audit session
282
- agentdir audit claims --text final-response.md
327
+ agentdir audit claims # recorded structured claims
328
+ agentdir audit claims --text final-response.md # prose, when not instrumented
283
329
  ```
284
330
 
285
331
  Audits are advisory by default. Use `--strict` when unsupported or contradicted
@@ -320,17 +366,59 @@ The important property is recoverability: deleting the derived index does not
320
366
  destroy the session. AgentDir can rebuild from the envelope store.
321
367
 
322
368
  The agent-facing report surface is JSON. `agentdir report final --format json`
323
- and `agentdir work finish --json` include an `agent_handoff` object with
324
- verification evidence, failed evidence, claim support, context lineage, known
325
- gaps, and recommended next agent actions.
369
+ and `agentdir work finish --json` include the full forensic report. Agents can
370
+ use `agentdir work finish --json --brief` to receive just the compact handoff,
371
+ Git state, health, and ended-session metadata. Both shapes include an
372
+ `agent_handoff` object with verification evidence, failed evidence, claim
373
+ support, context lineage, known gaps, and recommended next actions.
326
374
 
327
375
  ## Unique Capabilities
328
376
 
329
377
  ### Claims-To-Evidence Checks
330
378
 
331
- AgentDir can compare final-response claims such as "tests passed" or "build
332
- passed" against the latest recorded tool results. It does this with
333
- deterministic heuristics, not an LLM.
379
+ Agents record what a check showed, and AgentDir compares that against the
380
+ recorded tool results. It does this deterministically, not with an LLM.
381
+
382
+ ```bash
383
+ agentdir claim test --passed
384
+ agentdir claim build --failed --note "linker error in release profile"
385
+ agentdir claim list
386
+ agentdir audit claims # checks recorded claims against evidence
387
+ agentdir audit claims --strict # exit 1 when a claim is not supported
388
+ ```
389
+
390
+ A structured claim names its family and outcome outright, so checking it is a
391
+ comparison rather than an interpretation of prose:
392
+
393
+ | Claim | Evidence | Result |
394
+ | --- | --- | --- |
395
+ | passed | succeeded | `supported` |
396
+ | passed | failed | `contradicted` |
397
+ | failed | failed | `acknowledged` |
398
+ | failed | succeeded | `contradicted` |
399
+ | either | none recorded | `unsupported` |
400
+ | none recorded | failed | `unreviewed` |
401
+
402
+ Recording a family again replaces its earlier claim, so a check re-run after a
403
+ fix supersedes rather than accumulates. Claiming a failure honestly is
404
+ `acknowledged` and does not count against the audit.
405
+
406
+ Tool evidence remains append-only. When a newer result in the same evidence
407
+ family passes, earlier failures remain available as historical and resolved
408
+ evidence, while strict session audit and the agent handoff report only failures
409
+ whose family is still failing.
410
+
411
+ A claim made in error can be withdrawn:
412
+
413
+ ```bash
414
+ agentdir claim build --retract
415
+ ```
416
+
417
+ Claims are append-only events, so retracting supersedes the earlier claim in the
418
+ latest-claim view while leaving both in the record.
419
+
420
+ Recorded claims also reach the `agent_handoff` object without any final text
421
+ being supplied.
334
422
 
335
423
  Supported claim families:
336
424
 
@@ -341,9 +429,79 @@ Supported claim families:
341
429
  - doctor
342
430
  - release
343
431
 
432
+ #### Auditing prose instead
433
+
434
+ For final responses that were not instrumented, `agentdir audit claims --text`
435
+ reads claims out of prose:
436
+
437
+ ```bash
438
+ agentdir audit claims --text final-response.md
439
+ ```
440
+
441
+ This path has to infer intent from wording, so prefer recorded claims when the
442
+ agent can emit them.
443
+
444
+ Claim detection is keyword-based, so ordinary phrasing such as "everything
445
+ works" or "verified locally" matches no family. When recorded evidence failed
446
+ and the text makes no checkable claim about it, the audit reports that family as
447
+ `unreviewed` and is not `ok`, rather than passing because it found nothing to
448
+ check. `claims_detected` reports how many claims were actually parsed, so
449
+ "nothing to audit" is never mistaken for "audited and clean".
450
+
451
+ Text that states the failure instead ("tests failed", "two tests fail") is
452
+ reported as `acknowledged` and does not count against the audit, so honest
453
+ failure reporting is never flagged like text that hid the failure. Failure
454
+ vocabulary asserting success ("no test failures") is treated as a success claim
455
+ and checked against evidence like any other.
456
+
344
457
  ### Context Packs
345
458
 
346
- Agents can package retrieved context into auditable source manifests:
459
+ `work start` retrieves, persists, and prints a bounded briefing by default, with
460
+ numbered sources, excerpts, source classes, and match quality. `--no-context`
461
+ skips retrieval but still persists a zero-source opt-out marker, so a new task
462
+ cannot inherit an older task's context. The agent must then record one honest
463
+ decision:
464
+
465
+ ```bash
466
+ # when the preview looks useful but is too short:
467
+ agentdir work context --expand 1
468
+ agentdir work context --expand 1 --page 2
469
+ # then record the decision:
470
+ agentdir work context --use 1 --reason "prior failure constrains the repair"
471
+ # or, when the briefing does not help:
472
+ agentdir work context --none-relevant --reason "only generic build logs matched"
473
+ # after a restart or lost output:
474
+ agentdir work context --show
475
+ ```
476
+
477
+ `work finish` keeps every non-empty briefing in the session open until the agent
478
+ records used sources, no relevant context, or an explicit skipped review. A
479
+ newer pack cannot hide an older pending pack. Status, audits, and handoffs
480
+ report the funnel as retrieved, presented, reviewed, used, dismissed, pending,
481
+ and cited, including invalid cite-before-use lineage. Lower-level consumption
482
+ of omitted sources is reported separately so `used` never exceeds `reviewed`.
483
+ Citation remains optional and separate from use. Printed review commands are
484
+ bound to the displayed pack, so reopening an older briefing cannot accidentally
485
+ decide a newer one.
486
+
487
+ Briefing excerpts are labeled previews. `work context --expand <number>` reads
488
+ the retained canonical source through the same pack-local number without making
489
+ a review decision. Output is redacted and capped to 4096 UTF-8 bytes per page;
490
+ plain and JSON output identify integrity (`verified`, `legacy_unverified`,
491
+ `changed`, or `unavailable`) and extent (`full`, `bounded`, or
492
+ `stored_excerpt`). Digest drift or an unavailable federated root returns only
493
+ the immutable, redacted manifest preview rather than presenting changed text as
494
+ historical truth.
495
+
496
+ While the pack-owning session is active, a successful canonical expansion emits
497
+ one idempotent, metadata-only receipt. The source body is never copied into the
498
+ receipt or searchable memory. Expansion remains optional and never changes the
499
+ terminal decision or blocks `work finish`; audits, status, and handoffs report
500
+ expanded-before-decision, expanded-after-decision, and used-without-prior-
501
+ expansion counts. Retained ended or archived packs can still be read directly,
502
+ but historical reads do not append new receipts or re-enter active search.
503
+
504
+ The lower-level context interface remains available for explicit packs:
347
505
 
348
506
  ```bash
349
507
  agentdir context build "checkout failure" --emit
@@ -352,8 +510,18 @@ agentdir context cite --pack <pack-id>
352
510
  agentdir audit context --pack <pack-id>
353
511
  ```
354
512
 
355
- This does not prove a model paid attention, but it does make cooperative agent
356
- behavior visible.
513
+ Consuming every presented source through the lower-level interface completes a
514
+ compatibility review. A partial legacy consume can finish with a visible
515
+ `compatibility_partial` warning rather than forcing false consumption. A
516
+ terminal `work context` decision cannot be changed by a later lower-level
517
+ consume. Session-scoped lifecycle locking makes pack creation linearize before
518
+ the finish audit; an emitter that loses the race to an ended session is rejected.
519
+ Manifest digests, creation-event identities, decision integrity headers, and
520
+ source references are validated before lineage can be certified.
521
+
522
+ AgentDir cannot prove model attention. It can show what was presented, the
523
+ agent's reasoned decision, which sources were actually used, and whether those
524
+ used sources were later cited.
357
525
 
358
526
  ### Local Agent Memory
359
527
 
@@ -367,8 +535,12 @@ agentdir memory explain "release evidence"
367
535
  agentdir context build "release evidence" --emit
368
536
  ```
369
537
 
370
- Optional semantic extras exist, but the default path does not require a vector
371
- database or external embedding service.
538
+ Retrieval mode defaults to `auto`. Without optional dependencies it keeps the
539
+ built-in local hybrid path. When FastEmbed is installed and configured for the
540
+ store, the same `work start`, `context build`, `memory search`, and
541
+ `memory explain` commands automatically fuse semantic and lexical scores while
542
+ preserving both components in JSON output. Explicit `--retrieval` modes remain
543
+ available for diagnostics and comparisons.
372
544
 
373
545
  ### Federated Memory
374
546
 
@@ -1,13 +1,17 @@
1
1
  # AgentDir
2
2
 
3
3
  <p align="center">
4
- <img src="https://raw.githubusercontent.com/jstxn/agentdir/main/docs/assets/agentdir-overview.png" alt="AgentDir turns agent work into a saved trail, searchable memory, and proof for engineers." />
4
+ <img src="docs/assets/agentdir-agent-trace-demo.gif" alt="AgentDir records observable agent reasoning artifacts, tool calls, evidence, and handoffs across Codex, Claude, Pi, and other coding agents." />
5
5
  </p>
6
6
 
7
7
  <p align="center">
8
8
  <strong>Local-first memory and evidence for agentic engineering.</strong>
9
9
  </p>
10
10
 
11
+ <p align="center">
12
+ <a href="https://github.com/jstxn/agentdir/actions/workflows/ci.yml"><img src="https://github.com/jstxn/agentdir/actions/workflows/ci.yml/badge.svg" alt="CI status" /></a>
13
+ </p>
14
+
11
15
  AgentDir is a flight recorder for coding agents. It lets agents record what
12
16
  happened during a software task, then gives engineers a clean way to inspect,
13
17
  replay, search, and audit that work later.
@@ -44,7 +48,7 @@ AgentDir gives those answers a local, durable home.
44
48
  | Replayable sessions | Inspect the task, decisions, commands, outputs, blockers, summaries, and handoffs after the fact. |
45
49
  | Local-first storage | Records live in the repo-local `.agentdir` directory by default. No hosted service is required. |
46
50
  | Rebuildable memory | Raw event files are the source of truth. SQLite search and memory indexes can be rebuilt. |
47
- | Context lineage | Agents can emit context packs, then record which retrieved sources were consumed or cited. |
51
+ | Context lineage | Agents review a bounded briefing, then record which sources were used, dismissed, skipped, or cited. |
48
52
  | Cross-repo memory | Explicitly registered AgentDir roots can be searched together without moving canonical records. |
49
53
  | Secret-aware persistence | Common secret-like patterns are redacted before storage, with scan and cleanup commands for older records. |
50
54
 
@@ -70,10 +74,12 @@ Use AgentDir only when you want the trail.
70
74
  The agent handles the recording surface:
71
75
 
72
76
  ```bash
73
- agentdir work start "fix checkout failure" --emit-context
77
+ agentdir work start "fix checkout failure"
78
+ agentdir work context --expand 1
79
+ agentdir work context --use 1 --reason "prior checkout pattern informs the plan"
74
80
  agentdir run -- pytest -q
75
81
  agentdir audit session
76
- agentdir work finish --json
82
+ agentdir work finish --json --brief
77
83
  ```
78
84
 
79
85
  ## Install
@@ -123,7 +129,7 @@ available automatically during coding tasks:
123
129
  Package page: [@jstxn/agentdir-pi](https://pi.dev/packages/@jstxn/agentdir-pi)
124
130
 
125
131
  ```bash
126
- pi install npm:@jstxn/agentdir-pi@0.7.8
132
+ pi install npm:@jstxn/agentdir-pi@0.9.0
127
133
  # or install directly from a local checkout / release tag:
128
134
  pi install /absolute/path/to/agentdir
129
135
  pi install git:github.com/jstxn/agentdir@<tag-or-commit>
@@ -146,7 +152,7 @@ Coding agents use the non-interactive form below so `.agentdir/` is ignored at
146
152
  the user level without creating a repository `.gitignore` change:
147
153
 
148
154
  ```bash
149
- agentdir adopt --gitignore user
155
+ agentdir adopt --if-needed --gitignore user
150
156
  ```
151
157
 
152
158
  This is intentionally boring setup. It prepares the repository once, then agents
@@ -228,6 +234,39 @@ directory is `.git/hooks` by default and follows `core.hooksPath` or linked
228
234
  worktree configuration. In rulesync repos, the source rule replaces the listed
229
235
  project guidance files as the managed source of truth.
230
236
 
237
+ ## Git Worktrees
238
+
239
+ A repository has one store, shared by every `git worktree` checkout. Commands
240
+ run inside a linked worktree resolve to the main working tree's `.agentdir`, so
241
+ evidence and memory from all worktrees stay searchable together instead of
242
+ fragmenting into one store per branch.
243
+
244
+ Each worktree still keeps its own active session, so parallel agents in
245
+ different worktrees do not overwrite each other.
246
+
247
+ Agents should probe the resolved store instead of checking whether the current
248
+ checkout contains a physical `.agentdir`:
249
+
250
+ ```bash
251
+ agentdir root --require --quiet
252
+ ```
253
+
254
+ A zero exit means the local or shared store is ready. Exit 3 means the agent can
255
+ run `agentdir adopt --if-needed --gitignore user`. In a restricted linked
256
+ worktree that cannot write the shared Git hooks directory, it can retry with
257
+ `--no-hooks`; adoption preflights the hook target before creating the store or
258
+ writing guidance files.
259
+
260
+ Two cases keep a store inside the worktree instead:
261
+
262
+ ```bash
263
+ # a store already present in the worktree always wins
264
+ AGENTDIR_WORKTREE_STORE=local agentdir adopt # or opt out explicitly
265
+ ```
266
+
267
+ `agentdir doctor` warns when a worktree holds a store separate from the main
268
+ one and names the command that joins them for search.
269
+
231
270
  ## Inspect A Session
232
271
 
233
272
  Most users will not need these commands every day, but they are the reason
@@ -242,11 +281,18 @@ agentdir replay
242
281
  agentdir memory search "checkout failure"
243
282
  ```
244
283
 
284
+ Without `--session`, the review commands use the active session when one
285
+ exists, then fall back to the latest completed session for the current
286
+ worktree. `status` keeps `session.current` reserved for active work and reports
287
+ the historical projection separately as `session.latest` and
288
+ `evidence.session_id`.
289
+
245
290
  For final-answer support:
246
291
 
247
292
  ```bash
248
293
  agentdir audit session
249
- agentdir audit claims --text final-response.md
294
+ agentdir audit claims # recorded structured claims
295
+ agentdir audit claims --text final-response.md # prose, when not instrumented
250
296
  ```
251
297
 
252
298
  Audits are advisory by default. Use `--strict` when unsupported or contradicted
@@ -287,17 +333,59 @@ The important property is recoverability: deleting the derived index does not
287
333
  destroy the session. AgentDir can rebuild from the envelope store.
288
334
 
289
335
  The agent-facing report surface is JSON. `agentdir report final --format json`
290
- and `agentdir work finish --json` include an `agent_handoff` object with
291
- verification evidence, failed evidence, claim support, context lineage, known
292
- gaps, and recommended next agent actions.
336
+ and `agentdir work finish --json` include the full forensic report. Agents can
337
+ use `agentdir work finish --json --brief` to receive just the compact handoff,
338
+ Git state, health, and ended-session metadata. Both shapes include an
339
+ `agent_handoff` object with verification evidence, failed evidence, claim
340
+ support, context lineage, known gaps, and recommended next actions.
293
341
 
294
342
  ## Unique Capabilities
295
343
 
296
344
  ### Claims-To-Evidence Checks
297
345
 
298
- AgentDir can compare final-response claims such as "tests passed" or "build
299
- passed" against the latest recorded tool results. It does this with
300
- deterministic heuristics, not an LLM.
346
+ Agents record what a check showed, and AgentDir compares that against the
347
+ recorded tool results. It does this deterministically, not with an LLM.
348
+
349
+ ```bash
350
+ agentdir claim test --passed
351
+ agentdir claim build --failed --note "linker error in release profile"
352
+ agentdir claim list
353
+ agentdir audit claims # checks recorded claims against evidence
354
+ agentdir audit claims --strict # exit 1 when a claim is not supported
355
+ ```
356
+
357
+ A structured claim names its family and outcome outright, so checking it is a
358
+ comparison rather than an interpretation of prose:
359
+
360
+ | Claim | Evidence | Result |
361
+ | --- | --- | --- |
362
+ | passed | succeeded | `supported` |
363
+ | passed | failed | `contradicted` |
364
+ | failed | failed | `acknowledged` |
365
+ | failed | succeeded | `contradicted` |
366
+ | either | none recorded | `unsupported` |
367
+ | none recorded | failed | `unreviewed` |
368
+
369
+ Recording a family again replaces its earlier claim, so a check re-run after a
370
+ fix supersedes rather than accumulates. Claiming a failure honestly is
371
+ `acknowledged` and does not count against the audit.
372
+
373
+ Tool evidence remains append-only. When a newer result in the same evidence
374
+ family passes, earlier failures remain available as historical and resolved
375
+ evidence, while strict session audit and the agent handoff report only failures
376
+ whose family is still failing.
377
+
378
+ A claim made in error can be withdrawn:
379
+
380
+ ```bash
381
+ agentdir claim build --retract
382
+ ```
383
+
384
+ Claims are append-only events, so retracting supersedes the earlier claim in the
385
+ latest-claim view while leaving both in the record.
386
+
387
+ Recorded claims also reach the `agent_handoff` object without any final text
388
+ being supplied.
301
389
 
302
390
  Supported claim families:
303
391
 
@@ -308,9 +396,79 @@ Supported claim families:
308
396
  - doctor
309
397
  - release
310
398
 
399
+ #### Auditing prose instead
400
+
401
+ For final responses that were not instrumented, `agentdir audit claims --text`
402
+ reads claims out of prose:
403
+
404
+ ```bash
405
+ agentdir audit claims --text final-response.md
406
+ ```
407
+
408
+ This path has to infer intent from wording, so prefer recorded claims when the
409
+ agent can emit them.
410
+
411
+ Claim detection is keyword-based, so ordinary phrasing such as "everything
412
+ works" or "verified locally" matches no family. When recorded evidence failed
413
+ and the text makes no checkable claim about it, the audit reports that family as
414
+ `unreviewed` and is not `ok`, rather than passing because it found nothing to
415
+ check. `claims_detected` reports how many claims were actually parsed, so
416
+ "nothing to audit" is never mistaken for "audited and clean".
417
+
418
+ Text that states the failure instead ("tests failed", "two tests fail") is
419
+ reported as `acknowledged` and does not count against the audit, so honest
420
+ failure reporting is never flagged like text that hid the failure. Failure
421
+ vocabulary asserting success ("no test failures") is treated as a success claim
422
+ and checked against evidence like any other.
423
+
311
424
  ### Context Packs
312
425
 
313
- Agents can package retrieved context into auditable source manifests:
426
+ `work start` retrieves, persists, and prints a bounded briefing by default, with
427
+ numbered sources, excerpts, source classes, and match quality. `--no-context`
428
+ skips retrieval but still persists a zero-source opt-out marker, so a new task
429
+ cannot inherit an older task's context. The agent must then record one honest
430
+ decision:
431
+
432
+ ```bash
433
+ # when the preview looks useful but is too short:
434
+ agentdir work context --expand 1
435
+ agentdir work context --expand 1 --page 2
436
+ # then record the decision:
437
+ agentdir work context --use 1 --reason "prior failure constrains the repair"
438
+ # or, when the briefing does not help:
439
+ agentdir work context --none-relevant --reason "only generic build logs matched"
440
+ # after a restart or lost output:
441
+ agentdir work context --show
442
+ ```
443
+
444
+ `work finish` keeps every non-empty briefing in the session open until the agent
445
+ records used sources, no relevant context, or an explicit skipped review. A
446
+ newer pack cannot hide an older pending pack. Status, audits, and handoffs
447
+ report the funnel as retrieved, presented, reviewed, used, dismissed, pending,
448
+ and cited, including invalid cite-before-use lineage. Lower-level consumption
449
+ of omitted sources is reported separately so `used` never exceeds `reviewed`.
450
+ Citation remains optional and separate from use. Printed review commands are
451
+ bound to the displayed pack, so reopening an older briefing cannot accidentally
452
+ decide a newer one.
453
+
454
+ Briefing excerpts are labeled previews. `work context --expand <number>` reads
455
+ the retained canonical source through the same pack-local number without making
456
+ a review decision. Output is redacted and capped to 4096 UTF-8 bytes per page;
457
+ plain and JSON output identify integrity (`verified`, `legacy_unverified`,
458
+ `changed`, or `unavailable`) and extent (`full`, `bounded`, or
459
+ `stored_excerpt`). Digest drift or an unavailable federated root returns only
460
+ the immutable, redacted manifest preview rather than presenting changed text as
461
+ historical truth.
462
+
463
+ While the pack-owning session is active, a successful canonical expansion emits
464
+ one idempotent, metadata-only receipt. The source body is never copied into the
465
+ receipt or searchable memory. Expansion remains optional and never changes the
466
+ terminal decision or blocks `work finish`; audits, status, and handoffs report
467
+ expanded-before-decision, expanded-after-decision, and used-without-prior-
468
+ expansion counts. Retained ended or archived packs can still be read directly,
469
+ but historical reads do not append new receipts or re-enter active search.
470
+
471
+ The lower-level context interface remains available for explicit packs:
314
472
 
315
473
  ```bash
316
474
  agentdir context build "checkout failure" --emit
@@ -319,8 +477,18 @@ agentdir context cite --pack <pack-id>
319
477
  agentdir audit context --pack <pack-id>
320
478
  ```
321
479
 
322
- This does not prove a model paid attention, but it does make cooperative agent
323
- behavior visible.
480
+ Consuming every presented source through the lower-level interface completes a
481
+ compatibility review. A partial legacy consume can finish with a visible
482
+ `compatibility_partial` warning rather than forcing false consumption. A
483
+ terminal `work context` decision cannot be changed by a later lower-level
484
+ consume. Session-scoped lifecycle locking makes pack creation linearize before
485
+ the finish audit; an emitter that loses the race to an ended session is rejected.
486
+ Manifest digests, creation-event identities, decision integrity headers, and
487
+ source references are validated before lineage can be certified.
488
+
489
+ AgentDir cannot prove model attention. It can show what was presented, the
490
+ agent's reasoned decision, which sources were actually used, and whether those
491
+ used sources were later cited.
324
492
 
325
493
  ### Local Agent Memory
326
494
 
@@ -334,8 +502,12 @@ agentdir memory explain "release evidence"
334
502
  agentdir context build "release evidence" --emit
335
503
  ```
336
504
 
337
- Optional semantic extras exist, but the default path does not require a vector
338
- database or external embedding service.
505
+ Retrieval mode defaults to `auto`. Without optional dependencies it keeps the
506
+ built-in local hybrid path. When FastEmbed is installed and configured for the
507
+ store, the same `work start`, `context build`, `memory search`, and
508
+ `memory explain` commands automatically fuse semantic and lexical scores while
509
+ preserving both components in JSON output. Explicit `--retrieval` modes remain
510
+ available for diagnostics and comparisons.
339
511
 
340
512
  ### Federated Memory
341
513