@fradser/pi-memory
v0.2.8
Published
Native /memory command for pi — auto-memory guidance, instructions menu, and manual consolidation (no skill surface)
Downloads
1,363
Maintainers
Readme
Memory Plugin
Native pi /memory command for bounded project memory injection and parent-owned consolidation. It has no skill surface and honors Pi's configured agent directory.
Memory roots:
<agent-dir>/memory/<sha256(canonical-project-cwd)>/— private harness memory, written first<project>/.memory/— safe, git-tracked mirror written only for explicitly safe files
<agent-dir> is resolved through Pi's getAgentDir() and may be overridden with PI_CODING_AGENT_DIR. The hashed project scope prevents punctuation-based path collisions. Private memories, credentials, and personal information never enter the public mirror.
Version: 0.2.5
Installation
pi install npm:@fradser/pi-memory
# or from this repository
pi install /path/to/pi-packages/packages/memoryUsage
Type /memory to open the management menu. Type /consolidate to start a background run without opening the menu.
Auto-memory: on
1. Select memory model
2. Enter provider/model manually
3. Consolidate memory now
4. Edit user instructions
5. Edit project instructions
6. Open memory folder
7. Toggle auto-memory- Auto-memory is on by default. It adds bounded capture guidance; existing memory is injected independently of the toggle.
- Memory model accepts one complete
provider/modelreference. Menu selection and manual input use the same allowlist. Invalid persisted configuration is preserved and surfaced instead of being overwritten. - Consolidate memory now starts a single-flight parent-owned transaction.
/consolidate no-contextintentionally disables session-context capture. - Instructions use Pi's resolved context resource when available, including overrides and ancestor files.
- Open memory folder opens the configured harness directory, not a hard-coded home path.
Consolidation transaction
The parent extension owns the run from start to finish:
- Acquire a cross-process project lock and create a private
0700run directory. - Capture an immutable branch/context snapshot before launching the worker.
no-contextwrites an explicit disabled-context manifest. - Launch a no-extension, read-only worker with only
read,grep,find, andlstools. The worker receives run paths and metadata, never provider credentials or a live session file. - Accept exactly one bounded structured JSON plan. Progress, prose,
PASSEDtext, and validator-like output are not evidence. - Run
validate-consolidate.pybefore mutation. The parent applies only selected, validated operations with atomic writes; unrelated files are untouched. - Rebuild the scoped indexes, run full post-apply validation, and write a receipt bound to the run, scope, exact plan artifact bytes, selected files, and final hashes.
- Report success only after the parent-owned receipt and privacy/mirror checks verify the resulting state. Timeout, shutdown, spawn failure, stale identity, lock contention, and validation failure release the run without success notification.
An empty selected scope is a verified no-op. Global public-mirror repair is not part of scoped consolidation and requires a separate explicit confirmation.
Memory loading limits
Only direct regular Markdown files with a strict lower-case .md basename are loaded. Symlinked roots/files and non-regular entries are rejected. Loading is deterministic, harness memory shadows a public duplicate, and injection is bounded by file count, per-file size, and total size. Injected content is labeled untrusted reference data and must not be treated as instructions.
Files
memory/
├── index.ts
├── extensions/inject-memory.ts
├── extensions/consolidation-run.ts
├── extensions/memory-files.ts
├── extensions/memory-paths.ts
├── extensions/config.ts
├── procedures/consolidate.md
├── scripts/validate-consolidate.py
├── features/consolidate.feature
├── features/validate-consolidate.feature
└── tests/