The email bridge is a phenomenal extension of this architecture. Email is, at
its core, a decoupled, asynchronous, text-based queuing systemwhich maps 1:1
with how your HAUKI Actor Mailboxes operate.
Because the state is pure Markdown, an email client will render it perfectly
as plain text. When a human hits "Reply" and types their response at the top,
an SMTP-to-REST microservice (like a lightweight Node.js smtp-server or a
webhook from SendGrid) can easily strip the quoted reply, extract the From
address, and drop the new text directly into the HAUKI REST API. The engine
will never know the difference between an AI Python script, a web UI, or a
Gmail client.
Here is the LPC blueprint for the chair_daemon.c. Because HAUKI's VM natively
supports implicit string concatenation (your + operator compiles to opcode
0x06 and delegates seamlessly to StringManager.concatStrings), managing the
Markdown document requires zero parsing logic inside the virtual machine.
The Chair Daemon Blueprint
Save this as tests/fixtures/chair_daemon.c:
string project_uri;
string markdown_document;
/ Called once when the project is created
void initialize_project(string uri, string initial_markdown) {
project_uri = uri;
markdown_document = initial_markdown;
// Push the baseline document to the Cloudflare KV edge
save_object(project_uri);
write("Chair initialized for: " + project_uri + "
");
}
/ The eternal roundtable loop
void run_roundtable() {
int *payload;
string sender;
string message;
write("Roundtable active. Yielding CPU and waiting for participants...
");
while(1) {
// Suspend the context (0% CPU) until the REST API routes mail here
payload = read_mail();
if (payload != 0) {
// ABI Expectation: REST POST body is a JSON Array: ["SenderName",
"Message Text"]
sender = payload[0];
message = payload[1];
write(">>> Received input from: " + sender + "
");
// Append the new contribution to the Markdown document
markdown_document = markdown_document + "
### [" + sender + "]
";
markdown_document = markdown_document + message + "
";
// Instantly sync the updated consensus back to the cloud
save_object(project_uri);
write(">>> Document updated and synced to edge.
");
}
}
}
/ Read-only accessor for the REST API state serialization
string query_document() {
return markdown_document;
}
How the Full Pipeline Flows
* Instantiation: You clone the daemon and initialize it.
load tests/fixtures/chair_daemon.c
call 0 initialize_project "kv://projects/genesis-room-1" "# Genesis Room 1
Status: AWAITING_INPUT"
call 0 run_roundtable
* The Email/REST Submission: Your SMTP server receives an email from
petteri@example.com, extracts the body, and fires a POST request to your API
router:
curl -s -X POST -H "Content-Type: application/json" \
-d '["Human_Petteri", "Let us add a radiation mechanic to the grid."]' \
http://localhost:8085/api/objects/0/mail
* The Engine Wakeup: The ApiRouter intercepts the JSON, converts it into a
tagged array via _deserializeTagged(), and drops it in the mailbox. The
Scheduler wakes the context, the strings are concatenated in memory, and the
updated Markdown is immediately beamed back to Cloudflare KV.
* The AI Rebuttal: An AI Architect bot polling the KV edge sees the Markdown
update, generates a code snippet in response, and fires its own REST POST,
repeating the cycle asynchronously.
With the chair_daemon.c managing the state and your REST/KV plugins handling
the distribution, you now have a fully functioning, cross-platform
collaborative backend. We can test driving this loop via curl, or we can begin
drafting the Python LLM worker script that will actually read this KV state
and talk back to the Chair!