Skip to main content

Cohrint Agent

AI coding agent with per-tool permissions, cost tracking, prompt optimization, and anomaly detection. Works across Claude (API), Claude Code, Codex CLI, and Gemini CLI.

Install

pip install cohrint-agent

Requires Python 3.9+.

Quick Start

Interactive REPL

# Set your API key, then launch
export ANTHROPIC_API_KEY=sk-...
cohrint-agent

One-shot prompt

cohrint-agent "explain the main function in cli.py"

Pipe mode

echo "summarize this file" | cohrint-agent

Backends

Cohrint auto-detects the best backend. You can override with --backend:

Backend Description Requires
api Direct Anthropic API (exact token counts) ANTHROPIC_API_KEY
claude Claude Code subprocess (free tier / subscription) claude binary
codex OpenAI Codex CLI subprocess codex binary
gemini Gemini CLI subprocess gemini binary
cohrint-agent --backend claude "refactor this function"
cohrint-agent --backend codex "write unit tests for auth.py"

Auto-detect priority: COHRINT_BACKEND env → ANTHROPIC_API_KEY → claude binary → codex binary → gemini binary.

Session Management

Sessions are persisted to ~/.cohrint/sessions/. Resume any previous session:

# List sessions and costs
cohrint-agent summary

# Resume by session ID
cohrint-agent --resume abc12345

REPL Commands

Command Description
/help Show all commands
/tools Show tool approval status
/allow Bash,Write Approve specific tools
/allow all Approve all tools for this session
/cost Show current session cost
/optimize on|off Toggle prompt optimization
/model claude-opus-4-6 Switch model mid-session
/reset Clear history, permissions, cost
/quit Exit (shows final cost summary)

Cost Tracking

Every turn shows token usage and cost. Exit shows a full session summary:

  +----- Cost Summary -----+
  Model:             claude-sonnet-4-6
  Input tokens:      1,234
  Output tokens:     456
  Cost:              $0.0123
  Session total:     $0.0456
  Prompts:           3
  +-------------------------+

For Claude Code / Codex / Gemini (subscription or free tier), costs are labeled ~$0.00 (free tier) or ~$0.0123 (estimated).

Cohrint Dashboard

Send telemetry to your Cohrint dashboard for cross-session cost analysis:

export COHRINT_API_KEY=crt_...
cohrint-agent

Or pass inline: cohrint-agent --cohrint-key crt_...

All Flags

cohrint-agent [OPTIONS] [PROMPT]

  PROMPT              One-shot prompt (omit for interactive REPL)

  --backend           api | claude | codex | gemini (auto-detected)
  --model             Model ID (default: claude-sonnet-4-6)
  --max-tokens        Max output tokens (default: 16384)
  --resume SESSION_ID Resume a previous session
  --api-key           Anthropic API key (or ANTHROPIC_API_KEY env)
  --cohrint-key       Cohrint dashboard API key (or COHRINT_API_KEY env)
  --system            Custom system prompt
  --no-optimize       Disable prompt optimization
  --cwd               Set working directory
  --debug             Enable debug output

Environment Variables

Variable Description
ANTHROPIC_API_KEY Anthropic API key
COHRINT_API_KEY Cohrint dashboard key
COHRINT_BACKEND Force backend (api/claude/codex/gemini)
COHRINT_MODEL Default model override

License

MIT

Metadata

Release files for cohrint-agent 0.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cohrint-agent 0.4.2
File Size Uploaded
cohrint_agent-0.4.2.tar.gz 209.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cohrint-agent 0.4.2
File Interpreter ABI Platform
cohrint_agent-0.4.2-py3-none-any.whl Python 3 none any Details

Total release size: 353.1 kB

Release files / cohrint_agent-0.4.2.tar.gz

Download URL cohrint_agent-0.4.2.tar.gz
Size 209.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d493084fa710dd96c3769d4cac672c955a86f009b2444de6c166dec317e96a4f
BLAKE2b-256 checksum
How to use checksums
2ff7b5e09fa451984ce836c88cdf8cbfc04b83e24d7883826c53e3d68b139192
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / cohrint_agent-0.4.2-py3-none-any.whl

Download URL cohrint_agent-0.4.2-py3-none-any.whl
Size 143.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba0c318c763fad4718d676c50f611006edeb12c8a5442b9ec341e9d1791f63d0
BLAKE2b-256 checksum
How to use checksums
18ea959fdf2b608ef2200330d124d8d65ed55d6712e665f3545fa8c6a16f1921
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.4.2 This release

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page