Documentation-Oriented Architectures: MarkDown as a Coordination and Code Generation Layer in Multi-Agent Ecosystems with AI
Understanding Coordination and Code Generation
The consolidation of AI agents integrated into VS Code, such as assistants based on Large Language Models (LLMs), copilots, and autonomous agents connected to the repository, has profoundly transformed the dynamics of software engineering. In this new paradigm, MarkDown ceases to be just a documentation format and begins to function as a declarative layer of architectural intent, capable of coordinating agents and generating concrete implementations in multiple languages (ZHANG et al., 2024).
From this perspective, C# and Go do not represent the logic of the agent itself, but the material result of interpreting a structured documentary artifact. MarkDown becomes the contract; the code, its manifestation.
MarkDown as Executable Specification
When structured semantically and disciplined, a MarkDown document can act as:
- Functional specification;
- Architectural contract;
- Definition of metrics and technical constraints;
- Structured prompt for AI agents.
Contemporary language models demonstrate a high capacity to derive implementations from formal and semi-formal descriptions (BEURER-KELLNER et al., 2023). In this context, the structure, clarity, and syntactic discipline of MarkDown significantly influence the quality and predictability of the generated code, serving as a point of orchestration for multiple simultaneous requests, including in architectures based on multi-agent AI systems.
REST API Specification
In this section, a specification of the API from a declarative approach is presented, using MarkDown as a formal contract of intent. Before any implementation in a specific language, the goals, requirements, data model, and business rules are defined in a structured and technology-independent manner. This documentary layer guides AI agents in the consistent generation of code across multiple ecosystems.
Declarative MarkDown
# User Registration Service
## Goal
Expose a REST API for user registration and querying.
## Functional Requirements
- Create user
- Retrieve user by ID
## Data Model
User:
- Id (GUID)
- Name (string, required)
- Email (string, required, unique)
## Rules
- Email must be unique
- Name cannot be empty
- Responses in JSON
This document acts as an intent layer. From it, AI agents can generate coherent implementations in different languages.
Generated Result in C#
public class User
{
public Guid Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
}
Generated Result in Go
type User struct {
Id string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
}
Note that the code is a direct consequence of the declarative structure of MarkDown. Consistency across languages is ensured by the documentary contract.
Cache Policy Specification
In this section, the documentation takes on an even more strategic role: instead of merely defining data structures, it explicates architectural decisions related to performance, scalability, and observability. The cache policy is described declaratively, allowing AI agents to translate performance intentions and operational constraints into concrete implementations, maintaining alignment with previously established success metrics.
Declarative MarkDown
# Cache Strategy
## Context
High-read system with low latency requirements.
## Strategy
- Cache-Aside
- TTL of 5 minutes
## Rules
- Invalidate cache on update
- Log cache access failures
## Success Metric
- Average latency less than 50ms
- Hit ratio greater than 85%
Here, MarkDown not only describes data structures but also architectural decisions and operational constraints.
Expected Result in C#
public async Task GetUserAsync(Guid id)
{
var cacheKey = $"user:{id}";
var cached = await _cache.GetAsync(cacheKey);
if (cached != null)
return Deserialize(cached);
var user = await _repository.GetByIdAsync(id);
await _cache.SetAsync(cacheKey, Serialize(user),
new DistributedCacheEntryOptions
{
AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(5)
});
return user;
}
Expected Result in Go
func GetUser(id string) (*User, error) {
key := fmt.Sprintf("user:%s", id)
cached, err := redisClient.Get(ctx, key).Result()
if err == nil {
return deserialize(cached), nil
}
user, err := repository.GetById(id)
if err != nil {
return nil, err
}
redisClient.Set(ctx, key, serialize(user), 5*time.Minute)
return user, nil
}
Once again, the architectural decision was expressed documentarily; the code is the execution of that intent.
MarkDown as Coordination Layer in Multi-Agent Ecosystems
In environments with multiple agents in VS Code, responsible for code generation, testing, refactoring, and validation, MarkDown acts as:
- Single Source of Truth;
- Versioned contract in Git;
- Context base for automatic prompts;
- Semantic orchestrator of multiple languages.
This aligns with coordination approaches in multi-agent systems based on shared artifacts in the environment and is amplified by considering LLMs as agents capable of acting in different stages of the software development cycle (HE; TREUDE; LO, 2025).
The Importance of Architecture in Writing MarkDown
The generative capacity of a structured MarkDown document is directly associated with the architectural maturity of its creator. In software engineering, architectural decisions are responsible for determining quality attributes such as scalability, performance, security, modifiability, and availability, resulting from explicit trade-offs between functional and non-functional constraints (BASS; CLEMENTS; KAZMAN, 2012).
Thus, when principles such as SOLID, layered architecture, Domain-Driven Design (DDD), consistency and concurrency, as well as concerns of observability and infrastructure, are not adequately understood and articulated in the specification, the artifact tends to remain superficial.
Additionally, the literature on architectural documentation shows that the clarity and structure of the documentation directly influence the quality of subsequent implementation decisions (CLEMENTS et al., 2010). In the domain modeling context, conceptual precision and ubiquitous language are determinants for the structural robustness of the software (EVANS, 2003).
In this context, by incorporating agents based on Large Language Models into the development process, an amplifying effect is observed: the models tend to reflect the quality, clarity, and architectural depth of the provided specification. Shallow specifications produce similarly shallow implementations; architecturally consistent specifications tend to result in structurally sound code. In other words, AI agents amplify the quality of the architectural intent expressed in the artifact.
Conclusion
Documentation-Driven Architectures represent an evolutionary stage in contemporary software engineering. MarkDown ceases to be narrative support and becomes an executable declarative layer, capable of coordinating AI agents and producing consistent implementations in multiple languages. In this model, the software engineer assumes an even more strategic role: not only writing code but designing architectural intentions that will be materialized by autonomous agents.
References
-
BEURER-KELLNER, Luca; FISCHER, Marc; VECHEV, Martin. Prompting is programming: A query language for large language models. Proceedings of the ACM on Programming Languages, vol. 7, no. PLDI, pp. 1946-1969, 2023.
-
ZHANG, Wuyang et al. Renaissance of literate programming in the era of llms: Enhancing llm-based code generation in large-scale projects. arXiv preprint arXiv:2502.17441, 2024.
-
HE, Junda; TREUDE, Christoph; LO, David. Llm-based multi-agent systems for software engineering: Literature review, vision, and the road ahead. ACM Transactions on Software Engineering and Methodology, v. 34, n. 5, p. 1-30, 2025.
-
BASS, Len. Software architecture in practice. Pearson Education India, 2012.
-
CLEMENTS, Paul. Documenting Software Architectures: Views and Beyond, Portable Documents. 2010.
-
EVANS, Eric. Domain-driven design: tackling complexity in the heart of software. Addison-Wesley Professional, 2004.