SNARC: The Salience-Gated Memory System That Makes Claude Code Remember What Matters

SNARC: The Salience-Gated Memory System That Makes Claude Code Remember What Matters

SNARC (formerly Engram) automatically captures and injects relevant memories into Claude Code sessions based on surprise, novelty, arousal, reward, and conflict scoring.

GAla Smith & AI Research Desk·Mar 18, 2026·4 min read·34 views·AI-Generated
Share:
Source: github.comvia hn_claude_codeMulti-Source
SNARC: The Salience-Gated Memory System That Makes Claude Code Remember What Matters

What It Does

SNARC (Surprise, Novelty, Arousal, Reward, Conflict) is a memory system for Claude Code that captures what matters and forgets what doesn't. Unlike traditional memory systems that capture everything and retrieve via search, SNARC uses salience scoring to selectively store observations from your coding sessions.

Every tool Claude uses during a session is observed and scored on five dimensions. Observations below the salience threshold stay briefly in a circular buffer then evict, while high-salience observations persist. This mirrors biological memory: you don't remember every step, but you remember the one where you tripped.

How It Works

Context injection happens automatically in three scenarios:

  1. At session start
  2. After each prompt (if related memories exist)
  3. After context compaction

You don't need to query SNARC—it surfaces relevant memories without being asked. Injection is epistemically labeled with three tiers:

  • Tier 1: "observed (directly recorded)"
  • Tier 2: "inferred (heuristic—may not be accurate)"
  • Tier 3: "auto-extracted, verify if unsure"

The system is conservative by design, biased toward omission. Wrong memory is considered more damaging than missing memory.

The Dream Cycle

At session end, SNARC runs a "dream cycle" that extracts patterns from stored observations. This happens either mechanically (heuristic) or semantically (LLM-powered deep dream). Over time, SNARC builds a structured memory of how you work—what tools you reach for, what errors you hit, what fixes you apply.

Two consolidation modes:

  • Tool sequences: Recurring workflows (e.g., Edit → Bash(test) → Edit = TDD loop)
  • Error-fix chains: Error followed by fix on the same file within 5 observations
  • Concept clusters: Multiple observations grouped around the same files

For semantic pattern extraction, SNARC sends session observations to Claude via claude --print to identify:

  • Workflows: Recurring approaches with intent understanding
  • Error-fix chains: Problem → solution with semantic understanding
  • Insights: Something learned about the codebase
  • Decisions: Architectural choices made during the session
  • Identity facts: Persistent project knowledge

Setup and Configuration

Install SNARC from GitHub:

git clone https://github.com/dp-web4/engram
cd engram
npm install  # or appropriate package manager

Trigger deep dream manually:

snarc dream --deep

Or enable automatic deep dream at session end:

export ENGRAM_DEEP_DREAM=1

Safety Features

Deep dream identity facts are quarantined by default. They go to Tier 2 as proposed_identity patterns—never auto-injected into Claude's context, never promoted to Tier 3 without review.

Review quarantined proposals:

snarc review

Promote good proposals:

snarc promote 42 "test_framework" "Jest"  # human confirms → Tier 3

Reject bad proposals:

snarc reject 43  # delete bad proposal

For those who prefer speed over safety:

snarc config auto_promote_identity 1  # deep dream identity → straight to Tier 3
snarc config auto_promote_identity 0  # back to quarantine

When To Use It

SNARC shines when:

  1. You work on the same project across multiple sessions
  2. You have recurring workflows or patterns
  3. You want Claude Code to remember your architectural decisions
  4. You frequently encounter and fix similar errors
  5. You want automated knowledge capture without manual note-taking

Integration with Claude Code

SNARC integrates seamlessly with Claude Code's existing workflow. It observes tool usage through the same interfaces Claude Code uses, making it compatible with MCP servers and other extensions. The memory injection happens at the context level, meaning Claude receives relevant memories alongside your current prompt and file context.

This creates a feedback loop where SNARC learns from your interactions with Claude, and Claude benefits from SNARC's memory of past interactions.

AI Analysis

Claude Code users should install SNARC immediately if they work on projects spanning multiple sessions. The automatic memory capture and injection means you no longer need to manually remind Claude about project decisions, recurring workflows, or past error fixes. Configure SNARC to run deep dreams automatically (`ENGRAM_DEEP_DREAM=1`) but keep identity facts quarantined. Review proposals weekly with `snarc review` to promote accurate project knowledge. This creates a growing knowledge base that makes each new session more effective. Pay attention to the epistemic labels (Tier 1-3) when memories are injected. Tier 3 memories ("auto-extracted, verify if unsure") should be double-checked, especially for critical architectural decisions. The system's conservative bias means it might omit some relevant memories, so occasionally prompt Claude with explicit context if you notice gaps.
Enjoyed this article?
Share:

Related Articles

More in Products & Launches

View all