claudemem

package
v0.1.5421 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package claudemem reads the memories claude-mem (the Claude Code memory plugin, github.com/thedotmack/claude-mem) keeps, for the Memory page to import them (#8642). It only reads: claude-mem's database is opened read-only in place and nothing of its folder is written, moved or removed.

claude-mem keeps one SQLite database, claude-mem.db (WAL mode), in its data folder: CLAUDE_MEM_DATA_DIR from the environment, else the one ~/.claude-mem/settings.json names, else ~/.claude-mem (src/shared/data-dir.ts). Its tables, as SessionStore.ts makes and migrates them:

  • observations: what was learned in a session, one row each. Rows from before v21 hold their content in text; later rows in title, subtitle, narrative and facts (a JSON array of strings), with text NULL. type is the mode's observation type (code mode: bugfix, feature, refactor, change, discovery, decision, gotcha, pattern, security_alert, security_note, sensitive).
  • session_summaries: one or more a session: request, investigated, learned, completed, next_steps, notes.
  • sdk_sessions: the sessions, with the folder each ran in (cwd, from v53) under the project's name.

project is a name claude-mem made (the git root's folder name, an owner/repo slug, a marker folder's name), merged_into_project the one a later merge moved the row to. created_at_epoch is milliseconds. Columns came in over many versions, so each is read only when the table has it.

Index

Constants

View Source
const Agent = "claude-mem"

Agent is the name an imported memory's source gives.

View Source
const DBName = "claude-mem.db"

DBName is claude-mem's database in its data folder.

Variables

This section is empty.

Functions

func Dir

func Dir() string

Dir is claude-mem's data folder, as claude-mem itself decides it (resolveDataDir): CLAUDE_MEM_DATA_DIR, else the one settings.json in ~/.claude-mem names, else ~/.claude-mem. "" when there is no home.

func Find

func Find() (string, error)

Find is claude-mem's database: "" with no error when there is none, an error when whether there is one can't be told.

func Memories

func Memories(s *Store, known map[string]*memory.Project) ([]*memory.Memory, []*memory.Project)

Memories are the store's observations and session summaries as magpie memories, each waiting to be reviewed (Candidate) as imported, with the time claude-mem saved it. A project's memories go to the project its sessions' folders are in, else to the one of known whose name is the project's when only one is, else everywhere (tagged with the project's name). Each has an id made from what claude-mem holds, so a second import names the same memories (memory.Import skips them). A row with no text is left out. The projects the memories are kept for are returned too.

Types

type Observation

type Observation struct {
	ID        int64
	Session   string // memory_session_id
	Project   string // the project it was saved under
	Merged    string // merged_into_project, "" when not merged
	Type      string
	Text      string // the content of a row from before v21
	Title     string
	Subtitle  string
	Narrative string
	Facts     []string
	Created   time.Time
}

Observation is one row of observations, as read.

type Store

type Store struct {
	Path         string
	Observations []Observation
	Summaries    []Summary
	// Folders are the folders each project's sessions ran in, newest
	// first, by project name
	Folders map[string][]string
}

Store is what a claude-mem database holds.

func Read

func Read(path string) (*Store, error)

Read reads claude-mem's database at path. Any failure is an error: a database that can't be read is unknown, never empty.

type Summary

type Summary struct {
	ID        int64
	Session   string
	Project   string
	Merged    string
	Request   string
	Learned   string
	Completed string
	Notes     string
	Created   time.Time
}

Summary is one row of session_summaries, as read.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL