csstruth CLAUDE.md

csstruth CLAUDE.md is an instructions file for coding agents from ikraamg/csstruth. It costs 2,017 tokens per session, scanned A, original, MIT.

Project instructions for csstruth, a Chromium-based tool that turns a browser's rendered layout into deterministic text. Deterministic output stays the same across repeated runs when the page is unchanged.

In plain words
What is it for?
It guides development of csstruth's shared core, command-line interface, and MCP tools, including layout trees, snapshots, verification, and invariants.
Why use it?
It explains the architecture and rules needed to keep layout captures consistent and comparable.

Instructions file

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/ikraamg/csstruth/claude-md
Clone the repo
git clone --depth 1 https://github.com/ikraamg/csstruth

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 csstruth CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/ikraamg/csstruth/claude-md.svg)](https://agentmods.dev/instructions/ikraamg/csstruth/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/ikraamg/csstruth/claude-md"><img src="https://agentmods.dev/badge/instructions/ikraamg/csstruth/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 2,017 This file is loaded in full into every session.
When invoked 2,017 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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 $0.02017 $0.02017
Opus 5 $0.01009 $0.01009
Sonnet 5 $0.00403 $0.00403
Haiku 4.5 $0.00202 $0.00202

Measured 4d ago against content hash 563114a8f71e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

csstruth 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 4d 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 · 132 lines

How it starts

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

csstruth — Agent Context

Hard ground truth for CSS: extracts the browser's actual rendered layout as deterministic, diffable text so agents stop guessing. Chromium-only, via the Chrome DevTools Protocol. Public (MIT): github.com/ikraamg/csstruth · npm: csstruth.

Architecture (learn this first)

  • One core, two skins. All logic lives in src/core/*. src/cli.ts and src/mcp.ts are thin wrappers that call identical core functions. Never put logic in a skin — if both skins need it, it goes in core.
  • The seam is withPage(url, fn, opts) in src/core/connect.ts: opens a page, sets viewport, navigates, settles, runs fn, always tears down. Almost everything flows through it. Opts compose (captureAnimations, beforeNavigate, skipSettle) — mirror that pattern for new connection concerns.
  • The LayoutTree (tree.ts) is the core representation: one line per element, byte-identical across runs. Determinism is the whole thesis — never add timestamps, key-order dependence, or randomness to rendered output.
  • 12 CLI commands (10 also MCP tools; watch is CLI-only). Core modules: connect, extract, tree, invariants, explain, inspect, snapshot, verify, matrix, baseline, interact, animate, stability, state, fix, blame, watch, serve.

The invariant checks (src/core/invariants.ts)

Six rules power check/verify, each tuned so a violation is a REAL bug — the exemptions are deliberate, not laziness, and each is tagged field #N / NEXT-* in a comment (grep them for the rationale):

  • viewport-overflow — content wider than the viewport.
  • parent-bleed — a child past its container's padding box, BOTH axes (checkBleed mirrors horizontal/vertical, clamped by the nearest overflow-x/y). Exempts absolute/fixed and deliberately-displaced children (displaced(): negative margin, a translating transform via translatesBoxtranslateZ(0) and other no-op transforms still flag — or non-static position with a real inset).
  • zero-size / off-screen — interactive element with a 0 dimension or parked off-screen (unless inside a scroll/clip ancestor).
  • text-clip — text past a hidden-overflow box with no ellipsis opt-in.
  • overlap — two un-layered siblings overlapping. Exempts SVG internals, sr-only, empty async placeholders (isPlaceholderOverlap), and a descendant that escaped an intermediate container and lapped a cousin (escapesIntermediateContainer — parent-bleed owns that defect).
  • tap-target — sub-24px interactive element. Measures an input's <label> not the sr-only input; exempts a text link inline in a sentence (WCAG 2.5.8 — requires its own text, display:inline, and real parent text — an icon-only link still flags).

Read the full file on GitHub · 132 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. 4d ago First seen · 132 lines · 2,017 tokens per session scan A 563114a8f71e

Subscribe to this mod's changes

csstruth CLAUDE.md is an instructions file published in the GitHub repository ikraamg/csstruth (0 stars, last pushed 1mo ago), licensed MIT. It adds 2,017 tokens to every session, about $0.0101 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-31.