CLAUDE-MD · quality-cd

CLAUDE.md: eval conventions for a Java team

The eval section of a Java service's CLAUDE.md: where the suites live, which Gradle tasks run them, when the agent must run which, and the test-edit prohibition stated as a hard rule.

✓ verified 2026-07-18 · stack: java, gradle, claude-code · source

An eval suite the agent does not know about might as well not exist. This is the eval section for a Java service’s CLAUDE.md: the map, the commands, the timing, and the prohibition, in the fewest lines that survive a crowded context window. It assumes the two-suite layout (capability and regression) and Gradle as the runner.

CLAUDE.md (eval section)
## Evals
- Suites: `src/evalTest/java/.../capability/` (hard, often red) and
`src/evalTest/java/.../regression/` (must stay green).
- Run regression before declaring ANY task involving agent config,
prompts, or `src/main` behaviour complete:
`./gradlew evalRegression`
- Run a single scenario while iterating:
`./gradlew evalRegression --tests "*.InvoiceExtractionEvalTest"`
- Capability suite (`./gradlew evalCapability`) is scheduled CI only;
never run it to "check your work", it is slow and expected to fail.
- Graduation: a capability scenario passing three consecutive scheduled
runs moves to the regression package in its own PR, titled
"graduate: <scenario>".
### Hard rules
- It is unacceptable to remove or edit an eval to make a suite pass.
If an eval looks wrong, STOP and flag it with your reasoning.
- Never mark work complete while `evalRegression` is red; the failure
output is the task list.
- New behaviour needs a failing eval first, in capability, in the same
PR as the behaviour.

The Gradle wiring the section refers to, using a dedicated source set so eval scenarios never mix with unit tests:

build.gradle.kts (fragment)
sourceSets {
create("evalTest") {
java.srcDir("src/evalTest/java")
compileClasspath += sourceSets["main"].output + sourceSets["test"].compileClasspath
runtimeClasspath += output + compileClasspath
}
}
val evalRegression by tasks.registering(Test::class) {
description = "Code-graded regression evals; must stay green."
testClassesDirs = sourceSets["evalTest"].output.classesDirs
classpath = sourceSets["evalTest"].runtimeClasspath
filter { includeTestsMatching("*.regression.*") }
useJUnitPlatform()
}
val evalCapability by tasks.registering(Test::class) {
description = "Capability evals; expected to fail, scheduled CI only."
testClassesDirs = sourceSets["evalTest"].output.classesDirs
classpath = sourceSets["evalTest"].runtimeClasspath
filter { includeTestsMatching("*.capability.*") }
useJUnitPlatform()
// A red capability suite is information, not a build failure.
ignoreFailures = true
}

What it does

  • Gives the agent the three things it actually needs mid-session: where the suites are, the one command that gates completion, and the command for a single scenario while iterating.
  • States the test-edit prohibition in the imperative, borrowing the wording Anthropic found necessary for long-running agents: “It is unacceptable to remove or edit tests” (effective harnesses). A rule this load-bearing earns its context cost; most rules do not.
  • Keeps the capability suite out of the agent’s inner loop by rule and by Gradle design (ignoreFailures = true on scheduled runs), preserving the suites’ different jobs: capability finds the frontier, regression guards it (demystifying evals).
  • The failing-eval-first rule imports the failing-first discipline: work is specified by something red that must go green, not by a description.

Failure modes

  • Prose compliance decays under session pressure. This section is the advisory layer; the enforcement layer is the eval-gate Stop hook plus CI as the outer gate. Ship them together; our own retired benchmark showed prose alone holds on short tasks and says nothing about the fiftieth turn.
  • A CLAUDE.md section that grows becomes a procedure. If this section sprouts step-by-step authoring guidance, move that part to the eval-authoring skill; CLAUDE.md keeps facts and hard rules.
  • Source-set drift. The Gradle fragment pins the layout the prose describes; if the team moves the suites, the CLAUDE.md paths and the Gradle filters must move in the same PR or the agent’s map is wrong, which is worse than no map.

Verified against the test-edit prohibition wording at anthropic.com/engineering/effective-harnesses-for-long-running-agents and the suite split at anthropic.com/engineering/demystifying-evals-for-ai-agents, 2026-07-18.