Metadata-Version: 2.4
Name: tktop
Version: 0.1.0
Summary: Token monitor for coding agents — like htop for AI spend
Project-URL: Homepage, https://github.com/chanilharisankar/tktop
Project-URL: Repository, https://github.com/chanilharisankar/tktop
Project-URL: Issues, https://github.com/chanilharisankar/tktop/issues
Author: Harisan Sankar
License: MIT License
        
        Copyright (c) 2026 K Hari Sankar
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Utilities
Requires-Python: >=3.13
Requires-Dist: httpx>=0.27.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: rich>=13.0.0
Requires-Dist: textual>=1.0.0
Requires-Dist: typer>=0.12.0
Requires-Dist: watchfiles>=0.21.0
Provides-Extra: dev
Requires-Dist: bandit>=1.7.0; extra == 'dev'
Requires-Dist: build>=1.2.0; extra == 'dev'
Requires-Dist: pip-audit>=2.7.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: ruff>=0.8.0; extra == 'dev'
Description-Content-Type: text/markdown

# tktop

Token monitor for coding agents. Like `htop` for your AI spend.

## Features

- **Live dashboard** — real-time token usage breakdown (input/output/cache)
- **Token flow graph** — sparkline showing output tokens per turn
- **Tool stats** — see which tools consume the most calls
- **Drift detection** — 9 algorithms detecting loops, thrashing, runaway sessions
- **Cost tracking** — per-session cost estimates by model
- **Turn drill-down** — inspect individual turns with token split and content preview
- **LLM analysis** — on-demand optimization suggestions via Ollama/Anthropic/Vertex AI/OpenAI

## Install

```bash
# From PyPI
pip install tktop

# Upgrade to the latest release
pip install -U tktop
```

## Usage

```bash
tktop              # launch interactive session list
```

### Keybindings

| Key | Action |
|-----|--------|
| `↑/↓` or `j/k` | Navigate |
| `enter` | Select / drill-down |
| `a` | Run LLM analysis |
| `r` | Refresh |
| `escape` | Back |
| `q` | Quit |

## Supported Agents

- [x] Claude Code
- [x] Codex
- [ ] Cursor (planned)
- [ ] Aider (planned)

## LLM Analysis

Copy `.env.example` to `.env` and configure:

```bash
cp .env.example .env
# Edit .env with your provider settings
```

Supported providers: `ollama` (default), `anthropic`, `vertex`, `openai`

## Development

```bash
make install  # install in dev mode
make test     # run tests
make clean    # clean build artifacts
```

Local development still uses an editable install:

```bash
pip install -e ".[dev]"
```

For maintainers, a versioned release can be prepared with:

```bash
make release VERSION=0.1.1
```

### Devbox

If you have the Devbox CLI installed, you can bootstrap the repo with:

```bash
devbox shell
```

On first entry, the shell creates `.venv`, installs `.[dev]`, and activates the
environment for the session.

License: MIT. See [LICENSE](LICENSE).

Repository instructions for Codex are in [`AGENTS.md`](AGENTS.md). The current
design is documented in
[`docs/specs/2026-06-08-tktop-design.md`](docs/specs/2026-06-08-tktop-design.md).
