Metadata-Version: 2.5
Name: ithrl
Version: 0.4.0
Summary: Find smaller agent contexts that preserve a selected model behavior
Project-URL: Source, https://github.com/eberkut/ithrl
Project-URL: Issues, https://github.com/eberkut/ithrl/issues
Project-URL: Documentation, https://eberkut.github.io/ithrl/
Project-URL: Changelog, https://github.com/eberkut/ithrl/releases
Author: Vincent Morel
License-Expression: Apache-2.0
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Debuggers
Requires-Python: >=3.12
Requires-Dist: filelock>=3.32.4
Requires-Dist: github-copilot-sdk==1.0.28
Requires-Dist: jsonschema>=4.25
Requires-Dist: packaging>=24.2
Requires-Dist: platformdirs>=4.3
Requires-Dist: pydantic>=2.12
Requires-Dist: rich>=14
Requires-Dist: typer>=0.16
Provides-Extra: fuzz
Requires-Dist: scipy>=1.18; extra == 'fuzz'
Description-Content-Type: text/markdown

<!-- rumdl-disable MD033 -->
<h1>
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/eberkut/ithrl/main/docs/branding/ithrl-logo-dark.svg">
    <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/eberkut/ithrl/main/docs/branding/ithrl-logo-light.svg">
    <img src="https://raw.githubusercontent.com/eberkut/ithrl/main/docs/branding/ithrl-logo.png" alt="ithrl" width="320" height="158">
  </picture>
</h1>
<!-- rumdl-enable MD033 -->

[![PyPI](https://img.shields.io/pypi/v/ithrl.svg)](https://pypi.org/project/ithrl/)
[![CI](https://github.com/eberkut/ithrl/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/eberkut/ithrl/actions/workflows/ci.yml)

`ithrl` turns saved Codex and GitHub Copilot sessions into debugging experiments. Search for a
smaller context that preserves a chosen response or tool request, or a small text change that alters
it.

[Documentation](https://eberkut.github.io/ithrl/) · [Try it](#try-it) ·
[Supported inputs](#supported-inputs)

## Install

With [uv](https://docs.astral.sh/uv/):

```bash
uv tool install ithrl
```

You can also install with `pipx install ithrl` or, in an existing virtual environment,
`python -m pip install ithrl`. For context fuzzing, use `'ithrl[fuzz]'` in place of `ithrl` in
the installation command.

Tested on Python 3.12–3.14. Native runners require Linux. APIs and saved formats may change before
1.0; keep your source sessions and record the version used for each case.

## Try it

The bundled deterministic example needs no account, agent installation or model access:

```bash
mkdir -m 700 ithrl-demo
ithrl extract --example --output ithrl-demo/case
ithrl shrink ithrl-demo/case --observation-store ithrl-demo/observations.sqlite
```

The result removes half the context items and confirms that the target is preserved. Output excerpt:

```text
Reduced and confirmed
  context items   10 -> 5
  original test   target observed
  search          1-minimal; all valid single removals tested
  confirmation    target preserved
  observations    15
  No network requests or provider calls. No actions executed.
```

Inspect the saved result in `ithrl-demo/case/results/`; the
[results guide](https://github.com/eberkut/ithrl/blob/main/docs/results.md) explains its files.
Use a new directory to repeat the example; extraction refuses to overwrite an existing case.

## Commands

- `ithrl extract` browses saved sessions and creates a case from a selected decision.
- `ithrl prepare CASE` generates a private reduction configuration from a preflight receipt and
  statistical settings. Follow the
  [preparation procedure](https://github.com/eberkut/ithrl/blob/main/docs/reduction.md).
- `ithrl shrink CASE` searches for context removals that preserve the selected behavior.
- `ithrl inspect sections CASE` lists editable text fields and paragraph boundaries without
  displaying text or requiring a reduction result.
- `ithrl inspect reacquire SESSION` compares recorded operations and captured results across
  compaction. See
  [passive inspection](https://github.com/eberkut/ithrl/blob/main/docs/results.md#inspect-recorded-compaction).
- `ithrl inspect retained CASE --result RESULT` explains retained units and recorded removal trials
  from a saved reduction without model access. See
  [results and privacy](https://github.com/eberkut/ithrl/blob/main/docs/results.md#inspect-retained-context).
- `ithrl fuzz CASE --config PRIVATE_TOML` searches for and simplifies text appends that decrease how
  often the selected behavior occurs, with independent confirmation.

For example, extract a saved session file:

```bash
ithrl extract path/to/session.jsonl --output .ithrl/case
```

Extraction makes no provider calls. Native experiments require Linux, usable Bubblewrap, an
installed harness and model access. Review the provider, safety controls and call/time budget in the
[native-run guide](https://github.com/eberkut/ithrl/blob/main/docs/native-runs.md) before execution.
Returned actions are observed and denied. Cases contain copied session content; keep them private.

## Supported inputs

| Input | Extracted decisions | Reduction | Fuzzing | Passive inspection |
| --- | --- | --- | --- | --- |
| Bundled synthetic example | Synthetic tool request | Deterministic local runner | Local fake runner | — |
| Codex CLI rollouts | Final responses | Experimental native runner; [paragraph-removal measurements](https://github.com/eberkut/ithrl/blob/main/docs/measurements.md#ordinary-session-paragraph-removal) | Experimental prior-user text appends | Exact recorded-operation and captured-result comparisons across compaction |
| Copilot CLI session events | Final responses and shell requests | Experimental final-response paragraph removal and denied `bash` runner | Experimental prior-user text appends for final-response targets | Exact recorded-operation and captured-result comparisons across compaction |

Passive inspection reads saved evidence without a harness or model access. The
[worked investigation](https://github.com/eberkut/ithrl/blob/main/docs/research/passive-compaction-investigation.md)
records the qualified native profiles, ordinary examples and interpretation limits.

Native fuzzing appends text to eligible prior user input while preserving the fixed triggering
input. The
[fuzzing walkthrough](https://github.com/eberkut/ithrl/blob/main/docs/fuzzing.md)
covers a local example and native execution.

Ordinary Codex and Copilot paragraph-removal experiments passed fresh confirmation at a
20-percentage-point preservation margin. See the
[measurements](https://github.com/eberkut/ithrl/blob/main/docs/measurements.md#saved-session-experiments)
for completed and unsuccessful outcomes, costs and qualification limits, and the
[worked investigation](https://github.com/eberkut/ithrl/blob/main/docs/research/ordinary-session-investigation.md)
for a developer's interpretation. Check
[native compatibility](https://github.com/eberkut/ithrl/blob/main/docs/native-runs.md#compatibility-and-measurements)
before using an installed harness.

## Documentation

Read the [documentation site](https://eberkut.github.io/ithrl/) or browse the guides below.

- [Native runs](https://github.com/eberkut/ithrl/blob/main/docs/native-runs.md): session selection,
  shared prerequisites and compatibility.
- [Native reduction](https://github.com/eberkut/ithrl/blob/main/docs/reduction.md): prepare,
  inspect and execute a context-removal experiment.
- [Context fuzzing](https://github.com/eberkut/ithrl/blob/main/docs/fuzzing.md): try the local
  example and run a native text-append campaign.
- [Results and privacy](https://github.com/eberkut/ithrl/blob/main/docs/results.md): saved files,
  result interpretation, budgets, resume and sensitive data.
- [Contributing](https://github.com/eberkut/ithrl/blob/main/CONTRIBUTING.md): issue-first
  collaboration, checkout setup, checks and smoke tests.
- [Roadmap](https://github.com/eberkut/ithrl/blob/main/ROADMAP.md): current priorities and planned
  capabilities.
- [Architecture](https://github.com/eberkut/ithrl/blob/main/docs/architecture.md): implementation
  boundaries and decisions.
- [Research](https://github.com/eberkut/ithrl/blob/main/docs/research/index.md): feasibility
  studies, statistical methods and measurements.

For help, bugs or proposals, see [Support](https://github.com/eberkut/ithrl/blob/main/SUPPORT.md).
Report vulnerabilities through
[private reporting](https://github.com/eberkut/ithrl/security/advisories/new).

## Name

Pronounce `ithrl` as **Ithuriel**, the angel whose spear reveals Satan in disguise in Milton's
[*Paradise Lost*](https://rpo.library.utoronto.ca/content/paradise-lost-book-iv-1674).

## License

Licensed under the [Apache License 2.0](https://github.com/eberkut/ithrl/blob/main/LICENSE).
