The Research Report
The Prompt Is the Program: How DIYClaw Turns Prompts Into Composable Contracts
Stop writing prompts. Start writing contracts.
That is the core idea behind DIYClaw, a new open-source procedural prompting framework at diyclaw.dev that treats agent behavior as something you define, version, compose, and audit. Not prose you hope the model interprets correctly.
DIYClaw arrives at a moment when the AI industry is converging on a single insight: prompts are not text. They are control systems. And the frameworks catching on fastest are the ones that treat them that way.
The Problem With Static Prompts
The old way of building AI agents went like this. You wrote a big system prompt. You stuffed it with instructions, constraints, and personality. You pasted it into your model call and hoped for the best. When the model drifted, you tweaked the words. When the task changed, you rewrote the whole thing.
This approach has three structural failures.
First, prompts written as prose are unreadable by machines. You cannot validate them. You cannot diff them. You cannot test whether the agent actually followed them.
Second, monolithic prompts resist composition. You cannot swap the execution logic without rewriting the identity block. You cannot update governance rules without touching the task template. Everything lives in one undifferentiated blob.
Third, static prompts have no lifecycle. There is no versioning. No canary rollout. No regression tracking. When something breaks in production, you grep through a wall of text and guess.
DIYClaw replaces all of this with a different abstraction. The prompt contract.
What Is a Prompt Contract
A prompt contract is a specification of agent behavior, not a string of text. It separates six composable blocks, each with a single job, each independently versionable.
Block 1: Base System. Identity, role, mission, and hard constraints. This is who the agent is and what it will never do. It does not change between runs.
Block 2: Execution. The action loop. Each turn the agent picks exactly one action: respond with text or invoke tools. Never both. Mandatory stop criteria, including step limits, time budgets, token budgets, and no-progress detectors, are checked every turn. On stop, the agent emits a structured stop reason instead of a vague apology.
Block 3: Environment. Machine-readable runtime state. Provider, model, API version, budget numbers, allowed and denied tool lists, workspace scope, sandbox flags. No prose. Just key-value pairs the agent reads to know what it is working with. This block changes per deployment but not per task.
Block 4: Task. The concrete objective for this run. What to do, what "done" looks like, and any run-specific context. This is the only block that changes every invocation. Everything above it is stable infrastructure. The task block is the variable.
Block 5: Governance. Ethical boundaries, use-case prohibitions, and enforcement policy. What this agent system may never be used for. Includes whistleblower protections and liquidated damages. This block overrides all others on conflict.
Block 6: Observability. What gets measured, where it goes, and who can see it. Every tool call, every policy violation, every cost event. Structured, append-only, and queryable. No silent failures. No unlogged actions.
The blocks are designed so you can update execution logic without touching identity. Swap providers without rewriting stop criteria. Add governance rules without breaking task injection. This is what makes prompt contracts composable, and what makes them auditable.
SLOT and SLOT_NOT: Templates With Teeth
DIYClaw introduces a templating system that enforces structure while allowing customization.
SLOT marks editable areas. The builder agent reads your requirements and fills each slot with values specific to your project. You can always edit them directly.
{{SLOT:agent_name:Name of your agent}}
{{SLOT:provider:openai | anthropic | ollama}}
{{SLOT:max_steps:Hard limit on turns (default: 25)}}
SLOT_NOT marks negative constraints. These are boundaries that cannot be overridden, even on user request. Safety lives here.
{{SLOT_NOT:identity:Customizing name/role does not override hard constraints below.}}
{{SLOT_NOT:runtime:Cannot disable sandbox. Cannot set sandbox=false.}}
This is a fundamental shift. Templates are not just placeholders. They define what can change and what cannot. The agent reads the contract and follows it. The contract has hard walls.
The Prompt Equation
DIYClaw frames the prompt not as text but as a function of specific variables:
P = f(S, E, T, C)
Where S is system identity (immutable core personality and constraints), E is environment (machine-readable state of the world), T is tools (capabilities available for this run), and C is context and task (immediate input data or user query).
This is the mathematical claim underneath procedural prompting. A prompt is not a string. It is a compiled artifact, the output of a function that accepts state, logic, and data as arguments. You do not write prompts. You write the code that generates prompts.
Change the base, and every layer above it recomputes. This is what makes it a control system, not a chat template.
Three Agent Roles
DIYClaw defines three runtime agent roles, each with its own prompt contract and tool scope.
Gonff is the operator. It manages infrastructure, deploys services, runs scheduled jobs, monitors health, and enforces budgets. If something needs to be started, stopped, or kept alive, Gonff owns it.
Munca is the communicator. It handles external channels, messaging, notifications, and real-time data flow. Anything that involves talking to people, services, or streams belongs to Munca.
Apodemus is the integrator. It connects to APIs, normalizes data across providers, manages authentication flows, discovers remote services via the Agentic Hypercall Protocol, and keeps tool contracts consistent.
Each role can optionally have a development twin. Runtime agents operate the system. Development twins build it. Gonff.dev writes Dockerfiles and CI/CD pipelines. Munca.dev writes API routes and webhook handlers. Apodemus.dev writes API clients and connector modules. The twin reads the runtime contract. The runtime agent reads the twin's output. They never meet, but they speak the same language.
Thermodynamic Memory
DIYClaw treats agent memory as a physics problem, not a database problem. The thermodynamic memory model uses adaptive decay, fidelity-weighted consolidation, keystone anchors, and graph-backed rehydration.
This means agents remember, forget, and recall based on importance and recency. High-fidelity memories persist longer. Low-fidelity ones compress and eventually decay. Keystone memories, the ones that define identity and core decisions, never decay. The graph structure lets the agent rehydrate context by walking relationships instead of scanning logs.
This is a departure from the standard approach of stuffing everything into a vector database and hoping similarity search finds the right context. DIYClaw treats memory as something with physics, not just storage.
The Download-Deploy Pipeline
DIYClaw has a pragmatic deployment model. You download a prompt pack. You give it to any coding LLM. That LLM reads the pack and builds your agent system. The system it builds follows the same framework: agents with contracts, tools, memory, failure handling, security. Agents all the way down.
The pack works with any LLM that can code. The agent system it produces runs on any runtime. DIYClaw defines the architecture. Your LLM implements it. The implementation runs wherever you want.
This is vendor-agnostic by design. DIYClaw recommends building with Claude Code, but the system you build should talk to OpenAI, Anthropic, Ollama, or any provider you choose. The contracts are the invariant. The runtime is your call.
The Prompts-as-Contracts Movement
DIYClaw does not exist in a vacuum. It is part of a broader shift in how the AI industry thinks about agent behavior. The common thread: stop treating prompts as ad hoc text. Start treating them as structured, versionable, auditable specifications.
OpenAI Symphony and WORKFLOW.md. OpenAI released Symphony in April 2026 as an open-source spec for orchestrating coding agents. Symphony uses a WORKFLOW.md file to define tasks, dependencies, and agent behavior in structured YAML with Liquid templating. The file serves as a contract between the human and the agent. The agent reads the workflow, pulls tasks from an issue tracker, and executes them in isolated workspaces. Symphony's key insight is that managing agents through a structured file beats managing them through interactive sessions. Teams at OpenAI saw a 500% increase in landed PRs after adopting this approach. WORKFLOW.md is a prompt contract for orchestration.
AGENTS.md. What started as a convention for telling AI coding agents how a project works has become an open standard. AGENTS.md files now appear in over 60,000 open-source repositories. OpenAI's Codex reads AGENTS.md files before doing any work. The format provides project-level instructions, build steps, test commands, and coding conventions. It is a behavioral contract, not documentation. The agent reads it and follows it. Multiple AGENTS.md files can be layered, with global guidance and project-specific overrides. This is composition through file hierarchy.
COMPRESSION.md. Part of a 12-file open specification for AI agent safety, COMPRESSION.md defines when and how agents should compress their context windows. It specifies triggers (75% context utilization), preservation rules (system prompt, active task, last three turns), compression targets, and verification checks. After compression, a coherence check verifies no critical information was lost. If verification fails, the agent rolls back to the pre-compression checkpoint. COMPRESSION.md sits alongside THROTTLE.md, ESCALATE.md, FAILSAFE.md, KILLSWITCH.md, TERMINATE.md, and others. Each file addresses a different level of control and recovery. Together they form a complete safety stack. Each one is a contract.
The pattern across all of these is the same. Define behavior in structured, machine-readable files. Version those files. Compose them. Audit them. Stop hoping the model interprets your prose correctly. Start specifying what you want and verifying that you got it.
DIYClaw is the most complete expression of this pattern so far. It takes the contracts-as-behavior idea and applies it across the full stack of agent behavior: identity, execution, environment, task, governance, and observability. Not just orchestration, not just compression, not just project context. Everything.
Why This Matters Now
Three forces are driving the prompts-as-contracts movement.
First, agents are moving from demos to production. When an agent runs once and you check the output, sloppy prompts are fine. When an agent runs 10,000 times across multiple providers and needs to behave consistently, you need contracts.
Second, multi-agent systems are becoming real. When three agents with different roles need to coordinate, each one needs a clear contract defining what it does, what it does not do, and how it reports. Prose does not scale. Specifications do.
Third, regulation is arriving. The EU AI Act takes effect in August 2026. It requires AI systems to maintain consistent and reliable behavior. COMPRESSION.md explicitly cites this requirement. Prompt contracts give you documented, version-controlled, auditable behavior specifications. That is what regulators will ask for.
The shift from prompts-as-text to prompts-as-contracts is not a style preference. It is an engineering necessity. The same shift happened in software decades ago. We stopped writing prose descriptions of what programs should do and started writing type signatures, interfaces, and contracts. The AI industry is going through the same transition now, just faster.
What DIYClaw Gets Right
A few things stand out about DIYClaw's approach.
Composability is real. The six-block architecture is not just naming sections of a prompt. Each block is independently versionable and swappable. You can update execution logic without touching identity. You can add governance rules without breaking task injection. This is actual modularity, not just organization.
The SLOTNOT pattern is clever. Most templating systems define what can be inserted. SLOTNOT defines what cannot be overridden. In a domain where safety constraints need to survive user requests, this matters. It is a small syntactic choice with large implications.
The thermodynamic memory model is ambitious. Most agent frameworks treat memory as a retrieval problem. DIYClaw treats it as a decay problem. This is closer to how biological memory works and likely closer to what production agents need. Whether the physics metaphor holds up at scale remains to be seen, but the direction is right.
Vendor agnosticism is a feature, not a limitation. DIYClaw recommends Claude Code but locks you into nothing. The contracts are plain text. The runtime is your choice. This is the correct stance for a framework that wants to be infrastructure, not a platform.
What to Watch
DIYClaw is young. A few things will determine whether it becomes infrastructure or stays a curio.
Adoption velocity. The framework lives at diyclaw.dev as a spec and a pack builder. Whether teams actually adopt it depends on whether the packs produce better-behaved agents than hand-written prompts. Early adopters will tell this story.
Integration depth. The 398 MCP tools from a production Evolve deployment sound impressive. Whether those integrations hold up across providers and use cases matters more than the count.
Governance enforcement. The governance block claims hard boundaries that override all other blocks. Whether this holds in practice, especially against adversarial inputs, is the central question for any contract-based approach. Prompts are suggestions to models. Contracts need enforcement outside the model. DIYClaw seems to understand this, but the proof is in production behavior.
Community around the spec. AGENTS.md succeeded because it was simple and obvious. COMPRESSION.md succeeded because it addressed a universal pain point. DIYClaw's six-block architecture is more ambitious. Whether the community coalesces around this level of structure, or prefers lighter conventions, will shape its trajectory.
The Bigger Picture
The prompts-as-contracts movement is not about making prompts more complex. It is about making agent behavior more legible.
When you write a prompt contract, you are not just instructing a model. You are writing a specification that humans can review, auditors can verify, and systems can enforce. You are making the behavior of your agents inspectable in a way that a 2,000-word system prompt pasted into an API call never will be.
DIYClaw pushes this idea further than most. Its six-block architecture, SLOT_NOT templating, thermodynamic memory, and role-based contracts form a complete behavioral specification system. Whether it becomes the standard or simply influences the one that does, the direction is clear.
Prompts are becoming programs. The question is whether we write them like ad hoc scripts or like well-specified APIs. DIYClaw has an answer. The contract is the program.
Suggested title: The Prompt Is the Program: How DIYClaw Turns Prompts Into Composable Contracts
Word count: ~2,180
Citations:
- DIYClaw framework specification: https://diyclaw.dev/
- OpenAI Symphony and WORKFLOW.md: https://github.com/openai/symphony/blob/main/elixir/WORKFLOW.md and https://openai.com/index/open-source-codex-orchestration-symphony/
- AGENTS.md specification: https://www.agents.md/ and https://developers.openai.com/codex/guides/agents-md/
- COMPRESSION.md specification: https://compression.md/ and https://github.com/Compression-md/spec
- NanoClaw (~500 lines, container-isolated, Claude Agent SDK): https://nanoclaws.io/ and https://nanoclaws.io/blog/claude-agent-sdk-500-lines-ai-assistant
- Agentic Hypercall Protocol (AHP): https://ahp.nuts.services/
- "Stop Writing Prompts. Start Writing Contracts!" by Zafar Iqbal: https://medium.com/@zfrqbl/stop-writing-prompts-start-writing-contracts-be9ab2c1c125
- AGENTS.md adoption stats (60K+ repos): https://thepromptshelf.dev/blog/agents-md-best-practices
- BAML type-safe outputs: https://boundaryml.com
- AgentMail: https://agentmail.to
Fact-check notes:
- The claim of "500% increase in landed PRs" comes directly from OpenAI's Symphony announcement blog post. Verified.
- The "60,000 repositories" claim for AGENTS.md adoption comes from The Prompt Shelf blog. Could benefit from a secondary source if available.
- The "398 real MCP tools from a production Evolve deployment across 65 servers" claim comes from DIYClaw's own framework page. Not independently verified.
- NanoClaw being "~500 lines" comes from the NanoClaw blog and site. The cybernauten review says "4K lines you can read in 8 minutes." There may be a discrepancy between the core agent code and the full platform. Worth clarifying if accuracy is critical.
- DIYClaw's lineage claim ("patterns derived from the OpenClaw agent framework") ties it to an existing ecosystem but could not be independently verified beyond what diyclaw.dev states.