The Research Report
Inside Kimi K2.5: How Moonshot's Agent Architecture Actually Works
Someone extracted Kimi's production agent code and published it on GitHub. Moonshot AI confirmed it. The repository, dnnyngyen/kimi-agent-internals, contains system prompts, tool schemas, skill definitions, and source code for the runtime environment that powers Kimi's agents. The result is the most detailed public look at how a production AI agent system is actually built.
The findings challenge how most people think about AI agent capability. Kimi K2.5 is a 1-trillion-parameter Mixture-of-Experts model with 32 billion active parameters and a 262K context window. It powers both a simple chatbot and a full agent environment. The model is the same in both cases. The difference is entirely in the scaffolding.
Six Agent Modes, One Model
Kimi runs in six distinct modes across two interfaces. Four are for basic chat. Two are for agentic work.
Chat modes (kimi.com/chat):
- K2.5 Instant. Fast responses, no thinking tokens. This is the default experience.
- K2.5 Thinking. Step-by-step reasoning with visible reasoning tokens.
- Kimi K2 Instant and K2 Thinking. Deprecated predecessors.
Agent modes (kimi.com/agent and specialized endpoints):
- OK Computer. The generalist agent with persistent filesystem, unlimited tool calls, and runtime skill injection.
- Docs, Sheets, Slides, and Websites. Specialized agents built on top of OK Computer.
The key insight: the same K2.5 model powers all of them. Base Chat gets 10 tool calls per turn, no skill loading, and no persistent filesystem. OK Computer gets effectively unlimited tool calls, runtime skill injection, and a persistent workspace. The model did not change. The infrastructure did.
The Four-Layer Container Architecture
Kimi agents run inside a container with four distinct layers.
Layer 1: Control plane. A FastAPI server on port 8888 manages kernel lifecycle. It starts, stops, and resets the Python environment. This is how the outer system controls what the agent can do.
Layer 2: Compute engine. An IPython kernel handles code execution, communicating over ZeroMQ. Base Chat gets a 10-step budget per turn. OK Computer has no effective limit.
Layer 3: Web tools. Playwright drives a Chrome instance for browser automation. The browser runs in stealth mode with anti-detection flags. This lets the agent interact with web pages that block obvious automation.
Layer 4: User workspace. A mounted filesystem provides persistent storage. Base Chat gets /mnt/kimi/ with read-only access and no persistence across turns. OK Computer gets /mnt/okcomputer/ with full read-write access and persistent state.
External network access is blocked at the container level. The agent cannot make direct HTTP requests. All web access goes through the browser tools.
The Tool Gap: 9 vs 29
Base Chat has 9 tools. OK Computer has 29. The difference is not incremental. It is categorical.
Base Chat tools cover web search, URL opening, image search, Python execution, shell access (read-only filesystem), data source queries, and memory management.
OK Computer adds:
- 8 browser automation tools (visit, click, input, find, scroll up/down, screenshot, state)
- 3 file operation tools (read, write, edit with full filesystem access)
- 6 image and media tools (image generation, asset cropping, bounding box detection, speech synthesis, sound effects, voice listing)
- 5 utility tools (todo read/write, full-page screenshots, website deployment, slides generation)
The shell tool is the same binary in both modes. The difference is what the filesystem layer allows it to do.
Skill Injection: How Context Creates Expertise
This is the most interesting part of Kimi's architecture. The agent does not have specialized code for spreadsheets, documents, or web apps. It has generic tools. The expertise comes from SKILL.md files loaded into the context window at runtime.
When you ask Kimi for a spreadsheet, the system forces the agent to read /app/.kimi/skills/xlsx/SKILL.md. This file is 925 lines of detailed instructions covering Excel 365 versus 2019 compatibility, formula validation, styling conventions, and output verification.
The skill file teaches things a generic agent would not know. FILTER, XLOOKUP, and LAMBDA work in Excel 365 but crash in Excel 2019. The skill file tells the agent to use INDEX/MATCH instead. It specifies that gridlines should always be hidden. It explains the exact validation commands to run before delivering a file.
After reading this file, the same shell tool focuses on Excel-specific work. The tool did not change. The context did.
There are four skill domains:
- docx. Document creation, editing, tracked changes, and formatting preservation.
- pdf. PDF creation via HTML and Paged.js, plus PDF processing via Python. Supports KaTeX math, Mermaid diagrams, and academic formatting.
- xlsx. Spreadsheet creation, analysis, and advanced formatting with mandatory post-processing recalculation.
- webapp-building. React webapp scaffolding with TypeScript, Tailwind CSS, and shadcn/ui.
Each specialized agent mandates skill loading at the start. Kimi Sheets forces reading of the xlsx skill. Kimi Docs forces docx or pdf skill reading. Kimi Websites forces the webapp-building skill.
Two Strategies for Specialization
Kimi uses two distinct strategies for making its agents specialized.
Skill scaffolding works for Docs, Sheets, and Websites. These agents share the same identity as OK Computer. They just add mandatory pre-loaded context. The agent reads a skill file before starting work. This approach works because spreadsheet creation has objective correctness criteria. Formulas work or they do not. Compatibility rules are verifiable. You can teach these through documentation.
Persona replacement works for Slides. Instead of adding skills to the OK Computer base, Slides replaces the identity entirely. The system prompt says: "You are a presentation designer who has worked at McKinsey for 20 years, specializing in creating high-information-density, content-rich, and in-depth presentation slides for the world's TOP 10 enterprises."
This is a fundamentally different approach. The McKinsey consultant persona carries a style, a voice, and a set of values that resist procedural specification. Technical skill is taught via SKILL.md. Creative taste is taught via persona.
The division reveals something important. Spreadsheets have objective correctness criteria that can be documented. Presentation design requires subjective judgment that resists procedural specification.
The Three Phases of Agent Prompting
The repository maintainer identifies three phases in how agent systems handle prompts.
Phase 1: Static prompts (circa 2024). Early agents used simple, fixed system prompts. Capabilities were baked into model weights through fine-tuning. Changing behavior required retraining.
Phase 2: Instruction-heavy prompts (circa 2025). Long, detailed system prompts defined behavior and boundaries. Anthropic's Constitutional AI approach showed that instructions could override training for behavior control without retraining.
Phase 3: Modular skill injection (circa 2026). Capabilities are broken into modular files loaded on demand. Kimi's SKILL.md system does this. The agent reads domain-specific documentation when needed, keeping the base prompt minimal while accessing deep expertise on demand.
This shift solves the "lost in the middle" problem of massive context windows. Knowledge is separated from identity. The base prompt stays clean. Skills load only when relevant.
The Memory System
Kimi includes a memory space tool. The system prompt instructs the agent to use memoryspaceedits for persistent storage of facts and context across conversations. This is not vector-based RAG. It is direct read/write access to a structured memory store that persists between sessions.
The agent also has a todo system. The system prompt instructs Kimi to read the todo list "proactively and frequently" at the start of conversations, before starting new tasks, and whenever uncertain about what to do next. This is a simple but effective mechanism for maintaining task coherence across long multi-step workflows.
Data Sources and External Tools
The system prompt includes a priority hierarchy for external data. Datasource tools come first. Web search is the fallback when datasources are insufficient or unavailable.
Available datasources include Yahoo Finance for stock prices and financials, ifind for China A-shares and Hong Kong markets, World Bank Open Data for global economic indicators, arXiv for scientific preprints, and Google Scholar for academic literature.
All external data in final output must include the source name and URL. The system prompt enforces this citation rule.
KIMI_REF Tags
When Kimi completes a task that generates deliverable files, it must include a KIMI_REF tag at the end of the response. This tag contains the full file path where the output was saved, always under /mnt/okcomputer/output/. The system uses these tags to track and surface deliverables to users.
Only final deliverable files get KIMI_REF tags. Intermediate processing files, drafts, and helper scripts do not. This is a simple but effective output management system.
What This Means for Agent Design
The Kimi architecture reveals several principles that challenge common assumptions about AI agents.
Capability comes from scaffolding, not model size. The same model produces very different results depending on the tools, context, and skill files available to it. Many perceived differences between AI products are infrastructure differences pretending to be model differences.
Documentation is a first-class capability path. Writing a thorough 900-line manual and putting it in the right directory makes the agent an expert in that domain. New capabilities do not require retraining. They require documentation.
Tool access is a capability multiplier. Going from 9 tools to 29 tools is not a 3x improvement. It is a categorical shift from question-answering to full agent behavior. The model is identical. The tool access is different.
The container is the agent. The K2.5 model is one component. The control plane, compute engine, browser automation, filesystem, skill injection, memory store, todo system, and output tracking together form the actual agent. The model is the reasoning engine. The container is the product.
Limitations
The skill injection approach has boundaries. A 900-line instruction manual pushes the limits of what models can reliably follow. As skills grow more complex, verification becomes harder. The model generates logic rather than calling verified backend code, so errors propagate silently until output validation catches them.
The architecture also depends heavily on the model's ability to follow long, detailed instructions. When the model misreads or skips parts of a skill file, the errors are subtle and hard to detect.
Sources
- dnnyngyen/kimi-agent-internals repository: https://github.com/dnnyngyen/kimi-agent-internals
- Kimi K2.5 model repository: https://github.com/MoonshotAI/Kimi-K2.5
- Kimi K2.5 technical report: https://arxiv.org/html/2602.02276v1
- Kimi K2.5 blog post: https://www.kimi.com/blog/kimi-k2-5.html