Skip to content
Zachary BENSALEM edited this page Aug 15, 2026 · 1 revision

Lore

A narrative history of this codebase: what happened here and when. Dates are derived from git commit timestamps, tag creation dates, and file-creation history. Where the intent behind a change is not visible in the commits, the text hedges ("appears to have been").

Prime Agent is a self-improving RLM (Recursive Language Model) coding and research agent. The repository is a hard fork of PrimeIntellect-ai/prime-agent (originally badlogic's pi-mono by Mario Zechner) plus a standalone Qredence web UI under web/ that is not merged upstream. As of HEAD 94c724c1e (2026-08-15) there are 4556 commits on main, with the wire protocol at version 8 and schema revision 15.

Eras

1. pi-mono origins (upstream, before the fork)

The deepest layer of the history is inherited from badlogic's pi-mono by Mario Zechner. The bulk of commit authorship in the tree, roughly 3063 of 4556 commits, carries Zechner's name, and the @earendil-works package scope marks this upstream lineage. Early commits visible in this repo's log (dated August 2025) already show the distinctive concerns of that project:

  • 2025-08-10: reasoning-token support for OpenAI reasoning models, with "comprehensive reasoning token support across providers" following the same day.
  • 2025-08-11: the surgical differential-rendering TUI work (double buffering, a terminal abstraction, container change detection, scrollback preservation).
  • 2025-08-11: ESC-interrupt handling in the agent, and the /tokens command for cumulative token-usage tracking.
  • 2025-08-17: the ai package lands as a unified AI package supporting OpenAI, Anthropic, and Gemini.

These months form the foundation the fork later productized.

2. Monorepo setup and lockstep versioning (Aug 2025)

The monorepo as it exists today is scaffolded in the first commits, dated 2025-08-09:

  • 2025-08-09 a74c5da11: "Initial monorepo setup with npm workspaces and dual TypeScript configuration", the first commit.
  • Same day: fixes for npm publishing warnings, global CLI execution, and process.cwd() errors from deleted directories.
  • 2025-08-09: versions v0.5.3 and v0.5.4 introduced the lockstep versioning scheme ("Fix lockstep versioning and update all packages") that all packages still share today. Every package moves together; there are no independent package versions.

3. TUI, agent, and ai feature work (Aug-Oct 2025)

The early feature wave concentrated on the terminal experience and the model layer:

  • 2025-08-11: differential rendering for minimal redraws, initial-render on start(), instructional headers, and the welcome message in the chat demo.
  • 2025-08-11: biome formatting applied across the TUI; a husky pre-commit hook for formatting and type checking was added the same day.
  • 2025-08-17: the unified ai package with OpenAI, Anthropic, and Gemini providers.
  • 2025-08-24: OpenAI Completions and Responses API providers added.
  • 2025-10-17 ffc9be886: the coding-agent package appears, "Agent package + coding agent WIP, refactored web-ui prompts." This became the backend that the Qredence UI would later consume.

4. The RLM harness and runtime (May 2026)

Around May 2026 the recursive self-improvement machinery that gives the agent its "RLM" identity was added:

  • 2026-05-08: an IPython tool that runs Python in a persistent kernel; the prime-agent-runtime directory begins with the "rlm recursion bridge" the same day.
  • 2026-05-12: background RLM subagents.
  • 2026-05-15: the RLM background API is removed again, trimming that early experiment.
  • 2026-05-18: the R2 installer release flow lands, and the install.sh public installer appears, the start of the product's distribution story.

5. Daemon and protocol evolution (Jun-Aug 2026)

The daemon architecture, which separates the agent runtime from the interactive/terminal and web clients, was built out through June 2026 and consolidated in August:

  • 2026-06-03: the daemon session manager is added.
  • 2026-06-04: interactive mode is decoupled from the agent runtime; this is when the AgentConnection seam concept appears.
  • 2026-06-05: the daemon attach-snapshot reconnect flow and the swarm-reconnect protocol preparation land.
  • 2026-06-09: the daemon agents view and startup/streaming performance work.
  • 2026-06-10: subagents surfaced from daemon state with session restore on restart.
  • 2026-08-11: the protocol jumps to v8 (schema revision 15) to carry seedMessages on new_session, part of the InteractiveModeLocalSessionHost removal (see Major rewrites).

6. Qredence productization and the web workspace (Aug 2026)

The standalone Qredence web UI is the defining recent change. It arrived in a concentrated burst in mid-August 2026 and turned the fork into a two-surface product:

  • 2026-08-13: the web UI is isolated under a pnpm workspace (web/), with web/app (TanStack Start), web/design, web/protocol (chat-protocol.ts), and web/server (the prime-bridge.ts / event-mapper.ts adapter). The isolation commit is the first web commit.
  • 2026-08-13: the packages-vs-web split is documented.
  • 2026-08-13 through 2026-08-15: the OAuth sign-in flow, fork picker, kernel chip, favicons, slash catalog, and stream helpers are wired on the client, and OAuth types are added to the chat protocol.
  • 2026-08-15: prime-agent web, the packaged Qredence frontend and backend, and the repo-hosted public installer land (1afd96bda, PR #18).
  • 2026-08-15 57e3d5445 (HEAD): OpenUI chat artifacts are wired in, closing out the recorded history.

7. Web hardening wave and release-pipeline changes (Aug 2026)

Alongside the feature push, the web stack was hardened and the release tooling reworked:

  • 2026-08-11: React Doctor is integrated; doctor.config.jsonc records scoped waivers and false-positive notes (OpenUI library multi-component, co-located chart components, a false-positive preview-loading case), all dated 2026-08-11.
  • 2026-08-13: the chat is hardened against XSS, stale sessions, and accessibility gaps; an OpenUI error boundary is added.
  • The plans/ directory carries 12 improve-react hardening plans (numbered 001-012), all marked DONE, with React Doctor 0.9.5 at a baseline score of 100 against audit commit 89c8fb912. They cover chart color sanitization, settled-session reload gating, composer accessibility, streaming live-region throttling, settings focus restore, markdown hoisting, turn memo stabilization, SSE status reconnect, error surfacing, a markdown-link allowlist, the OpenUI error boundary, and stopping stream subscription when settings close.
  • 2026-08-14/15: the "Release Prime Agent" CI workflow (.github/workflows/build-binaries.yml, 412 lines) and scripts/build-binaries.sh are removed on the implementation/remove-release-ci branch (e67ccb2f0, merged 859871ada), presumably because the public installer and bundled web runtime made the standalone release workflow obsolete.

Longest-standing features

  • Differential-rendering TUI, the surgical, minimal-redraw terminal approach introduced 2025-08-11 has survived every refactor since and remains the interface model.
  • The AgentConnection seam concept, although formally named in June 2026, the idea of a narrow, portable seam between the agent runtime and its clients predates the daemon and was the design target of the June 2026 decoupling and the August 2026 InteractiveModeLocalSessionHost removal.
  • IPython as a built-in tool, the persistent-kernel Python tool added 2026-05-08 is still the recommended way to run shell and Python work in the agent.
  • JSONL session transcripts, session recording dates to 2026-01, with a transcript-analysis script following that same month.
  • Slash commands, the command surface goes back to August 2025 (/tokens) and remains central to the product today.

Deprecated features

  • InteractiveModeLocalSessionHost, introduced 2026-06-04 as a convenience backdoor exposing raw AgentSession, SessionManager, and ExtensionRunner to in-process terminal code. It was deleted 2026-08-11 per docs/adr/0001-kill-interactivemode-localsessionhost.md, which widened AgentConnection to close the gap. Every feature built through the host had silently become daemon-incompatible.
  • The interactive ! / !! bash shortcuts, removed in the coding-agent v0.0.10 release (2026-06-08) with the note "use IPython for shell commands." They were subsequently restored (2026-06-12) by running bash through the agent connection to regain streaming output, history, and Ctrl+C abort; so they are removed and then re-adopted, not a clean deprecation.
  • The "Release Prime Agent" CI workflow, removed 2026-08-14/15 on the implementation/remove-release-ci branch (see Eras, section 7).
  • The mom and pods packages, removed in a single commit 2026-04-30, part of trimming earlier working-memory/multi-agent experiments.
  • The interactive-mode easter eggs (/arminsayshi, /dementedelves, and the daxnuts auto-trigger for the opencode Kimi K2.5 model), removed 2026-08-15 as part of the public-release housekeeping, along with the orphaned exy.png mascot image (packages/coding-agent/docs/images/exy.png) and the internal planning docs (docs/superpowers/ and .react-doctor/).

Major rewrites

  • The web workspace addition (2026-08-13), adding web/ as a separate pnpm workspace with its own protocol, adapter, and app layer, deliberately kept out of the npm packages/ tree.
  • The InteractiveModeLocalSessionHost deletion (2026-08-11), a backwards-compatible seam widening on AgentConnection (extensions sub-interface, read-only SessionView, afterReplace hook) that killed a convenience backdoor rather than documenting it.
  • Protocol v7 to v8 with seedMessages (2026-08-11), seedMessages on new_session became wire-supported at protocol v8 / schema revision 15, negotiated as a daemon capability so v7 clients do not send the field.
  • The differential-rendering rewrite of the TUI (2025-08-11), replacing a full-redraw model with surgical, scrollback-preserving updates.
  • Decoupling interactive mode from the agent runtime (2026-06-04), the first step toward making the terminal a portable client of a daemon, later completed by the August seam removal.
  • Dev-only to bundled prime-agent web runtime (2026-08-15), moving the web surface from development-only code to a packaged frontend/backend launched by the installed prime-agent binary.

Growth trajectory

  • Packages: tui and agent exist from the initial monorepo commit (2025-08-09); ai is added 2025-08-17; coding-agent 2025-10-17.
  • prime-agent-runtime/ appears 2026-05-08; scripts/ and install.sh follow through May 2026; web/ lands 2026-08-13.
  • Contributors: Mario Zechner dominates overall (~3063 commits), reflecting inherited pi-mono/upstream history. Recent work is Qredence's, Zachary BENSALEM authored all of the last ~50 commits (72 total in the tree), with the web work largely contributed through PRs in August 2026. About 127 commits are bot-attributed (github-actions[bot], plus "codex:" commits in the web wave). Other upstream contributors include Armin Ronacher, Helmut Januschka, Sebastian Muller, Kevin Thomas, Seth Karten, and Aliou Diallo.
  • Tags: the release timeline runs v0.0.1-demo.1 through .7 (2026-05-14), v0.0.1 (2026-05-18), through v0.7.1 (2026-08-07), with a beta tag also on 2026-08-07. All packages share the lockstep 0.7.1 version.

Clone this wiki locally