Files
basicmachines-co-basic-memory/plugins/claude-code
phernandez 3ff40d51fc feat(plugins): rebuild Claude Code plugin as the memory bridge (v0.4 Phase 1)
Reframes the Claude Code plugin as the bridge between Claude's working
memory and Basic Memory's durable graph, per plugins/claude-code/DESIGN.md.
This is the minimal-first vertical slice with a clean break from v0.3.x.

Added:
- hooks/session-start.sh — SessionStart brief: one structured `type: task`
  query against the configured (or default) project + always-on recall
  prompt. Plain stdout, silent if BM is absent.
- hooks/pre-compact.sh — PreCompact checkpoint: writes a `type: session`
  note before compaction (extractive). Only writes when primaryProject is
  set, so it never touches an un-opted-in graph.
- output-styles/basic-memory.md — capture reflexes (search-first, typed
  decision notes, cite permalinks); keep-coding-instructions: true.
- schemas/{session,decision,task}.md — picoschema seeds (validation: warn)
  so plugin-written notes are findable via metadata_filters. task mirrors
  the memory-tasks skill.
- settings.example.json — copyable config with sensible defaults.

Removed (clean break):
- the six bundled skills, the basic-memory-manager agent, the
  PreToolUse/PostToolUse write_note hooks, the basic-memory config-note
  convention, and PLUGIN.md. Equivalent workflows live in top-level skills/.

Other:
- Rewrote scripts/validate_claude_plugin.py for the new layout (hooks +
  output-style + schemas; agent dropped; skills optional). Passes
  `just package-check-claude-code` incl. `claude plugin validate --strict`.
- Rewrote README around the bridge story; updated CHANGELOG, marketplace
  descriptions, and the AGENTS.md package-check note.
- Hooks tested end-to-end against throwaway projects (brief surfaces tasks;
  checkpoint writes a queryable session note; both degrade silently).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: phernandez <paul@basicmachines.co>
2026-05-31 12:31:08 -05:00
..

Basic Memory for Claude Code

The bridge between Claude's working memory and Basic Memory's durable knowledge graph.

Claude Code now keeps its own auto-memory — fast, in-context notes Claude writes to itself. Basic Memory is the other half: a searchable, portable, semantic graph of markdown files you and Claude both own. This plugin connects the two so you get the documented "use both" setup automatically: Claude starts each session briefed from the graph, and checkpoints the session back to it before the context window compacts.

This package lives in the canonical basic-memory repository under plugins/claude-code/ and only works with Claude Code. For framework-agnostic skills that work in any MCP agent, see the top-level skills/ directory.

What it does

  • Session briefing (SessionStart hook). When a session begins, the plugin queries Basic Memory for your active tasks and recent work and puts a short brief in front of Claude — so you start where you left off instead of cold.
  • Compaction checkpoint (PreCompact hook). Right before Claude Code compacts the context window, the plugin writes a type: session checkpoint note to the graph, so the texture of the session survives and the next one can resume from it.
  • Capture reflexes (output style). An opt-in output style teaches Claude to search the graph before answering recall questions, capture real decisions as typed decision notes, and cite permalinks.
  • Seed schemas. Picoschema definitions for session, decision, and task notes, so the stuff the plugin writes is structured and findable by search_notes metadata filters — recall is precise, not fuzzy.

The full design and rationale live in DESIGN.md.

Requirements

  • Basic Memory >= 0.19.0 installed and configured as an MCP server (uv tool install basic-memory).
  • Claude Code.

Installation

claude plugin marketplace add basicmachines-co/basic-memory --sparse .claude-plugin plugins/claude-code
claude plugin install basic-memory@basicmachines-co

Configuration

The hooks work out of the box against your default Basic Memory project — no config required. To pin a specific project (recommended, and required for the PreCompact checkpoint to write), add a basicMemory block to your project's .claude/settings.json. Copy settings.example.json and set primaryProject:

{
  "basicMemory": {
    "primaryProject": "my-project",
    "captureFolder": "sessions"
  }
}

To enable the capture reflexes, also set "outputStyle": "basic-memory" in your settings (or select it via /config).

Key Default What it does
primaryProject (default project) Where briefs read from and checkpoints write to
captureFolder sessions Folder for PreCompact checkpoint notes
recallTimeframe 3d Recency window for the session brief
recallPrompt (built-in) The instruction appended to the brief
preCompactCapture extractive How checkpoints are produced

See DESIGN.md for the complete configuration schema, the Claude-Code-project ↔ Basic-Memory-project mapping, and team-workspace behavior.

Development

From the monorepo root:

just package-check-claude-code

From this directory:

just check

just check validates the manifests, hooks, output style, and seed schemas, then runs claude plugin validate . --strict.

License

MIT