Coding agents
Give Claude Code, Codex or any agent a filtered, accounted-for review instead of a raw diff.
A raw git diff hands an agent everything: reformatted blocks, re-sorted imports, a changed quote style. It costs context and it buries the change that matters. mantish diff hands it a review where the noise has been classified, removed and counted, so the agent knows what it did not see.
No MCP server or model integration is involved — these are commands. You document them in the project's instructions, or give the agent the mantish-cli skill, and the agent runs them.
1. Add a profile
<repo>/.mantish/profiles/agent.json, committed so the whole team's agents share it:
{
"version": 1,
"format": "diff",
"context": 3,
"whitespace": "exact",
"muteTags": [],
"hideTags": ["whitespace", "formatting", "code-style", "syntax-sugar", "indentation"],
"spotlightTags": ["breaking", "error-handling", "type-change"]
}
whitespace: exact is deliberate: it lets the engine classify the noise and then hide it with a count, rather than making it invisible to the analysis. The profile does not hide imports, comments, renames or uncertain changes — those can change behaviour.
2. Put the commands in your project instructions
mantish diff --profile agent --format diff
mantish diff main...feature --profile agent --format json
mantish diff before.ts after.ts --profile ./agent-diff.json --format markdown
mantish diff --profile agent --format side-by-side --width 160
A snippet to paste into CLAUDE.md, AGENTS.md or the equivalent:
## Reviewing changes
Use `mantish diff --profile agent --format diff` for the first look at a change: it is a semantic
review with formatting and whitespace noise removed and counted, which costs far less context than
`git diff`.
- The output shows the source only. `# N files not shown` at the end counts files whose every edit
was hidden; a file that could not be compared says so under its header.
- To see how much was left out, or whether every file was analysed, rerun with `--stats` and read
the `# files:`, `# edits:` and `# coverage:` preamble lines. If `coverage:` is not `complete`,
open the files it names directly.
- The output is a filtered review, **not a patch**. Never pipe it to `git apply`.
- When you need the omitted detail, read the original files or run `git diff`.
- `mantish usages SYMBOL...` lists where each symbol is used, as the engine binds names, and says
what it searched; `mantish impact` lists what the current change may break; `mantish check` is the gate
before handing a change over.
- An answer with `"complete": false` is a lower bound and a place with `"proven": false` a guess:
grep for the name as well before deleting or renaming anything.
3. Use the exit code in scripts
mantish diff --profile agent --format json --exit-code > review.json
case $? in
0) echo "nothing left to review" ;;
1) echo "changes to review" ;;
2) echo "mantish failed" >&2; exit 2 ;;
esac
Hidden changes never cause exit 1 — they are reported in the counts instead. See exit codes.
Pull requests
An agent can read a pull request the same way, without a checkout: mantish pr diff 42 -r shop writes the pull request's diff with your profile's filtering, read through Mantish from GitHub, Azure DevOps, GitLab or Bitbucket (see the CLI reference). And with AI triage your agent sorts a pull request's files into what you should read closely, skim or skip — you start it from Mantish with one copied prompt.
What an agent gets is yours to limit: files under [agents] or [agent-content] in your ignore files are left out or listed without their content (Ignored files) — for mantish diff as well.
Usages and callers
Instead of a text search, an agent can ask Mantish where a symbol is used and who calls it — mantish usages OrderService.Place and mantish flow OrderService.Place --callers — across the repository when its index is ready, as the engine's navigation binds names. Each answer says what it searched and whether it is whole; --format json writes it for a script (see the CLI reference). "Where is it set?" is mantish usages OrderService.Status --writes.
What a change may break
mantish impact — or mantish pr impact 42 -r REPO for a pull request — tells an agent what its change may break before it calls the work done: the references it left behind, the callers and implementations of a changed signature it did not update, the callers of a changed body and the tests that reach it. Each entry names the mantish usages and mantish flow commands that list its places in full; what the diff judged harmless is counted, not listed. It never fails a run for what it finds (see the CLI reference).
Diagrams for a pull request
An agent that wants to show a flow or what its change may break in a pull request's description does not have to draw it: --format mermaid writes mantish flow, mantish impact and mantish diagram — or their pr forms — as a Mermaid flowchart GitHub and GitLab render as it is: at most 40 boxes, with the command that writes the whole answer in a comment (see the CLI reference).
A gate before the work is handed over
mantish check is the one gate for a pre-commit hook, CI and a coding agent: it fails when the change has a spotlight — a commented-out call, a disabled test, whatever your profile puts forward — or a breaking entry of mantish impact. Each finding names its place and its reason; an impact finding names the mantish usages command that lists what remains. A large change is checked whole: the impact stops at a time budget, and the check asks again of the files it left until every one is examined — a file no round reached is an unchecked finding with the command that checks it alone. A changed signature with more direct callers than the engine reads is unchecked too, with the command that lists them all. It exits 0 when nothing fails, 1 with findings and 2 when it could not check. --fail-on spotlight or --fail-on impact narrows it, --fail-on spotlight:disabled-test to one reason (see the CLI reference).
A pre-commit hook, .git/hooks/pre-commit (executable), that lets a commit through when Mantish could not run and says so:
#!/bin/sh
# The working tree against HEAD, judged as the team's agent profile judges it.
mantish check --profile agent
status=$?
if [ "$status" -eq 2 ]; then
echo "mantish check could not run — committing without the gate" >&2
exit 0
fi
exit "$status"
It judges the working tree, untracked files included, not the staged files alone. In CI, where a run that could not check must fail too, check what the branch adds to main:
mantish check origin/main...HEAD --format json > mantish-check.json
A check that could not cover everything — the repository's index not ready, a file it could not analyse — passes when it found nothing and says so ("complete": false in the JSON): read incompleteBecause before calling a change safe.
The mantish-cli skill
A skill tells an agent which mantish command answers which question, how to name a symbol, how to read what an answer proved and what it did not, and when grep is the right tool — so you do not have to write it into your instructions. It is one folder, mantish-cli/: a SKILL.md whose front matter holds only name and description, and a references/ folder the agent reads only when it parses a command's JSON or needs a flag the skill does not name.
- Claude Code: the skill comes with the Mantish plugin (
/plugin install mantish --marketplace mantish-dev/app) and is listed as/mantish:mantish-cli; Claude uses it on its own when a task calls for it. Do not copy it into.claude/skills/as well — it would be listed twice. - Other agents that read skills from a folder: copy
plugin/claude-code/skills/mantish-cli/from themantish-dev/apprepository — the same folder the plugin installs — into the folder your agent reads skills from, such as.agents/skills/mantish-cli/in the repository, committed so the whole team's agents share it. Copy it again when you update Mantish: it names the commands and flags of themantishit was released with.
An agent that reads no skills gets the same essentials from the snippet in section 2.
What to be honest about
- The output is a review excerpt, not a reconstruction of the diff. It cannot be applied.
- A profile is a noise preference, not proof that the omitted changes cannot affect behaviour. Check
analysisComplete,filteredand the omission counts before concluding a change is safe. - Ordering is stable for identical inputs, configuration and engine version, so captured output is comparable between runs.
- Nothing about the run is saved: no settings are written, and no credentials or server addresses appear in the output.
mantish usages,mantish flowandmantish impactsee what the engine can bind. A call made through a string, reflection, configuration or generated code is not among their places, and an answer that did not search everything says so —"complete": falseis never "unused".