# Brain PDF

Generate a publication-quality PDF from any brain page via the gstack make-pdf binary.

- Repository: https://github.com/garrytan/gbrain (31427 stars)
- Category: Documents
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add garrytan/gbrain --skill brain-pdf -g -a claude-code -y`
Codex: `npx skills add garrytan/gbrain --skill brain-pdf -g -a codex -y`
Cursor: `npx skills add garrytan/gbrain --skill brain-pdf -g -a cursor -y`
Gemini CLI: `npx skills add garrytan/gbrain --skill brain-pdf -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add garrytan/gbrain`

## Description

Generate a publication-quality PDF from any brain page via the gstack make-pdf binary. Strips YAML frontmatter, sanitizes emoji, applies running headers and page numbers. Brain page is always the source of truth; PDF is a rendering.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# brain-pdf, Render a Brain Page to Publication-Quality PDF

> **Convention:** see [conventions/quality.md](../conventions/quality.md) 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 gstack `make-pdf` binary. Output is
suitable for:

- Sharing a personalized book mirror via email or Telegram
- 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: gstack make-pdf

This skill depends on the gstack `make-pdf` binary at:

```
$HOME/.claude/skills/gstack/make-pdf/dist/pdf
```

The user must have gstack co-installed. If absent, the skill cannot run.
A future v0.26+ may bundle a fallback PDF renderer; for v0.25.1 gstack
is a soft prereq.

Verify it exists before invoking:

```bash
P="$HOME/.claude/skills/gstack/make-pdf/dist/pdf"
[ -x "$P" ] || { echo "make-pdf not installed; install gstack" >&2; exit 1; }
```

## Workflow

```
1. RESOLVE  → Confirm the brain page exists (gbrain get <slug>).
2. STRIP    → Remove YAML frontmatter, the renderer would otherwise
              dump it as a full page of raw metadata text.
3. RENDER   → Invoke make-pdf with sane defaults (no --cover, no --toc).
4. DELIVER  → Hand the PDF to the requester via the agent's preferred
              channel (do not use raw `MEDIA:` tags on Telegram, they fail silently).
```

## Invocation

```bash
SLUG="path/to/page"
P="$HOME/.claude/skills/gstack/make-pdf/dist/pdf"

# 1. Confirm the page exists.
gbrain get "$SLUG" > /dev/null || { echo "Page $SLUG not found" >&2; exit 1; }

The rest: https://github.com/garrytan/gbrain/blob/HEAD/plugin/skills/brain-pdf/SKILL.md
