# pi-memory

Persistent memory for Pi. Learns patterns and decisions per project, recalls context across sessions, generates handover docs.

## Install

```bash
pi install npm:@artale/pi-memory
```

## How it works

Two memory layers:

1. **MEMORY.md** — project-level knowledge base. Patterns, decisions, gotchas, architecture notes. Lives in the project root.
2. **Episodic memory** — JSONL log of insights with timestamps. Lives in `~/.pi/memory/episodes/`.

## Tools

- `memory_learn` — record a learning/insight (pattern, decision, gotcha, architecture, process)
- `memory_recall` — search project memory + episodic memory for context
- `memory_handover` — generate handover document (focus, blockers, next actions, learnings)

## Examples

```
The agent discovers a gotcha:
→ memory_learn({ insight: "Windows paths need forward slashes in bash", category: "gotcha" })

Next session, the agent recalls:
→ memory_recall({ query: "windows paths" })
→ Returns: "Windows paths need forward slashes in bash" + related episodes

End of session:
→ memory_handover({ summary: "Fixed build pipeline", nextActions: ["Deploy to staging"] })
```

## Categories

- `pattern` — recurring code patterns
- `decision` — architectural/design decisions with reasoning
- `gotcha` — things that tripped you up
- `architecture` — system design notes
- `process` — workflow/process learnings

## License

MIT
