agentleFS
komlukkomluk/scaffolding/skills/semantic-memory-store/SKILL.md

semantic-memory-store

Skill15 starsChanged 2 months agoMITView on GitHub

Store reusable insights in semantic memory for vector-similarity recall. TRIGGER when: an agent discovers a pattern, decision, or gotcha worth retrieving later via embedding search. SKIP: searching/recalling memory (use semantic-memory-mcp); file-based memory writes (use agent-memory).

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 6 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before attempting to store or search, verify a semantic memory backend is reachable:

    line 29
  2. Very specific:

    If mcp__memory__* MCP tools are available, use those (see the semantic-memory-mcp skill).

    line 31
  3. Distinctive:

    If an optional backend service is configured for the project, use its documented interface.

    line 32
  4. Very specific:

    If neither is available, skip this skill entirely and use file-based memory from the agent-memory skill.

    line 33
  5. Distinctive:

    When a semantic memory backend is available, store an entry with the following fields.

    line 37
  6. Distinctive:

    When a semantic memory backend is available, stored memories are automatically recalled by the agent execution pipeline.

    line 82
  7. Very specific:

    No manual retrieval is needed.

    line 89
  8. Distinctive:

    When supported by the backend, content is deduplicated by hash.

    line 103
  9. Distinctive:

    Use both when available: file-based memory for well-organized reference material, semantic memory for fuzzy-match discoverable insights.

    line 114

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Semantic Memory Store

Store knowledge as vector-embedded entries in an optional semantic memory service. When the service is available, entries are automatically embedded and retrievable via cosine similarity search by any agent in future sessions.

This skill is optional. If no semantic memory service is configured, agents should degrade gracefully and rely on the file-based memory described in the agent-memory skill.

When to Use

  • Agent discovers a non-obvious insight worth preserving beyond file-based memory
  • A debugging session reveals a root cause that would help future agents
  • An architectural decision is made that affects multiple components
  • A pattern or anti-pattern is confirmed through implementation experience
  • Cross-project knowledge that does not belong in a single file

When NOT to Use

  • Temporary task context (use conversation memory in .scaffolding/conversations/)
  • Information already in CLAUDE.md, docs/, or KNOWLEDGE.md
  • Large code snippets (use file-based memory instead)
  • Speculative or unverified conclusions

Availability Check

Before attempting to store or search, verify a semantic memory backend is reachable:

  • If mcp__memory__* MCP tools are available, use those (see the semantic-memory-mcp skill).
  • If an optional backend service is configured for the project, use its documented interface.
  • If neither is available, skip this skill entirely and use file-based memory from the agent-memory skill. Do not block on missing infrastructure.

How to Store

When a semantic memory backend is available, store an entry with the following fields. The backend embeds the content and persists it for similarity search.

Parameter Reference

ParameterRequiredDescription
contentYesText to embed and store (keep concise; long content may be truncated)
agent_nameNoAgent that created this memory (e.g. developer, debugger)
content_typeNoOne of: learning, error, pattern, decision (default: learning)
tagsNoList of string tags for filtering
task_idNoSource task ID if applicable
project_idNoAssociated project ID
conversation_idNoAssociated conversation ID

Content Types

TypeUse When
learningGeneral knowledge, best practices, how-to
errorRoot cause analysis, error resolution steps
patternConfirmed code pattern, architecture pattern
decisionArchitecture or design decision with rationale

Examples

Store a debugging insight

Store an entry with:

  • content: "SQLAlchemy async_session_maker bound to one event loop cannot be reused in a worker thread. Create a fresh engine+session per thread to avoid attached-to-different-loop errors."
  • agent_name: debugger
  • content_type: error
  • tags: ["sqlalchemy", "async", "threading"]

Store an architectural decision

Store an entry with:

  • content: "Semantic memory uses a local all-MiniLM-L6-v2 model (384 dims) instead of a hosted embedding API. Zero cost, fast, runs on CPU. Trade-off: lower quality than a hosted model but no API dependency."
  • agent_name: architect
  • content_type: decision
  • tags: ["semantic-memory", "embedding", "architecture"]

How Retrieval Works

When a semantic memory backend is available, stored memories are automatically recalled by the agent execution pipeline. When a task starts, the pipeline:

  1. Embeds the task prompt using the same model
  2. Performs cosine similarity search against stored memories
  3. Returns top-K results within a distance threshold
  4. Injects matching memories into the agent's context as ## Semantic Memory

No manual retrieval is needed. Agents that want to search for specific memories can use the semantic_search MCP tool described in the semantic-memory-mcp skill.

Prerequisites

Semantic memory requires an optional backend service. If your project does not configure one, this skill is inert and file-based memory remains fully functional. When a backend is configured, it typically requires:

  • The semantic memory feature enabled in the backend configuration
  • A datastore for embedded entries
  • An embedding model available to the backend

Consult your project's setup documentation for the exact configuration. Absence of any of these means the skill degrades gracefully to file-based memory.

Deduplication

When supported by the backend, content is deduplicated by hash. Storing the same content twice updates the existing entry (merges tags, updates timestamp) instead of creating a duplicate.

Search-before-store: hash dedup only catches byte-identical content. Backends that distil input into atomic memories (e.g. mem0) split one store call into several entries, so a slightly reworded fact silently bloats the store. Before storing, run a similarity search first; if a near-duplicate already exists, update or skip rather than adding a paraphrase.

Relationship to File-Based Memory

SystemMechanismBest For
File-based (agent-memory skill)Markdown files in .scaffolding/Structured, curated knowledge with manual organization
Semantic memory (this skill)Vector store with embedding searchDiscoverable knowledge via natural language similarity

Use both when available: file-based memory for well-organized reference material, semantic memory for fuzzy-match discoverable insights. When semantic memory is unavailable, file-based memory alone is sufficient.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.