Design first, code second. Every code file has an adjacent .ace file so Claude always sees intent before implementation.
.ace file is more important than the code file. Code can be regenerated from good design. Design cannot be recovered from code.
AI agents operate with limited context windows. Without documentation, the agent reads code, guesses the design intent, and may violate unstated constraints. Each session starts from scratch.
Codebases evolve, but the why behind decisions lives only in tribal knowledge. Without ACE, an AI agent will "improve" code by reverting intentional decisions.
Every mistake an agent makes costs tokens to fix. Reading code to understand what should have been documented: waste. Debugging issues that a gotcha would have prevented: waste.
Tokens spent on docs < tokens wasted on mistakes. Always.
Every file has a design document. For new code, write the .ace first, then implement. For existing code, always read the .ace before reading the code. Not optional.
Documentation lives next to the code it describes. Not buried in a /docs folder. Not scattered across wikis. Right there. auth.ts beside auth.ts.ace.
The ACE file tracks significant changes — not what changed (git does that), but why. This prevents an agent from "improving" code by reverting intentional decisions.
ACE files are optimised for agent consumption. Max 5000 tokens. Structured sections, no prose padding. If you can't document it in 5000 tokens, the file is too complex — split it.
ACE captures not just what code does, but how to perform multi-step operations. Workflows section documents procedures that would otherwise live in tribal memory.
Claude writes and maintains .ace files. Humans prompt and review. The agent creates structured docs with purpose, functions, dependencies, and gotchas. Both iterate.
An Acedev is a developer who works agent-centrically: ensures design documentation exists before coding, updates documentation alongside code, and commits both together — neither alone. The design document is the source of truth. The code is just an implementation of that truth.
auth.ts.acefolder.aceThe complete specification for ACE files. Click any section to expand.
One paragraph: what this file is for, its role in the system. Focus on why, not what.
functionName(params): ReturnType
Brief description. Inputs, outputs, side effects.
@std/http — Deno HTTP primitives
./session.ts — Session management
interface AuthResult { authenticated: boolean; session?: Session; }
2026-01-17 — Added query param fallback for SSE
Why: SSE connections can’t set Authorization header.
Impact: Token now checked in query param as second priority.
| Section | Required | Purpose |
|---|---|---|
| YAML frontmatter | Yes | Metadata, relationships |
| Purpose | Yes | What this file does |
| Key Functions | Yes* | Exported functions/classes |
| Dependencies | Yes | What this file imports |
| Gotchas | No | Tribal knowledge, warnings |
| API Contracts | No | TypeScript interfaces/types |
| Workflows | No | Multi-step procedures |
| Change History | Yes | Why significant changes were made |
*Key Functions can be omitted for pure type definition files.
One paragraph: what this folder contains, its role in the architecture.
How code should be organized. Patterns to follow. Key for guiding AI agents.
gvturn-api.ts — CRUD operations for gvTurns
gv-api.ts — Flow and decision management
2026-01-10 — Split from router.ts
Why: Router was 800 lines mixing routing with handlers.
| Type | Description |
|---|---|
service | Runnable service with entry point (e.g., konui, konsole) |
module | Group of related files, not independently runnable |
library | Shared utilities, types, helpers |
config | Configuration files, environment |
| Field | Type | Required | Description |
|---|---|---|---|
file | string | Yes | Filename this ACE describes |
created | date | Yes | When the file was created (YYYY-MM-DD) |
lastModified | date | Yes | Last significant modification |
consumers | string[] | No | Files that import/use this file |
produces | string[] | No | What this file outputs/exports |
deprecated | boolean | No | If true, scheduled for removal |
owner | string | No | Team or person responsible |
| Field | Type | Required | Description |
|---|---|---|---|
folder | string | Yes | Folder name this ACE describes |
type | enum | Yes | service, module, library, config |
entryPoint | string | No | Main file if runnable service |
port | number | No | If service, what port it listens on |
| Field | Applies To | Description |
|---|---|---|
type | All | html, css, javascript, json, jsonl, yaml |
runtime | JS | browser, node, deno |
globalApi | JS | Global namespace (e.g., window.gvturn) |
schema | JSON/YAML | Path to JSON Schema file |
lineFormat | JSONL | Per-line object structure |
| Language | Code File | ACE File |
|---|---|---|
| TypeScript | auth.ts | auth.ts.ace |
| Go | provider.go | provider.go.ace |
| Swift | AuthService.swift | AuthService.swift.ace |
| Kotlin | ViewModel.kt | ViewModel.kt.ace |
| Python | handler.py | handler.py.ace |
| Rust | lib.rs | lib.rs.ace |
| Java | Main.java | Main.java.ace |
No conflict: File ACE includes the extension (auth.ts.ace), folder ACE lives inside the folder (folder.ace).
| Reason | Explanation |
|---|---|
| Agent attention | Agents process ~5000 tokens reliably without losing focus |
| Forces focus | Can't document bloated code — split it instead |
| Fits in context | ACE + code file fit comfortably in one context window |
| Quick to read | Humans can skim in under 5 minutes |
Focus on why, not what. Git tracks what changed.
.ace first@ace-first
Always read ACE before code. Create if missing.
@ace-hierarchy
Read order: folder.ace → file.ace → code
@ace-mandatory
Never create code without companion ACE
@ace-design-led
Update ACE before code, not after
ACE isn't just a guideline — it's enforced through instruction, detection, and hard gates.
Every code file has a companion .ace file. Every directory gets a folder.ace for module-level architecture.
These are real ACE files from production code — TypeScript, Go, and folder-level architecture documentation.
auth.ts.ace
konui/src/
Bearer token authentication for Konui. Dual-storage token system: localStorage (for JS API calls) and cookies (for browser navigation).
checkAuth(request, config): Promise<AuthResult>
Authorization: Bearer header (API calls with fetch)?token= query parameter (SSE connections)konui_token cookie (browser page navigation)konui_token is hardcoded. Changing it will break existing authenticated sessions.2026-01-10 — Added query param fallback for SSE
Why: EventSource API cannot set Authorization headers.
bridge.go.ace
gvmesh/internal/bridge/
Main bridge service implementation. Manages the persistent outbound WebSocket connection to greatvibe.ai relay, subscribes to the internal ws.Hub for events, forwards events with priority-based batching, and handles inbound commands.
NewService Creates bridge service with config, hub, dispatcher, logger
Service.Start Connects to relay, starts event forwarding loop
Service.Stop Graceful disconnect, stops all goroutines
Service.Status Returns current BridgeStatus snapshot
getLoadSnapshot Reads CPU/memory/disk from /proc (Linux), falls back to 0
connectLoop Manages connect/reconnect with exponential backoff
readLoop Reads inbound messages (commands, pings) from relay
writeLoop Writes outbound messages (events, pongs) to relay
eventForwarder Subscribes to Hub, routes events by priority
batchFlusher Periodically flushes batched events by priority tier
2026-02-08 — Phase 20: dispatcher field → CommandHandler interface
Why: Commander integration required decoupled interface.
2026-02-07 — Implement real getLoadSnapshot() with /proc + syscall.Statfs
Why: Phase 1+2 review fix: replace stub with actual system metrics.
hub.go.ace
gvmesh/internal/ws/
Central WebSocket event hub. Manages client connections, topic subscriptions, event broadcasting with wildcard matching, cursor-based replay, and backpressure handling. Implements the EventEmitter interface so it can be injected into managers.
NewHub Create hub with config and logger
Hub.Start Start background goroutines (pruner)
Hub.Emit Publish event to all matching subscribers
Hub.Subscribe Add topic subscriptions, replay from cursor
Hub.topicMatches Wildcard matching: sessions.* matches sessions.created
provider.go.ace
gvshell/internal/providers/
Core Provider interface for gvShell. All AI providers (Claude, OpenAI, Gemini, Ollama) implement this contract.
mesh/folder.ace
gvmesh/internal/mesh/ — 30 files, networking layer
Mesh networking — peer discovery, join flow, heartbeat, gossip protocol. Handles all mesh communication: joining via sponsor node, maintaining heartbeats, peer management, and gossip-based state sync.
Commander Unified command routing engine
GossipManager Gossip protocol + session affinity
PeerManager In-memory peer cache with persistence
StreamManager Dynamic streaming channel manager
SessionAffinity Session → node affinity mapping
2026-02-08 — Phase 20: Commander, StreamManager, SessionAffinity
2026-02-04 — Phase 5: mTLS peer protocol, gossip, routing
2026-02-04 — Phase 2: Initial creation, join flow
routes/folder.ace
konui/src/routes/ — module-level architecture
Routes are thin. They parse requests, call services, format responses. No business logic, no direct DB access.
These are the ACE files for the pages you’re browsing right now — /info, /ace, /contact, and /license.
info-page.ts.ace
konui/src/views/ — the /info showcase page
Public-facing platform showcase page. Rendered at /info without authentication. Standalone page — does not use layout() wrapper since no auth context needed.
#hero Logo, title, one-liner, 3 outcome bullets, 2 CTAs
#what-you-get 6 outcome cards (user-facing language)
#screenshots 6-tab gallery with real UI images, lightbox zoom
#dogfood Built by What It Built — 100% vibe coded, 4 stat cards
#problem 6 pain point cards, core insight box
#how-it-works 4-step workflow + VS Code comparison accordion
#superpowers 4 feature deep-dives: gvTurn cards, gvContext, mesh, drift
#deep-dive Architecture accordion: Three-Tier, SVG, Components, Drift
Sticky nav + scroll spy, tab systems, accordions, counter animation, metric bar animation, drift bars, lightbox zoom
overflow:hidden + height:100vh on html,body. MUST override with !important..closest(’.section’).ace-page.ts.ace
konui/src/views/ — this very page!
Public-facing ACE specification page. Rendered at /ace without authentication. Dedicated home for the complete ACEspec: why ACE was invented, what problem it solves, how it works, and the full specification.
#hero Title, tagline, hero quote, stat counters
#problem 3 problem cards: Context Loss, Design Drift, Wasted Tokens
#principles 6 ACE principles + Acedev definition
#format File ACE vs Folder ACE, 20 languages grid
#spec Complete ACEspec: templates, YAML, workflows, constraints
#examples Real ACE files from production (you’re reading this section!)
#gvcontext Asset Registry, 4-layer hierarchy, SHA-256 tamper detection
#mesh-deploy CLAUDE.md distribution to gvmesh nodes via gossip
#prompt-reinforcement Per-turn macro injection, escalating schedule
#feedback ChatGPT external review and critique
${...} expressions.contact-page.ts.ace
konui/src/views/ — the /contact page
Public-facing contact page. Rendered at /contact without authentication. Directs visitors to LinkedIn for licensing enquiries, partnerships, and general questions.
LinkedIn only — no form, no backend. LinkedIn handles identity, spam, and threading. Enquiry type cards give visitors context before clicking through.
license-page.ts.ace
konui/src/views/ — the /license page
Public-facing license page. Rendered at /license without authentication. Displays copyright, licensing terms, and trademark attributions.
Copyright notice, licensing terms, trademark attributions for Claude (Anthropic) and ChatGPT (OpenAI). Minimal design — clean, readable legal text with no interactive components.
ACE files are just markdown — the real power is the compilation and delivery pipeline that ensures every AI agent reads them. This section goes deep on gvContext: the system that compiles, versions, checksums, and distributes the rules that make ACE mandatory.
Every rule, template, and contract Claude follows lives as a managed asset in a versioned registry. The registry.jsonl file at /gv/assetregistry/registry.jsonl is the single source of truth — one JSON object per line, one per asset.
Assets are organised into four layers, compiled in order. Higher layers can override or extend lower layers, but kernel rules are always first.
kernel + rulessdk + ui-componentsproductflow • DynamicEach asset exists in three forms. The compiler reads from compiled/ by default, concatenates assets in deterministic order, generates a SHA-256 checksum header, and writes the final CLAUDE.md to the tree directory.
The compiler produces 5 different CLAUDE.md files for 5 different contexts. Each target includes a specific subset of assets.
Every compiled CLAUDE.md starts with a metadata header. The checksum is computed over the body only (not the header), so the header can contain the checksum of its own content. Timestamps are intentionally omitted to maximise Claude's prompt cache hit rate.
Claude can manage the entire pipeline through MCP tools, exposed via konui's MCP server.
Konsole and gvShell fetch compiled CLAUDE.md content from konui over HTTP, using checksum-based cache invalidation:
Local targets (root, konui, konsole, gv) deploy by file copy. But gvmesh nodes are remote machines. They get their CLAUDE.md through a push-based bridge protocol with gossip-based convergence verification.
When a node establishes its WebSocket bridge connection to the relay, the relay immediately pushes the current compiled gvmesh CLAUDE.md content. This ensures nodes have context from the moment they join the mesh.
The ContextManager in gvmesh/internal/context/manager.go handles the bridge push:
bodyChecksum. Reject on mismatch.claude.md.previous. Then atomic write: write to .tmp, rename to CLAUDE.md.claude.md.cache and context-state.json for startup restore. On next boot, the node has CLAUDE.md before the bridge even connects.mesh.context_updatedcreated | updated | unchanged).Nodes continuously gossip their context state (checksum + pushVersion) to peers via mTLS. If a node sees a peer with a newer pushVersion and a different checksum, it knows it's stale and emits mesh.context_stale. The bridge relay listens for this event and re-pushes the latest CLAUDE.md.
When a gvmesh node boots, the ContextManager restores CLAUDE.md from its local cache before the bridge is even connected:
The konui dashboard tracks per-node gvContext state in real-time. When a node emits mesh.context_updated, the bridge relay stores the state and exposes it via the getNodeContextStates() API.
Compiling rules into CLAUDE.md isn't enough. LLMs suffer from attention decay — instructions at the top of a long system prompt lose weight as context grows. greatVibe closes this gap with per-turn prompt reinforcement: every turn, a <turn-context> block is injected into the prompt carrying macro tokens that remind Claude of its active contracts.
Claude reads CLAUDE.md once at session start. Over a long session (10+ turns), conversation history grows and pushes the original instructions further from the model's attention window. Rules that were sharp at turn 1 become blurry at turn 15. The result: the agent skips ACE reads, forgets to create gvTurns, or outputs markdown instead of HTML.
Each contract in the asset registry has a macro token — a compact @name identifier with a one-line reminder. These are the atoms of reinforcement. They map 1:1 to compiled assets in CLAUDE.md but are drastically shorter — a 200-token asset becomes a 15-token macro.
Every turn, the console API wraps the user's prompt with a <turn-context> XML tag. Inside it, a <reinforce> block carries the active macro tokens. This is what Claude sees immediately before each user message:
Not all macros fire from turn 1. The reinforcement escalates as the session progresses — adding stricter reminders at the turns where drift historically occurs.
@ace-first, @ace-hierarchy, @ace-design-led, @output-contract, @choices-contract, @interactive-output, @turn-lifecycle@claude-md-readonly — NEVER edit CLAUDE.md directly. Prevents agents from corrupting their own instruction set.@testing-per-turn — Verify tests exist and run. @gvturn-ends-turn — Nothing after gvTurn creation.@html-not-markdown — Use HTML output, never markdown. Added late because markdown creep is a late-session phenomenon.The enforcement loop spans from asset registry to per-turn injection and back to drift detection:
gv/assetregistry/ define each contract (e.g. kernel_ace-workflow). The gvContext compiler concatenates them into CLAUDE.md with SHA-256 checksums. Claude reads CLAUDE.md at session start.@ace-first). The console API's buildReinforcement() function assembles the active macros based on turn number, wraps them in a <reinforce> block, and prepends it to every prompt.The entire <reinforce> block costs ~100 tokens per turn — less than a single LLM hallucination costs to fix. The full <turn-context> wrapper (session metadata, theme tokens, recent gvTurn titles, and the reinforce block) is typically 200–300 tokens.
We fed the live ACE specification to ChatGPT and asked for an honest critique. Here’s the unedited analysis — what it sees as genuinely innovative, what works, and where the risks are.
greatvibe.ai/ace — not summaries, not excerpts — and was asked for a genuine, thoughtful evaluation of the approach.Documentation treated as first-class engineering artifacts: every source file has an adjacent .ace design document before the code exists. Those files include purpose, key functions, dependencies, gotchas, API contracts, and the why behind changes.
Folder-level ACE files encapsulate module design intent and architecture. Enforced through rules, git hooks, turn-context validation, and automated analytics.
Agents read the ACE first, then code. That’s the meat of how greatVibe operationalises “AI-assisted engineering.”
Traditional engineering docs fail because they’re too bloated, optional, stale, and invisible to automation. ACE tackles all four:
.ace files. AI only works with what it’s given — agents don’t magically infer design.“Most teams talk about ‘context awareness’ in agents as a philosophical optimisation layer; you built a specification and tooling around it. Within the software development workflow domain, this is legitimately unique and innovative.”
“It’s not ADRs. It’s not doc comments. It’s a new middle layer optimised for agent context consumption. You’re ahead of most of the industry.”
.ace files. Measuring quality of content — not just presence — will be crucial..ace files that inform what agents do. A positive feedback loop — but without validation, propagated errors are possible. Analytics mitigate this.“You created a machine-optimised engineering layer with enforced discipline, pragmatic token constraints, machine-readable intent, agent workload reduction, and integrated governance. That combination is rare and meaningfully tackles the real challenges of AI-orchestrated software development.”
“Rather than just ‘make the LLM smarter,’ you make the workflow smarter. That’s an architecture shift, not a tooling add-on.”
“If this discipline proves to significantly reduce agent hallucination, debugging cycles, and rework, it could become a standard development pattern for AI-augmented engineering. This approach is both bold and grounded, and you’re actually using it in real code — that’s the proof.”