All projectsAgent Harness Development

ForgeCode

Terminal-Native AI Coding Agent

ForgeCode is a terminal-native AI coding agent — you chat to plan, write, and refactor code without ever leaving the keyboard. The agent runs file and shell tools locally on your machine, while a server backend hosts the model loop, full conversation history, authentication, and billing. Switch between OpenAI, Anthropic, and Google models mid-session, drop into read-only Plan mode to research safely, and reopen any past conversation from a searchable session browser.

Category
Agent Harness Development
Role
Solo design & engineering
Interface
Terminal (TUI)
Status
Open source
Built with

TypeScriptBunHonoReact (OpenTUI)AI SDKPrismaPostgreSQLClerkPolarZodVercel

ForgeCode terminal on launch, signed in and waiting in Build mode
Signed in and ready — the Build-mode prompt on launch.
Architecture

Three clean layers.

Concerns are split so the client owns your filesystem and the server owns everything durable — the two never blur.

CLI — the terminal client

Owns the TTY and executes every tool locally with OpenTUI's React reconciler. The server never touches your filesystem; the client sends only the new message each turn.

Server — the Hono API

Hosts model interactions, full session history in Postgres via Prisma, Clerk authentication, and Polar billing — bundled to run on Vercel.

Stateless by design

The server rebuilds context from database history on every turn, so there is no tool replay and the CLI stays the single source of filesystem truth.

The loop

How a turn flows.

  1. 1You send a message from the terminal.
  2. 2The server checks your remaining credits.
  3. 3It loads the full conversation history from Postgres.
  4. 4A streaming tool-calling loop runs against the chosen model.
  5. 5The CLI executes each tool locally and returns the result.
  6. 6The reply and tool calls persist; one credit meters to Polar.
Capabilities

Built for real workflows.

Build & Plan modes

Build gets full read / write / run access; Plan is read-only research that cannot touch your files.

Runtime model switching

Swap between OpenAI, Anthropic, and Google models — with per-model reasoning and service-tier options — without restarting.

Persistent sessions

Every conversation is stored with an auto-generated title and reopened from a searchable session browser.

Browser-based auth

OAuth 2.0 (Authorization Code + PKCE) through Clerk, with transparent token refresh.

Usage-based billing

One credit per message via Polar metering, with fail-open logic so messaging still works when billing isn't configured.

Themeable & keyboard-driven

Persisted color themes and slash commands (/new, /sessions, /model, /balance …) for full keyboard control.

A full ForgeCode agent turn: planning, tool calls, and a summarized answer
A full agent turn — the model plans, calls listDirectory and readFile locally, then summarizes the codebase.
Tooling

The agent's toolbox

readFile

Read a file from the working directory.

writeFile

Create or overwrite a file.

editFile

Apply a targeted edit to an existing file.

listDirectory

List the contents of a directory.

glob

Find files by pattern.

grep

Search file contents by regex.

runShell

Run a shell command locally.

Plan mode restricts the agent to the read-only tools; Build mode unlocks all seven.

Models

Models supported

OpenAI
GPT-5.1 Codex — default / auto / flex / priority tiers
Anthropic
Claude Opus · Sonnet · Haiku
Google
Gemini — standard / flex / priority tiers
Gallery

A closer look.

ForgeCode runtime model picker
Runtime model picker — OpenAI, Anthropic, and Google side by side.
ForgeCode session browser
The session browser — every past conversation, auto-titled and searchable.
ForgeCode slash command list
Slash commands for full keyboard-driven control.
ForgeCode theme picker
Persisted, searchable color themes.
ForgeCode credits balance panel
Usage-based credits — metered one per message through Polar.

Interested in the details?