Accordion CLAUDE.md

Accordion CLAUDE.md is an instructions file for Claude Code from a-Fig/Accordion. It costs 13,772 tokens per session, scanned A, original, MIT.

Repository instructions for Accordion, a tool that shows how an AI coding assistant's context is arranged before each model request. They explain its terminology, code layout, and operating rules.

In plain words
What is it for?
Use them to understand context blocks, protected system content, the plugin connection, key URLs, and where the main engine and interface code live.
Why use it?
They give an assistant the definitions and project map needed to change Accordion without confusing the visualizer with the coding tool it observes.

Instructions file for Claude Code

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

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/a-fig/accordion/claude-md
Clone the repo
git clone --depth 1 https://github.com/a-Fig/Accordion

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

README.md
[![agentmods](https://agentmods.dev/badge/instructions/a-fig/accordion/claude-md.svg)](https://agentmods.dev/instructions/a-fig/accordion/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/a-fig/accordion/claude-md"><img src="https://agentmods.dev/badge/instructions/a-fig/accordion/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 13,772 This file is loaded in full into every session.
When invoked 13,772 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.1 $0.13772 $0.13772
Opus 5 $0.06886 $0.06886
Sonnet 5 $0.02754 $0.02754
Haiku 4.5 $0.01377 $0.01377

Measured 6d ago against content hash e71630f772a0, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

Accordion 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 6d 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 · 321 lines

How it starts

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

CLAUDE.md — Accordion

Guidance for AI coding sessions. VISION.md = product north star · README.md = short pitch.

Key URLs

Terminology

  • pi — the CLI AI coding harness whose context window Accordion visualizes. Not an Accordion product; it's the tool the user runs. extension/accordion.ts is a pi plugin that hooks into pi's context hook (fires before each model call).
  • block — atomic unit of context: one chunk of a single kind (system, user, text, thinking, tool_call, or tool_result). See core/types.ts → Block (app/src/lib/engine/types.ts is a re-export shim).
  • bolted — a block no actor may fold, group, pin, or replace: not the human, not a conductor, not the agent. Today exactly the system kind (the harness's own prompt, SYSTEM_BLOCK_ID = "sys:0", always the FIRST block, order -1). Predicate: core/digest.ts → isBolted; refusals surface as the "bolted" ClampReason, checked FIRST in every op handler so a conductor learns the PERMANENT reason rather than a misleading incidental one. Distinct from held (a human override the human can release) and from protected (the working tail, which moves as the tail resizes) — bolted is a property of the kind and never lifts. Its tokens ARE counted in liveTokens/fullTokens: a fixed floor, not reclaimable headroom. If no prompt can be sourced, NO block appears at all (silent absence, never a placeholder).
  • turn — one user message plus all assistant content (thinking, text, tool calls, tool results) that follows it before the next user message.
  • fold / folding — replacing a block's content in-place with something shorter, like a summary; the block stays on the wire to the LLM in compressed form. Always reversible.
  • Truthcore/truth.ts's Truth class: the canonical, framework-free context state — block log, per-block overlay (override/autoFolded/subst/by), multiblock groups, the protected working tail, involvement locks, budget/context-window dials, and a monotonic rev that bumps on every change and rides every emitted TruthEvent. One instance lives authoritatively inside the pi extension per live session (ADR 0021); the app's Svelte store and any conductor are thin mirrors over it, never a second source of truth.
  • replica — a Truth hydrated from a host's snapshot (core/replica.ts → hydrateSnapshot) and kept in lockstep by replaying WireEvents; it asserts its rev matches the host's after every replay and requests a fresh snapshot on any mismatch rather than patching around a gap. The GUI is always a replica in live mode; a spawned conductor is a replica too (core/conductor/remote.ts).
  • held — a block carrying a human override (manual pin, fold, or unfold): a non-null Block.override. Held state always wins over a strategy's proposed ops — the one exception is an involvement lock: while a conductor holds human-steering, the human steering mutators are refused outright (no override is ever created) until the lock releases or the conductor is detached (see freeze, below, and the Conductors section).
  • conductor — a pluggable, evented context-management strategy (core/conductor/contract.ts's frozen v2 Conductor interface) that attaches to a host, subscribes to HostEvents (blocks-appended/turn-committed/state-changed/wire-departing/resync), and proposes diff-op transactions between turns rather than being polled every pass. Never a privileged write path — every proposed op is clamped by the exact same Truth.apply a human hand action or the agent's own tools go through. Five ship today: compaction-naive, handoff, doorman (in-process, bundled into the extension) and thermocline + triptych (out-of-process, each spawned as its own Node process). See the Conductors section.
  • transaction / propose — a conductor's unit of write: host.propose({ baseRev, ops }): Promise<TxnResult> (core/conductor/contract.ts). Async by contract — an in-process host applies the ops synchronously and resolves on a microtask; an out-of-process host resolves after a propose/proposeResult wire round trip. A conductor cannot tell the two hosts apart, which is the whole portability point.
  • birth-fold — the exemption (ADR 0018, restored as ADR 0023) letting a strategy fold a block that sits inside the protected tail but has never yet reached the model whole (Truth.canFold's if (this.isProtected(b)) return !this.sent(b) branch). Such a fold is tracked in Truth's sticky birthFolded set so the tail growing over it later doesn't heal it back open. doorman is the shipped demonstration — it skeletonizes or folds a giant fresh tool_result before it ever rides the wire.
  • hold / holdWireUpToMs — a conductor may declare holdWireUpToMs (ms, default 0) to ask the host to pause the departing wire briefly on the wire-departing event, giving it one last chance to propose a last-moment fold before the model call actually leaves. The hold ends when the conductor's wire-departing handler settles — in-process, the returned promise resolving/rejecting; a remote conductor sends a dedicated holdRelease { holdId } the instant its handler settles (protocol v14; the host correlates by the holdId it minted per hold and ignores a stale/unknown one). A propose never releases the hold, so a concurrent background-tick propose (e.g. thermocline's prepare epoch) can't race it out from under the handler. Bounded: a timeout releases the wire unchanged and counts against holdTimeouts. Surfaced live as MapHeader's HOLD chip and in telemetry's lastHoldMs/holdTimeouts.
  • freeze — the conductor-detach kill switch ({ kind: "freeze" }, core/ops.ts): converts every currently strategy-owned fold/group into a human-owned one (the substituted content preserved byte-identical) BEFORE the host releases the conductor's locks, so work an exclusive conductor did survives its own detach instead of reverting or vanishing.
  • the wire — the messages array sent to the LLM provider. "Wire-valid" = the outgoing array is well-formed. Distinct from the WebSocket between the app and the pi extension (that's the live link / accordion protocol).
  • browser-served — mode where the pi extension HTTP-serves the SvelteKit UI on the same ephemeral port as the WS. Multi-session-aware (the served extension lists every live session over /__accordion/sessions); no Tauri desktop app required.
  • CC — Claude Code (as in "CC transcript", "CC browsing"). Read-only mode; sessions loaded from ~/.claude/projects/.
  • controller / lease — the global, machine-wide right to send mutating steering commands (ADR 0024, issue #66). Exactly one surface (a desktop app instance, a browser tab) holds it at a time, tracked as a ControllerLease blackboard at ~/.accordion/controller.json (app/src/lib/live/registry.ts); every other connected surface is a live, strictly zero-write READ-ONLY mirror. Claiming (claimController) is silent when uncontested and never refused when contested — the human is always the authority, last write wins. Enforced at the extension's WS command ingress (a synthesized "read-only" ClampReason, never produced by Truth.apply itself), so conductor propose and the agent's own unfold/recall are completely unaffected.
  • door / surface — the door is the fixed, well-known loopback port (DOOR_PORT = 24317, core/protocol.ts) exactly one extension binds at a time, as an additional listener alongside its own per-session ephemeral server, so /accordion can print one stable URL that survives any single session's death (first-bind-wins, automatic takeover on the holder's exit). A surface is a connecting client's per-tab identity (a sessionStorage UUID — per tab, not per origin, with a duplicate-tab BroadcastChannel dedupe guard; see app/src/lib/live/surfaceId.ts — plus a human label like "Desktop app"/"Browser tab") — what the controller lease is actually granted to.
  • READ-ONLY — the one term for "this view cannot write," covering two distinct situations: a Claude Code transcript (plain badge, no wire, no escape) and a live session currently steered from another surface (READ-ONLY · <WHO> STEERS chip + a TAKE CONTROL button). Both share the exact same guarantee (see the RULE below); "view-only" is deliberately never used as a second term for either.

Read the full file on GitHub · 321 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. 6d ago First seen · 321 lines · 13,772 tokens per session scan A e71630f772a0

Subscribe to this mod's changes

Accordion CLAUDE.md is an instructions file published in the GitHub repository a-Fig/Accordion (238 stars, last pushed 14d ago), licensed MIT. It adds 13,772 tokens to every session, about $0.0689 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.