Nguyễn Trần Hữu Đăng · Principal AI Systems Architect @ Apero · Ho Chi Minh City
dang.nguyentranhuu@gmail.com · linkedin.com/in/nguyentranhuudang · github.com/huudangdev
Why do most AI coding agents fail on complex, multi-week engineering projects? Because stateless LLM sessions suffer from context amnesia — every new prompt starts from zero — while memory tools that rely on a local desktop app (localhost MCP servers) break the moment headless agents run inside isolated cloud sandboxes or Git worktrees.
At Apero, we solve this by treating AI engineering as a self-evolving cognitive system rather than a chat autocomplete. Our architecture rests on three production pillars:
- Five-Layer Heliocentric Runtime (
L1 – L5): Instead of organizing our stack by programming languages, we separate raw model inference and read/write privilege boundaries (L1) from multi-agent swarm orchestration (L2), a four-beat asynchronous memory loop (L3), isolated Git worktree sandboxes (L4), and persistent Git-native memory (L5). - Five Independent Obsidian Git Vaults (
apero-wiki-ahw): Ten coding agents share one accumulating institutional memory partitioned across five plain-Markdown Git repositories:vaults/forge(build history, architectural decisions, post-mortems),vaults/dev(framework & architecture patterns),vaults/research(literature & benchmarks),vaults/work(product specs & contracts), andvaults/personal(engineering notes). A deterministic 6-rule working-directory router (wiki route) selects the right vault in O(1) time without wasting LLM tokens. - Four-Beat Cognitive Loop & Capability Split: We enforce a strict security boundary between read-only context recall (
llm(), retrieving project briefings in 188 ms against a 500 ms SLA budget) and post-commit memory mutation (llm_write()), governed by a 5-Gate Adversarial Verification Harness (62/62passing test suites).
In traditional software engineering, developers sit at the keyboard writing syntax line by line. In our architecture, human architectural intent sits at the center of a five-shell orbital runtime (L1 – L5), where specialized agent swarms continuously perceive context, execute inside isolated sandboxes, and commit verified knowledge back into persistent vaults.
How do 10+ heterogeneous coding agents (Claude Code, Gemini Antigravity, Cursor, Codex) collaborate on a codebase without overwriting each other's memory or hitting database locks? We structure shared memory as a Stratified Knowledge Graph G = (V_vault, B_loop, S_sys, E) stored entirely as plain Markdown files inside five independent Git repositories:
- Beat 1 · Post-Commit Session Ingest (
llm_write): Every time an agent commits code, a global Gitpost-commithook extracts the session transcript, diff, and failure recovery trace, writing a structured episode intovaults/forge. - Beat 2 · Tier-1 Synchronous Recall (
188 ms): Before taking action in an unfamiliar repository, any agent runswiki brief(llm -p) to load prior architectural decisions and known pitfalls in 188 ms (62.4% faster than our 500 ms SLA budget). - Beat 3 · Tier-2 Asynchronous Task Briefing: A background daemon indexes all five vaults across Hybrid RAG (
BM25 + Vector + Graph) and pre-warms task-specific briefings for upcoming prompts. - Beat 4 · Gated Pattern Distillation: Weekly consolidation distills recurring problem-solution pairs into reusable
.agentsskills once a pattern is proven across ≥ 15 observations and ≥ 3 independent sessions.
The architectural primitives in §1 and §2 power four production systems built and open-sourced from our workflow:
Autonomous velocity without verification leads to regressions. Every change produced by our agent swarms must pass a 5-Gate Adversarial Pipeline enforcing Segregation of Duties (SoD — no agent may approve its own code):
- Gate 1 (Contract Swarm): Synthesizes domain specifications, state machines, and discriminative counterexamples.
- Gate 2 (TDD Red Swarm): Two independent test authors write unit and boundary tests that must fail before implementation.
- Gate 3 (Sandbox Implementation): Coding workers implement minimal solutions inside isolated worktrees with zero type/lint errors.
- Gate 4 (Adversarial Tri-Audit): Three independent reviewers audit scope containment, OWASP security boundaries, and test integrity.
- Gate 5 (Exact-HEAD Verification): Full end-to-end test execution (
62/62suites passing) on the exact commit SHA.
To visualize a full year of continuous autonomous and principal engineering throughput ("The City I Built This Year"), Figure 4.2 projects 52 weeks of activity onto a 3D Isometric Contribution Metropolis (52 weeks × 7 days), where each tower's elevation represents daily verified commits — reaching a peak of 121 commits/day and 2,177 annual contributions across 159 active build days.
Colophon & Archival Specification · Typeset as a self-contained Daylight Archival Monograph (Geist & Geist Mono, calibrated Prussian Slate #1E3A5F, Deep Teal #0F766E, and Terracotta #9A3412 on #FAF9F5 archival paper plates with ≥ 6.18:1 WCAG AA/AAA contrast across both light and dark GitHub themes). Animated SVG schematics use Keplerian orbital kinematics, 3D isometric volumetric extrusion, and cubic-bezier spline propagation with full prefers-reduced-motion accessibility support.



