Skip to main content

File-backed AI handbook knowledge systems with progressive disclosure, evidence, and CRUD tooling.

Project description

Patchouli Handbook

中文说明

Patchouli Handbook is a file-backed knowledge system for AI agents. It is inspired by skills, but it is intentionally thicker: a skill can trigger the right behavior, while a handbook can hold a full guide, routing map, reusable entries, glossary, source evidence, validation, and CRUD tooling.

Use it when an agent needs more than a short SOP: domain principles, decision rules, examples, anti-patterns, and source-grounded guidance that should be expanded progressively instead of loaded all at once.

What It Provides

  • A stable on-disk handbook format built from Markdown plus manifest.json.
  • A lightweight entry_skill/SKILL.md activation layer for skill-aware agents.
  • A thicker GUIDE.md operating manual for complex tasks.
  • Category and entry pages for progressive disclosure.
  • Optional evidence pages and source indexes for provenance.
  • A Python API and JSON CLI for creating, editing, validating, and inspecting handbooks.
  • A complete example handbook generated from public game-design source summaries.

Repository Layout

patchouli_handbook/   Python library and CLI
docs/                 Architecture, authoring, and agent protocol docs
example/              Example generated handbooks
tests/                Unit tests
pyproject.toml        Package metadata and console script

Handbook Layout

<handbook_dir>/
├── manifest.json
├── GUIDE.md
├── INDEX.md
├── entry_skill/
│   └── SKILL.md
├── categories/
│   └── <category_slug>/
│       ├── CATEGORY.md
│       └── <entry_slug>.md
├── references/
│   ├── glossary.md
│   └── source_index.md
└── evidence/
    └── <source_id>.md

Quick Start

uv venv --python 3.12 .venv
source .venv/bin/activate
uv pip install -e '.[dev]'

Python 3.10+ is supported.

Create a blank handbook:

patchouli-handbook init \
  --output output/studio-handbook \
  --title "Studio Handbook" \
  --audience "AI agents and studio maintainers"

Add content:

patchouli-handbook categories create \
  '{"title":"Planning","description":"Scoping, goals, and project framing."}' \
  --handbook output/studio-handbook

patchouli-handbook entries create \
  '{"title":"Scope First","category_slug":"planning","summary":"Decide the scope before choosing tactics."}' \
  --handbook output/studio-handbook

patchouli-handbook validate --handbook output/studio-handbook

Inspect the included example:

patchouli-handbook inspect --handbook example/masahiro-sakurai-on-creating-games
patchouli-handbook validate --handbook example/masahiro-sakurai-on-creating-games

Start reading the example at:

  • example/masahiro-sakurai-on-creating-games/GUIDE.md
  • example/masahiro-sakurai-on-creating-games/INDEX.md

CLI

Common commands:

patchouli-handbook structure
patchouli-handbook describe --handbook <handbook_dir>
patchouli-handbook validate --handbook <handbook_dir>
patchouli-handbook categories list --handbook <handbook_dir>
patchouli-handbook entries get <entry_slug> --handbook <handbook_dir>

Machine-readable integration point:

patchouli-handbook apply '{"action":"get_entry","slug":"scope-first"}' --handbook <handbook_dir>

apply accepts these actions:

  • describe
  • validate
  • list_categories
  • list_entries
  • get_category
  • get_entry
  • update_book
  • create_category
  • update_category
  • delete_category
  • create_entry
  • update_entry
  • delete_entry

CLI failures are emitted as JSON:

{
  "ok": false,
  "error": {
    "type": "KeyError",
    "message": "'Unknown entry: missing-entry'"
  }
}

Python API

from patchouli_handbook import HandbookStore, create_empty_handbook

create_empty_handbook(
    "output/studio-handbook",
    title="Studio Handbook",
    audience="AI agents and studio maintainers",
)

store = HandbookStore("output/studio-handbook")
store.create_category(
    {
        "title": "Planning",
        "description": "Scoping, goals, and project framing.",
    }
)
store.create_entry(
    {
        "title": "Scope First",
        "category_slug": "planning",
        "summary": "Decide the scope before choosing tactics.",
        "use_when": ["The task is broad or under-specified."],
        "do_this": ["Name the goal.", "Name constraints.", "Pick the smallest useful next step."],
        "checklist": ["The scope is explicit.", "The next action is concrete."],
        "anti_patterns": ["Do not choose tactics before defining the target."],
    }
)
print(store.validate().model_dump())

Build From Source Summaries

The builder can generate a handbook from a channel_extractor-style job directory containing:

  • channel.json
  • videos.json
  • clean/<video_id>.json

Example:

export OPENAI_API_KEY=...
patchouli-handbook build \
  --input path/to/channel-job \
  --output output/generated-handbook

The builder writes GUIDE.md, INDEX.md, category pages, entry pages, references, evidence pages, entry_skill/SKILL.md, and manifest.json.

Documentation

Included Example

example/masahiro-sakurai-on-creating-games demonstrates a generated handbook with:

  • 14 categories
  • 260 entries
  • 299 evidence pages
  • GUIDE.md plus a skill-compatible entry_skill/SKILL.md

The example is included to show the intended scale and navigation pattern of a thick handbook.

Test

pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

patchouli_handbook-0.1.0.tar.gz (35.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

patchouli_handbook-0.1.0-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

Details for the file patchouli_handbook-0.1.0.tar.gz.

File metadata

  • Download URL: patchouli_handbook-0.1.0.tar.gz
  • Upload date:
  • Size: 35.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for patchouli_handbook-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6f137e0000ce8132a29097e4ee318a7389228a958138e53fbdd1a4ef06ffa58b
MD5 49ee749473de263816e531fdddde55fd
BLAKE2b-256 33b61c73e8d864cbb5cd29982cf10bcacb19f4b48db3848a50351b61cc45d46f

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchouli_handbook-0.1.0.tar.gz:

Publisher: ci.yml on Tritium0041/patchouli-handbook

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file patchouli_handbook-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for patchouli_handbook-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dbde8c7084cd5869361c3b75b984c5ca887270c9034ddd9273884eb87336d502
MD5 858a95d5ec685a502d040605f7eb985d
BLAKE2b-256 38ce406f7d6ed8c7960ead91c4ad2926f56b45b42d05fe1ddb191285ad35aef8

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchouli_handbook-0.1.0-py3-none-any.whl:

Publisher: ci.yml on Tritium0041/patchouli-handbook

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page