The Anti-Serverless AI Dashboard: Inside aims-v2

How a Next.js application rejected the cloud to enable real-time, optimistic co-editing between humans and autonomous agents.

7 min read • View on GitHub • More from thedotmack

A physical double-desk where a human hand and a robotic arm write simultaneously in the same ledger book, representing the human-AI co-editing collision.
When humans and autonomous agents share a workspace, conflict resolution becomes a foundational architectural requirement.
Key Takeaways

The Co-Editing Collision

When an OpenClaw AI agent is thinking, it writes its internal state and memory directly to a local file. When a human owner wants to intervene or correct the agent, they use the aims-v2 dashboard to edit that exact same file. If both hit save at once, data is corrupted.

This introduces a radical shift in how we view AI. The agent is not a stateless chat window waiting for a prompt. It is a live, autonomous process that the human is auditing in real time. Building a user interface for this requires solving edge cases that standard AI wrappers simply ignore.

Cryptographic Optimism

To solve the concurrency problem, the system uses Content-Hash-based Optimistic Locking. When the client loads a file, it receives a SHA-256 hash representing the current state of that document.

The Hash Collision: How cryptographic hashes prevent human and AI edits from silently overwriting each other.

If the AI changes the file in the background, the server's hash immediately changes. When the human tries to save, the hashes mismatch. This triggers a 409 Conflict and forces a manual diff-merge in the UI, ensuring neither side loses their train of thought.

The Anti-Serverless Mandate

The project's internal planning documents explicitly state that the application must not be deployed to Vercel. To make the UI update instantly when the AI thinks, the system requires a singleton EventEmitter and a persistent chokidar filesystem watcher pushing Server-Sent Events.

A heavy industrial pneumatic tube system connecting a glowing brain in a jar to a computer monitor, contrasting with dissolving clouds in the background.
Stateful Node.js servers provide the persistent connections required for real-time agent monitoring, unlike ephemeral serverless functions.

Serverless functions spin down and lose memory state, making this architecture impossible. aims-v2 forces Next.js back into acting like a traditional, stateful Node.js server.

FeatureStandard AI Wrappersaims-v2 Architecture
HostingEphemeral ServerlessPersistent VPS / Local Node.js
StateCloud DatabaseLocal Filesystem (Markdown + SQLite)
UpdatesPolling (REST)Push (Chokidar + Server-Sent Events)
ConcurrencyLast-write-winsSHA-256 Optimistic Locking

Markdown as a Portable Soul

Instead of a complex Postgres database, the agent's identity, prompts, and current context are stored entirely as plain text Markdown files with YAML frontmatter. This means the AI is perfectly portable.

A close-up of a translucent gemstone containing rigid rows of typewriter text inside its facets.
By storing state in Markdown files, the agent's identity becomes a portable, immutable artifact.

The dashboard is simply a beautiful UI sitting on top of a directory of text files. It is an exercise in treating the local filesystem as the ultimate source of truth for machine intelligence.