agentdir-cli 0.8.0__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 (118) hide show
  1. {agentdir_cli-0.8.0/src/agentdir_cli.egg-info → agentdir_cli-0.9.0}/PKG-INFO +101 -14
  2. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/README.md +100 -13
  3. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/AGENTIC_CODING.md +81 -20
  4. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/INSTALL.md +26 -14
  5. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/PI_PACKAGE.md +2 -2
  6. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/PRD.md +74 -9
  7. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/RELEASING.md +16 -16
  8. {agentdir_cli-0.8.0 → 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.9.0.md +51 -0
  11. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/examples/dogfood-session.sh +1 -1
  12. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/package.json +2 -2
  13. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/pyproject.toml +1 -1
  14. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/scripts/install.sh +2 -2
  15. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/scripts/rollback.sh +1 -1
  16. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/skills/agentdir/SKILL.md +18 -7
  17. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/__init__.py +1 -1
  18. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/audit.py +183 -16
  19. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/capture.py +11 -1
  20. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/cli.py +311 -18
  21. agentdir_cli-0.9.0/src/agentdir/context.py +1007 -0
  22. agentdir_cli-0.9.0/src/agentdir/context_expansion.py +1498 -0
  23. agentdir_cli-0.9.0/src/agentdir/context_projection.py +132 -0
  24. agentdir_cli-0.9.0/src/agentdir/context_repository.py +555 -0
  25. agentdir_cli-0.9.0/src/agentdir/context_review.py +500 -0
  26. agentdir_cli-0.9.0/src/agentdir/context_selection.py +869 -0
  27. agentdir_cli-0.9.0/src/agentdir/control.py +1698 -0
  28. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/doctor.py +39 -3
  29. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/federation.py +2 -2
  30. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/hooks.py +102 -6
  31. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/index.py +66 -20
  32. agentdir_cli-0.9.0/src/agentdir/locking.py +48 -0
  33. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/memory.py +264 -36
  34. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/rendering.py +60 -0
  35. agentdir_cli-0.9.0/src/agentdir/review.py +1024 -0
  36. agentdir_cli-0.9.0/src/agentdir/sessions.py +614 -0
  37. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/skills.py +75 -16
  38. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/store.py +1 -1
  39. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0/src/agentdir_cli.egg-info}/PKG-INFO +101 -14
  40. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir_cli.egg-info/SOURCES.txt +14 -0
  41. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/tests/test_agent_first.py +659 -5
  42. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/tests/test_agent_trust.py +11 -0
  43. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/tests/test_audit.py +252 -3
  44. agentdir_cli-0.9.0/tests/test_context_concurrency.py +683 -0
  45. agentdir_cli-0.9.0/tests/test_context_expansion.py +1080 -0
  46. agentdir_cli-0.9.0/tests/test_context_federation.py +437 -0
  47. agentdir_cli-0.9.0/tests/test_context_protocol.py +949 -0
  48. agentdir_cli-0.9.0/tests/test_context_review.py +904 -0
  49. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/tests/test_environment.py +2 -1
  50. agentdir_cli-0.9.0/tests/test_evidence_classification.py +433 -0
  51. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/tests/test_install_script.py +1 -1
  52. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/tests/test_pi_package.py +12 -4
  53. agentdir_cli-0.9.0/tests/test_vector_memory.py +1473 -0
  54. agentdir_cli-0.9.0/tests/test_worktrees.py +638 -0
  55. agentdir_cli-0.8.0/src/agentdir/context.py +0 -655
  56. agentdir_cli-0.8.0/src/agentdir/control.py +0 -746
  57. agentdir_cli-0.8.0/src/agentdir/review.py +0 -305
  58. agentdir_cli-0.8.0/src/agentdir/sessions.py +0 -245
  59. agentdir_cli-0.8.0/tests/test_vector_memory.py +0 -713
  60. agentdir_cli-0.8.0/tests/test_worktrees.py +0 -138
  61. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/LICENSE +0 -0
  62. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/MANIFEST.in +0 -0
  63. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/DEMO.md +0 -0
  64. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/assets/agentdir-overview.png +0 -0
  65. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/investigations/2026-05-12-cross-repo-ergonomics-lanes.md +0 -0
  66. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/investigations/2026-05-12-rag-vector-scenarios.md +0 -0
  67. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.1.0.md +0 -0
  68. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.1.1.md +0 -0
  69. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.2.0.md +0 -0
  70. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.3.0.md +0 -0
  71. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.3.1.md +0 -0
  72. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.3.2.md +0 -0
  73. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.3.3.md +0 -0
  74. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.3.4.md +0 -0
  75. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.4.0.md +0 -0
  76. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.5.0.md +0 -0
  77. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.5.1.md +0 -0
  78. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.5.2.md +0 -0
  79. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.5.3.md +0 -0
  80. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.6.0.md +0 -0
  81. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.7.0.md +0 -0
  82. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.7.1.md +0 -0
  83. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.7.2.md +0 -0
  84. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.7.3.md +0 -0
  85. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.7.4.md +0 -0
  86. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.7.5.md +0 -0
  87. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.7.6.md +0 -0
  88. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.7.7.md +0 -0
  89. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.7.8.md +0 -0
  90. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/docs/releases/v0.8.0.md +0 -0
  91. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/setup.cfg +0 -0
  92. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/__main__.py +0 -0
  93. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/actors.py +0 -0
  94. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/artifacts.py +0 -0
  95. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/claims.py +0 -0
  96. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/daemon.py +0 -0
  97. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/envelope.py +0 -0
  98. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/environment.py +0 -0
  99. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/events.py +0 -0
  100. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/fsutil.py +0 -0
  101. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/git.py +0 -0
  102. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/gitignore.py +0 -0
  103. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/mailbox.py +0 -0
  104. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/query.py +0 -0
  105. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/redaction.py +0 -0
  106. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/replay.py +0 -0
  107. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/retention.py +0 -0
  108. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/secrets.py +0 -0
  109. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir/upgrade.py +0 -0
  110. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir_cli.egg-info/dependency_links.txt +0 -0
  111. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir_cli.egg-info/entry_points.txt +0 -0
  112. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir_cli.egg-info/requires.txt +0 -0
  113. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/src/agentdir_cli.egg-info/top_level.txt +0 -0
  114. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/tests/test_claim_polarity.py +0 -0
  115. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/tests/test_header_folding.py +0 -0
  116. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/tests/test_structured_claims.py +0 -0
  117. {agentdir_cli-0.8.0 → agentdir_cli-0.9.0}/tests/test_truncation.py +0 -0
  118. {agentdir_cli-0.8.0 → 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.8.0
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
@@ -81,7 +81,7 @@ AgentDir gives those answers a local, durable home.
81
81
  | Replayable sessions | Inspect the task, decisions, commands, outputs, blockers, summaries, and handoffs after the fact. |
82
82
  | Local-first storage | Records live in the repo-local `.agentdir` directory by default. No hosted service is required. |
83
83
  | Rebuildable memory | Raw event files are the source of truth. SQLite search and memory indexes can be rebuilt. |
84
- | 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. |
85
85
  | Cross-repo memory | Explicitly registered AgentDir roots can be searched together without moving canonical records. |
86
86
  | Secret-aware persistence | Common secret-like patterns are redacted before storage, with scan and cleanup commands for older records. |
87
87
 
@@ -107,10 +107,12 @@ Use AgentDir only when you want the trail.
107
107
  The agent handles the recording surface:
108
108
 
109
109
  ```bash
110
- 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"
111
113
  agentdir run -- pytest -q
112
114
  agentdir audit session
113
- agentdir work finish --json
115
+ agentdir work finish --json --brief
114
116
  ```
115
117
 
116
118
  ## Install
@@ -160,7 +162,7 @@ available automatically during coding tasks:
160
162
  Package page: [@jstxn/agentdir-pi](https://pi.dev/packages/@jstxn/agentdir-pi)
161
163
 
162
164
  ```bash
163
- pi install npm:@jstxn/agentdir-pi@0.8.0
165
+ pi install npm:@jstxn/agentdir-pi@0.9.0
164
166
  # or install directly from a local checkout / release tag:
165
167
  pi install /absolute/path/to/agentdir
166
168
  pi install git:github.com/jstxn/agentdir@<tag-or-commit>
@@ -183,7 +185,7 @@ Coding agents use the non-interactive form below so `.agentdir/` is ignored at
183
185
  the user level without creating a repository `.gitignore` change:
184
186
 
185
187
  ```bash
186
- agentdir adopt --gitignore user
188
+ agentdir adopt --if-needed --gitignore user
187
189
  ```
188
190
 
189
191
  This is intentionally boring setup. It prepares the repository once, then agents
@@ -275,6 +277,19 @@ fragmenting into one store per branch.
275
277
  Each worktree still keeps its own active session, so parallel agents in
276
278
  different worktrees do not overwrite each other.
277
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
+
278
293
  Two cases keep a store inside the worktree instead:
279
294
 
280
295
  ```bash
@@ -299,6 +314,12 @@ agentdir replay
299
314
  agentdir memory search "checkout failure"
300
315
  ```
301
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
+
302
323
  For final-answer support:
303
324
 
304
325
  ```bash
@@ -345,9 +366,11 @@ The important property is recoverability: deleting the derived index does not
345
366
  destroy the session. AgentDir can rebuild from the envelope store.
346
367
 
347
368
  The agent-facing report surface is JSON. `agentdir report final --format json`
348
- and `agentdir work finish --json` include an `agent_handoff` object with
349
- verification evidence, failed evidence, claim support, context lineage, known
350
- 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.
351
374
 
352
375
  ## Unique Capabilities
353
376
 
@@ -380,6 +403,11 @@ Recording a family again replaces its earlier claim, so a check re-run after a
380
403
  fix supersedes rather than accumulates. Claiming a failure honestly is
381
404
  `acknowledged` and does not count against the audit.
382
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
+
383
411
  A claim made in error can be withdrawn:
384
412
 
385
413
  ```bash
@@ -428,7 +456,52 @@ and checked against evidence like any other.
428
456
 
429
457
  ### Context Packs
430
458
 
431
- 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:
432
505
 
433
506
  ```bash
434
507
  agentdir context build "checkout failure" --emit
@@ -437,8 +510,18 @@ agentdir context cite --pack <pack-id>
437
510
  agentdir audit context --pack <pack-id>
438
511
  ```
439
512
 
440
- This does not prove a model paid attention, but it does make cooperative agent
441
- 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.
442
525
 
443
526
  ### Local Agent Memory
444
527
 
@@ -452,8 +535,12 @@ agentdir memory explain "release evidence"
452
535
  agentdir context build "release evidence" --emit
453
536
  ```
454
537
 
455
- Optional semantic extras exist, but the default path does not require a vector
456
- 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.
457
544
 
458
545
  ### Federated Memory
459
546
 
@@ -48,7 +48,7 @@ AgentDir gives those answers a local, durable home.
48
48
  | Replayable sessions | Inspect the task, decisions, commands, outputs, blockers, summaries, and handoffs after the fact. |
49
49
  | Local-first storage | Records live in the repo-local `.agentdir` directory by default. No hosted service is required. |
50
50
  | Rebuildable memory | Raw event files are the source of truth. SQLite search and memory indexes can be rebuilt. |
51
- | 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. |
52
52
  | Cross-repo memory | Explicitly registered AgentDir roots can be searched together without moving canonical records. |
53
53
  | Secret-aware persistence | Common secret-like patterns are redacted before storage, with scan and cleanup commands for older records. |
54
54
 
@@ -74,10 +74,12 @@ Use AgentDir only when you want the trail.
74
74
  The agent handles the recording surface:
75
75
 
76
76
  ```bash
77
- 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"
78
80
  agentdir run -- pytest -q
79
81
  agentdir audit session
80
- agentdir work finish --json
82
+ agentdir work finish --json --brief
81
83
  ```
82
84
 
83
85
  ## Install
@@ -127,7 +129,7 @@ available automatically during coding tasks:
127
129
  Package page: [@jstxn/agentdir-pi](https://pi.dev/packages/@jstxn/agentdir-pi)
128
130
 
129
131
  ```bash
130
- pi install npm:@jstxn/agentdir-pi@0.8.0
132
+ pi install npm:@jstxn/agentdir-pi@0.9.0
131
133
  # or install directly from a local checkout / release tag:
132
134
  pi install /absolute/path/to/agentdir
133
135
  pi install git:github.com/jstxn/agentdir@<tag-or-commit>
@@ -150,7 +152,7 @@ Coding agents use the non-interactive form below so `.agentdir/` is ignored at
150
152
  the user level without creating a repository `.gitignore` change:
151
153
 
152
154
  ```bash
153
- agentdir adopt --gitignore user
155
+ agentdir adopt --if-needed --gitignore user
154
156
  ```
155
157
 
156
158
  This is intentionally boring setup. It prepares the repository once, then agents
@@ -242,6 +244,19 @@ fragmenting into one store per branch.
242
244
  Each worktree still keeps its own active session, so parallel agents in
243
245
  different worktrees do not overwrite each other.
244
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
+
245
260
  Two cases keep a store inside the worktree instead:
246
261
 
247
262
  ```bash
@@ -266,6 +281,12 @@ agentdir replay
266
281
  agentdir memory search "checkout failure"
267
282
  ```
268
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
+
269
290
  For final-answer support:
270
291
 
271
292
  ```bash
@@ -312,9 +333,11 @@ The important property is recoverability: deleting the derived index does not
312
333
  destroy the session. AgentDir can rebuild from the envelope store.
313
334
 
314
335
  The agent-facing report surface is JSON. `agentdir report final --format json`
315
- and `agentdir work finish --json` include an `agent_handoff` object with
316
- verification evidence, failed evidence, claim support, context lineage, known
317
- 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.
318
341
 
319
342
  ## Unique Capabilities
320
343
 
@@ -347,6 +370,11 @@ Recording a family again replaces its earlier claim, so a check re-run after a
347
370
  fix supersedes rather than accumulates. Claiming a failure honestly is
348
371
  `acknowledged` and does not count against the audit.
349
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
+
350
378
  A claim made in error can be withdrawn:
351
379
 
352
380
  ```bash
@@ -395,7 +423,52 @@ and checked against evidence like any other.
395
423
 
396
424
  ### Context Packs
397
425
 
398
- 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:
399
472
 
400
473
  ```bash
401
474
  agentdir context build "checkout failure" --emit
@@ -404,8 +477,18 @@ agentdir context cite --pack <pack-id>
404
477
  agentdir audit context --pack <pack-id>
405
478
  ```
406
479
 
407
- This does not prove a model paid attention, but it does make cooperative agent
408
- 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.
409
492
 
410
493
  ### Local Agent Memory
411
494
 
@@ -419,8 +502,12 @@ agentdir memory explain "release evidence"
419
502
  agentdir context build "release evidence" --emit
420
503
  ```
421
504
 
422
- Optional semantic extras exist, but the default path does not require a vector
423
- 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.
424
511
 
425
512
  ### Federated Memory
426
513
 
@@ -30,7 +30,7 @@ agentdir adopt
30
30
  For agent-driven, non-interactive setup, make the ignore destination explicit:
31
31
 
32
32
  ```bash
33
- agentdir adopt --gitignore user
33
+ agentdir adopt --if-needed --gitignore user
34
34
  ```
35
35
 
36
36
  This keeps `.agentdir/` out of Git across repositories without changing a
@@ -62,17 +62,28 @@ The user should not have to operate AgentDir during a normal coding session. Onc
62
62
 
63
63
  Agent responsibilities:
64
64
 
65
- - run `agentdir work start "<task>" --emit-context` when coding work begins
66
- - run `agentdir adopt --gitignore user` once if the repository has not been prepared yet
65
+ - probe with `agentdir root --require --quiet`; a zero exit means an initialized
66
+ local or shared linked-worktree store is ready, even if this checkout has no
67
+ physical `.agentdir`
68
+ - if the probe exits 3, run `agentdir adopt --if-needed --gitignore user`; add
69
+ `--no-hooks` if a restricted linked worktree cannot write the shared Git hooks
70
+ directory
71
+ - run `agentdir work start "<task>"` when coding work begins; it persists a bounded context briefing by default
72
+ - read its bounded context briefing and record either useful numbered sources
73
+ or a reasoned no-relevant decision with `agentdir work context`
74
+ - treat briefing excerpts as previews; prefer `agentdir work context --expand
75
+ <number>` before marking a source used when implementation details, patterns,
76
+ or exact evidence matter
67
77
  - use `agentdir status` when a single health view is needed
68
- - emit context packs when retrieved context materially informs the work
69
- - record which context sources were consumed and cited when reporting lineage
78
+ - use `--skip --reason` only when the context briefing cannot be reviewed, so
79
+ the final handoff keeps the gap visible
80
+ - cite only context sources actually used when reporting lineage
70
81
  - wrap evidence-bearing commands with `agentdir run`
71
82
  - use plain shell commands for routine exploration and file reads
72
83
  - record important blockers, decisions, and handoffs
73
84
  - use `agentdir evidence --brief` and `agentdir timeline` to skim the trail
74
85
  - use `agentdir report final --format json` to preview the agent handoff object
75
- - use `agentdir work finish --json` before final claims when practical
86
+ - use `agentdir work finish --json --brief` before final claims when practical
76
87
 
77
88
  Human responsibilities:
78
89
 
@@ -96,10 +107,46 @@ agentdir memory backend list
96
107
  agentdir memory daemon status
97
108
  ```
98
109
 
99
- `agentdir memory search` incrementally updates the index by default (new and deleted envelopes only; pass `--no-rebuild` to skip even that), then ranks matching envelopes and derived session summaries by vector similarity. `agentdir memory explain` shows why a hit matched. `agentdir context build` combines memory, current-session evidence, and recent session summaries into an agent-ready context pack. The raw Maildir envelopes remain the source of truth, so the memory layer can always be deleted and rebuilt.
110
+ `agentdir memory search` incrementally updates the index by default (new and deleted envelopes only; pass `--no-rebuild` to skip even that), then ranks matching envelopes and derived session summaries by vector similarity. `agentdir memory explain` shows why a hit matched. `work start` removes generic task words and the workspace name from its retrieval query, diversifies candidates, and prints at most five sources with match quality. Full IDs, scores, and match reasons remain in JSON. `agentdir context build` combines memory, current-session evidence, and recent session summaries into an agent-ready context pack. The raw Maildir envelopes remain the source of truth, so the memory layer can always be deleted and rebuilt.
100
111
 
101
- When retrieved context materially influences a plan, tool call, answer, or handoff,
102
- emit an auditable context pack:
112
+ The normal read-and-decide flow is:
113
+
114
+ ```bash
115
+ agentdir work start "checkout failure tests"
116
+ agentdir work context --expand 1
117
+ # continue a long source: agentdir work context --expand 1 --page 2
118
+ agentdir work context --use 1 --reason "prior checkout failure constrains the plan"
119
+ # or: agentdir work context --none-relevant --reason "only generic matches"
120
+ # after a restart or lost output: agentdir work context --show
121
+ ```
122
+
123
+ The briefing source numbers are pack-local selectors; full source IDs stay in
124
+ JSON, and retrieved-but-omitted IDs stay on the lower-level interface. A used decision reviews
125
+ the entire bounded briefing, records selected sources as used, and marks the
126
+ other presented sources dismissed. A no-relevant decision reviews and dismisses
127
+ the entire briefing without manufacturing consumption or citation. A non-empty
128
+ briefing remains pending until one of those decisions, or an explicit skipped
129
+ review, is recorded. The terminal decision is serialized and idempotent, so
130
+ concurrent identical declarations produce one record and conflicting later
131
+ declarations are rejected.
132
+
133
+ Expansion is a nonterminal read, not a disposition. It maps the exact displayed
134
+ ordinal back to the persisted manifest, resolves local messages, derived
135
+ summaries, or currently registered federated roots, checks captured hashes,
136
+ redacts the delivered representation, and returns at most 4096 UTF-8 bytes per
137
+ page. A changed or unavailable source falls back to the stored manifest preview
138
+ with an explicit integrity state instead of silently showing current content as
139
+ captured history.
140
+
141
+ Canonical reads made while the pack's session is active emit deterministic,
142
+ metadata-only `context.sources.expanded` receipts. Repeating a page is
143
+ idempotent; ended and archived pack reads remain read-only. Receipt bodies never
144
+ contain source content, are excluded from vector memory and summary excerpts,
145
+ and cannot change review status, decision IDs, lineage validity, or finish
146
+ eligibility. The audit funnel adds expansion counts before and after the
147
+ decision plus used sources that had no prior expansion.
148
+
149
+ For lower-level explicit pack handling:
103
150
 
104
151
  ```bash
105
152
  agentdir context build "checkout failure tests" --emit --json
@@ -108,10 +155,20 @@ agentdir context cite --pack <pack-id> --source <source-id>
108
155
  agentdir audit context --pack <pack-id>
109
156
  ```
110
157
 
111
- The emitted pack stores a JSON source manifest as a content-addressed artifact.
112
- Consumption and citation events are append-only records that connect retrieval to
113
- later work. This is an advisory audit trail for cooperative agents; evidence
114
- claims still need evidence rows and fresh verification.
158
+ Consuming every presented source through this lower-level path satisfies the
159
+ compatibility review. Partial legacy consumption can finish with a visible
160
+ `compatibility_partial` warning instead of requiring false use. New review-aware
161
+ packs reject cite-before-use; legacy v1 packs keep their historical citation
162
+ behavior without turning old sessions into new strict-audit failures.
163
+
164
+ The emitted pack stores a JSON source manifest and its bounded presentation as a
165
+ content-addressed artifact. Review, consumption, and citation events are
166
+ append-only records. Audits, status, and handoffs expose retrieved, presented,
167
+ reviewed, used, dismissed, pending, and cited counts; consumption outside the
168
+ bounded briefing is reported separately. Citation defaults only to
169
+ used sources and remains optional. This is an advisory audit trail for
170
+ cooperative agents; evidence claims still need evidence rows and fresh
171
+ verification.
115
172
 
116
173
  For cross-repo memory, register roots explicitly:
117
174
 
@@ -133,7 +190,7 @@ For repeated cross-repo work, create a group and use it as the memory plane:
133
190
  ```bash
134
191
  agentdir roots group create product-work --member root-abc123def456
135
192
  agentdir memory search --group product-work "checkout failure tests"
136
- agentdir work start "checkout failure tests" --group product-work --emit-context
193
+ agentdir work start "checkout failure tests" --group product-work
137
194
  ```
138
195
 
139
196
  Warm indexing is opt-in. Use it when repeated cross-repo or large-store work
@@ -145,16 +202,20 @@ agentdir memory daemon status
145
202
  agentdir memory daemon stop
146
203
  ```
147
204
 
148
- Optional semantic retrieval is also opt-in:
205
+ Optional semantic retrieval is configuration-gated:
149
206
 
150
207
  ```bash
151
208
  agentdir memory embeddings configure fastembed --model BAAI/bge-small-en-v1.5
152
209
  agentdir memory backend configure sqlite-vec
153
- agentdir memory search --retrieval semantic "checkout failure tests"
210
+ agentdir memory search "checkout failure tests"
154
211
  ```
155
212
 
156
- If the optional dependencies are missing, AgentDir reports that clearly and keeps
157
- the default local hybrid retriever active.
213
+ After configuration, automatic `work start`, context building, memory search,
214
+ and memory explanation fuse semantic and lexical signals. Use
215
+ `--retrieval semantic`, `--retrieval hybrid`, or `--retrieval document` only to
216
+ force a diagnostic comparison. If optional dependencies are missing, automatic
217
+ mode keeps the local hybrid retriever active; an explicitly forced semantic
218
+ request still reports the missing dependency clearly.
158
219
 
159
220
  ## Capturing Tool Calls And Results
160
221
 
@@ -232,7 +293,7 @@ agentdir replay --session "$(agentdir session current)"
232
293
  Agents should end the session when the task is done:
233
294
 
234
295
  ```bash
235
- agentdir work finish --json
296
+ agentdir work finish --json --brief
236
297
  ```
237
298
 
238
299
  ## Store Hygiene
@@ -262,7 +323,7 @@ Hook records use the active session when one exists. If no session is active, Ag
262
323
 
263
324
  ## Agent Guidance
264
325
 
265
- The generated Codex skill and project guidance tell coding agents that AgentDir is their responsibility, not a user checklist. They instruct agents to start with `work start`, use `status`, search and explain memory, wrap commands with `agentdir run`, emit important evidence, audit session quality and final claims when useful, and close with `work finish` when practical.
326
+ The generated Codex skill and project guidance tell coding agents that AgentDir is their responsibility, not a user checklist. They instruct agents to probe the resolved store instead of checking for a physical `.agentdir`, adopt only when needed, start with `work start`, read and decide on the bounded briefing, use `status`, search and explain memory, wrap commands with `agentdir run`, emit important evidence, audit session quality and final claims when useful, and close with `work finish` when practical.
266
327
 
267
328
  ```bash
268
329
  agentdir integrations install all --target project