What Are the Four Core Principles for LLM‑Powered Software Architecture?
This article outlines four foundational design principles—user‑intent‑driven design, context awareness, atomic capability mapping, and language‑API integration—for building LLM‑centric software architectures, illustrating each with DSL examples, Kotlin implementations, and practical insights on prompt engineering, dynamic context layering, and API evolution.
When optimizing ArchGuard's AI‑assisted architecture governance tool Co‑mate, the author identified patterns similar to earlier projects (AutoDev, ClickPrompt) and distilled three internal design principles, then expanded them into four more general principles for LLM‑centric software architecture.
TL;DR Principles
User‑Intent‑Driven Design – create new human‑machine interaction experiences and domain‑specific AI roles to better understand user intent.
Context Awareness – build architectures that can acquire business context, generate precise prompts, and explore high‑throughput engineering methods.
Atomic Capability Mapping – analyze the atomic abilities of LLMs and map them to missing capabilities in the application, letting each AI do what it excels at.
Language API – investigate next‑generation APIs (e.g., natural‑language as human‑machine API, DSL as AI‑machine API) to enable LLMs to understand, schedule, and orchestrate services.
ArchGuard Co‑mate Design Principles
DSL as a Unified Language – use a domain‑specific language to enhance human‑machine, machine‑machine, and machine‑human communication.
Atomic LLM for Orchestration – leverage LLM’s atomic capabilities to dynamically generate functions, as described in the earlier article “Governance Functions as Specifications”.
Layered Dynamic Context – separate context into hierarchical layers so LLMs can handle complexity effectively.
The Co‑mate implementation wraps basic functions in a Kotlin type‑safe builder, allowing LLMs to orchestrate governance functions based on documentation and specifications.
- 代码中的命名均不能以下划线或美元符号开始,也不能以下划线或美元符号结束.
- 代码中的命名严禁使用拼音与英文混合的方式,更不允许直接使用中文的方式,正确的英文拼写和语法可以让阅读者易于理解,避免歧义.
- 类名使用 UpperCamelCase 风格,必须遵从驼峰形式。正例: HelloWorld.Example DSL for naming conventions:
naming {
class_level {
style("CamelCase")
pattern(".*"){ name shouldNotBe contains("$") }
}
function_level {
style("CamelCase")
pattern(".*"){ name shouldNotBe contains("$") }
}
}LLM‑First Architecture Design Principles
1. User‑Intent‑Driven Design
LLM‑enabled applications typically expose a chat entry point whose purpose is to capture user intent (e.g., “write an article about design principles”). Guiding users to articulate intent clearly—through menus, command wrappers, or UI generation—improves the quality of downstream prompts.
2. Context Awareness
Providing LLMs with rich business context—such as user history, domain data, or architectural layers—enables more accurate prompt generation. ArchGuard Co‑mate adopts a layered context model (business, technical, code) to feed the LLM the appropriate level of detail.
3. Atomic Capability Mapping
Experiments with generating PlantUML diagrams showed a 20% failure rate, prompting a reconsideration of LLM’s role. The principle advises extracting LLM’s atomic abilities (e.g., reasoning, text generation) and mapping them to tasks the application lacks, while delegating unsuitable tasks (e.g., precise math) to function‑calling mechanisms.
4. Language API
A new generation of APIs is needed for LLMs to understand and orchestrate services. These may be natural‑language interfaces for human‑machine interaction or DSLs for AI‑machine communication, allowing LLMs to schedule and compose capabilities programmatically.
This article introduces LLM‑based software architecture design principles—user‑intent‑driven design, context awareness, atomic capability mapping, and language API—and shows how they can improve interaction, prompt precision, capability alignment, and API evolution for LLM‑centric systems.
phodal
A prolific open-source contributor who constantly starts new projects. Passionate about sharing software development insights to help developers improve their KPIs. Currently active in IDEs, graphics engines, and compiler technologies.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
