brain

A local Markdown knowledge base that collects, indexes, searches, and answers questions about saved notes and other sources. Markdown is a plain-text document format, and an Obsidian vault is a folder of linked Markdown notes.

In plain words
What is it for?
Use it to import URLs, YouTube links, playlists, or local files; refresh and search the collection; and ask questions about its contents.
Why use it?
It gives scattered notes, web pages, videos, and local files one searchable place and can show the sources behind an answer.

Command

Install

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.

agentmods
npx agentmods add commands/px0-ai/px0/brain
Clone the repo
git clone --depth 1 https://github.com/px0-ai/px0
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,210 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00000 $0.03210
Opus 5 $0.00000 $0.01605
Sonnet 5 $0.00000 $0.00642
Haiku 4.5 $0.00000 $0.00321

Measured 2d ago against content hash 6f0d35a68018, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

brain 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 2d 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.

docs/commands/brain.md · 408 lines

How it starts

The opening of the file, as written. The whole thing — 408 lines — stays where its author put it; the contents beside it link to each section on GitHub.

px0 brain

The brain is what you have read and kept: a folder of Markdown that px0 ingests into, indexes, and answers questions from. It can be px0's own brain/ folder or any folder of Markdown you already keep — including an Obsidian vault.

Implemented by px0/brain.py (ingestion), px0/retrieval.py (indexing and search), and px0/ask.py (retrieval plus generation).

px0 brain add <source> [--to FOLDER] [--from-file PATH]
px0 brain refresh [path] [--all] [--stale] [--days N]
px0 brain list
px0 brain show <path> [--json]
px0 brain rm <path> [--yes]
px0 brain export <dir> [--include-private]
px0 brain search <query> [--k N] [--kind KIND] [--json]
px0 brain ask <question> [--k N] [--kind KIND] [--sources]
px0 brain reindex

px0 brain add

Ingest one source: extract its text, write it as Markdown with frontmatter recording where it came from, and reindex.

Extraction always runs locally and needs no API key.

source (required)

What to ingest.

  • Input: a URL, a YouTube link, a YouTube playlist link, or a path to a local file.
  • Local paths accept ~ and are read relative to the current directory.
Source Extracted with Files by default into
http(s)://... requests + BeautifulSoup blogs/
.html, .htm the same reader, over a saved page blogs/
.pdf pdftotext -layout when poppler is installed, else pypdf papers/
.docx, .odt pandoc when installed, else a stdlib zip+XML reader docs/
.doc pandoc only — the legacy binary format has no fallback docs/
.md, .markdown, .txt, .text, .rst, .org read as-is docs/
YouTube video youtube-transcript-api docs/
YouTube playlist queued for the daemon — see below docs/

Anything else is refused, and the error lists every accepted extension.

A YouTube video with no published transcript is written as a stub: its metadata only, marked kind: stub, with the refresh command to retry printed for you. A scanned PDF with no text layer is refused with a note that it needs OCR first.

Read the full file on GitHub · 408 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. 2d ago First seen · 408 lines · 0 tokens per session scan A 6f0d35a68018

Subscribe to this mod's changes

brain is a command published in the GitHub repository px0-ai/px0 (241 stars, last pushed 5d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,210 tokens. 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-30.