interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / seed / agent / README.md

312 lines · 18960 bytes Raw Blame History Source

seed/agent: omagent, a small coding agent in seeded Omega

omagent is an agent harness in the style of HKUDS/nanobot (MIT), written in seeded Omega. Only nanobot's architecture was reused. None of its code was copied. The program is one static ARM64 Linux executable (191,608 bytes with omc 5f90edea) built from six sources:

{ printf 'om2\n'; cat seed/json/json.om seed/json/jsonw.om seed/net/http.om seed/net/notls.om seed/agent/path.om seed/agent/agent.om; } \
  | seed/out/omc > omagent && chmod +x omagent

seed/agent/path.om holds the workspace path rule (agpathok); the Omega Node tool adapter seed/node/tool.om composes the same file, so both refuse the same paths. The only compiler needed is the pinned seed/out/omc. Every implementation byte is compiled from .om. Python appears only in the test referee tests/check.py, which also plays the mock model server.

Status: IMPLEMENTED and EXERCISED on the host (Linux ARM64, DGX Spark) against a scripted mock server. No real model server was used, and no hardware qualification applies.

Architecture

operator CLI / stdin line  ->  agent loop  ->  model backend (HTTP POST, SSE or JSON)
                                   |                 |
                                   v                 v
                           tool dispatcher    stream parser (http.om SSE + json.om)
                     (read_file, write_file,         |
                      run_command, http_fetch)       v
                                   |          stdout (content deltas as they arrive)
                                   v
                     session file (append-only JSONL), memory file (read-only)

Agent loop

One user turn runs at most --max-rounds model rounds (default 8, at most 64):

  1. Append the user message to the history.
  2. Send the system prompt, the memory file and the whole history to the model with the four tool schemas.
  3. Stream the reply. Content deltas go to stdout as they arrive. Tool call deltas are collected by index, at most 8 calls per reply.
  4. With no tool calls, the turn ends. Otherwise, run every call in order, append one tool message per call (matched by tool_call_id), then go to step 2.
  5. Hitting the round limit stops with exit 7. Interrupted turns are trimmed from the in-memory history, so a later turn never sends a dangling tool_calls message.

With -p PROMPT, omagent runs one turn and exits. Without it, it reads prompts from stdin, one per line, until end of file (the stdin channel).

Model backend

Any OpenAI-compatible chat completions endpoint reached over plain HTTP at an IPv4 literal or localhost. The request is {"model":..,"stream":true,"tools":[..],"messages":[..]} with Content-Length, Accept: text/event-stream and, when a key is present, Authorization: Bearer KEY. A text/event-stream reply is parsed as SSE until [DONE]. Any other content type is read as one JSON document (choices[0].message), which covers servers that ignore stream.

https:// is refused with exit 2: this build carries no TLS client. Wiring om/tls in is proposed and NOT_RUN. Point omagent only at a model server you run. The resident server on 127.0.0.1:18091 must not be used for tests.

Tool protocol

The tools are OpenAI function tools whose arguments is a JSON object (a JSON string holding an object, or a raw object, both accepted):

toolargumentspermissionresult
read_filepathalwaysfile bytes, at most 64 KiB plus a truncation marker
write_filepath, content--allow-writeok: wrote N bytes to PATH
run_commandargv (1..63 strings)argv[0] exactly equal to an --allow-cmd entryoutput, then [exit status N], [killed by signal N] or [killed: timeout after S s]
http_fetchurl (http:// only)canonical HOST:PORT on an --allow-fetch entrystatus=N then the body, at most 64 KiB

A refused call is answered with a tool message that starts with refused: and names the permission, and the loop continues. The model sees the refusal; nothing runs. Result text is repaired to valid UTF-8 before it enters the history.

Memory

Relative --session and --memory paths resolve against the directory omagent started in, before it enters --workdir. Keep the session file outside the workspace too.

Channels

Two channels exist now: the CLI one-shot (-p) and stdin lines. Both are first-party. These are PROPOSED and not built: an HTTP channel (an OpenAI-compatible /v1/chat/completions server using the seed/net server half, like nanobot serve) and chat adapters (Matrix, IRC, Telegram). Adapters need TLS and are the natural home for omega-bridge or other universal adapters.

Safety model

  1. The model is untrusted. Every byte it sends passes http.om (status line, headers, chunked or close-delimited body, SSE framing) and json.om under fixed caps: 256 KiB per JSON reply or SSE event, 128 KiB reply text, 8 tool calls, and per call 255 bytes of id, 127 bytes of name and 64 KiB of arguments. A reply that breaks a cap, is not JSON, carries an error object, or ends before [DONE] or a finish_reason stops omagent with exit 6. Nothing from that reply runs.
  2. Tool permissions are explicit. By default, only read_file inside the workspace is allowed. Writing, programs and fetches each need their own flag. Programs are named by absolute path, and there is no shell and no PATH search.
  3. The workspace is a jail by path rules.
    • Paths must be relative.
    • No part may be empty, . or ... No control byte is allowed.
    • Every prefix is checked with lstat and must not be a symbolic link.
    • The final open uses O_NOFOLLOW.
    • Limit: the checks and the open are separate system calls, so a concurrent local process that swaps a directory for a link between them could escape (TOCTOU). Proposed fix: openat2 with RESOLVE_BENEATH as a host word. The effect-manifest work in seed/effects is the proposed outer sandbox layer.
  4. Commands are bounded.
    • Children run with an empty environment and stdin on /dev/null.
    • stdout and stderr go to one close-on-exec pipe, and at most 64 KiB is kept.
    • Each command runs as the leader of its own process group (setpgid on both sides of the fork, as in seed/node/auth.om).
    • When the direct child exits, omagent reaps it and SIGKILLs the rest of its group, so a background grandchild cannot outlive the call or hold the pipe open; the output read then ends at end of file. The call returns within about 50 ms of the child's exit.
    • At the --cmd-timeout deadline (default 10 s), the whole group gets SIGKILL and the child is reaped.
  5. No secrets in logs.
    • The API key is read from OMAGENT_API_KEY (or --key-env NAME), never from argv. It must be bytes 0x21..0x7e.
    • The key appears only in the Authorization header. The header buffer is zeroed after the write.
    • stderr carries only fixed messages and omagent: tool NAME: ok|refused|error.
    • Tool arguments and results are never echoed to stderr.
    • The session file stores messages, not headers.
    • The tests assert that the key never appears in stdout, stderr or the session file, and that the mock server did receive it.
  6. Timeouts. --timeout (default 120 s) bounds each model request, both idle time and the whole body. Connecting has a 5 s limit.

CLI

omagent --url http://IP:PORT/PATH --model NAME [-p PROMPT] [--workdir DIR]
  [--session FILE] [--memory FILE] [--allow-cmd /ABS/PATH]... [--allow-write]
  [--allow-fetch HOST:PORT]... [--timeout S] [--cmd-timeout S] [--max-rounds N]
  [--key-env NAME] | --version | --help

Exit codes:

codemeaning
0ok
2usage, configuration, --workdir or a bad key
3connect or send failed
4HTTP status other than 200 (stderr shows the status and the first 512 sanitized body bytes)
5model timeout or read failure
6malformed model output
7--max-rounds reached
8session or memory file
9a message could not be encoded, or the history is full

Tests

nice -n 19 ionice -c3 python3 seed/agent/tests/check.py

The test builds omagent with seed/out/omc and starts a scripted mock model server on a kernel-chosen 127.0.0.1 port. It then runs 32 conversations:

Negative controls follow. Two wrong expectations must fail. Nine source mutants must each be caught: allowlist bypass, .. allowed, symlink followed, fetch allowlist bypass, write flag ignored, end of stream without [DONE] accepted, SIGKILL to the direct child only (not its group) after it exits or at the deadline, and end of file taken as the child's exit. Output: AGENT-CHECK PASS cases=35 mutants=9. Exit 0 means PASS, 1 FAIL, and 3 NOT_RUN (no compiler).

Host dependencies

dependencyversionpurposeOmega replacement
seed/out/omcpin sha256 2c824805... (omega-mv main)compileritself (seeded)
Linux ARM64 kernelhostsystem calls through compiled host wordsnone (platform)
Python 33.12 on the Sparktest referee and mock server only, not on the product patha .om mock server on seed/net (proposed)
nanobot-ai0.3.5 on Python 3.12.3, in a separate venvcomparison arm of bench/ onlynone needed (not a dependency of omagent)

Compared with nanobot

Feature matrix

nanobot-ai 0.3.5 (paths relative to its installed nanobot/ package) against omagent (agent.om lines at this commit). Status: HAS (equivalent), PARTIAL (narrower), MISSING (absent).

featurenanobot evidenceomagentomagent evidence
model/tool loop with an iteration capagent/runner.py, maxToolIterations config/schema.py:129HASagturn :2237, --max-rounds :82, :161
streamed replies (SSE)providers/openai_compat_provider.py:2124HASagsse :1498; non-stream JSON too, agjsonbody :1527
read and write a fileread_file/write_file agent/tools/filesystem.py:281,546HAS (no offset/limit/pages on read)agtread :1762, agtwrite :1804
edit_file, list_dir, find_files, grep, apply_patchfilesystem.py:869,1111, search.py:215,514, apply_patch.py:84MISSING
shell commandexec agent/tools/shell.py:248 (through a shell)PARTIAL: argv exec of allowlisted programs, no shellagtrun :1965, agallowed :1849
persistent exec sessionsexec_session, list_exec_sessions exec_session.py:565,722MISSING
web fetchweb_fetch agent/tools/web.py:1114 (https, redirects, extraction)PARTIAL: plain http:// to allowlisted HOST:PORT, raw bodyagtfetch :2039
web searchweb_search web.py:367MISSING
workspace confinementrestrictToWorkspace schema.py:401 (default off)HAS (always on: no .., absolute paths or symlinks)agpathok :1735
command deny-list / timeoutsbuilt-in deny-list shell.py ~213-232, timeout :97PARTIAL: allowlist instead of deny-list; timeout and child exit kill the whole process groupagexec :1957, --cmd-timeout :81
MCP client (stdio, SSE, streamable HTTP)agent/tools/mcp.py:1365,1412, schema.py:362MISSING
session historysession/manager.py, sessions dirHAS (one JSONL file per --session)agsload :1032, agappend :917
history compaction / consolidationConsolidator and AutoCompact agent/loop.py:433,443, summaries agent/memory.py:803-824PARTIAL: drops the oldest whole turns, no summariesagcompact :896
long-term memory and Dreammemory/MEMORY.md, DreamConfig schema.py:53 (gateway only)PARTIAL: read-only --memory file, nothing written backagmemload :755
system prompt from workspace templates and skillscli/agent.py:154, skills/ (11 built-in)MISSING (fixed system prompt plus memory file)agsysmsg :1093
skillsskills/, disabledSkills schema.py:146MISSING
providers, presets, fallback modelsabout 46 providers schema.py:240, fallbackModels :128PARTIAL: one OpenAI-compatible endpoint, plain HTTP only, Bearer keyagurl :420, agkeyload :720
subagentsspawn agent/tools/spawn.py:63, agent/subagent.py:100MISSING
messages and session tools, goalsmessage.py:117, session_messages.py:81,153, sessions.py:88,165, long_task.py:159,290MISSING
chat channels17 channels in channels/ (Telegram, Slack, Discord, ...)MISSING (CLI only: -p or stdin lines)agline :2289
WebUI, gateway, OpenAI-compatible API serverwebui/, GatewayConfig schema.py:353, ApiConfig :333MISSING
cron and heartbeatcron tool agent/tools/cron.py:118, heartbeat schema.py:326MISSING
image generation, CLI apps, myimage_generation.py:121, cli_apps.py:99, self.py:149MISSING
transcriptionTranscriptionConfig schema.py:42MISSING
API key kept out of logs and child environmentsHAS (checked by every test case)tests/check.py

omagent lacks MCP, subagents, skills, web search, the editing and search tools, exec sessions, summarizing memory, multiple providers, TLS, chat channels, the WebUI and API server, cron and heartbeat, image generation and transcription. What it has is the four-tool coding loop above.

Equal-work benchmark

bench/equal_bench.py runs both programs through the same session:

Remaining differences:

A negative control (omagent without --allow-write) is graded BAD.

MEASURED on 2026-10-26 with omc 2c824805 (binary sha256 3eb8e93e..., 188,268 bytes):

A first run misnamed one skill, so nanobot's update-setup skill stayed enabled. That skill added 1,468 request bytes per session (3.3% of nanobot's 44,698). The numbers below are from the rerun with every built-in skill disabled. They are a little different from the first run, partly because the machine was busier.

Wall times include the same Python launcher and /usr/bin/time for both arms. Medians, with ratios from Wolfram:

measureomagentnanobotnanobot/omagent
launch to first model request, X925 / A7255.5 / 9.0 ms831 / 2228 ms167x / 255x
full session, instant mock, X925 / A72514.2 / 23.1 ms1206 / 2917 ms92x / 126x
full session, mock at 50 ms per chunk, X925 / A7251838 / 1850 ms3758 / 5020 ms2.02x / 2.73x
peak RSS2,584 KiB142,838 to 143,046 KiB55.3x

On-disk footprint:

Once the model is slow, the harness matters much less. With the mock spending about 1.8 s per session, omagent's advantage falls from 92x to 2.02x (X925) and from 126x to 2.73x (A725). The absolute gap stays at 1.2 to 3.2 s per session, mostly nanobot's 0.8 to 2.4 s startup, and amounts to 50% (X925) and 63% (A725) of nanobot's session time. Against a real model that takes seconds per reply, the share is smaller again. NOT_RUN: a real model server.

Raw rows, machine state, the Wolfram input and output, and the footprint lists are filed in the operator handoff OmegaBot/eqbench2/ (the first, flawed run is in OmegaBot/eqbench/).

Limits and NOT_RUN