How a-fig/accordion works
Accordion is a pi extension with a SvelteKit map UI: it parses or receives live agent context, presents it for inspection and steering, then applies reversible folds under shared rules. The extension owns live-session state and conductor execution; the UI mirrors that state and communicates through the live protocol. Conductors propose edits, while the shared engine enforces protection, locks, digests, and wire-safe updates. The README documents five strategies and browser/desktop, discovery, multi-session, and agent-recall capabilities. Some UI and live wiring is unsampled, so those links are included only where documented or indexed.
Main entry points: accordion.ts pi extension · contract.ts Conductor contract · registry.ts Conductor registry · liveHost.ts Conductor host
Components 25
Map and controls
- Context map
app/src/lib/ui/map/ContextMap.svelte - Reactive session store
app/src/lib/engine/store.svelte.ts - Session parsing
app/src/lib/session.svelte.ts - Live session UI
app/src/lib/live/registry.ts
Live extension
- pi extension
extension/accordion.ts - Conductor host
core/conductor/liveHost.ts - Live protocol
core/protocol.ts
Shared context engine
- Canonical context state
core/truth.ts - Message wire bridge
core/wire.ts - Edit operations
core/ops.ts - Fold digests
core/digest.ts - Involvement locks
core/locks.ts - Token estimation
core/tokens.ts
Conductor strategies
- Conductor registry
core/conductor/registry.ts - Conductor contract
core/conductor/contract.ts - Aged summary strategy
conductors/in-process/agedSummaryConductor.ts - Naive compaction
conductors/in-process/compaction-naive/compaction-naive.ts - Handoff strategy
conductors/in-process/handoff/handoff.ts - Doorman strategy
conductors/in-process/doorman/doorman.ts - Thermocline strategy
conductors/ws/thermocline/thermocline.ts - Thermocline policy
conductors/ws/thermocline/policy.ts - Triptych strategy
conductors/ws/triptych/triptych.ts
Other components
- User / agent operator
- pi session
- Completion model
Connections 30
- User / agent operator → Context map: steers context
README.md - Context map → Reactive session store: reads and edits
app/src/lib/ui/map/ContextMap.svelte - Session parsing → Reactive session store: loads session
app/src/lib/session.svelte.ts - pi session → pi extension: provides session
README.md - pi extension → Canonical context state: maintains state
extension/accordion.ts - pi extension → Message wire bridge: maps messages
extension/accordion.ts - pi extension → Live protocol: serves clients
extension/accordion.ts - pi extension → Conductor registry: registers strategies
extension/accordion.ts - pi extension → Conductor host: hosts strategies
extension/accordion.ts - Conductor host → Canonical context state: reads and writes
core/conductor/liveHost.ts - Conductor host → Conductor contract: implements
core/conductor/liveHost.ts - Conductor host → Completion model: requests completion
- Context map → Live session UI: reads steering status
app/src/lib/ui/map/ContextMap.svelte - Conductor registry → Conductor contract: uses interface
core/conductor/registry.ts - Naive compaction → Aged summary strategy: reuses strategy base
conductors/in-process/compaction-naive/compaction-naive.ts - Handoff strategy → Aged summary strategy: reuses strategy base
conductors/in-process/handoff/handoff.ts - Thermocline strategy → Thermocline policy: uses policy
conductors/ws/thermocline/thermocline.ts - Aged summary strategy → Conductor contract: implements strategy
conductors/in-process/agedSummaryConductor.ts - Thermocline strategy → Conductor contract: implements strategy
conductors/ws/thermocline/thermocline.ts - Triptych strategy → Conductor contract: implements strategy
- Doorman strategy → Conductor contract: implements strategy
- Canonical context state → Edit operations: applies edits
core/ops.ts - Canonical context state → Fold digests: derives folded content
core/truth.ts - Fold digests → Token estimation: estimates digest size
core/digest.ts - Live protocol → Edit operations: sanitizes edit requests
core/protocol.ts - pi extension → Live session UI: supports discovery and sessions
README.md - User / agent operator → pi extension: recalls folded context
README.md - Conductor registry → Doorman strategy: registers strategy
core/conductor/registry.ts - Conductor registry → Naive compaction: registers strategy
core/conductor/registry.ts - Conductor registry → Handoff strategy: registers strategy
core/conductor/registry.ts