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
TypeScriptBunHonoReact (OpenTUI)AI SDKPrismaPostgreSQLClerkPolarZodVercel

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

The agent's toolbox
readFileRead a file from the working directory.
writeFileCreate or overwrite a file.
editFileApply a targeted edit to an existing file.
listDirectoryList the contents of a directory.
globFind files by pattern.
grepSearch file contents by regex.
runShellRun a shell command locally.
Plan mode restricts the agent to the read-only tools; Build mode unlocks all seven.
Models supported
- OpenAI
- GPT-5.1 Codex — default / auto / flex / priority tiers
- Anthropic
- Claude Opus · Sonnet · Haiku
- Gemini — standard / flex / priority tiers
A closer look.




