ANT-OS Documentation

Complete reference for the biological operating system. v0.4.0

Installation

One-line install

$ curl -sSf https://ant-os.dev/install.sh | sh

The installer detects your system and picks the best method:

Requirements

Manual install

From .deb package

# Download latest release
$ wget https://github.com/anthonygaston/autonomous-native-trainee/releases/download/v0.4.0/ant-os_0.4.0_amd64.deb
$ sudo dpkg -i ant-os_0.4.0_amd64.deb

From source

$ git clone https://github.com/anthonygaston/autonomous-native-trainee.git
$ cd autonomous-native-trainee
$ cargo build --release
$ cp target/release/ant-os target/release/ant-shell ~/.cargo/bin/
After install
Two binaries are installed: ant-os (the daemon) and ant-shell (the interactive client).

Quick Start

1. Start the colony

# Fresh colony, 3 starter ants, API on port 7700
$ ant-os --fresh --port 7700 --ants 3

2. Connect with the shell

$ ant-shell
Connected to ANT-OS colony at 127.0.0.1:7700

ant> :status
Colony: 3 ants | Tick: 0 | Energy avg: 50.0%

ant> :roles
Extraction: 1 | Synthesis: 1 | Conversion: 1

3. Feed it data

# Ingest a local file
ant> :explorer read /path/to/document.txt

# Fetch a web page
ant> :cybernaut fetch https://example.com/article

# Train the language model
ant> :lm train 200

# Generate text
ant> :lm gen "The colony has learned"

4. Let it grow

# Enable automatic growth (on by default)
ant> :growth on

# ANTs will promote through roles based on quality
# Extraction → Synthesis → Convert → Constructor → Specialist roles

Configuration

Command-line flags

FlagDefaultDescription
--port3001API server port
--ants3Initial ant count
--freshfalseStart a new colony (don't restore snapshot)
--workspace~/ant-os-workspaceWorking directory for file operations

Config files

PathPurpose
~/.config/ant-os/api.jsonLLM provider config (provider, model, API key)
~/.config/ant-os/bots.jsonTelegram/Discord bot tokens and channel IDs

api.json example

{
  "provider": "claude",
  "model": "claude-sonnet-4-6",
  "api_key": "sk-ant-..."
}

What Is ANT-OS

ANT-OS is biological computation running as a Linux daemon. It is not a chatbot, not a simulation, and not a wrapper around an LLM. It is a self-organizing colony of autonomous neural agents — called ANTs (Autonomous Native Trainees) — that process data through a pipeline, earn energy from quality work, get promoted based on performance, and die when they run out of energy.

The colony learns by feeding — ingesting text, files, and URLs that flow through the neural pipeline and train the colony's internal language model. Over time, ANTs specialize into 13 distinct roles, from low-level data processing to executive decision-making, filesystem manipulation, network access, and system operation.

ANT-OS was designed as a Personal Cognitive OS (PC-OS): a local autonomous intelligence layer that runs beneath your daily computing life, continuously perceiving, learning, and acting in the background.

The Colony

The colony is the central simulation loop. Every tick, the following phases execute:

  1. Job dispatch — Tasks are queued and assigned to idle ANTs based on role
  2. Tick all ANTs — Each ANT processes its current task through its neural brain
  3. Quality scoring — The Supervisor evaluates task output via cosine similarity
  4. Energy update — Quality work earns energy; failure and idleness drain it
  5. Promotions — ANTs with sustained high quality EMA advance to specialist roles
  6. Lifecycle — Zero-energy ANTs die; Constructors can reproduce
  7. Automation — Rules evaluate, watchers drain, tasks execute
  8. Social signal — Colony-wide trust/valence updates propagate through the Thalamus
┌─────────────────────────────────────────────────────────┐ │ ANT-OS Colony │ ├───────────┬───────────┬───────────┬─────────────────────┤ │ Pipeline │ Senses │ Brain │ Body │ │───────────│───────────│───────────│─────────────────────│ │ Extract │ Explorer │ Librarian │ SystemOperator │ │ Synthesize│ Tracker │ Elder ×3 │ Defender │ │ Convert │ Cybernaut │ Respond. │ Engineer │ │ Construct │ │ │ │ ├───────────┴───────────┴───────────┴─────────────────────┤ │ Soul Plane · Language Bus · Kernel · Memory Journal │ ├─────────────────────────────────────────────────────────┤ │ Automation Engine · FS Watcher · Task Runner │ ├─────────────────────────────────────────────────────────┤ │ REST API (92 endpoints) · Interactive Shell │ └─────────────────────────────────────────────────────────┘

The 13 Roles

ANTs are promoted through a hierarchy based on sustained quality scores. Every ANT starts in the Pipeline tier and advances through demonstrated performance.

Pipeline Tier — All ANTs start here
Extraction Synthesis Conversion

Extraction compresses raw input into latent space (encoder half). Synthesis reconstructs patterns from latent representations (decoder half). Conversion transforms between representation formats.

Specialist Tier — Promoted at quality ≥ 0.35
Constructor Explorer max 1 Engineer max 1

Constructor reproduces by splitting its brain to create offspring. Explorer reads local files, watches directories, feeds the corpus. Engineer writes output files and manages colony filesystem production.

Leadership Tier — Promoted from Constructor with offspring
Elder max 3 Librarian max 1

Elder — Executive function; gates what the colony expresses. The Elder Council is the prefrontal cortex. Librarian — Semantic memory; clusters knowledge into emergent categories.

System Tier — Requires system_body
SystemOperator Defender Cybernaut

SystemOperator — Kernel command execution; 59 primitives for process/file/memory/network management. Defender — Colony immune system; reviews every command for safety, vetos threats. Cybernaut — Network access; fetches URLs, communicates with other colonies.

Language Tier
Respondent max 1 Tracker max 1

Respondent — Token-by-token text generation via the NeuralLM. Tracker — Observes user behavior (keyboard timing, file events, app switching).

Energy & Lifecycle

Every ANT has an energy level that determines its survival. Energy is the colony's currency of quality.

Natural selection
ANTs that produce high-quality work survive and advance. Those that don't, die and free resources. This is intentional — the colony self-selects for competence.

The Pipeline

All data flows through a three-stage neural pipeline:

Input → [Extraction] → Latent Space → [Synthesis] → Reconstruction → [Conversion] → Output ↑ ↓ Explorer / Cybernaut / User Engineer / Respondent / LM Training

Extraction ANTs encode raw data into 832-dimensional Species Code representations. Synthesis ANTs reconstruct patterns from these representations. Conversion ANTs transform between formats. The quality of each stage is scored by the Supervisor, feeding back into energy and promotions.

This pipeline runs every tick — the colony is always processing, always learning.

Species Code (832D)

Species Code (SC) is the universal internal representation used by every ANT. It's an 832-dimensional vector composed of:

The SCEncoder maps raw 8D sensor inputs into 832D SC via dense and slot weight matrices. The SCDecoder maps SC back to 8D action outputs. Between them, the Gate System applies multiplicative neuromodulation across 4 tiers:

TierModulationPurpose
0Raw signalUnmodulated baseline
1Arousal, stress, fatigueBody state influence
2History, goalsContext and planning
3Social feedbackColony-wide trust signals

Brain Regions

Each ANT's brain contains 6 simulated cortical regions that process information in a coordinated loop:

RegionFunctionBiological analog
Sensory Cortex Raw 8-channel input processing and activity detection Primary sensory areas
Thalamus Sensory relay with gating — filters inputs based on attention state Thalamic relay nuclei
Hippocampus Episodic memory circuit — novelty scoring and associative recall Hippocampal formation
Amygdala Emotional valence (threat/reward) and arousal computation Amygdaloid complex
dlPFC Sustained working memory with interrupt-driven context stacking Dorsolateral prefrontal cortex
Basal Ganglia Value-based reinforcement learning with eligibility traces and dopamine signals Striatum + substantia nigra

The processing loop each tick: Sensory Cortex → Thalamus → Hippocampus + Amygdala → dlPFC → Basal Ganglia → SC Encoder → Action

Kernel (59 Primitives)

The kernel is ANT-OS's interface to the host operating system. The SystemOperator role executes primitives through a 3-layer architecture:

CategoryPrimitives
Processspawn, terminate, list, info, priority, suspend, resume, signal, shell_exec
Filesystemcreate, read, write, delete, seek, stat, permissions, mkdir, ls, rmdir
Memoryallocate, free, protect, query, map, swap
Networksocket, bind, listen, accept, connect, send, receive, close
Devicelist, read, write, control, interrupt
Monitorcpu, disk, network, temperature
Securityperm get/set, owner set, auth challenge
Timeclock, timer set/cancel, process time
Powerquery, sleep, shutdown

Safety levels

Every primitive is classified for Defender review:

LevelReviewExamples
ObserveAuto-approvedProcessList, FileStat, MonitorCpu
ReversibleLoggedFileCreate, MemoryAllocate
DestructiveDefender must approveFileDelete, ProcessTerminate, ShellExec
ForbiddenAlways blockedPowerShutdown (without override)

Memory System

ANT-OS implements a 3-tier semantic memory system inspired by biological memory consolidation:

Hot Memory — 4,096 entries

Recent context and working memory. Fast access, continuous updates. Automatically consolidated to the archive tier when full.

Archive Memory — 2,048 entries

Consolidated from hot tier. Merged, deduplicated, importance-weighted. Migrates to long-term when mature.

Long-term Memory — Unlimited

48-dimensional FastText PCA embeddings. Semantic similarity search. The permanent knowledge substrate that survives across sessions.

Additional memory features:

NeuralLM

A 2-layer Transformer (625K parameters) that trains on the colony's corpus. This is not a large language model — it's a small, local, continuously-learning model that captures domain-specific patterns from the colony's experience.

Training sources

Commands

ant> :lm status              # Model stats, corpus size, vocab
ant> :lm train 200           # Train 200 epochs on current corpus
ant> :lm train "Custom text"  # Add text to corpus and train
ant> :lm gen "The colony"     # Generate text from prompt
ant> :lm feed /path 10       # Ingest file + train 10 epochs
ant> :lm save                 # Persist weights to disk
ant> :lm load model.antlm    # Load saved weights

Automation Engine

Event-driven rules that fire autonomously every tick — no user input required. Rules consist of a condition (when to fire) and an action (what to do).

Condition types

TypeSyntaxDescription
Tick intervaltick:500Fire every N ticks
Metric thresholdmetric:energy_avg:below:20Fire when metric crosses threshold
Event matchevent:ant_diedFire on colony event (prefix match)

Available metrics

num_alive, num_idle, energy_avg, total_deaths, total_tasks_completed, tick_count, sys_cpu_load, sys_memory_available

Action types

TypeSyntaxDescription
Webhookwebhook:<url>:<message>POST JSON to external endpoint
API callapi:<method>:<path>Call colony API internally
Journal logjournal:<message>Log to colony journal
Start tasktask:<name>Start a saved TaskPlan

Examples

# Alert when energy drops low
ant> :auto create low-energy metric:energy_avg:below:20 webhook:http://localhost:3100/hook:low_energy 100

# Log a heartbeat every 1000 ticks
ant> :auto create heartbeat tick:1000 journal:alive 0

# Trigger a task when CPU spikes
ant> :auto create cpu-alert metric:sys_cpu_load:above:90 task:cpu-report 500

# List all rules
ant> :auto list

# Disable a rule
ant> :auto disable 1

Filesystem Watcher

The Explorer is both a periodic crawler (every 500 ticks) and a real-time filesystem sensor. Using Linux inotify (via the notify crate), the colony watches directories and reacts to file changes as they happen.

How it works

  1. You add watch paths via :watch add /path
  2. inotify monitors the directory recursively for create/modify/delete events
  3. Events are drained every tick (Phase 4.66, max 256 events/tick)
  4. Changed file paths are pushed into explorer_hints
  5. Explorer ANTs pick up changed files for re-ingestion

The periodic crawl is preserved — the watcher supplements it. Crawling catches anything the watcher might miss; watching catches changes instantly.

ant> :watch add /home/user/projects    # Watch recursively
ant> :watch add /var/log                # Watch log directory
ant> :watch list                        # List active watches
ant> :watch remove /var/log             # Stop watching
Persistence
Watch paths are saved in colony snapshots. They're restored automatically when the colony loads.

Shell Execution

ShellExec (Primitive #59) runs arbitrary shell commands on the host system and captures stdout/stderr. Safety level: Destructive — every execution passes through Defender review.

PropertyValue
Opcode0x0D00
SafetyDestructive (Defender approval required)
Executionsh -c <command>
Output capturestdout + stderr, 8KB max
ReturnsExit code + captured output
ant> :exec uname -a                    # System info
ant> :! df -h                           # Disk usage (alias)
ant> :exec cargo build --release 2>&1   # Build project
ant> :! systemctl status nginx          # Check service

Soul Plane

When an ANT dies, its knowledge doesn't disappear — it enters the Soul Plane. This is the colony's epigenetic memory: the accumulated wisdom of dead ANTs that influences future generations.

ant> :soul                 # View Soul Plane status
ant> :personality scientific  # Apply personality overlay
ant> :personality blend scientific:0.7 creative:0.3  # Blend styles

Defender & Security

The Defender is the colony's immune system. Every kernel command proposal passes through Defender review before execution.

The Defender also monitors for:

ant> :defender          # Defender status + recent decisions
ant> :ledger            # Full command audit trail

Shell Commands

Status & Inspection

CommandDescription
:statusColony overview: ant count, tick, energy, roles
:qualityQuality EMA scores for all ANTs
:lexiconWord frequency and vocabulary stats
:antsList all living ANTs with role and energy
:rolesRole distribution summary
:pipelinePipeline throughput stats
:bodySystem body telemetry (CPU, RAM, disk, network)
:ant <id>Detailed info for a specific ANT
:ledgerKernel command audit trail
:defenderDefender status and recent decisions
:configRuntime configuration
:soulSoul Plane status
:forgeCorpus Forge status

Colony Control

CommandDescription
:spawn <role>Spawn a new ANT with specified role
:split <role>Constructor splits to produce offspring
:promote <id> <role>Manually promote an ANT
:kill <id>Kill a specific ANT
:feed <id>Feed energy to a hungry ANT
:merge <id> <id>Fuse two ANTs into one
:growth on|offToggle automatic colony growth
:save [path]Save colony snapshot to disk

Data Acquisition

CommandDescription
:cybernaut fetch <url>Fetch and ingest a web page
:explorer read <path>Ingest a local file
:respondent train <text>Direct text training for the LM
:lm feed <url|path> [epochs]Ingest source + train

Language Model

CommandDescription
:lm statusModel stats, corpus size, vocab
:lm train <epochs|text>Train on corpus or add text + train
:lm gen <prompt>Generate text from prompt
:lm save [path]Persist weights to disk
:lm load <path>Load saved weights

Knowledge & Memory

CommandDescription
:librarian query <text>Semantic search across categories
:librarian pruneClean up low-relevance clusters
:contextFull colony knowledge dump
:context recentChanges since last poll
:personality <name>Set writing style personality
:personality blend <name:wt ...>Blend multiple personalities

Shell Execution

CommandDescription
:exec <command>Run shell command, capture output
:! <command>Alias for :exec

Filesystem Watcher

CommandDescription
:watch add <path>Watch directory recursively for file events
:watch remove <path>Stop watching a directory
:watch listList all active watches

Task Automation

CommandDescription
:task exec <cmd>Quick single-command task
:task run <name>Interactive multi-step task builder
:task listList all task plans
:task detail <id>Inspect task plan steps
:task start <id>Start a task plan
:task cancel <id>Cancel running task
:task pruneClean up completed tasks

Tracker

CommandDescription
:tracker recordStart capturing user actions
:tracker stopStop recording, convert to TaskPlan
:tracker replay [name]Re-execute recorded steps
:tracker save <name>Persist recording for future use
:tracker listList saved recordings

Automation Rules

CommandDescription
:auto listList all automation rules
:auto create <name> <cond> <action> [cooldown]Create a rule
:auto delete <id>Delete a rule
:auto enable <id>Enable a rule
:auto disable <id>Disable a rule

API Reference (92 endpoints)

ANT-OS exposes a REST API via Axum. By default on http://127.0.0.1:3001 (configurable with --port). All responses are JSON.

Status & Context

MethodRouteDescription
GET/statsFull colony statistics
GET/context/summaryColony context summary for LLM consumption
POST/context/relevantContext relevant to a query
GET/memory/summaryMemory system overview
GET/memory?limit=NRecent memory entries

Colony Control

MethodRouteDescription
POST/spawnSpawn ANT with role
POST/saveSave colony snapshot
POST/shutdownGraceful shutdown

Data Acquisition

MethodRouteDescription
POST/explorer/readIngest local file
POST/cybernaut/fetchFetch and ingest URL
POST/respondent/trainDirect text training
POST/memory/ingestIngest into memory system

Language Model

MethodRouteDescription
GET/lm/statusLM stats and vocab
POST/lm/trainTrain on corpus
POST/generateGenerate text from prompt

Knowledge

MethodRouteDescription
POST/librarian/querySemantic search across categories

Kernel

MethodRouteDescription
POST/kernel/execExecute kernel primitive by name
POST/shell/execRun shell command directly

Filesystem Watcher

MethodRouteDescription
POST/explorer/watchAdd watch path
POST/explorer/watch/removeRemove watch path
GET/explorer/watch/listList active watches

Automation

MethodRouteDescription
GET/automationsList all rules
POST/automations/createCreate automation rule
POST/automations/deleteDelete rule by ID
POST/automations/enableEnable/disable rule
POST/automations/webhooks/drainDrain pending webhook payloads

Source Modules

ANT-OS is organized into ~120 source files across 8 module groups.

Neural foundation (src/)

ModuleDescription
synapse.rsWeighted connections with Hebbian plasticity and synaptic pruning
neuron.rsArtificial neuron with sigmoid activation and Hebbian learning
attention.rsStack-based interrupt context management and salience evaluation
memory.rsSalience-weighted episodic store for hippocampus
bus.rsInter-region signal routing using named constants
brain.rsMain orchestrator: coordinates sensory → SC → regions → action
signals.rs55+ named constants for inter-region communication

Brain regions (src/regions/)

ModuleDescription
sensory_cortex.rs8-channel raw input processing
thalamus.rsSensory relay with attention gating
hippocampus.rsNovelty scoring and associative recall
amygdala.rsEmotional valence (threat/reward) and arousal
dlpfc.rsSustained working memory with interrupt stacking
basal_ganglia.rsReinforcement learning with eligibility traces

Species Code (src/sc/)

ModuleDescription
mod.rsCore 832D encoding: 64 dense + 16×48 slots
encoder.rsMaps 8D inputs → 832D Species Code
decoder.rsMaps 832D Species Code → 8D outputs
gates.rs4-tier neuromodulatory gate system
alphabet.rsWord frequency tracking and stability analysis
tokenizer.rsSC ↔ text conversion via learned vocabulary
hrc.rsHierarchical recurrent compression for long context
binding.rsTensor product and role-binding for compositional SC
fasttext_pca.rsPre-trained embedding projection for linguistic grounding

Body & interoception (src/body/)

ModuleDescription
stomach.rsHunger accumulation and proportional feeding
metabolism.rsEnergy consumption with stress-dependent burn rate
nociception.rsPain generation from hunger and lethal states
interoception.rs8-channel body state: hunger, energy, fatigue, pain, stress
system_body.rsMachine-level telemetry: CPU, memory, disk, network → 8D signal

Colony & agents (src/ant/)

ModuleDescription
ant.rsIndividual agent: brain + body + task state + role + lifecycle
colony.rsMain simulation loop: spawn, tick, score, promote, lifecycle (~1500 lines)
api.rsREST API: 92 endpoints via Axum (~2800 lines)
kernel_ops.rs59 kernel primitive definitions with safety classification
kernel_exec.rsSandboxed primitive execution
kernel_cmd.rsSC output → primitive resolution
kernel_sandbox.rsCapability-based isolation: resource limits, allowed paths
kernel_ledger.rsAudit trail and consensus for command proposals
automation.rsEvent-driven rule engine: conditions → actions
supervisor.rsQuality scoring of task completions
soul_plane.rsEpigenetic memory: hero weights from dead ANTs
fusion.rsBrain merging for hybrid offspring
social.rsColony-wide trust/valence signal broadcast
neural_lm.rsCharacter-level LM: 3-layer MLP, streaming generation
journal.rsConversation log with semantic search and threading
corpus_forge.rsCorpus building from files/URLs with provenance tracking
language_bus.rsBidirectional channel between Respondent and user

Binaries (src/bin/)

BinaryDescription
ant-osMain daemon: spawns colony thread, starts API server
ant-shellInteractive REPL: commands, stats, automation
train-lmStandalone LM training: corpus ingestion, checkpoints

Bot Integration

ANT-OS includes Telegram and Discord bot bridges that connect external LLMs (Claude, Mistral, Codex, Kimi) to the colony. The bots inject the colony's agent_reference.md as system context, giving the LLM full awareness of colony state and commands.

How it works

  1. User sends a message to the Telegram/Discord bot
  2. Bot fetches colony context via GET /context/summary
  3. Bot sends user message + colony context + agent reference to the LLM
  4. LLM responds, optionally including [api_call] blocks
  5. Bot parses API call blocks and executes them against the colony
  6. Results are sent back to the user

This gives external LLMs full control over the colony — spawning ANTs, creating automation rules, running shell commands, querying memory — all through natural language.

Configuration

// ~/.config/ant-os/bots.json
{
  "telegram_token": "...",
  "discord_token": "...",
  "colony_url": "http://127.0.0.1:7700",
  "allowed_channels": ["..."]
}

LLM Orchestration

An external LLM connected to ANT-OS isn't just a reference tool — it's the deep reasoning layer of the architecture. The colony provides continuous perception and memory; the LLM provides judgment and strategy.

What the LLM can do

Programmatic access

# From any script or tool, hit the API:
$ curl -s http://127.0.0.1:7700/stats | jq .
$ curl -X POST http://127.0.0.1:7700/shell/exec -d '{"command":"uname -a"}'
$ curl -X POST http://127.0.0.1:7700/automations/create \
    -H 'Content-Type: application/json' \
    -d '{"name":"cpu-watch","condition":{"type":"MetricThreshold","metric":"sys_cpu_load","op":"Above","value":90},"action":{"type":"JournalLog","message":"CPU high"},"cooldown_ticks":500}'

GPU Acceleration

ANT-OS supports optional GPU acceleration via wgpu (Vulkan/Metal/DX12). Enable with the gpu feature flag:

$ cargo build --release --features gpu
GPU support is experimental
The CPU path is the default and recommended for most deployments. GPU acceleration is useful for large colonies (50+ ANTs) or intensive LM training.