aosp-internal-book: Instructions file for Claude Code

CLAUDE.md

aosp-internal-book CLAUDE.md is an instructions file for Claude Code from aospbooks/aosp-internal-book. It costs 1,281 tokens per session, scanned A, original, Apache-2.0.

A project rulebook for writing and maintaining a book about the internal design of Android, the open-source mobile operating system. It covers the book’s structure, diagrams, source references, local setup, and contribution rules.

In plain words
What is it for?
Use it when adding or editing chapters, running the book locally with Docker, checking Mermaid diagrams, citing Android source code, or following the project’s commit and CI rules.
Why use it?
It keeps a large technical book consistent and helps contributors avoid broken diagrams, duplicate section numbers, incorrect headings, or misplaced content.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: reads .claude/ paths.

This is aospbooks/aosp-internal-book's own configuration. It tells Claude Code how to work on aosp-internal-book itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything aosp-internal-book configures →

Reuse

Borrowing it

Nothing to install: this file belongs to aospbooks/aosp-internal-book. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/aospbooks/aosp-internal-book/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/aospbooks/aosp-internal-book

Made for: Claude Code.

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 aosp-internal-book CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/aospbooks/aosp-internal-book/claude-md/github.svg)](https://agentmods.dev/instructions/aospbooks/aosp-internal-book/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/aospbooks/aosp-internal-book/claude-md"><img src="https://agentmods.dev/badge/instructions/aospbooks/aosp-internal-book/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for aosp-internal-book CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/aospbooks/aosp-internal-book/claude-md"><img src="https://agentmods.dev/badge/instructions/aospbooks/aosp-internal-book/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,281 This file is loaded in full into every session.
When invoked 1,281 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.01281 $0.01281
Opus 5.5 $0.00512 $0.00512
Sonnet 5.5 $0.00256 $0.00256
Haiku 4.5 $0.00128 $0.00128

Measured 22d ago against content hash 14f3e46aa5a3, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

aosp-internal-book CLAUDE.md 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 22d 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.

CLAUDE.md · 43 lines

How it starts

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

AOSP Internals Book

67 chapters + 4 appendices, ~1,500 Mermaid diagrams.

Quick Start

docker compose build
docker compose up -d serve         # http://localhost:8000

Writing Rules

  1. Chapters: NN-slug.md, titles: # Chapter N: Title — colon only, never -- or —
  2. Section numbers: manual ## N.1, ### N.1.2 matching filename
  3. No duplicate section numbers within a chapter (watch for this when inserting new sections)
  4. Mermaid: quote labels with (), <br/>, |; no <br/> in participant lines; no parens in stateDiagram-v2 transition labels (State1 --> State2 : foo() breaks parsing — drop the parens)
  5. Descriptive heading before each mermaid block
  6. Source refs: real AOSP paths with line numbers
  7. The body of every chapter ends with "Try It" then "Summary" — nothing else comes after Summary, except an optional final "Key Source Files Reference" (or similarly-titled key-file-paths) table, which may sit after Summary as a final reference. Appendices, extras, deep dives, etc. still must move above Try It / fold into a numbered section.
  8. Do not add epigraph blockquotes at the top of chapters. No > *"quote"* / > -- Author blocks between the # Chapter N: Title line and the first ## N.1 section. The chapter goes straight into its introductory paragraph after the title. (We removed all of these in a cleanup pass; do not re-introduce them when editing or writing new chapters.)
  9. Verify mermaid format parses after every edit. Run ./serve.sh png NN-slug.md on every chapter whose Mermaid blocks you touched and confirm the output reports errors=0. The CI properdocs build does NOT validate Mermaid (the live site renders it client-side in the browser), so a parse error reaches readers as a "No diagram type detected" / "Syntax error" banner with no build-time signal. Treat errors=0 as a hard precondition — do not declare the edit done, commit, or move to visual review until the format check is clean. If errors>0, fix the offending block (the script names which file/index failed) and re-run until clean.
  10. Visually verify mermaid diagrams after writing or editing them. Parse-clean is not enough — diagrams can render with text overflowing rectangles, overlapping nodes, or unreadable arrows, and they can also be parse-clean but factually wrong about the architecture. After rule 9 passes, inspect each PNG under .mermaid-png/<slug>/. Check: (a) every label fits inside its shape with no overflow; (b) no nodes or edge labels overlap; (c) the boxes, arrows, and grouping match the architecture the prose describes (right components, right direction of arrows, no missing or invented relationships). Re-render after every mermaid edit.
  11. Keep llms.txt in sync with chapter content. llms.txt (root of repo, symlinked into docs/) is the llmstxt.org-style index that AI tools fetch to learn what's in this book and where to find each subsystem. Update it when chapters are added, removed, renamed, or significantly retitled, and when a chapter's scope changes enough that its one-line description no longer fits. Each chapter entry has the form - [Chapter N: Title](https://aospbooks.github.io/aosp-internal-book/<slug>/): one-line description of what the chapter covers and the key components it walks through. Do not update llms.txt for routine edits inside a chapter (typo fixes, mermaid tweaks, prose rewrites that don't change the chapter's scope). When editing, also confirm every URL still resolves to a real <slug>.md in the repo root.
  12. Never cite line-of-code counts. Do not write how many lines a file, class, crate, or subsystem contains — no (1,210 lines), no "at roughly 7,200 lines", no "Lines of Code" table column, no # 8234 lines comment in a source tree listing. These numbers go stale on every AOSP sync and are the first thing to rot in a chapter. Convey scale with prose the source can't invalidate ("one of the largest classes in the framework", "a small file of stubs") or, better, with a structural fact that is actually stable (how many files a package has, what the class is responsible for). This does not apply to source citations with line numbers (file.cpp:123, "lines 117-131"), which rule 6 requires, nor to qualitative scale statements with no specific count ("hundreds of millions of lines of code").
  13. Update the top-level README.md when chapters are added, removed, renamed, or reordered. Hand-edit the chapter table under "What This Book Covers" (each row carries its Part), the chapter count in the surrounding prose, and the file counts under "Project Structure". llms.txt (rule 11) groups chapters by the same Parts, so keep the two in step.

Read the full file on GitHub · 43 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. 22d ago Changed · -2 lines · -314 tokens per session 14f3e46aa5a3
  2. 1mo ago Changed · +2 tokens per session a03a9569c6bf
  3. 1mo ago Changed · +2 lines · +269 tokens per session c235542efa3e
  4. 2mo ago First seen · 43 lines · 1,324 tokens per session scan A db51719d9a4d

Subscribe to this mod's changes

aosp-internal-book CLAUDE.md is an instructions file published in the GitHub repository aospbooks/aosp-internal-book (144 stars, last pushed 23d ago), licensed Apache-2.0. It adds 1,281 tokens to every session, about $0.0051 per session on Opus 5.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-30.

Related

aosp-internal-book CLAUDE.md compared with instructions from other repositories

aosp-internal-book CLAUDE.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
aosp-internal-book CLAUDE.mdaospbooks/aosp-internal-bookInstructions file14423d agoApache-2.0A1,281Claude Code
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,516GitHub Copilot
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file275k3d agoMITA4,313Codex, OpenCode