omp packages

btw-enhanced1.1.1

omp extension: /btww — a multi-turn /btw. Ephemeral side conversation with follow-up questions, without polluting the main session context.

tamdan Published 2 months ago MIT ~19 downloads/mo

Built for omp

The author tagged this package oh-my-pi.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

btw-enhanced

An oh-my-pi (omp) extension that upgrades the built-in /btw side-question into a multi-turn side conversation: /btww.

omp's /btw answers exactly one ephemeral question — there is no way to ask a follow-up; every /btw starts from scratch. /btww keeps a side thread in its own scrollable window: ask, read the streamed answer, then ask follow-ups that build on it. It runs on /btw's own engine (runEphemeralTurn), so answers are grounded in your full session context — including whatever the agent is writing right now — it shares the main session's prompt cache (~97–99.5% measured input cache-hit rate), and it never touches your main session history.

╭─ btww side thread · Σ ↓79.6k ↑36 · $0.05 ─────────────────────────────╮
  ❯ what is the secret word and what did the README say? one line       │
                                                                        │
  Secret word: glockenspiel; README said "smoke test dir".              █
  ⬢ claude-opus-4-8 · ↓39.8k (39.6k cached, →231 cache) ↑24 · 5.0s      █
                                                                        │
  ❯ spell that word backwards, just the result                          │
                                                                        │
  leipsnekcolg                                                          │
  ⬢ claude-opus-4-8 · ↓39.9k (39.6k cached, →292 cache) ↑12 · 4.6s      │
─────────────────────────────────────────────────────────────────────────
  ❯ ▏
  Enter ask · ↑↓ / ^U ^D scroll · Esc close · /btww copy · /btww clear
╰────────────────────────────────────────────────────────────────────────╯

Requirements

  • oh-my-pi 17.2.x (the extension is typechecked against the matching @oh-my-pi/* packages)
  • Any provider/model your omp session already uses — /btww follows the session model and credentials

Install

omp plugin install github:Dani-Sh/btw-enhanced

or from a local clone:

omp plugin link /path/to/btw-enhanced

or for one-off local development:

omp -e /path/to/btw-enhanced/src/index.ts

No runtime dependencies — the @oh-my-pi/* imports resolve against the omp binary's bundled modules.

Usage

/btww opens the side-conversation window: a bordered overlay with its own scrollback, completely separate from the main chat transcript. Type questions into its input line; answers stream in place. Esc closes the window — the thread (and any in-flight stream) survives.

Command Behavior
/btww / /btww show Open the side-conversation window.
/btww <question> Ask (opens the window); continues the current side thread.
/btww new [question] Reset the side thread; optionally ask immediately.
/btww clear Drop the side thread.
/btww copy Copy the last completed answer to the clipboard.
/btww stop Cancel the in-flight question.

Inside the window: Enter asks, ↑/↓ · Shift+↑/↓ · Ctrl+U/Ctrl+D (half page, when the input is empty) · PgUp/PgDn · Home/End scroll (with a scrollbar; the view follows the stream until you scroll up), Esc closes. Some terminals (e.g. macOS Terminal) consume plain PgUp/PgDn to scroll their own viewport — use Ctrl+U/Ctrl+D there. Questions submitted while an answer is streaming are queued and run in order. Subcommand names get argument autocompletion; a question that is exactly a subcommand word needs rephrasing.

How it works

  • The side conversation lives in its own window (a focused TUI overlay), so streaming never interleaves with or pushes around the main transcript.
  • It IS /btw's engine. The extension resolves the live AgentSession through AgentRegistry (a public SDK export, matched by session-manager identity) and calls the same public runEphemeralTurn the built-in /btw uses. Core builds the request: the session's system prompt, the full history including any reply the main agent is streaming right now, the normalized tool catalog, session metadata, and the main session's own promptCacheKey.
  • True cache sharing, measured: the first side question of a thread read 39.6k of its 39.8k input tokens from the cache the main turn had just written — ↓39.8k (39.6k cached, →231 cache) · 5.0s · $0.0227. The only bytes ever written are the side prompt tail (a few hundred tokens).
  • Multi-turn on a single-shot API: runEphemeralTurn takes one prompt, so the retained side thread (last 12 completed Q/A pairs, replayed verbatim) rides inside it. The replay is the only uncached input of an ask — a deliberate fidelity-over-pennies tradeoff. Core injects its own no-tools reminder, so the template doesn't repeat it.
  • Per-turn statistics under each answer: model, tokens with cache read/write breakdown, output tokens, duration, and dollar cost — plus running totals in the window title.
  • The ephemeral turn never modifies the main session's history or persisted state, and the thread resets automatically on session switch/branch/tree navigation.

Why not extend /btw itself?

btw is a reserved built-in command name, and runEphemeralTurn is single-shot — it accepts one promptText and no side history. This extension reaches the same method through the public AgentRegistry SDK export and layers the side thread on top in the prompt.

Non-goals

  • Branch-promotion of a side answer into the main chat (the b key of built-in /btw) — the branch plumbing (branchFromBtw) is interactive-mode internal.

Development

bun install        # dev-time types only (@oh-my-pi/* at the omp version)
bun run typecheck

For AI readers

llms.txt is the machine-oriented index: engine details, contributor invariants, and verification steps.

License

MIT