pi-mem

pi-mem is an open-source memory harness and persistent context manager developed by Jo Inc for the Pi CLI coding agent. It provides a structured, file-based memory system inspired by OpenClaw to retain context across terminal sessions without requiring complex database infrastructure. Operating directly within the user's filesystem under `~/.pi/agent/memory/`, the harness injects curated long-term memories, active scratchpad notes, and recent daily logs into the Pi agent session upon startup. The agent reads and updates markdown files as it works, capturing durable architectural preferences, ongoing tasks, and daily session logs. What sets pi-mem apart from ephemeral session orchestrators is its lightweight, human-readable file layout. Developers can inspect, edit, or version-control their agent's memory files directly using standard text editors and Git, maintaining clear oversight over what the LLM remembers. pi-mem is distributed as an open-source npm package (`@askjo/pi-mem`) under the MIT license, making it free to use and modify for terminal-based development workflows.

Tags: ai agent, cli, coding agent, developer tools, memory, OpenSource

Visit pi-mem

Key features

  • Structured Markdown Storage — Organizes long-term context, scratchpads, and daily logs into clean markdown files under ~/.pi/agent/memory/. - Configurable Storage Directory — Supports custom memory locations using the PI_MEMORY_DIR environment variable. - Automatic Daily Log Loading — Automatically ingests logs from today and yesterday at session start to preserve immediate context. - Curated Long-Term Retention — Persists project decisions, preferences, and durable facts in a dedicated MEMORY.md file. - Active Task Scratchpad — Tracks immediate checklists, reminders, and pending fixes across runs in SCRATCHPAD.md. - Agent Note Generation — Allows the LLM to create and maintain modular reference notes and self-reviews in a notes/ directory. - NPM Distribution — Easily installed and integrated into TypeScript and Node.js environments via @askjo/pi-mem.

Use cases

Use Case: Retaining Multi-Day Context A developer working on complex refactoring across multiple days relies on pi-mem's daily logs (daily/YYYY-MM-DD.md) so the Pi coding agent automatically remembers yesterday's implementation details and edge cases upon startup.

Use Case: Enforcing Architectural Preferences Teams store codebase constraints, naming conventions, and environment details in MEMORY.md, ensuring the Pi agent adheres to repository standards across isolated terminal sessions.

Use Case: Managing Interruptions and Bug Fixes When interrupted mid-task, the developer or agent notes remaining fixes in SCRATCHPAD.md, allowing the session to be resumed later without losing track of pending tasks.

Who it is for

pi-mem is intended for developers using the Pi CLI coding agent who require persistent context and memory across terminal sessions. It is ideal for programmers who prefer human-readable, file-based memory management over heavy external database solutions. It is not suitable for developers seeking a standalone coding agent or those using agents outside the Pi ecosystem without manual adaptation.

Install guide

Installation Install the package globally or locally from npm: bash npm install -g @askjo/pi-mem

First Run Set up the memory directory (defaults to ~/.pi/agent/memory/ or customize via environment variable): bash export PI_MEMORY_DIR="$HOME/.pi/agent/memory" mkdir -p "$PI_MEMORY_DIR/daily" mkdir -p "$PI_MEMORY_DIR/notes" touch "$PI_MEMORY_DIR/MEMORY.md" touch "$PI_MEMORY_DIR/SCRATCHPAD.md"

Example Session Run the Pi agent with memory support loaded into the session: bash # Verify your memory directory configuration echo $PI_MEMORY_DIR # Run the Pi coding agent (pi-mem automatically loads recent daily logs and MEMORY.md) pi "Review the recent changes from yesterday and continue implementing the auth middleware noted in SCRATCHPAD.md"

Part of CLI Coding Agents

Categories: AI Coding Agents, Developer Tools, Memory

Related CLI agents

  • Beads — Beads (bd) is an open-source task coordination and state orchestration harness for AI coding agents developed by Gastown Hall. It…
  • Letta Code — Letta Code is an open-source terminal-based AI coding assistant developed by Letta (formerly MemGPT). Built on top of the Letta…
  • GoodMemory — GoodMemory is an open-source agent memory orchestration harness and context management system developed by hjqcan. Designed to give AI agents…
  • Vestige — Vestige is an open-source agent harness and persistent memory infrastructure framework developed by samvallad33. Designed specifically for AI coding agents…
  • SWE-agent — SWE-agent is an open-source autonomous software engineering agent harness built and maintained by researchers from Princeton University and Stanford University.…
  • OpenHands — OpenHands (formerly OpenDevin) is an open-source autonomous AI software development agent and orchestration platform. It provides an extensible runtime environment…
  • AI Tools
  • Categories
  • Industries
  • CLI Coding Agents
  • MCP Servers
  • MCP Categories