ak-render
AGENTS.md53 starsChanged 59 days agoMITView on GitHub
AK Render is optimized to reduce the tokens and decisions AI agents spend authoring, iterating on, and maintaining high-quality HTML pages. The byte size of the emitted HTML is not the optimization target. Output must stay beautiful, high quality and deterministic. Mandatory boundaries (only the author may change these, not even for better looks or speed): Guiding priorities (a collaborator may choose differently within the boundaries but must explain the trade-off): Implementation choices are open within these principles. These rules…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 35,117 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository3 other files it gives its agents.
- llms.txtllms.txt
- visual-polishSkill
- ak-renderSkill
The file
We split this AGENTS.md into the rules it gives an agent
8 rules. About 0 are common, 4 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 34
Do not trade output semantics, visual quality, no-JS and print readability, accessibility, security or determinism for a few kilobytes of …
- Distinctive: line 35
Do not add a minified-output or file-size target, budget or gate.
- Very specific: line 40
Read README.md and docs/adr/0001-page-spec-compiler-boundary.md for the compiler boundary.
- Very specific: line 41
Read DESIGN.md before changing anything in src/render/styles.ts, src/render/charts.ts, src/render/document.ts or src/theme/.
- Very specific: line 45
After an intentional output change, run pnpm build, pnpm snapshots:generate and pnpm gallery:generate, then commit the regenerated files.
- Very specific: line 46
Verify with REVIEW.md: run the gates, then check the screenshots at 1440, 768 and 375 in light and dark.
- Distinctive: line 47
When gallery content or routes change, keep the discovery surfaces it advertises (meta and share tags) in sync.
- Distinctive: line 51
Do not commit to main. Use a branch and a PR with conventional commits.
≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agent guide
Product principles
AK Render is optimized to reduce the tokens and decisions AI agents spend authoring, iterating on, and maintaining high-quality HTML pages. The byte size of the emitted HTML is not the optimization target. Output must stay beautiful, high quality and deterministic.
Mandatory boundaries (only the author may change these, not even for better looks or speed):
- Offline by default. An emitted page opens from
file://and makes zero network requests unless the spec opts in throughpolicy.network. No CDN, remote font or remote asset. - Deterministic. The same spec, compiler version and options produce identical bytes.
- No escape hatch. Spec input is untrusted. No raw CSS, HTML, JS or iframe, and no open-ended action. Themes are typed data.
- Local is canonical. Compiling never needs an account or the network. Cloud is opt-in convenience, never the source of truth.
Guiding priorities (a collaborator may choose differently within the boundaries but must explain the trade-off):
- The compiler owns presentation. The spec describes meaning; layout, color and motion derive from content and theme. Presentation props stay optional with good defaults. Do not add a knob the compiler can decide itself.
- Striking, within limits. Output may be expressive (motion, depth, atmosphere), but every page must read completely with reduced motion, in print, in a screenshot and without JavaScript. Motion decorates; it never carries information.
- Agent tokens, not HTML bytes. Optimize for what an agent spends on a page task, while keeping quality, readability, correctness, accessibility, determinism and offline output. Compact specs, smart defaults, high-level blocks, terse tool responses that can be queried deeper, and progressive discovery (
search-catalog,describe --compact) are how that cost falls.
Implementation choices are open within these principles.
Three different costs
| Cost | What it is | Status |
| Agent token cost | Tokens to read guidance, write the spec, call the CLI or MCP tools, read diagnostics, repair, and maintain the page later. Includes the number of round-trips and manual decisions. | The primary optimization target. |
| Rendered HTML bytes | Size of the emitted file. It never passes through the model; the agent reads a one-line summary. | Not a product KPI. It may grow when inlining is what keeps the page polished and offline. |
| Runtime performance | Load, CPU, memory and interaction cost for the person who opens the page. | Must stay reasonable for UX. It is not the same thing as minifying or shrinking the file. |
These rules hold regardless of the trade-off clause above.
Inlining in the compiler is the point, not overhead: the theme stylesheet, embedded fonts, icon and diagram SVG, syntax-highlight token spans and the small interaction runtime ship inside the file so the agent never writes CSS, picks a CDN, draws an icon or hand-highlights code. Do not remove or externalize them to save kilobytes.
- Do not trade output semantics, visual quality, no-JS and print readability, accessibility, security or determinism for a few kilobytes of output.
- Do not add a minified-output or file-size target, budget or gate. Byte counts in benchmarks and render summaries are reported for transparency and determinism checks, not as goals.
- Judge a change by task-level agent cost: the median and p95 tokens per task (guidance read, spec written, tool round-trips and repairs), task completion rate, iterations to a valid page, and page quality.
benchmarks/agent-token-cost.mjsandbenchmarks/spec-compression.mjsmeasure the parts that do not need a live model.benchmarks/agent-ab-harness.mjs(pnpm bench:agent) runs identical tasks through a live model on the existing flow and, when the build exposescomposeorrepair, on the compose/repair flow, and records provider-reported tokens, round-trips, repairs, wall time and, with--visual, a viewport overflow check; its versioned baseline isdocs/artifacts/agent-ab-baseline.md. Report a saving as measured only when it comes from that harness with both arms run; anything else is an estimate and is labelled so.
Working rules
- Read
README.mdanddocs/adr/0001-page-spec-compiler-boundary.mdfor the compiler boundary. - Read
DESIGN.mdbefore changing anything insrc/render/styles.ts,src/render/charts.ts,src/render/document.tsorsrc/theme/. - Read
docs/adr/0002-motion-policy.mdbefore adding or changing any animation or transition;src/render/motion.tsowns the guard and its compile-time check. Per-block motion recipes live insrc/motion/recipes.ts; discovery (motion-catalog.ts) and the audit (motion-audit.ts) project from it, so add a rule there rather than a second checker. The dev-only Motion Studio (src/motion/studio/) reads the same registry and writes only the spec. Seedocs/motion.md. - The visual audit (
src/audit/ui-audit*.ts,docs/audit-ui.md) owns real-browser checks of the compiled page; keepvalidatebrowser-free and add a rule toui-audit-rules.tswith its fix rather than a second checker.ui-audit-quick.tsis imported by the Worker, so it must stay free of Node built-ins. - Emitted CSS must stay token-driven. Feature CSS belongs in
FEATURE_CSS, never inBASE_CSS. - After an intentional output change, run
pnpm build,pnpm snapshots:generateandpnpm gallery:generate, then commit the regenerated files. - Verify with
REVIEW.md: run the gates, then check the screenshots at 1440, 768 and 375 in light and dark. - When gallery content or routes change, keep the discovery surfaces it advertises (meta and share tags) in sync.
plugins/ak-render/is the folder people install as the Claude plugin. Keep it self-contained (regular files only, no paths outside it) and keep its skill to what the pinned package version ships;docs/claude-plugin.mdowns the rules andpnpm test:pluginchecks the published package.- Working is not enough: visual output must look striking and refined, so anyone who sees it is impressed. After a feature works, do a visual polish pass (lighting, depth, atmosphere, typography, motion within the motion policy) checked by screenshots, and record the polish process in a skill so other models can reproduce it (
.claude/skills/visual-polish/SKILL.md). - After each round of work, spawn an independent QA subagent (Opus, extra-high effort, a duration budget of at most 10 minutes) to score it out of 10. The score covers engineering correctness and, just as much, aesthetic taste and output design quality: the reviewer inspects the rendered screenshots and exports and judges composition, hierarchy, color, lighting and depth, typography, spacing, polish and whether the result would impress a demanding designer. The QA agent returns the score plus a concrete list of improvements, each with how to do it and a Definition of Done that a re-score can check. Run
pnpm qa:prefirst so QA never spends time on machine-checkable errors, and hand QA the fixed inputs in the skill's QA prompt template (diff since the last QA,pnpm visual:checkcontact sheet and metrics, open DoD). Later rounds re-check only open DoD and the new diff. Its report is terse and to the point, with no lengthy explanation. Do not wait idle for the review: keep working in parallel and apply its findings when the report arrives. A score of 8 or above passes; otherwise fix the findings and re-score until it passes, before opening or readying the PR. - Do not commit to
main. Use a branch and a PR with conventional commits. - Merge PRs in batches, not one at a time: collect the green, approved PRs that are ready, merge them together in dependency order, and let the full
mainCI run once for the batch. Rebase any PR the batch leaves stale before it joins the next batch. - CI runs lanes by blast radius (
scripts/ci-scope.mjs): lint, typecheck and unit tests always run; browser (3 shards), package and macOS/Windows lanes run only when a changed path can affect them, and every push tomainruns them all. When a new top-level path is safe to skip for a lane, add it to that lane's list with a test intests/unit/ci-scope.test.ts; unknown paths run everything. - Claim an issue before working on it: assign yourself and keep one state label current (
in progress,blocked,in reviewduring agent review,doneonce the PR is open,shippedafter merge tomain). Check those labels first so parallel contributors and agents do not duplicate work. File unrelated gaps you find as new issues, and comment on related or duplicate issues with a reference.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

