Memory

From BEKO2210/Firstbrain · View interactive version

Memory is an AI agent skill from the GitHub repository BEKO2210/Firstbrain. View and manage Claude's memory -- insights, project context, and embedding status

How to use this skill

Skill file

/memory -- Memory Dashboard

A single entry point to understand what Claude knows -- "a dashboard for your AI's brain." Shows working memory summary, long-term insights, active project memories, and embedding index status.

Usage

Memory Architecture Overview

Claude operates with a four-layer memory model:

| Layer | Name | Storage | Persistence |

|-------|------|---------|-------------|

| 1 | Session Memory | In-context | Single conversation |

| 2 | Working Memory | MEMORY.md + .claude/memory/ topic files | Cross-session |

| 3 | Long-term Summary Memory | .claude/memory/insights.md | Weeks/months |

| 4 | Project-specific Memory | .claude/memory/project-{name}.md files | Project lifetime |

Execution Flow: `/memory` (overview)

  1. Load memory-utils.cjs:

```javascript

const { generateMemoryOverview } = require('./.agents/skills/memory/memory-utils.cjs');

```

  1. Call generateMemoryOverview('.').
  2. Present formatted dashboard to user.

Output includes: working memory summary, insight count + categories + top entries, active project memories with status, embedding index status.

Execution Flow: `/memory insights`

  1. Load and parse insights.md:

```javascript

const { parseInsights } = require('./.agents/skills/memory/memory-utils.cjs');

const data = parseInsights('.');

```

  1. Display all categories with full insight details (title, observation, confidence, observation count, last seen).
  2. Sort by confidence descending within each category.

Execution Flow: `/memory projects`

  1. List all .claude/memory/project-*.md files.
  2. For each file, display project name, status, last updated date.
  3. If archive directory exists, note archived projects.

Execution Flow: `/memory distill`

  1. Ensure fresh indexes: run /scan if indexes are stale.
  2. Load vault-index.json and tag-index.json:

```javascript

const { loadJson } = require('./.agents/skills/scan/utils.cjs');

const vaultIndex = loadJson('.claude/indexes/vault-index.json');

const tagIndex = loadJson('.claude/indexes/tag-index.json');

```

  1. Gather activity log from session actions.
  2. Call distillation:

```javascript

const { distillInsights } = require('./.agents/skills/memory/memory-utils.cjs');

const result = distillInsights('.', vaultIndex, tagIndex, { activityLog });

```

  1. Report: "Distilled insights: {added} new, {reinforced} reinforced, {decayed} decayed, {pruned} pruned. Total: {total}"
  2. If significant new insights found, display them with "Pattern noticed:" callout format.

Automatic Distillation Triggers

Claude should distill without being asked when either threshold is met:

Either signal meeting threshold triggers distillation. These are guidelines -- Claude uses judgment on when to run distillation and when to stay silent.

Notification policy: Notify for significant updates (new patterns, high-confidence reinforcements). Stay silent for minor ones (small confidence adjustments, no new insights). This is at Claude's discretion.

Insight Surfacing

When proactively surfacing insights during conversation, use a distinct visual callout block:

Pattern noticed: You frequently tag tool notes with both the tool name and #productivity.

Want me to apply this pattern to your new Docker note?

Rules for surfacing:

Project Memory Lifecycle

Creation

Updates

Archive

1. File copies to .claude/memory/archive/project-{slug}.md (never deleted -- governance)

2. Key decisions and context are distilled into insights.md as "Project Lessons" category entries

3. Lessons start at confidence 0.6 (higher than default -- concrete observations)

4. Archived file's frontmatter status updates to 'archived'

const { archiveProjectMemory } = require('./.agents/skills/memory/memory-utils.cjs');
const result = archiveProjectMemory('.', 'website-relaunch');
// { archived: true, path: '...', lessonsDistilled: 3 }

Structure

Individual files per project. Each tracks:

User Editing

insights.md is plain markdown -- the user can edit, correct, or delete entries directly. Claude respects all user modifications on next read. No special format required beyond the H2/H3 heading structure.

If the user corrects an insight's observation text or confidence, Claude uses the updated values going forward. If the user deletes an insight, Claude does not recreate it unless the pattern re-emerges strongly.

Code Example

const {
  generateMemoryOverview,
  distillInsights,
  parseInsights,
  createProjectMemory,
  archiveProjectMemory,
  getActiveProjects,
} = require('./.agents/skills/memory/memory-utils.cjs');
const { loadJson } = require('./.agents/skills/scan/utils.cjs');

// Show dashboard
const dashboard = generateMemoryOverview('.');
console.log(dashboard);

// Manually distill
const vaultIndex = loadJson('.claude/indexes/vault-index.json');
const tagIndex = loadJson('.claude/indexes/tag-index.json');
const result = distillInsights('.', vaultIndex, tagIndex, { activityLog: [] });

// Create project memory
const projects = getActiveProjects('.');
for (const project of projects) {
  createProjectMemory('.', project);
}

Limitations

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.