koog AGENTS.md

Developer instructions for Koog, a Kotlin Multiplatform framework for building AI agents with graph-based workflows. It connects agents with AI models, tools, and MCP services across JVM and JavaScript environments.

In plain words
What is it for?
Developing AI agents, workflow graphs, tools, memory and tracing features, model integrations, MCP connections, examples, and tests.
Why use it?
They explain the framework’s modules and build process so changes fit its architecture. This reduces mistakes when working across agent logic, tools, model integrations, and platform targets.

Instructions file for CodexOpenCode

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/jetbrains/koog/agents-md
Clone the repo
git clone --depth 1 https://github.com/JetBrains/koog

Made for: Codex, OpenCode.

Per session 1,913 This file is loaded in full into every session.
When invoked 1,913 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.01913 $0.01913
Opus 5 $0.00957 $0.00957
Sonnet 5 $0.00383 $0.00383
Haiku 4.5 $0.00191 $0.00191

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

Security

Grade A, and why

koog AGENTS.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 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.

AGENTS.md · 251 lines

How it starts

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

Koog AI Agent Framework

Koog is a Kotlin multiplatform framework for building AI agents with graph-based workflows. It supports JVM and JS targets and integrates with multiple LLM providers (OpenAI, Anthropic, Google, OpenRouter, Ollama) and Model Context Protocol (MCP).

Project Structure

The project follows a modular architecture with a clear separation of concerns:

koog/
├── agents/
│   ├── agents-core/           # Core abstractions (AIAgent, AIAgentStrategy, AIAgentEnvironment)
│   ├── agents-tools/          # Tool infrastructure (Tool<TArgs, TResult>, ToolRegistry, AIAgentTool)
│   ├── agents-features-*/     # Feature implementations (memory, tracing, event handling)
│   ├── agents-mcp/           # Model Context Protocol integration
│   └── agents-test/          # Testing utilities and framework
├── prompt-*/                 # LLM interaction layer (executors, models, structured data)
├── embeddings-*/             # Vector embedding support
├── examples/                 # Reference implementations and usage patterns
└── build.gradle.kts          # Root build configuration

Build & Commands

Development Commands

# Full build including tests
./gradlew build

# Build without tests
./gradlew assemble

# Run all JVM tests
./gradlew jvmTest

# Run all JS tests  
./gradlew jsTest

# Test specific module
./gradlew :agents:agents-core:jvmTest

# Run specific test class
./gradlew jvmTest --tests "ai.koog.agents.test.SimpleAgentMockedTest"

# Run specific test method  
./gradlew jvmTest --tests "ai.koog.agents.test.SimpleAgentMockedTest.test AIAgent doesn't call tools by default"

# Compile test classes only (for faster iteration)
./gradlew jvmTestClasses jsTestClasses

Development Environment

  • JDK: 17+ required for JVM target
  • Build System: Gradle with version catalogs for dependency management
  • Targets: JVM, JavaScript (Kotlin Multiplatform), WASM
  • IDE: IntelliJ IDEA recommended with Kotlin plugin

Code Style

Read the full file on GitHub · 251 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. yesterday First seen · 251 lines · 1,913 tokens per session scan A f7cc031abe45

Subscribe to this mod's changes

koog AGENTS.md is an instructions file published in the GitHub repository JetBrains/koog (4,541 stars, last pushed 3d ago), licensed Apache-2.0. It adds 1,913 tokens to every session, about $0.0096 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.