agi
CORTEX — a local self-improving AGI with a custom inference server, cognitive loop, System-2 chain-of-thought and self-improvement that writes to disk.
CORTEX — a local self-improving AGI with a custom inference server, cognitive loop, System-2 chain-of-thought and self-improvement that writes to disk.
A local AGI with a custom inference server, a cognitive loop, and self-improvement that actually writes to disk.
Cortex AGI is not a wrapper around OpenAI. It loads weights from this repo:
| file | backend | |---|---| | model/model.gguf | llama.cpp (llama-cpp-python) | | model/model.safetensors | numpy Llama / GPT-2 (Hugging Face) | | model/cortex.safetensors | CortexGPT — always the self-trained checkpoint |
If no GGUF/HF file is present, it boots CortexGPT (a numpy transformer), trains on every conversation, and checkpoints itself to model/cortex.safetensors.
Built-in world knowledge (agi/mind/world.py) is 777+ real articles — periodic table, capitals, states, planets, amino acids, HTTP, programming languages, constellations, and STEM/CS concepts. Retrieval and dream replay use them.
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Interpreter, in order (Windows, Linux, macOS):
2PY2 — portable / embeddable Python (not Python 2). Linux/macOS: env 2PY2=/path/to/python ./run.sh (export 2PY2 is invalid — the name starts with a digit). Windows: set 2PY2=C:\portable\python.exepython.env at the project root — optional. PYTHON=.venv/bin/pythonpython3 / python / .venvThen ./run.sh (Linux/macOS) or run.bat (Windows), or python -m agi. Open the control plane at http://localhost:8000.
Optional GGUF runtime:
pip install llama-cpp-python
Drop model.gguf or Hugging Face model.safetensors into model/ and restart, or POST /api/reload-model. CortexGPT always writes model/cortex.safetensors.
Hard questions run System 2 before speaking:
The chain streams live in the control plane and is attached to every reply. Fast facts (math, time, convert) stay System 1 with a short trace.
Drop an export onto the desk. Cortex AGI parses it, remembers the turns, opens a thread, and trains the neural core on the dialogue.
| export | how | |---|---| | WhatsApp | Settings → Chat → Export chat → .txt or .zip | | ChatGPT | Settings → Data controls → Export → conversations.json | | Claude | conversation JSON download | | Telegram | Export chat history → result.json | | generic | OpenAI messages JSON, ShareGPT, JSONL, CSV |
POST /api/import or the vault tab import chats. Caps: 25MB, 5000 turns. Private URLs stay blocked; this is local-only.
The import tab has a prompt you paste into any other model. It replies with cortex_export JSON. Paste that JSON back. Cortex AGI absorbs it.
GET /api/import/prompt
POST /api/import/json { "text": "{ ... cortex_export ... }" }
Cortex AGI stays the mind. Pick a mouth in the hosts tab to chat through it. Train also uses Ollama / LLMHoster as teachers.
model/cortex.safetensors/v1/chat/completions (or /api/chat). Train: POST /api/create bakes cortex-agi, then distills into CortexGPT/v1/chat/completions. Train: distill into CortexGPT, write data/train.jsonl, POST a fine-tune job if the hoster exposes one| mouth | default | auth | |---|---|---| | local CortexGPT / gguf / safetensors | model/ | none | | Ollama | http://127.0.0.1:11434 | none | | Cortex LLMHoster | http://127.0.0.1:8624 | CORTEX_API_KEY if set | | OpenRouter | https://openrouter.ai/api/v1 only | OPENROUTER_API_KEY |
Pick one in the hosts tab. Keys are stored in data/hosts.json, masked on GET, never logged.
GET /api/hosts
POST /api/hosts { "active": "ollama", "ollama": { "url", "model" } }
POST /api/hosts/probe
POST /api/train { "targets": ["local", "ollama", "hoster"] }
Env: AGI_LLM=ollama|hoster|openrouter|local, AGI_OLLAMA_URL, AGI_HOSTER_URL, OPENROUTER_API_KEY. Ollama and the hoster may be localhost or LAN; OpenRouter is pinned to openrouter.ai over HTTPS.
The mind tab (and settings) can fast-forward this checkout from GitHub. Memory under data/ and trained weights stay. Origin must be github.com/codero-sus/agi. Fast-forward only — dirty or diverged trees are refused. After apply the process restarts (AGI_UPDATE_RESTART=0 to skip).
GET /api/update
POST /api/update/check
POST /api/update { "restart": true }
Say check for updates or update yourself. /update in the composer.
From the repo root:
./updater.sh # macOS / Linux
updater.bat # Windows
Pulls the published branch (override with AGI_UPDATE_REF). Interpreter: 2PY2, else optional python.env, else system Python. Same on Windows (updater.bat, run.bat), Linux, and macOS (updater.sh, run.sh). Fast-forward only; data/ and weights stay. Restart with ./run.sh or run.bat.
Agentic AI here is not a chatbot with plugins. You spawn named agents that are slices of this mind:
create agent Scout — mission: watch the vault tools: vault, note, knowledge
@Scout what did we ingest
run Researcher: photosynthesis
GET/POST /api/agents, POST /api/agents/{name}/runPick an agent in the composer or the crew tab. Right-click to retire one.
Odysseus's headline is agents + compare + cookbook. Those are wrappers. Cortex AGI owns them:
do: — a bounded tool loop (knowledge, vault, memory, math, public URLs). No bash, no MCP, no silent root. The trace is a document that trains the core.compare A and B — one chain, two characterizations, a split. Not five vendor APIs side-by-side.model.gguf / model.safetensors, not a catalogue of 270 downloads.Odysseus is a self-hosted suite: chat wrapping Ollama, a research agent wrapping the web, a document app, email, calendar, 270-model cookbook. Useful. Not an AGI.
Cortex AGI is one mind that does the jobs people actually open Odysseus for:
| Odysseus | Cortex AGI | |---|---| | Wraps Ollama / OpenAI / vLLM | Is the model (model.gguf / model.safetensors / CortexGPT) | | Deep research as a separate agent | System-2 research → cited report → taught back into weights | | Documents as an editor app | Documents the mind owns; they train it | | Tasks / calendar as productivity | Tasks as working memory, spawned from research | | Skills via MCP servers | Skills as Python the AGI writes | | Compare five APIs | Compare hypotheses in one chain | | Cookbook of 270 downloads | One core that grows |
Say research this: photosynthesis, note: …, todo: …. Reports land in docs, next actions in todo, evidence in the live chain.
Open WebUI is a wrapper around someone else's model. Cortex AGI is the model, the mind, and the UI:
.md/.py/.json onto the page; they become knowledgelearn this: Title — body (persists under data/knowledge.json)GET /api/search?q=)forget that …After every turn Cortex AGI:
user name Ada)model/cortex.safetensorsSkills live in skills/ as real Python files the agent can write.
Persistent mind state is under data/ (SQLite + identity + goals + taught articles).
GET / — control-plane UIWS /ws — streaming thoughts + tokens (ping, stop, improve)POST /api/chat — { "message": "..." }GET /api/state — identity, memory, loss, skillsGET /api/history — recent dialogueGET /api/search?q= — memory + knowledgePOST /api/teach — { "title", "body" }POST /api/forget?q= — drop matching factsGET /api/export — transcriptPOST /api/improve — force an improvement cyclePOST /v1/chat/completions — OpenAI-compatibleGET /v1/modelsGET/POST /api/hosts — attach Ollama / LLMHoster / OpenRouter as a mouthPOST /api/hosts/probePOST /api/train — { "targets": ["local","ollama","hoster"] } bake + distillGET /api/update — current SHA vs originPOST /api/update — fast-forward source, then restartuser
→ custom server (FastAPI, gzip, worker-thread think)
→ cognition (understand → recall → plan → act → reflect)
→ numpy memory index / knowledge / tools / skills
→ ModelEngine (GGUF | safetensors | CortexGPT + optional Ollama/Hoster/OpenRouter mouth)
→ background trainer (Adam, dream, debounce checkpoint)A local-first Python agent framework for Cortex LLMHoster — 113 tools behind a real sandbox, hybrid memory, verifiable citations, guardrails, multi-agent teams and a 26-command CLI, with no dependencies beyond the standard library.
A self-training chatbot that improves over time — pure Python + NumPy brain, Flask WebUI, and the CORTEX self-learning loop with episodic memory and goals.
Self-hosted AI workspace that starts in one command — agents, multi-providers and benchmarks; grown out of MyWorkspaceAI.