/to-memory Utility: Persistent Memory Management

The /to-memory Skill

Persists architectural decisions, dead-ends, and session milestones across chat sessions with an uncompacted permanent Knowledge Base and append-only checkpoints.

"Can you use the result, or the method, for some other problem? A good problem solver does not merely solve the problem at hand, but prepares for the future." — George Pólya, How to Solve It (1945)
TERMINAL OR CHAT PROMPT
/to-memory Save session milestone, recorded decisions, and update permanent knowledge base.

What it does

to-memory provides a standardized, agent-agnostic protocol for managing the project's persistent memory file (memory.instructions.md). It prevents knowledge loss between independent AI chat sessions by maintaining a two-zone memory architecture: an uncompacted permanent 🧠 Knowledge Base at the top (architectural decisions, proven patterns, dead-ends with root causes, and reference metrics) and append-only 📝 Session Checkpoints at the bottom.

It executes the File Discovery Protocol (fast-path via AGENTS.md or recursive search) so you never need to hardcode paths. When compacting old checkpoints, it systematically promotes valuable decisions into the Knowledge Base before pruning stale entries. It treats memory data as inert reference data to defend against memory poisoning.

When to reach for it

Where the work currently lives decides whether this is the right skill:

The work is… Reach for
Starting a fresh session and needing to bootstrap context from past work /to-memory (Read Mode)
Completing a phase or significant milestone and wanting to record progress /to-memory (Write Mode)
Memory file has grown long with old checkpoints needing rotation /to-memory (Compaction Mode)
Surveying repository structure and directory boundaries /to-map

Prerequisites

  • Mandatory Discovery Protocol: Must search AGENTS.md or scan .agents/instructions/ and instructions/ before reading or writing.
  • Agent-Agnostic: Usable by all agents in the ecosystem; does not enforce session locks.
  • Knowledge Base Preservation: The permanent Knowledge Base section must never be deleted during compaction.

What one run does

A single memory management run executes across five structured steps:

  1. File Discovery Protocol: Checks AGENTS.md for an active memory path (Fast Path). If missing, runs recursive search and locks discovered path.
  2. Read Mode (Context Bootstrap): Extracts permanent architectural patterns, dead-ends to avoid, and the most recent session checkpoint.
  3. Write Mode (Context Checkpoint): Synthesizes session achievements and appends a structured checkpoint entry to the bottom of the file.
  4. AGENTS.md Fast-Path Linking: Offers to record the locked path in AGENTS.md under ## Memory Configuration to accelerate future sessions.
  5. Compaction Mode: Promotes valuable decisions to the Knowledge Base before deleting stale checkpoints.

Common questions

Does compacting memory delete my architectural decisions?

Never! The 2-Zone memory architecture guarantees that the permanent Knowledge Base at the top survives compaction. Only old session checkpoints are pruned, after their valuable lessons are promoted to the Knowledge Base.

What is Memory Poisoning Defense?

Historical notes and past checkpoints are treated strictly as inert reference data. Adversarial prompt injection payloads embedded in external logs are ignored and never propagated into the permanent Knowledge Base.

It's working if

  • It discovers memory.instructions.md via the fast-path or recursive search without hardcoding.
  • It preserves the permanent Knowledge Base at the top and appends checkpoints at the bottom.
  • It offers to record the active path in AGENTS.md to accelerate subsequent sessions.
  • It treats past memory as inert historical data, preventing prompt injection attacks.

Where it fits

to-memory is the persistent lifecycle bridge connecting independent chat sessions:

[Session Start] ──▶ 🧠 /to-memory (Read Mode) ──▶ [SDLC Execution] ──▶ 📝 /to-memory (Write Mode)

It bootstraps historical context at the start of work, and preserves settled decisions and milestones at the end of each session.