klag CLAUDE.md

klag CLAUDE.md is an instructions file for coding agents from themoah/klag. It costs 5,954 tokens per session, scanned A, original, Apache-2.0.

A project guide for Klag, a Java service that monitors Kafka consumer lag and exports metrics. It documents build, test, end-to-end testing, and GraalVM native-binary commands.

In plain words
What is it for?
Use it when developing, testing, packaging, or creating a native executable for Klag.
Why use it?
It gives coding agents the project's architecture, required Java setup, and standard commands for building and validating changes.

Instructions file

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/themoah/klag/claude-md
Clone the repo
git clone --depth 1 https://github.com/themoah/klag

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for klag CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/themoah/klag/claude-md.svg)](https://agentmods.dev/instructions/themoah/klag/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/themoah/klag/claude-md"><img src="https://agentmods.dev/badge/instructions/themoah/klag/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 5,954 This file is loaded in full into every session.
When invoked 5,954 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.05954 $0.05954
Opus 5 $0.02977 $0.02977
Sonnet 5 $0.01191 $0.01191
Haiku 4.5 $0.00595 $0.00595

Measured today against content hash 1550b10b210d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

klag CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 319 lines

How it starts

The opening of the file, as written. The whole thing — 319 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

Project Overview

Klag is a Kafka Lag Exporter built with Vert.x 4.5.30. Monitors consumer lag and group states with Prometheus/Datadog/OTLP metrics.

Build Commands

# Requires Java 21 - use SDKMAN if needed: sdk use java 21.0.9-tem
# Local: use ./gradlew | CI: uses gradle directly (no wrapper JAR committed)

./gradlew compileJava          # Compile
./gradlew test                 # Run tests
./gradlew assemble             # Package (creates fat JAR)
./gradlew run                  # Run with hot-reload

./scripts/test-helm-chart.sh   # Helm chart template tests (offline)
./scripts/e2e-test.sh          # Full e2e: k3d + real Kafka + chart + lag asserts
./scripts/e2e-strimzi-test.sh  # e2e against Strimzi-operator-managed Kafka (KRaft)
./scripts/e2e-strimzi-matrix.sh # Strimzi e2e across supported Kafka versions

GraalVM Native Image (startup/memory optimized)

Requires a GraalVM JDK 21 (LTS) with native-image (e.g. sdk install java 21.0.2-graalce). Run Gradle with that JDK as JAVA_HOME/GRAALVM_HOME.

gradle nativeCompile           # -> build/native/nativeCompile/klag (standalone binary)
docker build -f Dockerfile.native -t klag:native .   # distroless runtime image
scripts/benchmark-startup.sh native - build/native/nativeCompile/klag  # startup/RSS bench

Native config lives in build.gradle.kts (graalvmNative block) plus reachability hints in src/main/resources/META-INF/native-image/. Reflection metadata for Netty, kafka-clients, logback and micrometer comes from the GraalVM Reachability Metadata Repository (auto-enabled). Entry point is KlagLauncher (direct new MainVerticle(), no reflective Vert.x launcher).

Measured (macOS arm64, prometheus reporter, Kafka up): native ≈ 70-100 ms startup / 44 MB RSS vs JVM 21 ≈ 470-520 ms / 119 MB. JVM 25 (LTS) showed no startup/memory gain over 21 for this workload (slightly higher RSS), so the runtime stays on JDK 21.

Architecture

Vert.x reactive framework with Future<T>-based async API.

Read the full file on GitHub · 319 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today Changed · +33 lines · +780 tokens per session 1550b10b210d
  2. 4d ago First seen · 286 lines · 5,174 tokens per session scan A bfb569197f7d

Subscribe to this mod's changes

klag CLAUDE.md is an instructions file published in the GitHub repository themoah/klag (82 stars, last pushed 3d ago), licensed Apache-2.0. It adds 5,954 tokens to every session, about $0.0298 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.