Skip to content

About

No description, website, or topics provided.

Resources

Contributing

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

Bounded Batch

An experimental Codex skill for bounded, auditable concurrency across independent tool operations.

Status: Experimental License: MIT Dependencies: Standard library

Bounded Batch asks Codex to stop treating every independent inspection as a separate model–tool–model round trip when those inspections can be safely collected together.

It is deliberately conservative. It does not say “parallelize everything.” It says:

Identify one bounded investigation stage, batch only the operations whose inputs are already known and independent, preserve every result and failure, then return to adaptive reasoning.


Experimental status

This project is a testable mitigation hypothesis, not a proven optimization guarantee.

Community testing has suggested that explicit tool batching may reduce repeated context processing and outer model cycles in some GPT-5.6 Sol/Codex workloads. Those observations are technically plausible, especially for read-heavy repository investigations, but published percentage claims remain provisional and may be confounded by output truncation, workload differences, product changes, or incomplete knowledge of internal usage accounting.

Bounded Batch therefore makes no promise about:

  • token savings;
  • cached-input savings;
  • Codex credits or allowance usage;
  • wall-clock speed;
  • rate limits;
  • output quality;
  • internal model scheduling.

The skill must earn those claims through controlled evaluation. Correctness and complete evidence come first.


What problem is this testing?

A tool-using coding agent often works like this:

model → inspect A → model → inspect B → model → inspect C → model

When A, B, and C are independent and already known, a bounded alternative is:

model → inspect A + B + C concurrently → model

The potential benefit is not simply “parallel commands are faster.” Fewer outer reasoning cycles may mean less repeated processing of an increasingly large conversation and repository context.

The potential cost is equally important: an overly aggressive batch can retrieve unnecessary data, exceed output limits, hide partial failures, or execute operations that an earlier result would have made irrelevant.

Bounded Batch exists to test whether the useful middle ground can be made repeatable.


Design principles

Principle Practical meaning
Bounded, not maximal Concurrency, output, scope, and timeouts must be explicit.
Known work only Do not speculate ten future searches merely because they can run together.
Independence before concurrency If one result defines the next input, remain sequential.
Read broadly, write deliberately Read-only inspection is the primary target; overlapping writes are excluded.
Every result remains attributable Each output keeps its operation ID, input, status, errors, duration, and truncation state.
Truncation is failure, not success Incomplete evidence must be repartitioned, not interpreted optimistically.
Correctness before efficiency A cheaper wrong answer is not an optimization.
Claims require traces No percentage claim without controlled, inspectable measurements.

When the skill should activate

Good candidates include:

  • repository familiarization across several known areas;
  • impact analysis for a concept or API used in many files;
  • architecture or dependency discovery;
  • gathering several independent diagnostics;
  • comparing multiple known configuration files;
  • collecting bounded evidence before a review;
  • read-heavy audits with clearly separable queries.

Poor candidates include:

  • edit → test → diagnose → edit loops;
  • exploratory debugging where each result changes the next command;
  • migrations, deployments, Git history rewrites, or database mutations;
  • commands that require separate approval;
  • operations writing to overlapping files or shared state;
  • unbounded logs, generated files, or recursive output;
  • tasks requiring only one or two small inspections.

The complete gate is in SKILL.md. A more detailed decision table is in references/decision-matrix.md.


Package structure

bounded-batch/
├── SKILL.md                       Codex-facing workflow and routing boundary
├── README.md                      Full rationale, caveats, and usage
├── AGENTS.snippet.md              Optional global routing instruction
├── agents/
│   └── openai.yaml                Display and invocation metadata
├── scripts/
│   ├── batch_ops.py               Optional deterministic subprocess batcher
│   └── validate_package.py        Local package validation
├── examples/
│   └── manifest.json              Example helper manifest
├── references/
│   ├── decision-matrix.md         Batch-versus-sequential decision guide
│   ├── measurement-protocol.md    Controlled A/B testing protocol
│   └── threat-model.md            Safety and trust boundaries
├── evals/
│   ├── README.md                  Evaluation workflow
│   ├── prompts.csv                Trigger and negative-control cases
│   ├── result-template.csv        Comparable run metrics
│   └── trace_metrics.py           Best-effort Codex JSONL summarizer
├── tests/
│   └── test_batch_ops.py          Standard-library unit tests
├── CONTRIBUTING.md                Contribution process
├── CHANGELOG.md                   Version history
├── SECURITY.md                    Security reporting and limitations
└── LICENSE                        MIT license

Why keep SKILL.md concise?

Codex initially sees skill metadata and loads the full SKILL.md only after selecting the skill. Supporting explanation, examples, and evaluation materials therefore live outside the active workflow. This keeps the loaded instructions focused while retaining full public transparency.


Installation

User-wide installation

Extract or clone the folder so the final path is:

$HOME/.agents/skills/bounded-batch/SKILL.md

On macOS or Linux:

mkdir -p "$HOME/.agents/skills"
cp -R bounded-batch "$HOME/.agents/skills/bounded-batch"

On Windows PowerShell:

New-Item -ItemType Directory -Force "$HOME\.agents\skills" | Out-Null
Copy-Item -Recurse -Force ".\bounded-batch" "$HOME\.agents\skills\bounded-batch"

Repository-scoped installation

Place the folder at:

<repository>/.agents/skills/bounded-batch/SKILL.md

Repository scope is preferable when a team wants to version and review the skill alongside the codebase.

Codex detects skill changes automatically in current documentation. Restart Codex when a newly installed or updated skill does not appear.


Invocation

Explicit invocation is the most deterministic:

Use $bounded-batch to inspect the repository areas affected by the new authorization model.

Codex may also invoke it implicitly when the task matches the front-loaded description in SKILL.md.

For more reliable routing across all repositories, copy the short rule from AGENTS.snippet.md into your global ~/.codex/AGENTS.md. Keep that global rule small; the detailed procedure belongs in the skill.

Example prompt

Use $bounded-batch to determine every file affected by replacing the legacy
policy authority model. Gather independent read-only evidence first, preserve
paths and line references, bound all outputs, and switch to sequential work
before making edits.

The full process

┌─────────────────────────────────────────────────────────────┐
│ 1. Define one evidence question                             │
│    “Which files and concepts are affected?”                 │
└──────────────────────────┬──────────────────────────────────┘
                           │
                           ▼
┌─────────────────────────────────────────────────────────────┐
│ 2. Identify already-known operations                        │
│    Search symbols · inspect manifests · read fixed ranges   │
└──────────────────────────┬──────────────────────────────────┘
                           │
                           ▼
┌─────────────────────────────────────────────────────────────┐
│ 3. Prove independence                                       │
│    No operation needs another result to define its input    │
└──────────────────────────┬──────────────────────────────────┘
                           │
                           ▼
┌─────────────────────────────────────────────────────────────┐
│ 4. Set limits                                               │
│    Count · concurrency · bytes · ranges · timeouts          │
└──────────────────────────┬──────────────────────────────────┘
                           │
                           ▼
┌─────────────────────────────────────────────────────────────┐
│ 5. Execute concurrently                                     │
│    Prefer native structured concurrency; helper is optional │
└──────────────────────────┬──────────────────────────────────┘
                           │
                           ▼
┌─────────────────────────────────────────────────────────────┐
│ 6. Verify completeness                                      │
│    Failures explicit · no hidden truncation · evidence tied │
└──────────────────────────┬──────────────────────────────────┘
                           │
                           ▼
┌─────────────────────────────────────────────────────────────┐
│ 7. Reason and adapt                                         │
│    Stop, run another bounded stage, or become sequential    │
└─────────────────────────────────────────────────────────────┘

The central distinction is between concurrency inside a reasoning stage and parallelizing the reasoning itself. The skill batches evidence collection only when the reasoning required to formulate those operations has already happened.


Optional helper

scripts/batch_ops.py is a standard-library Python utility for deterministic local subprocess batching.

It accepts a JSON manifest containing argument arrays:

{
  "version": 1,
  "max_workers": 4,
  "max_total_output_bytes": 80000,
  "operations": [
    {
      "id": "status",
      "argv": ["git", "status", "--short"],
      "timeout_seconds": 20,
      "max_output_bytes": 12000
    },
    {
      "id": "policy-references",
      "argv": ["rg", "-n", "PolicyAuthority|MaintainerAuthority", "src", "docs"],
      "timeout_seconds": 20,
      "max_output_bytes": 30000
    }
  ]
}

Run it with:

python scripts/batch_ops.py examples/manifest.json --pretty

Helper guarantees

The helper:

  • uses subprocess argument arrays with shell=False;
  • executes operations concurrently with a fixed worker limit;
  • captures stdout and stderr separately;
  • applies per-operation and total output limits;
  • reports timeouts, exit codes, rejections, and truncation explicitly;
  • emits one structured JSON document;
  • requires no third-party Python packages;
  • performs no network calls or telemetry itself.

Helper non-guarantees

The helper is not:

  • a sandbox;
  • a proof that a command is read-only;
  • a replacement for Codex approvals or environment restrictions;
  • a guarantee that child processes terminate instantly after timeout;
  • a direct implementation of Codex's internal programmatic tool calling;
  • evidence that usage was reduced.

Its strict policy rejects unsupported executables and limits git to selected read-only subcommands. The allowlist is intentionally narrow and currently favors common Unix-like inspection tools plus Git; Windows users can still use the Git subset, rely on Codex's native tools, or extend the policy through reviewed contributions. The policy remains incomplete. --policy off exists for controlled testing, but using it transfers command-safety responsibility to the operator.


Caveats and failure modes

1. Output truncation can imitate efficiency

A run that returns less evidence may consume less output while also being incomplete. Every operation therefore carries a truncation flag, and the skill requires smaller follow-up partitions when truncation occurs.

2. Parallelism can create unnecessary work

Sequential exploration can stop early. A batch cannot benefit from an early result until the whole batch has already begun. Only batch operations whose value is already established.

3. Promise.all is not cancellation

Fail-fast aggregation usually rejects when one operation fails, but already-started operations may continue. Use all-settled semantics when individual outcomes matter.

4. Usage accounting is not fully observable

Visible token categories and reconstructed weighted formulas may not equal internal Codex allowance accounting. This project records raw categories and avoids hard-coding an unofficial “credit” formula.

5. Product behavior changes

Codex models, orchestration, trace schemas, skill discovery paths, and accounting can change. Version every result with the Codex version, model, date, and relevant configuration.

6. The skill may fail to trigger

Implicit invocation depends heavily on the skill description and surrounding installed skills. Explicit $bounded-batch invocation is the baseline for controlled tests.

7. Batching may worsen some tasks

Read-heavy, long-context investigations are the primary hypothesis. Adaptive debugging and mutation-heavy work may become less efficient or less correct.


Evaluation strategy

A valid comparison holds these constant:

  • exact repository commit and working tree;
  • task prompt, except explicit skill invocation in the treatment condition;
  • Codex version;
  • model and reasoning effort;
  • permissions and sandbox;
  • available tools and network access;
  • starting conversation state;
  • machine and environment where practical.

Measure in this order:

  1. Task correctness and evidence completeness
  2. Truncation and omitted work
  3. Unnecessary or redundant operations
  4. Model turns and command/tool executions
  5. Input, cached-input, and output tokens
  6. Wall time
  7. Any observed allowance or credit movement, clearly marked as product-specific and potentially opaque

Run repeated paired trials. Do not publish a percentage from one repository or one prompt.

The starter materials are in evals/, with the complete protocol in references/measurement-protocol.md.


Validation

Validate the package:

python scripts/validate_package.py

Run unit tests:

python -m unittest discover -s tests -v

The tests cover manifest validation, concurrent execution, timeout reporting, truncation reporting, and strict-policy rejection. They do not test Codex's model behavior; that requires the separate trace-based eval process.


Transparency and provenance

The project was motivated by a public community thread proposing explicit tool batching as a possible GPT-5.6 Sol usage mitigation:

  • Community discussion: https://www.reddit.com/r/codex/s/OqUgMFqhUs

The package structure follows OpenAI's documented Codex skill model: a directory containing SKILL.md, with optional scripts, references, and agents/openai.yaml. Evaluation guidance follows OpenAI's recommendation to test activation, process behavior, outcomes, efficiency, and token usage with captured traces.

Official references:

  • https://developers.openai.com/codex/build-skills
  • https://developers.openai.com/codex/agent-configuration/agents-md
  • https://developers.openai.com/blog/eval-skills
  • https://developers.openai.com/blog/skills-shell-tips

Bounded Batch is independent community work. It is not an OpenAI product, endorsement, engine patch, billing workaround, or statement about undocumented internal implementation.


Contributing

Contributions are welcome: test results, counterexamples, trace parsers, safer policies, documentation corrections, cross-platform fixes, and evidence that the hypothesis is wrong are all valuable.

Please read CONTRIBUTING.md. The central contribution rule is simple:

Preserve raw evidence, distinguish observation from inference, and never trade correctness for an attractive efficiency number.

This project uses the MIT License so anyone may use, study, modify, and redistribute it under the license terms.

About

No description, website, or topics provided.

Resources

Contributing

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages