Files
krust/AGENTS.md
T
Erfan YousefiandClaude Opus 4.8 897fd38066 build: add Makefile as the single entry point for dev/CI/release
One make interface that runs the same commands locally and in CI.

- `make validate` = fmt-check -> check -> test -> release build (the pre-PR gate).
- `make ci` (alias) is now what .github/workflows/ci.yml runs; release.yml's
  validate stage runs `make validate` and its per-target build/package runs
  `make package TARGET=<triple>` (byte-identical artifact: krust-<triple>.tar.gz
  containing krust-<triple>/{krust,README.md,LICENSE}).
- Convenience targets: fmt, check, clippy, test, build(-release), run, clean,
  package; lab-{up,load,contexts,crds,churn,down} wrap scripts/scale; and
  bench/bench-contexts/soak/discover/metrics wrap the headless harnesses.
- cargo is resolved robustly (PATH, then a Homebrew keg-only rustup, else
  plain cargo) and its dir is put on PATH so external subcommands (cargo-fmt,
  cargo-clippy) and rustc resolve even when rustup is keg-only.
- dist/ (package output) gitignored. Docs (contributor guide, AGENTS, README)
  point at `make validate`.

Verified locally: make validate green (85 tests), make package produces the
release tarball, cargo resolves with no keg on PATH. CI running `make ci` on
this PR is the cross-environment proof.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25 00:00:48 +02:00

3.3 KiB

AGENTS.md

Project Intent

krust is a latency-first, power-user Kubernetes TUI for very large environments:

  • many contexts/clusters
  • many resources per cluster
  • frequent churn

Agent behavior must prioritize snappiness and controlled API pressure over feature breadth.

Mandatory Change Pipeline

After every code change, run make validate — it runs, in order:

  1. cargo fmt --all -- --check
  2. cargo check --locked
  3. cargo test --locked
  4. cargo build --release --locked

This is the same target CI runs (make ci). Use make fmt to auto-format.

Rules:

  • If tests fail, do not proceed to release build until fixed.
  • Always report all four outcomes in the update.

Commit Autonomy And Authorization

Agents are allowed to decide logical commit boundaries while working, especially when moving from one feature/fix area to another.

Hard rule:

  • Before creating a commit, stop and request explicit user authorization.
  • No commit without a clear user approval in the current thread.

Commit request format:

  • Summary of what will be committed
  • Files touched
  • Validation status (fmt/check/test/release)
  • Proposed commit title

Performance Thinking Model (Non-Negotiable)

When designing or changing behavior, explicitly reason in this order.

1) Scope activation

  • Default to lazy activation.
  • Do not eagerly watch all contexts or all kinds unless explicitly requested.
  • Only activate watches required by the visible pane/action.

2) API pressure control

  • Prefer watch over poll where possible.
  • Keep reconnect backoff bounded.
  • Avoid fan-out explosions (context x kind x namespace) unless user-initiated.
  • Treat RBAC denials and unavailable APIs as expected states, not fatal paths.

3) Compute budget

  • Avoid full recompute on every event/keypress.
  • Recompute only affected projections.
  • Keep filtering/sorting scoped to active view.
  • Favor stable O(visible) or O(active-view) paths over O(total-store) paths.

4) Render budget

  • Render on invalidation, not continuous redraw.
  • Cap frame rate.
  • Avoid rebuilding large text buffers unless source changed.
  • Clamp vertical/horizontal scrolling to content bounds.

5) Memory bounds

  • Use bounded channels/ring buffers for high-volume streams (logs/events).
  • Ensure no unbounded queue growth under churn.
  • Prune or expire caches when no longer active.

6) Logs at scale

  • Stream only what user asked for (pod/container/replica scope).
  • Support multi-source aggregation without duplicate stream restarts.
  • Prefix source identity clearly for merged streams.
  • Reconnect with backoff; avoid replay storms.

7) UX under load

  • Keep input responsive even when data updates are heavy.
  • Never block UI navigation on slow API calls.
  • Show partial data quickly; degrade gracefully with clear status.

Implementation Guardrails

  • Prefer minimal diffs that preserve current fast paths.
  • Avoid introducing background work that scales with total cluster size by default.
  • If adding a new feature, define:
    • activation trigger
    • steady-state CPU/memory impact
    • API call/watch impact

Verification Expectations For Perf-Sensitive Changes

For changes touching watches, filtering/sorting, rendering, or logs, include:

  • what hot path changed
  • why the new path is cheaper or safer
  • potential regressions to watch for

If measurement is available, include it. If not, provide complexity-level reasoning.