Detailed Technical Paper
This page contains a detailed technical paper on formal methods and AI-driven development. For an overview, please visit the overview page.overview page.
AI Agent-Driven Development with Formal Methods
— The Human Role in the Era of Multi-Agent Collaboration —
A proposal for a new development paradigm where VDM-SL formal specifications serve as 'contracts' between AI agents, enabling multiple AI agents to collaborate like a team to autonomously build systems.
Challenge: The 'Common Language' of Multi-Agent Collaboration
The era where AI writes code has already arrived. However, the next paradigm goes beyond 'using AI as a tool' to multiple AI agents collaborating like a team to autonomously build systems.
Here a fundamental question arises—when multiple AI agents collaborate, what becomes the 'team's common language'?
Natural language specifications contain ambiguity, and test-driven development is based on inductive reasoning, so neither functions as a specification agreement mechanism between agents.
Proposal: Formal Specifications as 'Contracts' Between Agents
By using VDM-SL (Vienna Development Method - Specification Language) formal specifications as rigorous contracts between agents, the following can be achieved:
Parallel Autonomous Development
Each agent can independently develop with only its own module specification and dependent interface specifications. Implementation code from other modules is not required.
Mechanical Consistency Checking
Mechanical checking of A.post ⇒ B.pre composability. Properties selected for proof are handled separately as POs.
Structural Exposure of Ambiguity
Through type definitions, preconditions, postconditions, and invariants, interpretive discrepancies in natural language are made explicit and reduced.
Redefinition of Human Roles
Human roles are limited to domain experts. Focus on defining business rules and leave technology selection to AI.
Multi-Agent Architecture
Concrete VDM-SL Specification Example
An example specification of the Order module. Preconditions, postconditions, and invariants function as the module's 'contract.'
The postcondition of ConfirmOrder status = <CONFIRMED> satisfies the precondition that ShipOrder in the Inventory module requires order.status = <CONFIRMED>. This is the target of an A.post ⇒ B.pre contract-consistency check. The @ext annotation expresses non-functional requirements (performance, availability, usability, etc.) that cannot be expressed in VDM-SL, and serves as input for AI's technology selection in Phase 2.
Comparison with Existing AI-Driven Development Approaches
Each existing major AI-driven development architecture has distinct strengths, but they all harbor structural flaws in their 'source of truth.'
| Method | Source of Truth | Structural Flaw |
|---|---|---|
| Devin / SWE-Agent | Existing code behavior | Circular reasoning Inferring specs from code entrenches bugs |
| MetaGPT | SOP + natural language documents | Ambiguity accumulation NL degradation compounds per phase |
| ChatDev | Chat Chain dialogue consensus | Non-reproducible Different outputs for same input |
| GitHub Spec Kit | Structured Markdown | Structured ambiguity Implicit boundary conditions |
| Claude Code, etc. | Developer judgment | Cannot scale Limit of cognitive load |
| Our Method | VDM-SL formal specification | Limited scope Not suited for UI/UX or lightweight tasks |
Detailed Structural Flaws of Each Approach
Positioning Map
Our method is positioned in the upper-right quadrant — Multi-Agent × specification verification with proof targets.
The New Role of Humans
In this paradigm, the human role is limited to domain expert. Defining business rules and non-functional requirements (@ext annotations) is the human's job, while technology selection (language, framework, DB) and architecture design are performed autonomously by AI in Phase 2.
Traditional Developer
- Write code
- Write tests
- Review code
- Debug integration bugs
Humans in the AI Agent Era
- Define business rules (Phase 1)
- Quantify NFRs with @ext annotations
- Evaluate and judge AI's specification explanations
- Delegate technology selection and implementation to AI (Phase 2+)
There is no need to read or write formal notation. AI agents handle that. Humans, as domain experts, make judgments on the content explained in natural language by the Architect AI, such as 'Is this module division appropriate for this specification?' Whether to use Python, Ruby, or TypeScript is not the domain expert's concern—in Phase 2, AI autonomously selects the optimal technology based on @ext annotations.
How to Practice with Claude Code
Claude Code's CLAUDE.md hierarchical loading mechanism naturally corresponds to the scope separation of formal-spec-driven development. By placing overall contracts at the root and module specifications in each module directory, you can keep the context for each session minimal.
Recommended Directory Structure
Overall Contract
Describes module dependencies, shared type definitions, A.post ⇒ B.pre rules, and @ext annotation conventions. Always loaded in all sessions.
Spec + Dependent IF
Own module specification + dependent interface contracts only. Lazy-loaded only when files in that directory are accessed.
Phase-specific Rules
Automatically switches Claude Code behavior rules between editing specs/** and modules/*/src/**.
Parallel Development Execution Example
Each session develops without seeing each other's implementation code, using only interface contracts. Even if Order is implemented on Monday and Inventory on Friday, the formal specifications in CLAUDE.md make cross-session consistency mechanically checkable.
| Method | What enters the context | Estimated lines |
|---|---|---|
| Natural language spec (bulk) | Requirements documents for all modules | 500–2,000 lines |
| CLAUDE.md + VDM-SL | Root contract + own module spec + dependent IF | 100–300 lines |
Resources
Paper (Japanese / English)
Detailed in paper format: theoretical foundations, workflow, and roadmap for formal-spec-driven development.
Japanese → / English →Comparative Analysis
Systematic comparison with MetaGPT, ChatDev, Devin, Spec Kit, etc., and structural flaw analysis of each approach.
Comparative Analysis →Claude Code Practice Guide
Concrete development methods leveraging CLAUDE.md's hierarchical structure. Directory structure, workflow, and context optimization.
Practice Guide →Prompt Templates
Supports all phases from Phase 1-4. Ready to copy & paste into Claude/GPT-4.
Templates →Implementation Example (EC Site)
A sample that defines specifications for three modules—order, inventory, and payment—in VDM-SL and builds them with multi-agent development.
Sample →ANDO Hikaru — IID Systems — Apache License 2.0