8000 GitHub - jahau/agent-claim-check: Local-first, read-only CLI that checks coding-task acceptance criteria against observable evidence: Git changes, files and JUnit results · GitHub
[go: up one dir, main page]

Skip to content

About

Local-first, read-only CLI that checks coding-task acceptance criteria against observable evidence: Git changes, files and JUnit results

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

agent-claim-check

CI Release License: MIT

agent-claim-check checks a coding task's acceptance criteria against evidence you can observe: Git changes, project files and existing JUnit XML test results. It is meant for the moment a coding agent (or a person) says "done": instead of trusting the claim, you list what "done" means in a small JSON file and get a deterministic report that marks each criterion verified, missing or unverified.

It is local-first and read-only. It never runs commands from the claims file, never runs tests, never writes to the repository and never uses the network.

$ agent-claim-check check claims.json --base main --merge-base
agent-claim-check 0.1.0 (claims schema 1.0)
Task: Add client-side rate limiting (at most 10 requests per second) to WeatherClient
Git: 3 changed paths in the working tree compared with the merge base of HEAD and main (2d0cfc56655f)

VERIFIED    limiter-module: A rate limiter module exists
            src/rate-limiter.js exists
VERIFIED    existing-tests-untouched: Existing client tests were not edited to make them pass
            no changes to test/client.test.js compared with the merge base of HEAD and main (2d0cfc56655f)
MISSING     eleventh-rejected: The 11th request within a second is rejected
            test case "rejects the 11th request within a second" in "RateLimiter" did not pass (1 failed, 0 errored)
            - reports/junit.xml: "rejects the 11th request within a second" in "RateLimiter" failed
UNVERIFIED  concurrency-reviewed: Behaviour under concurrent calls was reviewed by a person
            needs human judgement; agent-claim-check does not verify it
...

The full output is in examples/rate-limit-task/report.txt.

What the statuses mean

Status Meaning
verified The evidence the criterion asks for was observed: the file exists, the file changed, the test case passed.
missing The evidence was looked for and is absent or contradicts the criterion: the file does not exist, nothing changed, a test failed, the report file is missing.
unverified The tool could not decide: the criterion needs human judgement, Git could not be inspected, a report is malformed, the test was skipped, or a committed report predates the changes.

verified is a statement about evidence, not about correctness. A changed file shows that work touched it, not that the change is right. See docs/limitations.md.

Installation

Requires Node.js 22 or later and, for Git-based criteria, git on PATH. The package has no runtime dependencies. It is not published to the npm registry.

From a release (each release lists SHA-256 checksums in SHA256SUMS):

npm install --global ./agent-claim-check-0.1.0.tgz
agent-claim-check --version

From source:

git clone https://github.com/jahau/agent-claim-check.git
cd agent-claim-check
npm ci --ignore-scripts
npm run build
node dist/cli.js --help

Writing a claims file

{
  "schemaVersion": "1.0",
  "task": "Add client-side rate limiting to WeatherClient",
  "git": { "base": "main", "mergeBase": true },
  "criteria": [
    {
      "id": "limiter-module",
      "description": "A rate limiter module exists",
      "check": { "type": "file-exists", "path": "src/rate-limiter.js" }
    },
    {
      "id": "existing-tests-untouched",
      "description": "Existing client tests were not edited to make them pass",
      "check": { "type": "file-unchanged", "path": "test/client.test.js" }
    },
    {
      "id": "suite-green",
      "description": "The whole test suite passes",
      "check": { "type": "junit-report", "reports": ["reports/junit.xml"], "minTests": 4 }
    }
  ]
}
Check type Verified when Parameters
file-exists The file exists (a path ending in / must be a directory). path
file-changed The file, or any file under a dir/ path, changed compared with the base. path, optional change: any (default), added, modified, deleted
file-unchanged The file, or every file under a dir/ path, is unchanged compared with the base. path
junit-testcase A test case with this name (and class name, if given) passed and none failed. reports, name, optional classname
junit-report The reports list no failures or errors and at least minTests passing test cases. reports, optional minTests (default 1)
manual Never; always unverified. Use it to keep human-judgement criteria visible. none

Paths are relative to the project root, use forward slashes and must stay inside the root. There is deliberately no check type that runs a command. The full format is described in docs/claims-format.md, with JSON Schemas in schemas/ (agent-claim-check schema claims prints one).

Running it

agent-claim-check check <claims.json> [--root <dir>] [--base <ref>] [--merge-base]
                                      [--format text|json] [--fail-on missing|unverified]
  • --root is the project directory that criteria paths are relative to (default: the current directory). It may be a subdirectory of a Git repository.
  • Git criteria compare the working tree (commi 829D tted, staged, unstaged and untracked files) with a base commit: HEAD by default, --base <ref> (or git.base) for a branch, tag or commit, and --merge-base for the point where the current branch left that ref, which is usually what you want for an agent's feature branch. A repository without commits is compared with an empty tree.
  • --format json writes a report that follows schemas/report-1.0.schema.json.
  • Output is deterministic: criteria in file order, changes sorted by path, no timestamps, and no absolute paths.

Exit codes: 0 the report was written and the threshold (if any) was not reached; 1 the --fail-on threshold was reached; 2 usage error or invalid claims file. --fail-on missing fails when any criterion is missing; --fail-on unverified fails when any criterion is missing or unverified.

In CI

Produce the test reports in the same job, so they describe the code under review, then check the claims:

- run: node --test --test-reporter=junit --test-reporter-destination=reports/junit.xml
- run: agent-claim-check check .claims/rate-limit.json --base origin/main --merge-base --fail-on missing

(with agent-claim-check installed from a release tarball in an earlier step).

Fetch enough history for the base (actions/checkout with fetch-depth: 0); with a shallow clone the base is not found and Git criteria are reported as unverified.

Demo

examples/rate-limit-task is a synthetic project: a weather API client whose agent claims to have added rate limiting. npm run demo builds the repository in a temporary directory (a base commit on main and the agent's commit on its own branch), adds the test run's JUnit output and regenerates report.txt and report.json. The report shows the limiter file and the client change as verified, the existing tests as untouched, a failing test and an undocumented README as missing, and a human review as unverified. CI regenerates the reports on Linux, macOS and Windows and fails if they differ by a single byte.

Security and privacy

  • Nothing in the claims file is executed; unknown check types and unknown properties are rejected.
  • Git is run only with fixed plumbing commands from an absolute PATH directory outside the project, with GIT_* variables from the caller removed, optional locks off and the file-system monitor disabled. Plumbing commands do not refresh the index, so clean filters, external diff drivers and hooks configured in the repository are never started (a test proves it).
  • JUnit XML is parsed by a small built-in parser that rejects document type declarations, so external entities and entity expansion cannot occur. Size, depth and element counts are bounded.
  • Failure messages and captured output in test reports are never read into the report; they often contain secrets.
  • Paths from the claims file cannot escape the project root, including through symbolic links.
  • Text from input files is escaped before it is printed, so control characters and bidirectional overrides cannot manipulate the terminal.

See SECURITY.md to report a vulnerability.

Related tools

Tools such as dunnit and DoneSpec re-run the checks themselves. agent-claim-check takes the opposite approach: it runs nothing and only reads evidence that already exists, so it can be pointed at an untrusted working tree and fits after the step of a CI job that runs the tests.

License

MIT. See docs/license-review.md for the dependency review.

About

Local-first, read-only CLI that checks coding-task acceptance criteria against observable evidence: Git changes, files and JUnit results

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages

0