Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add instructions/alshyra/sherlock-second-brain/agents-mdgit clone --depth 1 https://github.com/alshyra/sherlock-second-brainWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/alshyra/sherlock-second-brain/agents-md)<a href="https://agentmods.dev/instructions/alshyra/sherlock-second-brain/agents-md"><img src="https://agentmods.dev/badge/instructions/alshyra/sherlock-second-brain/agents-md.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.01484 | $0.01484 |
| Opus 5 | $0.00742 | $0.00742 |
| Sonnet 5 | $0.00297 | $0.00297 |
| Haiku 4.5 | $0.00148 | $0.00148 |
Grade A, and why
sherlock-second-brain AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 92 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AGENTS.md
Sherlock's second brain MCP server: validated knowledge lives in fiches/ and skills/;
everything unvalidated lives in cases/ (JSON investigations — investigation files for
debugging and analysis) or memories/ (standalone MD notes with YAML frontmatter). A
resolved case is promoted into a fiche or skill via the MCP; a memory can also be
promoted into a fiche.
Repo language is English (code, docs, generated output) — the README.md is in English
because it is parsed by Glama (https://glama.ai). Some tests keep French content
(tests/test_vector.py, test_slugify) to exercise multilingual support.
Commands
uv run ruff check src/ tests/ # lint (Astral, E,F,I,W,UP,B,ANN,PYI + preview)
uv run ty check # type checking (Astral)
uv run pytest tests/ -v # all tests (no services needed, tmp_path fixtures)
uv run pytest tests/test_storage.py::test_slugify -v # single test
uv sync # installs deps (chromadb+fastembed inclus)
Required verification order: ruff check → ty check → pytest.
Run the server with uv run python -m sherlock_second_brain.server — this is a stdio MCP server,
it needs an MCP client to be useful (wired as ~/.config/opencode/opencode.json →
SHERLOCK_BRAIN_DATA_DIR=/opt/infra/kb).
Architecture (hexagonal)
src/sherlock_second_brain/:server.py— composition root: instantiates adapters+services,@mcp.tool()defsdomain/— rich aggregates enforcing their invariants:models/case.py(Casefactory + mutations +promote) andmodels/memory.py(Memoryfactory + setters +promote), one file per class (models/{case,hypothesis,step,evidence,memory,promotion}.py), pluserrors.py(StorageError hierarchy),rules.py(VALID_STATUS,VALID_PROMOTION_TARGETS) andtext.py(slugify,now_iso,CASE_ID_PATTERN,MEMORY_ID_PATTERN)application/— thin orchestration only (no business rules), depending onports.pyProtocols:case_service.py(CaseService),memory_service.py(MemoryService),promotion_service.py(PromotionService)adapters/— persistence/IO only, no domain policy:filesystem.py(Storagepersists by object:save_*/get/list/delete/next_*_id/write_evidence),chroma.py(VectorIndex+FastembedEmbeddingFunctionmultilingue),lexical.py(LexicalIndex),hybrid.py(HybridIndexRRF),dto/case_update.py(CaseUpdateFieldsfor thecase_updatefields),frontmatter.py(memory MD + YAML frontmatter render/parse),templates/(Jinja2:fiche.md.j2,skill.md.j2,memory_fiche.md.j2rendered byPromotionService)
- Data layout under
SHERLOCK_BRAIN_DATA_DIR(default~/sherlock-second-brain-data):cases/<case-id>/case.json+cases/<case-id>/evidence/*—case-id=case-YYYY-MM-DD-NNN(per-day counter)memories/<id>.md—id=mem-YYYY-MM-DD-NNN(per-day counter), YAML frontmatter + bodyfiches/<slug>.md,skills/<slug>/SKILL.mdvector/— derived ChromaDB index, always rebuildable via theindex_rebuildtool
src/sherlock_second_brain/schema/case.schema.jsonis the source of truth:Storage._save_casevalidates every case against it (SCHEMA_PATHprefers the schema bundled inside the package, falling back to walking up to the repo root). If you touch the schema, keep writes compatible ortest_written_case_matches_json_schemafails.- Search is hybrid:
server.pycomposesHybridIndex(VectorIndex, LexicalIndex)and fuses rankings by RRF. ChromaDB is a mandatory dependency (no fallback). The embedding model is multilingual (sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2, downloaded at firstindex_rebuild). Doc IDs arefiche:<slug>,case:<id>,skill:<slug>,memory:<id>. Document enumeration is shared inadapters/documents.py. CaseServicemaintains the index on every mutation (update/evidence/status/delete);MemoryServicemaintains it on every mutation including create (a memory must be immediately searchable).
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 4d ago First seen · 92 lines · 1,484 tokens per session scan A 746cb42643a2
sherlock-second-brain AGENTS.md is an instructions file published in the GitHub repository alshyra/sherlock-second-brain (0 stars, last pushed 27d ago), licensed MIT. It adds 1,484 tokens to every session, about $0.0074 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other instructions, from other repositories
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
spec-kit AGENTS.md
AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).
next.js AGENTS.md
Instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.