EventController.handleEvent rebuilt the editor's status-line top border synchronously on every session event via updateEditorTopBorder(). During a long-running eval that fires 5-10 events/s, each rebuild ran StatusLine.getTopBorder → #buildSegmentContext → getCachedContextBreakdown → session.getContextUsage → estimateTokens (with JSON.stringify per toolCall block) — the render pipeline is throttled to ~30 fps, so most rebuilds were dropped before painting. Combined with a scheduler that collapsed cadenceDelay to zero whenever a frame overran the 33ms budget, the TUI busy-looped at ~40-50% CPU. Fix: - Editor gains setTopBorderProvider(): a lazy builder invoked once per editor render. InteractiveMode installs it in the constructor and on setEditorComponent, so the rebuild coalesces to the render tempo regardless of event rate. - Delete updateEditorTopBorder wrapper (now equivalent to ui.requestRender) and inline every call site. - Add adaptive render backpressure: a frame that exceeds MIN_RENDER_INTERVAL_MS inflates the next scheduling delay to 2 * last_frame_cost, capped at 200 ms, targeting a 50% render duty cycle instead of pinning the CPU at t=0. New regression tests: - editor-top-border-provider.test.ts: provider fires exactly once per render, wins over eager setTopBorder, falls back when cleared, gets the correct availableWidth. - adaptive-render-backpressure.test.ts: cheap frames keep the 33 ms cadence, a slow frame idles proportionally, pathological frames are capped at 200 ms. Verified with bun test packages/tui/test (all 246 relevant tests pass) and bun test packages/coding-agent/test/modes (455 tests pass). Three pre-existing agent-session-handoff snapcompact failures on main are unrelated (snapcompactSupportedChars binding). Fixes #4145
@oh-my-pi/pi-coding-agent
Core implementation package for the omp coding agent in the oh-my-pi monorepo.
For installation, setup, provider configuration, model roles, slash commands, and full CLI reference, see:
Package-specific references:
Memory backends
The agent supports three mutually-exclusive memory backends, selected via the memory.backend setting (Settings → Memory tab, or ~/.omp/config.yml):
off(default) — no memory subsystem runs.local— existing rollout-summarisation pipeline; writesmemory_summary.mdand consolidated artifacts under the agent dir.hindsight— talks to a Hindsight server (Cloud or self-hosted Docker), retains transcripts every Nth user turn, recalls memories on the first turn of a session, and exposesretain,recall, andreflect.
Hindsight quickstart
- Run a Hindsight server (Cloud or
docker run -p 8888:8888 ghcr.io/vectorize-io/hindsight:latest). - Set
memory.backend = "hindsight"andhindsight.apiUrl = "http://localhost:8888"(or your Cloud URL). - Optional environment overrides (env wins over settings):
HINDSIGHT_API_URL,HINDSIGHT_API_TOKEN— connectionHINDSIGHT_BANK_ID,HINDSIGHT_DYNAMIC_BANK_ID,HINDSIGHT_AGENT_NAME— bank addressingHINDSIGHT_AUTO_RECALL,HINDSIGHT_AUTO_RETAIN,HINDSIGHT_RETAIN_MODE— lifecycleHINDSIGHT_RECALL_BUDGET,HINDSIGHT_RECALL_MAX_TOKENS— recall sizingHINDSIGHT_BANK_MISSION,HINDSIGHT_DEBUG
Switching backends mid-session is honoured on the next system-prompt rebuild and the next /memory slash command. Existing users with memories.enabled = true|false are migrated to memory.backend = "local"|"off" exactly once on first launch.