Pardpro's Flat-4 is an incredibly strict, highly-deterministic software architecture pattern designed to eliminate "spaghetti code", cyclic dependencies, and unclear responsibilities.
The enhanced Flat-4+ version introduces Domain-Driven Design (DDD) concepts and Command Query Responsibility Segregation (CQRS) to balance strictness with development efficiency.
The architecture is divided into the following strictly governed layers:
graph TD
subgraph Flat-4+ Architecture
L1[L1: Entry Layer<br/>Routing & API]
L2[L2: Coordinator Layer<br/>Zero-GC Context & Flow]
L0[L0: Domain Layer<br/>Pure Math/Entities]
L3[L3: Molecular Layer<br/>Stateless Pipelines]
L4[L4: Atomic Layer<br/>Drivers, I/O, DB, Micro-bursts]
U[Utils: Common Layer]
%% Write/Complex Flow
L1 -- Write/Command --> L2
L2 -- Pure Logic --> L0
L2 -- Orchestrate --> L3
L2 -- Direct Action --> L4
L3 -- Combine --> L4
%% CQRS Fast-Track
L1 -. CQRS Read/Query .-> L4
end
new/malloc) is strictly forbidden inside the L2 event loop. L1 must pre-allocate an Arena, and L2/L3/L4 must utilize strictly zero-copy, in-place mutation to eliminate GC pauses.| Caller | May call | Must not call |
|---|---|---|
| L1 | L2, L4 (Query only), Utils | L1, L3, L0 |
| L2 | L3, L4, L0, Utils, Policies | L1, L2 |
| L3 | L4, Utils | L1, L2, L3, L0 |
| L4 | Utils | L1, L2, L3, L4, L0 |
| L0 | Utils | L1, L2, L3, L4, L0 |
| Utils | Utils | L0, L1, L2, L3, L4 |
This repository acts as an AI Agent Skill / Architecture Toolkit.
SKILL.md file into your AI assistant. The AI will then act as your strict Flat-4 Architect, helping you design code, refactor existing code, and generate Architecture maps.python scripts/validate_flat4.py /path/to/your/project
references/ directory for detailed design workflows, architecture rules, and audit checklists.docs/06_Evaluation_Metrics.md to benchmark AI Pass@1 success rates and hardware CPU wake-up metrics. You can run the included simulation proof-of-concept:
python scripts/simulate_l4_microburst.py
Pardpro's Flat-4 是一种极其严格、高度确定性的软件架构模式,旨在彻底消除“面条代码”、循环依赖以及职责不清的问题。
增强版的 Flat-4+ 引入了领域驱动设计 (DDD) 的纯函数概念和 CQRS (命令查询职责分离),在保持严格防腐的同时,兼顾了日常开发的效率。
代码被严格划分为以下层级:
L1 -> L2;但简单的纯数据查询 (Read) 允许 L1 -> L4 直达。graph TD
subgraph Flat-4+ 架构流转图
L1[L1: Entry 入口层<br/>路由与环境隔离]
L2[L2: Coordinator 协调层<br/>状态机与 Zero-GC 上下文]
L0[L0: Domain 领域层<br/>纯业务逻辑与算法]
L3[L3: Molecular 组合层<br/>无状态零拷贝管道]
L4[L4: Atomic 原子层<br/>物理隔离、I/O 与防抖]
U[Utils: Common 通用层]
%% Write/Complex Flow
L1 -- 写操作/复杂指令 --> L2
L2 -- 算法计算 --> L0
L2 -- 序列组合 --> L3
L2 -- 直接调用 --> L4
L3 -- 组合驱动 --> L4
%% CQRS Fast-Track
L1 -. CQRS 简单读取查库 .-> L4
end
new/malloc)。L1 必须在启动时预分配对象池 (Arena),L2~L4 必须采用零拷贝 (Zero-Copy) 与原地内存覆盖技术,彻底消除垃圾回收停顿。| 调用方 | 允许调用 | 严禁调用 |
|---|---|---|
| L1 | L2, L4 (仅限查询), Utils | L1, L3, L0 |
| L2 | L3, L4, L0, Utils, Policies | L1, L2 |
| L3 | L4, Utils | L1, L2, L3, L0 |
| L4 | Utils | L1, L2, L3, L4, L0 |
| L0 | Utils | L1, L2, L3, L4, L0 |
| Utils | 同层其他 Utils | L0, L1, L2, L3, L4 |
这个仓库是一个完整的 AI Agent 架构师技能包 和 静态审计工具。
SKILL.md 的内容。AI 会自动掌握 Flat-4+ 的精髓,帮你从零设计模块、重构旧代码、生成架构图。python scripts/validate_flat4.py /path/to/your/project
references/ 目录下的设计工作流 (design-workflow.md) 和人工审计清单 (audit-checklist.md),用于规范团队的代码审查标准。docs/06_Evaluation_Metrics.md 查看如何评估“AI 首次生成通过率”以及“操作系统唤醒/防抖效能”。你也可以直接运行以下概念验证 (PoC) 模拟器:
python scripts/simulate_l4_microburst.py
2 commits
Python
100.0%
Pardpro's Flat-4 is an incredibly strict, highly-deterministic software architecture pattern designed to eliminate "spaghetti code", cyclic dependencies, and unclear responsibilities.
The enhanced Flat-4+ version introduces Domain-Driven Design (DDD) concepts and Command Query Responsibility Segregation (CQRS) to balance strictness with development efficiency.
The architecture is divided into the following strictly governed layers:
graph TD
subgraph Flat-4+ Architecture
L1[L1: Entry Layer<br/>Routing & API]
L2[L2: Coordinator Layer<br/>Zero-GC Context & Flow]
L0[L0: Domain Layer<br/>Pure Math/Entities]
L3[L3: Molecular Layer<br/>Stateless Pipelines]
L4[L4: Atomic Layer<br/>Drivers, I/O, DB, Micro-bursts]
U[Utils: Common Layer]
%% Write/Complex Flow
L1 -- Write/Command --> L2
L2 -- Pure Logic --> L0
L2 -- Orchestrate --> L3
L2 -- Direct Action --> L4
L3 -- Combine --> L4
%% CQRS Fast-Track
L1 -. CQRS Read/Query .-> L4
end
new/malloc) is strictly forbidden inside the L2 event loop. L1 must pre-allocate an Arena, and L2/L3/L4 must utilize strictly zero-copy, in-place mutation to eliminate GC pauses.| Caller | May call | Must not call |
|---|---|---|
| L1 | L2, L4 (Query only), Utils | L1, L3, L0 |
| L2 | L3, L4, L0, Utils, Policies | L1, L2 |
| L3 | L4, Utils | L1, L2, L3, L0 |
| L4 | Utils | L1, L2, L3, L4, L0 |
| L0 | Utils | L1, L2, L3, L4, L0 |
| Utils | Utils | L0, L1, L2, L3, L4 |
This repository acts as an AI Agent Skill / Architecture Toolkit.
SKILL.md file into your AI assistant. The AI will then act as your strict Flat-4 Architect, helping you design code, refactor existing code, and generate Architecture maps.python scripts/validate_flat4.py /path/to/your/project
references/ directory for detailed design workflows, architecture rules, and audit checklists.docs/06_Evaluation_Metrics.md to benchmark AI Pass@1 success rates and hardware CPU wake-up metrics. You can run the included simulation proof-of-concept:
python scripts/simulate_l4_microburst.py
Pardpro's Flat-4 是一种极其严格、高度确定性的软件架构模式,旨在彻底消除“面条代码”、循环依赖以及职责不清的问题。
增强版的 Flat-4+ 引入了领域驱动设计 (DDD) 的纯函数概念和 CQRS (命令查询职责分离),在保持严格防腐的同时,兼顾了日常开发的效率。
代码被严格划分为以下层级:
L1 -> L2;但简单的纯数据查询 (Read) 允许 L1 -> L4 直达。graph TD
subgraph Flat-4+ 架构流转图
L1[L1: Entry 入口层<br/>路由与环境隔离]
L2[L2: Coordinator 协调层<br/>状态机与 Zero-GC 上下文]
L0[L0: Domain 领域层<br/>纯业务逻辑与算法]
L3[L3: Molecular 组合层<br/>无状态零拷贝管道]
L4[L4: Atomic 原子层<br/>物理隔离、I/O 与防抖]
U[Utils: Common 通用层]
%% Write/Complex Flow
L1 -- 写操作/复杂指令 --> L2
L2 -- 算法计算 --> L0
L2 -- 序列组合 --> L3
L2 -- 直接调用 --> L4
L3 -- 组合驱动 --> L4
%% CQRS Fast-Track
L1 -. CQRS 简单读取查库 .-> L4
end
new/malloc)。L1 必须在启动时预分配对象池 (Arena),L2~L4 必须采用零拷贝 (Zero-Copy) 与原地内存覆盖技术,彻底消除垃圾回收停顿。| 调用方 | 允许调用 | 严禁调用 |
|---|---|---|
| L1 | L2, L4 (仅限查询), Utils | L1, L3, L0 |
| L2 | L3, L4, L0, Utils, Policies | L1, L2 |
| L3 | L4, Utils | L1, L2, L3, L0 |
| L4 | Utils | L1, L2, L3, L4, L0 |
| L0 | Utils | L1, L2, L3, L4, L0 |
| Utils | 同层其他 Utils | L0, L1, L2, L3, L4 |
这个仓库是一个完整的 AI Agent 架构师技能包 和 静态审计工具。
SKILL.md 的内容。AI 会自动掌握 Flat-4+ 的精髓,帮你从零设计模块、重构旧代码、生成架构图。python scripts/validate_flat4.py /path/to/your/project
references/ 目录下的设计工作流 (design-workflow.md) 和人工审计清单 (audit-checklist.md),用于规范团队的代码审查标准。docs/06_Evaluation_Metrics.md 查看如何评估“AI 首次生成通过率”以及“操作系统唤醒/防抖效能”。你也可以直接运行以下概念验证 (PoC) 模拟器:
python scripts/simulate_l4_microburst.py
2 commits
Python
100.0%