Metadata-Version: 2.4
Name: pithio
Version: 0.1.0
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Rust
Classifier: Topic :: Software Development
License-File: LICENSE.md
Summary: Shorter tool output for AI coding agents, without losing the answer
Keywords: ai,agents,llm,tokens,claude-code,mcp
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# pithio

**Local context compression for AI agents. Less to read, details within reach.**

pithio shortens the text and data your agents read from terminals, APIs, web pages and connected tools, before the
model reads it. Every shortened output says what it left out, and the full original stays on your machine: when the
agent needs a detail, it fetches it or queries it exactly.

## Install and set up (two commands)

**1. Install** (one line, no Rust needed):

```sh
# macOS and Linux
curl -fsSL https://raw.githubusercontent.com/allenjoseph05/pithio/main/install.sh | sh
```

```powershell
# Windows (PowerShell)
irm https://raw.githubusercontent.com/allenjoseph05/pithio/main/install.ps1 | iex
```

Or download the file for your system from [Releases](https://github.com/allenjoseph05/pithio/releases), or build it
with `cargo install --git https://github.com/allenjoseph05/pithio pithio`.

**2. Connect your agent:**

```sh
pithio init --agent claude-code --write      # or: codex, cursor, copilot, gemini
pithio doctor                                # checks the setup
```

That is all: from your agent's next session, its tool outputs are shortened. `pithio dashboard` shows what was saved;
`pithio uninstall --agent claude-code --write` removes it again.

## Results

| on real developer tool output | without pithio | with pithio |
|---|---|---|
| correct answers (171 questions, Claude Haiku) | 86.5 % | **91.8 %** |
| input tokens per tool output | 39,775 | **28,330** (29 % fewer) |
| correct answers on real system logs (Loghub) | 57.4 % | **74.1 %**, with 60 % fewer tokens |
| tool-result tokens on GitHub API pages | 100 % | **7.8 %**, every answer still visible |

How these were measured: [BENCHMARKS.md](BENCHMARKS.md).

## What it shortens

- **Terminals and repositories:** test runs, builds, compiler diagnostics, git log and diff, file lists.
- **Tables and structured data:** JSON API responses, CSV and delimited tables, YAML and TOML.
- **Logs and search:** application logs, failed CI jobs, code and text search matches.
- **Web and MCP results:** fetched web pages, issue lists, search hits, database rows, connector logs.

Source files the agent is editing and short outputs are left alone. Output is never larger than the input, and the
same input always gives the same output, so prompt caches keep working.

## Every output says what it did

Each shortened output opens with a note naming its level:

1. **Lossless:** the same data, written more compactly.
2. **Repeats only:** every distinct value or kind of line shown, repeats counted.
3. **Focused:** some parts left out; the note says what and how to get them.

```text
test sample::case_001 ... ok
[... 79 more lines of the kinds shown above (other numbers) ...]
test sample::reports_expired_session ... FAILED

[pithio: level 2, repeats only: every kind of line is shown, repeats folded with exact counts; original 1,204 tokens: kept locally as handle 3f2a9c1e8b7d6a54]
```

## Getting a detail back

The agent (or you) can recover anything from a shortened output by its handle:

```sh
pithio more HANDLE                      # read the original, page by page
pithio more HANDLE --grep timeout       # matching lines
pithio q HANDLE                         # the tables in it and their columns
pithio q HANDLE "count status = 500"    # exact counts, sums, filters and lookups (SQL)
pithio grep HANDLE "worker 7"           # lines that contain a text
```

## Other ways to use it

- **In your own app (Python, Node), coming soon as `pip install pithio` and `npm install pithio`:**
  `client = pithio.wrap(anthropic.Anthropic())` shortens tool results in every request and adds a recovery tool.
- **MCP gateway:** list your MCP servers in the config, then connect your client to `pithio serve --config PATH`.
- **Any shell command:** `pithio run -- COMMAND`.
- **Local proxy:** point an Anthropic client at `http://127.0.0.1:8788` (`pithio proxy`).

## See what it saved

```sh
pithio gain        # tokens saved today, this week, all time
pithio show        # recent shortened outputs, each next to its original
pithio audit       # checks every stored output against what its note promised
pithio dashboard   # the same in a local web page
```

## Privacy

Everything runs on your machine; pithio sends nothing anywhere. Originals are kept locally for one day
(`~/.pithio`); `pithio forget` deletes them. Outputs that look like they hold a secret are never stored.

## Building from source

```sh
cargo build --release -p pithio
cargo test --release -p pithio-core -p pithio
```

See [CONTRIBUTING.md](CONTRIBUTING.md) and [SECURITY.md](SECURITY.md).

## Licence

[FSL-1.1-ALv2](LICENSE.md).

