Skip to main content

Optchat

@magistr/optchatv2026.10.25.10· MIT· 1d agoBEHAVIORSSKILLS
01README

One chat that never ends — Victor Taelin's OptChat / UniiChat design as a swamp model. Every message is logged word for word in an append-only chat directory. A cheap model compresses the log into a binary tree of 512-byte lines; each turn sees the view — lines covering the whole chat, fine when recent and coarse when old, 64-128 KB — and zooms into a line when it needs more. The view's merge order is Taelin's rollback push (a binary counter), generalised by the due rule and batched so the prompt prefix stays cached. Turns and compactions run through the local claude -p (Claude Code subscription, no API key); zoom and date reach the agent over a bundled stdio MCP server.

Methods:

  • turn — answer a user message with the view, log replies, tool calls and results, then compact
  • compact — build every ready tree node, up to 8 model calls at once (ruler, retries)
  • append — log notes, subagent reports or user messages without a model call
  • view — render the view the next turn will see
  • zoom — open a line into its two halves, or a message whole
  • status — chat size, tree progress, view bytes and lines per level

Ships the optchat skill.

02Release Notes

2026.10.25.10

  • Repo-wide republish; no functional change.
03Behaviors1
@magistr/optchatv2026.10.25.10extensions/models/optchat.ts

Global Arguments

ArgumentTypeDescription
chatDirstringDirectory holding the chat (main/, tree/, view.json). Created if missing. A leading ~/ means $HOME.
agentName?stringThe agent's name in the system prompt; its replies are logged with this name, lowercased, as their kind.
userInstructions?stringWho the user is, how their files are organized, how they want work done. Appended to the system prompt.
turnModel?stringModel for turns (a claude --model value).
turnEffort?stringEffort for turns (low, medium, high, xhigh, max); empty leaves the CLI default.
compactModel?stringCheap model for compactions.
compactEffort?stringEffort for compactions; empty leaves the CLI default.
turnTools?arrayBuilt-in Claude Code tools the agent may use for the user's tasks (zoom and date are always on). Add Bash, Write, Edit to let it change things.
workDir?stringWorking directory for turns; empty means chatDir.
concurrency?numberCompactions run at once.
viewHighBytes?numberA batch merge starts once the view passes this.
viewLowBytes?numberA batch merges the view down to this.
compactHighBytes?numberThe compaction view is merged again once it passes this.
compactLowBytes?numberThe compaction view is merged down to this.
turnTimeoutSeconds?number
compactTimeoutSeconds?number
lockStaleMinutes?numberA chat lock older than this is taken over.
claudeBin?string
denoBin?stringDeno binary that runs the zoom/date MCP server during turns.
fn status()
Report the chat's size, tree and view (read only).
fn append(text: string, kind?: enum)
Log text as messages without a model call: notes imported from before the chat (kind note), a subagent report (work), or a user message to answer later.
ArgumentTypeDescription
textstringThe text to log, whole.
kind?enum
fn compact(maxCalls?: number)
Build every ready tree node with the compaction model, up to `concurrency` at once. Idempotent: built nodes are never rebuilt; failed ones are retried on the next run.
ArgumentTypeDescription
maxCalls?numberStop starting model calls after this many.
fn turn(message: string, compactAfter?: boolean)
Answer one user message: summarize every earlier message, call the turn model with the view and the message in a fresh conversation (zoom and date served over MCP), log each reply, tool call and result, then compact.
ArgumentTypeDescription
messagestringThe user's new message.
compactAfter?booleanCompact the turn's own messages afterwards, so the next turn starts at once.
fn view()
Render the view as the next turn would see it (read only).
fn zoom(id: number, n?: number)
Open line id+n into the two lines under it, or message id whole when n = 1 (read only).
ArgumentTypeDescription
idnumber
n?number

Resources

status(infinite)— Chat size, built and pending tree nodes, and the view's lines, bytes and lines per level.
append(infinite)— Messages logged by an append, without a model call.
compaction(infinite)— One compaction run: nodes built, model calls made, failures and nodes still pending.
turn(infinite)— One turn: the user's message, the agent's final reply, the ids logged, tool calls, cost and usage, and the compactions around it.
view(infinite)— The view as the next turn would see it, inside <chat> tags.
zoom(infinite)— A zoom into one line: its two halves, or the message whole when n = 1.
04Skills1
optchat1 file
05Previous Versions9
2026.10.15.9MIT

2026.10.15.9

Changed

  • Repo-wide maintenance release: version bump to republish the current source. No schema change.
2026.10.15.8MIT

2026.10.15.8

Changed

  • Repo-wide maintenance release: version bump to republish the current source. No schema change.
2026.10.15.6MIT

2026.10.15.6

Changed

  • Repo-wide maintenance release: version bump to republish the current source. No schema change.
2026.10.15.5MIT

2026.10.15.5

Changed

  • Repo-wide maintenance release: version bump to republish the current source. No schema change.
2026.10.15.4MIT

2026.10.15.4

Changed

  • Repo-wide maintenance release: version bump to republish the current source. No schema change.
2026.10.15.3MIT

2026.10.15.3

Changed

  • Repo-wide maintenance release: version bump to republish the current source. No schema change.
2026.10.15.2MIT

2026.10.15.2

Changed

  • Repo-wide maintenance release: version bump to republish the current source. No schema change.
2026.10.15.1MIT

2026.10.15.1

Changed

  • Repo-wide maintenance release: version bump to republish the current source. No schema change.
2026.10.08.1MIT

2026.10.08.1

Added

  • First release: Taelin's OptChat / UniiChat never-ending chat as a swamp model. Append-only chat directory, 512-byte summary tree, push-ordered view batched 128 KB → 64 KB, compaction view 16-32 KB, ruler + "Too long" retries in the same conversation, up to 8 compactions at once from work queues.
  • Methods turn, compact, append, view, zoom, status.
  • Turns and compactions through claude -p stream-json; zoom and date served to the agent by a bundled stdio MCP server.
  • Ships the optchat skill.
06Stats
A
100 / 100
Downloads
15
Archive size
43.3 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Docs keep secrets in a vault1/1earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License2/2earned
  • Verified public repository2/2earned
07Platforms
08Labels