agentleFS
0xSero0xSero/research-skills/brain-search/SKILL.md

brain-search

Skill4 starsChanged 11 days agoMITView on GitHub

Search a locally synced finite.place brain (markdown raw/, wiki/, datasets/) in any language with hybrid BM25 + multilingual dense retrieval, run SQL over its CSV/JSONL datasets, and validate its data quality with rule-based and model-judged checks. Use for "find in the brain", "what does the brain say about X", "query the datasets", "check the brain's quality". Not for editing or syncing the brain (use the fragment CLI) or for web research.

5 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 0

    Distinctive

    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
  1. Very specific:

    Every datasets/*.csv|tsv|jsonl is a DuckDB view named after its file (- → _).

    line 36

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

brain-search: fast multilingual search, SQL and validation for a brain folder

A Python package in this folder (uv, Python ≥ 3.12). Two commands: brain (search + SQL client) and brain-validate (quality report). Full details: README.md.

Setup (once)

cd <this folder> && uv sync
fragment sync <brain> --dir ~/brains/<brain> --mode pull     # brains live in ~/brains/<brain> (BRAIN_SEARCH_BRAINS)
uv run brain --brain <brain> status                          # starts the local daemon, embeds every section (cached)

The daemon listens on 127.0.0.1:8770 (BRAIN_SEARCH_PORT), keeps the models loaded and re-indexes changed files on query. BRAIN_SEARCH_DEVICE=cpu keeps it off busy GPUs. uv run brain stop ends it.

Search

uv run brain --brain <brain> search "<question>"                       # hybrid BM25 + bge-m3, RRF fusion, ~20 ms
uv run brain --brain <brain> search "<question>" -q "<same question in another language>"   # fused
uv run brain --brain <brain> search "<question>" --deep                # + cross-encoder rerank (~1 s)
uv run brain --brain <brain> search "..." --kind raw,dataset --wiki "<wiki>" --json

Results are whole sections with heading path, page date, finite.place URL and (for wiki pages) cited sources; at most 2 per page (--per-page). --recent boosts later years. Read the returned page before answering from it, and obey the brain's own AGENTS.md (quarantined folders stay unread unless the person explicitly asks for them).

SQL over datasets

uv run brain --brain <brain> tables
uv run brain --brain <brain> sql "SELECT category, count(*) FROM <dataset> GROUP BY 1 ORDER BY 2 DESC"

Every datasets/*.csv|tsv|jsonl is a DuckDB view named after its file (- → _); queries can only read files inside the brain folder.

Validate

uv run brain-validate --brain <brain> --wiki "<wiki folder>" [--subject "<what it is about>"] \
  [--sample 150] [--rows-per-dataset 6] [--judge grounding,relevance,spotcheck,safety]

Rule checks (frontmatter, 1 MiB limit, manifest row counts, unsourced/duplicate rows, bad dates, broken links, PII patterns, dead URLs) plus model judges on any OpenAI-compatible endpoint (JUDGE_URL, JUDGE_MODEL). Writes <wiki>/output/quality-report-<date>.md and quality-*.jsonl.

Measure on your brain

uv run brain --brain <brain> eval questions.jsonl [--deep]: one {"q", "expect": ["path#heading"]} per line; prints recall@k, MRR, latency and misses.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.