Skip to main content
Glama

Cheap Agent for Codex

A standalone Codex integration for Cheap Agent. Codex plans and handles recovery; cheaper worker models perform research and implementation in isolated git worktrees. Successful changes land uncommitted for review.

What is included

  • MCP tools for delegation, research, job progress, blocked-job replies, and landing.

  • Six Codex skills: $cheapag, $cheapag-plan, $cheapag-status, $cheapag-clean, $cheapag-hook, and $cheapag-allow.

  • Codex lifecycle and tool hooks, including native apply_patch support and per-turn recovery budgets.

  • Install, diagnostics, and uninstall commands that preserve existing MCP servers, hooks, and user-edited skills.

  • The upstream worker, verification, model routing, cost limits, and cleanup engine.

Related MCP server: cc-delegate

Quick start

Requires Git and Node.js 20.11 or newer; Node 22+ is recommended with current Codex releases.

npm ci
npm run build
node dist/index.js codex install

Restart Codex and review the Cheap Agent hooks in its Hooks settings. The installer never grants itself trust. It respects CODEX_HOME and defaults to ~/.codex.

Set up your worker provider from your own terminal:

node dist/index.js codex login

The login flow accepts the API key through hidden terminal input and makes a tiny paid connectivity check. Do not paste keys into a chat. OpenCode Go, OpenRouter and DeepSeek are supported by the upstream engine.

Before sending a repository's code to the worker, review its provider and model route and personally grant consent from that repository:

node /absolute/path/to/cheap-agent-codex/dist/index.js allow
# Optional restrictions:
node /absolute/path/to/cheap-agent-codex/dist/index.js allow --zdr-only
node /absolute/path/to/cheap-agent-codex/dist/index.js allow --models provider/model

Then ask Codex to use $cheapag for a task. Installed skills contain the exact CLI path, so a global install is unnecessary. Keep this checkout in place after installation.

Commands

node dist/index.js codex doctor
node dist/index.js codex status
node dist/index.js codex hook on
node dist/index.js codex hook off
node dist/index.js codex clean
node dist/index.js codex uninstall

The edit guard is optional and off by default. It encourages delegation; it is not a security sandbox. External workers have their own permissions, and local command hooks require a compatible local Codex environment. See CODEX.md for behavior, consent, backups, removal, and limitations.

Development

npm run typecheck
npm test -- --maxWorkers=4
npm pack

The suite includes isolated worker simulations and a full delegated worktree/verification/landing cycle. The Codex port was validated with 395 passing tests and 5 skipped, plus the real Codex configuration parser. Live paid model inference requires separate credentials and repository consent.

This repository is marked private in package.json to prevent accidental npm publication. Local packaging with npm pack remains available. The inherited cheapag executable is retained for compatibility; this port is not the public cheap-agent npm release.

Attribution

Based on Cheap Agent 1.2.5 by muaaz9329, upstream commit abe39a81f7e73a55f17493695d1138a98c7bce4c. The original MIT LICENSE and an upstream README snapshot are retained. Codex integration details are documented in CODEX.md.

Available Tools

6 tools
delegateA

Make any code change: use this for every edit, including small, mechanical, "quick" or multi-file ones; those are exactly what the cheap worker is for, and your tokens cost the user far more than its. One call: task = what to change, which files, how to check. The worker edits an isolated worktree, runs the checks, and lands an OK result (uncommitted) in your working tree; read the result block instead of re-checking. Pass difficulty, rated from the issue as the time an engineer new to the code needs to fix and test it: easy < 15 min, medium < 1 h, hard > 1 h. For multi-step work pass plan + steps instead of task. Plan format: one "# " line, then per step a "## " heading followed by "files: ", "do: ", "done-when: " (optional "dont:", "needs: ", "difficulty: easy|medium|hard"), each key at the start of its line, not a bullet. In done-when, backticked text is run as a shell command that must succeed; put only commands in backticks.

NameRequiredDescriptionDefault
noteNoExtra guidance for this run, at most 300 characters
planNoInstead of task: plan file path, relative to the repository root
taskNoThe change in plain words: what to change, which files, how to check. One step, no plan file needed
waitNoDefault true: return when every group settles or one is BLOCKED. false: return RUNNING at once; then jobs(action="wait")
briefNoA research result to start from: its id (e.g. r5k2q) or its text. The worker gets it instead of re-exploring
filesNoWith task: files or directories it touches, comma-separated (default: the whole repo)
stepsNoWith plan: "3" one step, "3-5" a range in one job, "1-2,3,4" comma-separated groups, each its own job, run in parallel unless files overlap or needs: orders them
sourceNoThe user's request or the issue text, verbatim, or the repo-relative path of a file holding it. The worker checks the task against it and reports where they disagree
done_whenNoWith task: how to check it; `backticked` shell commands must succeed (default: the repo's tests)
difficultyNoTime an engineer new to the code needs: easy < 15 min, medium < 1 h, hard > 1 h. Picks the worker model; a plan step's difficulty: wins

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description fully carries the burden: it discloses the isolated-worktree execution model, that checks are run, that the result lands uncommitted in the caller's tree, that the agent should read the result block instead of re-checking, and the BLOCKED/RUNNING settling behavior. That covers exactly the traits an agent needs before invoking a mutating tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

No filler sentences and the most important rule is first, but it is packed into long semicolon-chained sentences, and the dense inline plan-format spec is harder to scan than a short bulleted block would be.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 10-parameter mutating tool with no annotations and no output schema, the description covers execution model, return semantics ('result block'), and the full plan/steps protocol. It stops short of describing what a landed result or a BLOCKED group actually looks like, and says nothing about permission or conflict handling.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the 3 baseline is already met; the description goes further by specifying the plan file format (heading, files/do/done-when keys, needs:, dont:), the difficulty bucketing, the steps grouping grammar ('3-5', '1-2,3'), and that backticked done-when text is executed as a shell command. Minor deduction for not clarifying note/brief/source interaction with each other.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and scope: 'Make any code change' and explicitly extends it to small, mechanical, and multi-file edits, which implicitly separates it from research/land siblings. An agent can tell this is the general edit-delegation tool without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit rule ('use this for every edit') plus the rationale (cheap worker vs. expensive orchestrator tokens), and names the branching condition: use plan + steps instead of task for multi-step work. It also names jobs(action="wait") as the follow-up when wait=false.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

jobsA

List jobs, show a job's last result block again, wait for a job or batch to settle, or cancel a running job (keeps its worktree).

NameRequiredDescriptionDefault
jobNoJob id, e.g. j7f3a (show, wait, cancel), or batch id, e.g. b4k1x (wait)
actionYeslist: one line per job; show: a job's last block; wait: block until the job's or batch's next result, then return it; cancel: stop a running job

TDQS

A3.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden, and it does disclose two genuinely useful traits: cancel preserves the worktree (a non-obvious side effect) and wait blocks until settlement (a latency trait). It says nothing about whether cancel is otherwise irreversible, whether wait can time out or hang indefinitely, or what state changes show/list cause.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single sentence with each clause mapping to exactly one action, and the non-obvious detail (worktree retention) placed in a parenthetical rather than buried. It is dense but every clause earns its place; no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 2-parameter multi-action tool with no annotations and no output schema, the description covers all four modes and the batch variant, and flags the one destructive-adjacent nuance. The remaining gap is that nothing explains which action is the common/default one or what list and show actually return in shape.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and the action enum already documents all four modes plus the job-vs-batch id distinction, so the schema does the heavy lifting. The description adds only marginal value beyond it — the word 'again' for show and 'batch' for wait — which matches the baseline 3 for high-coverage schemas.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description enumerates four concrete verb+resource operations (list jobs, show last result block, wait for settle, cancel) rather than restating the name, so an agent immediately knows the tool is a multi-action job control surface. It does not, however, distinguish itself from siblings like delegate or land, so an agent must infer that this tool observes/controls jobs while delegate presumably creates them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Each action clause implies a situation ('wait for a job or batch to settle', 'cancel a running job'), which gives implied usage guidance per action. But there is no explicit when-to-use-this-vs-alternative routing (e.g. 'use delegate to start a job, then jobs to wait on it'), and no stated exclusions or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

landA

Land or discard finished jobs that did not land (PARTIAL, FAIL, CONFLICT…). apply: 3-way applies a job's worktree changes to your working tree, uncommitted (a conflict leaves the tree untouched); discard: deletes its worktree. One line per job.

NameRequiredDescriptionDefault
jobYesJob id, or several comma-separated in landing order, e.g. "j3d55" or "j3d54,j3d55" (apply stops at the first that fails)
actionYesapply: land the job's changes; discard: delete its worktree

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the behavioral burden and does well: it discloses that apply is a 3-way application, leaves changes uncommitted, and leaves the tree untouched on conflict, while discard deletes the worktree. It could go further on irreversibility or permissions, but the key side effects are disclosed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

It is three tight sentences with the core scope and action behavior front-loaded. Every clause adds information, and there is no redundant restatement of the tool name.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a two-parameter tool with no output schema, the description covers the action semantics, conflict behavior, multi-job handling implied by 'one line per job,' and the relevant job statuses. An agent has enough context to invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already documents both parameters including the comma-separated job format and action enum meanings. The description adds little parameter-specific detail beyond the schema, so the baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb+resource ('Land or discard finished jobs') and scopes it to jobs that did not land, naming example statuses (PARTIAL, FAIL, CONFLICT). This clearly separates the tool from unrelated siblings such as reply, jobs, and delegate.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It clearly implies when the tool applies: finished jobs that did not land, with statuses given as examples. It also explains the two actions enough to choose between them, though it does not explicitly name alternatives or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

pingA

Check that the Cheap Agent server is running and report its version.

NameRequiredDescriptionDefault

No parameters

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the burden, and it does reasonably well: it discloses that the call verifies server availability and returns version information, implying a side-effect-free read. It does not state failure behavior (e.g. what happens if the server is down) or auth requirements, keeping it just short of a 5.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single, front-loaded sentence with no wasted words that conveys both the action and the returned information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a trivial no-parameter health check with no output schema, the description covers purpose and the key return value (version). Minor gaps: no mention of error/timeout behavior if the server is unreachable.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool takes zero parameters, so there is nothing for the description to clarify; the baseline for a no-parameter tool applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: checks that the Cheap Agent server is running and reports its version. This is unambiguous and clearly distinct from siblings like reply, jobs, and delegate.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The intended use (a health/connectivity check) is strongly implied by 'ping' and 'check that the server is running,' but the description never explicitly says when to use it versus alternatives or when not to call it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

replyA

Answer a BLOCKED job's question and resume its worker in the same session. Returns the job's next result block (OK, FAIL, or BLOCKED again); for a job in a batch, the batch block at its next settlement.

NameRequiredDescriptionDefault
jobYesThe BLOCKED job id, e.g. "j6a90"
answerYesAn option letter (a-d), or a short free-text answer; for several numbered questions, one answer each: "1a, 2b" or "1a, 2: use redis"

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden well: it discloses that the worker resumes in the same session and describes the return (OK, FAIL, or BLOCKED again), plus batch settlement behavior. Lacks details like auth or idempotency but is solid for a reply action.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two dense sentences, front-loaded with the action and followed by return semantics. Zero waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, yet the description explains the return block variants, which is exactly the missing context. Complete enough for a two-param action tool, though batch edge cases could be elaborated slightly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so both parameters (job, answer) including the answer format examples are already documented. The description adds no param meaning beyond the schema; baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Specific verb+resource: answers a BLOCKED job's question and resumes its worker. The BLOCKED-state scoping clearly distinguishes it from sibling job-management tools like jobs, land, and delegate.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The BLOCKED precondition makes the trigger condition clear, and the return semantics hint at follow-up states. It doesn't explicitly name alternatives among siblings, but the state gate is strong context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

researchA

Find and explain code in this repository: asks the cheap read-only research worker a question (it reads the working tree, uncommitted changes included). Returns a short answer with path:line refs and a confidence; verify low-confidence answers before acting.

NameRequiredDescriptionDefault
pathsNoComma-separated repo-relative paths to limit the search to, e.g. "src/auth, src/app.ts"
questionYesThe question, e.g. where is JWT validated and how are expiry errors mapped?
max_wordsNoAnswer length cap in words; default 200, at most 600

TDQS

A3.7/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description does real work: it declares the operation read-only, notes it is cheap, discloses data freshness ("reads the working tree, uncommitted changes included"), and describes the return shape with path:line refs and a confidence value. The remaining gap is latency/rate expectations and any limits on the number of distinct searches.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core purpose, then the mechanism, then the return contract and a caution — a sensible ordering with almost no filler. The parenthetical about the working tree slightly interrupts the sentence flow but still earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema and no annotations, the description covers what an agent actually needs: side-effect profile, tree freshness, return shape, and a reliability caveat. Cost and latency expectations for the "research worker" are the only meaningful omission.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the three parameters are already fully documented in the schema itself. The description adds only that a question is asked and that answers are short, without clarifying how `paths` scoping or `max_words` cap interact with the reported confidence. Baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb+resource ("Find and explain code in this repository") and clarifies the mechanism (a read-only research worker answering a question). An agent can tell this is a code-lookup tool rather than a generic action tool, though it never contrasts itself with the ambiguously named `delegate` or `jobs` siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Use is implied by "find and explain code" and the closing instruction to "verify low-confidence answers before acting," which gives useful follow-up behavior. However there is no explicit when-not-to-use or which sibling to pick for adjacent tasks, leaving the agent to infer routing against `delegate`.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 6 tool updatesv1.2.5
    • First observeddelegate
    • First observedjobs
    • First observedland
    • First observedping
    • First observedreply
    • First observedresearch

TDQS

A4.1/5.0

Scored across 6 tools

Disambiguation4/5

Each tool has a mostly distinct role: delegate creates work, reply unblocks existing work, jobs manages job state, land finalizes worktrees, research queries code, and ping checks health. There is some overlap because delegate, reply, and jobs can all return result blocks, but the descriptions make the intended entry points reasonably clear.

Naming Consistency4/5

All names are short, lowercase, single-word commands, giving a consistent CLI-like style. The only notable deviation is 'jobs' as a plural noun while the others are mostly verbs, but the set remains predictable and readable.

Tool Count5/5

Six tools is well-scoped for an asynchronous coding-worker orchestration server. Each tool covers a distinct lifecycle area, and none feels redundant or merely decorative.

Completeness5/5

The surface covers the full worker lifecycle: delegate work, research code, monitor/wait/cancel jobs, reply to blocked jobs, land or discard finished work, and health-check the server. No obvious dead ends are apparent for the stated purpose.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    Delegates heavy development tasks from a supervisor to an autonomous worker on a cheaper model via MCP, with isolated git worktrees and provider-agnostic support.
    3
    1
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Orchestrates multiple coding agents at once so an MCP client can delegate implementation work while retaining judgment: each agent runs in its own isolated git worktree and branch, claims the files it edits, and communicates via a mailbox and shared board. Supports blocking questions to the orchestrator, Codex-written acceptance tests locked before workers start, scope validation, and reporting on first-pass success.
    Apache 2.0