Memory System

Persistent project memory for AI agents with project and global layers

Memory System

Knowns includes a 2-layer memory system so agents can retain patterns, decisions, and conventions across sessions instead of relearning them every time.

The 2 Layers

LayerScopeBest for
ProjectCurrent repositoryTeam conventions, architecture decisions, reusable patterns
GlobalAcross projectsPersonal defaults and broadly reusable practices

Why It Matters

  • Agents can load project memory at session start
  • Reusable learnings stop disappearing between sessions
  • Important patterns can be promoted instead of copied into every prompt
  • Search and graph views can connect memories to tasks and docs

CLI Commands

Persistent memory is managed with the knowns memory command group:

bash
# List memory entries
knowns memory list --plain

# Filter by layer or category
knowns memory list --layer project --category pattern --plain

# View a memory entry
knowns memory view <id> --plain

# Add a new memory entry
knowns memory add \
  --title "Auth token rotation pattern" \
  --category pattern \
  --tags auth,security \
  --content "Rotate access tokens every 15 minutes"

# Promote reusable knowledge
knowns memory promote <id>
knowns memory demote <id>

MCP Tools

MCP has full memory coverage for both persistent and session-scoped memory (v0.20 consolidated format):

Persistent memory:

TypeScript
memory({ action: "add", title: "Auth pattern", category: "pattern", layer: "project", content: "..." })
memory({ action: "list", layer: "project" })
memory({ action: "get", id: "abc123" })
memory({ action: "update", id: "abc123", content: "..." })
memory({ action: "promote", id: "abc123" })  // project → global
memory({ action: "demote", id: "abc123" })   // global → project

Search memory:

TypeScript
search({ action: "search", query: "auth pattern", type: "memory" })

See MCP Integration for the full tool list.

Typical Workflow

text
Research something once
→ save the distilled lesson to project memory
→ load it automatically in later sessions
→ promote it to global if it applies everywhere

Good Memory Candidates

  • Architecture decisions that should not be re-debated every session
  • Team conventions that are easy for agents to miss
  • Reusable debugging lessons
  • Patterns extracted from completed tasks
  • Skills System - kn-init, kn-research, and kn-extract now use memory-aware workflows
  • Web UI - Browse memory entries and graph relationships visually
  • CLI Reference - Full command syntax