The Architect · Gemini
Read the repository, clarify the design, write spec.md, review the real git diff, and run the acceptance checks independently.
Folio I · Asynchronous Orchestration
Gemini (Antigravity) writes the brief. Local Codex CLI builds, using isolated Git worktrees for parallel runs. Castor’s zero-dependency MCP stdio server returns results without polling. It records dispatch history and real user feedback so you can refine model and reasoning settings and keep improving the workflow.
0 TOKEN IDLE · REACTIVE WAKEUP

background: alwaysreport.schema.jsonFolio II · Tabula I
The patron and architect agree on the work. Castor sends the brief to local Codex and returns a compact result for independent review. Dispatch metrics and the user’s response help the architect refine model and reasoning choices and adapt the way they work together.
codex exec or codex exec resume with --json, --output-schema report.schema.json, and --dangerously-bypass-approvals-and-sandbox. Events stream to disk. The tool returns the report, Git summary, and artifact paths, triggering Antigravity’s wakeup.Read the repository, clarify the design, write spec.md, review the real git diff, and run the acceptance checks independently.
Implement the brief, verify the change in the assigned checkout, and deliver the six-field JSON report. Resume the same session when review calls for rework.
Folio III · Tabula II
Antigravity runs dispatch and resume in the background. End the turn or work on something unrelated until the result arrives. Each run and user reply add to the record that informs the next dispatch.
Gemini reads the repository and writes a six-part Markdown brief covering objective, context, detailed requirements, constraints, verification, and acceptance.
Before the session’s first dispatch, check ~/.codex/models_cache.json for available models and reasoning levels, with ~/.codex/config.toml as fallback. Use outcomes and feedback from similar tasks to choose model and reasoning_effort and pass them explicitly to codex_dispatch (background: "always"). Start each dispatch or resume toolSummary with [<model>·<effort>]. Set use_worktree: true for parallel workers in one repository. Share the task ID and branch when enabled.
Gemini yields while Codex works autonomously. Skip polling loops, polling timers, and sleeps.
Antigravity wakes Gemini on tool return with the JSON report and git.diff_stat.
Inspect the diff and run the checks. Merge accepted changes before codex_cleanup_worktree, or send specific feedback through codex_resume to preserve session memory.
Report model·effort, rounds and reworks, total duration, and total tokens in the acceptance summary. After presenting any round, Gemini records the first user reply verbatim using codex_feedback with that task_id and round, including any rating, verdict, tags, or notes the user gives. Users can also rate or leave notes in Codex Monitor. Use this record to refine Step II’s settings and address what users found difficult in the workflow.
Folio IV · Tabula III
All seven tools load eagerly (eager: true), with async background mode configured in Antigravity. Select a tool to inspect its parameters, call payload, and returned result.
codex_dispatchbackground: always
codex_resumebackground: always
codex_feedbackbackground: off
codex_statusbackground: off
codex_cancelbackground: off
codex_cleanup_worktree background: off
codex_monitorbackground: off
Start a new implementation from a self-contained Markdown spec. By default Codex edits the active checkout.
| Parameter | Use |
|---|---|
workdir | Required absolute path to the target directory. |
spec / spec_file | Provide Markdown text or the absolute path to a spec file. |
title | Optional concise, human-readable task title. |
task_id | Optional unique ID. The server generates one when omitted. |
use_worktree / base_ref | Create a managed worktree and select its base. Defaults: false and HEAD. |
model / reasoning_effort | Optional overrides at the tool level. The orchestrator skill selects both explicitly from the live ~/.codex/models_cache.json. |
extra_writable_dirs | Optional paths passed through via --add-dir. |
{
"name": "codex_dispatch",
"arguments": {
"workdir": "/home/dev/project",
"spec_file": "/home/dev/specs/task-a.md",
"title": "Document the CLI",
"task_id": "task-a",
"model": "gpt-6.2-sol",
"reasoning_effort": "high",
"use_worktree": true
}
}{
"task_id": "task-a",
"round": 1,
"status": "completed",
"duration_seconds": 38.5,
"effective_model": "gpt-6.2-sol",
"effective_reasoning_effort": "high",
"rework_count": 0,
"total_duration_seconds": 38.5,
"total_usage": {"input_tokens": 3600, "output_tokens": 900, "total_tokens": 4500},
"report": {
"status": "completed",
"summary": "Documented the CLI.",
"files_changed": [
"README.md"
],
"commands_run": [
"git diff --check (passed)"
],
"tests_summary": "Diff whitespace check passed.",
"open_issues": []
},
"git": {
"branch": "codex/task-a",
"diff_stat": "README.md | 2 ++"
}
}Set use_worktree: true whenever two or more artisans edit the same repository.
Continue a previous Codex session with concrete review feedback in its work directory.
| Parameter | Use |
|---|---|
task_id | Reuse the session and working directory from an earlier task. |
session_id / workdir | Supply both when resuming without a task ID. |
feedback / feedback_file | Provide actionable feedback or the path to a Markdown feedback file. |
model / reasoning_effort | Optional Codex model and reasoning overrides. |
{
"name": "codex_resume",
"arguments": {
"task_id": "task-a",
"feedback": "README.md: document the config path."
}
}{
"task_id": "task-a",
"round": 2,
"status": "completed",
"duration_seconds": 20.2,
"usage": {"input_tokens": 2400, "output_tokens": 600},
"rework_count": 1,
"total_duration_seconds": 58.7,
"total_usage": {"input_tokens": 6000, "output_tokens": 1500, "total_tokens": 7500},
"git": {
"branch": "codex/task-a",
"diff_stat": "README.md | 3 +++"
}
}Cite the file and line, include failing output, and say what should happen.
Record or update a user or reviewer’s rating, verdict, tags, or notes, or save the user’s verbatim first reply after a round. These reactions stay with the task and help you refine model and effort settings and improve the day-to-day workflow. Available to the model and Codex Monitor. Updates meta.json and syncs telemetry.jsonl, telemetry.csv, and report.md.
| Parameter | Use |
|---|---|
task_id | Required task ID. |
rating | Optional integer from 1 to 5. |
verdict | Optional. Choose accepted, rework, partial, rejected, abandoned. |
tags | Optional array of strings. |
notes | Optional freeform review notes. |
user_first_prompt | Optional verbatim first user reply after a round finishes. |
round | Optional positive integer. Defaults to the current round. |
{
"name": "codex_feedback",
"arguments": {
"task_id": "task-a",
"round": 2,
"rating": 5,
"verdict": "accepted",
"tags": [
"docs"
],
"notes": "The config path is clear now.",
"user_first_prompt": "Looks good, 5/5. The config path is clear now."
}
}{
"task_id": "task-a",
"feedback": {
"rating": 5,
"verdict": "accepted",
"tags": [
"docs"
],
"notes": "The config path is clear now.",
"updated_at": "2026-11-27T08:22:09Z",
"user_first_prompts": [
{
"round": 2,
"prompt": "Looks good, 5/5. The config path is clear now.",
"recorded_at": "2026-11-27T08:22:09Z"
}
]
},
"rework_count": 1,
"total_duration_seconds": 58.7,
"total_usage": {
"input_tokens": 6000,
"output_tokens": 1500,
"total_tokens": 7500
}
}Gemini automatically saves the first reply after presenting a round. Rate or annotate the task in Codex Monitor to add context for future dispatches.
Inspect a single task or list recent tasks. Use on explicit request or during post-mortem debugging.
| Parameter | Use |
|---|---|
task_id | Inspect one task, including recent events and stderr tail. |
limit | Limit the recent task list when task_id is omitted. Default: 20. |
{
"name": "codex_status",
"arguments": {
"task_id": "task-a"
}
}{
"task_id": "task-a",
"status": "running",
"alive": true,
"round": 1,
"last_event": "turn.started"
}Take one snapshot. The completion result arrives on its own.
Stop Codex and its child processes using a Windows Job Object or a macOS/Linux process group.
| Parameter | Use |
|---|---|
task_id | Required ID of the running task. |
{
"name": "codex_cancel",
"arguments": {
"task_id": "task-b"
}
}{
"task_id": "task-b",
"cancelled": true,
"message": "Terminated running Codex process."
}The process stops. Any changes it made stay in the checkout.
Remove a managed worktree after reviewing and merging its changes or deciding to discard them.
| Parameter | Use |
|---|---|
task_id | Required ID of the task that owns the managed worktree. |
delete_branch | Also remove the task’s branch. Default: false. |
force | Force worktree removal and branch deletion if requested. Can discard work. Default: false. |
{
"name": "codex_cleanup_worktree",
"arguments": {
"task_id": "task-a",
"delete_branch": true
}
}{
"task_id": "task-a",
"cleaned": true,
"branch_deleted": true
}Merge accepted changes before removing the worktree.
Open Codex Monitor in the Antigravity App side panel or full-page view, or read the structured snapshot. Tasks has a live section and collapsible By Project groups for settled tasks, newest first by finish time. Cards show effective model and effort pills and show concise failure reasons when available. The server stores extracted reasons in error_summary and surfaces them in latest_activity. Open the session detail sheet for configuration, runtime, prompt history, and activity, with expanded prompt and stream views. Cancel live tasks or enter a rating, verdict, and notes inline.
Analytics shows overall KPIs and a Model × Reasoning Effort matrix. Use outcomes and ratings from past dispatches to compare settings for real work and choose a configuration for the next task. The KPIs and matrix exclude failed tasks.
For each setting, the server checks the current rollout’s turn_context, an explicit dispatch or resume override, the previous round, project .codex/config.toml, then user ~/.codex/config.toml (or $CODEX_HOME/config.toml).
| Parameter | Use |
|---|---|
task_id | Optional ID of the task to select. |
limit | Optional cap on the number of tasks listed. Use a non-negative integer. Default is 20. |
include_detail | Optional boolean, default false. With task_id, true returns task_detail with prompt history and the activity stream across rounds, trimmed to fit the response size budget. |
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "codex_monitor",
"arguments": {"task_id": "task-a", "limit": 5, "include_detail": true}
}
}{
"structuredContent": {
"active_count": 0,
"selected_task": {
"task_id": "task-a",
"status": "completed",
"effective_model": "gpt-6.2-sol",
"effective_reasoning_effort": "high",
"elapsed_seconds": 20.2,
"latest_activity": {
"kind": "report",
"text": "Documented the CLI and config path."
}
},
"task_detail": {
"task_id": "task-a"
},
"analytics": {
"overall": {
"task_count": 1,
"total_tokens": 7500
},
"by_model_effort": [
{
"model": "gpt-6.2-sol",
"reasoning_effort": "high",
"task_count": 1
}
]
},
"telemetry_dir": "~/.gemini/codex-castor"
}
}Codex Monitor refreshes via tools/call every 1s when any task is active or the selected task is live, and every 8s when idle, at zero LLM tokens.
Folio V · Tabula IV
Each managed task runs in a Git checkout on its own branch. The ledger saves specs, feedback, events, stderr, and reports by round. Castor syncs dispatch history and user feedback across telemetry.jsonl, telemetry.csv, and report.md to guide future model and reasoning settings and improve the workflow with use.
stderr-r1.log and, after rework starts, feedback-r2.md and the second round’s files. Set CODEX_CASTOR_STATE_DIR to move the runtime root and CODEX_BIN to select the local Codex executable.The server reads live model and effort from rollouts, records activity in meta.json, sends opt-in MCP progress and log notifications, and extracts concise failure summaries. The telemetry module locks updates and syncs JSONL, CSV, and Markdown exports. Failed tasks are excluded from aggregated statistics. The schema defines the six-field report. The MCP App at ui://codex-castor/monitor.html offers Tasks and Analytics views with inline feedback on task cards.
The architect’s procedure covers self-contained specs and independent review. Look up current models in ~/.codex/models_cache.json and route explicitly with model and reasoning_effort. Report telemetry at acceptance and record the first user reply to each presented round automatically.
Role division, MCP registration, and background settings for seven tools. Prefix the dispatch or resume toolSummary with [<model>·<effort>] and record the first user reply with codex_feedback.
The installer and Doctor cover the telemetry module and analytics CLI, and Doctor verifies the MCP handshake. Use python3 scripts/analytics.py summary with --model, --effort, --project, or --since to filter the totals and recent tasks. Use backfill to rebuild the ledger, feedback to record evaluations or first replies, and export to write Markdown or CSV. Run the tests, follow terminal events with --follow, or see active tasks in the Antigravity CLI status bar.
Folio VI · Tabula V
Requires Python 3.9+, Git, a configured local Codex CLI, and Antigravity. Run these commands from your terminal.
Clone the repository and run the installer for your operating system. Add --install-statusline to show active tasks below Antigravity CLI’s built-in status bar. Reload Antigravity afterward.
macOS and Linux
git clone https://github.com/JAY201368/codex-castor.git && cd codex-castor && ./scripts/install.sh
Windows 11 x64 · PowerShell
git clone https://github.com/JAY201368/codex-castor.git
Set-Location codex-castor
py -3 scripts/install.py
From the clone, check the installed configuration and run an MCP stdio handshake. On Windows run py -3 scripts/doctor.py.
python3 scripts/doctor.py
Remove the installer-managed integration. On Windows run py -3 scripts/install.py --uninstall. Add --purge-state if you also want to remove saved Castor state.
python3 scripts/install.py --uninstall