brain-pdf

brain-pdf is a skill for Claude Code, Codex from timurgaleev/memex. It costs 52 tokens per session (1,632 once invoked), scanned A, original, MIT.

A renderer that turns a brain page, written in Markdown with metadata, into a publication-quality PDF. The original page remains the source, while the PDF is only a formatted copy.

In plain words
What is it for?
Use it to create PDFs of reports, briefings, essays, reading playbooks, or other brain pages when a host-side PDF renderer is available.
Why use it?
It provides a clean document for sharing or archiving without treating the exported PDF as the editable original. It also removes frontmatter and handles details such as emoji, headers, and page numbers.

Skill for Claude CodeCodex

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 skills/timurgaleev/memex/brain-pdf
Any agent
npx skills add timurgaleev/memex --skill brain-pdf
Clone the repo
git clone --depth 1 https://github.com/timurgaleev/memex

Made for: Claude Code, Codex.

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 brain-pdf

README.md
[![agentmods](https://agentmods.dev/badge/skills/timurgaleev/memex/brain-pdf.svg)](https://agentmods.dev/skills/timurgaleev/memex/brain-pdf)
Your own site
<a href="https://agentmods.dev/skills/timurgaleev/memex/brain-pdf"><img src="https://agentmods.dev/badge/skills/timurgaleev/memex/brain-pdf.svg" alt="Measured on agentmods" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,632 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.00052 $0.01632
Opus 5 $0.00026 $0.00816
Sonnet 5 $0.00010 $0.00326
Haiku 4.5 $0.00005 $0.00163

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

Security

Grade A, and why

brain-pdf 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.

deploy/skills/brain-pdf/SKILL.md · 181 lines

How it starts

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

brain-pdf — Render a Brain Page to Publication-Quality PDF

Convention: see conventions/quality.md (via get_skill conventions/quality) for output rules. The PDF is a rendering — never the primary artifact. If a PDF exists, the source brain page exists behind it.

The rule

The brain page is ALWAYS the source of truth. The PDF is a rendering of it, never a standalone artifact. If a PDF exists somewhere, the brain page must exist behind it.

What this does

Renders a brain page (markdown with frontmatter) into a publication-quality PDF using the host agent's PDF renderer (e.g. the agent harness's make-pdf skill or an equivalent markdown-to-PDF toolchain). Output is suitable for:

  • Sharing a personalized book mirror via email or chat
  • Delivering a strategic-reading playbook as a clean read
  • Producing a briefing or report with running headers and page numbers
  • Archiving a long-form essay in a portable format

Prerequisite: a host-side PDF renderer

This skill depends on a markdown-to-PDF renderer available on the host where the agent runs. memex itself does not render PDFs — it serves the page body; rendering is the agent's job.

Verify a renderer is available before invoking (check for the agent harness's make-pdf skill, or a pandoc/Chromium-print pipeline). If none is installed, the skill cannot run — tell the user which prerequisite is missing instead of improvising a degraded rendering.

Workflow

1. RESOLVE  → Confirm the brain page exists (page_get <slug>).
2. STRIP    → Remove YAML frontmatter — the renderer would otherwise
              dump it as a full page of raw metadata text.
3. RENDER   → Invoke the PDF renderer with sane defaults (no cover,
              no TOC).
4. DELIVER  → Hand the PDF to the requester via the agent's preferred
              file-delivery channel (an explicit attachment tool — not
              inline media markup, which can fail silently).

Invocation

SLUG="path/to/page"

# 1. Confirm the page exists and pull the raw markdown body.
#    memex is DB-canonical: there is no repo checkout of the page —
#    the body always comes from the brain over MCP.
RAW=$(mktemp "$TMPDIR/brain-page-XXXXXX.md")
memex call page_get "{\"slug\":\"$SLUG\"}" > /dev/null \
  || { echo "Page $SLUG not found" >&2; exit 1; }
memex call page_get "{\"slug\":\"$SLUG\"}" | jq -r '.content' > "$RAW"

# 2. Strip YAML frontmatter — sed: skip the opening '---' through the
#    closing '---' (lines 1..N), then keep everything after.
CLEAN=$(mktemp "$TMPDIR/brain-page-clean-XXXXXX.md")
sed '1{/^---$/!q}; /^---$/,/^---$/d' "$RAW" > "$CLEAN"

# 3. Render. NO cover, NO TOC by default — they look corporate
#    and waste space. Add them only if explicitly requested.
OUT="$TMPDIR/$(basename "$SLUG").pdf"
# invoke the host renderer, e.g. the agent's make-pdf skill:
#   make-pdf "$CLEAN" "$OUT"

echo "Rendered: $OUT"

Read the full file on GitHub · 181 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 4d ago First seen · 181 lines · 52 tokens per session scan A fba1e7fa72f3

Subscribe to this mod's changes

brain-pdf is a skill published in the GitHub repository timurgaleev/memex (8 stars, last pushed 3d ago), licensed MIT. It adds 52 tokens to every session and 1,632 once invoked, about $0.0003 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.

Related

Other skills, from other repositories

pdf-processing

Extract text from PDFs, fill forms, and merge documents.

PrefectHQ/fastmcp · 11 tokens

treatment-plans

Generate concise (3-4 page), focused medical treatment plans in LaTeX/PDF format for all clinical specialties. Supports general medical treatment, rehabilitation therapy, mental health care, chronic disease management, perioperative care, and pain management. Includes SMART goal frameworks, evidence-based…

synthetic-sciences/openscience · 86 tokens

wechat-article-ingest

微信公众号文章 → Markdown 提取 + A层观点提取 + B层问题链生成。 支持直接链接抓取和 PDF 提取两种方式。.

chubbyguan/chubbyskills · 39 tokens

documentation-server

Use when you need to store, retrieve, search, or manage documents in a local knowledge base with semantic search and hybrid (vector + full-text) retrieval. Also use when interacting with the documentation server web interface, managing uploads, or performing AI-powered document analysis. Use this instead of MCP-native…

andrea9293/mcp-documentation-server · 71 tokens

agoragentic-anydoc-document-evidence

Convert a local Word, PowerPoint, spreadsheet, OpenDocument, RTF, EPUB, CSV, or text-based PDF into bounded Markdown and an Agoragentic evidence handoff. Use when an agent needs document contents plus runtime-verified provenance, explicit evidence coverage, known-loss warnings, and a pending-or-incomplete parse…

rhein1/agoragentic-integrations · 82 tokens

papers-download-from-list

Uses colocated paper download tools to download, verify, and repair local PDFs from obsidian-vault/paperlist.csv rows so that obsidian-vault/paperPDFs/ stays complete and deduplicated. Use when candidate rows are in state=Wait and should become Downloaded before the formal analysis chain.

RipeMangoBox/BITE · 75 tokens