Metadata-Version: 2.5
Name: agent-tuner
Version: 1.0.0
Summary: Understand your AI usage. Tune your agent workflows.
Project-URL: Homepage, https://github.com/ej-sanmartin/tuner
Project-URL: Source, https://github.com/ej-sanmartin/tuner
Project-URL: Issues, https://github.com/ej-sanmartin/tuner/issues
Project-URL: Documentation, https://github.com/ej-sanmartin/tuner/tree/main/docs
Project-URL: Changelog, https://github.com/ej-sanmartin/tuner/blob/main/CHANGELOG.md
Author: Tuner contributors
License-Expression: MIT
License-File: LICENSE
Keywords: agents,ai,claude-code,cursor,skills,token-usage
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.13
Requires-Dist: tzdata; sys_platform == 'win32'
Description-Content-Type: text/markdown

<p align="center">
  <img src="https://raw.githubusercontent.com/ej-sanmartin/tuner/main/docs/tuner-mark.svg" width="72" height="72" alt="Tuner">
</p>

<h1 align="center">Tuner</h1>

<p align="center"><strong>Understand your AI usage. Tune your agent workflows.</strong></p>

<p align="center">
  <a href="https://github.com/ej-sanmartin/tuner/actions/workflows/ci.yml">
    <img alt="CI"
      src="https://github.com/ej-sanmartin/tuner/actions/workflows/ci.yml/badge.svg">
  </a>
  <a href="https://www.python.org/downloads/">
    <img alt="Python 3.13 or newer"
      src="https://img.shields.io/badge/python-3.13%2B-3776AB">
  </a>
  <a href="https://github.com/ej-sanmartin/tuner">
    <img alt="macOS and Windows"
      src="https://img.shields.io/badge/platform-macOS%20%7C%20Windows-555555">
  </a>
  <a href="https://github.com/ej-sanmartin/tuner/blob/main/LICENSE">
    <img alt="MIT license"
      src="https://img.shields.io/badge/license-MIT-b55238">
  </a>
</p>

Tuner is a local-first tool that reads the session history of your coding
agents (Cursor, Claude Code, OpenCode, Open WebUI, and Hermes), shows
where your tokens went, and helps you turn the expensive patterns into
better prompts, rules, and Agent Skills. It runs on macOS and Windows with
Python 3.13 and has **no runtime dependencies, no cloud service, and no
API key**.

> Status: 1.0.0. See [docs/PROGRESS.md](https://github.com/ej-sanmartin/tuner/blob/main/docs/PROGRESS.md) for what
> is done, what is verified, and what is not.

<p align="center">
  <img src="https://raw.githubusercontent.com/ej-sanmartin/tuner/main/docs/overview.png" width="880"
    alt="Tuner usage overview for one week">
</p>

## Install

```sh
uv tool install agent-tuner   # installs the `tuner` command
tuner init                    # config, Cursor hooks, /tuner skill, schedule
```

(`tuner` is taken on PyPI, so the distribution is `agent-tuner`; the
command is `tuner`.) `tuner init` is explicit and reversible with
`tuner uninstall`; skip pieces with `--no-hooks --no-skill --no-schedule`.

## Upgrade

```sh
tuner upgrade        # upgrade the package, then refresh what Tuner installed
```

`tuner upgrade` detects how Tuner was installed (`uv tool`, `pipx`, or a
local checkout), upgrades it, then runs the *new* code to apply database
migrations and refresh the Cursor hooks, the `/tuner` skill, and the
schedule, but only the ones you already have. After a manual upgrade run
`tuner upgrade --sync-only`; `tuner doctor` warns when they are out of sync.
On Windows `uv` cannot replace a running `tuner.exe`, so `tuner upgrade`
prints the two commands to run instead.

## Use

```sh
tuner report --open      # collect, build, and open that report
tuner open               # latest finished scheduled report
tuner open --generated   # the report written most recently
tuner doctor             # check sources, hooks, skill, schedule
```

Then, in Cursor or Claude Code, run **`/tuner`**. The agent reads a
redacted evidence bundle, explains *why* the expensive tasks were
expensive (productive complexity vs avoidable overhead vs insufficient
evidence), and proposes improvements. For each task it also writes a
title of at most 80 characters. The expensive-tasks list and the task
heading show that label; the prompt text stays on the task page. The
result is cached and appears in the report's Recommendations view.
Re-running `/tuner` on unchanged data reuses the cache instead of
spending tokens again.

Each human prompt is its own task, so per-prompt cost stays visible. A
short follow-up in the same sitting is linked, not merged: an
affirmation (`yes`, `go ahead`) or an exact plan approval (`implement
this`, `implement the plan`, `build this`, `do the plan`). Extra words,
as in `implement this new parser`, stay a new task.

Reports land in `reports/<period>/{usage.json,analysis.json,report.html}`
inside Tuner's data directory. `tuner open` opens the latest finished
scheduled report. `tuner open --generated` (and `tuner report --open`)
opens the report just written, including a custom `--since` window. If
no finished report exists yet, `tuner open` uses that newest file and
says so. Reports are generated every Sunday at 18:00 local time by
default, with catch-up if the machine was off.

<details>
<summary>All commands</summary>

| Command | Purpose |
| --- | --- |
| `tuner init` / `uninstall` | set up / remove everything Tuner installed |
| `tuner collect` | incremental, idempotent import (no LLM) |
| `tuner report` | deterministic `usage.json` + offline `report.html` |
| `tuner analyze` | cache status, evidence, save analysis (used by `/tuner`) |
| `tuner skills` | list, diff, apply, reject, roll back skill changes |
| `tuner schedule` | install/inspect the OS job; `run` is idempotent |
| `tuner pricing` | price lookups and deterministic cost math |
| `tuner config` | show/edit validated TOML config |
| `tuner open` | latest finished scheduled report; `--generated` for the one just written |
| `tuner doctor` | diagnostics for sources, hooks, skill, and schedule |

</details>

## What is measured and what is estimated

Claude Code transcripts contain provider usage, so those numbers are
**measured**. OpenCode, Open WebUI, and Hermes keep token counts in a
local database, so those numbers are measured too. Cursor does not store
token counts locally, so Cursor numbers are **estimates** (labelled, with
a method, confidence, and known gaps) and are never mixed with measured
data without saying so. Costs are API-equivalent estimates from versioned
prices, not billing; unknown models produce an explicitly incomplete
estimate. See [docs/DATA_SCHEMA.md](https://github.com/ej-sanmartin/tuner/blob/main/docs/DATA_SCHEMA.md).

## Skills Tuner may create

Modes (`tuner config set skills.mode review`): `suggest` (record only),
`review` (default; you apply with `tuner skills apply ID`), `auto` (small,
validated changes only). Tuner only edits skills it created, backs up
before writing, detects conflicts, supports `tuner skills rollback`, and
never runs `git add` or `git commit`. See [docs/PRIVACY.md](https://github.com/ej-sanmartin/tuner/blob/main/docs/PRIVACY.md).

## Privacy in one paragraph

Everything stays on your machine. No telemetry. The only network request
Tuner can make is `tuner pricing refresh` (public price list, explicit and
opt-in). Transcripts are treated as untrusted data and are redacted for
secrets. The model only sees what `tuner analyze evidence` prints.

## Docs

[Research](https://github.com/ej-sanmartin/tuner/blob/main/docs/RESEARCH.md) · [Architecture](https://github.com/ej-sanmartin/tuner/blob/main/docs/ARCHITECTURE.md) ·
[Data schema](https://github.com/ej-sanmartin/tuner/blob/main/docs/DATA_SCHEMA.md) · [Privacy](https://github.com/ej-sanmartin/tuner/blob/main/docs/PRIVACY.md) ·
[Development](https://github.com/ej-sanmartin/tuner/blob/main/docs/DEVELOPMENT.md) · [Progress](https://github.com/ej-sanmartin/tuner/blob/main/docs/PROGRESS.md)

## License

MIT
