Personal AGI Operating Core
Project description
๐ MONAD
Personal AGI Operating Core
๐จ๐ณ ็ฎไฝไธญๆ (Chinese) โข How It Works โข Installation โข Architecture
MONAD is not a chatbot or a simple tool-matcher. It is a self-learning, objective-driven autonomous rational agent core.
Unlike traditional agents that rely on a predefined, hardcoded set of tools, MONAD acts like a rational entity with basic "instincts". It has no memory and no pre-loaded knowledge of how to perform specific tasks (like checking the weather or searching the web).
Instead, it autonomously learns how to complete your tasks by writing and executing Python code on the fly, and then saving those successful experiences as reusable skills.
๐ง Core Philosophy
- File System as Database: The system itself has no memory of past sessions. It persists all learned information (axioms, environment knowledge, learned skills, user context, and experiences) directly to local Markdown files. No vector databases, no RAG, zero external dependencies.
- Absolute Rationality: MONAD follows a strict reasoning loop (
Analyze โ Self-check โ Learn โ Execute โ Reflect) to accomplish goals logically. - Self-Learning & Self-Evolving: Instead of shipping with 100 tools, MONAD ships with only 4 basic instincts (hands ๐คฒ, voice ๐ฃ๏ธ, eyes ๐๏ธ, dialogue ๐ฌ). It learns everything else by generating code.
- LLM as a Command Executor: The LLM's own training data is disregarded. All factual information must be retrieved from the real world via code execution or web perception.
- Stateless Message Management: Every user request starts with a fresh, clean message context. MONAD doesn't rely on LLM Chat History; instead, it persists vital information via reflection loops. This ensures reasoning purity and prevents hallucination buildup from long conversations.
- Search First, Ask Later: When stuck during execution (errors, missing packages, unfamiliar tools), MONAD's first instinct is to search the web via
web_fetch, never to guess. But if the user's intent is unclear, MONAD asks the user first. In short: unclear query โ ask user; execution problem โ search first. - URL-First Principle: When the user provides a specific URL or domain (e.g., "Analyze kexue.fm"), MONAD must directly access that URL first, not detour through a search engine. Search engines are a fallback, not the default when a target is already known.
- Experience Staging & Hygiene: Experiences don't go directly into long-term memory. New experiences first land in a staging area (
pending.jsonl). Only when the same tag pattern recurs โฅ3 times is the best example promoted to the permanent experience file โ a frequency-based deduplication inspired by how humans consolidate short-term memory into long-term memory. Failed experiences are tagged[FAILED]and never promoted, preventing "experience pollution." - Tag-Based Experience Retrieval: Experiences are tagged during reflection. At reasoning time, MONAD scores each experience by
relevance ร 2 + recency(not semantic embeddings, just keyword overlap + timestamp), picks the top entries, and always includes the 3 most recent as fallback. Simple, fast, zero infrastructure. - Anti-Hallucination Verification: LLMs sometimes claim "I created the skill" without actually writing any files. MONAD defends against this at two levels: (1) Post-Action Verification โ after actions that should create files, the system checks the filesystem and appends verification results to the LLM's observation; (2) Hollow Answer Guard โ if the LLM tries to deliver a final answer claiming creation/saving but never executed a write action, the answer is rejected and the LLM is forced to actually do the work.
- Skill Deduplication (Reuse First): Before creating a new skill, the system prompts the LLM to check existing skills and prefer modifying them. The SkillBuilder module independently evaluates all existing skills and supports three actions:
skip,update(preferred), orcreateโ preventing the skill library from growing duplicate entries.
โก Basic Capabilities ("Instincts")
MONAD comes with only four built-in capabilities:
| Capability | Metaphor | Description |
|---|---|---|
๐ python_exec |
Hands ๐คฒ | Evaluate arbitrary Python code. Process data, call APIs, read/write files, install librariesโlearn to do anything. |
๐ป shell |
Voice ๐ฃ๏ธ | Execute shell commands on the host operating system. |
๐๏ธ web_fetch |
Eyes ๐๏ธ | Perceive the internet directly. Fetch web pages with 3 modes: fast (HTTP), stealth (anti-bot), browser (JS render). Powered by Scrapling. |
๐ ask_user |
Dialogue ๐ฌ | Ask the user for clarification when it truly cannot proceed independently. |
๐ Knowledge Architecture
MONAD uses Categorized Memory instead of semantic retrieval (RAG).
knowledge/
โโโ axioms/ # System axioms & core behavioral principles
โโโ environment/ # World knowledge (e.g., search engine URLs, API endpoints)
โโโ user/ # Categorized user context (No RAG used here)
โ โโโ facts.md # Objective facts & preferences (e.g., prefers Python)
โ โโโ mood.md # Current state & mood
โ โโโ goals.md # Long-term goals & ongoing projects
โโโ skills/ # Reusable Python skills (built-in + auto-generated)
โ โโโ <skill>/
โ โโโ skill.yaml # Metadata: name, goal, inputs, steps, triggers
โ โโโ executor.py # Python implementation with run(**kwargs)
โโโ experiences/ # Two-tier experience memory
โ โโโ pending.jsonl # Short-term: all recent experiences (staging area)
โ โโโ accumulated_experiences.md # Long-term: promoted high-frequency patterns
โโโ protocols/ # Error handling protocols
โโโ tools/ # Documentation for the 4 basic capabilities
โ๏ธ How It Works
When you give MONAD an objective (e.g., "What is the weather in Hangzhou today?"):
- Analyze & Self-Check: Understand intent and check the local knowledge base for existing skills.
- Learn & Research (The "Search First" Principle): If the task is unknown or an error occurs, MONAD uses
web_fetchto research documentation, API usage, or solutions. This is the "Learning" phase where it acquires the "how-to" knowledge before acting. - Execute & Observe: MONAD writes and executes Python code or shell commands via
python_exec. It treats the output as "Observations" to verify success or identify new obstacles. - Reflect & Persist: After a successful execution, the
Reflectionmodule summarizes the experience with tags. TheSkillBuilderevaluates if the logic should be abstracted into a permanent skill โ checking existing skills first to avoid duplication. - Verify & Answer: Before delivering the final answer, the system verifies that claimed actions actually happened (files exist, skills were written). The answer is based on real-world data verified through execution.
๐ก Deep Dive: Why Stateless?
MONAD intentionally discards traditional "Chat History" in favor of a Stateless Design, where every task starts with a clean context and persists only vital information via the file system.
- Mitigating Hallucination: Long-running chat histories eventually lead to context pollution and attention decay. By resetting the context per task, we force the LLM to reason in a pure, noise-free environment.
- Physical Memory: Unlike black-box model caches, MONAD's memory consists of human-readable Markdown files. This is a deliberate step towards Personal Data Sovereignty.
- Task Atomicity: Every objective becomes an independent, reproducible unit of execution.
- The Future of Agents: We believe the evolution of Agents will shift from "simulating conversation" to "simulating rational execution." Maintaining a living "State Whiteboard" via reflection loops is far more aligned with the essence of AGI than endlessly stacking chat logs.
๐ Installation
1. Install via pip (Recommended)
pip install monad-core
Alternatively, install from source:
git clone https://github.com/hscspring/Monad.git
cd Monad
pip install -e .
2. Configure your LLM
On your first run, MONAD will initialize its workspace in ~/.monad/. Update ~/.monad/.env with your LLM Base URL, API Key, and Model name.
Note: If you don't configure this manually, MONAD will guide you through an interactive setup with connectivity validation on your first launch.
๐ป Usage
Once installed, you can start the MONAD agent from any directory in your terminal.
Start Web UI (Default)
Launch the modern browser-based interface:
monad
Interactive Terminal Mode (Classic)
Start the continuous ReAct agent loop in the CLI:
monad --cli
Feishu (Lark) Bot Mode
- Follow the first two steps in the Feishu Bot Guide to create a bot and obtain your
APP_IDandAPP_SECRET. - Connect MONAD to your Feishu bot via WebSocket:
APP_ID=xxx APP_SECRET=yyy monad --feishu
Note: Requires
pip install monad-core[feishu]for thelark-oapidependency.
Self-Test
Verify all modules load correctly and the LLM connection is functioning:
monad --test
Unit Tests
Run the test suite for all tools:
python -m pytest tests/ -v
Built with pure rational reasoning ๐ก
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file monad_core-0.3.1.tar.gz.
File metadata
- Download URL: monad_core-0.3.1.tar.gz
- Upload date:
- Size: 82.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
baeb7ce7909548fd6c6511c98c50fd609b63cceed76934832370c47a53f90c59
|
|
| MD5 |
f3cdb4ef69bca14990490bdeb4a088d2
|
|
| BLAKE2b-256 |
0872e3fecb580caa5856183a5a6116288998126d1add73b20d7fe8ceb7e4bada
|
File details
Details for the file monad_core-0.3.1-py3-none-any.whl.
File metadata
- Download URL: monad_core-0.3.1-py3-none-any.whl
- Upload date:
- Size: 84.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5dc3d6111a539b54089a7813c89a5cf44fb5e87b6c6eb7a499dd62a442497e78
|
|
| MD5 |
a912f20bf3fb62c9b4ba50004e3fa442
|
|
| BLAKE2b-256 |
75a1a9262ad5e0850cd154007a1dde6f45502a3a32b0971b0cf721eac43c98be
|