project

Project-specific instructions for Klag, a Java service that monitors Kafka consumer lag and exports monitoring data. They describe its build commands, source layout, runtime requirements, tests, and native-image setup.

In plain words
What is it for?
Use them when compiling, testing, running, packaging, or navigating the Klag codebase, including its Kafka, metrics, Helm, and end-to-end test areas.
Why use it?
They give a coding agent the project context and commands needed to make changes consistently.

Cursor rule for Cursor

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 rules/themoah/klag/project
Clone the repo
git clone --depth 1 https://github.com/themoah/klag

Made for: Cursor.

Per session 554 This file is loaded in full into every session.
When invoked 554 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.00554 $0.00554
Opus 5 $0.00277 $0.00277
Sonnet 5 $0.00111 $0.00111
Haiku 4.5 $0.00055 $0.00055

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

Security

Grade A, and why

project 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 yesterday.

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.

.cursor/rules/project.mdc · 60 lines

What it actually says

Klag

Kafka consumer lag exporter (Vert.x 4.5.30, Java 21). Monitors lag, velocity, hot partitions, time-based lag, commit freshness, ISR, and group state. Exports to Prometheus, Datadog, or OTLP.

Build

# Java 21 — sdk use java 21.0.9-tem
./gradlew compileJava   # compile
./gradlew test          # unit tests
./gradlew assemble      # fat JAR
./gradlew run           # hot-reload dev

./scripts/test-helm-chart.sh    # Helm template tests (offline)
./scripts/e2e-test.sh           # k3d + real Kafka e2e
./scripts/e2e-strimzi-test.sh   # Strimzi/KRaft e2e

CI uses gradle directly (wrapper JAR is not committed). Local dev uses ./gradlew.

Native image: GraalVM JDK 21 + gradle nativeCompilebuild/native/nativeCompile/klag. Entry point is KlagLauncher (no reflective Vert.x launcher).

Layout

src/main/java/io/github/themoah/klag/
├── MainVerticle.java       # HTTP router, lifecycle
├── config/                 # AppConfig, Env
├── health/                 # probes, version
├── kafka/                  # KafkaClientService[Impl]
├── metrics/                # collector, reporter, velocity/hotpartition/timelag
├── mcp/                    # read-only MCP snapshot tools
└── model/                  # Java 21 records

HTTP endpoints

Path Purpose
/healthz Liveness (always 200)
/readyz Readiness (200 if Kafka up)
/metrics Prometheus scrape
/version Build info
/mcp MCP JSON-RPC (if MCP_ENABLED=true)

Code style

  • Async APIs return Future<T>; use Java 21 records for DTOs
  • SLF4J + Logback; no stdout from application code
  • Config precedence: classpath application.propertiesKLAG_CONFIG_FILE → env vars
  • Bump version in build.gradle.kts after minor/major changes
  • Minimize diff scope; match existing patterns; no drive-by refactors

Full env var and metric reference: CLAUDE.md.

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. yesterday First seen · 60 lines · 554 tokens per session scan A 17cdd078d011

Subscribe to this mod's changes

project is a cursor rule published in the GitHub repository themoah/klag (81 stars, last pushed yesterday), licensed Apache-2.0. It adds 554 tokens to every session, about $0.0028 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.