sherlock-second-brain: Instructions file for Codex

AGENTS.md

sherlock-second-brain AGENTS.md is an instructions file for Codex, OpenCode from alshyra/sherlock-second-brain. It costs 1,484 tokens per session, scanned A, original, MIT.

A set of repository instructions for Sherlock’s second-brain MCP server, covering its architecture, coding conventions, commands, and workflow for validating knowledge.

In plain words
What is it for?
Use it when working on that repository, especially when editing its MCP server, knowledge files, skills, tests, or documentation.
Why use it?
It gives coding agents the project-specific rules needed to make consistent changes and run checks in the expected order.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions AGENTS.md; mentions OpenCode.

This is alshyra/sherlock-second-brain's own configuration. It tells Codex and OpenCode how to work on sherlock-second-brain itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything sherlock-second-brain configures →

Reuse

Borrowing it

Nothing to install: this file belongs to alshyra/sherlock-second-brain. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/alshyra/sherlock-second-brain/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/alshyra/sherlock-second-brain

Made for: Codex, OpenCode.

Wrote 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.

agentmods badge for sherlock-second-brain AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/alshyra/sherlock-second-brain/agents-md/github.svg)](https://agentmods.dev/instructions/alshyra/sherlock-second-brain/agents-md)
Your own site
<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/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for sherlock-second-brain AGENTS.md

Your own site · 80×15
<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="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,484 This file is loaded in full into every session.
When invoked 1,484 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.01484 $0.01484
Opus 5.5 $0.00594 $0.00594
Sonnet 5.5 $0.00297 $0.00297
Haiku 4.5 $0.00148 $0.00148

Measured 2mo ago against content hash 746cb42643a2, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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 2mo 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.

AGENTS.md · 92 lines

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() defs
    • domain/ — rich aggregates enforcing their invariants: models/case.py (Case factory + mutations + promote) and models/memory.py (Memory factory + setters + promote), one file per class (models/{case,hypothesis,step,evidence,memory,promotion}.py), plus errors.py (StorageError hierarchy), rules.py (VALID_STATUS, VALID_PROMOTION_TARGETS) and text.py (slugify, now_iso, CASE_ID_PATTERN, MEMORY_ID_PATTERN)
    • application/ — thin orchestration only (no business rules), depending on ports.py Protocols: case_service.py (CaseService), memory_service.py (MemoryService), promotion_service.py (PromotionService)
    • adapters/ — persistence/IO only, no domain policy: filesystem.py (Storage persists by object: save_*/get/list/delete/next_*_id/ write_evidence), chroma.py (VectorIndex + FastembedEmbeddingFunction multilingue), lexical.py (LexicalIndex), hybrid.py (HybridIndex RRF), dto/case_update.py (CaseUpdateFields for the case_update fields), frontmatter.py (memory MD + YAML frontmatter render/parse), templates/ (Jinja2: fiche.md.j2, skill.md.j2, memory_fiche.md.j2 rendered by PromotionService)
  • 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 + body
    • fiches/<slug>.md, skills/<slug>/SKILL.md
    • vector/ — derived ChromaDB index, always rebuildable via the index_rebuild tool
  • src/sherlock_second_brain/schema/case.schema.json is the source of truth: Storage._save_case validates every case against it (SCHEMA_PATH prefers the schema bundled inside the package, falling back to walking up to the repo root). If you touch the schema, keep writes compatible or test_written_case_matches_json_schema fails.
  • Search is hybrid: server.py composes HybridIndex(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 first index_rebuild). Doc IDs are fiche:<slug>, case:<id>, skill:<slug>, memory:<id>. Document enumeration is shared in adapters/documents.py.
  • CaseService maintains the index on every mutation (update/evidence/status/delete); MemoryService maintains it on every mutation including create (a memory must be immediately searchable).

Read the full file on GitHub · 92 lines

Changes

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.

  1. 2mo ago First seen · 92 lines · 1,484 tokens per session scan A 746cb42643a2

Subscribe to this mod's changes

sherlock-second-brain AGENTS.md is an instructions file published in the GitHub repository alshyra/sherlock-second-brain (0 stars, last pushed 3mo ago), licensed MIT. It adds 1,484 tokens to every session, about $0.0059 per session on Opus 5.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.

Related

sherlock-second-brain AGENTS.md compared with instructions from other repositories

sherlock-second-brain AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
sherlock-second-brain AGENTS.mdalshyra/sherlock-second-brainInstructions file03mo agoMITA1,484Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143kyesterdayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode