@jstxn/agentdir-pi 0.7.3

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AgentDir Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,358 @@
1
+ # AgentDir
2
+
3
+ <p align="center">
4
+ <img src="docs/assets/agentdir-overview.png" alt="AgentDir turns agent work into a saved trail, searchable memory, and proof for engineers." />
5
+ </p>
6
+
7
+ <p align="center">
8
+ <strong>Local-first memory and evidence for agentic engineering.</strong>
9
+ </p>
10
+
11
+ AgentDir is a flight recorder for coding agents. It lets agents record what
12
+ happened during a software task, then gives engineers a clean way to inspect,
13
+ replay, search, and audit that work later.
14
+
15
+ The goal is simple: AgentDir should be nearly invisible while you work.
16
+
17
+ Engineers should not have to manually start sessions, wrap commands, collect
18
+ evidence, or maintain agent memory by hand. Once a repository is adopted, the
19
+ agent operates AgentDir in the background and leaves behind a useful trail.
20
+
21
+ ## Why AgentDir Exists
22
+
23
+ Agentic engineering has a trust gap.
24
+
25
+ Agents can edit code, run tools, and summarize results, but their work often
26
+ ends up scattered across chat history, terminal scrollback, temporary files, and
27
+ unverified final claims. That makes it hard to answer basic questions:
28
+
29
+ - What did the agent actually do?
30
+ - Which commands support the final answer?
31
+ - Were tests, builds, lint, or release checks really run?
32
+ - What context did the agent retrieve and rely on?
33
+ - Can a future agent learn from this session?
34
+ - Can the index or memory layer be rebuilt if it breaks?
35
+
36
+ AgentDir gives those answers a local, durable home.
37
+
38
+ ## What You Get
39
+
40
+ | Capability | What it means |
41
+ | --- | --- |
42
+ | Invisible agent workflow | Agents run AgentDir commands during normal work, so engineers keep using their coding assistant normally. |
43
+ | Evidence-backed claims | Test, build, lint, typecheck, doctor, and release claims can be checked against recorded tool results. |
44
+ | Replayable sessions | Inspect the task, decisions, commands, outputs, blockers, summaries, and handoffs after the fact. |
45
+ | Local-first storage | Records live in the repo-local `.agentdir` directory by default. No hosted service is required. |
46
+ | 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. |
48
+ | Cross-repo memory | Explicitly registered AgentDir roots can be searched together without moving canonical records. |
49
+ | Secret-aware persistence | Common secret-like patterns are redacted before storage, with scan and cleanup commands for older records. |
50
+
51
+ ## The Invisible Workflow
52
+
53
+ AgentDir is designed around a small separation of responsibility.
54
+
55
+ | Human does | Agent does |
56
+ | --- | --- |
57
+ | Install AgentDir once. | Start and finish AgentDir sessions. |
58
+ | Run `agentdir adopt` once per repo. | Capture evidence-bearing commands with `agentdir run`. |
59
+ | Ask the coding agent to do work. | Record decisions, blockers, context, and handoffs. |
60
+ | Inspect evidence only when needed. | Audit session quality and final claims before reporting. |
61
+
62
+ In day-to-day use, the human workflow stays the same:
63
+
64
+ ```text
65
+ Ask the agent to do the task.
66
+ Review the result.
67
+ Use AgentDir only when you want the trail.
68
+ ```
69
+
70
+ The agent handles the recording surface:
71
+
72
+ ```bash
73
+ agentdir work start "fix checkout failure" --emit-context
74
+ agentdir run -- pytest -q
75
+ agentdir audit session
76
+ agentdir work finish --json
77
+ ```
78
+
79
+ ## Install
80
+
81
+ AgentDir is distributed through GitHub Releases. For the private
82
+ `jstxn/agentdir` repo, authenticate GitHub CLI first:
83
+
84
+ ```bash
85
+ gh auth login
86
+ ```
87
+
88
+ Install the latest release:
89
+
90
+ ```bash
91
+ gh api -H "Accept: application/vnd.github.raw" \
92
+ 'repos/jstxn/agentdir/contents/scripts/install.sh?ref=v0.7.3' | bash
93
+ ```
94
+
95
+ The installer uses `pipx` when available. Otherwise it creates a self-contained
96
+ virtual environment under `~/.local/share/agentdir` and links the CLI into
97
+ `~/.local/bin`.
98
+
99
+ Verify:
100
+
101
+ ```bash
102
+ agentdir --version
103
+ agentdir --help
104
+ ```
105
+
106
+ ## Pi Package
107
+
108
+ Pi users can install this repository as a Pi package so the AgentDir skill is
109
+ available automatically during coding tasks:
110
+
111
+ ```bash
112
+ pi install npm:@jstxn/agentdir-pi@0.7.3
113
+ # or install directly from a local checkout / release tag:
114
+ pi install /absolute/path/to/agentdir
115
+ pi install git:github.com/jstxn/agentdir@<tag-or-commit>
116
+ ```
117
+
118
+ The package exposes `skills/agentdir/SKILL.md`; it teaches Pi to start AgentDir
119
+ sessions, wrap evidence-bearing commands, use local memory/context packs, and
120
+ produce evidence-aware handoffs. See [AgentDir Pi Package](docs/PI_PACKAGE.md)
121
+ for details.
122
+
123
+ ## Adopt A Repository
124
+
125
+ Run once from a git repository:
126
+
127
+ ```bash
128
+ agentdir adopt
129
+ ```
130
+
131
+ This is intentionally boring setup. It prepares the repository once, then agents
132
+ operate AgentDir during normal coding work:
133
+
134
+ - creates the repo-local `.agentdir` store
135
+ - installs AgentDir-managed git hook shims
136
+ - installs the Codex skill into the user skill directory
137
+ - writes managed project guidance for common agent tools
138
+ - asks interactive users whether `.agentdir/` should be added to the project or
139
+ user-level Git ignore file
140
+ - runs `doctor` to confirm the store is healthy
141
+
142
+ After that, agents have the guidance they need to use AgentDir without the
143
+ engineer manually operating it during normal work.
144
+
145
+ Preview setup without writing anything:
146
+
147
+ ```bash
148
+ agentdir adopt --dry-run --json
149
+ ```
150
+
151
+ If you want generated integration files to stay inside the AgentDir store
152
+ instead of project instruction files:
153
+
154
+ ```bash
155
+ agentdir adopt --install-skill store --install-generic store --integration-target store
156
+ ```
157
+
158
+ For non-interactive installs, choose the ignore destination explicitly:
159
+
160
+ ```bash
161
+ agentdir adopt --gitignore project # write <repo>/.gitignore
162
+ agentdir adopt --gitignore user # write the user-level Git excludes file
163
+ agentdir adopt --gitignore none # leave ignore files unchanged
164
+ ```
165
+
166
+ Undo managed setup while keeping the `.agentdir` evidence store:
167
+
168
+ ```bash
169
+ agentdir unadopt # dry-run
170
+ agentdir unadopt --apply # remove managed hooks and guidance
171
+ ```
172
+
173
+ ## What Gets Written
174
+
175
+ Default adoption writes only local files:
176
+
177
+ ```text
178
+ <repo>/.agentdir/ # evidence, artifacts, indexes, state
179
+ <repo>/.git/hooks/* # managed hook shims with backups
180
+ <repo>/AGENTS.md # generic / Codex-readable guidance
181
+ <repo>/CLAUDE.md # Claude Code guidance
182
+ <repo>/.github/copilot-instructions.md # Copilot guidance
183
+ <repo>/.cursor/rules/agentdir.mdc # Cursor guidance
184
+ <repo>/.windsurf/rules/agentdir.md # Windsurf guidance
185
+ ~/.codex/skills/agentdir/SKILL.md # Codex skill, by default
186
+ ```
187
+
188
+ Managed guidance is wrapped in AgentDir markers. Existing unmanaged content is
189
+ preserved where the target format supports managed blocks.
190
+
191
+ ## Inspect A Session
192
+
193
+ Most users will not need these commands every day, but they are the reason
194
+ AgentDir exists.
195
+
196
+ ```bash
197
+ agentdir status
198
+ agentdir evidence --brief
199
+ agentdir timeline
200
+ agentdir report final --format json
201
+ agentdir replay
202
+ agentdir memory search "checkout failure"
203
+ ```
204
+
205
+ For final-answer support:
206
+
207
+ ```bash
208
+ agentdir audit session
209
+ agentdir audit claims --text final-response.md
210
+ ```
211
+
212
+ Audits are advisory by default. Use `--strict` when unsupported or contradicted
213
+ claims should fail a check.
214
+
215
+ ## How AgentDir Works
216
+
217
+ AgentDir has one source of truth and several rebuildable views:
218
+
219
+ ```text
220
+ raw envelopes -> SQLite index -> memory/search/audit/report
221
+ ^
222
+ |
223
+ rebuilt from envelopes
224
+ ```
225
+
226
+ 1. **Raw envelopes**
227
+ Each meaningful event is stored as an immutable file in a Maildir-inspired
228
+ directory layout. These files are the source of truth.
229
+ 2. **Derived indexes**
230
+ SQLite indexes, search tables, memory passages, context packs, and audit
231
+ views are derived from the raw event files and can be rebuilt.
232
+
233
+ Default project layout:
234
+
235
+ ```text
236
+ <repo>/.agentdir/
237
+ sessions/
238
+ actors/
239
+ artifacts/
240
+ archives/
241
+ indexes/agentdir.sqlite3
242
+ state/
243
+ integrations/
244
+ ```
245
+
246
+ The important property is recoverability: deleting the derived index does not
247
+ destroy the session. AgentDir can rebuild from the envelope store.
248
+
249
+ The agent-facing report surface is JSON. `agentdir report final --format json`
250
+ and `agentdir work finish --json` include an `agent_handoff` object with
251
+ verification evidence, failed evidence, claim support, context lineage, known
252
+ gaps, and recommended next agent actions.
253
+
254
+ ## Unique Capabilities
255
+
256
+ ### Claims-To-Evidence Checks
257
+
258
+ AgentDir can compare final-response claims such as "tests passed" or "build
259
+ passed" against the latest recorded tool results. It does this with
260
+ deterministic heuristics, not an LLM.
261
+
262
+ Supported claim families:
263
+
264
+ - test
265
+ - lint
266
+ - typecheck
267
+ - build
268
+ - doctor
269
+ - release
270
+
271
+ ### Context Packs
272
+
273
+ Agents can package retrieved context into auditable source manifests:
274
+
275
+ ```bash
276
+ agentdir context build "checkout failure" --emit
277
+ agentdir context consume --pack <pack-id> --source <source-id> --purpose plan
278
+ agentdir context cite --pack <pack-id>
279
+ agentdir audit context --pack <pack-id>
280
+ ```
281
+
282
+ This does not prove a model paid attention, but it does make cooperative agent
283
+ behavior visible.
284
+
285
+ ### Local Agent Memory
286
+
287
+ AgentDir builds searchable local memory from prior sessions. Agents can search
288
+ similar work, explain why a memory hit matched, and include relevant history in
289
+ new context packs.
290
+
291
+ ```bash
292
+ agentdir memory search "release evidence"
293
+ agentdir memory explain "release evidence"
294
+ agentdir context build "release evidence" --emit
295
+ ```
296
+
297
+ Optional semantic extras exist, but the default path does not require a vector
298
+ database or external embedding service.
299
+
300
+ ### Federated Memory
301
+
302
+ For multi-repo work, AgentDir can search explicitly registered roots:
303
+
304
+ ```bash
305
+ agentdir roots register ../other-repo --name other-repo
306
+ agentdir memory search --federated "release evidence"
307
+ ```
308
+
309
+ Each repository remains the canonical owner of its own `.agentdir` store.
310
+
311
+ ## Safety Model
312
+
313
+ AgentDir is local-first and advisory by design.
314
+
315
+ - It records what agents choose to record.
316
+ - It does not replace code review or CI.
317
+ - It does not send data to a hosted AgentDir service.
318
+ - It treats raw envelopes as the source of truth.
319
+ - It redacts common secret-like patterns before persistence.
320
+ - It provides `secrets scan` and `secrets redact --apply` for cleanup.
321
+
322
+ Useful commands:
323
+
324
+ ```bash
325
+ agentdir doctor
326
+ agentdir secrets scan
327
+ agentdir secrets redact
328
+ agentdir secrets redact --apply
329
+ ```
330
+
331
+ ## Upgrade And Rollback
332
+
333
+ Upgrade an existing install and refresh current repo adoption:
334
+
335
+ ```bash
336
+ agentdir --upgrade
337
+ ```
338
+
339
+ Rollback to the previous stable release:
340
+
341
+ ```bash
342
+ gh api -H "Accept: application/vnd.github.raw" \
343
+ 'repos/jstxn/agentdir/contents/scripts/rollback.sh?ref=v0.7.3' | bash
344
+ ```
345
+
346
+ ## Learn More
347
+
348
+ - [Install Guide](docs/INSTALL.md)
349
+ - [Agentic Coding Guide](docs/AGENTIC_CODING.md)
350
+ - [Technical Brief](docs/TECH_BRIEF.md)
351
+ - [Release Guide](docs/RELEASING.md)
352
+ - [PRD](docs/PRD.md)
353
+
354
+ ## Project Status
355
+
356
+ AgentDir is beta software for local-first agentic engineering workflows. The
357
+ core model is stable: agents operate the recorder, engineers get the evidence,
358
+ and raw local envelopes remain the recoverable source of truth.
@@ -0,0 +1,64 @@
1
+ # AgentDir Pi Package
2
+
3
+ AgentDir ships a Pi package so Pi can load AgentDir guidance as an Agent Skill.
4
+ The package currently exposes one skill:
5
+
6
+ ```text
7
+ skills/agentdir/SKILL.md
8
+ ```
9
+
10
+ The skill teaches Pi to start AgentDir sessions, wrap evidence-bearing shell
11
+ commands, use local memory/context packs, and produce evidence-aware handoffs.
12
+ It does not install the `agentdir` CLI; install AgentDir separately first.
13
+
14
+ ## Install
15
+
16
+ From a local checkout:
17
+
18
+ ```bash
19
+ pi install /absolute/path/to/agentdir
20
+ ```
21
+
22
+ Temporarily for one Pi run:
23
+
24
+ ```bash
25
+ pi -e /absolute/path/to/agentdir
26
+ ```
27
+
28
+ From git, pin a tag or commit that contains the Pi package files:
29
+
30
+ ```bash
31
+ pi install git:github.com/jstxn/agentdir@<tag-or-commit>
32
+ ```
33
+
34
+ If the npm package has been published:
35
+
36
+ ```bash
37
+ pi install npm:@jstxn/agentdir-pi@0.7.3
38
+ ```
39
+
40
+ Use `pi config` to enable or disable the bundled skill after installation.
41
+
42
+ ## Package Manifest
43
+
44
+ The root `package.json` declares the Pi resources:
45
+
46
+ ```json
47
+ {
48
+ "keywords": ["pi-package"],
49
+ "pi": {
50
+ "skills": ["./skills"],
51
+ "image": "https://raw.githubusercontent.com/jstxn/agentdir/v0.7.3/docs/assets/agentdir-overview.png"
52
+ }
53
+ }
54
+ ```
55
+
56
+ The `pi-package` keyword makes the package discoverable by the Pi package
57
+ gallery, `pi.skills` points Pi at the skill directory, and `pi.image` gives the
58
+ gallery a preview image from this repository.
59
+
60
+ ## Release Notes
61
+
62
+ - Keep the npm package version aligned with the AgentDir release version.
63
+ - Before publishing, run `npm pack --dry-run` and confirm the tarball includes
64
+ `package.json`, `skills/agentdir/SKILL.md`, `README.md`, and `LICENSE`.
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@jstxn/agentdir-pi",
3
+ "version": "0.7.3",
4
+ "description": "Pi package for AgentDir local-first coding-agent memory and evidence capture.",
5
+ "license": "MIT",
6
+ "keywords": [
7
+ "pi-package",
8
+ "agentdir",
9
+ "agent-skills",
10
+ "coding-agent",
11
+ "evidence",
12
+ "local-first"
13
+ ],
14
+ "homepage": "https://github.com/jstxn/agentdir#readme",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/jstxn/agentdir.git"
18
+ },
19
+ "bugs": {
20
+ "url": "https://github.com/jstxn/agentdir/issues"
21
+ },
22
+ "files": [
23
+ "skills",
24
+ "docs/PI_PACKAGE.md",
25
+ "README.md",
26
+ "LICENSE"
27
+ ],
28
+ "pi": {
29
+ "skills": [
30
+ "./skills"
31
+ ],
32
+ "image": "https://raw.githubusercontent.com/jstxn/agentdir/v0.7.3/docs/assets/agentdir-overview.png"
33
+ }
34
+ }
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: agentdir
3
+ description: Use AgentDir as a local-first flight recorder for non-trivial coding-agent work in software repositories. Load at the start of coding tasks, before tests/lint/build/typecheck, and when asked about AgentDir evidence, audits, session replay, memory, context packs, adoption, or handoffs.
4
+ license: MIT
5
+ compatibility: Requires the agentdir CLI on PATH; works best inside a git repository.
6
+ ---
7
+
8
+ # AgentDir for Pi
9
+
10
+ AgentDir is local-first memory and evidence capture for agentic engineering. Use it as agent-owned background instrumentation: the engineer should not have to start sessions, wrap checks, collect evidence, or maintain memory by hand during normal coding work.
11
+
12
+ This Pi package teaches Pi how to operate AgentDir. It does not install the `agentdir` CLI. If `agentdir` is not on `PATH`, tell the user AgentDir needs to be installed and continue without recording unless they ask you to set it up.
13
+
14
+ ## Safety Rules
15
+
16
+ - Do not record secrets, private keys, raw environment dumps, or credential-bearing command output.
17
+ - If `agentdir doctor` reports secret-like persisted bodies, do not print those bodies. Use `agentdir secrets scan` for path-only triage and `agentdir secrets redact --apply` only when cleanup is approved.
18
+ - Use Pi's normal file tools for reading and editing files. `agentdir run --` wraps shell commands only; it does not wrap Pi `read`, `edit`, or `write` tool calls.
19
+
20
+ ## Start Work
21
+
22
+ At the start of a non-trivial coding task in a software repository:
23
+
24
+ 1. If `.agentdir` is missing, run `agentdir adopt` once before work begins.
25
+ 2. Start the session with `agentdir work start "<short task>" --emit-context`.
26
+ 3. Keep any returned context pack id/source ids if you plan to cite or consume retrieved context later.
27
+
28
+ Use `agentdir status` when you need one compact view of the active session, evidence, memory, context, registered roots, and doctor health.
29
+
30
+ ## Evidence-Bearing Commands
31
+
32
+ Run evidence-bearing shell commands through AgentDir:
33
+
34
+ ```bash
35
+ agentdir run -- pytest -q
36
+ agentdir run -- npm test
37
+ agentdir run -- npm run lint
38
+ agentdir run -- npm run typecheck
39
+ agentdir run -- npm run build
40
+ ```
41
+
42
+ Evidence-bearing commands include tests, lint, typecheck, build, release checks, reproduced failures, doctor checks, and diagnostics used to support final claims.
43
+
44
+ Do not wrap routine exploration commands such as `rg`, `sed`, `nl`, `cat`, `ls`, `find`, or quick read-only `git status` checks. Use plain shell commands for reading files, mapping code, and gathering low-level context.
45
+
46
+ Use `agentdir evidence --brief` and `agentdir timeline` to skim what has been recorded.
47
+
48
+ ## Context And Memory
49
+
50
+ - `agentdir work start "<task>" --emit-context` is the normal entry point.
51
+ - Use `agentdir context build "<task>" --emit` when retrieved context should become an auditable context pack.
52
+ - Use `agentdir context consume --pack <pack-id> --source <source-id> --purpose plan|tool|answer|handoff` when you rely on retrieved context.
53
+ - Use `agentdir context cite --pack <pack-id>` or `agentdir audit context --pack <pack-id>` when reporting source lineage.
54
+ - Use `agentdir memory search "<task, error, or subsystem>"` and `agentdir memory explain "<same query>"` when prior local work may help.
55
+ - Use `agentdir roots suggest` and `agentdir roots doctor` to inspect cross-repo memory. Register roots only when cross-repo memory is explicitly requested or clearly part of the task.
56
+
57
+ Emit important plans, blockers, diffs, review decisions, and final handoffs as immutable events when they matter for future replay or audit.
58
+
59
+ ## Finish Work
60
+
61
+ Before the final response, run `agentdir work finish --json` when practical. Read the `agent_handoff` object before making final verification claims.
62
+
63
+ If you need to preview the final handoff without ending the active session, run `agentdir report final --format json` instead.
64
+
65
+ Before claiming tests, builds, lint, typecheck, hooks, release checks, or doctor checks passed, verify the latest recorded evidence with `agentdir evidence --brief`.