coding-tools
Declarative, agent-friendly command-line tools for working in a codebase, behind
one short ct command. Each tool replaces an ad-hoc shell pattern with a single,
self-describing command, and every tool is framed the same way — so what you learn
from one transfers to the next, and an agent can discover and drive them uniformly.
Tools
ct <command> dispatches to ct-<command> (git-style), or call each tool by its
full name.
| Command | Tool | Purpose |
|---|---|---|
ct search |
ct-search |
Recursively find files by name, type, size, and content (find | xargs grep). |
ct view |
ct-view |
Show a file's lines by range, or the regions around a pattern with context. |
ct tree |
ct-tree |
Report a file tree with per-file line/word/char counts; filter, sort, summarise. |
ct edit |
ct-edit |
Find/replace across files, gated by an --expect verdict and --dry-run. |
ct patch |
ct-patch |
Set/delete nodes by path in JSON/JSONC/JSONL, preserving comments and layout. |
ct test |
ct-test |
Run a command as a framed experiment; classify the result from its output. |
Why
A coding agent's loop is locate → read → change → verify. These tools make each step bounded, deterministic, and self-verifying, which is what lets it run with less supervision:
- Framed verdicts. A search or a command run can pose a
--question, classify into aSUCCESS/ERRORverdict, and--emita templated line; exit status follows the verdict.ct-search --expect nonepasses when nothing is found (a negative assertion);ct-edit --expect =1writes only if exactly one site matched, so a wrong-sized change fails loudly instead of applying silently. - Preview before write.
ct-edit --dry-runshows the diff and verdict without touching disk; edits preserve every untouched byte (indentation, terminators). - Read-only by default where it matters.
ct-testruns only a fixed, immutable allowlist of read-only commands. - Machine-readable. Every tool takes
--jsonfor structured results, and--explain [md|json]prints its own documentation / tool-use definition. The umbrella'sct --explain jsonis a one-call manifest of the whole suite.
Shared conventions
- Pattern promotion. Any pattern argument is promoted with one rule: no
metacharacters → literal substring; glob metacharacters (
*?[ ]) that are not a valid regex → glob; otherwise → regex. - Exit status.
0= success / verdictSUCCESS;1= clean negative / verdictERROR;2= usage or runtime error. The0/1split composes in&&/||pipelines. --explain [md|json]. Every tool is self-describing for humans and agents.
Examples
# Find Rust files mentioning TODO — just yes/no.
# Assert there are no leftover debug prints (passes when nothing matches).
# Read a span, or the neighbourhood of a symbol.
# Preview a one-site rename, then apply it.
# Frame a read-only check as a test.
The canonical reference for each tool is its --explain md output, mirrored under
docs/explain/; docs/specs/commands.md
is the suite index.
License
Apache-2.0. See LICENSE.