Skip to content
rhussPublic

About

Claude Code plugin for memory knowledge management: sync to Obsidian, semantic linting, cross-project insights, and memory lifecycle governance

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

79 Commits

Folders and files

Repository files navigation

cc-memory

A Claude Code plugin that gives your AI assistant a persistent, self-organizing memory that grows smarter across projects and sessions.

Claude Code's built-in auto-memory writes flat files. They accumulate without maintenance, contradict each other over time, and stay locked inside individual projects. The cc-memory plugin transforms this raw material into a living knowledge base: it detects cross-project patterns, forms higher-level concepts, tracks which knowledge is actively useful, and surfaces the right context at the right time.

Why This Is Different

Most agent memory systems optimize for retrieval: store things, find similar things later. cc-memory optimizes for understanding: it detects that "always read config before invoking a tool" and "validate the OG image before posting to social media" are instances of the same structural pattern, despite having nothing in common on the surface.

The loose inspiration is Hofstadter and Sander's Surfaces and Essences, which argues that analogy-making is the core cognitive act. Their work describes concepts as fluid, constantly shifting things that reshape themselves every time they encounter a new situation. cc-memory borrows one narrow idea from that: recognizing structural similarity across different domains. But the implementation is far more rigid than anything Hofstadter would endorse. Concepts here are named files with fixed membership lists and YAML frontmatter. They do not slide, blend, or re-categorize themselves on the fly the way Hofstadter's mental categories do. This is not an implementation of his theory. It is a pragmatic system that picked up one useful aspect and mapped it onto a domain where markdown files and shell scripts are the medium, and that medium cannot reflect the full dynamic nature of what Surfaces and Essences describes.

cc-memory uses Claude itself as the analogy engine: the LLM reads your accumulated memories and finds the patterns that connect them. The result is concepts: named abstractions distilled from concrete experiences across your projects. These concepts become part of your working knowledge in every future session.

What you get that other memory systems don't

Capability cc-memory Typical agent memory (Mem0, Letta, etc.)
Cross-project pattern detection Concepts formed from memories spanning multiple projects Memories scoped to single conversations or agents
Structural analogy Finds deep patterns regardless of surface differences Embedding similarity (surface-level matching only)
Activation tracking Knows which memories are actively useful vs. quietly decaying All memories treated equally
Lifecycle governance Staleness detection, triage, contradiction resolution Accumulate-only, no maintenance
Human-readable corpus Markdown files you can browse, edit, and version Vector stores or databases you can't inspect
Memory vault Synced knowledge base in a plain directory (browsable with Obsidian or any editor) No knowledge browsing layer
No infrastructure File-based, runs locally, no database or API server Often requires Redis, Neo4j, or cloud services

Why File-Based Memory Works

cc-memory stores everything as markdown files with YAML frontmatter. No database. No vector store. No API server. This is a deliberate design choice, not a limitation.

You can read and fix your memories. Every memory is a .md file you can open in any editor. Run rg "testing" ~/.claude/projects/*/memory/ to find every memory about testing across all projects. Fix a wrong memory with your editor. Try doing that with embeddings in a vector database.

Memories work with git. They are files in ~/.claude/projects/, and the Obsidian copies live in your vault. You can diff what changed between sessions, revert a bad batch of memories, or track how your knowledge evolved over months. Version history comes for free.

No infrastructure to maintain. cc-memory runs entirely on your machine with tools you already have: Python, uv, and Claude Code. No Redis instance. No API keys. No cloud service that might go down or change its pricing. Works on an airplane.

Markdown is the native language of LLMs. Claude reads markdown better than any other format. There is no serialization layer, no schema mapping, no ORM equivalent. The file Claude reads is the file you edit. What you see is what Claude gets.

Your existing tools already work. Pipe memories through jq. Search them with rg. Transform them with awk. Open them in Obsidian and build dashboards. Write a shell script that processes your memory corpus. The unix philosophy applies: small tools, plain text, composition.

Your data survives this plugin. If you stop using cc-memory tomorrow, every memory is still a readable markdown file with structured frontmatter. Your memory vault still has the synced copies. Nothing is locked in a proprietary format or a running process. The worst case is that your files stop getting new features, not that they become unreadable.

Value Over Built-in Claude Code Memory

Claude Code has a built-in auto-memory system. It works out of the box with zero configuration. That matters, and cc-memory does not replace it. cc-memory sits on top of it, transforming what it produces.

Here is what the built-in system does not do:

No lifecycle management. Built-in memories accumulate. After a few months of active use, you have 200+ memory files across your projects. Some are stale. Some contradict each other. Some say the same thing in different words. There is no mechanism to flag, clean up, or consolidate them. cc-memory adds staleness detection (flags memories you never reference), triage (inbox-zero cleanup workflow), and distillation (merges duplicates, resolves contradictions).

No cross-project learning. What you learn in your Go project stays in your Go project. Your Python CLI and your React dashboard each have their own feedback memories, and the built-in system never notices that "always verify config before calling a tool" appears in all three. cc-memory detects these patterns and promotes them to concepts that surface across every project.

No usage signals. The built-in system treats a memory written yesterday and a memory written eight months ago the same way. cc-memory tracks activation: how often each memory is referenced, when it was last used. A memory referenced 15 times last month stays protected. A memory never referenced since creation gets flagged after 60 days. The staleness detector uses real usage data, not just age.

No context filtering. Built-in MEMORY.md loads everything at session start. Every entry gets the same weight. cc-memory adds context hints to knowledge entries. When you are debugging, concepts tagged with (when: debugging) stand out. Concepts tagged only with (when: writing) can be skipped. Claude spends tokens on what matters for the current task.

No browsable knowledge base. Built-in memories are scattered across ~/.claude/projects/ directories. You can find them if you know where to look, but there is no overview, no search, no connections between them. cc-memory syncs everything to a memory vault: a plain directory with markdown files, a Map of Content, concept relationship links, and a review list for questioned memories. Open it in Obsidian for wikilinks and dashboards, or browse it with any text editor. Your AI's accumulated knowledge becomes something you can see and search.

The trade-off is real. Built-in auto-memory is zero-config. You do nothing and it works. cc-memory adds a plugin to install, a sync hook that runs at session end, and commands you run periodically (/memory:distill, /memory:triage). If you work on a single project and rarely accumulate more than a dozen memories, built-in memory is probably enough. cc-memory pays off when you work across multiple projects, accumulate memories faster than you can review them, and want your AI to learn from patterns that span your whole workflow.

How It Works

The knowledge pipeline

  Session memories          Cross-project          Concepts surface
  accumulate per-project    patterns detected      in future sessions
  ┌─────────────┐          ┌──────────────┐       ┌─────────────────┐
  │  Project A   │    ┌───>│              │       │ ## Knowledge     │
  │  - feedback  │    │    │   /memory:   │       │ - verify-before- │
  │  - project   │────┘    │   distill    │──────>│   act            │
  │  - user      │         │              │       │ - search-before- │
  ├─────────────┤    ┌───>│  (analogy    │       │   create         │
  │  Project B   │    │    │   engine)    │       │ - authentic-     │
  │  - feedback  │────┘    │              │       │   voice          │
  │  - reference │         └──────────────┘       └─────────────────┘
  ├─────────────┤                                  Written to each
  │  Project C   │────┘                            project's MEMORY.md
  │  - feedback  │
  └─────────────┘

  SessionEnd hook           Periodic distillation   Auto-surfaced at
  syncs + tracks            (manual or suggested)   session start
  activation

Step 1: Memories accumulate. Claude Code writes memories during sessions: your preferences, architectural decisions, project context, reference links. These are markdown files with YAML frontmatter, stored per-project under ~/.claude/projects/.

Step 2: The sync hook runs. At every session end, the plugin syncs changed memories to your memory vault (a configurable directory, which can be an Obsidian vault or any plain directory), tracks which memories were actively used (activation tracking), detects stale memories, and updates knowledge indexes.

Step 3: Distillation finds patterns. When you run /memory:distill, Claude reads the full memory corpus across all projects and looks for structural patterns. "Always verify state before acting" appears in 7 projects as different concrete rules. Claude recognizes the shared structure and creates a concept: verify-before-act.

Step 4: Knowledge surfaces in sessions. Each project's MEMORY.md gets a ## Knowledge section listing the concepts relevant to that project. When Claude starts a session, it sees these entries and can read the full concept file when the situation matches. Your Go project and your Python project both benefit from search-before-create without you ever mentioning it again.

Real concepts from real usage

These are actual concepts that cc-memory distilled from 60+ memories across 10 projects:

Concept What it captures Projects contributing
verify-before-act Always read current state before acting; never assume defaults 7 projects
search-before-create Search for existing entities before creating new ones 4 projects
authentic-voice Write naturally, prioritize quality over detector evasion 4 projects
respect-user-state Never auto-modify user-controlled state without permission 5 projects
pipeline-discipline Execute multi-step workflows completely, don't shortcut 3 projects

Each concept file tracks its member memories with distance labels (core, related, peripheral) and evolves across distillation runs as new memories join or old ones lose relevance.

Concept relationships

Concepts don't exist in isolation. The distill skill detects three types of relationships:

Hierarchies: search-before-create specializes verify-before-act. When distill detects that one concept's pattern is a narrower application of another's, it proposes a specializes/generalizes link. Hierarchy-aware knowledge surfacing means that if a parent concept is relevant to your project, its specializations are automatically surfaced too.

Tension edges: pipeline-discipline and respect-user-state can conflict when a destructive action is part of an automated pipeline. Tensions are recorded with a boundary description so Claude can navigate the trade-off explicitly rather than blindly applying one concept while ignoring the other.

Evolution tracking: Every distillation run records how each concept's membership and relationships changed. A concept gaining members across runs is becoming a core principle. One losing members may be splitting into more specific sub-concepts. Stable concepts are marked as such.

Contradiction as creative signal: When two memories contradict, distill asks whether a higher-level concept could reconcile both positions before defaulting to simple resolution. This is how new concepts emerge from productive tension, the core mechanism from Hofstadter's analogy-making theory.

Activation tracking

Not all memories are equally useful. cc-memory tracks how often each memory is referenced across sessions:

  • referenced-count: cumulative sessions where this memory was in working context
  • last-referenced: date of the most recent session

This data feeds three systems:

  1. Smart staleness detection: A memory referenced 15 times in the last month is never flagged as stale, even if it's a year old. A memory never referenced since creation gets flagged after 60 days instead of 90.
  2. Distillation prioritization: Highly-activated memories across 3+ projects are flagged as priority concept candidates before the full corpus scan.
  3. Triage context: When reviewing questioned memories, activation data helps you decide instantly: "referenced 12 times, keep" vs. "never referenced, delete."

Getting Started

Installation

Option A: From the marketplace (recommended)

/plugin marketplace add rhuss/cc-rhuss-marketplace
/plugin install memory@cc-rhuss-marketplace

After installing, run /memory:sync once. The skill checks whether the SessionEnd hook is registered and offers to set it up if it is missing.

Option B: From source

git clone https://github.com/rhuss/cc-memory.git
cd cc-memory
make install

make install registers a local marketplace, installs the plugin, and adds the SessionEnd sync hook to ~/.claude/settings.json. The install is idempotent. Run it again after pulling updates.

Post-install

After installing (either method), remove these sections from your global ~/.claude/CLAUDE.md if they exist. The plugin injects them automatically:

  • Memory Lifecycle Awareness (status FSM and last-validated instructions)
  • Cross-Project Insights (auto-detection trigger and insight format)
  • Entity Resolution for Memories (search-before-create flow)

Verify the plugin is loaded by running /memory:lint in a new CC session.

How it integrates with Claude Code

cc-memory plugs into Claude Code at three points: a SessionEnd hook, plugin-provided skills, and the MEMORY.md file that Claude reads at session start.

The SessionEnd hook is the workhorse. When any Claude Code session ends, Claude Code fires the SessionEnd hook defined in ~/.claude/settings.json. The install script registers sync-memory-to-obsidian.py as a SessionEnd hook command (invoked via uv run). This script runs outside of Claude, as a standalone Python process, every time a session closes. It does not need Claude to execute. The hook:

  1. Scans all project memory directories (~/.claude/projects/*/memory/) for files modified since the last sync
  2. Copies changed memories to the memory vault, transforming CC frontmatter and injecting wikilinks where memory content matches existing vault notes
  3. Tracks activation: updates referenced-count and last-referenced on memories that were in working context during the session
  4. Tags context: detects the session's activity type from skill invocations and adds it to the contexts field on referenced memories
  5. Runs staleness detection: flags memories that are old and unused as questioned
  6. Rebuilds the ## Knowledge section in every project's MEMORY.md with current concept and insight entries
  7. Regenerates the Map of Content (MOC) in the memory vault

The hook uses a lock file to prevent concurrent runs and a timestamp file (.last_sync) to track what changed since the previous sync.

Plugin skills provide the interactive commands (/memory:distill, /memory:lint, /memory:triage, /memory:sync, /memory:insight). These are SKILL.md files under memory/skills/ that Claude reads and follows when you invoke the command. They run inside a Claude session, with Claude as the executor. The distill skill, for example, instructs Claude to read the full memory corpus, detect structural patterns, and write concept files. The skills use Claude's own reasoning as the intelligence layer. The shell script handles the mechanical parts (file I/O, frontmatter parsing, vault sync).

MEMORY.md is the bridge between the plugin and Claude's context. Each project directory (~/.claude/projects/<project>/memory/) has a MEMORY.md file. Claude Code loads this file automatically at session start as part of the project's memory context. The ## Knowledge section at the bottom of MEMORY.md is written by the sync hook. It contains one-line entries pointing to concept and insight files in the memory vault, with optional context hints. Claude sees these entries and can read the linked files when the current task matches.

Session starts
  └─> Claude Code loads ~/.claude/projects/<project>/memory/MEMORY.md
        └─> Claude sees ## Knowledge section
              └─> Entries like: [verify-before-act](path) — description (when: debugging)
                    └─> Claude reads the concept file if the task matches

Session ends
  └─> Claude Code fires SessionEnd hook
        └─> sync-memory-to-obsidian.py runs (Python, not Claude)
              └─> Syncs to vault, tracks activation, rebuilds Knowledge entries

The cycle is self-reinforcing: memories accumulate during sessions, the hook organizes them at session end, and the organized knowledge surfaces in the next session.

Commands

Command What it does
/memory:sync Sync CC memories to your Obsidian vault on demand
/memory:lint Semantic health check: find contradictions, orphans, and gaps
/memory:insight File a cross-project analysis as a permanent vault note
/memory:distill Consolidate duplicates, resolve contradictions, form cross-project concepts
/memory:triage Inbox-zero triage: auto-resolve perpetual feedback, interactively review the rest

/memory:sync

Manually trigger a full sync cycle. Normally runs automatically at session end.

/memory:sync            # Incremental (only changed files)
/memory:sync --force    # Full sync (reprocess everything)

The sync pipeline: scan for changes, transform frontmatter, inject wikilinks, generate the Map of Content, track activation, run staleness detection.

/memory:lint

Semantic health check across all CC memories.

/memory:lint

Detects three types of issues:

  • Contradictions: Two memories making opposing claims (e.g., "prefer bundled PRs" vs. "always split into small PRs"). Suggests scoping, merging, or retiring.
  • Orphans: Memories with no connections to others. Suggests connecting or verifying relevance.
  • Gaps: Topics referenced in multiple memories that lack a consolidating memory.

Reports but never modifies without your confirmation.

/memory:insight

File a cross-project analysis as a permanent note.

/memory:insight                     # Auto-detect title
/memory:insight testing patterns    # Use provided title

The plugin also auto-detects when Claude produces cross-project analysis and offers to save it. The trigger: Claude must draw on stored memories from 2+ project directories, not just mention technologies.

/memory:distill

Two-phase corpus distillation.

/memory:distill                    # Full corpus
/memory:distill kubernetes         # Focus on a topic

Phase 1 (Consolidation): Merge duplicates, resolve contradictions, compress verbose entries.

Phase 2 (Concept Formation): Scan the consolidated corpus for structural patterns recurring across 2+ projects with 3+ supporting memories. High-activation memories (referenced 5+ times across 3+ projects) are evaluated first. Each pattern becomes a concept file in the Obsidian vault.

The sync hook suggests distillation when 20+ new memories have accumulated since the last run.

/memory:triage

Inbox-zero workflow for questioned memories.

Pass 1 (automatic): Auto-revalidate perpetual feedback (timeless behavioral guidance like "use podman instead of docker"). These don't expire by age.

Pass 2 (interactive): Present remaining questioned memories one at a time. For each: name, project, description, questioned-reason, and a preview. You choose: keep (revalidate), delete, or show full body first.

Auto-syncs to Obsidian after completing.

The Memory Lifecycle

active --> questioned --> active (re-validated)
                     \-> deleted (no longer relevant)
  • active: Claude uses this memory normally.
  • questioned: Flagged for review. Claude mentions it needs verification.

Dead memories are deleted, not archived with a status flag. The Obsidian sync preserves historical copies.

Automated staleness detection runs at every session end:

Condition Threshold Action
Referenced within 30 days Protected Never flagged
Zero references, no activation data 60 days Flagged as questioned (inactive)
Has references but old last-validated 90 days Flagged as questioned (age)
No activation data (legacy memory) 90 days Flagged as questioned (age)
Project has no sessions 60 days All memories flagged questioned (project-inactive)

Entity resolution

Before creating a new memory, Claude searches existing memories to avoid duplicates:

  1. Keyword search: Scan frontmatter name and description fields in the project and cross-project
  2. Semantic comparison: Read the top 3 candidates and compare with the proposed memory
  3. Decision: No match creates new; strong match offers update; partial match explains the difference

Knowledge Surfacing

Concepts and insights live in the memory vault. To make them available in CC sessions, the plugin writes a ## Knowledge section to each project's MEMORY.md:

## Knowledge
- [verify-before-act](~/Obsidian/.../concepts/verify-before-act.md) — Read current state before acting; 10 members from 7 projects
- [search-before-create](~/Obsidian/.../concepts/search-before-create.md) — Search for existing entities before creating new ones; 4 members

Each entry is one line. Claude sees these at session start and reads the full file when the situation matches.

Context-aware hints

Knowledge entries can include context hints that describe when a concept is most relevant:

- [verify-before-act](path) — Read current state before acting (when: debugging, implementing)
- [search-before-create](path) — Search for existing entities before creating new ones (when: implementing, refactoring)

The (when: ...) suffix tells Claude which activity types make this concept relevant. If you're in a writing session, Claude can skip concepts tagged only with debugging. This reduces token overhead without losing information.

Context tags use a controlled vocabulary of 8 activity types: writing, debugging, reviewing, implementing, configuring, planning, researching, refactoring. The vocabulary and skill-to-activity-type mappings are configurable in config.yaml.

How context tags accumulate:

  1. At session end, the sync hook detects the session's activity type from skill invocations (e.g., invoking systematic-debugging maps to debugging)
  2. Referenced memories gain the detected activity type in their contexts frontmatter field (capped at 8 tags per memory)
  3. During distillation, member memory contexts are aggregated to concept level using frequency-based filtering (tags must appear in 2+ members for concepts with 3+ members)
  4. Knowledge entries display the concept's context tags as (when: ...) hints

Concepts and insights without contexts fields appear without hints (backward compatible).

Project-relevance filtering: A concept only appears in a project's MEMORY.md if that project has memories in the concept's membership list. No participation, no Knowledge section.

The Memory Vault

The sync pipeline writes to a configurable directory called the memory vault. This is just a folder full of markdown files. Point it at a subdirectory inside an Obsidian vault if you want Obsidian's features. Point it at any other directory if you do not use Obsidian. The content is the same either way: plain markdown with YAML frontmatter.

Vault structure

<vault_path>/<output_dir>/
├── MOC-Claude-Memory.md       # Map of Content (auto-generated)
├── Review-Needed.base         # Obsidian Base view (optional, for Obsidian users)
├── concepts/                  # Cross-project structural patterns
│   ├── verify-before-act.md
│   ├── search-before-create.md
│   └── authentic-voice.md
├── insights/                  # Point-in-time cross-project analyses
│   └── insight-testing-patterns.md
├── project-a/                 # Synced memories from project A
├── project-b/                 # Synced memories from project B
└── ...
  • MOC: Auto-regenerated index linking to all synced memories. Uses [[wikilinks]] that Obsidian resolves, but the file is readable as plain markdown too.
  • Wikilinks: During sync, the plugin injects [[wikilinks]] where memory content matches existing vault notes. In Obsidian, these become clickable links. Outside Obsidian, they are readable annotations.

Why Obsidian works well (but is not required)

If you point the vault at an Obsidian directory, you get a few things for free that plain directories do not offer:

  • Review-Needed.base: An Obsidian Bases view that filters memories by status = questioned and shows a "Days Stale" formula column. Makes triage quick: open the view, see everything that needs attention.
  • Graph view: Obsidian's graph shows how concepts, insights, and memories connect through wikilinks. You can see clusters and orphans at a glance.
  • Search: Obsidian's full-text search across all synced memories, concepts, and insights.
  • Properties: Obsidian reads the YAML frontmatter natively, so you can sort and filter by status, memory-type, referenced-count, or any other field.

None of this is required. The sync script writes the same files regardless. rg, grep, or any file browser works fine for exploring the vault without Obsidian.

Configuration

Environment variables

Variable Default Purpose
OBSIDIAN_VAULT ~/Obsidian/ro14nd Path to the memory vault root directory (can be any directory, not just Obsidian)
MEMORY_OUTPUT_DIR Claude-Memory Subdirectory within the vault root
MEMORY_SYNC_FORCE unset Set to 1 for full sync
STALENESS_INACTIVE_NO_REFS_DAYS 60 Days before flagging zero-reference memories
STALENESS_ACTIVE_PROTECTION_DAYS 30 Days of recent reference that protect from staleness
CONTEXTS_MAX_TAGS_PER_MEMORY 8 Maximum context tags per memory file
CONTEXTS_MAX_TAGS_PER_ENTRY 5 Maximum context tags displayed per knowledge entry

Config file

memory/knowledge/config.yaml:

vault_path: ~/Obsidian/ro14nd
output_dir: Claude-Memory

wikilink_scan_dirs:
  - 04-Zettelkasten/permanent
  - 01-Projects

staleness:
  validation_threshold_days: 90
  project_inactivity_days: 60
  inactive_no_refs_threshold_days: 60
  active_protection_days: 30

distillation:
  suggestion_threshold: 20
  concepts_dir: concepts

contexts:
  vocabulary:
    - writing
    - debugging
    - reviewing
    - implementing
    - configuring
    - planning
    - researching
    - refactoring
  skill_mapping:
    "blog:": writing
    "systematic-debugging": debugging
    "speckit-implement": implementing
    # ... see config.yaml for full mapping
  max_tags_per_memory: 8
  max_tags_per_entry: 5

Environment variables override config file values.

Evaluation

eval-memory.py measures whether cc-memory's curated context actually improves Claude Code behavior. It runs replay probes (fixed prompts scored against expected patterns) and collects corpus health metrics.

Running the evaluation

# Full evaluation: probes + corpus analytics
uv run memory/scripts/eval-memory.py

# Only run probes (skip corpus analytics)
uv run memory/scripts/eval-memory.py --probes-only

# Only run corpus analytics (skip probes)
uv run memory/scripts/eval-memory.py --corpus-only

# Run specific probes
uv run memory/scripts/eval-memory.py --probes em-dash,staccato,search-first

# Compare against a previous run
uv run memory/scripts/eval-memory.py --compare ~/.claude/eval/eval-2026-07-10-120000.json

# Custom output directory
uv run memory/scripts/eval-memory.py --output-dir /tmp/eval-results

# Run three-layer evaluation (none/project/concept)
uv run memory/scripts/eval-memory.py --layer all

# Run only a specific layer
uv run memory/scripts/eval-memory.py --layer project

# Recreate the synthetic test fixture
uv run memory/scripts/eval-memory.py --recreate-fixture

How probes work

Each probe runs a fixed prompt through claude --print twice: once with the project's memory directory present (memory-on), once with it temporarily renamed (memory-off). Both outputs are scored by a deterministic pattern-matching function. The delta between scores tells you whether memory helped, hurt, or made no difference.

The built-in probes cover four categories:

Category Probes What they test
Writing style em-dash, staccato, here-is Whether memories enforce style rules (no em-dashes, no staccato sentences, no "Here is" openings)
Workflow behavior preserve-hooks, trait-reg, verify-config, no-auto-merge Whether memories guide correct tool usage (merge into existing hooks, check multiple registration locations, read config before acting, ask before merging)
Cross-project cross-project, og-image, search-first Whether concept knowledge transfers (verify state before mutating, check OG images before posting, search before creating memories)
Synthetic yq-over-jq, pineapple, celsius Portable probes using a self-contained test fixture. Test whether deliberate, unusual rules (prefer yq over jq, use PINEAPPLE as error keyword, use Celsius) are picked up from synthetic memories

Three-layer evaluation

Synthetic probes support three-layer testing to measure how different levels of memory context affect Claude's behavior:

Layer What's active What it measures
None Memory directory disabled Baseline: Claude with no project memory
Project Memories present, Knowledge triggers stripped Whether project-scoped memories alone influence behavior
Concept Full stack with Knowledge triggers Whether trigger-based concept activation adds value on top of project memories

The --layer flag controls which layers run. Use --layer all (default) for the full comparison, or --layer project to test a single layer. Results show per-layer scores and deltas (None->Project, Project->Concept) to quantify the contribution of each layer.

Trigger-based concept activation

Knowledge entries in MEMORY.md can include trigger phrases: - [name](path) -- description | Trigger: keyword1, keyword2. When a concept file has a triggers field in its frontmatter, the sync script appends these triggers to the Knowledge entry. Claude reads the linked concept file when the current task matches any trigger keyword, making concept activation explicit rather than relying on pattern matching alone.

Output

Each run produces:

  • A JSON report at ~/.claude/eval/eval-YYYY-MM-DD-HHMMSS.json containing raw outputs, scores, corpus metrics, and comparison data
  • A human-readable summary printed to stdout with a probe results table and corpus analytics

Regression detection

Pass --compare <previous-report.json> to diff the current run against a previous one. The comparison identifies regressions (probes that went from pass to fail), improvements (fail to pass), and unchanged probes.

Troubleshooting

SessionEnd hook not running

make check-hook           # Verify registration
bash scripts/ensure-hook.sh  # Re-register (idempotent)

Manual sync after hook failure

/memory:sync              # From any CC session
/memory:sync --force      # Full reprocess

Plugin not loading

claude plugin list        # Should show memory@memory-plugin-development
make reinstall            # Full reinstall

Memories not being loaded

If Claude seems to ignore your memories, check these three requirements:

  1. Git repo: The project directory must contain a .git directory. CC identifies projects by git root.
  2. MEMORY.md index: Individual memory files must be listed in ~/.claude/projects/<encoded-path>/memory/MEMORY.md. Files not indexed are not loaded.
  3. Path encoding: CC encodes paths by replacing both / and . with -. For example, /Users/you/.config/myapp encodes to -Users-you--config-myapp (note double dash from /. becoming --).

Eval probes all showing "no-difference"

If synthetic probes pass in all layers (including "none"), check for stale memory.disabled/ directories under ~/.claude/projects/. These prevent the memory toggle from working. Run with --recreate-fixture to get a clean state.

Architecture

Component Location Purpose
Sync script memory/scripts/sync-memory-to-obsidian.py SessionEnd hook: sync, activation tracking, staleness detection
Eval script memory/scripts/eval-memory.py Measure memory system effectiveness via replay probes and corpus analytics
Distill skill memory/skills/distill/SKILL.md Two-phase corpus distillation and concept formation
Lint skill memory/skills/lint/SKILL.md Semantic health check
Triage skill memory/skills/triage/SKILL.md Inbox-zero triage workflow
Insight skill memory/skills/insight/SKILL.md Cross-project insight filing
Sync skill memory/skills/sync/SKILL.md Manual sync wrapper
Config memory/knowledge/config.yaml Default configuration
Plugin manifest memory/.claude-plugin/plugin.json Plugin metadata for CC

Theoretical foundations

  • Hofstadter & Sander, Surfaces and Essences: Analogy as the Fuel and Fire of Thinking (2013): Loose inspiration for cross-domain pattern detection. The book's vision of fluid, dynamic concepts goes far beyond what this system implements.
  • CoALA: Cognitive Architectures for Language Agents (Princeton, 2023): Working/episodic/semantic/procedural memory taxonomy
  • semantic-memory (ACT-R activation model): Inspiration for activation tracking
  • MemOS (MemCube metadata model): Inspiration for provenance tracking

About

Claude Code plugin for memory knowledge management: sync to Obsidian, semantic linting, cross-project insights, and memory lifecycle governance

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages