Skip to content
stackingturtlesPublic

About

How many times has your agent said sorry and with what model.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

sorry

A small Rust CLI that asks TypeSafe's Jev whether Claude Code and Codex responses contain any admission of a mistake, then prints counts by week and the model that wrote the response.

Quick start

From the repository root, build the binary and set your TypeSafe API key:

scripts/build.sh
export TYPESAFE_API_KEY="your-typesafe-api-key"
bin/sorry

Replace the placeholder with your actual key. The export applies to the current terminal session. After the first build, just run bin/sorry. To limit the report to the past 90 days, run bin/sorry --lastdays 90.

Example output (illustrative):

Week      Model                Apologies
2026-W39  claude-opus-5-5              12
2026-W39  gpt-6.1-sol                   3
2026-W40  claude-opus-5-5               0
2026-W40  gpt-6.1-sol                   2

Progress goes to stderr; stdout contains only the three-column report.

Build

Requires Rust 1.89 or newer. Build once; running the binary doesn't require Rust:

scripts/build.sh

This creates an optimized, stripped native binary at bin/sorry. Re-run the build script after changing the source. On Linux, the native TLS dependency also requires OpenSSL development libraries and pkg-config to build.

What counts

Each assistant response counts at most once. Any admission of the assistant's own mistake qualifies, whether or not it includes an apology: “My mistake,” “I got that wrong,” “I misread your question,” “My earlier answer was incorrect,” and “That change I made introduced a regression.” Neutral or indirect admissions count too; remorse or explicit acceptance of blame is not required. The report column remains Apologies and includes all these admissions.

Sympathy, refusals, agreement or revisions without admitting an error, hypothetical mistakes, quoted examples, code, fictional dialogue, and someone else's mistakes don't count. The full rubric and examples sent to Jev live in src/apology.json.

Every distinct, uncached assistant text goes to Jev; there is no keyword filter. The CLI uses the documented Noul API, with a default yes-probability threshold of 0.5. Several responses share a request, but each gets its own question targeting only that response. Long responses are split into overlapping chunks without truncation and count once if any chunk crosses the threshold. This preserves text but can lose context across chunk boundaries, so classifications remain estimates.

Logs and grouping

  • Claude: recursively reads ~/.claude/projects/**/*.jsonl, including subagents. Respects CLAUDE_CONFIG_DIR.
  • Codex: recursively reads ~/.codex/sessions/**/*.jsonl and ~/.codex/archived_sessions/**/*.jsonl. Respects CODEX_HOME.
  • Reads assistant commentary and final replies, including subagent responses. Excludes user prompts, tool calls/results, reasoning blocks, and hook, system, and progress records. Joins Claude text blocks into one response and avoids Codex's duplicate event/message records and copied history.
  • Claude models come from message metadata; Codex models come from the active turn context. Missing model metadata is labeled claude-unknown or codex-unknown rather than inferred from today's configuration.
  • Weeks are Monday–Sunday ISO weeks in UTC, including the ISO week year. Every week/model combination with responses appears, even with zero apologies.
  • Missing log directories are fine. An unfinished final JSON record is skipped with a diagnostic. Other corrupt records or API failures stop the run with a nonzero exit code and no incomplete report.

Only local logs that still exist can contribute to the report. Quoted prompts, hook output, and code embedded in an assistant reply remain in the text sent to Jev; the rubric tells Jev not to count that quoted material as the assistant admitting a mistake.

Cache and options

Uncached assistant text is sent to TypeSafe. The local cache stores only text hashes, probabilities, and the Jev version that answered, without response text or API keys. Results are saved as classifications complete, so an interrupted run can resume. Identical text is evaluated once but each distinct occurrence still contributes to its own week/model count.

The cache lives at $XDG_CACHE_HOME/sorry/classifications.jsonl, or defaults to ~/Library/Caches/sorry/classifications.jsonl on macOS and ~/.cache/sorry/classifications.jsonl elsewhere. A fully cached run needs no API key or network access.

bin/sorry --lastdays 90
bin/sorry --since 2026-09-01
bin/sorry --threshold 0.8
bin/sorry --claude-dir /path/to/projects --codex-dir /path/to/codex-home
bin/sorry --cache /path/to/classifications.jsonl
bin/sorry --help

--lastdays N limits the report and Jev requests to the rolling past N × 24 hours, ending when the command starts. N must be a positive whole number. If you also specify --since, responses must satisfy both time limits.

The classifier defaults to jev-latest; set TYPESAFE_DEFAULT_MODEL or pass --jev-model to use a particular Jev version. Cache keys include the rubric, selected classifier model name, endpoint, and response text. Because jev-latest is a moving alias, delete the cache to re-evaluate existing text after an alias update, or pin a version. Changing the threshold reuses cached probabilities. Updating the rubric automatically reclassifies existing text on the next run.

TYPESAFE_BASE_URL can override https://api.typesafe.ai (HTTPS required, except for a local HTTP test server/proxy). Rate limits and temporary service errors receive up to three retries with backoff, respecting Retry-After.

Development

cargo test --locked
cargo clippy --locked --all-targets -- -D warnings
cargo fmt --check

Tests use a local mock HTTP server; no API key is needed. They verify log extraction, model changes, deduplication, UTC/ISO boundaries, batching, long messages, lookback limits, cache reuse/recovery, rate limits, and failed API responses. They don't measure Jev's classification accuracy.

See AGENTS.md for the project layout and guidance for coding agents.

About

How many times has your agent said sorry and with what model.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages