Skip to main content
Glama

guard_diff_audit

Idempotent

Audit working-tree diff size against configured line and file thresholds before large edits; get added and deleted lines, file count, and a warn or hard verdict.

Instructions

Audit the working tree's size against the configured line and file thresholds.

Use it before a large edit, or when status shows a warn or hard diff, to see added/deleted lines, file count, and the verdict. baseline is an optional git ref string, default None (HEAD). Thresholds come from config: warn at 400 lines or 10 files, hard at 800 lines, unless the project or personal config overrides them. It returns the rendered diff audit, including a bounded-scan note when untracked reads hit their caps, and a Nudge. Outside a git repo the text says the diff is unavailable. Side effects: creates .agent-guard/ and seeds config.json if that file is missing, and runs git. Untracked content reads are capped (1000 files, 1 MB per file, 8 MB total). It does not modify the worktree or the ledgers.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "guard_diff_audit"
  }
}

Input Schema

NameRequiredDescriptionDefault
baselineNoGit ref to diff the working tree against. String or omitted. Default None, which means HEAD (an unborn repository is compared as an unborn HEAD). Example: a commit sha. A ref git cannot resolve is reported in the text; it is not raised.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv3.3.1
    • addedInput schema / properties / baseline / description
      Added value: +"Git ref to diff the working tree against. String or omitted. Default None, which means HEAD (an unborn repository is compared as an unborn HEAD). Example: a commit sha. A ref git cannot resolve is reported in the text; it is not raised."
  2. First observedv0.1.0

TDQS

A4.1/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Goes well past the annotations by naming the actual side effects (creates `.agent-guard/`, seeds `config.json`, runs `git`), the read caps (1000 files, 1 MB per file, 8 MB total), the thresholds applied, and an explicit non-effect ('does not modify the worktree or the ledgers'). The readOnlyHint=false annotation is consistent with the disclosed config writes rather than contradicted by them.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose is front-loaded in the first sentence, then usage, thresholds, return, and side effects in a sensible order. Slightly long with some density that could be trimmed, but essentially every sentence carries information an agent needs.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers everything material for a one-parameter audit tool: triggers, effective thresholds, side effects, read bounds, error behavior, and the fact that it does not mutate the worktree or ledgers. Output is described even though an output schema already exists.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and the `baseline` description already covers the string-or-null shape, the HEAD default, and the case of an unresolvable ref. The description only restates the default, adding no syntax or format detail the schema does not already supply.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and object: audit the working tree's size against configured line and file thresholds. It implies its relationship to the status tool ('when status shows a warn or hard diff') but never names guard_status or guard_verify explicitly, so the sibling boundary is only loosely established.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives concrete trigger conditions: before a large edit, or when status reports a warn or hard diff. It also flags the non-git failure mode ('the text says the diff is unavailable'), though it never states when a different guard tool would be the better choice.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.