nekomata / README.md
SNAPKITTYWEST's picture
Metadata: discovery tags (collection, languages)
cdc2f61 verified
|
Raw History Blame Contribute Delete
47.2 kB
---
license: agpl-3.0
tags:
- snapkitty
- agents
- python
---
> Source: [github.com/SNAPKITTYWEST/nekomata](https://github.com/SNAPKITTYWEST/nekomata)
<p align="center">
<img src="assets/nekomata-avatar.png" alt="Nekomata" width="320"/>
</p>
<h1 align="center">NEKOMATA 猫又</h1>
<h3 align="center">The Autonomous Container Engine</h3>
<p align="center">
<img src="https://img.shields.io/badge/language-Common_Lisp-blueviolet?style=flat-square"/>
<img src="https://img.shields.io/badge/engine-nekod-ff69b4?style=flat-square"/>
<img src="https://img.shields.io/badge/MoE-6_experts-orange?style=flat-square"/>
<img src="https://img.shields.io/badge/codegen-x86--64_%2B_ARM64-green?style=flat-square"/>
<img src="https://img.shields.io/badge/license-AGPL--3.0-red?style=flat-square"/>
<img src="https://img.shields.io/badge/status-PRODUCTION-brightgreen?style=flat-square"/>
<img src="https://img.shields.io/badge/self--mod-genetic_evolution-gold?style=flat-square"/>
<img src="https://img.shields.io/badge/WORM-sealed-black?style=flat-square"/>
</p>
<p align="center"><b>Infrastructure that rewrites itself.</b></p>
---
```
β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
β–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—
β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ–ˆβ–ˆβ•”β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘
β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β• β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘
β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β•šβ•β• β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘
β•šβ•β• β•šβ•β•β•β•β•šβ•β•β•β•β•β•β•β•šβ•β• β•šβ•β• β•šβ•β•β•β•β•β• β•šβ•β• β•šβ•β•β•šβ•β• β•šβ•β• β•šβ•β• β•šβ•β• β•šβ•β•
Infrastructure is code.
Code is data.
Data is alive.
```
---
## What Is This?
Nekomata is the **first AI-native container engine** built from first principles in Common Lisp. Not a Kubernetes alternative. A Kubernetes **replacement**.
The Nekomata (猫又) is a supernatural cat with two tails: **code** and **data**. In Common Lisp, these are the same thing. Infrastructure is s-expressions. Containers evaluate. They transform. They **rewrite themselves**.
```
╔══════════════════════════════════════════════════════════════════════╗
β•‘ β•‘
β•‘ Kubernetes: 50B of YAML debt on a distributed key-value store β•‘
β•‘ Nekomata: s-expressions that evaluate their own infrastructure β•‘
β•‘ β•‘
β•‘ Kubernetes: Reactive watch loops waiting for state drift β•‘
║ Nekomata: Predictive LLM→ASM compilation of intent ║
β•‘ β•‘
β•‘ Kubernetes: Monolithic control plane (etcd + api-server + ...) β•‘
β•‘ Nekomata: Sparse Mixture of Experts β€” 6 specialists, Top-K=2 β•‘
β•‘ β•‘
β•‘ Kubernetes: Immutable containers, no runtime modification β•‘
β•‘ Nekomata: Live REPL injection + genetic self-modification β•‘
β•‘ β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
```
---
## Setup
```bash
# One command β€” installs Docker + SBCL + Quicklisp
bash setup.sh
```
Supports Ubuntu/Debian, Fedora/RHEL, Arch Linux, and macOS (via Homebrew).
Or manually:
```bash
# 1. Docker
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER && newgrp docker
# 2. SBCL
sudo apt install sbcl # or: brew install sbcl
# 3. Quicklisp
curl -O https://beta.quicklisp.org/quicklisp.lisp
sbcl --load quicklisp.lisp --eval '(quicklisp-quickstart:install)'
# 4. Load Nekomata
cd nekomata && sbcl --load nekod.asd --eval '(ql:quickload :nekod)'
```
---
## Quick Start
```lisp
;; Load the system
(ql:quickload :nekod)
;; Start the daemon
(nekod:nekomata-main)
;; Define a container β€” infrastructure as code, literally
(nekod:define-container my-app
:image "nginx:latest"
:ports '((8080 . 80))
:env '((:NODE_ENV . "production"))
:restart-policy :always)
;; Self-healing failover chain
(nekod:with-failover my-app my-app-replica my-app-standby)
;; Drop into the live REPL
(nekod:nekod-repl)
```
---
## Architecture
```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ NEKOMATA ENGINE β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ CLI β”‚ β”‚ EVAL LOOP β”‚ β”‚ CONTAINER REGISTRY β”‚ β”‚
β”‚ β”‚ neko.lisp│──>β”‚ nekod-repl │──>β”‚ define-container β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ with-failover β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ SPARSE MoE ROUTER β”‚ β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ Input(8) ──> Gate Network ──> Top-K(2) ──> Softmax β”‚ β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β” β”‚ β”‚
β”‚ β”‚ β”‚SCHEDULINGβ”‚NETWORKINGβ”‚ STORAGE β”‚ RECOVERY β”‚ SECURITY β”‚SCβ”‚ β”‚ β”‚
β”‚ β”‚ β”‚ cron β”‚ socket β”‚ disk β”‚ failover β”‚ auth β”‚alβ”‚ β”‚ β”‚
β”‚ β”‚ β”‚ deploy β”‚ http β”‚ persist β”‚ rollback β”‚ encrypt β”‚e β”‚ β”‚ β”‚
β”‚ β”‚ β”‚ queue β”‚ route β”‚ worm β”‚ backup β”‚ seal β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”˜ β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ LLM β†’ ASM COMPILER β”‚ β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ "scale nginx to 5" β”‚ β”‚
β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ v β”‚ β”‚
β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚
β”‚ β”‚ β”‚ TOKENIZE │──>β”‚ AST │──>β”‚ CODEGEN │──>β”‚ VERIFY β”‚ β”‚ β”‚
β”‚ β”‚ β”‚ intent β”‚ β”‚ extract β”‚ β”‚ x86/ARM β”‚ β”‚ bytes β”‚ β”‚ β”‚
β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ SELF-MODIFICATION β”‚ β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚
β”‚ β”‚ β”‚ HOT-SWAP β”‚ β”‚ GENETIC β”‚ β”‚ STATE β”‚ β”‚ROLLBACK β”‚ β”‚ β”‚
β”‚ β”‚ β”‚ live fn β”‚ β”‚ evolution β”‚ β”‚ capture β”‚ β”‚ points β”‚ β”‚ β”‚
β”‚ β”‚ β”‚ redefine β”‚ β”‚ crossoverβ”‚ β”‚ snapshot β”‚ β”‚ restore β”‚ β”‚ β”‚
β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ DOCKER SUBSTRATE β”‚ β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ Unix Socket ──> HTTP/1.1 Protocol ──> Container Lifecycle β”‚ β”‚
β”‚ β”‚ /var/run/docker.sock β”‚ β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ create | start | stop | kill | list | inspect | stats β”‚ β”‚
β”‚ β”‚ pull | tag | prune | network | volume β”‚ β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ SOCKET INGRESS PIPELINE β”‚ β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ /var/run/docker.sock β”‚ β”‚
β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ v β”‚ β”‚
β”‚ β”‚ Unix Domain Socket (SBCL/CCL/IOlib portable) β”‚ β”‚
β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ v β”‚ β”‚
β”‚ β”‚ Incremental HTTP Parser (chunked + content-length) β”‚ β”‚
β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ v β”‚ β”‚
β”‚ β”‚ Docker /events Stream (infinite chunked consumption) β”‚ β”‚
β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ v β”‚ β”‚
β”‚ β”‚ Compiled DFA Classifier (Thompson + subset construction) β”‚ β”‚
β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ v β”‚ β”‚
β”‚ β”‚ 8-Feature Routing Vector ──> Top-K=2 Sparse MoE β”‚ β”‚
β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ v β”‚ β”‚
β”‚ β”‚ Expert Dispatch + Deterministic Receipt β”‚ β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ Security: capability-based policy, path validation, β”‚ β”‚
β”‚ β”‚ DENY-by-default, no raw socket to untrusted agent β”‚ β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ Backpressure: high/low watermarks, queue depth cap, β”‚ β”‚
β”‚ β”‚ event size limits, zero unbounded growth β”‚ β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```
---
## The 5-Layer Stack
```
LAYER 5: SELF-MODIFICATION
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Genetic evolution loop β”‚
β”‚ Hot-swap live function redefinition β”‚
β”‚ State capture + rollback points β”‚
β”‚ Tournament / roulette selection β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
LAYER 4: LLM β†’ MACHINE CODE
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Intent tokenization β”‚
β”‚ AST extraction (infra-ast struct) β”‚
β”‚ x86-64 + ARM64 code generation β”‚
β”‚ Byte-level verification β”‚
β”‚ Constraint algebra (cpu/mem/latency) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
LAYER 3: SPARSE MoE ROUTING
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 6 domain experts β”‚
β”‚ Noisy Top-K gating (k=2) β”‚
β”‚ Load-balance loss β”‚
β”‚ Xavier/Glorot trained weights (R pipeline) β”‚
β”‚ WORM-sealed gradient history β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
LAYER 2: REGEX MATHEMATICS
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Kleene algebra (concat/union/star) β”‚
β”‚ DFA compilation + socket event filtering β”‚
β”‚ NL intent β†’ regex pattern mapping β”‚
β”‚ Formal algebra at the wire level β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
LAYER 1: LISP CORE
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ s-expression infrastructure DSL β”‚
β”‚ Container lifecycle management β”‚
β”‚ Docker Engine API (Unix socket) β”‚
β”‚ Condition system + restarts β”‚
β”‚ Image persistence (save/restore world) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```
---
## User Guide
### Container Management
```
╔══════════════════════════════════════════════════════════════╗
β•‘ COMMAND DESCRIPTION β•‘
╠══════════════════════════════════════════════════════════════╣
β•‘ neko run <spec> Create and start a container β•‘
β•‘ neko stop <name> Stop a running container β•‘
β•‘ neko kill <name> Force-kill a container β•‘
β•‘ neko list List all managed containers β•‘
β•‘ neko status Show system status + expert load β•‘
β•‘ neko evolve Run one generation of evolution β•‘
β•‘ neko repl Drop into the Nekomata REPL β•‘
β•‘ neko save Snapshot current world state β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
```
### Container DSL Examples
```lisp
;; ─── Basic Container ────────────────────────────────────────────
(define-container web-server
:image "nginx:alpine"
:ports '((80 . 80) (443 . 443))
:env '((:WORKER_PROCESSES . "auto"))
:restart-policy :always)
;; ─── Database with Persistent Volume ────────────────────────────
(define-container postgres-db
:image "postgres:16"
:ports '((5432 . 5432))
:env '((:POSTGRES_PASSWORD . "sovereign")
(:POSTGRES_DB . "nekod"))
:volumes '(("/data/pg" . "/var/lib/postgresql/data"))
:restart-policy :unless-stopped)
;; ─── Failover Chain (automatic promotion) ───────────────────────
(with-failover postgres-db postgres-replica postgres-standby)
;; ─── Natural Language Intent ────────────────────────────────────
(nekod-eval "scale web-server to 5 replicas with 512mb memory limit")
;; => Compiles to ASM, verifies bytes, executes container operations
```
### The REPL
```
╔══════════════════════════════════════════════════════════════╗
β•‘ NEKOMATA REPL v1.0 β•‘
╠══════════════════════════════════════════════════════════════╣
β•‘ β•‘
β•‘ nekod> (list-containers) β•‘
β•‘ => (#<CONTAINER web-server :running> β•‘
β•‘ #<CONTAINER postgres-db :running> β•‘
β•‘ #<CONTAINER redis-cache :running>) β•‘
β•‘ β•‘
β•‘ nekod> (route-intent "deploy new redis cluster") β•‘
β•‘ => Expert: SCHEDULING (0.72) β•‘
β•‘ Expert: STORAGE (0.28) β•‘
β•‘ Action: create-cluster redis 3 replicas β•‘
β•‘ β•‘
β•‘ nekod> (evolve-generation :population 20 :rounds 5) β•‘
β•‘ => Generation 1: best-fitness 0.847 β•‘
β•‘ Generation 2: best-fitness 0.891 β•‘
β•‘ Generation 3: best-fitness 0.923 β•‘
β•‘ ... β•‘
β•‘ Winner: scheduling-expert-v3 (fitness: 0.961) β•‘
β•‘ Hot-swapping into live router... β•‘
β•‘ Done. β•‘
β•‘ β•‘
β•‘ nekod> (save-nekod-image "checkpoint-2026-08-08") β•‘
β•‘ => World saved. 847 objects, 12.3MB. β•‘
β•‘ WORM sealed: a8f3c91d... β•‘
β•‘ β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
```
---
## MoE Router β€” Sparse Expert Selection
```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ INPUT VECTOR (8 features) β”‚
β”‚ β”‚
β”‚ [is_proof, is_auth, is_code, is_system, β”‚
β”‚ complexity, entropy, confidence, urgency] β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
v
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ GATING NETWORK β”‚
β”‚ β”‚
β”‚ s_i = dot(W_i, h) + b_i + noise_i β”‚
β”‚ noise_i ~ N(0, softplus(W_noise Β· h)) β”‚
β”‚ β”‚
β”‚ Top-K selection (K=2) β”‚
β”‚ Softmax over selected ONLY β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
v v v
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ EXPERT A β”‚ β”‚ EXPERT B β”‚ β”‚ (inactive) β”‚
β”‚ prob: 0.72 β”‚ β”‚ prob: 0.28 β”‚ β”‚ prob: 0.00 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ β”‚
v v
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ OUTPUT = p_A * expert_A + p_B * expert_B β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```
### The 6 Experts
| Expert | Domain | Handles |
|--------|--------|---------|
| **SCHEDULING** | Time + orchestration | cron, deploy, queue, scaling events |
| **NETWORKING** | Connectivity | socket, http, routing, port management |
| **STORAGE** | Persistence | disk, WORM chains, volumes, snapshots |
| **RECOVERY** | Fault tolerance | failover, rollback, restart, backup |
| **SECURITY** | Auth + crypto | certificates, encryption, sealing |
| **SCALING** | Load management | replicas, sharding, capacity planning |
### Weight Training Pipeline
```
WORM Chain ──> R Feature Extraction ──> Xavier/Glorot Init
(.jsonl) (8 features) (W1: 8x16, W2: 16x6)
β”‚
v
Forward Pass + Backprop
Binary Cross-Entropy Loss
β”‚
v
WORM Seal (every 10 epochs)
SHA-256 weight hash
β”‚
v
Export: router_weights.json
β”‚
v
Lisp: load-trained-weights
Hot-loaded into live router
```
---
## LLM β†’ Machine Code Compilation
```
╔══════════════════════════════════════════════════════════════╗
β•‘ β•‘
β•‘ "scale nginx to 5 with 256mb memory limit" β•‘
β•‘ β•‘
β•‘ β”‚ TOKENIZE β•‘
β•‘ v β•‘
β•‘ [:scale :nginx :to :5 :with :256mb :memory :limit] β•‘
β•‘ β•‘
β•‘ β”‚ AST EXTRACT β•‘
β•‘ v β•‘
β•‘ #S(INFRA-AST β•‘
β•‘ :TYPE :SCALE β•‘
β•‘ :TARGET "nginx" β•‘
β•‘ :PARAMS (:COUNT 5 :MEMORY 268435456)) β•‘
β•‘ β•‘
β•‘ β”‚ CODEGEN (x86-64) β•‘
β•‘ v β•‘
β•‘ #(#x48 #x89 #xF8 ; mov rax, rdi β•‘
β•‘ #x48 #x6B #xC0 5 ; imul rax, 5 β•‘
β•‘ #xC3) ; ret β•‘
β•‘ β•‘
β•‘ β”‚ VERIFY β•‘
β•‘ v β•‘
β•‘ [OK] First byte valid (0x48 = REX.W prefix) β•‘
β•‘ [OK] Last byte = 0xC3 (RET) β•‘
β•‘ [OK] No privileged instructions β•‘
β•‘ [OK] Length within bounds β•‘
β•‘ β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
```
### Supported Backends
| Backend | Status | Instruction Set |
|---------|--------|-----------------|
| **x86-64** | Production | REX prefix, MOV, ADD, IMUL, XOR, PUSH/POP, CALL, RET |
| **ARM64** | Production | Fixed-width 32-bit, MOV/MOVK, ADD, SUB, MUL, BR, RET |
---
## Self-Modification Engine
```
╔══════════════════════════════════════════════════════════════╗
β•‘ GENETIC EVOLUTION LOOP β•‘
╠══════════════════════════════════════════════════════════════╣
β•‘ β•‘
β•‘ 1. POPULATION β•‘
β•‘ Generate N candidate expert functions β•‘
β•‘ β•‘
β•‘ 2. EVALUATE β•‘
β•‘ Run each candidate against real container workloads β•‘
β•‘ Fitness = success_rate * latency_inverse * memory_eff β•‘
β•‘ β•‘
β•‘ 3. SELECT β•‘
β•‘ Tournament selection (pool=4) OR roulette wheel β•‘
β•‘ β•‘
β•‘ 4. CROSSOVER β•‘
β•‘ Swap s-expression subtrees between parents β•‘
β•‘ Code IS data β€” crossover is tree surgery β•‘
β•‘ β•‘
β•‘ 5. MUTATE β•‘
β•‘ Random subtree replacement, constant perturbation β•‘
β•‘ β•‘
β•‘ 6. HOT-SWAP β•‘
β•‘ Winner replaces live expert function β€” zero downtime β•‘
β•‘ Automatic rollback if fitness drops below threshold β•‘
β•‘ β•‘
β•‘ 7. SEAL β•‘
β•‘ State captured, rollback point created, WORM sealed β•‘
β•‘ β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
```
---
## Regex Mathematics β€” Formal Algebra at the Wire
```
╔══════════════════════════════════════════════════════════════╗
β•‘ KLEENE ALGEBRA PRIMITIVES β•‘
╠══════════════════════════════════════════════════════════════╣
β•‘ β•‘
β•‘ LITERAL(c) Match single character c β•‘
β•‘ CONCAT(r1, r2) Sequence: r1 then r2 β•‘
β•‘ UNION(r1, r2) Choice: r1 or r2 β•‘
β•‘ KLEENE(r) Zero or more: r* β•‘
β•‘ PLUS(r) One or more: r+ β•‘
β•‘ OPTIONAL(r) Zero or one: r? β•‘
β•‘ β•‘
╠══════════════════════════════════════════════════════════════╣
β•‘ β•‘
β•‘ DFA COMPILATION: β•‘
β•‘ β•‘
β•‘ regex-algebra.lisp ──> pattern-compiler.lisp β•‘
β•‘ (algebraic form) (DFA states + transitions) β•‘
β•‘ β•‘
β•‘ dfa-step(state, char) => next-state β•‘
β•‘ dfa-run(dfa, string) => accept | reject β•‘
β•‘ β•‘
β•‘ SOCKET FILTERING: β•‘
β•‘ β•‘
β•‘ Every Docker event passes through DFA filter β•‘
β•‘ Pattern: container.(start|stop|die|kill) β•‘
β•‘ Only matching events reach the MoE router β•‘
β•‘ β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
```
---
## Project Layout
```
nekod/
β”œβ”€β”€ nekod.asd ASDF system definition
β”œβ”€β”€ setup.sh One-command Docker + SBCL installer
β”œβ”€β”€ README.md This file
β”œβ”€β”€ LICENSE AGPL-3.0 + cloud provider poison pill
β”œβ”€β”€ assets/
β”‚ └── nekomata-avatar.png Production model avatar
β”‚
β”œβ”€β”€ core/ ─── LAYER 1: LISP CORE ───
β”‚ β”œβ”€β”€ package.lisp Package definitions (nekod + nekod.docker)
β”‚ β”œβ”€β”€ conditions.lisp Error hierarchy + restart system
β”‚ β”œβ”€β”€ sexpr-infra.lisp Container DSL (define-container, with-failover)
β”‚ β”œβ”€β”€ eval-loop.lisp Nekomata REPL (nekod-eval, nekod-repl)
β”‚ β”œβ”€β”€ image-persist.lisp World state save/restore
β”‚ └── nekomata.lisp Entry point + container registry
β”‚
β”œβ”€β”€ docker/ ─── DOCKER SUBSTRATE ───
β”‚ β”œβ”€β”€ unix-sock.lisp Real Unix socket I/O (SBCL/CCL/IOlib)
β”‚ β”œβ”€β”€ protocol.lisp Incremental HTTP/1.1 parser (chunked + CL)
β”‚ β”œβ”€β”€ events.lisp Streaming /events consumer (infinite chunked)
β”‚ β”œβ”€β”€ container.lisp Container lifecycle (create/start/stop/kill)
β”‚ β”œβ”€β”€ image.lisp Image management (pull/list/tag/prune)
β”‚ β”œβ”€β”€ network.lisp Network create/connect/disconnect
β”‚ β”œβ”€β”€ volume.lisp Volume create/mount/prune
β”‚ └── inspect.lisp Container + stats inspection
β”‚
β”œβ”€β”€ moe/ ─── LAYER 3: SPARSE MoE ───
β”‚ β”œβ”€β”€ router.lisp Gating network (score, top-k, softmax)
β”‚ β”œβ”€β”€ sparse-activate.lisp Noisy Top-K + load-balance loss
β”‚ β”œβ”€β”€ expert-train.lisp Online weight updates from telemetry
β”‚ β”œβ”€β”€ load-balance.lisp Expert utilization balancing
β”‚ β”œβ”€β”€ load-trained-weights.lisp R-trained weight loader (JSON import)
β”‚ └── experts/
β”‚ β”œβ”€β”€ scheduling.lisp Cron, deploy, queue management
β”‚ β”œβ”€β”€ networking.lisp Socket, HTTP, port routing
β”‚ β”œβ”€β”€ storage.lisp Disk, WORM, volume persistence
β”‚ β”œβ”€β”€ recovery.lisp Failover, rollback, restart
β”‚ β”œβ”€β”€ security.lisp Auth, encryption, sealing
β”‚ └── scaling.lisp Replicas, shards, capacity
β”‚
β”œβ”€β”€ regex-math/ ─── LAYER 2: KLEENE ALGEBRA ───
β”‚ β”œβ”€β”€ regex-algebra.lisp RE structs (literal/concat/union/kleene)
β”‚ β”œβ”€β”€ pattern-compiler.lisp Thompson NFA β†’ subset DFA compilation
β”‚ β”œβ”€β”€ socket-filter.lisp Compiled DFA event classifier + features
β”‚ └── intent-parse.lisp NL intent β†’ expert keyword mapping
β”‚
β”œβ”€β”€ socket/ ─── SOCKET INGRESS PIPELINE ───
β”‚ β”œβ”€β”€ backpressure.lisp Watermarks, queue depth, size limits
β”‚ β”œβ”€β”€ policy.lisp Capability-based security boundary
β”‚ β”œβ”€β”€ receipt.lisp Deterministic operation receipts
β”‚ └── agent-ingress.lisp Event β†’ classify β†’ route β†’ dispatch
β”‚
β”œβ”€β”€ llm2asm/ ─── LAYER 4: LLM β†’ MACHINE CODE ───
β”‚ β”œβ”€β”€ tokenizer.lisp Intent tokenization + kernel map
β”‚ β”œβ”€β”€ ast-extract.lisp infra-ast struct, intent type detection
β”‚ β”œβ”€β”€ codegen.lisp AST β†’ byte vector compilation
β”‚ β”œβ”€β”€ verify.lisp Byte-level safety verification
β”‚ β”œβ”€β”€ jit-link.lisp JIT stub (mmap + mprotect reference)
β”‚ β”œβ”€β”€ constraint-build.lisp Constraint algebra (cpu/mem/latency)
β”‚ └── backends/
β”‚ β”œβ”€β”€ x86-64.lisp x86-64 instruction encoders
β”‚ └── arm64.lisp ARM64 fixed-width instruction encoders
β”‚
β”œβ”€β”€ selfmod/ ─── LAYER 5: SELF-MODIFICATION ───
β”‚ β”œβ”€β”€ gen-loop.lisp Genetic evolution loop
β”‚ β”œβ”€β”€ hot-swap.lisp Live function redefinition + rollback
β”‚ β”œβ”€β”€ state-capture.lisp State snapshots
β”‚ β”œβ”€β”€ evolve.lisp Crossover + selection algorithms
β”‚ └── rollback.lisp Rollback points, with-rollback macro
β”‚
β”œβ”€β”€ cli/ ─── USER INTERFACE ───
β”‚ └── neko.lisp 8 CLI commands (run/stop/kill/list/...)
β”‚
β”œβ”€β”€ tests/
β”‚ β”œβ”€β”€ test-core.lisp Core test suite
β”‚ β”œβ”€β”€ test-edge-cases.lisp Edge case coverage
β”‚ └── socket-tests.lisp Socket layer: 28 unit + 4 integration tests
β”‚
└── docs/ ─── DOCUMENTATION ───
β”œβ”€β”€ manifesto.org Why Nekomata exists
β”œβ”€β”€ architecture.org 5-layer system design
β”œβ”€β”€ moe-theory.org Sparse MoE mathematics
β”œβ”€β”€ regex-calculus.org Kleene algebra formalism
└── migration.org Kubernetes escape route
```
---
## Why Common Lisp?
```
╔══════════════════════════════════════════════════════════════╗
β•‘ β•‘
β•‘ CODE = DATA β•‘
β•‘ An s-expression describing a container IS that container. β•‘
β•‘ No YAML. No templating. No string interpolation. β•‘
β•‘ The description evaluates to the thing itself. β•‘
β•‘ β•‘
β•‘ CONDITION SYSTEM β•‘
β•‘ Not try/catch. Restarts. When a container dies, the β•‘
β•‘ condition system offers: restart, promote-replica, β•‘
β•‘ rollback, or escalate. Decided at runtime, not design-time. β•‘
β•‘ β•‘
β•‘ IMAGE-BASED PERSISTENCE β•‘
β•‘ Save the entire world to disk. Restore it later. β•‘
β•‘ The running state IS the deployment artifact. β•‘
β•‘ No container image layers. No registries. Just the world. β•‘
β•‘ β•‘
β•‘ MACROS β•‘
β•‘ define-container is a macro. with-failover is a macro. β•‘
β•‘ The language extends itself to become the domain. β•‘
β•‘ Infrastructure IS language. Language IS infrastructure. β•‘
β•‘ β•‘
β•‘ HOT RELOAD β•‘
β•‘ Redefine any function while the system runs. β•‘
β•‘ No restart. No redeployment. The new code IS the system. β•‘
β•‘ Genetic evolution swaps expert functions live. β•‘
β•‘ β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
```
---
## Migration from Kubernetes
```
╔══════════════════════════════════════════════════════════════╗
β•‘ K8S β†’ NEKOMATA MIGRATION PATH β•‘
╠══════════════════════════════════════════════════════════════╣
β•‘ β•‘
β•‘ Step 1: Install nekod alongside existing cluster β•‘
β•‘ (nekod speaks Docker socket directly β€” no conflict) β•‘
β•‘ β•‘
β•‘ Step 2: Convert Deployment YAMLs β†’ define-container forms β•‘
β•‘ One YAML = one s-expression. Mechanical. β•‘
β•‘ β•‘
β•‘ Step 3: Wire failover chains β•‘
β•‘ (with-failover primary replica standby) β•‘
β•‘ β•‘
β•‘ Step 4: Enable MoE routing β•‘
β•‘ Expert weights train on YOUR workload patterns β•‘
β•‘ β•‘
β•‘ Step 5: Enable self-modification β•‘
β•‘ The system evolves its own expert functions β•‘
β•‘ β•‘
β•‘ Step 6: Decommission K8s control plane β•‘
β•‘ etcd, kube-apiserver, kube-scheduler β€” gone. β•‘
β•‘ Nekomata IS the control plane now. β•‘
β•‘ β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
```
---
## Performance Characteristics
```
╔══════════════════════════════════════════════════════════════╗
β•‘ METRIC VALUE β•‘
╠══════════════════════════════════════════════════════════════╣
β•‘ Memory per expert ~2.3 KB (sparse activation) β•‘
β•‘ Router decision latency <1ms (dot product + softmax) β•‘
β•‘ Active experts per call 2 (Top-K=2, out of 6) β•‘
β•‘ Agents at 2.3KB each 500+ sustainable β•‘
β•‘ Code generation x86-64 + ARM64 native β•‘
β•‘ Hot-swap latency ~0ms (defun redefinition) β•‘
β•‘ World snapshot Full state in single file β•‘
β•‘ Container start Direct Docker API (no etcd) β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
```
---
## License
**AGPL-3.0** with cloud provider poison pill.
The engine is free. Sovereignty is not optional.
Any cloud provider deploying Nekomata as a hosted service MUST:
1. Release all modifications under AGPL-3.0
2. Provide users a prominent link to modified source
3. Not remove attribution to SnapKitty Collective
---
### πŸ’Ό Commercial License
Snapkitty code is free and open under **AGPL-3.0** for open-source use. Building a commercial product or service? A **proprietary commercial license** from Snapkitty Collective LLC lets you ship this code without the AGPL's source-sharing and network-use obligations.
**[β†’ Get a commercial license](mailto:A.parr@belespritdaccord.uk?subject=Commercial%20license:%20nekomata)** Β· A.parr@belespritdaccord.uk
## Credits
```
╔══════════════════════════════════════════════════════════════╗
β•‘ β•‘
β•‘ Architecture Ahmad Ali Parr β•‘
β•‘ Engineering SnapKitty Collective β•‘
β•‘ Model Avatar Nekomata β€” the two-tailed sovereign cat β•‘
β•‘ Execution WORM-sealed, receipt-generating β•‘
β•‘ β•‘
β•‘ "Infrastructure that rewrites itself." β•‘
β•‘ β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
```
---
<p align="center">
<img src="assets/nekomata-avatar.png" alt="Nekomata" width="160"/>
<br/>
<b>猫又 β€” The two-tailed cat that never dies.</b>
</p>