Memory

Agents that
remember.

0spec maintains a per-project memory corpus. Decisions, discoveries, constraints, and proven fixes accumulate across sessions — so agents don't repeat mistakes or rediscover what they already know.

Lifecycle

01

Candidate extraction

During execution, agents produce artifacts. The ingestion pipeline extracts potential memories from stage outputs — decisions, errors, discoveries — and writes them as candidates.

02

Promotion

Candidates are evaluated for relevance and novelty. High-confidence candidates are promoted to durable memory with full metadata: kind, scope, evidence, and applicability.

03

Retrieval

Before each stage runs, the memory system queries the FTS5 index with the stage prompt and context. Top-k results (BM25 ranked) are injected into the agent's context window.

04

Feedback & decay

Memories track usage: selected count, usefulness votes, staleness. Unused or contradicted memories decay. Pinned memories persist. The corpus stays relevant over time.

Memory Kinds

decision

Choices made by agents during execution

"Chose Express over Fastify for API layer due to existing middleware."

discovery

New findings about the codebase or problem domain

"Auth middleware stores session tokens in cookies, not headers."

preference

Learned preferences about code style, patterns, tooling

"Project uses Zod v4 record syntax: z.record(z.string(), ValueSchema)."

constraint

Limitations or restrictions that affect future work

"Cannot use ESM imports in config files — Node CJS runtime only."

actionable_error

Recoverable errors with known remediation steps

"bun install fails on linux-arm64 — use npm install as fallback."

proven_fix

Solutions that worked and should be reused

"CORS 403 on /api routes fixed by adding origin to allowlist in middleware.ts."

Configuration

Enable memory in your project config. Each stage can override retrieval settings or filter by memory kind.

[settings.memory]
enabled = true
default_max_context_tokens = 2000
fts_top_k = 20
min_relevance_score = 0.3
candidate_ttl_days = 14

# Per-stage override
[[stages]]
id = "implement"
[stages.memory]
enabled = true
query_hint = "auth middleware patterns"
kind_filter = ["proven_fix", "constraint"]
max_context_tokens = 3000

Storage

~/.0spec/memory/{project-slug}/
  events.jsonl          # Raw memory events
  candidates.jsonl      # Pending promotion
  memory.sqlite         # FTS5 index + usage tracking
  memory-bank/          # Durable promoted memories

SQLite FTS5 with BM25 ranking. Weighted fields: text (1.0), summary (3.0), tags (2.5). Per-memory usage tracking with pin, archive, and staleness signals.

Memory is available on all plans — Free, Solo, and Pro.