kagent CLAUDE.md

A development guide for kagent, a Kubernetes-based system for defining, running, and calling AI agents. It explains the project's architecture, sources of truth, and component boundaries.

In plain words
What is it for?
Use it when developing or reviewing kagent APIs, agent templates, control-plane state, backend inputs, durable runtime data, or related components.
Why use it?
It helps coding agents make changes that fit the existing design and avoid duplicating session, task, or infrastructure models.

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/kagent-dev/kagent/claude-md
Clone the repo
git clone --depth 1 https://github.com/kagent-dev/kagent
Per session 2,725 This file is loaded in full into every session.
When invoked 2,725 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.02725 $0.02725
Opus 5 $0.01362 $0.01362
Sonnet 5 $0.00545 $0.00545
Haiku 4.5 $0.00272 $0.00272

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

Security

Grade A, and why

kagent 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 3d 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.

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 · 203 lines

How it starts

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

CLAUDE.md — Kagent Development Guide

This file defines the repository-wide rules for agents working on kagent. Read the code in scope before changing it. For detailed development and CI workflows, use the kagent-dev skill. See STYLE.md for language-specific conventions.

1. Current Architecture

Kagent is a Kubernetes-native control plane for defining, running, and invoking AI agents.

  • Harness and AgentTemplate are kagent.dev/v1alpha3 Kubernetes APIs. A harness describes how to compile a template into runnable inputs; a template describes the agent users want.
  • AgentInstance is PostgreSQL-backed control-plane state exposed through gRPC. It is not a Kubernetes resource.
  • Upstream A2A owns task, interaction, streaming, and history semantics. Do not create parallel session or task models.
  • Substrate Actors are the compute backend. Durable directories own private runtime state that must survive actor replacement.
  • Harness compilers translate resolved templates into backend inputs. Keep compilation separate from applying those inputs.
  • The public API describes agent behavior, not infrastructure mechanics. Do not expose Kubernetes scheduling, service accounts, arbitrary containers, channels, profiles, or generic extension maps.

The release-blocking harnesses are kagent, Codex, and Claude. Prefer clean-install behavior over compatibility with legacy session-backed agents unless compatibility is explicitly required.

2. Sources of Truth

When documentation and implementation disagree, verify the intended state in the execution plan and current code rather than preserving obsolete behavior.

Read the full file on GitHub · 203 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. 3d ago First seen · 203 lines · 2,725 tokens per session scan A 4da0225a3aba

Subscribe to this mod's changes

kagent CLAUDE.md is an instructions file published in the GitHub repository kagent-dev/kagent (3,629 stars, last pushed yesterday), licensed Apache-2.0. It adds 2,725 tokens to every session, about $0.0136 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.