Project Info
Inspiration
Anyone who has used AI coding agents has seen their context window fills up, and /compact gets called soon after. Just like that your thinking partner has lost 90% of your conversation. Decisions, rules, errors, code, and more gone. We believe this is an inherently naive solution to a problem that deserves real attention.
What it does
Accordion shows you your entire context window at a glance using a series of blocks in a grid. Each block is colored depending on its type. Those types are user messages, responses, thinking, tool calls and their results. Then, what we call a conductor, reads every block and decides which should be folded, unfolded, or grouped based on custom logic. Folded blocks are replaced with tagged summaries containing a unique code. If the agent needs the original content, it can get it back at any time using our unfold command. Every fold is fully reversible. strategies for conductors range from simple oldest-first folding to harvesting attention from a 500M parameter model to score each blocks relevance to the most recent context. The promise is simple. No blocking calls for compaction, longer smarter coding sessions, and cheaper inference costs. Accomplishments we're proud of Thermocline(one of our conductors) scored 83.3% on SlopCodeBench, 2.5× the 33.3% the same model scored using naive compaction to manage its own context. This is the first conductor to combine attention-based relevance scoring with LLM summaries and block grouping. The result validates that reversible, recall-able folding with intelligent prioritization isn't just theoretically better than naive compaction, it measurably outperforms it on real coding tasks.
How we built it
Accordion is built around a simple idea: context is a view, not a storage system. We keep the full conversation intact and generate a live view of what gets injected into the model each turn. Folding swaps content for a compact digest; unfolding restores it instantly. The desktop app is built with Tauri, SvelteKit, and TypeScript, while a local WebSocket connection streams live context updates from the running agent to the UI in real time. The Conductor architecture uses a clean synchronous interface — conduct(view) → Command[] — so new folding strategies are a single file to drop in, in any language over the wire or as a direct TypeScript class. One of the biggest technical challenges was preserving tool-call correctness. Since tool calls and their results must remain paired in the provider's message format, Accordion never folds a tool call — only its result — and validates every context view before sending it to the model.
Challenges we ran into
Control and trust. We wanted automation without sacrificing user control. The final system has a layered trust model: collaborative conductors that users can always override, exclusive conductors with an explicit consent gate showing exactly which controls they claim, and a kill switch (detach) that freezes the current context and hands every control back to you — always, unconditionally. Stable fold handles. When a block is folded, the agent sees a {#code FOLDED} tag in its context — a short handle it can pass back to retrieve the content. That handle has to be stable across sessions, short enough to be noise-free in context, and deterministic so the agent gets the same code every run. We derive it as a stateless hash of the block's durable ID rather than generating it dynamically, so it requires no stored state and survives reconnects cleanly. Automatic folding strategy. Determining what is "important" is harder than it sounds. We ended up building a family of strategies rather than committing to one answer — from a simple oldest-first baseline to an attention-probe-driven scorer (Qwen2.5-0.5B) that identifies which blocks the model is actually attending to.
What we learned
Treating context manipulation as a UI problem as much as an AI problem unlocked a lot. The hard part wasn't compression — it was giving humans and agents the right level of visibility and control at each layer: what's folded, who did it, and how to get it back. We also learned that the right abstraction is a view over a store, not a store you mutate. Once that clicked, reversibility, attribution, and the agent's ability to reach back for folded content all fell out naturally — no extra infrastructure. Finally: folding strategy is not one thing. The first conductor we built was a clean baseline. The second taught us something the first couldn't. By the time we had nine, each one caught real failure modes the others missed — which is why the architecture is a protocol, not a single algorithm.
What's next
LLM-generated summaries, computed once and cached — richer prose summaries for individual blocks would make folded content more legible to the agent than raw digests Hierarchical folding — fold the folds, for million-turn sessions: a long session compresses to a handful of headlines you can open to any depth Agent-driven pinning — the agent can already unfold and recall; letting it pin blocks protects them from future automated folding Replay — scrub how the context evolved across a session, so you can see exactly when something got folded, who did it, and what the token budget looked like at each step "Accordion just killed claude" - Tech influencer
/compact is the naive solution, Accordion is the intelligent one.
See everything your AI agent holds in context — and fold it like an accordion instead.
Your whole context window split in 2 sections. The lower section represents your agent's most recent context and is protected against any interference
Accordion is a pi extension that shows you your agent's entire context window at a glance and lets you manage it manually or with intelligence through a conductor.
Why it's different
1. No blocking calls for compaction
your context window is automatically managed for you in the background, keeping you below your limit
2. longer more useful sessions
The relevance of each block is ranked so we only fold bloat, and keep what's important.
3. Cheaper inference costs
Accordion keeps your context window lean, with cache optimizations in mind.
Every long-running agent hits the same wall: the context fills up, and something has to go. Today's answers are dumb and dumber:
- Compaction blasts your whole history into one lossy summary — slow, destructive, all-or-nothing.
- Sliding windows just drop the oldest tokens — the agent simply forgets.
| Sliding window | /compact | skills & memory | 🪗 Accordion | |
|---|---|---|---|---|
| Keeps old context usable | ❌ | ⚠️ lossy | ⚠️ if retrieved | ✅ |
| Reversible to full detail | ❌ | ❌ | ❌ | ✅ |
| No mid-task stall | ✅ | ❌ | ✅ | ✅ |
| Per-section, not all-or-nothing | ❌ | ❌ | ⚠️ | ✅ |
| You can see and steer it | ❌ | ❌ | ❌ | ✅ |
| No extra infra (no vector DB) | ✅ | ✅ | ❌ | ✅ |
The proof — early, but pointed
Accordion ships with a catalog of interchangeable Conductors. The strongest so far, Thermocline, scores each block relevance to the most recent context using the attention from a 500M parameter model as a proxy.
In a test run on SlopCodeBench (a long-horizon coding benchmark), Thermocline at a 100k-token budget outperformed naive compaction with the same constrained context budget. Both used deepseekV4Pro.
| Conductor | Context Budget | Score | Checkpoints reached |
|---|---|---|---|
| Thermocline | 100k | 83.3% | 5 / 6 |
| naive compaction | 100k | 33.3% | 2 / 6 |
⚠️ Read this as a signal, not a guarantee. It's a single hackathon-scale run on a subset of the problems — not a published benchmark. Broader, repeatable evaluation is on the roadmap.
How it works
The context Map is the whole window at a glance: one square per block, sized by token weight (a dice face, 1–6), colored by kind — user messages, assistant responses, thinking, tool calls, and tool results each get their own hue. Bright = live; recessed and hatched = folded.
Three hands share those controls:
- You — fold, unfold, pin, and peek by hand. Your overrides always win.
- The agent — reaches back to unfold or pin context it needs mid-task, or recall
a folded block as a tool result (like
read_file) without changing what's standing in context. - The Conductor — an automatic strategy that, between turns, folds what's gone cold and unfolds what's becoming relevant. Collaborative by default; an exclusive conductor you approve can take over specific controls, and detach is always your kill switch.
Every block is Full, Folded (shown as a short tagged summary), or Pinned (locked open).
Folds nest: cold turns fold into groups, groups into bigger groups, so a session of thousands of turns stays small enough to fit and complete enough to recover. And the recent past is always safe — the most recent ~20k tokens are a protected working tail the agent reasons over at full fidelity (the thick-bordered box below the fold line).
→ Capability matrix, full walkthrough, and the deep spec: VISION.md
What works today
- ✅ Desktop app (Tauri + SvelteKit): the Map view, token budget, inspector, protected working tail.
- ✅ Live link to a running pi session, with auto-discovery.
- ✅ Opt-in live steering — apply your fold plan to what the agent is shown.
- ✅ Reversible, provider-safe folding with deterministic
{#code FOLDED}digests the agent can ask to unfold. - ✅ Involvement locks — exclusive conductors, the consent gate, freeze-on-detach, and
agent
recall. - ✅ The Conductor — automatic fold/unfold between turns, based on context.
- ✅ LLM-generated summaries, computed once and cached.
- ✅ Read-only browsing of saved Claude Code transcripts.
Honest about what's not there yet: no agent-driven pinning, no hierarchical (nested) groups, no replay. That's the build ahead.
Roadmap
- Core fold/unfold engine — reversible, tool-pair safe
- The separate window — desktop app: Map view, budget, inspector
- Live link to pi + auto-discovery, opt-in steering
- Agent-driven unfold +
recall, involvement locks - LLM-generated summaries, computed once and cached
- The Conductor — automatic fold/unfold between turns
- Hierarchical folding for million-turn sessions
- Agent-driven pin
- Replay — scrub how context evolved across a session
- Better conductors — research, develop, and test stronger context strategies
- Expand accordion beyond pi
Quick start
Part 1 — Browser (no Rust, no desktop app)
pi install npm:@a-fig/accordion
restart pi if it is already running, then inside of pi run:
/accordion
That's it, assuming you have pi
Part 2 — Desktop app (Optional - full feature set)
The desktop app adds multi-session discovery (switch between running pi sessions from
a sidebar), conductors that require local model resources, and the /accordion command
that foregrounds the right session automatically. It requires Node 20+ and Rust.
Don't double-register the extension. Part 1's
pi install npm:@a-fig/accordionalready registered the extension (the/accordioncommand, theunfold/recalltools, and the skills all come from the npm package). That same extension is what the localextension/accordion.tsbuilds into. Addingextension/accordion.tstoextensionswhile the npm package is still installed loads it twice — a duplicate/accordioncommand, duplicate tool registration, and a duplicate context hook. Pick one of the two paths below; don't do both.
Prerequisites: install Node 20 LTS and Rust via rustup, then follow the one-time platform setup at https://v2.tauri.app/start/prerequisites/ (WebView2 + MSVC on Windows, Xcode CLT on macOS).
Path A — Place a built binary (recommended; keeps the npm package)
/accordion launches a pre-built binary from disk — it does not connect to a dev
server. So all you need is a built app binary in one of the locations the extension
scans. If you already ran Part 1, this is the only step: no settings.json edit, no
duplicate extension.
git clone https://github.com/a-Fig/accordion.git
cd accordion/app && npm install
npm run tauri build -- --no-bundle # builds target/release/app(.exe); --no-bundle
# skips the slower MSI/NSIS/.dmg installers
Then drop the binary where the extension looks for an installed bundle:
| OS | Path |
|---|---|
| Windows | %LOCALAPPDATA%\Programs\Accordion\Accordion.exe |
| macOS | /Applications/Accordion.app |
| Linux | ~/.local/share/Accordion/accordion |
(Without an installed bundle, /accordion falls back to the repo build outputs
app/src-tauri/target/release/app then …/debug/app.) Run /accordion in any pi
session and it launches (or focuses, via single-instance) the desktop app on that session.
Path B — Register the local extension (for extension development)
Only choose this if you'll edit the extension itself. Remove the npm package first, then
point pi at your checkout instead. From ~/.pi/agent/settings.json, drop
"npm:@a-fig/accordion" from packages and add to extensions:
{ "extensions": ["<absolute-path-to-repo>/extension/accordion.ts"] }
The extension has its own runtime deps, so install them too:
cd accordion/extension && npm install
Run the app + live session
npm run tauri dev # opens the native window; hot-reloads on save
npm run tauri devis a Vite dev server for UI iteration. It is not what/accordionconnects to —/accordionalways launches a built binary (target/release/app). To produce that binary, runnpm run tauri build -- --no-bundle. Bothnpm run devandnpm run tauri devwant port 1420; run only one at a time.
Run pi in any project. It advertises itself in ~/.accordion/sessions/ and appears in
Accordion's Sessions sidebar within ~1s. Click it (or run /accordion in that
terminal) and its context populates live. Folding is preview-only by default; use the
header's Folding toggle to opt in to steering the live agent's context.
Only one surface steers at a time, machine-wide across every session — the rest are live mirrors. If you open Accordion from a second tab or window while another is already driving, you'll see a one-time prompt to take control; everywhere else stays READ-ONLY with a TAKE CONTROL button, never a silent write race between two open surfaces.
To refresh the binary after main moves (close any open Accordion window first so the
file isn't locked, then git pull, npm install, and rebuild): see
CONTRIBUTING.md.
Contributing
An experiment in context engineering — contributions, ideas, and benchmarks welcome. Setup, the quality gate, and platform gotchas are in CONTRIBUTING.md.
Our main frontier right now is better conductors: researching which context actually
matters, developing stronger strategies, and testing them against real sessions. We're not
chasing a long tail of mediocre ones — the goal is one to three conductors that genuinely
hold up. Four ship today (compaction-naive, handoff, doorman, and the attention-gated
thermocline) against a small, frozen contract (core/conductor/contract.ts): a conductor
attaches to a host, reacts to context-change events, and proposes fold/group edits between
turns — clamped by the exact same rules a human fold goes through, never a privileged write
path. If you don't need that finer-grained event stream, core/conductor/view.ts's
ViewConductor adapter lets you write the simpler conduct(view) → Command[] shape instead
(what compaction-naive and handoff do); one line in core/conductor/registry.ts registers
it. Strategies can range from simple oldest-first folding to scoring each block's relevance
with a small model. If you have a theory about what an agent should keep and what it can let
go, that's the surface to prove it — and the place where outside help is most valuable right
now.
The north star: your agent's memory should be something you can see and steer — not a black box that silently forgets.
🏆 Built at the AI Hackathon 2026 @ UC Berkeley — a winning project.
Tyler Darisme · Aaditya Desai · Sheel Shah · Thy Tang
🪗
Analysis
View
Metric
- 24
- 11
- 6
- 1
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- CSSIn code
- HTMLIn code
- Hugging FaceIn code
- JavaScriptIn code
- PythonIn code
- PyTorchIn code
- RustIn code
- SvelteIn code
- TypeScriptIn code
- Node.jsClaimed
9 of 10 appear in the indexed code. 1 claimed on Devpost could not be matched to code, which may simply mean the tool leaves no trace in the repository.
AI coding agents
- Claude CodeConfig · Commits
- CodexConfig
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
2.8 MB
Source files
210
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
a-Fig/Accordion
357 files · 38.1 MB · @ dc037bc
Structure
Interface
65 files · 18%Screens, components and styles rendered to the user.
API & routing
5 files · 1%Request entry points: routes, handlers and controllers.
Application logic
66 files · 18%Domain rules, services and shared utilities.
+15 more
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- TypeScript62%
- Markdown22%
- Svelte10%
- HTML3%
- Python1%
- Rust1%
- Other (2)1%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
conductors/attention-folder/probe/requirements.txt
pypi · 17- filelock
- hf-xet
- huggingface_hub
- Jinja2
- networkx
- numpy
- packaging
- PyYAML
- regex
- requests
- safetensors
- sentencepiece
- sympy
- tokenizers
- torch
- tqdm
- transformers
app/package.json
npm · 16- @fontsource-variable/ibm-plex-sans
- @fontsource/ibm-plex-mono
- @tauri-apps/api
- @tauri-apps/plugin-dialog
- @tauri-apps/plugin-fs
- @tauri-apps/plugin-opener
- +10 more
app/src-tauri/Cargo.toml
cargo · 9- reqwest
- serde
- serde_json
- tauri
- tauri-plugin-dialog
- tauri-plugin-fs
- tauri-plugin-opener
- tauri-plugin-single-instance
- +1 more
extension/package.json
npm · 7- ws
- +6 more
conductors/the-conductor-v2/package.json
npm · 2- ws
- +1 more
conductors/the-conductor/package.json
npm · 2- ws
- +1 more
conductors/tiered-relevance/package.json
npm · 2- ws
- +1 more
conductors/attention-folder/package.json
npm · 1- ws
conductors/recency-folder/package.json
npm · 1- ws
conductors/thermocline/package.json
npm · 1- ws
Declared in the repository’s manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
Feature verification
Conductor architecture (conduct(view) -> Command[])Verified
A conductor reads every block and decides which should be folded, unfolded, or grouped via a clean synchronous interface conduct(view) -> Command[]
Claimed on Devposthigh confidenceconductors/contract/conductor.ts— Defines ConductorView, Command union, Conductor, ConductorHost contract typesconductors/builtin/builtin.ts— Reference implementation of the conductor interface, pinned by a golden test
Context Map grid view with kind-colored blocksVerified
Shows the entire context window at a glance as a grid of blocks colored by kind (user, response, thinking, tool call, tool result)
Claimed on readmehigh confidenceapp/src/lib/engine/types.ts— Block type defines kind: user/text/thinking/tool_call/tool_resultapp/src/app.css— Per-kind hex colors (--k-*) referenced in CLAUDE.md match the visual grammar table
Desktop app built with Tauri, SvelteKit, TypeScriptVerified
The desktop app is built with Tauri, SvelteKit, and TypeScript
Claimed on Devposthigh confidenceapp/src-tauri/src/lib.rs— Tauri Rust backend presentapp/src/routes— SvelteKit routes directory for the app UI
Family of interchangeable conductor strategiesVerified
Strategies range from simple oldest-first folding to an attention-probe scorer from a 500M parameter model; by the time of nine conductors each caught real failure modes
Claimed on Devposthigh confidenceconductors/sliding-window— Oldest-first/sliding-window baseline conductor directory existsconductors/attention-folder— Attention-probe based conductor directory with probe/ subfolderconductors/thermocline— Combines attention-probe scoring with grouping, per its READMEconductors— Repo contains 14 conductor directories (builtin, sliding-window, attention-folder, thermocline, keel, keel-v2, cold-epoch, cold-score, code-skeleton, garbage-collector, handoff, bear2-hybrid, tiered-relevance, compaction-naive)
Folded blocks replaced with tagged {#code FOLDED} digest, unfoldable by agentVerified
Folded blocks are replaced with tagged summaries containing a unique code; the agent can unfold them at any time to restore original content
Claimed on Devposthigh confidenceapp/src/lib/engine/digest.ts— Defines what a folded block collapses to, including the {#code FOLDED} tag formatextension/accordion.ts:1842— Registers an 'unfold' pi tool that lets the live agent restore folded context by code
Fully reversible folding (content substitution, not removal)Verified
Every fold is fully reversible; folding swaps content for a digest and unfolding restores it instantly
Claimed on Devposthigh confidenceapp/src/lib/live/mapping.ts— applyPlan(messages, ops) implements pure, reversible substitution of block content per fold op
Involvement locks (human-steering, agent-unfold, tail-size) with consent gate and detach kill switchVerified
A layered trust model: collaborative conductors users can override, exclusive conductors with an explicit consent gate, and a detach kill switch that always hands control back
Claimed on Devposthigh confidenceconductors/contract/conductor.ts:35— LockName type = human-steering | agent-unfold | tail-size, with LOCK_NAMES arrayapp/src/lib/ui/map/ConsentDialog.svelte— Consent gate UI component for exclusive conductorsapp/src/lib/engine/store.locks.test.ts— Dedicated test suite for lock enforcement in the store
Live WebSocket link to a running pi session with auto-discoveryVerified
A local WebSocket connection streams live context updates from the running agent to the UI in real time, with auto-discovery of sessions
Claimed on Devposthigh confidenceextension/accordion.ts— Implements the WS server side of the live pi extension hooking the context hookapp/src/lib/live/discovery.svelte.ts— Session discovery/polling on the app sideapp/src/lib/live/liveClient.svelte.ts— WS client connecting to a discovered session
LLM-generated summaries, computed once and cachedVerified
LLM-generated summaries, computed once and cached, listed under 'what works today'
Claimed on readmehigh confidenceconductors/keel/keel.ts:209— llmCache: Map<string,string> keyed by deep-region signature, populated once on completion resolve and reused on subsequent passes (documented cache-once behavior)conductors/keel/keel.ts:201— Comment block explicitly labels this the 'Phase 2: LLM deep-zone digest (async, fire-and-forget)' feature
npm package installable via pi installVerified
Install via pi install npm:@a-fig/accordion; restart pi then run /accordion
Claimed on readmehigh confidenceextension/package.json:2— Package name @a-fig/accordion matches the documented install command; files field lists accordion.js/dist/skills/README
Opt-in live steering of the agent's context (folding not applied to the live agent unless enabled)Verified
Folding is opt-in and off by default (folding.enabled, a header toggle); preview-only otherwise
Claimed on readmemedium confidenceapp/src/lib/live/folding.svelte.ts— Dedicated module for the folding-enabled toggle state gating whether plans are applied live
Protected working tail (~20k tokens, most recent context immune to folding)Verified
The most recent ~20k tokens are a protected working tail the agent reasons over at full fidelity
Claimed on readmehigh confidenceapp/src/lib/engine/store.svelte.ts:133— protectTokens defaults to 20_000 and protectedFromIndex walk-back logic gates fold()/auto-fold within the tail
Read-only browsing of saved Claude Code transcriptsVerified
Read-only browsing of saved Claude Code transcripts
Claimed on readmehigh confidenceapp/src-tauri/src/lib.rs:535— list_claude_sessions Rust commandapp/src-tauri/src/lib.rs:844— read_claude_session Rust command reads ~/.claude session filesapp/src/lib/live/claudeDiscovery.svelte.ts— Polling discovery wired to the CC tab in the app
Recall tool (read folded content without changing view)Verified
Agent can recall a folded block as a tool result (like read_file) without changing what's standing in context
Claimed on readmehigh confidenceextension/accordion.ts:1882— Registers a 'recall' tool explicitly described as an unblockable read of folded content, distinct from mutating unfold
Stable, deterministic fold-code hashing (stateless hash of block id)Verified
The {#code FOLDED} handle is derived as a stateless hash of the block's durable ID, requiring no stored state and surviving reconnects
Claimed on Devpostmedium confidenceapp/src/lib/engine/digest.ts— Digest module computes the folded-block tag; paired with digest.test.ts confirming deterministic output
Tool-call/result pairing safety (never fold a tool_call)Verified
Accordion never folds a tool call, only its result, and validates every context view before sending to the model
Claimed on Devposthigh confidenceapp/src/lib/live/mapping.ts:274— Comment and logic: an op targeting a tool_call part (or any non-foldable kind) is deliberately ignored/not appliedapp/src/lib/live/mapping.ts:312— Balanced-pairs logic ensures a removed tool_call also removes its tool_result
Thermocline conductor: attention-based relevance scoring via Qwen2.5-0.5B combined with LLM summaries and groupingCode-supported
Thermocline is the first conductor to combine attention-based relevance scoring with LLM summaries and block grouping
Claimed on Devpostmedium confidenceconductors/thermocline/README.md:3— Describes combining attention-folder's Qwen2.5-0.5B probe scoring with grouping/summary logicconductors/thermocline/scorer.mjs— Re-exports the attention-folder Qwen probe scorerconductors/thermocline/thermocline.mjs— Hosts the WebSocket conductor process implementing the folding policy
Agent-driven pinningClaimed only
Agent-driven pinning: the agent can pin blocks to protect them from future automated folding
Claimed on readmehigh confidenceNested/hierarchical folding for million-turn sessionsClaimed only
Hierarchical folding: fold the folds, for million-turn sessions, compressing to headlines openable to any depth
Claimed on readmehigh confidenceReplay (scrub context evolution across a session)Claimed only
Replay lets you scrub how the context evolved across a session, seeing exactly when something got folded and by whom
Claimed on readmehigh confidenceSlopCodeBench benchmark result (Thermocline 83.3% vs naive compaction 33.3%)Claimed only
Thermocline scored 83.3% on SlopCodeBench, 2.5x the 33.3% scored by naive compaction, both using deepseekV4Pro
Claimed on Devposthigh confidence
An AI agent derived these features from the project’s Devpost page and readme, then searched the code for each one. Verified features are backed by cited code; claimed-only features had no supporting code, which is not by itself proof a feature is missing.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.