Metadata-Version: 2.4
Name: coalesce-cli
Version: 0.1.0
Summary: Reduce Claude Code token consumption by batching file tool calls.
Author: Coalesce
License: MIT
Project-URL: Homepage, https://github.com/coalesce-dev/coalesce-cli
Project-URL: Issues, https://github.com/coalesce-dev/coalesce-cli/issues
Keywords: claude,claude-code,llm,tokens,cli,optimizer,batching
Classifier: Development Status :: 4 - Beta
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 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.31.0
Dynamic: license-file

# Coalesce CLI

Reduce Claude Code token consumption by batching tool calls into single primitives.

## Install

```bash
pip install ./coalesce-cli
# or one-liner:
curl -sSL <YOUR_BACKEND>/api/cli/install.sh | bash
```

## Configure

```bash
coalesce configure --api-key coa_xxxxx --endpoint https://your-coalesce.example.com
```

## Commands

- `coalesce configure`   — save API key + endpoint to `~/.coalesce/config.json`
- `coalesce status`      — show current config
- `coalesce demo`        — run a synthetic optimization pass against a fake task and report savings to the dashboard
- `coalesce report`      — manually report a Claude Code session's naive/batched counts
- `coalesce version`     — print the version

## How the batcher works

The `coalesce.batcher.Batcher` class collects individual `read_file` / `edit_file` / `search` requests
and coalesces them into a small number of batched primitives:

- `batch_read(files=[...])`
- `batch_edit(files=[...], plan="...")`
- `batch_search(queries=[...])`

Each batch primitive counts as ONE tool call regardless of how many files it touches, avoiding one
LLM roundtrip per file.

## Model auto-detection

Coalesce auto-detects the Claude model in use (Sonnet 4.5/4.6, Opus 4.7/4.8, Haiku 4.5) via the
`CLAUDE_MODEL` environment variable or the `--model` flag passed to `coalesce demo` / `coalesce report`.
Pricing rates are pulled per-model from the Coalesce backend so `$` savings are accurate.
