An open API service indexing awesome lists of open source software.

https://github.com/a-Fig/Accordion

๐Ÿ† AI Hackathon 2026 @ UC Berkeley Intelligent context management for developers
https://github.com/a-Fig/Accordion

ai-agents context-window llm pi pi-coding-agent uc-berkeley-ai-hackathon

Last synced: about 7 hours ago
JSON representation

๐Ÿ† AI Hackathon 2026 @ UC Berkeley Intelligent context management for developers

Awesome Lists containing this project

README

          


Accordion

### /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.**

Accordion โ€” the context map demo: blocks folding and unfolding while the protected tail stays intact

Your whole context window split in 2 sections. The lower section represents your agents most recent context and is protected against any interference

---

Accordion is a [pi](https://github.com/earendil-works/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.

Accordion's context Map โ€” a live pi session rendered as a grid of colored blocks

## 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 whats 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](conductors/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).


Attention conductor view โ€” each block tinted by how much the working tail still attends back to it

Folded blocks are shown with dull colors

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](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

- [x] Core fold/unfold engine โ€” reversible, tool-pair safe
- [x] The separate window โ€” desktop app: Map view, budget, inspector
- [x] Live link to pi + auto-discovery, opt-in steering
- [x] Agent-driven unfold + `recall`, involvement locks
- [x] LLM-generated summaries, computed once and cached
- [x] 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)

```bash
pi install npm:@a-fig/accordion
```
restart pi if it is already running, then inside of pi run:
```bash
/accordion
```
That's it, assuming you have [pi](https://github.com/earendil-works/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/accordion`
> already registered the extension (the `/accordion` command, the `unfold`/`recall`
> tools, and the skills all come from the npm package). That same extension is what the
> local `extension/accordion.ts` builds into. **Adding `extension/accordion.ts` to
> `extensions` while the npm package is still installed loads it twice** โ€” a duplicate
> `/accordion` command, duplicate tool registration, and a duplicate context hook. Pick
> **one** of the two paths below; don't do both.

**Prerequisites:** install [Node 20 LTS](https://nodejs.org) and
[Rust via rustup](https://rustup.rs), 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.

```bash
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`:

```json
{ "extensions": ["/extension/accordion.ts"] }
```

The extension has its own runtime deps, so install them too:

```bash
cd accordion/extension && npm install
```

#### Run the app + live session

```bash
npm run tauri dev # opens the native window; hot-reloads on save
```

> `npm run tauri dev` is a Vite dev server for UI iteration. It is **not** what
> `/accordion` connects to โ€” `/accordion` always launches a built binary
> (`target/release/app`). To produce that binary, run
> `npm run tauri build -- --no-bundle`. Both `npm run dev` and `npm run tauri dev` want
> **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.

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.md)**.

## Contributing

An experiment in context engineering โ€” contributions, ideas, and benchmarks welcome.
Setup, the quality gate, and platform gotchas are in **[CONTRIBUTING.md](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. A conductor is a single class with one method โ€” `conduct(view) โ†’ Command[]` โ€” and
one registration line to appear in the app. 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

๐Ÿช—