Skip to main content

straitjacket

Context and evidence tools for coding agents.

Straitjacket turns long command output into bounded digests with retrieval addresses. Agents can open the exact evidence they need, find relevant code, and hand a failing test, source location, or verified patch to another harness. Use it alongside Claude Code, Codex, Antigravity, and the other supported hosts. Your harness still runs the model, authenticates the user, and controls its tools.

Claude Code Codex Antigravity Hermes Oh My Pi OpenCode DeepSeek Harness

Python 3.11+ · ctx-harness v0.6.0 · Apache-2.0 · Documentation

See the mechanism: the 20,001-line log replay reduces 302,628 tokens to a 531-token canonical digest, retains a quiet anomaly, and retrieves omitted lines exactly. This local fixture measures evidence delivery. Task success and cost need separate measurements.

Try it on a failing test

In a repository with a pytest suite, run:

python -m pip install 'ctx-harness==0.6.0'
ctx run -- pytest -q

For a long failure, ctx returns the test names, a digest, and an address for the captured output. For a failing test command, the digest records the child exit code and ctx run returns 3. To find the traceback, replace the sample handle below with the one from your run and search the stream pytest used.

ctx search run:ba3d1020ee8f#stdout 'AssertionError'

Use the line range in the search result with ctx get. The default capture limit is 64 MiB per stream. If output crosses it, the digest identifies the discarded middle. To connect your coding harness, run ctx setup and then ctx doctor. Installation and host setup.

Choose a workflow

If you want to… Start here
Find an implementation or call site without reading whole files Search by symbol, follow references, and open a source range
Reuse a prompt prefix as the question and evidence change Build a stable prefix and measure the session
Give exploration, implementation, and verification to different harnesses Delegate through ACP and inspect the route
Control which skills and tools a session sees Inspect skill listings and configure a launch profile
Run Gemini 4 Hydrogen, Neon, Carbon, or Argon Discover and select an Antigravity model

Delegate work across harnesses

ctx orchestrate assigns each step to a harness and model using its capability requirement and configured costs. A worker receives the task and checkpoints from its dependencies. The task ledger records attempts and handoffs, so a resumed route can reuse finished work. The relay lets a peer send an evidence address while work is in progress. Worker routing · Task ledger · Relay.

Agent Client Protocol (ACP) lets Straitjacket start and cancel workers through one interface. Install and authenticate an adapter, then configure the exact model ID it advertises. For example, with OpenCode:

ctx setup --host opencode --acp --acp-model 'provider/model-id'
ctx orchestrate 'Review the current diff' --dry-run

Replace provider/model-id with an ID from that endpoint. The preview shows worker assignments. Use the checkout installation for model-free previews of general tasks and the new Gemini 4 routing entries. Running the route starts model work. Each ACP attempt opens a fresh session and receives bounded retrieval and edit tools over MCP. ACP setup for all seven harnesses.

The host decides when to load a skill. On Claude Code, ctx surface inventory estimates the cost of listing a skill separately from loading its body. ctx wrap claude --surface auto can shorten listings for skills the project's session history shows it never used. Skill selection and launch profiles.

Spend fewer turns finding code

In a Straitjacket checkout, these commands locate the reference parser, read its definition, and find uses under the package:

ctx search repo: sym:parse_ref
ctx def repo:src/ctx/refs.py:parse_ref
ctx refs parse_ref --path src/ctx

If all you have is a bug report, start with ctx pack "your task" for ranked starting points. If you already have a path and symbol, go straight to ctx def. The result identifies the lookup method and its coverage. Code search · Investigation workflows.

Keep repeated input cheap

A large result early in a session can be read and billed on every later turn. Capture it once, then retrieve just the evidence that changes the next decision. Straitjacket keeps its own shared instructions stable across turns. For a custom model client, it can also serialize fixed reference material ahead of a changing question and selected excerpts:

ctx compress build.log --query 'Which target failed?' --cache-prefix reference.txt

Send the returned cache_wrap.prefix first and cache_wrap.suffix second. The same reference produces the same prefix bytes across questions. The provider determines reuse. To evaluate savings, compare runs on the same task and model. Record completion, cache reads and writes, uncached input, output, and cost. ctx stats --session can report observed usage when available. Prompt layout · Session measurement.

Select a Gemini 4 model

Run agy models with the account that will do the work. In the native ctx collab workflow, pass a listed slug such as gemini-4-hydrogen-high to --model. For ACP, use the ID advertised by the ACP endpoint. Availability and reasoning levels depend on the account and client. The Antigravity guide covers Hydrogen, Neon, Carbon, and Argon, including how to start and continue a native conversation.

What the measurements show

Workload Observed result
20,001-line log fixture, replayed November 23 The raw log took 302,628 o200k_base tokens. The canonical digest took 531; actual counts were 531–537 as opaque run handles changed. It retained the quiet event at line 14,238, preserved the captured bytes exactly, and retrieved an omitted control line. No model ran.
Source ranges after edits Across 1,920 lookups, anchored ranges relocated 1,452 times, verified in place twice, refused 466 times, and returned the wrong content zero times.
Three live canary tasks, one run per arm Both arms solved 3/3. With the wrapper, median cache hit rate rose from 96.5% to 97.5% and total cost rose from $0.67 to $0.92.
Finding files on 14 DeepSWE tasks Among the top eight suggestions, ctx pack found 54.0% of existing files touched by the reference fix on average. Ranking by grep count found 42.9%. Grep found at least one relevant file on all 14 tasks, the pack on 12.
DeepSWE, eight Python tasks, Haiku, 60-turn cap The wrapped arm passed 177 held-out fail-to-pass test IDs on committed patches versus 54 for plain Claude. The runs cost $5.74 and $5.42 respectively. Neither arm fully resolved a task.

Integration and storage

The CLI works in any terminal. Claude Code and Codex can replace oversized results after a command runs. Antigravity CLI can rewrite supported calls before execution. Hermes, Oh My Pi, and OpenCode can rewrite arguments and replace text results. DeepSeek Harness can gate calls and replace text results. The host matrix lists version-specific behavior and distinguishes live observations from adapter tests.

Captured artifacts live in a local plaintext store. Model-visible reads follow the configured redaction policy. Unpinned artifacts become eligible for collection after 30 days by default and remain until ctx gc runs. Commands run with the invoking user's permissions. Configuration.

Verified edits · Tool SDK · CLI reference · All guides · Changelog

Development

git clone https://github.com/vamsiramakrishnan/straitjacket.git
cd straitjacket
python -m pip install -e '.[dev]'
pytest

New mechanisms need deterministic output, explicit degradation, and a named evaluation gate. Follow CONTRIBUTING.md.

Useful first contributions: add a digest profile for a command you use, reproduce an output that loses important evidence, or add a small-output case where the wrapper costs more than it saves. Include the command, expected evidence, and reproduction steps in an issue. The evaluation guide shows how to check delivery without a model.

  • branchyard. Run coding agents on isolated branches and review their changes.

Metadata

Release files for ctx-harness 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ctx-harness 0.6.0
File Size Uploaded Provenance Actions
ctx_harness-0.6.0.tar.gz 1.3 MB With provenance Details for ctx_harness-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ctx-harness 0.6.0
File Interpreter ABI Platform Actions
ctx_harness-0.6.0-py3-none-any.whl Python 3 none any Details for ctx_harness-0.6.0-py3-none-any.whl

Total release size: 2.8 MB

Release files / ctx_harness-0.6.0.tar.gz

Download URL ctx_harness-0.6.0.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
4eb5e8206c8ec967c4f6205ba9abde8523833b2361da2d83cad20b3717edb73f
BLAKE2b-256 checksum
How to use checksums
fb3023580f157955f98c462eabc32603755b772109795431a04ed01c6800d755
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / ctx_harness-0.6.0-py3-none-any.whl

Download URL ctx_harness-0.6.0-py3-none-any.whl
Size 1.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
2494e7043b2407beedbc0e85f51d3f1cbf0daecca6d9d4b0fc5c6b9074511b32
BLAKE2b-256 checksum
How to use checksums
7d257a732b5097720b2932fe572cd1489b1413f730715c816a194f988df2769b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for ctx-harness 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ctx_harness-0.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page