Skip to content

The OS Model

Archon Protocol is an operating system for AI agents. Every file maps to an OS concept with precise loading semantics: what is always resident, what is loaded on demand, what persists across sessions.

The Complete Map

┌──────────────────────────────────────────────────────────────────┐
│  ARCHON PROTOCOL = AI Agent Operating System                     │
│                                                                  │
│  ┌──────────────────────────────────────────────────────────┐    │
│  │  KERNEL (always resident in context)                      │    │
│  │                                                           │    │
│  │  AGENTS.md / CLAUDE.md        Prime directive, workflow   │    │
│  │  archon.config.yaml           System configuration        │    │
│  │  ai-index.md                  Page table (address map)    │    │
│  └──────────────────────────────────────────────────────────┘    │
│                          ↕ syscall interface                     │
│  ┌──────────────────────────────────────────────────────────┐    │
│  │  DRIVERS (loaded into kernel via `skills:` field)         │    │
│  │                                                           │    │
│  │  archon-code-quality          Type safety, file limits    │    │
│  │  archon-test-sync             Test follows code           │    │
│  │  archon-async-loading         Skeleton, retry, lazy load  │    │
│  │  archon-error-handling        Structured errors           │    │
│  │  archon-handoff               Interface contracts         │    │
│  │  archon-nextjs-ssr  ⟵ conditional, detected by init     │    │
│  │  archon-react-hydration  ⟵ conditional                   │    │
│  └──────────────────────────────────────────────────────────┘    │
│                          ↕ process management                    │
│  ┌──────────────────────────────────────────────────────────┐    │
│  │  SYSTEM CALLS (user-invoked commands)                     │    │
│  │                                                           │    │
│  │  /archon-init      = boot()    Bootstrap + hardware scan  │    │
│  │  /archon-demand    = exec()    Full delivery pipeline     │    │
│  │  /archon-audit     = stat()    Read-only health check     │    │
│  │  /archon-refactor  = defrag()  Progressive restructure    │    │
│  │  /archon-verifier  = fsck()    Independent integrity check│    │
│  └──────────────────────────────────────────────────────────┘    │
│                          ↕ child process spawning                │
│  ┌──────────────────────────────────────────────────────────┐    │
│  │  DAEMONS (internal, never user-invoked)                   │    │
│  │                                                           │    │
│  │  archon-self-auditor   = watchdog   6-dim code audit      │    │
│  │  archon-test-runner    = testd      Test sync + execution │    │
│  └──────────────────────────────────────────────────────────┘    │
│                          ↕ read/write                            │
│  ┌──────────────────────────────────────────────────────────┐    │
│  │  FILESYSTEM (persistent storage)                          │    │
│  │                                                           │    │
│  │  /docs/architecture/    = /usr/src/    Kernel source      │    │
│  │  /docs/guide/           = /usr/share/man/  Man pages      │    │
│  │  /docs/reference/       = /usr/share/info/ Reference      │    │
│  │  /docs/decisions/       = /var/log/    System journal      │    │
│  │  /proposed-rules.md     = /tmp/staging Package staging    │    │
│  │  /todo/debt_radar.md    = /var/spool/  Job queue          │    │
│  └──────────────────────────────────────────────────────────┘    │
│                                                                  │
│  ┌──────────────────────────────────────────────────────────┐    │
│  │  INSTALLER & PACKAGE MANAGER                              │    │
│  │                                                           │    │
│  │  templates/install.sh           = OS installer            │    │
│  │  templates/archon.config.yaml   = Default /etc/           │    │
│  │  templates/constraints/         = Driver packages         │    │
│  │  tests/                         = POST (power-on self-test)│   │
│  └──────────────────────────────────────────────────────────┘    │
└──────────────────────────────────────────────────────────────────┘

Layer-by-Layer Breakdown

1. Kernel — Always Resident

The kernel is always loaded into the AI's context window. It never gets paged out. It defines who the agent is, what rules it follows, and where to find everything else.

FileOS EquivalentLoadingPurpose
AGENTS.mdKernel imagealwaysApply: trueIdentity, prime directive, core workflow loop
archon.config.yaml/etc/Read at every commandProject config: language, framework, environment
ai-index.mdPage tableRead by AI to locate filesMaps every document to its purpose and path

Why always resident: Without the kernel, the agent has no identity, no workflow, no constraint awareness. Every other component depends on the kernel being present.

Linux analogy: AGENTS.md is /boot/vmlinuz — the first thing loaded, the last thing unloaded, the authority that everything else obeys.

2. Drivers — Loaded into Kernel Space

Drivers are constraint skills. They define hard boundaries (❌ prohibitions) and are injected into the agent's context alongside the kernel via the skills: field in agent frontmatter.

FileOS EquivalentLoadingWhen Active
archon-code-qualityStorage driverPreloaded via skills:Every code change
archon-test-syncFS integrity driverPreloaded via skills:Every code change
archon-async-loadingDisplay driverPreloaded via skills:UI component edits
archon-error-handlingNetwork driverPreloaded via skills:API/component edits
archon-handoffIPC driverPreloaded via skills:Cross-boundary changes
archon-nextjs-ssrGPU driver (optional)Deployed if framework detectedNext.js projects only
archon-react-hydrationAudio driver (optional)Deployed if framework detectedReact projects only

Why "drivers": Like hardware drivers, constraint skills translate high-level intent ("write good code") into low-level enforcement ("no any type, no empty catch"). They run in kernel space — the agent cannot ignore them.

Loading mechanism: The skills: field in agent YAML frontmatter is the equivalent of modprobe — it loads drivers into kernel context before the agent starts processing.

yaml
# archon-demand.md frontmatter = kernel module loading
skills:
  - archon-code-quality      # LD_PRELOAD equivalent
  - archon-test-sync
  - archon-async-loading
  - archon-error-handling
  - archon-handoff

3. System Calls — User-Invoked Commands

System calls are the command agents/skills that users invoke directly. Each syscall triggers a well-defined kernel-level operation.

CommandSyscall AnalogyWhat It Does
/archon-initboot()Detect hardware (environment), load drivers (constraints), mount filesystem (config), run POST
/archon-demandexec()Fork a delivery process: implement → audit → fix → evolve → commit
/archon-auditstat()Read-only inspection of project health, scored 0-100
/archon-refactordefrag()Analyze fragmentation (tech debt), plan progressive restructure
/archon-verifierfsck()Independent integrity check — verify claimed work was actually done

Process lifecycle of /archon-demand (the primary syscall):

User: /archon-demand "add dark mode"

  ├── Stage 0: Read refactor plan         (check process environment)
  ├── Stage 1: Implement                  (exec: write code)
  ├── Stage 1.5: Linter verification      (syscall: lint)
  ├── Stage 2: (reserved)
  ├── Stage 3: Self-audit                 (fork: spawn watchdog daemon)
  │   ├── 3.1 Rule scan                   (driver: code-quality)
  │   ├── 3.2 Structure check             (driver: code-quality)
  │   ├── 3.3 Edge cases                  (driver: error-handling)
  │   ├── 3.4 Test sync                   (fork: spawn test daemon)
  │   ├── 3.5 i18n check                  (driver: code-quality)
  │   └── 3.6 Knowledge evolution         (write: proposed-rules.md)
  ├── Stage 4: Fix issues found           (self-heal)
  ├── Stage 5: Final verify               (fork: spawn fsck)
  └── Stage 6: Commit                     (sync: persist to disk)

4. Daemons — Internal Services

Daemons are never invoked by the user. They are spawned by system calls (primarily /archon-demand) as child processes with isolated context.

DaemonOS EquivalentSpawned ByCapability
archon-self-auditorwatchdogddemand Stage 3Read-only 6-dimension code audit
archon-test-runnertestddemand Stage 3.4Test discovery, assertion sync, execution

Why isolated context matters: Like OS daemons that run in their own address space, these agents get their own context window. The audit daemon's internal reasoning (scanning 200 prohibitions across 50 files) doesn't pollute the main process's working memory.

5. Filesystem — Persistent Storage

The filesystem is the documentation hierarchy. It persists across sessions and provides the agent's long-term memory.

PathFS EquivalentPersistencePurpose
docs/architecture//usr/src/PermanentKernel source: how the system works
docs/guide//usr/share/man/PermanentUser manuals: how to use the system
docs/reference//usr/share/info/PermanentReference docs: complete command/skill specs
docs/decisions//var/log/journal/Append-onlySystem journal: why decisions were made (ADRs)
proposed-rules.md/tmp/staging/TransientPackage staging: proposed rules awaiting approval
todo/debt_radar.md/var/spool/TransientJob queue: work items awaiting execution

Mount semantics:

  • docs/architecture/ is read-only for regular tasks — only modified during explicit architecture work
  • docs/decisions/ is append-only — ADRs are never deleted, only superseded
  • proposed-rules.md is read-write — rules flow in from Stage 3.6, flow out to constraint skills after approval
  • todo/debt_radar.md is read-write — items added during EVOLVE step, removed when completed

6. Installer & Package Manager

FileOS EquivalentPurpose
templates/install.shOS installer (Debian installer)Initial deployment of all files to correct paths
templates/archon.config.yamlDefault /etc/Config template, filled during boot
templates/constraints/Driver packages (.deb, .rpm)Framework-specific constraints, installed if needed
tests/POST (Power-On Self-Test)Verify system integrity after install or changes

Memory Model

The AI's context window is RAM. Not everything fits at once. The OS model dictates what stays resident and what gets paged.

┌────────────────────────────────────────────┐
│  ALWAYS RESIDENT (kernel space)            │  ~2% of context
│  AGENTS.md + archon.config.yaml            │
├────────────────────────────────────────────┤
│  PRELOADED (driver space)                  │  ~5% of context
│  Constraint skills via `skills:` field     │
├────────────────────────────────────────────┤
│  ON DEMAND (user space)                    │  ~93% of context
│  Source code, test output, docs lookups,   │
│  git diff, terminal output, etc.           │
└────────────────────────────────────────────┘

Key insight: The kernel + drivers consume ~7% of context. This is the "tax" for governance. The remaining 93% is free for actual work. This is why Archon uses constraint skills (compact prohibitions) instead of verbose guides — every token in kernel space is prime real estate.

Boot Sequence

When /archon-init runs, it follows a boot sequence analogous to a real OS:

1. BIOS/UEFI    → Detect execution environment (Cursor? Claude Code? Codex?)
2. Bootloader   → Read archon.config.yaml (or create if first boot)
3. Kernel load  → AGENTS.md already resident (alwaysApply: true)
4. Hardware scan→ Detect project: language, framework, i18n, state, tests
5. Driver load  → Deploy constraint skills to skills_dir
6. Mount FS     → Verify docs/ structure exists and is consistent
7. Init system  → Start first process (await user's /archon-demand)
8. POST         → Run integrity tests (vitest)

Extended OS Mappings

Beyond the core layers, the OS analogy extends to runtime concepts:

OS ConceptArchon ProtocolPurpose
KernelAGENTS.md + archon.config.yamlAlways resident, non-negotiable law
DriversConstraint skillsHard boundary enforcement, loaded via skills:
Syscalls/archon-init, /archon-demand, etc.User-invoked kernel operations
Daemonsarchon-self-auditor, archon-test-runnerBackground services, isolated context
Filesystemdocs/ hierarchyPersistent storage with mount semantics
IPCarchon-handoff contractsInter-module communication via explicit interfaces
PermissionsImport boundaries in constraint skillsLayer-enforced unidirectional dependencies
Package Managerproposed-rules.md → constraint skillsRules staged, reviewed, then installed as drivers
Audit Traildocs/refactor-reports/Immune memory — what changed and what broke
Health Monitorarchon-audit + archon-verifierReal-time system health detection
Boot Configarchon.config.yamlbenchmarks:Tells the system which modules are reference implementations
Init System/archon-init boot sequenceHardware scan → driver load → FS mount → POST
Process ModelFeature modulesIsolated execution units, explicit interfaces
Memory ManagementContext window budget (~2% kernel, ~5% drivers, ~93% user)What stays resident vs. demand-paged

The Constraint Pyramid

Constraints cascade from four levels simultaneously. They are not redundant — they are complementary:

┌─────────────────────────────────────────────┐
│  Layer 1: Kernel (always resident)          │  AGENTS.md, archon.config.yaml
│  "Who you are and what law you follow"      │  Cannot be bypassed
├─────────────────────────────────────────────┤
│  Layer 2: Drivers (preloaded per command)   │  Constraint skills via `skills:` field
│  "What you must not do"                     │  ❌ prohibitions, hard limits
├─────────────────────────────────────────────┤
│  Layer 3: Syscalls (standard workflows)     │  archon-demand 7-stage pipeline
│  "How you must do it"                       │  Step-by-step, with audit + evolution
├─────────────────────────────────────────────┤
│  Layer 4: Filesystem (reference on demand)  │  Architecture docs, ADRs, refactor reports
│  "Why we do it this way"                    │  Searchable knowledge base
└─────────────────────────────────────────────┘

When these layers act together on a single task:

  • Layer 1 ensures "the agent follows the core workflow" (identity constraint)
  • Layer 2 ensures "the agent doesn't make banned mistakes" (negative constraint)
  • Layer 3 ensures "the agent follows the standard process" (procedural constraint)
  • Layer 4 ensures "the agent understands the context" (cognitive constraint)

The Document Lifecycle

Documents flow through a lifecycle from discovery to permanence:

Discover problem → Temporary fix → Codify as rule → Expand to workflow → Document as reference

                    proposed-rules.md    Constraint skill    Architecture doc
                    "don't do this"      "do it this way"    "why we do it this way"

Each stage increases in permanence and decreases in volatility. The staging area (proposed-rules.md) churns frequently; architecture docs change rarely. This mirrors how OS components have different release cadences — kernel patches are rare and careful, user-space packages update freely.

Why This Model Matters

Without the OS metaphor, the protocol is "a bunch of markdown files." With it:

  1. Loading priority is unambiguous — kernel files are non-negotiable, driver files are critical, filesystem is reference
  2. New contributors instantly understand hierarchy — "is this a kernel change or a filesystem change?"
  3. Context budget is explicit — kernel = always loaded, drivers = preloaded per command, filesystem = on-demand
  4. Evolution path is clear — new constraints are drivers, not kernel patches; new docs are filesystem writes, not kernel recompiles
  5. Constraint cascade is visible — four layers act simultaneously, each covering a different dimension
  6. Document lifecycle is defined — every rule has a clear path from discovery to permanence

Powered by AAEP (AI Architect Evolution Protocol)