memex-agentic-memory
Skill142 starsChanged 3 months agoMITView on GitHub
A-MEM-inspired agentic memory workflow for structured knowledge capture.
In this repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-prompts-warmupSkill
- memex-best-practicesSkill
- memex-organizeSkill
- memex-recallSkill
- memex-retroSkill
- memex-syncSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
17 rules. About 0 are common, 13 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 22
Before proceeding, locate .memexrc using the same precedence as core memex:
- Very specific: line 28
Check that experimental.agenticMemory is exactly true.
- Distinctive: line 55
Not reusable across future sessions
- Distinctive: line 57
If nothing is worth remembering, stop here.
- Distinctive: line 66
Context: Add explicit project/domain context when the insight would be ambiguous without it
- Distinctive: line 91
Before writing, search for related existing cards.
- Distinctive: line 99
If semantic search fails or is unavailable, fall back to keyword search:
- Distinctive: line 105
Read the top candidates that look relevant:
- Distinctive: line 135
Before writing, produce a preview of planned changes:
- Very specific: line 150
Use existing memex write paths:
- Distinctive: line 172
Only modify the specific fields previewed in Step 6.
- Distinctive: line 195
No auto-linking: Never add links based solely on keyword overlap or embedding score.
- Distinctive: line 196
No silent mutation: Never update an existing card without the preview step.
- Distinctive: line 197
Preserve frontmatter: When updating, copy all existing frontmatter fields.
- Distinctive: line 198
Metadata as strings: Use comma-separated strings for keywords/tags, not arrays.
- Distinctive: line 199
No raw secrets: Never search for or write actual secrets, credentials, tokens, or exact secret file contents.
- Very specific: line 200
Fallback: If the feature flag is disabled, use memex-retro instead.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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.
Files
Agentic Memory Skill (Experimental)
An A-MEM-inspired workflow that uses existing memex primitives to produce higher-quality memory cards through structured observation, enrichment, retrieval, and deliberate linking.
This skill is experimental and requires opt-in.
Prerequisite: Feature Flag Guard
Before proceeding, locate .memexrc using the same precedence as core memex:
$MEMEX_HOME/.memexrc(ifMEMEX_HOMEenv var is set)- Walk up from the current directory looking for
.memexrc ~/.memex/.memexrc(fallback)
Check that experimental.agenticMemory is exactly true.
If the flag is missing, false, or not exactly true, STOP. Use the standard
memex-retro skill instead. Do not proceed with the agentic workflow.
Tools Available
Three equivalent interfaces — use whichever your environment supports:
| CLI (memex in PATH) | Plugin CLI fallback (Claude Code) | MCP tool (VSCode / Cursor) |
memex search <q> | node ~/.claude/plugins/cache/cc-plugins/memex/*/dist/cli.js search <q> | memex_search with query arg |
memex read <slug> | node ~/.claude/plugins/cache/cc-plugins/memex/*/dist/cli.js read <slug> | memex_read with slug arg |
memex write <slug> | node ~/.claude/plugins/cache/cc-plugins/memex/*/dist/cli.js write <slug> | memex_write with slug arg and body |
Resolution order: Try memex in PATH first. If not found, use the plugin
fallback or MCP tools.
Workflow
Step 1: Input Triage
Identify whether there is a memory-worthy insight from the completed work.
Skip if the content is:
- Temporary or session-specific (current task state, in-progress work)
- Obvious or well-known (standard library usage, common patterns)
- Not reusable across future sessions
If nothing is worth remembering, stop here.
Step 2: Draft Atomic Card
For each insight, draft one card:
- Title: Short, descriptive
- Slug: English kebab-case (e.g.,
yaml-array-roundtrip-bug) - Body: One atomic insight in your own words. Distill, don't copy.
- Context: Add explicit project/domain context when the insight would be ambiguous without it
Step 3: Metadata Draft
Generate candidate metadata as simple string fields:
---
title: <title>
created: <YYYY-MM-DD>
source: <client>
category: <optional>
context: <one sentence explaining domain and purpose>
keywords: <3-8 salient terms, comma-separated>
tags: <broad categories, comma-separated>
---Important: Store context, keywords, and tags as comma-separated
strings, not YAML arrays. This avoids frontmatter serialization issues with
the current stringifyFrontmatter implementation.
Step 4: Candidate Retrieval
Before writing, search for related existing cards.
Try semantic search first:
memex search "<topic query>" --semantic --compact --limit 8If semantic search fails or is unavailable, fall back to keyword search:
memex search "<topic query>" --compact --limit 8Read the top candidates that look relevant:
memex read <slug>Limits to avoid runaway retrieval:
- Max candidate searches: 3
- Max cards read: 10
- Max link hops: 2
Step 5: Decision
Choose exactly one primary action per insight:
| Action | When |
| create | No existing card covers the insight. Embed [[wikilinks]] in the new card pointing to related candidates when meaningfully related. |
| update | Existing card covers the same insight but lacks new detail |
| skip | Insight is duplicate, too obvious, or not durable |
Rules:
- Merge/archive is out of scope for this version unless the user explicitly asks.
- Links must be chosen by the agent after reading candidate cards. Embedding similarity or keyword match is only a candidate signal, not an automatic link decision.
- Updating existing cards is allowed only after preview (Step 6).
Step 6: Preview
Before writing, produce a preview of planned changes:
Planned memory changes:
- create: <slug> (<title>)
- update: <slug> because <reason why update is better than new card>
- links: [[a]], [[b]] because <relationship explanation>
- metadata: context/keywords/tags draftFor updates to existing cards, the agent MUST explain why updating is preferable to creating a new card.
Step 7: Write
Use existing memex write paths:
memex write <slug> << 'EOF'
---
title: <title>
created: <YYYY-MM-DD>
source: <client>
category: <optional>
context: <one sentence>
keywords: <comma-separated terms>
tags: <comma-separated categories>
---
<One atomic insight in your own words.>
This relates to [[existing-card]] because <explicit relationship explanation>.
EOFOn update, copy ALL existing frontmatter fields from the current card (title, created, source, category, context, keywords, tags, and any custom fields). Only modify the specific fields previewed in Step 6. Append new information to the body.
Step 8: Verify
After writing:
memex read <slug>Confirm:
- Required frontmatter exists (title, created, source)
- Wikilinks are syntactically valid (
[[slug]]format) - Body contains the intended insight
Rules
- Atomic: One insight per card. Multiple insights = multiple cards.
- Own words: Distill and rephrase. Don't copy-paste.
- Links in context:
[[links]]must appear in sentences explaining the relationship.- Good: "This contradicts the approach in [[jwt-migration]] — stateless tokens can't be revoked."
- Bad: "Related: [[jwt-migration]]"
- No auto-linking: Never add links based solely on keyword overlap or embedding score.
- No silent mutation: Never update an existing card without the preview step.
- Preserve frontmatter: When updating, copy all existing frontmatter fields. Only change fields explicitly previewed.
- Metadata as strings: Use comma-separated strings for keywords/tags, not arrays.
- No raw secrets: Never search for or write actual secrets, credentials, tokens, or exact secret file contents. Use redacted examples and abstract descriptions instead.
- Fallback: If the feature flag is disabled, use
memex-retroinstead.
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
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.

