Download Game! Currently 85 players and visitors. Last logged in:EwilynTaikaAnakinElwines

Blitzer's Blog >> 71772

Back to blogs index
Posted: 17 Aug 2026 17:03 [ permalink ]
blog add OMEGA MESH OS v0.2+ - DEVELOPER MANIFESTO & ARCHITECTURE GUIDE
To the Developer / AI Assistant:
You are assisting in the development of OMEGA Mesh OS, a highly modular,
UNIX-inspired, browser-based virtual operating system. The system acts as a
"Liquid Frontend" or "Thin Client" that connects to a decentralized network
(The Dark Mesh). The browser only renders what the backend or background
processes tell it to render via an asynchronous Event Bus.

Core Philosophy: The system is an "Agentic OS". It must be 100% agnostic to
whether commands come from a human typing on a keyboard, a remote Termux
terminal, a Python script, or an AI agent over the network.

Before writing any code for Mesh OS, you MUST strictly adhere to the following
architectural pillars and rules.

Before writing any code for Mesh OS, you MUST strictly adhere to the following
architectural pillars and rules.o8 THE 6 PILLARS OF MESH OS
1. Everything is an Intent (JSON)
We do NOT parse strings with Regex. The OS has a bulletproof State-Machine
Lexer that tokenizes user input. Every action in the systemwhether spawning an
app, piping data, or closing a windowmust be abstracted into a JSON Intent.

Bad: if (cmd.startsWith("SPAWN")) { ... }

Good: MeshOS.intent({ op: "spawn_window", target: "clock" })

Rule: Extend window.MeshOS.intent to add new capabilities.

2. UNIX Process & I/O Model (File Descriptors)
Every application is a MeshOS.Process object. Apps do not randomly write to
the screen. They communicate exclusively via standard File Descriptors (FD):

fd[0] = stdin (Input)

fd[1] = stdout (Normal output)

fd[2] = stderr (Error output)

Piping: Output from one app can be piped to another: MeshOS.intent({op:
"pipe", from: PID1, fromFd: 1, to: PID2, toFd: 0}).

Dmesg: Any output written to stdout/stderr that is NOT piped to a target
automatically falls into the global MeshOS.Syslog (dmesg buffer).

3. Visual Layer: Workspaces & Screens
The UI is divided into Workspaces (WS 1, WS 2, WS 3). Each workspace has its
own DOM container (#screen-1).

Rule: Apps must never write to document.body directly. If an app needs a GUI,
it must query the current workspace (MeshEnv.get('CURRENT_WS')) and mount its
DOM elements inside that specific screen container.

4. Global State: MeshEnv & Named Streams
MeshEnv: A global registry for environment variables (like Linux env vars).
Use MeshEnv.set(k, v) and MeshEnv.get(k).

Named Streams: For Pub/Sub data. Use MeshOS.Streams.push('topic', data,
'mime/type') and MeshOS.Streams.sub('topic', callback). This replaces old
hardcoded data polling.

5. VFS Persistence & Bootloader
The OS lives in IndexedDB (VFS). On boot, the browser loads and executes files
in alphabetical order (e.g., 00_kernel.js, 01_wm.js, 02_repl.js).

Rule: Do not write monolithic code. Scripts are injected via a backend
dispatcher (load_to_session.sh).

6. The 150-Line Rule
Rule: Every .js module or application MUST be highly modular and strictly
under 150 lines of code. If it's longer, break it into libraries or separate
Intents.

Rule: Every .js module or application MUST be highly modular and strictly
under 150 lines of code. If it's longer, break it into libraries or separate
Intents.o8 HOW TO BUILD A MESH OS APPLICATION (EXAMPLE)
When asked to create a new program, follow this structure. This example
demonstrates a basic app that reads from stdin and writes to the current
workspace DOM.

File: codebase/sysutils/example_app.js

JavaScript
/ Extend the global Intent Router safely
window.MeshOS.intent = (function(oldIntent) {
  return function(req) {
    
    // 1. Intercept your specific Intent
    if (req.op === 'spawn_example') {
      
      // 2. Create a Process to get a PID and File Descriptors
      const app = new window.MeshOS.Process('example_app');
      
      // 3. Create GUI element (if needed)
      const ui = document.createElement('div');
      ui.style = 'border:1px solid #0f0; padding:10px; background:#111;
color:#0f0; margin:5px; display:inline-block;';
      ui.innerText = `App PID: ${app.pid} waiting for input...`;
      
      // 4. Mount to the ACTIVE Workspace (Never document.body)
      const currentWs = window.MeshEnv.get('CURRENT_WS');
      document.getElementById('screen-' + currentWs).appendChild(ui);
      
      // 5. Handle Standard Input (stdin)
      app.fds[0].onData = (data) => {
        ui.innerHTML += `<br>> ${data}`;
        
        // Example of writing to stdout
        app.write(1, `Processed: ${data}`); 
      };
      
      return app.pid; // Always return the PID
    }
    
    // 6. Pass unhandled intents back to the chain
    return oldIntent(req);
  };
})(window.MeshOS.intent);

Porting Legacy Code (Migration Guide)
If you are porting legacy code (e.g., from hauki-os):

Remove Regex Parsing: Do not parse string commands manually. Let the
State-Machine Lexer tokenize it, and handle it inside an intent({op: "..."})
block.

Remove setInterval Polling for external data: Use MeshOS.Streams to subscribe
to events asynchronously.

Stop Global DOM Hacks: Confine UI logic to the CURRENT_WS DOM node.

Decouple Execution: Assume your code might be executed via a remote JSON
payload from a Python script or an AI agent. Return clear text or JSON
responses from your intent handlers.

Your Goal: Write modular, elegant, UNIX-like JavaScript that integrates
seamlessly into the Event Bus. End of Manifesto.