Quick Start · Why MeshCtx · Features · API · Contributing
The agent that remembers you — fully local, fully offline, fully auditable.
The problem: your local AI has amnesia. Ollama gives you a great local model — that remembers nothing between chats. Every session starts from zero.
MeshCtx gives it a memory that lives on your disk. Tell it once — "I'm allergic to peanuts", "my report is due every Friday" — and it still knows weeks later. Across restarts. With the network unplugged.
$ meshctx chat You: Remember — allergic to peanuts, prefers morning meetings. MeshCtx: Noted. Stored locally, encrypted at rest. … three weeks later, after a reboot, Wi-Fi off … You: Suggest a lunch spot for the client visit tomorrow. MeshCtx: Three options near their office — all with peanut-free menus. Also, it's a Friday: your weekly report is due. Verified in this repo 🔓 Local-First, Zero Login — runs on your machine. No account, no cloud auth, no phone-home. (Most cloud agents require online verification even for local models.) 📴 Offline-Capable — point MeshCtx at Ollama (ollama:qwen3 / ollama:llama3.3 presets built in) or any OpenAI-compatible local endpoint, and keep working with the network unplugged. 🧠 Cross-Session Memory — retrieval-injected, on-disk local memory (src/chat_tools.py :: _collect_memory_entries). Survives restarts. Never leaves your disk. 🔍 Auditable Releases — every release passes a 3,900+ test gated suite plus a multi-party AI audit with SHA256 evidence per tag. 🌍 11 Languages — full UI i18n, parity-checked dictionaries (1,592 keys × 11 languages). Design philosophy: a cognitive architecture, not a stateless tool Feature Typical Agent MeshCtx Memory Vector store lookup Hippocampal replay + emotional weighting + pattern chunking Planning Single-pass chain Free energy principle + active inference + thalamic gating Self-improvement None Genomic optimizer (genetic algorithm on own parameters) Code modification Static Neural plasticity-inspired self-modifying code at runtime Architecture Flat modules 17 brain regions simulating cortical-subcortical loops MeshCtx treats AI agent design as a neuroscience problem, not just an engineering problem.
For developers: src/core/*.py contains complete interface definitions. Use from src.core.agent_swarm import AgentIdentity for type-safe integration.
Commercial: pip install meshctx-core (private repo, license required) — zero code changes needed.
ollama serve & ollama pull qwen3 # Start MeshCtx, open Model Hub → Add Model → preset `ollama:qwen3` (http://127.0.0.1:11434/v1) # …unplug the network. Chat, memory, tools keep working — 100% on your machine. Windows # Download installer (recommended) # https://github.com/LucyAndLuna2023/meshctx/releases/latest # meshctx-setup.exe — NSIS wizard, 7 languages, one-click install Linux / WSL / macOS curl -fsSL https://raw.githubusercontent.com/LucyAndLuna2023/meshctx/main/install.sh | bash meshctx setup # Configure API keys meshctx start # Start web service (http://localhost:3001) macOS 专用脚本: curl -fsSL .../install-mac.sh | bash。 安装脚本默认英文显示;Windows 安装器 (NSIS) 支持 10 语言: zh/en/ja/ko/fr/de/es/it/ar/he。中文用户可显式切回: MESHCTX_LANG=zh ./install.sh(macOS 同理 MESHCTX_LANG=zh ./install-mac.sh;Windows 同理 set MESHCTX_LANG=zh && install.bat)。
git clone https://github.com/LucyAndLuna2023/meshctx.git cd meshctx && pip install -e . meshctx chat # CLI mode Commands meshctx start # Web service (default http://localhost:3001) meshctx chat # CLI conversation meshctx setup # Configure API keys and models meshctx desktop # Windows desktop client meshctx agent # Multi-step autonomous agent 🧠 Core Features 🧬 GenomicOptimizer (v3.116) 🆕 Genetic algorithm that evolves agent's own parameters: temperature, top_p, prompt style, memory weights.
Traditional AI: Store → Keyword match MeshCtx: Pattern chunking → Emotional weighting → Hippocampal replay → Associative spread Pattern chunking: Compress raw data into meaning patterns (like a chess player recognizing formations) Emotional weighting: CRITICAL memories decay 200x slower than routine Hippocampal replay: Background 5-min cycle consolidates memories + discovers associations Reconsolidation: Each recall updates the memory (core human learning mechanism) Associative spread: Weighted link propagation (smell → scene → person → conversation) Adaptive forgetting: Forget details, keep patterns — forgetting is a feature, not a bug FSRS spaced repetition (phase-1): Per-memory stability/difficulty (D/S/R) state machine schedules every recall at the edge of forgetting — reviews land exactly when retrieval is about to fail, cutting injection tokens while maximizing retention Active recall write-back: Every hit + confirmation rewrites stability and re-schedules the next review (test-effect / retrieval practice theory); forgetful lapses are punished with a stability halving CMA-ES self-tuning (phase-1): Continuous parameters (temperature / top_p / memory weights / FSRS weights) optimized via covariance-matrix-adaptation evolution — replaces blind GA mutation with gradient-free global optimization 🐝 Agent Swarm — Manager-Worker Multi-Agent (v3.34) meshctx start --port 3001 # Manager node # Register worker on another machine curl -X POST http://manager:3001/swarm/register \ -d '{"worker_id":"bot1","name":"Coder","capabilities":["code"]}' # Submit complex task — auto-decompose → dispatch → parallel execute curl -X POST http://manager:3001/swarm/execute \ -d '{"task":"Research best practices + write code + review","type":"research"}' Manager-Worker architecture with network + key-based coordination Auto task decomposition: research/code/analysis/report templates Identity auth: ed25519 + HMAC + 5-min anti-replay Collaboration: Delegate · Vote · Consensus · Ensemble 🌐 Multi-Platform Gateway (v2.39) WeChat Enterprise · Feishu · Telegram · Slack · Discord · WhatsApp
Per day/week/month tracking: sessions · messages · tokens · latency · error rate
Multi-API key rotation: round_robin · least_used · random · auto-exhaustion detection
meshctx/ ├── src/ │ ├── main.py # FastAPI main app │ ├── web_ui.py # Web UI templates │ ├── cli.py # CLI commands │ ├── i18n.py # 10-language i18n │ └── core/ # Core modules │ ├── hybrid_reasoning.py # Free energy reasoning │ ├── observability.py # Span/TraceLogger │ ├── rag_orchestrator.py # RAG + RRF fusion │ ├── terminal_sandbox.py # Security sandbox │ ├── genomic_optimizer.py # Genetic algorithm engine │ ├── memory_v5.py # 4-tier memory injection │ └── ... # 14 modules total ├── tests/ # 3404 tests ├── docs/ # Documentation site └── install.sh # One-click install 🔌 API Chat Endpoint Method Description /api/chat POST Conversation (JSON) /api/chat/stream POST Streaming (SSE) Dual Session (Planner-Executor) Endpoint Method Description /api/dual/plan POST Planner planning /api/dual/execute POST Executor execution /api/dual/stats GET Session stats Memory Endpoint Method Description /api/memory/stats GET Memory diagnostics /api/memory/add POST Add memory /api/memory/search POST Search memories Agent Swarm Endpoint Method Description /swarm/register POST Register worker /swarm/execute POST Submit swarm task /swarm/status GET Swarm status Subagent Endpoint Method Description /api/subagent/run POST Launch isolated subagent /api/subagent/{id}/status GET Query status 🔒 Security Secret scanning: Auto-detect and redact API keys/tokens/PII Hooks interception: Block dangerous commands by default Credential pool: Key rotation prevents exhaustion Approval modes: YOLO / smart / manual three-tier 🌐 Platform Support Platform Install Status Windows NSIS installer (10 languages) ✅ Linux curl|bash script ✅ macOS DMG + Homebrew ✅ WSL Same as Linux ✅ Docker docker-compose ⚠️ WIP 🤝 Contributing We welcome contributions! Here's how:
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
None of the files in this release were uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




