@roodriigoooo/trail
Trail: session artifacts and fresh-session checkpoints for Pi
Package details
Install @roodriigoooo/trail from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@roodriigoooo/trail- Package
@roodriigoooo/trail- Version
0.1.4- Published
- May 3, 2026
- Downloads
- 179/mo · 179/wk
- Author
- roodriigoooo
- License
- MIT
- Types
- extension
- Size
- 2.9 MB
- Dependencies
- 0 dependencies · 3 peers
Pi manifest JSON
{
"extensions": [
"./extensions/trail.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
trail for pi
this is a little pi extension for keeping track of the useful things that happen during a coding session.
my goal is to make session context less magical and less lossy. when i am working with an agent, i often want to grab the one command that worked, the file that was just edited, the short list of errors i already hit, or the decision that finally made the implementation click. i do not always want the whole conversation. i want the trail.
Trail turns commands, errors, file operations, code blocks, prompts, responses, and checkpoints into things you can browse, inspect, copy, reference, and package into a handoff for a fresh session.
it is not meant to be history search. it is more like a small artifact navigator and checkpoint tool for agent work.
why i made this
some of the situations that inspired it:
- wanting to see a created or edited file one more time without digging through the transcript
- wanting a short list of errors triggered during the session
- wanting to find that one command that worked, and not rerun the five that did not
- wanting to carry only the useful state into a new session
- wanting to hand off a debugging session with the dead ends included
- wanting to package a review, repro, or compact continuation note before context gets too noisy
- wanting to switch models or start fresh without losing the actual work trail
Claude Code's /compact was also a big inspiration. unlike /compact, which compresses the current conversation, Trail lets users navigate, select, verify, and package the exact commands, errors, files, decisions, dead ends, and next steps needed to continue work in a fresh session.
| Feature | /compact |
Trail |
|---|---|---|
| Compress current conversation | Yes | Yes, optionally |
| Navigate session artifacts | Limited | Yes |
| Select exact artifacts to preserve | Limited | Yes |
| Preserve exact commands/errors/files | Not guaranteed | Yes |
| Save durable checkpoints | Not the main model | Yes |
| Resume in another session/model/tool | Limited | Yes |
| Edit handoff before reuse | Not the core workflow | Yes |
| Track dead ends / already tried | Not guaranteed | Yes |
| Create debug/review/repro handoffs | No | Yes |
install
from GitHub while Trail is moving fast:
pi install git:github.com/roodriigoooo/trail
pinned GitHub release:
pi install git:github.com/roodriigoooo/trail@v0.1.3
from npm:
pi install npm:@roodriigoooo/trail
example usage
open the artifact navigator:
/trail
search the current session artifacts:
/trail search migration failed
search returns ranked artifacts, not raw grep lines. Trail favours errors, files, and commands before transcript-like matches.
create a handoff checkpoint:
/trail checkpoint --handoff finish the checkpoint store refactor
create a one-time debug checkpoint that deletes itself after resume:
/trail checkpoint --debug --once --raw investigate failing ci
continue from the latest checkpoint in a fresh session:
/trail continue last
examples to get the idea across
Trail in motion
commands
/trail— open artifact navigator/trail search <query>— search ranked artifact docs, then browse matches/trail checkpoint [--handoff|--compact|--debug|--review] [--once] [--raw] [--model <provider/model>] [--max-output <tokens>] [--] [note]— review selected artifacts, then create editable summarized checkpoint/trail continue [id|last]— choose or start from a checkpoint in a fresh session/trail resume [id|last]— alias for continue/trail load [id|last] [--include-consumed]— load a prior checkpoint's artifacts into the navigator without spending model-context tokens/trail unload <id|all>— drop a loaded checkpoint from the session/trail delete [id|last]— permanently delete a checkpoint (bypasses soft-consume)/trail list [--include-consumed]— list checkpoints/trail ref <artifact-id-or-ref>— inject compact artifact reference/trail inject <artifact-id-or-ref>— alias forref/trail inject-full <artifact-id-or-ref>— inject full artifact text/trail copy <artifact-id-or-ref>— copy artifact to clipboard
checkpoint resume keys
When UI is available, /trail continue shows saved checkpoints:
j/kor arrows — moveenter— continue from selected checkpointp— preview checkpoint markdowne— edit then continued— delete selected checkpoint after confirmationqoresc— close
checkpoint review keys
When UI is available, /trail checkpoint shows mode-selected artifacts before drafting:
j/kor arrows — movespace— include/exclude artifacta— include alln— include noneenter— create checkpoint from checked artifactsqoresc— cancel
Checkpoint quality guidelines live in docs/checkpoint-guidelines.md.
navigator keys
j/kor arrows — moveg/G— top/bottomtab— cycle artifact kind filters— cycle source (current / all / loaded slots likec1,c2)enter— inspect selected artifact; file artifacts open current full file contentsiorr— inject compact artifact referenceI— inject full artifact texty— copy selected artifactc— create handoff checkpointv— toggle detailqoresc— close
configuration
Trail merges config from:
~/.pi/agent/trail.json<project>/.pi/trail.json
example:
{
"maxArtifacts": 300,
"maxBodyChars": 6000,
"checkpointArtifacts": 24,
"consumedRetentionDays": 7,
"summarizer": {
"enabled": true,
"provider": "openai",
"model": "gpt-5.2",
"maxOutputTokens": 1200,
"maxInputChars": 36000,
"timeoutMs": 120000
}
}
storage
checkpoints live in:
~/.pi/agent/trail/checkpoints/<id>.md~/.pi/agent/trail/checkpoints/<id>.artifacts.json~/.pi/agent/trail/index.json
--once checkpoints are soft-consumed at the end of the session in which they were used (/trail continue, /trail resume, or /trail load). The index entry is marked consumedAt, hidden from default listings, and the underlying files stay on disk for consumedRetentionDays (default 7) so an accidental cancel is recoverable. /trail unload <id> cancels the pending consume contract for the current session. /trail delete always purges immediately. Pass --include-consumed to list / load to see soft-consumed entries.
File-path references inside an injected checkpoint always survive consume — they point to your project's disk paths, not Trail storage. Only artifact-level lookups (/trail ref c1.f12, etc.) require the original artifacts.json to still exist; /trail load rehydrates them from the sidecar without spending any model-context tokens.
example checkpoint markdown
~/.pi/agent/trail/checkpoints/20260502-184212Z.md
# Trail checkpoint 20260502-184212Z
mode: handoff
summary: llm
cwd: /Users/me/project
created: 2026-05-02T18:42:12.000Z
note: finish checkpoint store refactor
artifacts: /Users/me/.pi/agent/trail/checkpoints/20260502-184212Z.artifacts.json
## Summary
Checkpoint store now writes durable markdown plus sidecar artifact JSON.
## Decisions / constraints
- Keep checkpoints compact; do not preserve full transcript.
- Store exact artifact refs so fresh sessions can ask for source context.
## Current state
- `extensions/checkpoint-store.ts` handles save, list, find, read, consume.
- `--once` checkpoints remove markdown, sidecar JSON, and index entry after resume.
## Next steps
- Add tests for partial checkpoint id lookup.
- Run `npm run check`.
## Avoid repeating
- Do not move checkpoint files into project cwd; storage belongs under Pi agent dir.
## References
- [file:f12] `extensions/checkpoint-store.ts`
- [command:c4] `npm run check`
example checkpoint artifacts
~/.pi/agent/trail/checkpoints/20260502-184212Z.artifacts.json
[
{
"id": "f12",
"displayId": "f12",
"ref": "file:abc123:0",
"kind": "file",
"title": "edit extensions/checkpoint-store.ts",
"subtitle": "+ save checkpoint markdown and sidecar artifacts",
"body": "export function createCheckpointStore(): CheckpointStore { ... }",
"timestamp": 1777747332000,
"meta": {
"path": "extensions/checkpoint-store.ts"
}
},
{
"id": "c4",
"displayId": "c4",
"ref": "command:def456:0",
"kind": "command",
"title": "npm run check",
"subtitle": "exit 0",
"body": "tsc --noEmit",
"timestamp": 1777747390000
}
]
example checkpoint index
~/.pi/agent/trail/index.json
[
{
"id": "20260502-184212Z",
"mode": "handoff",
"file": "/Users/me/.pi/agent/trail/checkpoints/20260502-184212Z.md",
"createdAt": "2026-05-02T18:42:12.000Z",
"cwd": "/Users/me/project",
"sourceSession": "/Users/me/.pi/sessions/project/session.jsonl",
"note": "finish checkpoint store refactor",
"consumeOnUse": false
}
]
development
run from repo without installing:
pi --no-extensions -e ./extensions/trail.ts
smoke test:
pi --no-extensions -e ./extensions/trail.ts --mode json --no-session "/trail help"
type check:
npm ci
npm run check
dry-run package contents:
npm run pack:dry
security
Pi extensions run with full system permissions. review source before installing third-party packages.