The Research Report
AgentWiki Gives Modular Prompt Assembly a Reference
Two weeks ago, I wrote about AgentPatterns.ai — a site that documents production patterns for structured system prompts. It covers dynamic composition, cache-aware layering, and heuristic effort scaling. The key insight: system prompts are not text blobs. They are engineered documents with named sections, explicit ordering, and deliberate assembly rules.
AgentWiki arrived on the scene around the same time, and it approaches the same territory from a different angle. AgentPatterns gives you patterns — specific, actionable recipes for production teams. AgentWiki gives you a knowledge base — an encyclopedia of concepts, cross-referenced and growing daily, that lets you understand why those patterns work.
The overlap is not accidental. Both sites are responding to the same shift. The field is converging on a shared vocabulary for building agent system prompts from modular components. AgentWiki just formalized it.
What AgentWiki Is
AgentWiki.org is a self-updating knowledge base for AI agent design. Inspired by Andrej Karpathy's LLM Wiki concept, it ingests roughly 40 AI newsletters each morning, decomposes them into atomic pages via a DSPy/Haiku pipeline, and cross-references everything through semantic embeddings. As of this writing, it holds 4,259 pages with 2,759 new this week.
The site is agent-readable. It exposes a free semantic search API and a JSON-RPC interface for read/write operations. Any AI agent can query it and pull structured knowledge about planning, memory, tool use, structured outputs, and the full landscape of agent architecture.
But the page that matters most for this audience is the one on system prompt composition.
System Prompt Composition: The Core Idea
AgentWiki's page on system prompt composition defines the practice precisely: building AI agent system prompts from modular, reusable components rather than writing monolithic instruction blocks. The page claims this approach "reduces AI errors by up to 60% and cuts manual prompt maintenance time by 60-75%."
Those are big numbers. Whether you take them as gospel or as directional, the underlying point holds. Monolithic prompts — single large blocks of instructions — are fragile. Change one section and you risk breaking behavior in another. You cannot test them in isolation. You cannot reuse sections across agents. And they grow like kudzu.
AgentWiki identifies seven core components that every production system prompt should contain, assembled in priority order:
1. Identity and Persona. Who the agent is, its role, expertise level, and communication style. The page specifically warns against vague descriptors like "helpful assistant." Use concrete role definitions instead.
2. Skills and Capabilities. Explicit lists of tools, knowledge areas, and functions the agent can use. This prevents hallucinated capabilities and guides tool selection.
3. Constraints and Guardrails. What the agent must not do. Token limits, safety rules, compliance requirements, ethical boundaries.
4. Output Format. The structure, format, and length of responses. Critical for downstream systems that parse agent responses programmatically.
5. Context Injection. Dynamic background data that changes per request — user profiles, conversation history, retrieved documents, real-time data.
6. Few-Shot Examples. Input-output pairs that demonstrate desired behavior. Especially effective for complex formatting requirements.
7. Error Handling. Fallback instructions for ambiguity, missing data, or tool failures.
This is not revolutionary. Most experienced prompt engineers would nod along. The value is in the formalization. AgentWiki gives each component a name, a priority, and a clear definition. That shared vocabulary is what the field has been missing.
Composition Patterns
AgentWiki documents five distinct composition patterns for assembling these components:
Template-Based Composition
Use variables and templates to assemble prompts programmatically. A base template defines the structure. Variables inject role-specific content. One template generates prompts for dozens of different agents by swapping variable values.
<identity>{persona}</identity>
<skills>{roster}</skills>
<constraints>{constraints}</constraints>
<context>{injection}</context>
<output>{format}</output>
This is the simplest pattern and the one most teams start with. It works well when you have a small number of agents with predictable variation.
The Five Primitives Pattern
Five reusable building blocks: Roster (available agents and tools), Voice (communication style and persona), Structure (output format specification), Briefing (context and background data), and Gate (conditional logic — "if condition, then action; else skip").
The Gate primitive is worth calling out. Conditional inclusion is where composition gets powerful. Not every agent needs every instruction in every mode. Gates let you include or exclude sections based on runtime conditions without maintaining separate prompt templates.
Composable Skills Pattern
Decompose capabilities into independent skill modules loaded on demand. AgentWiki explicitly frames this as following the Unix philosophy: small programs that do one thing well. Benefits include progressive disclosure (loading only relevant skills per request), cleaner context windows, and the ability to test each skill independently.
This is the pattern that pairs most directly with what AgentPatterns calls "dynamic system prompt composition." Both sites agree: load only what you need, when you need it.
The RTCCO Framework
Role, Task, Context, Constraints, Output — five functional components treated like LEGO blocks that can be swapped or adjusted independently. This is a variant of the core seven-component model, compressed into five. It trades granularity for simplicity.
The Sandwich Method
A three-layer structure: top bun (intent and role), filling (detailed instructions and examples), bottom bun (restate intent and constraints). The redundancy at both ends helps LLMs prioritize the most important instructions. Research on recency bias in LLMs supports this approach.
Cache-Aware Layering: The Production Constraint
AgentWiki does not stop at composition patterns. The Knapsack Prompt Assembly page addresses the constraint that turns elegant composition theory into messy production reality: context windows are finite.
Knapsack prompt assembly treats prompt construction as a constrained resource allocation problem. The context window is the binding constraint. Not all state information has equal importance for every decision. Some pages represent critical constraints or invariants that must always be present. Others provide supporting context whose marginal value diminishes at scale.
The two-phase protocol works like this:
Phase 1: Hard Constraint Installation. Identify and install all pages that represent non-negotiable requirements — safety constraints, regulatory compliance, fundamental system objectives. These go in regardless of token budget. Correctness and safety take priority over efficiency.
Phase 2: Marginal Utility Ranking. Treat remaining pages as candidates ranked by their expected contribution to agent decision quality divided by their token cost. Greedily select pages in descending order of utility per token until the budget is exhausted.
This is a formalization of what production teams already do informally. AgentWiki gives it a name and a rigorous framing. The knapsack formulation makes tradeoffs explicit. When you have more context than fits in a window, you need a principled way to choose what to include. "Include the N most recent pages" is not principled. Marginal utility ranking is.
Priority Ordering: Where Identity Meets Cache
Here is where AgentWiki and AgentPatterns converge most clearly. AgentPatterns defines five priority tiers for prompt sections:
- 10-30: Core Identity — agent role, capabilities, boundaries
- 40-50: Tool Definitions — tool schemas, capability declarations
- 55-65: Safety and Rules — style rules, safety constraints
- 70-80: Provider-Specific Guidance — provider-optimized instructions
- 85-95: Dynamic Context — session state, memory injection
AgentWiki's composition page defines the same ordering with different labels: Identity first, then Skills, then Constraints, then Output Format, then Context Injection. The priorities align. Identity and core instructions are stable and cacheable. Dynamic context changes every turn and belongs at the end.
Both sites arrive at the same conclusion independently: priority ordering is not a preference. It is a structural constraint imposed by cache economics. Cached reads cost 10% of base input price on Anthropic's API. Cache writes cost 125-200%. A single cache-busting change wipes out savings across every subsequent call.
The immutable prefix pattern that AgentPatterns documents — stable prefix, growing tail — is the cache-aware version of AgentWiki's priority ordering. Core identity and policies form the stable prefix. Conversation history occupies the dynamic suffix. Priority ordering is not just about logical organization. It is about placing cache-stable content where the cache can actually hit it.
The Convergence Signal
AgentWiki and AgentPatterns are not alone. The broader trend is unmistakable:
- Microsoft PromptKit (157 composable components across 4 pipelines) treats prompts as modular, version-controlled artifacts.
- LangChain Deep Agents SDK exposes a skills system with progressive disclosure — metadata, instructions, and resources loaded at three levels.
- OpenAI Symphony uses WORKFLOW.md as a YAML+Liquid prompt contract defining agent instructions, policies, and tool permissions per task type.
- Salesforce Agent Script defines agent behavior in a single declarative file with per-decision control over determinism versus LLM reasoning.
- AGENTS.md and COMPRESSION.md are emerging as repo-level standards for agent configuration and context management.
Every one of these projects is converging on the same architecture: identity modules, skill components, priority ordering, cache-aware layering, and progressive disclosure. They use different names. The structure is the same.
AgentWiki's contribution is giving that structure a proper reference document. It is not the first to describe modular composition. But it is the first to collect the concepts, cross-reference them, and maintain them as a living encyclopedia that updates daily.
What Is Missing
AgentWiki's system prompt composition page has gaps. The "reduces AI errors by up to 60%" and "cuts manual prompt maintenance time by 60-75%" claims are sourced but lack direct links to the underlying studies. The composition patterns are described at a conceptual level without production-scale benchmarks. The cache-aware layering discussion on the Knapsack Prompt Assembly page is more formal than most practitioners need, and less concrete than AgentPatterns' code examples.
The site also does not address failure modes as directly as AgentPatterns does. AgentPatterns includes "when this backfires" sections for every pattern. Dynamic composition can bust caches. Effort scaling costs 15x more tokens. Declarative specs struggle with dynamic workflows. AgentWiki presents the patterns more neutrally, which is fine for a reference but less useful for teams making architectural decisions.
The agent-readable API is an interesting feature that the article does not explore in depth. If AgentWiki becomes a canonical knowledge source that agents query at runtime, the composition patterns it documents could move from reference material to active assembly instructions. That would be a different kind of system entirely — one where agents compose their own prompts by consulting a shared knowledge base.
Why This Matters Now
The shift from monolithic prompts to modular composition is not theoretical. It is happening in production at Anthropic, OpenAI, Microsoft, Salesforce, and dozens of smaller teams. The leaked 102K-character Claude system prompt uses roughly 25 top-level XML sections. That is not a paragraph of instructions. That is a structured document with named sections, explicit boundaries, and deliberate ordering.
AgentWiki gives the community a shared vocabulary for describing what those teams are already doing. That vocabulary matters because it lets teams compare approaches, share patterns, and build on each other's work instead of reinventing the same solutions independently.
If you are building agents that run in production, AgentWiki is worth bookmarking. The system prompt composition page, the Knapsack Prompt Assembly page, and the cross-referenced pages on structured prompting and system prompt architecture form a coherent reference for the modular composition approach. Pair it with AgentPatterns for the production patterns and failure modes, and you have the closest thing the field has to a complete guide.
The structured prompts movement has been growing for a year. AgentWiki gives it an encyclopedia. AgentPatterns gives it a cookbook. The vocabulary is converging. The patterns are stabilizing. What was once ad hoc is becoming engineering.
Citations
- AgentWiki — System Prompt Composition: https://agentwiki.org/systempromptcomposition
- AgentWiki — Knapsack Prompt Assembly: https://agentwiki.org/knapsackpromptassembly
- AgentWiki — System Prompt Architecture: https://agentwiki.org/systempromptarchitecture
- AgentWiki — Structured Prompting: https://agentwiki.org/structured_prompting
- AgentWiki — Modular Architectures: https://agentwiki.org/modular_architectures
- AgentWiki — Home page (4,259 pages, daily digest): https://agentwiki.org
- AgentPatterns.ai — Dynamic System Prompt Composition: https://agentpatterns.ai/context-engineering/dynamic-system-prompt-composition/
- AgentPatterns.ai — Production System Prompt Architecture: https://agentpatterns.ai/instructions/production-system-prompt-architecture/
- AgentPatterns.ai — Prompt Caching: Architectural Discipline: https://agentpatterns.ai/context-engineering/prompt-caching-architectural-discipline/
- CL4R1T4S — Claude Opus 4.6 system prompt capture: https://github.com/elder-plinius/CL4R1T4S/blob/main/ANTHROPIC/ClaudeOpus4.6.txt
- Anthropic — Effective context engineering for AI agents: https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents
- Bui (2026) — OpenDev: https://arxiv.org/abs/2603.05344
- Lumer et al. (2026) — Don't Break the Cache: https://arxiv.org/abs/2601.06007
- Microsoft PromptKit: https://promptkit.altairalabs.ai/concepts/skills/
- LangChain Deep Agents SDK — Skills System: https://deepwiki.com/langchain-ai/deepagents/2.4-skills-system
- OpenAI Symphony: https://github.com/openai/symphony
- Salesforce Agent Script: https://github.com/salesforce/agentscript
Suggested Title
AgentWiki Gives Modular Prompt Assembly a Reference (or: The Shared Vocabulary for Structured Prompts Just Arrived)
Word Count
~1,850 words (body text)
Fact-Check Notes
- The "reduces AI errors by up to 60% and cuts manual prompt maintenance time by 60-75%" claims come from AgentWiki's system prompt composition page, which cites PromptOT and Positive Tenacity. I have not independently verified these specific percentages. The underlying claim — that modular composition improves maintainability and reduces errors — is well-supported by production practice, but the exact numbers should be confirmed before publishing.
- AgentWiki's page count (4,259 pages, 2,759 new this week) comes from the site's home page as of May 6, 2026. This number changes daily.
- The 25 top-level XML sections in the leaked Claude system prompt is documented by CL4R1T4S and cited by AgentPatterns.ai. I confirmed the repository exists but did not independently count the sections.
- The cache economics figures (10% for cached reads, 125-200% for cache writes) come from Anthropic's API documentation.
- AgentWiki's Knapsack Prompt Assembly page was created on May 4, 2026 and last modified May 4, 2026. It is a very new page and may not have been widely reviewed.
- The five composition patterns (Template-Based, Five Primitives, Composable Skills, RTCCO, Sandwich) are documented on AgentWiki. The "Five Primitives" and "RTCCO" labels appear to originate from Daniel Miessler and PromptOT respectively. I did not find primary sources confirming these as established frameworks with broad adoption.
- AgentWiki's agent-readable API (semantic search + JSON-RPC) is documented on the site. I confirmed the API endpoint exists but did not test it end-to-end.