Skip to main content

Forge

Status: Ready

Truth label: Current

Audience: Fleet operator, System designer

Reader outcome: Start Forge Central and a worker, and know the task lifecycle, supervision modes, routing, backends, persistence, and operations.

Last verified: 2026-09-13

Forge is AGENTASIAN's distributed task control plane and worker runtime.

  • Forge Central is the FastAPI service at forge.central.api:app.
  • Forge workers run with python -m forge.worker.
  • Workers make outbound HTTP requests and do not listen on a port.

Start Forge​

# Central
python -m uvicorn forge.central.api:app --host 127.0.0.1 --port 8080

# Worker
python -m forge.worker --engine claude-code

The all-in-one launchers start Central, Brain, and Cortex. They do not start a worker.

One worker is one slot. For concurrent runs on a single machine, run one worker per engine, each pinned to its own:

./agents.sh start # start, stop, restart, status, logs

or by hand:

python -m forge.worker --name claude --engine claude-code --pin-engine
python -m forge.worker --name codex --engine codex --pin-engine

Central responsibilities​

Central owns:

  • project registration and path validation
  • priority task routing
  • worker registration, credentials, heartbeats, and removal
  • transactional claim state
  • task leases, fencing, and expired-run recovery
  • checkpoint approval
  • sessions and dependency ordering
  • recurring schedules
  • task logs, run lineage, decisions, and egress analytics

Task lifecycle​

pending
|
| claim transaction
v
assigned -> in_progress
|
| success
v
autonomous: completed
checkpoint: checkpoint -> approve, revise, or fail
supervised: plan checkpoint -> execution -> final checkpoint

Any active state can reach failed or cancelled.

Each claim creates:

  • a UUID current_run_id
  • an incrementing run_attempt, also used as the fence
  • a server-owned lease
  • a claim-bound run token for credentialed workers

The worker renews its lease while the CLI runs. Central's reaper checks every 15 seconds and fails claims that exceed the lease TTL or maximum wall-clock limit. A stale result cannot overwrite a newer attempt because Central checks the fence before applying state.

Supervision modes​

ModeBehavior
autonomousA successful run completes immediately
checkpointA successful final result is held for operator review
supervisedCentral serves a safe planning run first, then holds both the plan and final result

Checkpoint actions:

  • POST /tasks/{id}/approve completes a final checkpoint or releases the supervised execution stage.
  • POST /tasks/{id}/reject accepts action: revise or action: fail.
  • Revisions add bounded feedback to the task and do not consume the automatic retry budget.
  • Human rejection never triggers automatic retry.
  • Decisions are appended to decisions.jsonl.

The default project supervision mode is checkpoint.

Routing​

A task may constrain routing by:

  • assigned_worker_id
  • engine
  • required_capabilities
  • parent_task_id

Central offers a task only when:

  • the worker pin is empty or matches the polling worker
  • the worker reported the requested CLI engine
  • every required capability is present
  • the parent task is complete

Project paths are literal strings registered with the project. They are not translated between Windows, macOS, and Linux. Pin cross-platform tasks to a worker that can reach the path.

Execution backends​

The worker backend registry is in forge/worker/executors/registry.py.

EngineCommandLogin or keyResumeLive progress
claude-codeclaude -p ... --output-format stream-jsonClaude CLI loginYesYes
codexcodex exec ... --jsonCodex CLI loginNoParsed final JSONL events
codex-ossCodex with --oss --local-provider ollamaLocal OllamaNoParsed final JSONL events
antigravityagy -p ... --output-format stream-jsonAntigravity loginYesAgent and tool events
agenticIn-process LangChain tool loopProvider keyNoLegacy
legacyIn-process single-shot generationProvider keyNoLegacy

The startup --engine is the default for tasks that do not name one. A worker can execute a task through any installed backend it advertised.

Workers report each advertised CLI's own version at registration, and Cortex shows it in the fleet panel. python scripts/upgrade-clis.py upgrades the CLIs on one box; see the runbook for what it will and will not upgrade.

Permission mapping​

Forge levelClaude CodeCodex and Codex OSSAntigravity
safeplan moderead-only sandboxplan mode
writeaccept editsworkspace-write sandboxsandbox with tool approval bypass
yoloskip permission checksbypass approvals and sandboxskip permission checks

The worker's --max-permission is a hard ceiling. A task that requests more authority is clamped and the event is logged.

safe is not an OS-enforced no-side-effect boundary. Claude plan mode permits selected test commands, and the worker runs the configured verification command independently after the CLI. Repository code can therefore execute in a nominally safe workflow.

Worker flow​

  1. Load .env, discover installed backends, and validate the bundled AGOR policy before registration.
  2. Register hostname, instance name, capabilities, engines, and the version each advertised engine's CLI reports.
  3. Save the one-time worker credential under <data_root>/worker-credentials/.
  4. Drain any terminal results left in the local outbox.
  5. Poll GET /tasks/next?worker_id=....
  6. Claim the selected task.
  7. Read current target-repository controls in full, create only missing memory within effective write permission, and refresh derived CPMI history.
  8. Build a prompt with task identity, persona hint, selected skills, active rules, session context, project controls, and untrusted history.
  9. Launch the requested CLI in project_path.
  10. Renew the lease, watch cancellation, and ship supported logs.
  11. Run the task's optional verification command.
  12. Persist the result in the outbox and post it to Central.
  13. Report a learning to Brain.

Bundled governance​

Agent Global Operating Rules ship with Agent Asian's code and distributions. Every executor receives the bundled policy. Project-local memory files remain authoritative; Brain only indexes and retrieves them. Writable tasks create missing memory and native entrypoints without replacing existing content. Read-only tasks perform no governance setup writes. Oversized or unreadable controls stop dispatch instead of losing rules. Run metadata retains policy identity and the current control digest. See worker governance for operating details.

Credentials and result delivery​

The shared bearer token protects the API perimeter. Forge adds two narrower worker credentials:

  • The worker token identifies one hostname and instance. Central stores only a SHA-256 hash.
  • The run token is minted at claim and bound to task_id plus fence.

The worker token is sent on registration, heartbeat, poll, and claim. The run token is sent on lease renewal, logs, and results.

If a worker credential file is lost, Central refuses takeover of the existing identity. Stop the worker, delete its old registration through Cortex or DELETE /workers/{id}, then restart it to enroll again.

Before the first result POST, the worker writes outbox/<worker_id>/<task_id>-<fence>.json. It removes the entry after accepted, duplicate, superseded, or task-gone outcomes. Transport and authentication failures keep the entry for later delivery.

Persistence​

SE_MANAGER_DATA_DIR defaults to ~/.agent_asian.

DataStorage
Projects, tasks, workersJSON documents in forge.sqlite3
Leases, result deduplication, run-token hashesRelational tables in forge.sqlite3
Sessionssessions/sessions.json
SchedulesRecurrence tables in forge.sqlite3; retained legacy schedules.json migration input
Incremental task logsFiles under logs/
Run summariesruns.jsonl
Checkpoint decisionsdecisions.jsonl
Trace lineagetraces.sqlite3 and traces/raw/

Central uses SQLite WAL, BEGIN IMMEDIATE mutations, and an exclusive process lock. Do not put the live database on a WSL drvfs or 9P mount.

On first startup after GL-01, empty SQLite tables import the old project, task, and worker JSON registries. Imported files are renamed with .migrated.

API reference​

Projects and workers​

MethodRoutePurpose
GET/POST/projectsList or create projects
GET/PATCH/DELETE/projects/{id}Read, update, or remove a project
POST/workers/registerEnroll or refresh a worker
POST/workers/{id}/heartbeatMark a worker alive
GET/workers, /workers/{id}Inspect workers
DELETE/workers/{id}Remove an idle registration
GET/workers/typesList personas and skills

Tasks​

MethodRoutePurpose
GET/POST/DELETE/tasksList, create, or clear tasks
GET/DELETE/tasks/{id}Read or remove one task
GET/tasks/pendingPending tasks in route order
GET/tasks/nextFind work for a worker
POST/tasks/{id}/claimTransactional claim
POST/tasks/{id}/leaseRenew lease and read cancellation
POST/tasks/{id}/cancelRequest cancellation
POST/GET/tasks/{id}/log(s)Append or read live logs
POST/tasks/{id}/resultReport a fenced result
POST/tasks/{id}/approveApprove a held checkpoint
POST/tasks/{id}/rejectRevise or fail a held checkpoint

Sessions, schedules, and analytics​

Route groupPurpose
/sessions*Group tasks, aggregate context, rename, complete, and delete
/schedules*Create and run interval, daily, or weekly task templates
/analytics/egressUsage and cost summaries
/runs/{run_id}/traceTask-run lineage, including current raw result content in outcome
/tasks/{task_id}/runsAttempt history for one task
/status, /healthOperational status

The API's OpenAPI document at /docs is the exact request-field reference.

Operations​

On Windows, scripts/windows/supervisor.ps1 can keep Central, Brain, and Cortex running, log restarts, emit flap alerts, and invoke scripts/backup_data.py daily. Register it with scripts/windows/register-supervisor.ps1 after reviewing the hard-coded repository and data paths.

The backup script uses SQLite's backup API and rotates timestamped zip files. It is safe to run while Central is active, but the current allowlist omits decision, scope-audit, candidate-resolution, worker-credential, and outbox state. See Data and storage.

Known limits​

  • Paused and archived projects reject new tasks and are omitted from polling, but work already assigned or running is not stopped; cancel it separately.
  • There is no automatic project-path mapping across workers.
  • Raw task artifacts remain on the worker that ran the task unless the data root is shared.
  • The shared fleet bearer authorizes most operator routes, and CLI children inherit the worker environment unless separately isolated.
  • Client-scope filtering is not applied to every Brain retrieval path.
  • Antigravity now streams progress. IDE quality parity still requires matched operator comparisons; see AGY parity.
  • The two legacy execution engines have a wider and older trust model.

See Runbook for operations and Configuration for settings.

Recurring tasks now have a Cortex editor, timezone previews, overlap policies and durable occurrence evidence. Manual runs preserve the next appointment.

Reconcile local task ledgers​

Use the bundled governance migration commands for older projects with two task ledgers. migrate-plan takes an explicit root and private state directory and returns an inspectable diff and record coverage. migrate-apply takes that plan, checks both ledgers, preserves source states and retires the old filename to a pointer. The private receipt retains original bytes. migrate-rollback previews recovery and writes only with --apply; later edits are preserved as a conflict. Repeating an intact migration has no effect. See task-ledger migration for the full workflow. No Brain service or extra governance installation is required.

Native startup setup​

Workers carry native setup in their ordinary code. Startup initializes absent instruction globals for installed Claude, Codex and Antigravity CLIs, or upgrades a block that matches its active private receipt. It preserves unrelated text. Unowned files, native overrides, edited blocks and restrictive budgets are reported for review. No credentials or native permission settings change. Owned Claude advisory hooks use a separate recoverable settings projection; unrelated hooks remain intact. Private receipts are stored under the normal data root and support interrupted setup recovery. Task metadata and Cortex show the startup observation separately from native loading proof. See native account instructions.

Advisory Claude hooks​

Claude feedback ships with Agent Asian and uses its existing Python runtime. Session start supplies a bounded memory reminder. File-tool and shell edits are checked through Git status and file metadata, including untracked files. Known memory documents receive format and changed-prose checks. Source contents and transcripts are not collected. Limited or unavailable inspection is reported for manual review.

Final feedback is a user-facing warning at most once per session. It cannot block completion, start another model turn or replace the requested artifact. Native permissions remain unchanged. The bundled hook setup and rollback commands retain unrelated settings and extra hooks; reviewed legacy advisory entries have private recovery evidence. Cortex lists configuration and implementation hashes separately from execution proof.

Policy identity is visible in rendered text because native readers can remove comments. A file hash, a supplied native instruction and a successful standalone read remain distinct evidence. A denied native read stays unverified.