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,324 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; mentions Codex.

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,324 This file is loaded in full into every session.
When invoked 1,324 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.01324 $0.01324
Opus 5 $0.00662 $0.00662
Sonnet 5 $0.00265 $0.00265
Haiku 4.5 $0.00132 $0.00132

Measured 9d ago against content hash db51719d9a4d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, 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 9d 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

65 chapters + 3 appendices, ~227,000 lines, ~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. Re-run python3 agents/build.py after any change to chapter content. The 16 Part-skills under agents/<claude|gemini|codex|copilot>/ are generated from chapters at the repo root, so any chapter edit can stale them. Always regenerate after a chapter edit — including prose tweaks, typo fixes, and mermaid changes, not just headings or structural edits — and commit the regenerated files if the regeneration produces a diff. The CI agents/build.py --check step in build-test.yml will fail if they're stale. See agents/SPEC.md for the full design.
  13. Update agents/README.md (and the top-level README.md) when chapters are added, removed, renamed, or reordered. agents/build.py regenerates the per-platform Part-skill content but does not touch either README. When the chapter set changes, hand-edit (a) agents/README.md — both the 64 chapters + 2 appendices count near the top, the example chapter range (./00-frontmatter.md./63-custom-rom.md), and the per-Part chapter listing in the "What's in each Part" table — and (b) the top-level README.md chapter table under "What This Book Covers" plus the chapter count in surrounding prose. If the new/renamed chapter changes which Part it belongs to, also edit agents/_content/manifest.toml before regenerating.

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. 9d 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 (131 stars, last pushed 10d ago), licensed Apache-2.0. It adds 1,324 tokens to every session, about $0.0066 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-30.

Related

Other instructions, from other repositories

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,153 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens

deepseek-harness AGENTS.md

AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.

deepseek-ai/deepseek-harness · 3,735 tokens