Claude Code gives every session automatic memory: a session run at a cwd
passively loads that project's ~/.claude/projects/<cwd-slug>/memory/ into its
context — no skill invoked, nothing to remember. pi has no equivalent: files
in ~/.pi/agent/memory/ are inert unless a skill explicitly reads them. So a
CC→Pi migrant loses their memory entirely, and even hand-written pi memory is
invisible until wired up per-skill.
@getpipher/armory-memory is a pi extension that gives pi a Claude-Code-
compatible, cwd-keyed memory system, with one-command CC import.
- Auto-injection — on
before_agent_start, inject the current cwd's memory into the system prompt as a## Memoryblock (mirrors CC's passive model). - Import —
/memory importcopies~/.claude/projects/<slug>/memory/→~/.pi/agent/memory/<slug>/1:1, idempotent, with a drift-mitigation header.
~/.pi/agent/memory/
-Users-rector-local-dev-core/ ← cwd = ~/local-dev/core
playbook.md
notes.md
-Users-rector-local-dev-sip-protocol/ ← cwd = ~/local-dev/sip-protocol
architecture.md
Why cwd-keyed (not named-context): CC keys by cwd. Mirroring that means:
- CC memory imports 1:1 (pure file copy, no restructuring).
- Muscle memory transfers ("the memory for this repo").
- The cwd → slug encoding is CC's exact scheme (
path→-path,/→-).
This is the design decision that makes the package a true CC drop-in.
Naively inlining the whole memory dir every turn would bloat every prompt (a rich project's memory can be hundreds of KB). The injection is budget-aware:
- Inject a compact index of all files (name + size), capped at
indexMax. - Inline the N newest files' content (default 3), truncated to a
byteCap(default 4 KB). - Older files appear in the index only; the agent uses the
readtool for them.
This mirrors CC's surfacing (recent + summary) while keeping the prompt lean.
before_agent_starthook — passive, runs every turn, injects## Memory.memorytool — model-callable;listthe current cwd's memory./memorycommand — human:list·import [--force] [slug|all]·path.
CC originals are copied (not moved) so both hosts work simultaneously. Each
imported file gets a header: CC is canonical until edited in pi; mirror changes
back to CC if using both. Low-tech, matches how armory-todo/strategy-rename
handled transitions. The header is stripped from injected content (cosmetic).
- Memory writes (auto-capture like CC's auto-memory) — v0.1 is read/import only; writes stay skill-driven (the migrant's existing workflows).
- Token-budget auto-tuning — v0.1 uses fixed defaults with env overrides.
- Bi-directional sync — v0.1 is import-once; live sync is a future feature.