@a-fig/accordion 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -0
- package/package.json +35 -34
package/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/a-Fig/Accordion/main/docs/assets/logo-lockup-white.png">
|
|
5
|
+
<img alt="Accordion" src="https://raw.githubusercontent.com/a-Fig/Accordion/main/docs/assets/logo-lockup-black.png" width="440">
|
|
6
|
+
</picture>
|
|
7
|
+
|
|
8
|
+
### /compact is the naive solution. Accordion is the intelligent one.
|
|
9
|
+
|
|
10
|
+
**See everything your AI agent holds in context — and fold it like an accordion instead.**
|
|
11
|
+
|
|
12
|
+
<img src="https://raw.githubusercontent.com/a-Fig/Accordion/main/docs/assets/accordion-hero.gif" alt="Accordion — the context map demo: blocks folding and unfolding while the protected tail stays intact" width="820">
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
Accordion is a [pi](https://github.com/earendil-works/pi) extension that shows you your
|
|
19
|
+
agent's entire context window at a glance and lets you manage it — manually or with
|
|
20
|
+
intelligence through a **conductor**.
|
|
21
|
+
|
|
22
|
+
This package ships the **pi extension** (the live link that streams context and applies
|
|
23
|
+
your fold plan) plus a **browser-served UI**, so you can run Accordion with `pi install`
|
|
24
|
+
alone — no Rust, no desktop app required.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pi install npm:@a-fig/accordion
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
That adds the package to `~/.pi/agent/settings.json`. Restart pi, then in any project:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
/accordion
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The extension HTTP-serves the Accordion UI on a local ephemeral port and prints the URL
|
|
39
|
+
(also opens it). The page auto-connects to the running session. Folding is **off by
|
|
40
|
+
default** — flip the **Folding** toggle in the header to start steering what the agent
|
|
41
|
+
sees.
|
|
42
|
+
|
|
43
|
+
> **Single session, browser only.** This package serves the UI in your browser for the
|
|
44
|
+
> current pi session. For multi-session discovery, conductors that need local model
|
|
45
|
+
> resources, and the native window, build the
|
|
46
|
+
> [desktop app](https://github.com/a-Fig/Accordion) from source.
|
|
47
|
+
|
|
48
|
+
## How it works
|
|
49
|
+
|
|
50
|
+
The **context Map** is the whole window at a glance: one square per block, sized by token
|
|
51
|
+
weight (a dice face, 1–6), colored by kind — **user** messages, **assistant** responses,
|
|
52
|
+
**thinking**, **tool calls**, and **tool results** each get their own hue. Bright = live;
|
|
53
|
+
recessed and hatched = folded.
|
|
54
|
+
|
|
55
|
+
Three hands share the controls:
|
|
56
|
+
|
|
57
|
+
- **You** — fold, unfold, pin, and peek by hand. Your overrides always win.
|
|
58
|
+
- **The agent** — reaches back to unfold or pin context it needs mid-task, or **recall**
|
|
59
|
+
a folded block as a tool result (like `read_file`) without changing what's standing in
|
|
60
|
+
context.
|
|
61
|
+
- **The Conductor** — an automatic strategy that, between turns, folds what's gone cold
|
|
62
|
+
and unfolds what's becoming relevant. Collaborative by default; an *exclusive*
|
|
63
|
+
conductor you approve can take over specific controls, and **detach** is always your
|
|
64
|
+
kill switch.
|
|
65
|
+
|
|
66
|
+
Every block is **Full**, **Folded** (shown as a short tagged summary), or **Pinned**
|
|
67
|
+
(locked open). Folds are **content substitution, never removal** — provider-safe and
|
|
68
|
+
fully reversible. The most recent ~20k tokens are a **protected working tail** the agent
|
|
69
|
+
reasons over at full fidelity.
|
|
70
|
+
|
|
71
|
+
<div align="center">
|
|
72
|
+
<img src="https://raw.githubusercontent.com/a-Fig/Accordion/main/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">
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
## Skills included
|
|
76
|
+
|
|
77
|
+
This package registers two pi skills the agent uses to interact with folded context:
|
|
78
|
+
|
|
79
|
+
- **accordion-context-folding** — the `unfold` tool: restore a folded block into standing
|
|
80
|
+
context (sticky, attributed to the agent).
|
|
81
|
+
- **accordion-context-recall** — the `recall` tool: read a folded block's full content as
|
|
82
|
+
a tool result *without* mutating the view, like `read_file`. Never lockable.
|
|
83
|
+
|
|
84
|
+
## What works today
|
|
85
|
+
|
|
86
|
+
- ✅ Browser-served UI — no desktop app required
|
|
87
|
+
- ✅ Live link to a running pi session
|
|
88
|
+
- ✅ Opt-in live steering — apply your fold plan to what the agent is shown
|
|
89
|
+
- ✅ Reversible, provider-safe folding with deterministic `{#code FOLDED}` digests
|
|
90
|
+
- ✅ Agent-driven unfold + `recall`, involvement locks
|
|
91
|
+
- ✅ The Conductor — automatic fold/unfold between turns
|
|
92
|
+
- ✅ LLM-generated summaries, computed once and cached
|
|
93
|
+
|
|
94
|
+
## Links
|
|
95
|
+
|
|
96
|
+
- **Source & full docs:** [github.com/a-Fig/Accordion](https://github.com/a-Fig/Accordion)
|
|
97
|
+
- **Vision:** [VISION.md](https://github.com/a-Fig/Accordion/blob/main/VISION.md)
|
|
98
|
+
- **pi (the harness):** [github.com/earendil-works/pi](https://github.com/earendil-works/pi)
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
<div align="center">
|
|
103
|
+
|
|
104
|
+
🏆 Built at the **AI Hackathon 2026 @ UC Berkeley** — a winning project.
|
|
105
|
+
|
|
106
|
+
🪗
|
|
107
|
+
|
|
108
|
+
</div>
|
package/package.json
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@a-fig/accordion",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"description": "Accordion live link — a pi extension that streams context to the Accordion GUI and applies the fold plan the GUI returns.",
|
|
6
|
-
"keywords": ["pi-package"],
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build:extension": "node ./build-extension.mjs",
|
|
9
|
-
"build:client": "node ./build-client.mjs",
|
|
10
|
-
"build": "npm run build:client && npm run build:extension",
|
|
11
|
-
"smoke": "node smoke.mjs"
|
|
12
|
-
},
|
|
13
|
-
"pi": {
|
|
14
|
-
"extensions": ["./accordion.js"]
|
|
15
|
-
},
|
|
16
|
-
"files": [
|
|
17
|
-
"accordion.js",
|
|
18
|
-
"dist",
|
|
19
|
-
"skills"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"@earendil-works/pi-agent
|
|
27
|
-
"@earendil-works/pi-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@a-fig/accordion",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Accordion live link — a pi extension that streams context to the Accordion GUI and applies the fold plan the GUI returns.",
|
|
6
|
+
"keywords": ["pi-package"],
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build:extension": "node ./build-extension.mjs",
|
|
9
|
+
"build:client": "node ./build-client.mjs",
|
|
10
|
+
"build": "npm run build:client && npm run build:extension",
|
|
11
|
+
"smoke": "node smoke.mjs"
|
|
12
|
+
},
|
|
13
|
+
"pi": {
|
|
14
|
+
"extensions": ["./accordion.js"]
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"accordion.js",
|
|
18
|
+
"dist",
|
|
19
|
+
"skills",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"ws": "^8.18.0"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
27
|
+
"@earendil-works/pi-agent-core": "*",
|
|
28
|
+
"@earendil-works/pi-ai": "*",
|
|
29
|
+
"typebox": "*"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"esbuild": "^0.25.0",
|
|
33
|
+
"jiti": "^2.7.0"
|
|
34
|
+
}
|
|
35
|
+
}
|