The AI agent that gets smarter and cheaper over time.
Fully open-source. Self-hosted. Every LLM provider. Powered by Bun.
Nexus is an autonomous AI agent that learns from every task. Unlike coding copilots tethered to an IDE or chatbot wrappers around a single API, Nexus uses a dual-process architecture inspired by cognitive science to continuously improve performance and reduce costs over time.
# 1. Clone and install
git clone https://github.com/prathyushnallamothu/nexus.git
cd nexus
bun install
# 2. Run the setup wizard (recommended)
bun run dev setup
# Or configure manually
echo "ANTHROPIC_API_KEY=sk-..." > .env
# 3. Run
bun run devThe setup wizard will guide you through provider selection, API key configuration, model selection, and budget settings.
- Getting Started β Installation and quickstart
- Configuration β Configuration options
- Skills System β How Nexus learns from tasks
- Modes β Create specialized agents
- Memory System β Persistent knowledge base
- Tools β Available tools
- Architecture β System architecture
- CLI Reference β CLI commands
- FAQ β Frequently asked questions
Inspired by Kahneman's "Thinking, Fast and Slow":
- System 1: Fast, automatic skill execution (60-80% cheaper)
- System 2: Slow, deliberate full LLM reasoning
- Router assesses task risk and complexity automatically
Autonomous skill creation and improvement:
- Skill Creation β Learns from task trajectories
- Skill Mutation β Self-mutates on failure
- Wilson Confidence β Statistical skill evaluation
- Auto Retirement β Removes underperforming skills
- Task #1: Full reasoning β $0.15, 3 minutes
- Task #100: Skill match β $0.04, 45 seconds
- Task #1000: Internalized β $0.01, 10 seconds
- Anthropic (Claude)
- OpenAI (GPT)
- Google Gemini
- Ollama (local, free)
- OpenRouter (200+ models)
- Zero SDK dependencies β direct HTTP calls
Drop a .md file in modes/ to create a specialized agent:
- Coding β Software development
- Research β Analysis and investigation
- Code Review β Structured code review
- DevOps β Infrastructure and deployment
- Writing β Content creation
- Prompt firewall (12 injection patterns)
- Permission system (path + tool-level)
- Audit logger (immutable trail)
- Behavioral monitoring (anomaly detection)
- Dynamic supervision (HITL approval)
- Wiki knowledge base with FTS5 search
- Semantic memory with vector embeddings
- Episodic memory for task outcomes
- User modeling (preferences, patterns)
- Cross-session recall
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLI (Interactive REPL Β· Bun Runtime) β
βββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Intelligence Layer β
β βββ System 1/2 Dual-Process Router β
β βββ Skill Store (Wilson Confidence) β
β βββ Experience Learner (Reflect + Evolve) β
β βββ Mode Manager (Zero-Code Specialization) β
β βββ Memory Manager (Wiki + Semantic) β
βββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Governance Layer β
β βββ Permission Guard β
β βββ Policy Engine β
β βββ Approval Queue β
β βββ Budget Store β
β βββ Audit Logger β
β βββ Behavioral Monitor β
βββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Middleware Pipeline β
β βββ Timing Β· Prompt Firewall Β· Budget Enforcer β
β βββ Permission Β· Network Β· Supervision β
β βββ Memory Context Β· Artifact Tracker β
β βββ Tool Compactor Β· Output Scanner Β· Logger β
βββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Agent Core (Tool Dispatch + LLM Loop) β
βββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Provider Abstraction (Zero SDK Dependencies) β
β βββ Anthropic Β· OpenAI Β· Google Β· Ollama β
β βββ OpenRouter β
βββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Runtime Layer β
β βββ MCP Manager Β· Cron Scheduler β
β βββ Sandbox Manager β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
| Variable | Default | Description |
|---|---|---|
NEXUS_MODEL |
anthropic:claude-sonnet-4-20250514 |
Model to use |
NEXUS_BUDGET |
2.0 |
Budget per session in USD |
NEXUS_HOME |
.nexus/ |
Directory for data |
ANTHROPIC_API_KEY |
β | Anthropic API key |
OPENAI_API_KEY |
β | OpenAI API key |
GOOGLE_API_KEY |
β | Google API key |
OPENROUTER_API_KEY |
β | OpenRouter API key |
bun run dev setupInteractive wizard for:
- Provider selection
- API key configuration
- Model selection
- Budget setting
- Skill installation
bun run dev doctorCheck configuration and diagnose issues.
| Command | Description |
|---|---|
/help |
Show available commands |
/clear |
Clear conversation history |
/model |
Show current model |
/skills |
List learned skills |
/modes |
List available modes |
/mode <name> |
Switch to a mode |
/stats |
Show routing & learning stats |
/wiki recall <query> |
Search wiki memory |
/tools |
List available tools |
/exit |
Exit Nexus |
nexus/
βββ packages/
β βββ core/ # Agent loop, middleware, tools, types
β βββ providers/ # Multi-provider LLM abstraction
β βββ intelligence/ # Skills, router, learner, modes
β βββ governance/ # Security, permissions, audit
β βββ protocols/ # MCP, A2A, Agent Cards
β βββ runtime/ # Cron, sandbox, scheduling
βββ apps/
β βββ cli/ # Interactive CLI
β βββ web/ # Web UI (planned)
βββ docs/ # Documentation
βββ modes/ # Zero-code modes
β βββ coding.md
β βββ research.md
β βββ code-review.md
β βββ devops.md
β βββ writing.md
βββ .nexus/ # Runtime data
βββ skills/ # Learned skills
βββ memory/ # Semantic and episodic memory
βββ wiki/ # Persistent knowledge base
βββ audit/ # Audit logs
βββ sessions/ # Session transcripts
βββ cron/ # Scheduled jobs
βββ governance/ # Permissions, approvals, budgets
Contributions are welcome! Please read our contributing guidelines before submitting PRs.
MIT License β see LICENSE for details.
- Inspired by cognitive science (Kahneman's dual-process theory)
- Compatible with agentskills.io format
- Built on Bun for performance
- Uses Model Context Protocol for extensibility
- Documentation
- GitHub Issues
- Discord (coming soon)
- Twitter (coming soon)