Skip to content
guidobuildsPublic

About

Lightweight workflow layer that makes coding agents plan and verify instead of overbuilding. OpenCode, Claude Code, Codex, Grok Build.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Forge

Forge is a personal project for working with code agents more reliably.

It started as a way to get better results from OpenCode, and now also supports Claude Code, Codex and Grok Build. The idea is to give agents a lightweight operating model for turning vague software requests into smaller, safer, verifiable changes without adding a heavy process around them.

Forge is experimental. It is shaped by hands-on use, and the workflow may change as I learn what works and what does not.

Why It Exists

Code agents are useful, but they often fail in predictable ways: they start coding too early, lose context between steps, overbuild, or make changes without a clear verification path.

Forge is my attempt to make that work more disciplined:

  • clarify intent before implementation when it matters
  • choose the smallest safe workflow for each request
  • keep long-running context in durable project notes
  • separate orchestration from execution
  • make verification part of the work, not an afterthought

Forge is intentionally minimal. It is not a plugin marketplace, a new IDE, or a replacement for your agent. It is just a small workflow layer for getting agents to pause, inspect, plan when needed, and verify their work.

What It Does

Forge adds a structured agent workflow for:

  • inspect an existing codebase before making changes
  • produce design notes for ambiguous or high-risk work
  • turn approved direction into an executable plan
  • implement focused changes with a minimum-change bias
  • run or document validation after implementation
  • preserve important decisions and follow-ups under .forge/

For simple requests, Forge should stay out of the way and take the shortest safe path. For larger changes, it can slow the process down just enough to reduce rework and bad assumptions.

How It Works

Forge uses a thin orchestrator and a single worker model.

The orchestrator decides how much process a request needs. The worker does the actual inspection, design, planning, building, operating, or verification work. This keeps the user conversation focused while still giving the agent a repeatable execution pattern.

Typical routes include:

inspect -> build -> verify
inspect -> design -> plan -> build -> verify
build -> verify

There is no mandatory lifecycle. Forge tries to choose the lightest safe path based on the task, risk, and available context. Forge calls this proportional routing Forge Flow: the path scales with risk, clarity, and continuity rather than file count, and it is a routing discipline, not a mandatory lifecycle or a separate invocable skill.

Before delegating, the orchestrator states the chosen route to the user — the work types it plans to run, whether forge-grill runs before build, and why it is the lightest safe path for that request. For non-trivial work, it then presents an approval brief — conclusions, planned tasks, why — and waits for an explicit go-ahead before the first build dispatch.

Durable Context

When a task benefits from persistent context, Forge writes notes under .forge/<feature-slug>/.

These notes are useful for:

  • resuming work across agent sessions
  • reviewing the reasoning behind a change
  • keeping implementation aligned with approved decisions
  • making follow-up work easier to delegate

Small, obvious changes do not need ceremony. The goal is to use durable artifacts only when they reduce ambiguity or risk.

State model for non-trivial work

For non-trivial or multi-session work, Forge keeps a small state model under .forge/<feature-slug>/, sized to the task:

  • feature-list.json — the unit-of-work ledger. Each feature carries the triple behavior + verification (a runnable command) + state (not_started | active | blocked | passing), plus a tasks[] execution ledger (title, files, expected outcome, validation, state) so any agent can resume mid-build.
  • verification.md — recorded verification evidence: the command, its output, a pass/fail verdict, and (when used) the receipt ID.
  • .forge/evidence/ — machine receipts written by forge-ai evidence run; each receipt binds one check and requirement to the exact Git candidate, command, cwd, timeout, dependencies, and runner environment.
  • progress.md / session-handoff.md — session continuity and handoff, written when work spans sessions or blocks.

Before build starts on non-trivial work, Forge presents an approval brief — conclusions, the planned tasks, and why — and waits for an explicit go-ahead; a finished plan does not authorize build by itself.

Two rules make "done" mean done:

  • Definition of Done. A feature only reaches passing once its verification command was actually run and the evidence is recorded in verification.md, backed by a current forge-ai evidence receipt when the project uses the CLI. No feature is marked done on assertion alone.
  • Independent verification. For non-trivial work the builder does not certify its own work. The orchestrator dispatches a separate forge-worker verify run that re-runs the checks and flips the state. It checks receipt freshness before trusting any recorded run.

Trivial, low-risk changes skip all of this and stay on the build -> verify path. Process still scales with risk, clarity, and continuity rather than file count: a small authorization or data-loss change can need more scrutiny than a large documentation edit, and a tiny high-risk patch is not exempt.

Forge Check: candidate-bound verification evidence

Forge Check is Forge's name for verification evidence bound to the change: a recorded check counts only while its receipt is current for that exact candidate and contract. The CLI that produces it is opt-in and Git-only in this MVP. It never executes a command just because a Markdown or JSON file was read, and it never uses an implicit shell: the argv after -- is passed exactly as given.

forge-ai evidence run   --slug my-feature --check unit --requirement "the unit suite passes" -- pnpm test
forge-ai evidence check --slug my-feature --check unit --requirement "the unit suite passes" -- pnpm test

run writes an atomic receipt under .forge/evidence/<slug>/<check>/ with the Git worktree/index identity, exact argv and cwd, timeout, requirement, declared dependency receipts, exit status, bounded output, and basic runner metadata. check is read-only and exits 0 only when that receipt is current for the same candidate and contract. States are distinct: passed, failed, stale, missing, and error; anything other than passed exits non-zero.

A changed file (tracked or non-ignored untracked, including deletions, modes, and symlink targets), command, requirement, cwd, timeout, declared dependency receipt, or runner environment makes evidence stale. A later failed or errored run supersedes an older pass instead of leaving it current. Missing, corrupt, incompatible, or wrong-worktree receipts are rejected. .forge/evidence/ is excluded from the candidate identity so writing receipts does not invalidate them. Historical receipts are preserved; old Markdown evidence is never auto-promoted to a current pass.

Forge operational outputs under .forge/<slug>/ — verification.md, progress.md, session-handoff.md, build-log.md, and change-report.html — plus the root closure logs .forge/lessons.md and .forge/index.md are excluded as state/evidence logs. .forge/<slug>/feature-list.json is normalized only for updatedAt, feature state/evidence, and task state/notes; behavior, verification, dependencies, archiveWhen, task validation, source, checks, reproductions, repo-facts.md, explore.md, and every other semantic field stay covered. This lets the documented state-model and closure writes converge without hiding the contract.

Runs first write a durable admission marker under the receipt store, then take a per-check owner lock. If an admitted attempt is newer than the latest receipt and has no complete receipt (lock failure, publication failure, crash, or interruption), check fails closed with an incomplete/abandoned-attempt error; only a later complete run restores current evidence. Completeness is separate from the result: check requires a valid receipt for the latest admitted attempt, while the result comes from the latest completed receipt (completion order), so concurrent runs whose completion order differs from admission order are handled without masking a later failure. Attempt history and old receipts are preserved. Same-prefix receipts are rejected as ambiguous, and check errors while an admission or run for that check is in progress. If the store cannot record admission at all (for example the slug store is unwritable), the run refuses to execute and is not admitted; check cannot report an attempt that was never recorded. On timeout the runner settles on exit or the deadline, kills its owned process group, and drains pipes with a bounded grace; if output streams remain open (streamsClosed false), the run cannot pass. Read paths validate every .attempts/.locks component, lock-owner file, and attempt marker before reading; a symlink there is rejected. The final receipt component remains a documented same-permission read boundary because a same-permission writer can replace receipts outright. A symlinked ancestor in the worktree or under .forge/evidence/ is rejected before reading or writing, so a tracked path cannot be read through an external directory symlink and a receipt cannot be routed outside the repository.

Limits: Forge Check proves what ran against which candidate, not that the check is meaningful or that behavior is correct. Hashes and before/after captures cannot detect a temporary edit restored between captures, and this is not a security boundary against a writer with the same filesystem permissions. Git-ignored files (including an installed dependency tree) are outside the identity: a lockfile or manifest change is covered, but an in-place dependency change with no tracked change is not. Submodule contents and nested Git repositories are represented only by their directory/gitlink entry, not recursively hashed. Runner metadata is intentionally basic (platform, arch, Node version); arbitrary environment variables are not part of the identity. Non-UTF-8 path rejection is exercised at the byte-predicate level because APFS refuses to create such names; it is not claimed as a real-filesystem test. A deliberately detached descendant with its own or ignored stdio is outside cleanup and visibility; one that keeps inherited pipes open makes the run fail closed. Process-group cleanup is POSIX; on Windows the runner can target only the direct child, so an inherited-pipe descendant still fails the run closed after the grace but may outlive it. Non-Git directories are rejected rather than treated as mechanically verified, and merge authorization is never implied by a passing check.

Supported Agents

Forge currently installs support for:

  • OpenCode
  • Codex
  • Claude Code
  • Grok Build

The same operating model is shared across all supported agents so the workflow stays mostly consistent even when the underlying tool changes.

Installation

Install with the npm CLI:

npx @guidobuilds/forge-ai install

The installer prompts for the target agent platform, whether Forge should be installed globally for your user or locally for the current project, and — interactively — which model each agent should use: keep each agent's recommended default, or choose per agent. For OpenCode, Codex, and Grok, the per-agent prompt shows the models you actually have configured (via opencode models, codex debug models, or grok models, falling back to a curated list or free-text entry if the command isn't available), not a generic list.

To choose models non-interactively (requires an explicit single --platform — model ids aren't portable across platforms):

npx @guidobuilds/forge-ai install --platform claude --scope user --model opus --yes
npx @guidobuilds/forge-ai install --platform opencode --scope user --model-map forge=anthropic/claude-opus-4-1,forge-worker=anthropic/claude-sonnet-4-5 --yes

--model applies to every agent that supports a model on the target platform; --model-map name=model,... sets it per artifact. Choices persist across update — they are not silently reset back to the canonical default. To change a model later without a full reinstall, see Configuring models below.

To update an existing install:

npx @guidobuilds/forge-ai update

For non-interactive environments:

npx @guidobuilds/forge-ai install --platform all --scope user --yes

Preview the files without writing them:

npx @guidobuilds/forge-ai install --platform all --scope user --dry-run

Validate a local Forge source tree:

npx @guidobuilds/forge-ai validate --source .

How to Use

Forge installs the same operating model on every agent, but how you invoke it differs per platform, because each agent exposes different primitives (skills, subagents, agent switching). The installer is only step one — this section is how you actually drive Forge once it is installed.

The pieces

Forge is one orchestrator, a read-only seeker, a think-only planner, a two-tier worker model, and a dedicated adversary, with four supporting skills:

  • forge — the orchestrator. It talks to you, decides how much process a task needs, and delegates the real work. It does not edit code itself.
  • forge-seeker — the collector. A cheap, fast, read-only agent (haiku on Claude Code) that maps the repo, searches, fetches docs, and returns typed evidence (map: / evidence: / unknown:) — facts, not conclusions. forge dispatches it for wide inspection and forge-worker for read-only shards; it cannot write, execute, or spawn.
  • forge-planner — the brain. The most capable model (opus on Claude Code) spent on design and planning for non-trivial work. It reads, thinks, records every decision with its losing options, and returns a PLAN (the feature-list.json content the approval brief presents). It cannot write, execute, or spawn — the first build dispatch persists the plan.
  • forge-worker — the coordinator worker. It executes bounded subgoals and spawns forge-seeker (read-only shards) or forge-worker-leaf (write shards) when context would grow too large (~100k-token peak). It still decides trivial design/plan inline; non-trivial design/plan goes to forge-planner.
  • forge-worker-leaf — the terminal worker. It runs one bounded shard with no sub-delegation.
  • forge-adversary — the breaker. After a build, the orchestrator dispatches it to try to break the work — logically and technically (logic/requirements, runtime, security, performance). It gates the Definition of Done: a confirmed, reproducible break keeps the feature out of passing. It complements forge-grill, which grills plans before building.
  • using-forge — the shared operating-model skill the orchestrator follows.
  • forge-grill — an orchestrator mode for stress-testing a plan or design before building. The orchestrator invokes it proactively before non-trivial or risk-bearing builds; also available as /forge-grill for manual use.
  • forge-change-report — an on-demand skill forge-worker loads at the closure of a non-trivial feature build. It writes .forge/<feature-slug>/change-report.html: a self-contained interactive HTML report of what changed architecturally (added/modified/removed entities and integrations, first-level connections, impacted functionalities), so a diff stops erasing architectural knowledge.
  • forge-diagramming — an on-demand skill loaded when forge is about to hand-author a diagram or chart. It distills diagram SVG mechanics and the dataviz non-negotiables (form, palette gates, marks, labels, interaction) so reports and artifacts carry deliberate, readable visuals. It is not for the forge-change-report graph, which its own template owns, and not for generic page design.

What changes per platform is the kind each piece is installed as, and therefore how you trigger it.

Claude Code

Piece Installed as How you invoke it
forge subagent (model: opus, structural tools allowlist) mention it by name, @forge, or claude --agent forge
forge-grill skill (model: sonnet, not user-invocable) loaded automatically by forge before non-trivial or risk-bearing builds
forge-change-report skill (not user-invocable) loaded by forge-worker at build closure to write .forge/<slug>/change-report.html
forge-diagramming skill (not user-invocable) loaded by forge workers before hand-drawing diagrams/charts
using-forge skill (model: sonnet, not user-invocable) loaded automatically by forge before routing work
forge-seeker subagent (model: haiku, read-only tools + WebFetch) forge dispatches it for wide inspection and grill fact-finding; forge-worker for read-only shards
forge-planner subagent (model: opus, read-only tools) forge dispatches it for non-trivial design/plan; it returns a PLAN the first build persists
forge-worker subagent coordinator; forge delegates via Agent(forge-worker, forge-adversary, forge-seeker, forge-planner)
forge-worker-leaf subagent terminal shard; spawned by forge-worker (or orchestrator on Codex)
forge-adversary subagent the orchestrator delegates to it after build to gate risk-bearing work

forge installs as a real Claude Code subagent with a structural tools allowlist (Agent(forge-worker, forge-adversary, forge-seeker, forge-planner), TodoWrite, Skill, AskUserQuestion) — it cannot Read/Write/Edit/Bash itself, only dispatch. forge-seeker and forge-planner carry their own structural allowlists (Read, Glob, Grep, LS, plus WebFetch for the seeker) — neither can write, execute, or spawn. It loads using-forge and forge-grill via the Skill tool and can still ask you clarifying questions directly (AskUserQuestion is retained for an agent running as the session's main driver, unlike a bounded sub-task dispatch). Requires Claude Code v2.1.172+.

To make forge the automatic default for a project (equivalent to the old /forge auto-load), add to .claude/settings.json:

{ "agent": "forge" }

Without that, invoke it explicitly per session (mention it by name, @forge, or claude --agent forge). forge-ai install/update/uninstall manage forge's own file; they do not write settings.json for you.

OpenCode

Piece Installed as How you invoke it
forge primary agent switch your active agent to forge
forge-seeker subagent read/glob/grep/list/webfetch allowed, everything else denied; dispatched via task for read-only fact-finding
forge-planner subagent read/glob/grep/list allowed, everything else denied; dispatched via task for non-trivial design/plan
forge-worker subagent coordinator; forge delegates with task: allow
forge-worker-leaf subagent terminal shard; spawned by coordinator (task: deny)
forge-adversary subagent the forge agent delegates to it to gate risk-bearing work after build
using-forge, forge-grill, forge-change-report, forge-diagramming skills loaded by the agent as needed

Switch your primary agent to forge. Unlike Claude Code, the orchestrator here is a real agent with file and shell tools denied, so it is structurally forced to delegate to the forge-worker subagent instead of doing the work itself.

Codex

Piece Installed as Location
forge, forge-worker, forge-worker-leaf, forge-adversary, forge-seeker, forge-planner agents (.toml) ~/.codex/agents/ (or .codex/agents/ per project)
using-forge, forge-grill, forge-change-report, forge-diagramming skills ~/.agents/skills/ (or .agents/skills/ per project)

The CLI writes agent .toml files but does not generate AGENTS.md or profiles. forge-seeker and forge-planner run with sandbox_mode = "read-only"; a read-only Codex sandbox still executes commands, so their no-execution rule is stated in their own installed prose rather than enforced by the harness.

Project vs user scope

Grok Build

Piece Installed as How you invoke it
forge skill type /forge in the prompt
forge-grill skill type /forge-grill
using-forge skill /using-forge (usually pulled in by /forge)
forge-change-report skill loaded by forge-worker at build closure
forge-diagramming skill loaded by forge workers before hand-drawing diagrams/charts
forge-seeker subagent (model: grok-composer-2.5-fast, read-only tools) main thread or forge-worker delegates via task for read-only fact-finding
forge-planner subagent (model: grok-build-plan, read-only tools) main thread delegates via task for non-trivial design/plan
forge-worker subagent coordinator; main thread delegates via task
forge-worker-leaf subagent terminal shard; spawned by coordinator
forge-adversary subagent the orchestrator delegates to it after build to gate risk-bearing work

Start a session by typing /forge. Like Claude Code, the orchestrator runs as a skill in the main Grok session, which then delegates bounded work to the forge-worker subagent. Grok uses its own tool IDs (run_terminal_cmd, grep_search, search_replace, etc.) — the installer translates the worker's toolset automatically.

Note: Grok Build already auto-discovers skills and agents from ~/.claude/ for compatibility. If you have a Claude Code install, Grok may partially pick up those files — but with Claude tool names that Grok doesn't recognize. A native Grok install (--platform grok) writes .grok/-scoped files with the correct Grok tool IDs.

Project vs user scope

With --scope user (the default) the definitions live under your home directory and apply everywhere. With --scope project they live in the repo (.claude/, .opencode/, .codex/, .agents/, .grok/) and apply only there. Invocation is identical either way.

Optional: enforce the gate with hooks (Claude Code)

Forge's Definition of Done is followed by instruction, not enforced — strong models honor the gate from the operating model alone. If you want the verification gate enforced mechanically on Claude Code (e.g. for unattended runs), add an opt-in hook to your .claude/settings.json. Keep it thin: a safety net for the one invariant that must hold, not a compliance layer.

{
  "hooks": {
    "Stop": [
      { "hooks": [ { "type": "command", "command": "<your project's verification command, e.g. pnpm test --silent>" } ] }
    ],
    "PostToolUse": [
      { "matcher": "Write|Edit", "hooks": [ { "type": "command", "command": "<your fast type/lint check, e.g. pnpm typecheck>" } ] }
    ]
  }
}

The Stop hook re-runs your checks when the agent tries to finish, so a failing gate blocks a premature "done"; the PostToolUse hook surfaces type/lint errors after each edit for mid-task self-correction. Point the Stop hook at fast unit checks and leave slow suites to CI. This is intentionally optional — reach for it only when you want the gate enforced without you in the room.

Local Development

Forge uses pnpm for development (pinned via packageManager in package.json, so corepack enable is enough — no global install needed). The published package is still consumed by end users via npx/npm, unchanged.

From a local checkout:

pnpm install
pnpm run build
node bin/forge-ai.mjs install --source . --platform all --scope user

To preview local output without writing:

node bin/forge-ai.mjs install --source . --platform all --scope project --dry-run

Updating

If you have Forge installed globally, the simplest way is:

forge-ai self-update

This detects how the CLI was installed (pnpm global, npm global, Homebrew npm, etc.) and runs the right upgrade command — including the --prefer-online flag that sidesteps pnpm's metadata cache when a new version was just published. After bumping the binary, it automatically runs forge-ai update to refresh the spec kit.

Forge also pings the registry on every interactive run and prints a one-line notice when a newer version is available, so you don't have to remember to check.

If you don't have a global install (running via npx):

npx @guidobuilds/forge-ai@latest update

Forge replaces its managed agent and skill definitions in your supported agent configuration directories.

Forge records installed files in manifests under ~/.forge/state/ (migrated automatically and transparently from the earlier ~/.forge-ai/ on first run — the old directory is left in place, marked with a MIGRATED note, and never deleted automatically) so updates can safely remove files that are no longer bundled. update prunes stale managed files by default only when the current file still matches the recorded checksum; use --no-prune to keep stale managed files. --dry-run previews writes and deletes without changing files or manifests.

Forge routes a single canonical artifact to the right artifact kind per agent: the orchestrator installs as a real subagent on Claude Code, OpenCode, and Codex, and as a skill on Grok. If you installed an earlier version where Claude's orchestrator was a skill, run update (not install) so Forge prunes the now-stale ~/.claude/skills/forge/SKILL.md left by the previous layout.

Uninstalling

npx @guidobuilds/forge-ai uninstall

This removes exactly the files Forge's manifest recorded for the given --scope (default: user), refusing to silently delete anything you edited locally — a locally-modified file is backed up and requires --yes/--force (or interactive confirmation) before it's removed, mirroring update's overwrite protection. Pass --platform to uninstall a single agent instead of all of them, and --dry-run to preview what would be removed.

Listing installs

npx @guidobuilds/forge-ai list

Prints every recorded install — the user-scope one, if any, plus one line per project you've installed Forge into — with the Forge version, file count, platforms, and last-updated time for each.

Configuring models

npx @guidobuilds/forge-ai configure --platform claude --scope user

Change which model an already-installed agent uses without a full reinstall. Interactively, it walks every agent on the given scope/platform that supports a model (using each platform's live model discovery where applicable, same as install). Non-interactively, pass --model <id> or --model-map name=model,... (same rules as install: an explicit single --platform, no --force/--yes — the point of the command is to make a choice, not skip one). Only the affected files are rewritten; the manifest and every other installed platform are left untouched.

Project Status

Forge is experimental and personal.

There is no promise that the workflow will stay stable or that every agent/tool combination will keep working the same way. I am using it, changing it, and keeping the parts that make agent work better in practice.

Feedback, issues, and pull requests are welcome, especially when they come from real usage.

About

Lightweight workflow layer that makes coding agents plan and verify instead of overbuilding. OpenCode, Claude Code, Codex, Grok Build.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages