brain-merge
Skill109 starsChanged 39 days agoMITView on GitHub
Compare and selectively merge Brain directories across any two agent instances. Supports diff (see what's unique where), pull (import from another brain), and learn (bidirectional exchange).
In this repository61 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- adviseSkill
- ai-crystallizeSkill
- analyze-kbSkill
- auto-discoverySkill
- benchmark-memorySkill
- changelog-protocolSkill
- coherence-sweepSkill
- compute-lifecycleSkill
- create-articleSkill
- create-explanatory-imageSkill
- decideSkill
- deep-researchSkill
- detect-tensionsSkill
- dialecticSkill
- domain-watchSkill
- elicitation-techniquesSkill
- epistemic-classificationSkill
- epub-chapter-extractorSkill
- extract-document-insightsSkill
- extract-insightsSkill
- find-connectionsSkill
- first-runSkill
- get-perspective-onSkill
- get-youtube-transcriptSkill
- git-commit-pushSkill
- graduate-insightsSkill
- incubation-loopSkill
- ingest-sourceSkill
- insight-capture-formatSkill
- insight-interviewSkill
- integrate-recent-notesSkill
- learn-new-thingsSkill
- manage-reference-dataSkill
- manage-thinking-topicsSkill
- manage-watching-domainsSkill
- multi-format-book-extractorSkill
- nano-banana-image-generatorSkill
- propagate-changeSkill
- quick-searchSkill
- reasoning-checksSkill
- recallSkill
- ref-auditSkill
- ref-bridgeSkill
- ref-ingestSkill
- ref-querySkill
- ref-reconcileSkill
- ref-refreshSkill
- refresh-indexSkill
- ref-supersedeSkill
- scheduled-runSkill
- scope-mountSkill
- search-vaultSkill
- self-diagnosticSkill
- start-hereSkill
- synthesize-insightsSkill
- talkSkill
- test-memory-systemSkill
- think-about-itSkill
- update-changelogSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 8 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
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
- Distinctive: line 20
pull: - Import files from a source brain into a target brain
- Distinctive: line 35
Ask the user for:
- Distinctive: line 40
If paths are ambiguous (user says "moltbook" or "the other one"), scan parent directories for Brain/ folders and present a pick list:
- Distinctive: line 97
Goal: Import specific files from source into target, safely.
- Very specific: line 103
If not specified, ask: "Which folders or files to pull?
- Distinctive: line 148
If approved, run pull source → target.
- Distinctive: line 180
Index refresh: - always runs after file changes so FAISS stays current
- Very specific: line 184
If copy fails mid-way: re-run - --ignore-existing makes it idempotent
- Very specific: line 185
If index build fails: run /refresh-index manually in that agent
- Distinctive: line 186
If paths not found: re-run Step 0 discovery scan
- Distinctive: line 190
After completing this skill's primary task, consider tactical improvements:
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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
Brain Merge
Compare and selectively merge knowledge between any two Brain directories. Works across any agent instances - not tied to specific paths.
Purpose
Agent brains develop independently and accumulate unique insights. This playbook lets you see what each brain has that the other doesn't, and move knowledge between them safely.
Modes
- diff - Compare two brains, see what's unique to each
- pull - Import files from a source brain into a target brain
- learn - Bidirectional exchange with approval at each direction
State Dependencies
| Source | Location | Read | Write |
| Source brain | User-specified path | ✓ | - |
| Target brain | User-specified path (defaults to current) | ✓ | ✓ |
| FAISS index | [agent-root]/resources/local-brain-search/data/ | - | ✓ |
Process
Step 0: Resolve inputs
Ask the user for:
- Source brain path - the brain to compare against or pull from
- Target brain path - the brain to compare or import into (default: current agent's
./Brain) - Mode - diff, pull, or learn (infer from user's message if obvious)
If paths are ambiguous (user says "moltbook" or "the other one"), scan parent directories for Brain/ folders and present a pick list:
find /Users/yourname/Dropbox/Agents -maxdepth 2 -name "Brain" -type d 2>/dev/null | sortDIFF MODE
Goal: Show what each brain has that the other doesn't, grouped by folder.
Step 1: Inventory both brains
SOURCE="[SOURCE_BRAIN_PATH]"
TARGET="[TARGET_BRAIN_PATH]"
find "$SOURCE" -name "*.md" | sed "s|$SOURCE/||" | sort > /tmp/brain_source.txt
find "$TARGET" -name "*.md" | sed "s|$TARGET/||" | sort > /tmp/brain_target.txt
echo "Source: $(wc -l < /tmp/brain_source.txt) files"
echo "Target: $(wc -l < /tmp/brain_target.txt) files"Step 2: Generate diff lists
comm -23 /tmp/brain_source.txt /tmp/brain_target.txt > /tmp/unique_to_source.txt
comm -13 /tmp/brain_source.txt /tmp/brain_target.txt > /tmp/unique_to_target.txt
comm -12 /tmp/brain_source.txt /tmp/brain_target.txt > /tmp/in_both.txt
echo "Unique to source: $(wc -l < /tmp/unique_to_source.txt)"
echo "Unique to target: $(wc -l < /tmp/unique_to_target.txt)"
echo "In both: $(wc -l < /tmp/in_both.txt)"Step 3: Group by folder and present
echo "=== UNIQUE TO SOURCE ==="
awk -F'/' '{print $1}' /tmp/unique_to_source.txt | sort | uniq -c | sort -rn
echo "=== UNIQUE TO TARGET ==="
awk -F'/' '{print $1}' /tmp/unique_to_target.txt | sort | uniq -c | sort -rnFor each folder, show a few sample filenames so the user gets a sense of what's there.
Present as a clean table. Note any folders that exist in one brain but not the other (structural differences).
Gate 1: Present report. Ask: "Want to pull any of this into your brain? Which folders or files?"
PULL MODE
Goal: Import specific files from source into target, safely.
Step 1: Run diff if not already done
Step 2: Clarify scope
If not specified, ask: "Which folders or files to pull? (e.g., 02-Permanent, AI Extracted Notes, all unique files, or specific filenames)"
Gate 2: Confirm scope before touching anything:
"About to copy [N] files from [source] → [target]. Files already in target will be SKIPPED. Proceed?"
Step 3: Execute copy
rsync -av --ignore-existing \
"[SOURCE]/[SELECTED_FOLDER]/" \
"[TARGET]/[SELECTED_FOLDER]/"For full unique-file pull:
while IFS= read -r file; do
dest="[TARGET]/$file"
mkdir -p "$(dirname "$dest")"
cp -n "[SOURCE]/$file" "$dest"
done < /tmp/unique_to_source.txtStep 4: Refresh index in target
cd [TARGET_AGENT_ROOT]
python3 resources/local-brain-search/build_index.pyReport total files copied, skipped, and confirm index refreshed.
LEARN MODE
Goal: Bidirectional exchange - each brain gets what the other has.
Step 1: Run diff (both directions)
Step 2: Source → Target
Show what source has that target doesn't.
Gate 3: "Source has [N] unique files. Pull into target? (y/n/select folders)"
If approved, run pull source → target.
Step 3: Target → Source
Show what target has that source doesn't.
Gate 4: "Target has [M] unique files. Push into source? (y/n/select folders)"
If approved:
rsync -av --ignore-existing \
"[TARGET]/[SELECTED_FOLDER]/" \
"[SOURCE]/[SELECTED_FOLDER]/"Step 4: Refresh indexes in both agents
cd [TARGET_AGENT_ROOT] && python3 resources/local-brain-search/build_index.py
cd [SOURCE_AGENT_ROOT] && python3 resources/local-brain-search/build_index.pyReport: files exchanged in each direction, both indexes refreshed.
Tips
- Start with diff - understand what you're working with before moving anything
- Safe by default -
--ignore-existing/cp -nnever overwrites existing files - Content conflicts - files with the same name but different content are flagged but not auto-resolved; manual review recommended
- Structural differences - folders that exist in one brain but not the other are worth noting (may indicate the agent evolved differently)
- Index refresh - always runs after file changes so FAISS stays current
Error Recovery
- If copy fails mid-way: re-run -
--ignore-existingmakes it idempotent - If index build fails: run
/refresh-indexmanually in that agent - If paths not found: re-run Step 0 discovery scan
Self-Improvement
After completing this skill's primary task, consider tactical improvements:
- Review execution: Were there friction points, unclear steps, or inefficiencies?
- Identify improvements: Could error handling, step ordering, or instructions be clearer?
- Scope check: Only tactical/execution changes - NOT changes to core purpose or goals
- Apply improvement (if identified):
- Edit this SKILL.md with the specific improvement
- Keep changes minimal and focused
- Version control:
- Stage:
git add .claude/skills/brain-merge/SKILL.md - Commit:
git commit -m "refactor(brain-merge): <brief improvement description>"
- Stage:
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.

