{"id":51267227,"url":"https://github.com/a-Fig/Accordion","last_synced_at":"2026-07-01T01:00:44.532Z","repository":{"id":366224181,"uuid":"1275508434","full_name":"a-Fig/Accordion","owner":"a-Fig","description":"🏆 AI Hackathon 2026 @ UC Berkeley  Intelligent context management for developers","archived":false,"fork":false,"pushed_at":"2026-06-24T07:28:31.000Z","size":36430,"stargazers_count":2,"open_issues_count":12,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-24T08:26:03.573Z","etag":null,"topics":["ai-agents","context-window","llm","pi","pi-coding-agent","uc-berkeley-ai-hackathon"],"latest_commit_sha":null,"homepage":"https://get-accordion.dev","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/a-Fig.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-06-20T19:31:53.000Z","updated_at":"2026-06-24T07:12:27.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/a-Fig/Accordion","commit_stats":null,"previous_names":["a-fig/accordion-ai-hackberkeley","a-fig/accordion"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/a-Fig/Accordion","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-Fig%2FAccordion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-Fig%2FAccordion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-Fig%2FAccordion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-Fig%2FAccordion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/a-Fig","download_url":"https://codeload.github.com/a-Fig/Accordion/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-Fig%2FAccordion/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34988714,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-30T02:00:05.919Z","response_time":92,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-agents","context-window","llm","pi","pi-coding-agent","uc-berkeley-ai-hackathon"],"created_at":"2026-06-29T16:00:20.026Z","updated_at":"2026-07-01T01:00:44.523Z","avatar_url":"https://github.com/a-Fig.png","language":"TypeScript","funding_links":[],"categories":["Miscellaneous","🛠️ Tools \u0026 Projects"],"sub_categories":["Memory \u0026 Compression"],"readme":"\n\u003cdiv align=\"center\"\u003e\n\n\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"docs/assets/logo-lockup-white.png\"\u003e\n  \u003cimg alt=\"Accordion\" src=\"docs/assets/logo-lockup-black.png\" width=\"440\"\u003e\n\u003c/picture\u003e\n\n### /compact is the naive solution, Accordion is the intelligent one.\n\n**See everything your AI agent holds in context — and fold it like an accordion instead.**\n\n\u003cimg src=\"docs/assets/accordion-hero.gif\" alt=\"Accordion — the context map demo: blocks folding and unfolding while the protected tail stays intact\" width=\"820\"\u003e\n\n\u003csub\u003eYour whole context window split in 2 sections. The lower section represents your agents most recent context and is protected against any interference\u003c/sub\u003e\n\u003c/div\u003e\n\n---\n\nAccordion is a [pi](https://github.com/earendil-works/pi) extension that shows you\nyour agent's entire context window at a glance and lets you manage it manually or with intelligence through a conductor.\n\n\u003cdiv align=\"center\"\u003e\n\n\u003ca href=\"docs/assets/accordion-demo.mp4\"\u003e\u003cimg src=\"docs/assets/map-hero.png\" alt=\"Accordion's context Map — a live pi session rendered as a grid of colored blocks\" width=\"860\"\u003e\u003c/a\u003e\n\n\u003c/div\u003e\n\n## Why it's different\n\n#### 1. No blocking calls for compaction \n\u003e your context window is automatically managed for you in the background, keeping you below your limit\n\n#### 2. longer more useful sessions\n\u003e The relevance of each block is ranked so we only fold bloat, and keep whats important. \n\n#### 3. Cheaper inference costs\n\u003e Accordion keeps your context window lean, with cache optimizations in mind.\n\nEvery long-running agent hits the same wall: the context fills up, and something has to\ngo. Today's answers are dumb and dumber:\n\n- **Compaction** blasts your whole history into one lossy summary — slow, destructive,\n  all-or-nothing.\n- **Sliding windows** just drop the oldest tokens — the agent simply forgets.\n\n| | Sliding window | `/compact` | skills \u0026 memory | 🪗 Accordion |\n|---|:---:|:---:|:---:|:---:|\n| Keeps old context usable | ❌ | ⚠️ lossy | ⚠️ if retrieved | ✅ |\n| **Reversible** to full detail | ❌ | ❌ | ❌ | ✅ |\n| No mid-task stall | ✅ | ❌ | ✅ | ✅ |\n| Per-section, not all-or-nothing | ❌ | ❌ | ⚠️ | ✅ |\n| You can see and steer it | ❌ | ❌ | ❌ | ✅ |\n| No extra infra (no vector DB) | ✅ | ✅ | ❌ | ✅ |\n\n## The proof — early, but pointed\n\nAccordion ships with a catalog of interchangeable **Conductors**. The strongest so far,\n**[Thermocline](conductors/thermocline/)**, scores each block relevance to the most recent context using the attention from a 500M parameter model as a proxy.\n\nIn a test run on **SlopCodeBench** (a long-horizon coding benchmark), Thermocline at a\n100k-token budget outperformed naive compaction with the same constrained context budget. Both used deepseekV4Pro.\n\n| Conductor | Context Budget | Score | Checkpoints reached |\n|---|:---:|:---:|:---:|\n| **Thermocline** | 100k | **83.3%** | 5 / 6 |\n| naive compaction | 100k | 33.3% | 2 / 6 |\n\n\u003e ⚠️ **Read this as a signal, not a guarantee.** It's a single hackathon-scale run on a\n\u003e subset of the problems — not a published benchmark. Broader, repeatable evaluation is on the roadmap.\n\n## How it works\n\nThe **context Map** is the whole window at a glance: one square per block, sized by token\nweight (a dice face, 1–6), colored by kind — **user** messages, **assistant** responses,\n**thinking**, **tool calls**, and **tool results** each get their own hue. Bright = live;\nrecessed and hatched = folded.\n\nThree hands share those controls:\n\n- **You** — fold, unfold, pin, and peek by hand. Your overrides always win.\n- **The agent** — reaches back to unfold or pin context it needs mid-task, or **recall**\n  a folded block as a tool result (like `read_file`) without changing what's standing in\n  context.\n- **The Conductor** — an automatic strategy that, between turns, folds what's gone cold\n  and unfolds what's becoming relevant. Collaborative by default; an *exclusive*\n  conductor you approve can take over specific controls, and **detach** is always your\n  kill switch.\n\nEvery block is **Full**, **Folded** (shown as a short tagged summary), or **Pinned**\n(locked open).\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"docs/assets/attention-conductor.png\" alt=\"Attention conductor view — each block tinted by how much the working tail still attends back to it\" width=\"600\"\u003e\n\u003cbr\u003e\u003csub\u003eFolded blocks are shown with dull colors \u003c/sub\u003e\n\u003c/div\u003e\n\nFolds nest: cold turns fold into groups, groups into bigger groups, so a session of\nthousands of turns stays small enough to fit and complete enough to recover. And the\nrecent past is always safe — the most recent ~20k tokens are a protected working tail the\nagent reasons over at full fidelity (the thick-bordered box below the fold line).\n\n→ Capability matrix, full walkthrough, and the deep spec: **[VISION.md](VISION.md)**\n\n## What works today\n\n- ✅ Desktop app (Tauri + SvelteKit): the Map view, token budget, inspector, protected\n  working tail.\n- ✅ Live link to a running pi session, with auto-discovery.\n- ✅ Opt-in live steering — apply your fold plan to what the agent is shown.\n- ✅ Reversible, provider-safe folding with deterministic `{#code FOLDED}` digests the\n  agent can ask to unfold.\n- ✅ Involvement locks — exclusive conductors, the consent gate, freeze-on-detach, and\n  agent `recall`.\n- ✅ The Conductor — automatic fold/unfold between turns, based on context.\n- ✅ LLM-generated summaries, computed once and cached.\n- ✅ Read-only browsing of saved Claude Code transcripts.\n\nHonest about what's **not** there yet: no agent-driven pinning, no hierarchical (nested)\ngroups, no replay. That's the build ahead.\n\n## Roadmap\n\n- [x] Core fold/unfold engine — reversible, tool-pair safe\n- [x] The separate window — desktop app: Map view, budget, inspector\n- [x] Live link to pi + auto-discovery, opt-in steering\n- [x] Agent-driven unfold + `recall`, involvement locks\n- [x] LLM-generated summaries, computed once and cached\n- [x] The Conductor — automatic fold/unfold between turns\n- [ ] Hierarchical folding for million-turn sessions\n- [ ] Agent-driven pin\n- [ ] Replay — scrub how context evolved across a session\n- [ ] Better conductors — research, develop, and test stronger context strategies\n- [ ] Expand accordion beyond pi\n\n## Quick start\n\n### Part 1 — Browser (no Rust, no desktop app)\n\n```bash\npi install npm:@a-fig/accordion\n```\nrestart pi if it is already running, then inside of pi run:                                      \n ```bash\n    /accordion                                                                       \n ```\nThat's it, assuming you have [pi](https://github.com/earendil-works/pi)\n\n---\n\n### Part 2 — Desktop app (Optional - full feature set)\n\nThe desktop app adds **multi-session discovery** (switch between running pi sessions from\na sidebar), conductors that require local model resources, and the `/accordion` command\nthat foregrounds the right session automatically. It requires Node 20+ and Rust.\n\n\u003e **Don't double-register the extension.** Part 1's `pi install npm:@a-fig/accordion`\n\u003e already registered the extension (the `/accordion` command, the `unfold`/`recall`\n\u003e tools, and the skills all come from the npm package). That same extension is what the\n\u003e local `extension/accordion.ts` builds into. **Adding `extension/accordion.ts` to\n\u003e `extensions` while the npm package is still installed loads it twice** — a duplicate\n\u003e `/accordion` command, duplicate tool registration, and a duplicate context hook. Pick\n\u003e **one** of the two paths below; don't do both.\n\n**Prerequisites:** install [Node 20 LTS](https://nodejs.org) and\n[Rust via rustup](https://rustup.rs), then follow the one-time platform setup at\n**https://v2.tauri.app/start/prerequisites/** (WebView2 + MSVC on Windows, Xcode CLT on\nmacOS).\n\n#### Path A — Place a built binary (recommended; keeps the npm package)\n\n`/accordion` launches a **pre-built binary** from disk — it does not connect to a dev\nserver. So all you need is a built `app` binary in one of the locations the extension\nscans. If you already ran Part 1, this is the only step: no `settings.json` edit, no\nduplicate extension.\n\n```bash\ngit clone https://github.com/a-Fig/accordion.git\ncd accordion/app \u0026\u0026 npm install\nnpm run tauri build -- --no-bundle   # builds target/release/app(.exe); --no-bundle\n                                     # skips the slower MSI/NSIS/.dmg installers\n```\n\nThen drop the binary where the extension looks for an installed bundle:\n\n| OS | Path |\n|---|---|\n| **Windows** | `%LOCALAPPDATA%\\Programs\\Accordion\\Accordion.exe` |\n| **macOS** | `/Applications/Accordion.app` |\n| **Linux** | `~/.local/share/Accordion/accordion` |\n\n(Without an installed bundle, `/accordion` falls back to the repo build outputs\n`app/src-tauri/target/release/app` then `…/debug/app`.) Run `/accordion` in any pi\nsession and it launches (or focuses, via single-instance) the desktop app on that session.\n\n#### Path B — Register the local extension (for extension development)\n\nOnly choose this if you'll edit the extension itself. Remove the npm package first, then\npoint pi at your checkout instead. From `~/.pi/agent/settings.json`, drop\n`\"npm:@a-fig/accordion\"` from `packages` and add to `extensions`:\n\n```json\n{ \"extensions\": [\"\u003cabsolute-path-to-repo\u003e/extension/accordion.ts\"] }\n```\n\nThe extension has its own runtime deps, so install them too:\n\n```bash\ncd accordion/extension \u0026\u0026 npm install\n```\n\n#### Run the app + live session\n\n```bash\nnpm run tauri dev   # opens the native window; hot-reloads on save\n```\n\n\u003e `npm run tauri dev` is a Vite dev server for UI iteration. It is **not** what\n\u003e `/accordion` connects to — `/accordion` always launches a built binary\n\u003e (`target/release/app`). To produce that binary, run\n\u003e `npm run tauri build -- --no-bundle`. Both `npm run dev` and `npm run tauri dev` want\n\u003e **port 1420**; run only one at a time.\n\nRun pi in any project. It advertises itself in `~/.accordion/sessions/` and appears in\nAccordion's **Sessions** sidebar within ~1s. Click it (or run `/accordion` in that\nterminal) and its context populates live. Folding is preview-only by default; use the\nheader's **Folding** toggle to opt in to steering the live agent's context.\n\nTo refresh the binary after `main` moves (close any open Accordion window first so the\nfile isn't locked, then `git pull`, `npm install`, and rebuild): see\n**[CONTRIBUTING.md](CONTRIBUTING.md)**.\n\n## Contributing\n\nAn experiment in context engineering — contributions, ideas, and benchmarks welcome.\nSetup, the quality gate, and platform gotchas are in **[CONTRIBUTING.md](CONTRIBUTING.md)**.\n\nOur main frontier right now is **better conductors**: researching which context actually\nmatters, developing stronger strategies, and testing them against real sessions. We're not\nchasing a long tail of mediocre ones — the goal is one to three conductors that genuinely\nhold up. A conductor is a single class with one method — `conduct(view) → Command[]` — and\none registration line to appear in the app. Strategies can range from simple oldest-first\nfolding to scoring each block's relevance with a small model. If you have a theory about\nwhat an agent should keep and what it can let go, that's the surface to prove it — and the\nplace where outside help is most valuable right now.\n\n---\n\n**The north star: your agent's memory should be something you can see and steer — not a\nblack box that silently forgets.**\n\n\u003cdiv align=\"center\"\u003e\n\n🏆 \u0026nbsp;Built at the **AI Hackathon 2026 @ UC Berkeley** — a winning project.\n\n\u003csub\u003eTyler Darisme \u0026nbsp;·\u0026nbsp; Aaditya Desai \u0026nbsp;·\u0026nbsp; Sheel Shah \u0026nbsp;·\u0026nbsp; Thy Tang\u003c/sub\u003e\n\n🪗\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa-Fig%2FAccordion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fa-Fig%2FAccordion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa-Fig%2FAccordion/lists"}