agentleFS
Allan-NavaAllan-Nava/qrspi/CLAUDE.md

qrspi

CLAUDE.md2 starsChanged 51 days agoMITView on GitHub

Guidance for Claude Code when working in this repository. qrspi is a Claude Code plugin, not an application. There is no build step and no dependency: every file that matters is Markdown or JSON, and the "product" is the prompt text itself. The executable code that ships is the npx qrspi installer, bin/qrspi.mjs, which exists only to put the Markdown where Claude Code can see it, plus the one module it imports — bin/pipeline.mjs, the pipeline diagram's grammar, which the…

  • Installs packages

The file

We split this CLAUDE.md into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do not weaken these when editing.

    line 131
  2. Distinctive:

    Do not outsource the thinking.

    line 139
  3. Very specific:

    Keep handoff's description on *writing* a handoff and token-efficiency's on *diagnosing cost*, or the two compete — measured not to, …

    line 156
  4. Very specific:

    The page has no prose of its own: Every word comes from README.md or is read off the filesystem (the skills index — the Codex twins, …

    line 316

≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md

Guidance for Claude Code when working in this repository.

What this repo is

qrspi is a Claude Code plugin, not an application. There is no build step and no dependency: every file that matters is Markdown or JSON, and the "product" is the prompt text itself. The executable code that ships is the npx qrspi installer, bin/qrspi.mjs, which exists only to put the Markdown where Claude Code can see it, plus the one module it imports — bin/pipeline.mjs, the pipeline diagram's grammar, which the site reads too.

It ships three things:

  1. A workflow — QRSPI: Questions → Research → Spec (Design + Structure) → Plan → Implement. Each phase burns whatever context it needs, compresses what it learned into one Markdown artifact on disk, and the next phase starts from a fresh session reading only that artifact. This is "intentional compaction".
  2. A reference skill — token-efficiency: the reasoning behind the workflow (measurement, compaction ratios, subagents as context firewalls, effort allocation, prompt-cache invalidation, tool hygiene, KPIs).
  3. A craft skill — handoff: how to write the artifact itself so it survives a context reset — what survives, the load-bearing-fact test, compressing without losing the evidence trail, the zero-context step. It triggers outside QRSPI ("summarise this session before I lose it"), which is what earns it a skill.

The plugin produces artifacts in the user's repo under thoughts/<task-id>-<slug>/. Nothing in this repo is generated at runtime.

Layout

bin/
  qrspi.mjs            `npx qrspi` installer (install / uninstall / path / check)
  pipeline.mjs         the pipeline diagram's one grammar — which fenced block, what a
                       row is, what else a line inside it may be. `readPipeline(text)`
                       is the only export; bin/qrspi.mjs and site/build.mjs both import
                       it, so they cannot read the block differently (#141)
assets/
  logo.svg             the mark — single source for the favicon, the site, the README
  logo-mono.svg        same shapes in currentColor, no tile
  wordmark.svg         mark + QRSPI lockup
  social-preview.html  source of the OG card
  social-preview.png   1280x640, rendered from that HTML, committed
site/
  build.mjs            generates site/dist/index.html FROM README.md (gitignored output)
scripts/
  measure-context-cost.mjs  count_tokens over the plugin's own text (needs a key)
  measure-run.mjs      KPIs 1, 3, 4 of a real run, from ~/.claude/projects/<slug>/*.jsonl
                       — no key; reads the phase off each session's first prompt and
                       counts its subagents (`<session>/subagents/`, #144).
                       Both are contributor tooling, kept out of the npm tarball by
                       package.json#files
evals/
  trigger/             twenty prompts per skill, should/should-not trigger, for the
                       skill-creator harness — see CONTRIBUTING.md; not in the tarball
.github/workflows/
  ci.yml               check on Node 18/20/22/24 with no npm install, plus a copy-mode round
                       trip; site build + npm pack on 22, and `check` run from the packed
                       tarball (#152) — every PR and push to main
  release.yml          on tag qrspi--v*: publish to npm, cut the release, close the milestone
  release-drift.yml    fails when main carries a version with no tag for 2h; runs daily
  pages.yml            builds and deploys the site to GitHub Pages on push to main
package.json           npm distribution; `bin` → bin/qrspi.mjs, `test` → qrspi check
.claude-plugin/
  plugin.json          plugin manifest (name, version, author, keywords)
  marketplace.json     single-plugin marketplace manifest for `/plugin marketplace add` —
                       Codex CLI reads it too, as a legacy marketplace
.codex-plugin/
  plugin.json          the Codex CLI manifest: same name, version and description,
                       `skills: ./skills/`; `npm test` holds the version to the others
commands/
  new.md               /qrspi:new  — bootstrap thoughts/<dir> and run phase 0
  next.md              /qrspi:next — detect current phase, gate, emit the next prompt
  review.md            /qrspi:review — one artifact against the judgement rubric; read-only
skills/
  qrspi/
    SKILL.md           the workflow index: 6 rules, phase table, context budgets
    references/
      00-questions.md  phase prompt + artifact skeleton
      01-research.md   idem
      02-design.md     idem
      03-structure.md  idem
      04-plan.md       idem
      05-implement.md  prompt only — the phase output is code, not an artifact
      99-progress.md   implement-phase state file skeleton
      recovery.md      what to re-enter, and how narrowly, when Implement finds an
                       upstream artifact wrong — a prompt-less reference, not a template
      landing.md       artifacts into a reviewable PR: what the description carries,
                       commit-per-step, thoughts/ ships in the same PR
      reviewing.md     judgement-level rubric per artifact: wrong-but-plausible Research,
                       over-specified Design, a step that hides a decision
  token-efficiency/
    SKILL.md           index of the five levers and five KPIs
    references/        measuring, compaction, subagents, effort, caching (+ caching-api
                       for people writing their own loop), tool-hygiene, anti-patterns,
                       playbook
  handoff/
    SKILL.md           the one test, what survives a reset, the failure modes by name
    references/        what-survives, load-bearing, zero-context-step
  qrspi-new/ qrspi-next/ qrspi-review/
    SKILL.md           the three commands in Codex CLI form (`$qrspi:qrspi-new`…): Codex
                       has no slash commands and reads skills only from skills/, so they
                       live here — inert in Claude Code (`disable-model-invocation`,
                       `user-invocable: false`), steered to explicit use in Codex by
                       their description. `npm test` holds each to its command's step
                       list; paths are relative to the skill dir, never
                       ${CLAUDE_PLUGIN_ROOT}
plugins/
  qrspi-pane/          a second plugin in the same marketplace: a Claude Code mod (a hooks
                       module, `hooks/register.tsx`) drawing thoughts/ as a pane, opened with
                       `/qrspi-status`; reads only. Not in package.json#files — installed
                       through the marketplace alone. `claude plugin validate plugins/qrspi-pane`
                       checks it; `tsconfig.json` points at the engine types `/plugin-types` writes
README.md              user-facing pitch; overlaps SKILL.md numbers — keep in sync

Note the dual role of skills/qrspi/references/*.md: they are both the phase prompts (> PROMPT blockquote at the top) and the artifact templates that /qrspi:new copies into the user's thoughts/<dir>/. Editing one edits both.

The copy is not verbatim. /qrspi:new copies six files — 05-implement.md is a prompt with nothing to fill in — and deletes the > **PROMPT blockquote from each one, because the plugin already carries it and /qrspi:next prints the one you need. That block is 36-49% of a template, and left in the artifact every downstream phase re-reads it as the previous phase's instructions.

The rules the content encodes

Do not weaken these when editing; they are the plugin's whole thesis.

  1. Fresh session at every phase boundary — never continue.
  2. The artifact is the only channel between phases.
  3. Artifacts are self-contained: repo-root-relative paths, explicit symbols, line numbers. Never "the file from before".
  4. The ticket does not enter Research (it returns in Design).
  5. The 40% context rule — stop and compact, do not push through.
  6. Do not outsource the thinking; every phase is a human checkpoint.

Conventions to follow when editing

  • A SKILL.md is an index, not a manual. Target ~100 lines. Detail goes to references/ and is loaded on demand. A skill that preaches context economy while spending 9k tokens on every trigger refutes itself.
  • Skill frontmatter is only name + description. The description sits in context permanently for every installed skill, so it names what the skill covers in one clause and then its trigger conditions (Use when…), no longer than triggering needs. It is judged by measurement, not by sentence count: any change to a description is re-run against evals/trigger/ and its false-trigger rate dated in CONTRIBUTING.
  • Do not add one skill per phase. This was decided deliberately (README, "Two design notes"): six near-identical descriptions would burn the permanent budget and compete to trigger. Phases are sequential and user-driven, so they are commands. The bar for a skill is that it triggers outside QRSPI — handoff cleared it ("summarise this session before I lose it" needs no workflow); a phase never will. Keep handoff's description on writing a handoff and token-efficiency's on diagnosing cost, or the two compete — measured not to, 2026-09-18: 0 false triggers in 198 negative runs (evals/trigger/, CONTRIBUTING has the numbers and the traps). qrspi and token-efficiency share the 40% rule and compaction; that border holds too — 0 false triggers in 50 negative runs, 2026-10-08 (#106).
  • Command frontmatter carries description, argument-hint, and a tight allowed-tools list. Keep allowed-tools minimal; widen only with a reason. The one widening so far: /qrspi:next and /qrspi:review may run git log (read-only) to compare an artifact's Written against: commit with what landed since (#111).
  • Each command has a Codex twin in skills/qrspi-<name>/SKILL.md, because Codex CLI has no slash commands, discovers skills only under skills/, and has deprecated its custom prompts (learn.chatgpt.com/docs/custom-prompts, read 2026-09-23). The twin is not a per-phase skill in the sense the design note refuses: its frontmatter carries disable-model-invocation: true and user-invocable: false, so Claude Code neither lists it nor spends a description on it. In Codex it is listed — under the plugin-prefixed name $qrspi:qrspi-<name> — with a description that says to run it only when named; not policy.allow_implicit_invocation: false, which drops the skill from the list the model sees while codex exec never expands $name, so the skill was unreachable outside the TUI's popup (measured 2026-09-23). Edit the command, then mirror the change: npm test compares the two step lists and fails when they drift. The twin addresses the phase references as ../qrspi/references/ — relative to its own directory — never ${CLAUDE_PLUGIN_ROOT}, which Codex does not set; npx qrspi install --copy does not copy the twins, they are for Codex.
  • Plugin paths in commands use ${CLAUDE_PLUGIN_ROOT}, never a relative path.
  • Template placeholders are <...> and _(to be filled …)_, and every artifact ends with a ## Status checkbox block. /qrspi:next greps for exactly these to decide whether a phase is complete — changing the markers breaks phase detection in commands/next.md. The last box in every Status is the human's — Reviewed in Questions and Research, Approved in Design, Structure and Plan — and a phase session never ticks it (#126); npm test requires one naming <who> per template.
  • Phase prompts live in a > **PROMPT blockquote at the top of the reference file. /qrspi:next extracts that block with awk — not the whole file — and prints it with real paths substituted; /qrspi:new deletes the same block from the artifact copies. npm test therefore requires every numbered reference except 99-progress.md to carry the marker; un-numbered files in references/ are guides (recovery.md and its kind) with neither a prompt nor a Status block, and the check leaves them alone. The extraction stops at the first line that does not start with >, so the block must be contiguous: a blank line inside it must be a bare >, never empty, or everything after it is silently dropped from the printed prompt.
  • Numbers are duplicated, and npm test compares them. The pipeline diagram is in README.md, skills/qrspi/SKILL.md and compaction.md; the per-phase effort table is in SKILL.md, commands/next.md and effort.md. Change a row, change it in all three of its files. The context budgets live in SKILL.md alone.
  • The API claims in token-efficiency/references/ are dated. caching.md, effort.md, measuring.md and playbook.md assert model IDs, prices, minimum cacheable prefixes, an invalidation matrix, effort and thinking parameters, and beta headers — facts about someone else's product, on their release cadence, not ours. They are the likeliest thing here to be quietly wrong. Re-verify them against the current API reference rather than from memory, keep the (cached: YYYY-MM-DD) date on the model table honest, and treat a stale price as a bug: the whole skill argues from those numbers. Last audited 2026-10-08, against the claude-api reference bundled with Claude Code 2.1.293 and the 2.1.294 binary itself — the first pass that could read the harness's claims off the binary rather than mark them unverifiable: 76 claims, 59 hold, 3 wrong, 9 incomplete, 5 unverifiable. One model arrived — Haiku 5.5 ($0.10/$0.50 up to a 100K prompt, takes effort, default medium), which made effort.md's reason for a Sonnet on the subagent row wrong; the row itself stays, moving it is a decision. /effort keeps the cache on Fable 5.1, Opus 5.5, Sonnet 5.5 and Haiku 5.5, not Opus 5 (per_turn_effort_active in the init event). No price changed. Before that, 2026-10-03 (#131, findings in #130), against the Claude Code 2.1.286 reference: 72 claims, 47 hold, 3 wrong, 10 incomplete, 12 unverifiable. One model arrived — Sonnet 5.5 ($2/$10, rejects disabled thinking, uses between_tools), added to the model table and the thinking, caching and mid-conversation lists; per-message effort now runs on Google Cloud too, not the Claude API alone; inline-tools-2026-09-15 is now in the reference; fast mode loses the system and messages caches, not the tools one; compact-2026-09-04 joined the headers; three harness claims were marked unverified. No price changed. The effort table still puts Sonnet 5 on the subagent row — its successor recalibrated the levels, so moving the row is a decision, not a fix. Before that, 2026-09-30 (#108): no price or model row changed; Opus 5.5 was missing from the thinking rules in effort.md (it cannot disable thinking), and six claims were tightened or marked unverified. Before that, 2026-09-23 (#92): one model arrived (Opus 5.5 — $4/$20, cache read 0.05×, default effort medium, Claude Code's default since v2.1.280) and two wordings were tightened; the 2026-09-21 pass found nothing, the 2026-09-18 pass three wrong and two incomplete (the Claude Code sections drift fastest: the harness ships weekly). Audit before every tag — #87 is the template.
  • Versions must match across the four manifests — package.json, .claude-plugin/plugin.json, .claude-plugin/marketplace.json and .codex-plugin/plugin.json — and the lockfile follows. npm test fails if the manifests drift.
  • Copy mode never deletes what it did not write. It drops a .qrspi-installed marker in each directory it creates and refuses an unmarked target without --force — see unmanaged() in bin/qrspi.mjs. uninstall obeys the same marker. Keep both sides in step.
  • Copy mode rewrites ${CLAUDE_PLUGIN_ROOT}/skills to ~/.claude/skills — see rewritePluginRoot() in bin/qrspi.mjs. A ${CLAUDE_PLUGIN_ROOT} reference pointing anywhere other than /skills would survive unrewritten and break the copy install, so npx qrspi check rejects it. Add such a reference only together with its rewrite rule.
  • The installer stays dependency-free and Node-18-compatible, and CI now proves both: check runs on Node 18, 20, 22 and 24 without npm install — the floor and the current line, so a removal in a newer Node is caught as early as a post-18 syntax. No bundler, no TypeScript, no postinstall hook — installing a package must never write to ~/.claude behind the user's back; that only happens on an explicit qrspi install.
  • npx qrspi install registers the marketplace from GitHub, not from ROOT. Under npx, ROOT is ~/.npm/_npx/<hash>/…, which npm prunes; a marketplace pointing there survives the install but breaks the next update. marketplaceSource() in bin/qrspi.mjs switches to the slug from package.json#repository when it sees _npx in the path — so that field has to name the GitHub repo, and check fails if it does not. npm i -g and a checkout keep registering ROOT.
  • Prose style: British-leaning spelling ("utilisation"), em-dashes, no marketing filler. No decorative emoji — none in prose, headings, or the "Next phase" footers. Two functional uses stay: the status glyphs in 99-progress.md (a column read at a glance, with a legend) and # ❌ / # ✅ above do/don't code examples. A decision table gets words (kept / lost), not ticks — a tick under a column called "cache" does not say which way it points.

Verifying a change

There is nothing to build. The one automated check is the installer's own:

npm test                  # == node bin/qrspi.mjs check

It validates the four manifests and their versions, skill frontmatter, SKILL.md length, every ${CLAUDE_PLUGIN_ROOT} reference, the > **PROMPT blockquote that /qrspi:next prints and /qrspi:new strips, and the checkbox markers that /qrspi:next greps for. It also enforces the content rules this file states and nothing else used to check: the ## Status block in every artifact template, the pipeline diagram across the three files that draw it — every line inside each block is blank or a row, and a line that is neither is reported as path:line with the line quoted (#141) — the per-phase effort allocation across the three that tabulate it, and what /qrspi:new would leave in thoughts/ — each template with its prompt block removed is still gateable (Status, checkboxes, placeholders) and the block itself was contiguous. Two more since the 2026-09-30 audit: the phase-detection count in /qrspi:next and its twin is scoped to the ## Status block (a Plan's acceptance criteria stay open until Implement, #97), and the progress template's step table holds placeholders only (#98). It also fails on a file URL or an absolute home path in a tracked text file (#99). And it keeps the parallel-Implement execution plan in /qrspi:next and its twin (#122), and a human box — one naming <who> — in every artifact template's Status block, so no phase closes on a session's own ticks (#126). Run it before every commit and extend it whenever you add an invariant — .github/workflows/ci.yml runs it, the site build and npm pack --dry-run on every pull request.

Then, by hand:

npm pack --dry-run                       # tarball carries .claude-plugin/, skills/, commands/
CLAUDE_CONFIG_DIR=/tmp/fake node bin/qrspi.mjs install --copy   # safe end-to-end test
node bin/qrspi.mjs install --dry-run     # what the claude-CLI path would run
grep -rn '](' README.md CLAUDE.md        # links resolve

End-to-end check: install locally with /plugin marketplace add . then /plugin install qrspi, and run /qrspi:new TEST-1 <some ticket> in a scratch repo — it must create thoughts/TEST-1-<slug>/ with six files (no 05-implement.md), each with its H1 renamed and its > **PROMPT blockquote deleted, then stop without entering Research. The same check under Codex CLI: codex plugin marketplace add . (the checkout is copied, uncommitted files included), codex plugin add qrspi@allan-nava, then in a scratch repo codex exec --approve-for-me '$qrspi:qrspi-new TEST-1 <ticket>' < /dev/null — same six files, same stop. After editing, codex plugin remove qrspi@allan-nava and add it again: the copy does not track the checkout.

The site

allan-nava.github.io/qrspi is generated by site/build.mjs and deployed by .github/workflows/pages.yml on every push to main.

The page has no prose of its own. Every word comes from README.md or is read off the filesystem (the skills index — the Codex twins, user-invocable: false, are left out). Design lives in build.mjs, content lives in the README — do not add copy to the generator, and do not commit site/dist/, which is gitignored. To change what the page says, edit README.md and rebuild:

npm run build:site && open site/dist/index.html

It also emits sitemap.xml — one URL, because the site is one page and the section anchors are fragments of it, not separate resources — plus JSON-LD (WebSite and SoftwareApplication) built from the same title and description the meta tags use, so the four cannot drift. There is deliberately no robots.txt: crawlers read one only from the host root, and allan-nava.github.io/robots.txt already speaks for every project site under it, generating its Sitemap: lines in CI from the sites whose sitemap.xml returns 200. Shipping the sitemap is what gets qrspi listed there.

The generator parses the README: the H1 becomes the hero and each ## becomes a section. The pipeline diagram in the intro is read by bin/pipeline.mjs, the one grammar npx qrspi check reads it with too (#141): the block is the first bare fence whose body names 00-questions.md, so a fenced block added above it changes nothing, and every line inside that block must be blank or a row (Phase context → artifact (size)). A line that is neither stops the build, named as README.md:<line> and quoted; so does a missing block, an empty one, or one whose bounds fall outside the intro. No row is dropped and there is no <pre> to degrade to — the hero draws every row, or the build writes nothing and exits 1. pages.yml runs npm test before the build, so in CI the check names the line first. Renaming a README heading renames a nav entry and an anchor; reshaping the pipeline block now fails loudly — but still re-run the build and look at the output, because a byte-identical diff says the page did not move, not that it is right. marked is a devDependency used only here — it never reaches the published npm package, which stays dependency-free.

Brand assets

assets/logo.svg is the single source: four bars converging on one solid block — the phases compacting into an artifact. Terracotta #b7552f, white shapes, 64×64 grid, 14px corner radius. It has to survive 16px, so do not add detail to it; if you restyle it, re-check it at 16px before committing.

The site inlines that file as its favicon and draws it in the header and hero, so the mark never gets a second copy. The README points at the raw GitHub URL, not a relative path, so it also renders on npm.

social-preview.png (the OG card, and what you upload under Settings → General → Social preview) is rendered from assets/social-preview.html with headless Chrome — no dependency, no CI step:

"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --headless=new \
  --disable-gpu --hide-scrollbars --allow-file-access-from-files \
  --window-size=1280,640 --screenshot=assets/social-preview.png \
  --virtual-time-budget=2500 "file://$PWD/assets/social-preview.html"

Regenerate it whenever the card's text goes stale. assets/ is deliberately not in package.json#files: the npm tarball stays small and links to the GitHub copy.

Releasing

The runbook lives in CONTRIBUTING.md — one home, so it cannot drift. In short: bump the version in all four manifests, npm test, then claude plugin tag . --push. The tag triggers .github/workflows/release.yml, which publishes to npm with provenance, cuts the GitHub release and closes the matching milestone. It authenticates to npm over OIDC (Trusted Publishing) — there is no npm token in this repository. Note the bootstrap exception in CONTRIBUTING.md: npm cannot configure a trusted publisher for a package that does not exist, so a brand-new package's first version is published by hand.

Things to avoid here

  • Growing bin/qrspi.mjs into an application. It installs Markdown; anything beyond install/uninstall/path/check belongs elsewhere. No dependencies, no build, no postinstall.
  • Executing a phase inside /qrspi:new or /qrspi:next — both commands must emit a prompt and stop. Continuing violates rule 1. /qrspi:review reports and stops for the same reason: fixing what it finds would make the artifact the reviewer's.
  • Relaxing the gates in commands/next.md. Refusing to advance on an unfinished artifact is the feature, not friction.
  • Pasting code into an artifact template. Artifacts carry paths, symbols and line numbers; the whole compression ratio depends on that.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.