Forge is a coding agent that runs in your terminal. Describe what you want done and it will read the code, run commands, edit files, and report back — asking for your approval before it runs a shell command or changes a file.
Tasks are the default way to work. By default each one gets its own git worktree and branch, so you can queue several jobs at once without them stepping on your working copy, then review the diff and merge the one you want. Chat is still there when you just want to talk to the agent one message at a time.
Worktrees need a git repository. If one cannot be created, the task runs in your checkout instead, where an approved edit changes your files directly.
- Node.js 22 or newer
- An OpenRouter API key
- ripgrep (
rg) on yourPATH— used by the code search tool. Everything else works without it.
npm install --global @nehanahmed/forge
forge config set-key <your-openrouter-key>The key is saved to ~/.forge/config.json. Forge sets owner-only permissions when it
creates the file, but if the file already exists its permissions are left unchanged — run
chmod 600 ~/.forge/config.json first if other users can read it. You can also set
OPENROUTER_API_KEY in your shell, or in a .env file in the project you run Forge from.
Install ripgrep with the package manager you already use:
winget install --id BurntSushi.ripgrep.MSVC -e # Windows
brew install ripgrep # macOS
sudo apt install ripgrep # Debian / UbuntuForge ships JetBrains Mono (SIL Open Font License 1.1) so the dashboard looks the same everywhere. Install it into your per-user font directory with:
forge font install # copy the fonts and register them with the OS
forge font install --no-register # copy only; register yourself later
forge font install --dir ./fonts # copy to a specific directory
forge font path # print the per-user font directoryThen select the font once in your terminal profile:
- Windows Terminal — Settings → Profiles → Defaults → Appearance → Font face →
JetBrains Mono - VS Code — set
"terminal.integrated.fontFamily": "JetBrains Mono" - iTerm2 — Settings → Profiles → Text → Font →
JetBrains Mono - Terminal.app — Settings → Profiles → Text → Font →
JetBrains Mono - GNOME Terminal — Preferences → Profile → Text → Custom font →
JetBrains Mono - Konsole — Edit Current Profile → Appearance → Font →
JetBrains Mono
Forge cannot change the terminal's font for you: the font face belongs to the terminal emulator, and there is no portable ANSI sequence for setting it. Bundling and installing the font, then pointing you at the right setting, is as far as a CLI can go.
cd path/to/your-project
forgeCommit or stash your work first. Each task branches from HEAD, so uncommitted and
untracked changes are not visible inside it, and merging refuses a main working tree with
tracked changes.
Forge opens the dashboard. Type a goal, for example Find and fix the race in the login flow, and press Enter. The task appears in the list with its progress and log; approvals
show up in the inbox (a). When the task finishes, press Tab (or Esc) to move focus to the
list, then review it with D, merge it with m, or discard it with x.
The default model is NVIDIA Nemotron 3 Ultra on OpenRouter's free tier. Run /models (or
press M from the dashboard list) to pick another one. The choice applies to new tasks and
is saved in ~/.forge/config.json.
| Input | What it does |
|---|---|
| plain text | Start a task with that goal |
/new [--read-only] [--shared] [--policy <p>] <goal> |
Start a task with explicit options |
/open <n> |
Open a task and its log |
/approve <n> / /deny <n> |
Answer the oldest pending approval for a task |
/diff <n> |
Show the task's diff |
/merge <n> / /discard <n> |
Merge the branch, or delete it and its worktree |
/resume <n> / /cancel <n> |
Resume an interrupted task, or cancel a task and its children |
/policy <n> [ask|auto|read_only] |
Set a task's approval policy; omit the mode to toggle manual/auto |
/auto <n> / /manual <n> |
Shortcut for auto or manual approvals |
/models |
Open the model picker |
/help / /quit |
Show commands / leave |
Keys: ↑/↓ to move, ←/→ to fold a task tree, Enter to open a task, a for
approvals, p to toggle manual/auto approvals, M to choose a model, Tab to switch
between list and input, ? for the full key map, q to quit. Long log lines wrap to the
terminal width, and the view scrolls by height, so nothing is clipped horizontally.
Destructive actions ask for a y/n confirmation.
forge chat
forge chat --resume # latest session in this directory
forge chat --resume <id> # a specific sessionChat streams replies and tool calls inline, and shows token use and estimated cost for the
session. Commands: /help, /clear, /new, /sessions, /models, /model <id>,
/exit.
- Reads and searches your code, and can delegate read-only research to a sub-agent so the noise stays out of the main conversation.
- Runs shell commands and edits files, with approval.
- Handles the git basics itself: status, diff, stage, commit. It never pushes, resets, or amends.
- Splits large jobs into child tasks, with limits on depth and count per tree.
- Retries transient model failures (network drops, rate limits, upstream 5xx) with backoff, and resumes mid-stream work from saved state when possible.
- Keeps task state on disk, so a restart does not lose queued work.
- Shell commands and file writes go through an approval policy:
ask(default),auto_in_worktree(writes inside the task's worktree and allowlisted test/build commands are auto-approved), orread_only(read and search tools only). Switch a task at runtime withpin the dashboard or/policy <n> [ask|auto|read_only]; automatic approvals need worktree isolation, and read-only tasks cannot be widened. The chat UI and dashboard both ask; read-only tasks simply cannot write. - Commands run with your user permissions. There is no sandbox, so read a command before you approve it.
- Task branches must be
agent/task-*, and merges only happen from the dashboard after a clean-tree check. Git hooks run normally. - Forge sends model traffic to OpenRouter. Shell commands and git hooks run on your machine and may make their own network requests.
Settings live in ~/.forge/config.json and are all optional. The file controls UI density,
ASCII mode, timestamps, cost labels, alternate-screen use, and child-task limits. See
docs/configuration.md for every key and its default.
Forge scopes tasks, worktrees, and session metadata to the directory it was opened in.
Each directory gets a folder named <slug>-<hash12>, derived from its canonical path, and
project.json records the exact path.
| Path | Contents |
|---|---|
.agent-sessions/ in the project |
Chat session state |
~/.forge/projects/<key>/tasks/ |
Task index, logs, and per-task state |
~/.forge/projects/<key>/worktrees/ |
Task worktrees and agent/task-* branches |
~/.forge/projects/<key>/meta/meta.json |
Session titles and model choices for that directory |
~/.forge/projects/<key>/project.json |
Exact canonical path the project folder belongs to |
~/.forge/config.json |
API key and UI settings (global) |
Add .agent-sessions/ to your .gitignore if you use chat; everything else is stored
outside the project. Deleting a task's worktree from the dashboard also removes its branch.
pnpm install
pnpm lint # ESLint (TypeScript + React hooks)
pnpm format # Prettier; use format:check in CI
pnpm typecheck # src, tests, and scripts
pnpm build # clean + tsc + shebang
pnpm test # node:test via tsx, no API key needed
pnpm test:coverage
npm link # use the local build as `forge`pnpm test runs both tests/unit and tests/integration. The integration suite builds
real git repositories and worktrees in an isolated temporary HOME, so run it from the
repository root. Build once before running the CLI smoke tests locally.
pnpm dev watches src/cli/app.tsx and needs dist/cli/app.js to exist, so run pnpm build once first.
Contributor workflow, package rules, and the release process are in AGENTS.md. For a tour of the code, start with docs/architecture.md; test conventions are in docs/testing.md.
MIT. See LICENSE.