Skip to content
cccskills
FreePublished on GitHub

perpetual-memory

Use when you need to auto-log all tool interactions into a self-organizing vector DB with instant recall. Intercepts interactions, extracts key information, generates embeddings, stores in LanceDB, auto-categorizes, and builds a retrieval index. Inspired by OpenClaw SQLite LCM + summary DAG pattern.

The English summary is being prepared. Showing the original description.

See how to install

Files included (10)

  • SKILL.md7.2 KB
  • commands/perpetual-memory.md116 B
  • hooks/post-execute.cjs185 B
  • hooks/pre-execute.cjs291 B
  • references/research-requirements.md454 B
  • rules/perpetual-memory.md389 B
  • schemas/input.schema.json506 B
  • schemas/output.schema.json301 B
  • scripts/main.cjs2.9 KB
  • templates/implementation-template.md321 B

SKILL.md (original)

Review the instructions the agent will receive before you install.

Perpetual Memory

Overview

Auto-embed all tool interactions into a vector store without explicit "remember" commands. Every significant interaction is captured, categorized, and stored in LanceDB for instant semantic recall across sessions.

Core principle: If it happened and it mattered, it is in perpetual memory. No explicit "remember" commands needed. The system auto-captures decisions, learnings, patterns, gotchas, and issues from every agent interaction.

When to Use

  • After completing any significant task (auto-triggered)
  • When agents produce findings, decisions, or learnings
  • When debugging reveals root causes or workarounds
  • When architectural decisions are made
  • When new patterns or anti-patterns are discovered
  • At session boundaries to capture session summaries

Do NOT use for:

  • Trivial read-only queries that produce no insights
  • Ephemeral debugging output that has no lasting value
  • Duplicate content already in the memory system

Integration with Existing Memory System

This skill extends (does NOT replace) the existing memory system:

SystemPurposePerpetual Memory Role
learnings.mdHuman-readable learning archiveAuto-populates from embeddings
decisions.mdADR-style decisionsIndexes for semantic recall
issues.mdKnown blockers and workaroundsIndexes for semantic recall
patterns.jsonStructured patterns (MemoryRecord)Deduplicates against
gotchas.jsonStructured gotchas (MemoryRecord)Deduplicates against
memory-search.cjsSemantic search over markdownComplementary (different index)
pnpm search:codeCode search (BM25 + semantic)Does NOT interfere
perpetual_memory tableVector store of all interactionsPrimary perpetual store

Workflow

Step 1: Intercept Interaction

After a tool completes (PostToolUse), extract the significant content:

  • TaskUpdate completions with metadata.summary
  • Write/Edit operations with file paths and descriptions
  • Bash command outputs with significant findings
  • Skill invocation results

Step 2: Extract Key Information

From the raw interaction, extract:

  • What happened: One-line summary of the action
  • Why it matters: The significance or decision rationale
  • Context: Agent name, task ID, affected files
  • Category signal: Keywords that indicate decision/learning/pattern/gotcha/issue

Step 3: Generate Embeddings and Store

# Embed and store via the auto-embed CLI tool
node .claude/tools/cli/auto-embed.cjs \
  --text "Discovered that routing-guard.cjs blocks Write on creator paths. This is Gate 4 enforcement." \
  --agent developer \
  --task-id task-12 \
  --category learning

Step 4: Auto-Categorize

The tool auto-categorizes based on keyword matching:

CategoryTrigger Keywords
decisiondecided, chose, selected, tradeoff, rationale, ADR
learninglearned, discovered, found that, realized, insight
patternpattern, approach, technique, best practice, convention
gotchagotcha, pitfall, anti-pattern, risk, warning, sharp edge
issueissue, bug, error, broken, failing, blocker, regression

Override with --category <name> when auto-detection is wrong.

Step 5: Deduplication

Before storing, the tool checks similarity against existing entries:

  • Default threshold: 0.92 (92% cosine similarity)
  • If a near-duplicate exists, the store is skipped
  • Configurable via --dedup-threshold <float>

Step 6: Build Retrieval Index

The LanceDB perpetual_memory table automatically maintains a vector index. Queries use ANN (Approximate Nearest Neighbor) search for sub-second retrieval.

CLI Reference

# Store an interaction
node .claude/tools/cli/auto-embed.cjs --text "interaction text" --agent developer --task-id task-5

# Query perpetual memory
node .claude/tools/cli/auto-embed.cjs --query "how does routing work" --limit 10

# View statistics
node .claude/tools/cli/auto-embed.cjs --stats

# Pipe from stdin
echo "important finding" | node .claude/tools/cli/auto-embed.cjs --stdin --agent qa

Agent Integration

All agents should embed significant findings at task completion:

// In TaskUpdate(completed) metadata handler:
// Auto-embed the summary into perpetual memory
const summary = metadata.summary;
if (summary && summary.length > 20) {
  // The auto-embed tool handles categorization and dedup
  Bash({
    command: `node .claude/tools/cli/auto-embed.cjs --text "${summary.replace(/"/g, '\\"')}" --agent ${agentType} --task-id ${taskId}`,
  });
}

Iron Laws

  1. NEVER store secrets, credentials, or PII in perpetual memory -- sanitize before embedding.
  2. ALWAYS deduplicate before storing -- duplicate embeddings waste storage and pollute retrieval.
  3. NEVER break existing memory-search.cjs -- perpetual memory is an additional layer, not a replacement.
  4. ALWAYS include agent and task-id metadata -- unattributed memories cannot be traced or audited.
  5. NEVER embed raw tool output verbatim -- extract the insight, not the noise.

Anti-Patterns

Anti-PatternWhy It FailsCorrect Approach
Embedding raw Bash outputNoise drowns signal; embeddings are low qualityExtract the finding or decision from the output
Skipping deduplicationStorage bloat; retrieval quality degradesAlways use dedup threshold (default 0.92)
Replacing markdown memory filesBreaks existing agent workflows that read .mdPerpetual memory supplements, never replaces
Storing without agent/task metadataCannot trace or audit memory provenanceAlways pass --agent and --task-id
Embedding everythingContext pollution; irrelevant results in queriesOnly embed significant findings and decisions

Memory Protocol (MANDATORY)

Before starting: Read .claude/context/memory/learnings.md

After completing:

  • New pattern -> .claude/context/memory/learnings.md
  • Issue found -> .claude/context/memory/issues.md
  • Decision made -> .claude/context/memory/decisions.md

ASSUME INTERRUPTION: If it's not in memory, it didn't happen.

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Ensure accessibility in UI components including semantic HTML, ARIA attributes, keyboard navigation, and WCAG 2.2 AA compliance.

The English summary is being prepared. Showing the original description.

oimiragieo/agent-studio42Updated Jul 14, 2026

Use when you want to improve response quality through meta-cognitive reasoning. Applies 15+ reasoning methods to reconsider and refine initial outputs.

The English summary is being prepared. Showing the original description.

oimiragieo/agent-studio42Updated Jul 14, 2026

N-round opposing-stance debates for trade-off analysis. Assigns pro/con roles to agents, runs structured debate rounds with quality scoring, and produces a moderator synthesis with confidence-rated recommendation. Generalizable to architecture, technology, security, and design decisions.

The English summary is being prepared. Showing the original description.

oimiragieo/agent-studio42Updated Jul 14, 2026

Force adversarial code review stance that eliminates confirmation bias — reviewer must find issues or re-analyze

The English summary is being prepared. Showing the original description.

oimiragieo/agent-studio42Updated Jul 14, 2026

Creates specialized AI agents on-demand when no existing agent matches a request. Use when the Router cannot find a suitable agent for a task. Enables self-evolution by generating persistent agents.

The English summary is being prepared. Showing the original description.

oimiragieo/agent-studio42Updated Jul 14, 2026

LLM-as-judge evaluation framework with 5-dimension rubric (accuracy, groundedness, coherence, completeness, helpfulness) for scoring AI-generated content quality with weighted composite scores and evidence citations

The English summary is being prepared. Showing the original description.

oimiragieo/agent-studio42Updated Jul 14, 2026

See all skills by oimiragieo

Report a problem with this skill