benchmark-memory
Skill109 starsChanged 37 days agoMITView on GitHub
Systematic benchmarking framework for Local Brain Search memory system with LLM-as-judge scoring
- Reads credentials
- Installs packages
In this repository61 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- adviseSkill
- ai-crystallizeSkill
- analyze-kbSkill
- auto-discoverySkill
- brain-mergeSkill
- 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
5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 29
Reproducible: Test against frozen Brain snapshot
- Very specific: line 97
Default model: sonnet (good quality) - haiku is faster/cheaper, opus stronger
- Distinctive: line 114
Create a frozen Brain snapshot and build its index.
- Distinctive: line 295
After running benchmarks, answer these questions:
- Distinctive: line 310
Recommendation: Start with Haiku judge, validate sample against Sonnet.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Benchmark Memory System
Systematic benchmarking framework to measure retrieval quality, compare configurations, and identify optimal parameters for the Local Brain Search memory system.
Purpose
- Measure retrieval quality objectively using LLM-as-judge scoring
- Compare different configuration settings (spreading vs static, parameter sweeps)
- Identify optimal parameters for different query types (factual, conceptual, synthesis)
- Generate reproducible results against frozen test datasets
Design Principles
- Contained: Skill + sub-agent + bundled scripts
- Reproducible: Test against frozen Brain snapshot
- Automated: LLM-as-judge for relevance scoring
- Analyzable: CSV output for analysis
State Dependencies
| Source | Location | Read | Write |
| Brain snapshot | .claude/skills/benchmark-memory/snapshots/ | Yes | Yes |
| Query sets | .claude/skills/benchmark-memory/query-sets/ | Yes | Yes |
| Benchmark results | .claude/skills/benchmark-memory/results/ | Yes | Yes |
| Analysis reports | .claude/skills/benchmark-memory/analysis/ | No | Yes |
| Memory system | resources/local-brain-search/ | Yes | No |
Prerequisites
- Local Brain Search system indexed (
resources/local-brain-search/data/brain.faiss) - Python venv at
resources/local-brain-search/venv/with search dependencies - A container-valid LLM-judge channel (see LLM-as-Judge Scoring below - the channel differs between workstation and Trinity)
LLM-as-Judge Scoring
The judge channel is environment-dependent. Pick it before you run anything.
| Environment | Judge channel | Status |
| the user's workstation | Claude Code headless (claude -p) | Works - the CLI holds a real, refreshable credential on disk |
| Any Trinity container | chat_with_agent (Trinity MCP), or an in-process Task subagent | claude -p DOES NOT WORK - see below |
Why claude -p fails on Trinity (measured 2026-09-16, retrieval-signal-hierarchy AM-10)
A Trinity agent's turn is subscription-authenticated by the platform at process spawn, but that
credential is turn-scoped by design and never written to disk in refreshable form. The container
does ship ~/.claude/.credentials.json, which is why this looks like it should work - but its
accessToken and refreshToken are empty strings. A child claude -p has nothing to read and
dies with Not logged in in about a second. claude --version still succeeds, so it is not a valid
readiness check - a binary on $PATH proves nothing about auth.
Do not work around this by shelling out anyway. Per Trinity ent#643, agents must not spawn the
claude CLI: a subprocess escapes the execution ledger, cost attribution, autonomy gates and
permission enforcement. Task and chat_with_agent are the sanctioned paths.
Container-valid option A - in-process Task subagent
For a judging pass driven from inside this turn, spawn a subagent with the Task tool. It inherits
the turn's authentication, stays inside the execution ledger, and needs no key. Best when the
scoring set is small enough to fan out over a handful of agents and return scores as text.
Container-valid option B - chat_with_agent for delegated/batch work
For a long batch (the 50-query x 15-config sweep), drive chat_with_agent over Trinity MCP.
TRINITY_MCP_URL and TRINITY_MCP_API_KEY are in every agent's environment, so a stdlib-only Python
script can call tools/call -> chat_with_agent over plain HTTP and get a real, subscription-backed
execution. No SDK, no installs, no key. Reference client:
a Trinity MCP client of your own (protocol: Trinity MCP tools/call).
Benchmark-critical hazard: identical messages are DEDUPLICATED into one execution. Same
message-> sameexecution_id-> the same cached response text; the second call never runs. A benchmark that scores the same (query, result) pair twice - score-rescore, rubric perturbation, self-consistency, or simply two configs that retrieve the same note - will record perfect agreement as a pure artifact, and a failed judge call will "retry" forever against its own cached failure. Always put a unique nonce in the message, derived from (query id, config id, model, attempt) so it stays deterministic and resumable.
Two further measured behaviours that matter here: allowed_tools is not enforced (never treat a
judge as sandboxed or blind), but tool use is auditable - get_execution_result(include_log=True)
returns the tools the turn actually held, so verify the judge used none rather than assuming it.
- Default model:
sonnet(good quality) -haikuis faster/cheaper,opusstronger - JSON output via prompt engineering for reliable scoring
Installing Dependencies
Dependencies are installed in the local-brain-search venv:
cd resources/local-brain-search
source venv/bin/activate
pip install pandas tqdm # no anthropic SDK and no API key needed on either channelSub-Commands
/benchmark-memory setup
Create a frozen Brain snapshot and build its index.
cd .claude/skills/benchmark-memory/scripts
./run_benchmark.sh --list-snapshots # Check existing
python3 create_snapshot.py # Create new snapshotWhat it does:
- Creates snapshot directory with date stamp
- Copies Brain folder (excluding .obsidian, .trash)
- Builds FAISS index for the snapshot
- Creates SNAPSHOT-INFO.md with metadata
/benchmark-memory create-queries [--count N]
Generate or manage test query sets.
cd .claude/skills/benchmark-memory/scripts
python build_query_set.py --count 50 --output ../query-sets/core-50.jsonQuery Categories (50 total):
| Category | Count | Example |
| Factual | 10 | "What is dopamine?" |
| Conceptual | 10 | "How does motivation work?" |
| Synthesis | 15 | "Connect Buddhism and neuroscience" |
| Temporal | 5 | "Recent notes about AI agents" |
| Needle | 5 | "Note about intermittent reinforcement" |
| Broad | 5 | "Identity" |
/benchmark-memory run [--config CONFIG] [--snapshot SNAPSHOT]
Execute benchmark with specified configuration.
cd .claude/skills/benchmark-memory/scripts
./run_benchmark.sh --config focused --snapshot brain-snapshot-2026-02-18
./run_benchmark.sh --dry-run --config focused # Preview without execution
./run_benchmark.sh --list-configs # List available configsConfigurations:
focused: 15 key configurations (recommended for initial benchmarking)single:CONFIG_NAME: Run single configurationall: Full parameter sweep (expensive)
Estimated cost per run:
- 50 queries x 10 results x 15 configs = 7,500 LLM scores
- Using Sonnet (default): ~$75
- Using Haiku: ~$7.50
/benchmark-memory analyze [--results FILE]
Generate analysis summary from benchmark results.
cd .claude/skills/benchmark-memory/scripts
python analyze_results.py --results ../results/benchmark-*.csvOutputs:
- Summary by configuration
- Summary by query category
- Best config per intent
- Recommendations
Workflow
Step 1: Setup (one-time)
/benchmark-memory setup
|
v
Step 2: Create Queries (one-time)
/benchmark-memory create-queries --count 50
|
v
Step 3: Run Benchmark (per experiment)
/benchmark-memory run --config focused
|
v
Step 4: Analyze Results
/benchmark-memory analyzeMetrics Collected
Performance Metrics
| Metric | Description |
latency_ms | Query execution time |
iterations | Spreading iterations used |
converged | Whether spreading converged |
Quality Metrics
| Metric | Range | Description |
| Precision@K | 0-1 | Fraction of results that are relevant |
| Recall@K | 0-1 | Fraction of relevant notes found |
| MRR | 0-1 | Mean Reciprocal Rank |
| NDCG@K | 0-1 | Ranking quality with position discount |
| Avg Score | 0-3 | Average LLM relevance score |
LLM-as-Judge Scoring Scale
| Score | Label | Definition |
| 0 | Irrelevant | No connection to query |
| 1 | Tangential | Loosely related |
| 2 | Relevant | Addresses the query |
| 3 | Highly Relevant | Directly answers the query |
Configurations to Test
Baseline
static_baseline: Traditional vector searchspreading_default: Spreading activation with defaults
Parameter Sweeps
- Iteration count: 2, 5, 7
- Inhibition strength: 0.1, 0.3, 0.5
- Temporal decay: 0.8, 0.9, 0.95
- Q-weight: 0.0, 0.3, 0.5
Optimized Combinations
synthesis_optimized: max_iterations=7, inhibition=0.1factual_optimized: max_iterations=2, inhibition=0.5balanced_optimized: max_iterations=5, inhibition=0.2, decay=0.85
Output Files
Results CSV
results/benchmark-YYYY-MM-DD-HHMMSS.csvSchema:
timestamp,config_name,query_id,query_category,mode,max_iterations,
inhibition_strength,latency_ms,result_1_note,result_1_score,...,
precision_at_5,precision_at_10,mrr,ndcg_at_10,avg_scoreAnalysis Report
analysis/report-YYYY-MM-DD.mdError Recovery
Partial benchmark run
Results are appended incrementally. Resume by running with --resume:
python run_benchmark.py --config focused --resumeAPI rate limits
Built-in retry with exponential backoff. Adjust --delay if needed:
python run_benchmark.py --config focused --delay 1.0Invalid snapshot
Re-create snapshot:
python create_snapshot.py --forceSuccess Criteria
- Snapshot creation produces valid index
- Query set covers all 6 categories (50+ queries)
- LLM judge produces consistent scores (>80% agreement on re-run)
- All 15 focused configs can be benchmarked
- Results CSV is valid and analyzable
- Analysis identifies best config per query type
Expected Insights
After running benchmarks, answer these questions:
- Does spreading beat static? For which query types?
- What's the optimal iteration count for synthesis queries?
- Does high inhibition help factual queries?
- Does q_weight > 0 improve results over time?
- What settings work best for each query type?
Cost Management
| Strategy | Savings | Trade-off |
| Score top 5 only | 50% | Less data on long-tail |
| Use Haiku judge | 90% | Slightly less accurate |
| Cache scores | Variable | Only for unchanged retrieval |
Recommendation: Start with Haiku judge, validate sample against Sonnet.
Directory Structure
.claude/skills/benchmark-memory/
├── SKILL.md # This file
├── requirements.txt # Python dependencies
├── scripts/
│ ├── run_benchmark.sh # Wrapper script (uses venv Python)
│ ├── create_snapshot.py # Create frozen Brain snapshot
│ ├── build_query_set.py # Generate/manage query test set
│ ├── run_benchmark.py # Execute benchmark with config
│ ├── score_results.py # LLM-as-judge scoring
│ ├── compute_metrics.py # Calculate evaluation metrics
│ └── analyze_results.py # Generate analysis summary
├── configs/
│ ├── focused_configs.json # Test configurations (15 configs)
│ └── judge_prompt.txt # LLM judge prompt template
├── snapshots/ # Frozen Brain copies
├── query-sets/ # Test queries (core-50.json included)
├── results/ # Benchmark CSVs
└── analysis/ # Analysis reportsTested Components
| Component | Status | Notes |
| Snapshot creation | ✅ Works | Creates snapshot with FAISS index + graph |
| Query set | ✅ Works | 50 queries across 6 categories |
| Static search | ✅ Works | Traditional vector similarity |
| Spreading search | ✅ Works | Multi-iteration activation |
| 15 configs | ✅ Works | Focused parameter sweep |
| LLM-as-judge | ⚠️ Channel-dependent | claude -p works on the workstation ONLY; on Trinity use chat_with_agent or a Task subagent (see LLM-as-Judge Scoring) |
| Results CSV | Ready | Incremental writes, resume support |
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.

