Metadata-Version: 2.5
Name: ctx-harness
Version: 1.1.1
Summary: straitjacket: a context sidecar for coding agents — cut wasteful token spend, reduce turns with LSP, and delay context compaction without lossy compression.
Project-URL: Homepage, https://github.com/vamsiramakrishnan/straitjacket
Project-URL: Repository, https://github.com/vamsiramakrishnan/straitjacket
Project-URL: Changelog, https://github.com/vamsiramakrishnan/straitjacket/blob/main/CHANGELOG.md
Author: straitjacket contributors
License:                                  Apache License
                                   Version 2.0, January 2004
                                http://www.apache.org/licenses/
        
           TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
        
           1. Definitions.
        
              "License" shall mean the terms and conditions for use, reproduction,
              and distribution as defined by Sections 1 through 9 of this document.
        
              "Licensor" shall mean the copyright owner or entity authorized by
              the copyright owner that is granting the License.
        
              "Legal Entity" shall mean the union of the acting entity and all
              other entities that control, are controlled by, or are under common
              control with that entity. For the purposes of this definition,
              "control" means (i) the power, direct or indirect, to cause the
              direction or management of such entity, whether by contract or
              otherwise, or (ii) ownership of fifty percent (50%) or more of the
              outstanding shares, or (iii) beneficial ownership of such entity.
        
              "You" (or "Your") shall mean an individual or Legal Entity
              exercising permissions granted by this License.
        
              "Source" form shall mean the preferred form for making modifications,
              including but not limited to software source code, documentation
              source, and configuration files.
        
              "Object" form shall mean any form resulting from mechanical
              transformation or translation of a Source form, including but
              not limited to compiled object code, generated documentation,
              and conversions to other media types.
        
              "Work" shall mean the work of authorship, whether in Source or
              Object form, made available under the License, as indicated by a
              copyright notice that is included in or attached to the work
              (an example is provided in the Appendix below).
        
              "Derivative Works" shall mean any work, whether in Source or Object
              form, that is based on (or derived from) the Work and for which the
              editorial revisions, annotations, elaborations, or other modifications
              represent, as a whole, an original work of authorship. For the purposes
              of this License, Derivative Works shall not include works that remain
              separable from, or merely link (or bind by name) to the interfaces of,
              the Work and Derivative Works thereof.
        
              "Contribution" shall mean any work of authorship, including
              the original version of the Work and any modifications or additions
              to that Work or Derivative Works thereof, that is intentionally
              submitted to Licensor for inclusion in the Work by the copyright owner
              or by an individual or Legal Entity authorized to submit on behalf of
              the copyright owner. For the purposes of this definition, "submitted"
              means any form of electronic, verbal, or written communication sent
              to the Licensor or its representatives, including but not limited to
              communication on electronic mailing lists, source code control systems,
              and issue tracking systems that are managed by, or on behalf of, the
              Licensor for the purpose of discussing and improving the Work, but
              excluding communication that is conspicuously marked or otherwise
              designated in writing by the copyright owner as "Not a Contribution."
        
              "Contributor" shall mean Licensor and any individual or Legal Entity
              on behalf of whom a Contribution has been received by Licensor and
              subsequently incorporated within the Work.
        
           2. Grant of Copyright License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              copyright license to reproduce, prepare Derivative Works of,
              publicly display, publicly perform, sublicense, and distribute the
              Work and such Derivative Works in Source or Object form.
        
           3. Grant of Patent License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              (except as stated in this section) patent license to make, have made,
              use, offer to sell, sell, import, and otherwise transfer the Work,
              where such license applies only to those patent claims licensable
              by such Contributor that are necessarily infringed by their
              Contribution(s) alone or by combination of their Contribution(s)
              with the Work to which such Contribution(s) was submitted. If You
              institute patent litigation against any entity (including a
              cross-claim or counterclaim in a lawsuit) alleging that the Work
              or a Contribution incorporated within the Work constitutes direct
              or contributory patent infringement, then any patent licenses
              granted to You under this License for that Work shall terminate
              as of the date such litigation is filed.
        
           4. Redistribution. You may reproduce and distribute copies of the
              Work or Derivative Works thereof in any medium, with or without
              modifications, and in Source or Object form, provided that You
              meet the following conditions:
        
              (a) You must give any other recipients of the Work or
                  Derivative Works a copy of this License; and
        
              (b) You must cause any modified files to carry prominent notices
                  stating that You changed the files; and
        
              (c) You must retain, in the Source form of any Derivative Works
                  that You distribute, all copyright, patent, trademark, and
                  attribution notices from the Source form of the Work,
                  excluding those notices that do not pertain to any part of
                  the Derivative Works; and
        
              (d) If the Work includes a "NOTICE" text file as part of its
                  distribution, then any Derivative Works that You distribute must
                  include a readable copy of the attribution notices contained
                  within such NOTICE file, excluding those notices that do not
                  pertain to any part of the Derivative Works, in at least one
                  of the following places: within a NOTICE text file distributed
                  as part of the Derivative Works; within the Source form or
                  documentation, if provided along with the Derivative Works; or,
                  within a display generated by the Derivative Works, if and
                  wherever such third-party notices normally appear. The contents
                  of the NOTICE file are for informational purposes only and
                  do not modify the License. You may add Your own attribution
                  notices within Derivative Works that You distribute, alongside
                  or as an addendum to the NOTICE text from the Work, provided
                  that such additional attribution notices cannot be construed
                  as modifying the License.
        
              You may add Your own copyright statement to Your modifications and
              may provide additional or different license terms and conditions
              for use, reproduction, or distribution of Your modifications, or
              for any such Derivative Works as a whole, provided Your use,
              reproduction, and distribution of the Work otherwise complies with
              the conditions stated in this License.
        
           5. Submission of Contributions. Unless You explicitly state otherwise,
              any Contribution intentionally submitted for inclusion in the Work
              by You to the Licensor shall be under the terms and conditions of
              this License, without any additional terms or conditions.
              Notwithstanding the above, nothing herein shall supersede or modify
              the terms of any separate license agreement you may have executed
              with Licensor regarding such Contributions.
        
           6. Trademarks. This License does not grant permission to use the trade
              names, trademarks, service marks, or product names of the Licensor,
              except as required for reasonable and customary use in describing the
              origin of the Work and reproducing the content of the NOTICE file.
        
           7. Disclaimer of Warranty. Unless required by applicable law or
              agreed to in writing, Licensor provides the Work (and each
              Contributor provides its Contributions) on an "AS IS" BASIS,
              WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
              implied, including, without limitation, any warranties or conditions
              of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
              PARTICULAR PURPOSE. You are solely responsible for determining the
              appropriateness of using or redistributing the Work and assume any
              risks associated with Your exercise of permissions under this License.
        
           8. Limitation of Liability. In no event and under no legal theory,
              whether in tort (including negligence), contract, or otherwise,
              unless required by applicable law (such as deliberate and grossly
              negligent acts) or agreed to in writing, shall any Contributor be
              liable to You for damages, including any direct, indirect, special,
              incidental, or consequential damages of any character arising as a
              result of this License or out of the use or inability to use the
              Work (including but not limited to damages for loss of goodwill,
              work stoppage, computer failure or malfunction, or any and all
              other commercial damages or losses), even if such Contributor
              has been advised of the possibility of such damages.
        
           9. Accepting Warranty or Additional Liability. While redistributing
              the Work or Derivative Works thereof, You may choose to offer,
              and charge a fee for, acceptance of support, warranty, indemnity,
              or other liability obligations and/or rights consistent with this
              License. However, in accepting such obligations, You may act only
              on Your own behalf and on Your sole responsibility, not on behalf
              of any other Contributor, and only if You agree to indemnify,
              defend, and hold each Contributor harmless for any liability
              incurred by, or claims asserted against, such Contributor by reason
              of your accepting any such warranty or additional liability.
        
           END OF TERMS AND CONDITIONS
        
           APPENDIX: How to apply the Apache License to your work.
        
              To apply the Apache License to your work, attach the following
              boilerplate notice, with the fields enclosed by brackets "[]"
              replaced with your own identifying information. (Don't include
              the brackets!)  The text should be enclosed in the appropriate
              comment syntax for the file format. We also recommend that a
              file or class name and description of purpose be included on the
              same "printed page" as the copyright notice for easier
              identification within third-party archives.
        
           Copyright [yyyy] [name of copyright owner]
        
           Licensed under the Apache License, Version 2.0 (the "License");
           you may not use this file except in compliance with the License.
           You may obtain a copy of the License at
        
               http://www.apache.org/licenses/LICENSE-2.0
        
           Unless required by applicable law or agreed to in writing, software
           distributed under the License is distributed on an "AS IS" BASIS,
           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
           See the License for the specific language governing permissions and
           limitations under the License.
License-File: LICENSE
Keywords: agent,antigravity,context,harness,lsp,mcp,sidecar
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.11
Requires-Dist: pathspec>=0.12
Provides-Extra: agent
Requires-Dist: claude-agent-sdk>=0.2; extra == 'agent'
Provides-Extra: code
Requires-Dist: ast-grep-cli>=0.30; extra == 'code'
Requires-Dist: ast-grep-py>=0.45; extra == 'code'
Requires-Dist: jedi>=0.20; extra == 'code'
Requires-Dist: tree-sitter-bash>=0.25; extra == 'code'
Requires-Dist: tree-sitter-c-sharp>=0.23; extra == 'code'
Requires-Dist: tree-sitter-c>=0.24; extra == 'code'
Requires-Dist: tree-sitter-cpp>=0.23; extra == 'code'
Requires-Dist: tree-sitter-go>=0.25; extra == 'code'
Requires-Dist: tree-sitter-java>=0.23; extra == 'code'
Requires-Dist: tree-sitter-javascript>=0.25; extra == 'code'
Requires-Dist: tree-sitter-kotlin>=1.1; extra == 'code'
Requires-Dist: tree-sitter-lua>=0.5; extra == 'code'
Requires-Dist: tree-sitter-php>=0.24; extra == 'code'
Requires-Dist: tree-sitter-python>=0.25; extra == 'code'
Requires-Dist: tree-sitter-ruby>=0.23; extra == 'code'
Requires-Dist: tree-sitter-rust>=0.24; extra == 'code'
Requires-Dist: tree-sitter-scala>=0.26; extra == 'code'
Requires-Dist: tree-sitter-swift>=0.7; extra == 'code'
Requires-Dist: tree-sitter-typescript>=0.23; extra == 'code'
Requires-Dist: tree-sitter>=0.25; extra == 'code'
Provides-Extra: dev
Requires-Dist: jsonschema>=4; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Provides-Extra: fast
Requires-Dist: orjson>=3; extra == 'fast'
Provides-Extra: full
Requires-Dist: ast-grep-cli>=0.30; extra == 'full'
Requires-Dist: ast-grep-py>=0.45; extra == 'full'
Requires-Dist: grimp>=3.15; extra == 'full'
Requires-Dist: jedi>=0.20; extra == 'full'
Requires-Dist: networkx>=3.4; extra == 'full'
Requires-Dist: orjson>=3; extra == 'full'
Requires-Dist: pillow>=10; extra == 'full'
Requires-Dist: protobuf>=5.26; extra == 'full'
Requires-Dist: tree-sitter-bash>=0.25; extra == 'full'
Requires-Dist: tree-sitter-c-sharp>=0.23; extra == 'full'
Requires-Dist: tree-sitter-c>=0.24; extra == 'full'
Requires-Dist: tree-sitter-cpp>=0.23; extra == 'full'
Requires-Dist: tree-sitter-go>=0.25; extra == 'full'
Requires-Dist: tree-sitter-java>=0.23; extra == 'full'
Requires-Dist: tree-sitter-javascript>=0.25; extra == 'full'
Requires-Dist: tree-sitter-kotlin>=1.1; extra == 'full'
Requires-Dist: tree-sitter-lua>=0.5; extra == 'full'
Requires-Dist: tree-sitter-php>=0.24; extra == 'full'
Requires-Dist: tree-sitter-python>=0.25; extra == 'full'
Requires-Dist: tree-sitter-ruby>=0.23; extra == 'full'
Requires-Dist: tree-sitter-rust>=0.24; extra == 'full'
Requires-Dist: tree-sitter-scala>=0.26; extra == 'full'
Requires-Dist: tree-sitter-swift>=0.7; extra == 'full'
Requires-Dist: tree-sitter-typescript>=0.23; extra == 'full'
Requires-Dist: tree-sitter>=0.25; extra == 'full'
Provides-Extra: image
Requires-Dist: pillow>=10; extra == 'image'
Provides-Extra: map
Requires-Dist: grimp>=3.15; extra == 'map'
Requires-Dist: networkx>=3.4; extra == 'map'
Provides-Extra: scip
Requires-Dist: protobuf>=5.26; extra == 'scip'
Provides-Extra: sem
Requires-Dist: semgrep>=1.60; extra == 'sem'
Description-Content-Type: text/markdown

# straitjacket

**A context sidecar for coding agents.**

Cut wasteful token spend, reduce turns with LSP, and delay context compaction —
without lossy compression.

Straitjacket runs alongside Claude Code, Codex, Antigravity, Hermes, Oh My Pi,
OpenCode, and DeepSeek Harness. Your harness keeps running the model, handling
auth, and controlling permissions. Straitjacket stores noisy command output
locally once, hands the model a compact digest with exact retrieval handles,
resolves code structure through reused language servers, and keeps the active
transcript lean so sessions stay sharp longer.

<p>
  <a href="https://code.claude.com/"><img src="assets/agents/claude.svg" width="36" height="36" alt="Claude Code" title="Claude Code"></a>
  <a href="https://developers.openai.com/codex/"><img src="assets/agents/codex.svg" width="36" height="36" alt="Codex" title="Codex"></a>
  <a href="https://antigravity.google/"><img src="assets/agents/antigravity.png" width="36" height="36" alt="Antigravity" title="Antigravity"></a>
  <a href="https://github.com/NousResearch/hermes-agent"><img src="assets/agents/hermes.svg" width="36" height="36" alt="Hermes" title="Hermes"></a>
  <a href="https://github.com/can1357/oh-my-pi"><img src="assets/agents/omp.svg" width="36" height="36" alt="Oh My Pi" title="Oh My Pi"></a>
  <a href="https://opencode.ai/"><img src="assets/agents/opencode.svg" width="36" height="36" alt="OpenCode" title="OpenCode"></a>
  <a href="https://github.com/deepseek-ai/deepseek-harness"><img src="assets/agents/dsh.svg" width="36" height="36" alt="DeepSeek Harness" title="DeepSeek Harness"></a>
</p>

Python 3.11+ · `ctx-harness` v1.1.1 · Apache-2.0 · [Documentation](https://vamsiramakrishnan.github.io/straitjacket/)

**Why without lossy compression matters:** on a [20,001-line log replay](evals/cache-ab-2026-11-23.md),
head-and-tail truncation cuts the output to 1,219 tokens and silently drops a
quiet fallback event at line 14,238. Straitjacket reduces 302,628 tokens to a
531-token canonical digest, keeps line 14,238 intact, stores all captured bytes
verbatim on disk, and retrieves any omitted line on demand. This local fixture
measures tool-output delivery. [End-to-end task success and cost need separate measurements](#what-the-measurements-show).

## Try it on a failing test

In a repository with a pytest suite, run:

```sh
curl -fsSL https://raw.githubusercontent.com/vamsiramakrishnan/straitjacket/main/scripts/install.sh | sh
# or manually:
uv tool install 'ctx-harness[full]'   # or: python -m pip install 'ctx-harness[full]'
ctx setup --global && ctx tools install --auto
ctx run -- pytest -q
```

For a long failure, `ctx` stores the full output on disk and returns the failing
test names, a short digest, and a handle. For a failing test command, the digest
records the child exit code and `ctx run` returns 3. Search the stored stream
and pull only the traceback lines you need:

```sh
ctx search run:ba3d1020ee8f#stdout 'AssertionError'
ctx get run:ba3d1020ee8f#stdout --lines 140:180
```

Replace the sample handle with the one from your run. The default capture limit
is 64 MiB per stream; if output crosses it, the digest explicitly identifies the
discarded middle. To connect your coding harness, run `ctx setup` and then
`ctx doctor`. [Installation and host setup](docs/GETTING-STARTED.md).

## What the sidecar does

| Goal | How Straitjacket helps | Start here |
|---|---|---|
| **Cut wasteful token spend** | Capture huge logs and test runs once on disk, keep prompt prefixes stable, and trim unused skill/MCP schemas from every turn | [How it works](docs/HOW-IT-WORKS.md) · [Capability surface](docs/CAPABILITY-SURFACE.md) |
| **Reduce turns with LSP** | Query reused language servers for hover, references, fresh diagnostics, and sealed cross-file renames instead of grep-read-edit loops | [Language servers (LSP)](docs/LSP.md) · [Code search](docs/CODE-SEARCH.md) |
| **Delay context compaction** | Keep raw floods out of the transcript, defer dead per-turn schemas, and optionally offload aging tool results into frozen lossless epochs | [Lossless rescue](docs/LOSSLESS-RESCUE.md) · [Prompt prefixes](docs/QUERY-AWARE-SELECTION.md) |
| **Keep every byte recoverable** | Never truncate silently or summarize away details; every omitted region keeps an exact handle (and anchored `repo:` spans follow edits) | [Why straitjacket](docs/WHY-STRAITJACKET.md) · [Anchored addresses](docs/ANCHORS.md) |
| **Delegate across harnesses** | Route steps across Claude Code, Codex, Antigravity, OpenCode, Hermes, OMP, and DSH over ACP using handles instead of full transcripts | [ACP setup](docs/ACP.md) · [Worker routing](docs/ROUTING.md) |
| **Select a Gemini 4 model** | Discover and select Hydrogen, Neon, Carbon, or Argon in native Antigravity sessions | [Antigravity sessions](docs/NATIVE-AGY-SESSIONS.md) |

## Cut wasteful token spend — without lossy compression

A bulky test log or build output that lands early in a session is not billed once: it
stays in the conversation and gets re-read on every turn that follows. Lossy
compression (head-and-tail truncation, loud-line `ERROR` filters, or LLM
summarization) trims the byte count by permanently throwing away lines — often
silently dropping the quiet detail you need next.

Straitjacket separates **what stays on disk** from **what enters the prompt**:

- **Zero silent loss:** `ctx run` and host hooks persist raw stdout/stderr
  locally and emit a deterministic, format-aware digest (`pytest`, logs, JSON,
  linters, diffs, markdown, structured outlines) with exact handles for omitted
  regions. Pull any omitted line verbatim with `ctx search` and `ctx get`.
- **Trim dead per-turn schema weight:** unused MCP servers and skill
  descriptions pad every single request. Run `ctx surface inventory` or
  `ctx prune` to audit per-turn token overhead, or launch Claude Code with
  `ctx wrap claude --surface auto` to shorten descriptions for skills your
  project's history never used. [Skill and tool pruning](docs/CAPABILITY-SURFACE.md).
- **Keep prompt prefixes cache-friendly:** deterministic local digests keep
  earlier transcript bytes stable across turns. For custom model clients,
  `--cache-prefix` places fixed reference material ahead of changing questions
  and selected excerpts:

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

Send `cache_wrap.prefix` first and `cache_wrap.suffix` second; identical
reference material yields byte-identical prefixes across questions. Measure real
usage with `ctx stats --session` and compare runs on task completion, cache
reads/writes, uncached input, output, and total cost. [Prompt layout](docs/QUERY-AWARE-SELECTION.md) · [Session measurement](docs/HOW-IT-WORKS.md).

## Reduce turns intelligently with LSP

Agents waste turns when they navigate code by trial-and-error: recursive grep,
reading whole files to find one definition, guessing call sites, and applying
manual multi-file edits that leave stale imports or broken references behind.

Straitjacket connects directly to your installed language servers — no extra
model or GPU calls — and reuses one server per workspace over a private local
Unix socket:

```sh
ctx lsp hover src/example.py:4:7
ctx lsp refs repo:src/example.py:Example.method
ctx lsp diagnostics src/example.py:1:1
```

For multi-file refactors, plan a semantic rename or code action through LSP and
apply it as a hash-sealed `ctx edit` transaction instead of burning turns
hunting down every call site by hand:

```sh
ctx lsp rename src/example.py:4:7 --new-name better_name --out rename-plan.json
ctx edit preview rename-plan.json
ctx edit apply rename-plan.json
```

- **Broad language registry:** built-in server definitions for Python,
  TypeScript/JavaScript, Go, Rust, C/C++, C#, Java, Kotlin, Lua, PHP, Ruby,
  Scala, shell, and Swift (with CI/local replay verified on Pyright,
  `typescript-language-server`, `gopls`, and `rust-analyzer`, and custom servers
  supported via `CTX_LSP_SERVERS`).
- **Fresh post-edit diagnostics:** after a `ctx edit` write, available LSP
  diagnostics run alongside built-in syntax checks and disclose freshness
  explicitly rather than treating stale or missing reports as clean.
- **Layered symbol navigation:** `ctx refs` automatically tries SCIP, then LSP,
  then Jedi/textual fallback and labels which engine answered. Pair LSP with
  fast local lookups when you want a starting point or a bounded slice:

```sh
ctx pack "Where does parse_ref validate a run handle?" --files 3
ctx search repo: sym:parse_ref
ctx def repo:src/ctx/refs.py:parse_ref
ctx refs parse_ref --path src/ctx
```

When files shift mid-session, content-anchored addresses
(`--lines 40:52@07407f1c`) relocate moved code automatically and refuse if the
underlying lines changed — avoiding wasted turns debugging stale line numbers.
[Language servers (LSP)](docs/LSP.md) · [Code search](docs/CODE-SEARCH.md) · [Investigation workflows](docs/USE-CASES.md).

## Delay context compaction events

Host compaction happens when noisy tool outputs, whole-file reads, and bloated
tool schemas fill the context window — forcing the host to summarize older turns
and often busting prompt caches. Straitjacket pushes compaction much further out
through active, lossless context management:

1. **Keep floods out from turn one:** large command results stay in the local
   store behind a compact digest, and follow-up `ctx get` reads remain bounded.
   You carry a few hundred tokens across later turns instead of hundreds of
   thousands.
2. **Cut fixed per-turn overhead:** `ctx prune` and
   `ctx wrap claude --surface auto` keep unused skills and MCP schemas out of
   every turn's context budget without deleting anything.
3. **Offload aging tool results without losing them:** mark task boundaries with
   `ctx checkpoint` or enable opt-in epoch-latched rescue (`--rescue-pct` on the
   Claude proxy). When window fullness crosses the threshold, older oversized
   tool results are persisted to disk and replaced in one frozen,
   cache-friendly epoch — freeing runway before host compaction triggers, while
   keeping every original byte recoverable by handle even after compaction runs.

[Lossless mid-session rescue](docs/LOSSLESS-RESCUE.md) · [How context stays lean](docs/HOW-IT-WORKS.md).

## Delegate across harnesses (optional)

When you want different coding agents for exploration, implementation, and
verification, `ctx orchestrate` routes each step over Agent Client Protocol
(ACP) and hands workers compact handles and checkpoints instead of forwarding
entire conversation transcripts. The task ledger tracks attempts and resumes
interrupted runs; the relay passes live handle updates between peers.
[ACP setup for all seven harnesses](docs/ACP.md) · [Worker routing](docs/ROUTING.md) · [Task ledger](docs/TASK-LEDGER.md) · [Relay](docs/RELAY.md).

```sh
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 advertised by that endpoint. Use the
[checkout installation](#development) for model-free previews of general tasks
and the latest Gemini 4 routing entries. For native Antigravity sessions
(Hydrogen, Neon, Carbon, or Argon), run `agy models` and pass a listed slug such
as `gemini-4-hydrogen-high` to `--model` in `ctx collab`.
[Antigravity guide](docs/NATIVE-AGY-SESSIONS.md).

## What the measurements show

Straitjacket publishes both delivery measurements and end-to-end agent runs —
including small-output cases where adding a wrapper cost more than running
natively.

| Workload | Observed result |
|---|---|
| [20,001-line log fixture, replayed November 23](evals/cache-ab-2026-11-23.md) | 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. |
| [9-file cross-file Python refactor, LSP vs. explicit edits](evals/lsp-edit-comparison-2026-10-29.md) | Controlled model-free replay (3 repeats): LSP semantic rename cut scripted tool calls from 14 to 7, saved 18.7% tool-result tokens (4,295 → 3,491) and 589 argument tokens vs. discovery/read/explicit edits, and left 3 unrelated same-name files untouched. Live agent turns and billing require separate measurement. |
| [Source ranges after edits](evals/anchor-drift-2026-08-20.md) | Across 1,920 lookups, anchored ranges relocated 1,452 times, verified in place twice, refused 466 times, and returned the wrong content zero times. |
| [Finding files on 14 DeepSWE tasks](evals/agentbench/results/pack_recall.json) | 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. |
| [Three live canary tasks, one run per arm](evals/agentbench/RESULTS.md) | 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. Small, already-bounded outputs are often cheaper natively. |
| [DeepSWE, eight Python tasks, Haiku, 60-turn cap](evals/agentbench/deepswe-2026-09-13.md) | 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](docs/HOST-CAPABILITIES.md) 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](docs/CONFIGURATION.md).

[Verified edits](docs/EDIT-LOOP.md) · [Tool SDK](docs/TOOL-SDK.md) ·
[CLI reference](docs/CLI.md) · [All guides](docs/README.md) · [Changelog](CHANGELOG.md)

## Development

```bash
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](CONTRIBUTING.md).

Useful first contributions: [add a digest profile for a command you use](docs/WRITING-A-PROFILE.md),
reproduce an output that loses important detail, or add a small-output case
where the wrapper costs more than it saves. Include the command, expected
detail, and reproduction steps in an [issue](https://github.com/vamsiramakrishnan/straitjacket/issues/new).
The [evaluation guide](evals/README.md) shows how to check delivery without a model.

## Related projects

- [branchyard](https://github.com/vamsiramakrishnan/branchyard). Run coding agents on isolated branches and review their changes.
