📈 GH Trending Explorer 🎲 Surprise me

← all repos

jonaslsaa / pi-optchat

git clone https://github.com/jonaslsaa/pi-optchat.git v0.8.9 · 2d ago

Persistent infinite memory with profiles, background agents, and conversation imports for Pi.

+2
stars, 24h · #5,720
+~14
stars, 7 days · #6,462
+304
stars, 30 days · #1,685
307
★ total · +5% this week
28
forks · 11 open issues

Star history (as recorded here)

2026-10-20 · 302 ★ 2026-10-22 · 307 ★
LanguageTypeScript
License—
Created2026-10-04 (17d ago)
Last push2d ago
Watchers0
OwnerUser

GitHub topics

Links

README excerpt
# pi-optchat
A Pi extension that gives you one endless chat per profile, remembered through a summary tree instead of compaction. It implements Victor Taelin's OptChat recipe.
- **Memory**: every message is kept, and each turn starts from a fresh context holding a bounded view of everything so far.
- **Profiles**: separate memories and instructions, such as `work` and `personal`.
- **Subagents**: delegate tasks to background agents, watch them live, and send them guidance.
- **Import**: bring in history from Claude Code (conversations and memories), Codex, Pi and OMP, or ChatGPT.
- **Connected windows**: a second Pi window on the same profile becomes a subagent you talk to directly, or opens an existing background subagent.
It runs inside ordinary Pi, with no fork or separate launcher.
## Install
 [code] 
Or from GitHub: `pi install git:github.com/jonaslsaa/pi-optchat`.
Requirements: Pi 1.0.2 or compatible, Node.js 22.19+, and Git. Tested on macOS; the offline tests also run on Linux and Windows.
Web access is not bundled. Subagents load the Pi extensions you have installed (except pi-optchat itself), so installing `pi-web-access` gives web tools to the main agent and every subagent.
To uninstall, run `pi remove git:github.com/jonaslsaa/pi-optchat`. Profile data is kept.
## Quick start
1. Restart Pi.
2. Choose **+ Create profile** and name it, for example `work`.
3. Chat normally.
The footer shows the active profile. Memory follows the profile across directories and Pi sessions. New sessions show the profile picker with the last-used profile first; resumed sessions restore their profile.
### Headless and RPC
- `pi -p`, `--mode rpc` and other extensions' runners need `--optchat-profile work`. Without it (and without a saved profile in a resumed session) the run is plain Pi with no OptChat memory.
- In hosts that create sessions themselves (Pi Web), send `/optchat profile work` as the first message of a new session.
- If the profile is open in another Pi, `pi -p` joins it as a connected window by default; `--optchat-connect auto|join|off` controls this.
Details, errors and join rules: docs/connected-windows.md.
## How it works
- Every message is logged and becomes one line: a short one (up to 512 bytes) word for word, a longer one summarized by the compactor model to about 512 bytes (up to 640 with the default Summary size tolerance).
- Pairs of lines merge into a binary tree of summaries: recent lines cover one message each, older lines cover more.
- Each turn starts from a fresh context: the memory view (the tree's lines, up to 128,000 bytes), your previous exchange, and your new message.
- When the view passes 128,000 bytes, lines merge in one batch down to 64,000, so between merges it only grows at the end and each turn reads the last one's view from the cache.
- The agent reads originals with `zoom` (open a line into the two it was made from, or a message in full) and `date`.
Victor's recipe explains the design; How it differs from the recipe