org-agent: The Neurosymbolic Kernel
- The Philosophy
- The Architecture: The Cognitive Loop
- Extensibility: The Org-Native Skill Standard
- Security & Isolation
- Documentation
- Hardware Compartments (Deployment)
- Installation & Setup Guide
- Current State: Phase 3 (The Self-Editing Kernel) Achieved
A hyper-minimalist, self-editing, proactive AI agent framework. `org-agent` acts as the "executive soul" of a personal OS, using Org-mode as its native memory and Common Lisp as its deterministic reasoning engine.
The Philosophy
Mandate 1: Strictly Org-mode and Common Lisp
The system is built on a "No Legacy" policy. Markdown (.md) and JSON are strictly prohibited for internal system logic, planning, and memory. Org-mode is the native Abstract Syntax Tree (AST) for both human and machine, and Common Lisp (SBCL) is the deterministic reasoning engine.
Mandate 2: Minimalist Core, Skill-Based Extension
The `org-agent` kernel (the Daemon) MUST remain a minimalist microkernel. It handles only the cognitive loop, the persistent Object-Store, and the communication protocol. All business logic, LLM provider connectors, and task-management rules MUST be implemented as hot-reloadable Skills living in the user's Memex.
Why Org-mode? (Homoiconic Memory)
Most agent frameworks rely on a messy combination of Python scripts, JSON states, and Markdown prompts. This breaks the human-agent interface. JSON is for machines; Markdown is for humans.
Org-mode is for both. It provides a rigorous, hierarchical Abstract Syntax Tree (AST) that a machine can navigate deterministically, while remaining a perfectly ergonomic, human-readable text document. In this system, your notes, your tasks, your prompts, and your agent's code all live in the exact same format.
Why Common Lisp? (The Kernel vs. The Actuators)
The `org-agent` kernel is built in Common Lisp to provide a persistent, high-performance background process (SBCL) that maintains a live, threaded Object Store in RAM. It performs heavy neurosymbolic reasoning asynchronously, decoupled from any single user interface.
This architecture treats all interfaces as external Actuators and Sensors:
- Editor Actuator (Emacs): A sensor array that detects file changes and executes structural refactoring.
- Messaging Actuator (Signal/Telegram/Discord): A delivery channel for proactive alerts and human-in-the-loop decisions.
- Web Actuator (Dashboard): A visual telemetry interface for monitoring the live kernel state.
The Architecture: The Cognitive Loop
The core engine is agnostic to both business logic and communication channels. It routes data through a strict four-stage cognitive pipeline:
- Perceive: Sensors (Emacs, Webhooks, CRON) send updates over the Org-Agent Communication Protocol (OACP). The kernel updates its live Object Store.
- Think (System 1): The `neuro.lisp` module queries an LLM (e.g., Gemini, OpenAI, or local models) based on the context, asking for an intuitive, pattern-matched suggestion. It returns an unverified proposed action.
- Decide (System 2): The `symbolic.lisp` module is the absolute gatekeeper. It takes the LLM's proposal and runs it through strict Lisp constraints (e.g., "A parent task cannot be marked DONE if it has active TODO children"). If the logic fails, the LLM is overruled.
- Act: Verified commands are dispatched to the appropriate Actuators (refactoring a buffer, sending a Signal message, or updating a database).
Extensibility: The Org-Native Skill Standard
To keep the core microkernel minimal, all capabilities (API connectors, GTD logic, Atomic Notes (Zettelkasten) memory management) are abstracted into Skills.
Adhering to the Lisp Machine Mandate (Code is Data), a skill is not a Python folder. A skill is a single `.org` file located in the Atomic Notes (Zettelkasten) directory.
The kernel parses these `.org` files at startup, extracts the `#+begin_src lisp` blocks, and hot-loads them into the live system. You can define a System 1 Prompt and a System 2 Verification Rule entirely within your personal notes.
Security & Isolation
Using `eval` on text generated by LLMs or extracted from text files is fundamentally dangerous. `org-agent` implements strict defense-in-depth:
Layer 1: Lisp-Level Sandboxing
- Reader Safety: `*read-eval*` is strictly disabled during AST parsing, completely neutralizing reader macro injection attacks (`#.(uiop:run-program …)`).
- Package Jailing: Every Org-Native skill is dynamically compiled into its own isolated Lisp package (`:org-agent.skills.<name>`). Skills cannot accidentally (or maliciously) overwrite the core System 2 gatekeeper or collide with other skills.
Layer 2: OS-Level Containerization
The entire Common Lisp kernel can be isolated within a "Hardware Compartment" to protect the host OS.
Documentation
Detailed specifications and planning documents are located in the docs/ directory:
- Product Requirements Document (PRD)
- Communication Protocol (OACP)
- Phase 2 Roadmap
- Specialized PRDs for Project Foundry, Org Delivery, LLM Cascade, and more.
Hardware Compartments (Deployment)
`org-agent` supports multiple levels of isolation. Choose the compartment that fits your security and performance needs. See the `deploy/` directory for templates.
1. Bare Metal
Run directly on your host CPU for maximum performance. Best for development.
2. Docker (Standard)
The default containerized experience.
3. LXC / Systemd-nspawn
Lightweight Linux containers with lower overhead than Docker.
4. Virtual Machines (Debian / Fedora)
Strong isolation using Vagrant/VirtualBox. Ensures zero-leakage from the Lisp machine.
5. Functional Deployment (Guix)
Reproducible, declarative environment management.
Installation & Setup Guide
This guide covers the standard distributed deployment: running the `org-agent` daemon on a remote Docker server, connecting to it from your local Emacs instance, and configuring dynamic LLMs (like OpenRouter).
Step 1: Server Setup (Global Docker Compose)
`org-agent` is designed to fit into a professional multi-app Docker environment.
-
Clone the repository on your server:
git clone http://10.10.10.43:3000/amr/memex-amero.git /home/amr/memex -
Configure your Environment (.env): Place your `.env` file in `/docker/compose/` alongside your master `docker-compose.yml`.
# Create /docker/compose/.env with your keys: # OPENROUTER_API_KEY=your_key_here # ORG_AGENT_DAEMON_PORT=9105 # ORG_AGENT_WEB_PORT=8080 # MEMEX_DIR=/memex -
Integrate into Global Compose: Add the following service fragment to your master file at `/docker/compose/docker-compose.yml`:
services: org-agent: build: context: /home/amr/memex/projects/org-agent dockerfile: deploy/docker/Dockerfile container_name: org-agent restart: unless-stopped ports: - "9105:9105" - "8080:8080" volumes: - /docker/memex:/memex env_file: - .env -
Start the Service:
cd /docker/compose docker-compose up -d org-agent
Step 2: Local Emacs Setup (The Actuator)
Your laptop acts as the sensor/actuator array.
-
Load the Emacs Package: Evaluate the `org-agent.el` file in your local Emacs.
(add-to-list 'load-path "/path/to/local/org-agent/src") (require 'org-agent) -
Configure the Connection: Tell Emacs where your Docker server is located.
(setq org-agent-host "10.0.0.5") ;; Replace with your server's IP (setq org-agent-port 9105) - Connect to the Brain: Run the interactive command to establish the OACP socket. `M-x org-agent-connect`
Step 3: Dynamic Model Configuration (Homoiconic Setup)
`org-agent` does not use external JSON config files for its behavior. You configure the agent directly within your Org-mode Memex.
- Open any `.org` file in your Memex (e.g., `settings.org`).
-
Add the following property to define your preferred model:
* Agent Settings :PROPERTIES: :LLM_MODEL_OPENROUTER: google/gemini-pro-1.5 :END: - Save the buffer. The agent instantly detects the change via Emacs, updates its internal Object Store, and routes all future neural thoughts through the selected model.
To see all available models, simply type `@agent list models` in any Org buffer and save.
Current State: Phase 3 (The Self-Editing Kernel) Achieved
- DONE Core Lisp microkernel (Cognitive Loop: Perceive -> Think -> Decide -> Act)
- DONE OACP (Swank/Socket communication protocol) implemented
- DONE Org AST-to-Lisp conversion logic & Object Store integration
- DONE System 2 Safety Gating (The Harness) established
- DONE Org-Native Skill parsing and loading
- DONE Secure Docker containerization
- DONE Skill Graph & Recursive Dependencies (Ars Contexta)
- DONE Multi-Provider LLM Failover Cascade
- DONE Context API (Peripheral Vision)
- DONE Heartbeat Loop (Proactive Awareness)
- DONE Immune System (Autonomous Self-Repair)
- DONE Web Dashboard (Visual Telemetry)
- DONE Org-Native Multi-modal Delivery (Signal/Telegram/Discord)
- DONE Project Foundry (Autonomous Scaffolding & Git Stewardship)
- DONE Strictly Org-mode Mandate (.md purge)