Skip to main content
Home: Florian Bruniaux Engineering & AI Contact

Florian Bruniaux / Explore

Search the site

Search in English or French, or jump to a section.

↑ ↓ to navigateEnter to openEsc to close

EN
Colour theme

Command-line tool · Creator

ctxharness

Find stale information in the instruction files your AI agents rely on.

Use it when a change to a version, script or path could leave stale instructions in CLAUDE.md or AGENTS.md.

TypeScript CLI Node.js

CLAUDE.md says Prisma 7.5 while package.json lists ^7.7.0. The agent then reasons from stale facts, silently, in every session. ctxharness catches the drift before it reaches your agents.

npx ctxharness scan CLAUDE.md   # zero-config — detect drift instantly
npx ctxharness run               # enforce assertions from .ctxharness.yml

Three layers of context engineering testing

L1: Fact drift. Versions, file existence, counts, regex captures. Any extractable fact from your codebase vs what your AI docs claim.

L2: Instruction quality. Vague language (“be careful”, “use your judgment”), positive/negative instruction ratio, token budget, multi-file coherence.

L3: Context assembly. Hook validation, skill loading, rule glob validity, coverage ratio.

What it looks like

AI Context Test — 5 assertions

fact                    expected       mentions  status
────────────────────────────────────────────────────────────────────────
next-version            16.2.3                1  ✗ 1 mismatch
prisma-version          7.7.0                 4  ✗ 1 mismatch
node-version            22.14.0               1  ✓ 1/1 pass
no-vague-language       check                 2  ✓ 2/2 pass
instruction-balance     check                 2  ✓ 2/2 pass

Mismatches
────────────────────────────────────────────────────────────────────────
next-version    CLAUDE.md:13    16.2.3    16.2.0
prisma-version  CLAUDE.md:13    7.7.0     7.5
✗ 2 mismatch(es) — update the file(s) listed above

Architecture

TypeScript monorepo, two packages:

  • @florianbruniaux/ctxharness-core: extractors, scanners, runner, reporter, snapshot, plugin API
  • ctxharness: CLI binary (Commander), 11 commands

20 extractors read ground truth from the codebase: packageJson, nvmrc, prismaModelList, trpcRouterList, cargoToml, goMod, gitStaleness, and more.

15 scanners validate AI doc files: inlineRegex, vaguenessPattern, hookValidity, skillValidity, coverageRatio, freshnessScore, and more.

Published CLI commands

ctxharness run       # run all assertions, exit 1 on drift
ctxharness check     # alias for run with text output
ctxharness scan      # zero-config heuristic claim detection
ctxharness score     # 0-100 health score with grade (S/A/B/C/D/F)
ctxharness fix       # auto-fix version drift (--apply to write files)
ctxharness doctor    # full L1/L2/L3 breakdown with remediation advice
ctxharness snapshot  # save quality baseline
ctxharness diff      # compare against baseline — exit 1 on regression
ctxharness init      # scaffold .ctxharness.yml
ctxharness trend     # show score history and direction across runs
ctxharness populate  # suggest assertions for uncovered claims

Cross-host audit: what I verified in August 2026

On 31 August 2026, I inspected the npm tarball for version 0.4.6: it does not contain the agent-config/ implementation or the doctor --host and doctor --scope options. The npx examples on this page run the published drift and quality features. They do not run the cross-host agent-configuration extension.

Source revision 80451b6d5ab372909b6186d313e982560ee25ecf adds that extension for Claude Code and Codex. At that revision, 286 tests passed, both packages built, and repository lint passed. Those results validate the pinned source checkout, not the npm tarball.

That audit applies to version 0.4.6 and the source revision cited above. The evidence model behind it is documented in Portable agent configuration is a release system, not a shared folder: static presence and parity remain separate from loaded, invoked and effective behavior.

Plugin API

Custom extractors and scanners via definePlugin / loadPlugin, usable in .ctxharness.yml like any built-in.

Stack presets

Ready-to-use config templates: T3 (Next.js + Prisma + tRPC), Next.js App Router, Python, Go, Rust.

CI integration

- name: Check AI doc drift
  uses: FlorianBruniaux/ctxharness@v0.4
  with:
    config: .ctxharness.yml
    format: gha

Also ships Husky hook templates (post-merge / post-checkout) and GitLab CI / CircleCI templates.

Versions covered by the August 2026 audit

  • npm package inspected: 0.4.6
  • Cross-host agent-configuration extension: source-only preview at revision 80451b6d5ab372909b6186d313e982560ee25ecf
  • Source revision validation: 286 tests passed, package builds passed, repository lint passed
  • npm 0.4.6 tarball: no agent-config/, --host, or --scope support
Back to tools & projects