- Get Started

FORGE - Builder Agent

FORGE is the primary code generation agent. It writes implementation code against a CONTRACT.md that defines the acceptance criteria, security requirements, and test expectations. FORGE runs inside an ephemeral Coder workspace with its own isolated Git worktree and branch.

Architecture

┌─────────────────────────────────────────────────────────────┐
│ FORGE Workspace (ephemeral Coder workspace)                  │
│                                                              │
│  ┌────────────────┐     ┌──────────────────────────────────┐│
│  │ Coder Agent    │────▶│ openflows-harness                ││
│  │ (LLM Session)  │     │ - dispatch read (get task)       ││
│  └────────────────┘     │ - status get/set (track phase)   ││
│                          │ - pr opened (record PR)          ││
│                          │ - heartbeat start (alive signal) ││
│                          │ - handoff write (to Sentinel)    ││
│                          └──────────────────────────────────┘│
│                                      │                        │
│                                      ▼                        │
│                              ┌─────────────┐                 │
│                              │    Redis    │                 │
│                              │ SharedStore │                 │
│                              └─────────────┘                 │
└─────────────────────────────────────────────────────────────┘

Workflow Phases

PhaseStatus ValueDescription
PlanningplanningAnalyze task, read repository, create CONTRACT.md
BuildingbuildingImplement solution per contract
TestingtestingRun test suite, verify all pass
Review Readyreview_readyPR opened, awaiting SENTINEL review
RevisingrevisingAddressing SENTINEL review comments
BlockedblockedCannot proceed - human escalation needed

Hook System (Claude Code)

FORGE uses a comprehensive hook system for policy enforcement and quality:

HookTriggerPurpose
session_start.shSession startsProvides dispatch context, workflow guide, contract path
pre_bash_guard.shBefore any bashBlocks direct Redis access, destructive commands, git push --force
post_write_lint.shAfter file writeAuto-formats code (rustfmt, prettier, gofmt)
stop_require_artifact.shOn stop attemptRefuses to stop unless PR is created or blocked
pre_task_guard.shBefore subagentValidates task scope, prevents scope creep
post_task_guard.shAfter subagentVerifies subagent completed expected work

Coordination via Harness

FORGE uses the following harness commands to coordinate with NEXUS and SENTINEL:

CONTRACT.md Format

The contract is the agreement between FORGE and SENTINEL. FORGE writes it during planning; SENTINEL reviews against it during code review.

The CONTRACT.md is a markdown document that specifies the goal, acceptance criteria, security requirements, files to be modified, and risks. It serves as the specification that FORGE implements against and SENTINEL reviews.

Configuration

Configure FORGE in registry.json under the agents section with plan_mode: false.

plan_mode: false

FORGE runs with plan_mode: false because it executes implementation, not planning. SENTINEL uses plan_mode: true for adversarial review.

Workspace Template

The openflows-forge template includes:

Security Controls