cluster-efficiency

A command for analyzing how efficiently a Kubernetes cluster uses computing resources. Kubernetes is software for running and managing containerized applications.

In plain words
What is it for?
Reviewing nodes and workloads, investigating out-of-memory failures, examining autoscaling, focusing on costs, saving reports, and comparing results over time.
Why use it?
It helps reveal wasted capacity, resource shortages, memory failures, and possible cost problems across the cluster.

Command

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 commands/dapi/claude-code-marketplace/cluster-efficiency
Clone the repo
git clone --depth 1 https://github.com/dapi/claude-code-marketplace
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,657 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00000 $0.02657
Opus 5 $0.00000 $0.01328
Sonnet 5 $0.00000 $0.00531
Haiku 4.5 $0.00000 $0.00266

Measured 2d ago against content hash 677a64140f3b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cluster-efficiency scanned grade A with 1 finding 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 2d ago.

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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

kubectl --context=$CONTEXT exec -n monitoring $PROM_POD -c prometheus -- wget -qO- 'http://localhost:9090/api/v1/query?query=sum+by+(namespace,pod)(increase(container_oom_events_total[7d]))'
cluster-efficiency/commands/cluster-efficiency.md · 253 lines

How it starts

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

/cluster-efficiency — Анализ эффективности ресурсов кластера

Выполни комплексный анализ эффективности использования ресурсов кластера Kubernetes.

Аргументы

Передаются через $ARGUMENTS:

  • --context=NAME — Kubernetes контекст
  • --namespace=NS — Фильтр по namespace
  • --focus=AREA — Фокус: all, nodes, workloads, karpenter, cost
  • --save — Сохранить отчет
  • --compare — Сравнить с предыдущим
  • --prometheus — Использовать Prometheus
  • --deep — Глубокий анализ с подагентами

Режим работы

Фаза 0: Сбор контекста (ОБЯЗАТЕЛЬНО!)

Определи контекст Kubernetes:

CONTEXT="${CLUSTER_EFFICIENCY_CONTEXT:-$(kubectl config current-context)}"
echo "Using context: $CONTEXT"

ПЕРЕД любым анализом:

  1. Прочитай журнал изменений ресурсов:
cat docs/resource-changes.md 2>/dev/null || echo "Журнал не найден"
  1. Получи OOM историю:
kubectl --context=$CONTEXT get events -A --field-selector reason=OOMKilling --sort-by='.lastTimestamp' | tail -20
kubectl --context=$CONTEXT get pods -A -o json | jq -r '.items[] | select(.status.containerStatuses[]?.lastState.terminated.reason == "OOMKilled") | "\(.metadata.namespace)/\(.metadata.name)"' 2>/dev/null
  1. Сформируй "защитный список" workloads, для которых снижение ЗАПРЕЩЕНО:
    • Упомянутые в откатах resource-changes.md
    • Имевшие OOM за последние 7 дней
    • Production namespace (без явной просьбы)

Фаза 1: Базовый анализ

SCRIPT_DIR=$(find ~/.claude -path "*/cluster-efficiency/scripts/cluster-efficiency.sh" -type f 2>/dev/null | head -1 | xargs dirname)
cd "$SCRIPT_DIR" && ./cluster-efficiency.sh $ARGUMENTS

Фаза 2: Глубокий анализ (--deep)

Если передан --deep или базовый анализ выявил серьёзные проблемы — запусти параллельно через Task tool три подагента (subagent_type="general-purpose"). Передай каждому контекст и защитный список.

Промпт для node-analyzer:
Ты — специализированный агент для анализа эффективности нод Kubernetes.

Контекст: $CONTEXT (используй во всех kubectl командах: --context=$CONTEXT)

Задачи:
1. Собрать метрики нод:
   kubectl --context=$CONTEXT get nodes -o wide
   kubectl --context=$CONTEXT top nodes
   kubectl --context=$CONTEXT get nodes -L karpenter.sh/nodepool -L karpenter.sh/capacity-type
   kubectl --context=$CONTEXT describe nodes | grep -E "^Name:|Allocatable:|Allocated resources:|cpu|memory"

2. Классифицировать ноды по типу (system/worker/spot/on-demand), управлению (static/Karpenter) и утилизации (low <30% / normal / high >70%)

3. Выявить проблемы: ноды <30% утилизации, переоцененные workloads (высокие requests при низком usage), несбалансированное распределение

Формат вывода:
NODE EFFICIENCY ANALYSIS
========================
Context: $CONTEXT
Summary: total/system/on-demand/spot ноды
Utilization Distribution: low/normal/high
Issues Found: конкретные ноды с цифрами
Recommendations: приоритизированные действия

Отвечай на русском. Конкретные числа и имена нод.

Read the full file on GitHub · 253 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. 2d ago First seen · 253 lines · 0 tokens per session scan A 677a64140f3b

Subscribe to this mod's changes

cluster-efficiency is a command published in the GitHub repository dapi/claude-code-marketplace (16 stars, last pushed 4mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,657 tokens. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.