@twoergosum/cogito
v0.1.0
Published
Cogito — an ErgoSum-aware TUI chat shell. Owns the chrome, routes Anthropic traffic through the ErgoSum proxy.
Maintainers
Readme
cogito
Cogito, ergo sum. An ErgoSum-aware TUI chat shell.
Cogito is a terminal chat client that wraps Anthropic's Claude (via the official claude CLI or the @anthropic-ai/sdk) and routes every request through the ErgoSum context proxy. It owns the input box, slash commands, status bar, and transcript styling — model output streams through unchanged.
It is not a harness: when used in claude-cli backend mode, cogito spawns the real Claude Code binary in headless streaming mode, so traffic genuinely originates from Claude Code and Anthropic's third-party OAuth-token restrictions don't apply.
╭─────────────────────────────────────────────────────────────────────────────╮
│ cogito Pro ∴ ergo sum proxy ● inject :49200 • via claude-cli → opus │
│ turns 3 tok in/out 4.2k/812 last 1.4s inject trim 1 · 4 sect │
│ related Trim · Stack · Database · CLI Package · API & Server · +8 ^p │
╰─────────────────────────────────────────────────────────────────────────────╯
╭─╮
│∴│ Adding the version slot now reads from `package.json`...
╰─╯Install
npm install -g @twoergosum/cogitoYou'll also want:
- ergosum-cli —
npm i -g ergosum-cli. Cogito will auto-startergosum proxyon launch. - One of the two Anthropic backends:
- Claude Pro/Max users: install Anthropic's
claudeCLI and runclaude login. - API users: export
ANTHROPIC_API_KEY=sk-....
- Claude Pro/Max users: install Anthropic's
Run
cogito # interactive TUI
cogito --check # print backend + proxy state, no UI
cogito --versionBackend is auto-detected at startup: ANTHROPIC_API_KEY → anthropic-api; else claude on PATH → claude-cli. Switch at runtime with /backend.
Slash commands
| Command | What it does |
|---|---|
| /help | Show all commands |
| /quit · /exit | Exit cogito |
| /clear | Clear conversation history |
| /compact [N] | Drop older turns, keep last N (default 4) |
| /cost | Estimated session cost (Opus pricing) |
| /status | Backend + proxy + session state |
| /model [name] | View or switch model |
| /backend <claude-cli\|anthropic-api> | Switch backend |
| /proxy <on\|off\|pause\|resume\|status> | Manage ErgoSum proxy |
| /inject · /smart | Switch proxy mode |
| /pages | List workspace pages |
| /grab <slug> | Attach a page to your next message |
| /search <query> | Semantic search across the workspace |
| /init · /login · /memory | Pass-through to the ergosum CLI |
| /resume [id\|prefix\|#] | Open the session picker, or resume by id directly |
Keybindings
| Key | Action |
|---|---|
| Enter | Send message |
| / | Open slash palette (↑/↓ navigate, Tab/Enter pick, Esc dismiss) |
| ↑/↓ (or mouse wheel) | Scroll transcript by 1 |
| PgUp / PgDn (or Shift+↑/↓) | Scroll by page |
| g / G | Jump to top / bottom |
| Ctrl+P | Toggle the workspace pages panel |
| Ctrl+C | Quit |
Architecture
┌──────────────────┐ ┌────────────────────┐
│ Cogito │───▶│ Backend (CLI/API) │──▶ Anthropic
│ (Ink TUI shell) │ └────────────────────┘
└────┬─────────────┘ ▲
│ reads / shells out │ via http://localhost:49200
▼ │ (api backend only)
ergosum proxy ─────────────────┘
(state @ ~/.config/ergosum/, logs @ /tmp/ergosum-proxy.log)- Status bar: polls the proxy's well-known PID + pause files every 2s and tails the proxy log for
trimmed N · retrieved M sectionsevents. - Related pages: scored client-side by keyword overlap between page titles and the last 6 messages, tie-broken by
updated_atrecency. - Resume: reads
~/.claude/projects/<encoded-cwd>/<session-id>.jsonl, extracts user/assistant + tool-call/tool-result blocks, and hands the session id back toclaude --resume. - Alt-screen mode: cogito takes over the terminal so streaming re-renders never disturb scrollback. Released cleanly on exit.
What cogito doesn't do
- No agent loop / tool implementation. When you use
claude-cli, tools are Claude Code's own. Theanthropic-apibackend is text-only in v1. - No proprietary ErgoSum logic. Cogito only reads the proxy's public on-disk state and the
ergosumCLI / API surface. Trim, inject, and retrieval algorithms live in the ErgoSum server.
Development
npm install
npm run build
node dist/index.js