Skip to main content
Glama

Codex Work Window MCP

Turn quota limits into governed work windows.

Codex Work Window MCP treats the Codex 5-hour allowance as a capacity-planning constraint rather than an interruption. The server plans bounded work segments, keeps a reserve, requires checkpoints at the right time, and creates a precise resume contract for long-running jobs.

This project does not bypass, increase, spoof or manipulate Codex quota. It only plans work around capacity reported by an approved quota provider.

Product idea

Quota capacity
     │
     ▼
Work Window
     │
     ├── Segment A ── checkpoint
     ├── Segment B ── checkpoint
     └── PARK
           │
         reset
           │
           ▼
      Resume Contract
           │
           ▼
       Segment C

The useful abstraction is not “how much quota is left?” It is:

What is the largest safe piece of work that should start now, what reserve must remain, and exactly where should the job resume if capacity runs out?

Related MCP server: Codex Claude Code MCP

MCP tools

Tool

Purpose

window_plan

Convert current capacity into a bounded segment admission.

checkpoint_save

Store a concise handoff: completed, pending, risks, next safe action.

resume_contract

Reconstruct the first safe action and stop conditions before resuming.

Why this is different

Codex Work Window is designed around five operating concepts:

  1. Reserve — never plan to consume the final percentage of capacity.

  2. Segments — large jobs are admitted in bounded slices, not as one mega-run.

  3. Job class — long/high-risk jobs receive shorter admitted segments.

  4. Checkpoint quality — every checkpoint must name the next safe action.

  5. Provider isolation — Codex quota-reading logic is isolated from the planner, reducing breakage if the host interface changes.

Status

v0.2.0 includes the foundation policy engine plus a read-only live Codex app-server quota provider.

The policy engine, local state, MCP contract and live quota provider are implemented. The manual provider remains available for CI, tests and controlled simulation without requiring Codex.

The read-only codex app-server provider is implemented behind the QuotaProvider interface and has been validated on macOS.

Requirements

  • Node.js 22.13+

  • npm

Install for development

npm install
npm run check

Run a safe local demo

WORK_WINDOW_QUOTA_PERCENT=58 npm run demo

Optional reset time:

WORK_WINDOW_QUOTA_PERCENT=18 \
WORK_WINDOW_RESET_AT="2026-09-06T13:00:00+08:00" \
npm run demo

Run as an MCP server

Build first:

npm run build

Then point your MCP client to:

node /absolute/path/to/codex-work-window-mcp/dist/index.js

Manual mode uses WORK_WINDOW_QUOTA_PERCENT; live mode uses the read-only Codex app-server provider. Do not present manual-provider values as real Codex readings.

Default policy

hard stop      8%
reserve       12%
caution       22%
cold segment  15 min
max segment   45 min
plan horizon  90 min
snapshot TTL  90 sec

These are conservative development defaults, not claims about OpenAI's own quota policy. They are user-side planning controls and can be made configurable later.

Example: long ONZKO-style implementation job

Objective: refactor a WordPress integration module
Requested: 60 min
Quota: 58%
Job class: long

Work Window returns:
- OPEN
- admitted segment: bounded by forecast/policy
- reserve: 12%
- checkpoint required: yes
- validUntil: short-lived admission deadline

Before the segment ends:
- commit or leave a clean reversible state
- run the relevant tests
- call checkpoint_save
- state the exact next safe action

Safety principles

  • No credential collection.

  • No direct Codex authentication-file reading.

  • No daemon or background service.

  • No automatic purchases or quota-reset purchases.

  • No destructive resume action without separate authorisation.

  • Local state is stored per workspace under .work-window/ with restrictive file modes where supported.

See docs/SECURITY.md.

Roadmap

See docs/ROADMAP.md.

Attribution

This project is inspired by the problem and workflow explored by valentine-89/codex-quota-guard-mcp, an MIT-licensed project by Val89. See NOTICE.md.

Licence

MIT. See LICENSE.

Available Tools

3 tools
checkpoint_saveB

Save a bounded, redacted handoff state for deterministic resume.

ParametersJSON Schema
NameRequiredDescriptionDefault
jobIdYes
pendingYes
lastTestNo
completedYes
gitStatusNo
objectiveYes
riskNotesNo
workspaceRootYes
nextSafeActionYes

TDQS

B3.3/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 behavioral burden. It does disclose that the saved state is 'bounded' and 'redacted', signaling that not all workspace data is persisted. However, it does not mention overwrite behavior, storage semantics, failure behavior, or side effects.

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 sentence with no filler, front-loading the action and the key characteristics of the state being saved. Every phrase earns its place.

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

Completeness2/5

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

Given nine parameters, six required fields, no annotations, and no output schema, one sentence is not enough. Missing are return values, overwrite semantics, how the state relates to resume_contract, and guidance on what 'bounded' and 'redacted' impose on callers.

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

Parameters1/5

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

Schema description coverage is 0%, and the description names none of the nine parameters. 'Handoff state' is generic and does not clarify the roles of required fields such as jobId, completed, pending, and nextSafeAction. The description fails to compensate for the schema's lack of parameter explanations.

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 uses a specific verb ('Save') and a clearly defined resource ('bounded, redacted handoff state'). The phrase 'for deterministic resume' distinguishes it from sibling tools like resume_contract, which presumably consumes such a state.

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 purpose phrase 'for deterministic resume' implies this tool is used when persisting a checkpoint before a resume or handoff. However, there are no explicit when-to-use or when-not-to-use instructions, nor alternatives compared against window_plan or resume_contract.

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

resume_contractC

Prepare a resume contract from the last checkpoint and current capacity.

ParametersJSON Schema
NameRequiredDescriptionDefault
jobIdYes
workspaceRootYes

TDQS

C2.4/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It says only that a contract is 'prepared' and gives no information about side effects, persistence, required permissions, or whether the operation is read-only or mutating. This is a significant gap for a tool whose name suggests it may alter a workflow state.

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

Conciseness3/5

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

The description is a single, front-loaded sentence with no filler words, so it is concise. However, it is so sparse that it omits information essential for correct invocation, making it under-specified rather than efficiently complete.

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

Completeness2/5

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

For a tool with no annotations, no output schema, and 0% schema coverage, the description is incomplete. It gives a hint about the source data ('last checkpoint', 'current capacity') but says nothing about return values, side effects, or prerequisites, leaving an agent unable to confidently call it.

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

Parameters2/5

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

Schema coverage is 0%, and the description does not map 'workspaceRoot' or 'jobId' to the mentioned 'last checkpoint' or 'current capacity'. The description adds only a vague contextual hint and fails to explain what each parameter actually means or how to populate it.

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

Purpose3/5

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

The description uses the verb 'Prepare' with a resource ('resume contract') and names two inputs ('last checkpoint', 'current capacity'), so it is not a tautology. However, 'resume contract' is never defined, and no distinction is drawn between this tool and its siblings, leaving its exact purpose somewhat vague.

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

Usage Guidelines2/5

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

The description implies a use case ('from the last checkpoint and current capacity') but gives no explicit when-to-use guidance and no mention of alternatives like window_plan or checkpoint_save. An agent must infer when this tool is appropriate rather than being told.

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

window_planC

Turn current quota into a bounded work segment with reserve and checkpoint rules.

ParametersJSON Schema
NameRequiredDescriptionDefault
jobClassNomedium
workspaceRootYes
requestedMinutesNo

TDQS

C2.8/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. 'Turn current quota into a bounded work segment' hints at a transformation or planning operation, but it does not disclose whether this mutates state, creates files, requires permissions, or is reversible. The mention of 'reserve and checkpoint rules' adds context but not enough detail.

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?

The description is a single concise sentence with no filler. It is front-loaded with the core action and outcome. However, its brevity comes at the cost of key details, so it is efficient but not fully substantive.

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

Completeness2/5

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

The tool has 3 parameters, no output schema, and no annotations, so the description alone must provide complete context. It does not explain what 'bounded work segment' means, how reserve rules work, what checkpoint rules entail, or how jobClass and requestedMinutes affect the plan. This is insufficient for an agent to invoke the tool correctly.

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

Parameters1/5

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

Schema description coverage is 0%, and the description does not explain any of the parameters (workspaceRoot, jobClass, requestedMinutes). The terms 'quota' and 'reserve' indirectly relate to requestedMinutes and reserve rules, but no parameter meanings or usage details are provided. The description fails to compensate for the schema's lack of documentation.

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 uses a specific verb ('Turn') and resource ('current quota') to convey that this tool creates a bounded work segment with reserve and checkpoint rules. It is distinct enough from siblings like checkpoint_save and resume_contract, though it does not explicitly name them for differentiation.

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?

Usage context is implied through phrases like 'current quota' and 'bounded work segment', suggesting it is used when planning a work window. However, there is no explicit guidance about when to prefer this tool over checkpoint_save or resume_contract, nor any exclusions or prerequisites.

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. 3 tool updatesv0.2.0
    • First observedcheckpoint_save
    • First observedresume_contract
    • First observedwindow_plan

TDQS

B3.2/5.0

Scored across 3 tools

Disambiguation5/5

Each tool targets a distinct phase of the work-window lifecycle: planning rules, saving state, and preparing a resume contract. There is no functional overlap or ambiguity about which tool to call.

Naming Consistency4/5

All names use a two-word underscore convention and clearly describe their action, but the pattern is mixed: window_plan and checkpoint_save are noun-verb while resume_contract is verb-noun. This is a minor deviation from a strictly consistent verb_noun scheme.

Tool Count5/5

Three tools is well-scoped for a focused workflow around planning, saving, and resuming work windows. Each tool earns a clear place; nothing feels redundant or missing at the surface level.

Completeness4/5

The set covers the core lifecycle of a work window: planning, checkpointing, and resuming. Minor gaps exist such as an explicit finalize/cancel action, but agents can work around those by planning a new window or not resuming.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers