Token — a colorful CLI coding agent with file tools, shell execution, and OpenAI
Project description
Token
The problem
Most AI coding tools are either cloud-hosted editors you can't control, or heavyweight frameworks that bury a simple idea under layers of abstraction. You want an agent that reads your code, makes changes, and runs commands — right in your terminal, powered by OpenAI, without handing your codebase to a third-party service.
Existing open-source agents often use complex multi-agent graphs with routing nodes, sub-agent spawning, and checkpoint systems. This adds latency, makes debugging harder, and burns tokens on orchestration overhead instead of actual coding work.
How Token solves it
Token is a single-loop coding agent. One LLM conversation, one while loop — the model decides what tools to call and keeps going until it has an answer. No multi-agent graphs, no routing nodes, no sub-agent spawning.
- Single conversation loop — the LLM calls tools (read files, write files, run commands) until it returns a text response. No orchestration layer between you and the model.
- Three-stage compression — automatically compresses conversation history when it approaches 75% of the context window, so long sessions don't crash or lose context.
- Read/write parallelization — read-only tool calls (file reads, searches, tree listings) run concurrently. Write operations run sequentially with human approval.
- OpenAI — live model catalog from the OpenAI API. Paste your key, pick a model, start coding.
- Workspace sandbox — all file operations are confined to your project directory. Nothing touches files outside the workspace root.
Install
Recommended — isolated CLI install with pipx:
pipx install excergic-token
Or with pip:
pip install excergic-token
Or with uv:
uv tool install excergic-token
Requires Python 3.11+.
Quick start
pipx install excergic-token
token
On first run, Token prompts you to paste your OpenAI API key, fetches models live, and saves your credentials to ~/.config/token/config.json (mode 0600, only your user can read it). Workspace defaults to your current directory.
token
Use /provider anytime to paste a new key or pick a different model.
Usage
# Start the agent (default — uses current directory as workspace)
token
# Optional flags
token --model gpt-4o --workspace /path/to/project
# Version
token version
How it works
Token runs a Hermes-style conversation loop:
You type a query
-> Three-tier system prompt (stable + context + volatile)
-> LOOP:
-> Compress if approaching context limit
-> Sanitize messages
-> LLM API call (with bound tools)
-> If tool calls: execute (parallel reads / sequential writes) -> loop back
-> If no tool calls: display text response -> done
The LLM sees your workspace structure, git status, and project instructions in the system prompt. It decides which tools to call — there's no routing logic, no planner node, no verifier. The model is the orchestrator.
Tools
| Tool | Permission | Parallel |
|---|---|---|
get_project_tree |
auto | yes |
read_file |
auto | yes |
list_directory |
auto | yes |
search_in_files |
auto | yes |
write_file |
ask | no |
create_file |
ask | no |
run_command |
ask | no |
Read-only tools run concurrently via ThreadPoolExecutor. Write tools run one at a time with a permission gate preview.
Context management
- Token budget — 80% of the model's context window. Loop exits when exhausted.
- Three-stage compression — checks before first call (estimated), before every call (real token count), and after tool execution. Protects the first message (user intent) and last 6 messages (recent context), summarizes the middle via a cheap auxiliary LLM.
Slash commands
| Command | Description |
|---|---|
/help |
Show help |
/clear |
Clear conversation history |
/provider |
Switch OpenAI model or API key |
/setup |
Re-run OpenAI key and model setup |
/usage |
Show session token usage |
/exit |
Quit |
Permission prompts
When the agent wants to write a file or run a shell command, you'll see a preview and be asked:
- y — allow once
- a — allow all for this session
- n — deny
Configuration
API keys are never read from .env. Paste them in the CLI during setup (/setup or /provider); they are saved to ~/.config/token/config.json.
Optional environment variables (non-secret tuning only):
| Variable | Default | Description |
|---|---|---|
WORKSPACE_ROOT |
. |
Sandbox workspace root |
SHELL_TIMEOUT_SECONDS |
300 |
Shell command timeout |
TOKEN_BUDGET_LIMIT |
200000 |
Per-session token budget |
Development
git clone https://github.com/Excergic/Token.git
cd Token
uv sync
cp .env.example .env # optional workspace overrides only
uv run token
Publishing (maintainers)
Releases are published to PyPI as excergic-token via GitHub Actions when a GitHub Release is published.
- Configure PyPI Trusted Publishing for
excergic-token→ GitHubExcergic/Token - Create a GitHub environment named
pypiin repo settings - Tag and release:
git tag v1.2.2
git push origin v1.2.2
# Create a GitHub Release from the tag — CI publishes automatically
Manual publish:
uv build
UV_PUBLISH_TOKEN=pypi-... uv publish
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file excergic_token-1.2.3.tar.gz.
File metadata
- Download URL: excergic_token-1.2.3.tar.gz
- Upload date:
- Size: 53.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ccf0f3dd8d67197432838b160582ea81f93ddd3fe51134a2133d11041168145
|
|
| MD5 |
b7742718e2d566ebeb062c1b538b60fa
|
|
| BLAKE2b-256 |
4425b90ae3e634d24c0fed9f26c90351bd20678109992906c9d77f5febe74bcc
|
Provenance
The following attestation bundles were made for excergic_token-1.2.3.tar.gz:
Publisher:
publish.yml on Excergic/Token
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
excergic_token-1.2.3.tar.gz -
Subject digest:
9ccf0f3dd8d67197432838b160582ea81f93ddd3fe51134a2133d11041168145 - Sigstore transparency entry: 2116559252
- Sigstore integration time:
-
Permalink:
Excergic/Token@a78110612381400417a3d71d3b3c0a459226ef08 -
Branch / Tag:
refs/tags/v1.2.3 - Owner: https://github.com/Excergic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a78110612381400417a3d71d3b3c0a459226ef08 -
Trigger Event:
release
-
Statement type:
File details
Details for the file excergic_token-1.2.3-py3-none-any.whl.
File metadata
- Download URL: excergic_token-1.2.3-py3-none-any.whl
- Upload date:
- Size: 76.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70d91167ed027a236661d5144d2c471034f807f9248d17bc98c70848460ea0e5
|
|
| MD5 |
a8382fcdf4c929f64cf5298837b8a0f6
|
|
| BLAKE2b-256 |
5ec8c3c4a4ae32e9815015bfaf0c39ac61abc2f84344ff9b747d072c0cb11b0c
|
Provenance
The following attestation bundles were made for excergic_token-1.2.3-py3-none-any.whl:
Publisher:
publish.yml on Excergic/Token
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
excergic_token-1.2.3-py3-none-any.whl -
Subject digest:
70d91167ed027a236661d5144d2c471034f807f9248d17bc98c70848460ea0e5 - Sigstore transparency entry: 2116559316
- Sigstore integration time:
-
Permalink:
Excergic/Token@a78110612381400417a3d71d3b3c0a459226ef08 -
Branch / Tag:
refs/tags/v1.2.3 - Owner: https://github.com/Excergic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a78110612381400417a3d71d3b3c0a459226ef08 -
Trigger Event:
release
-
Statement type: