Skip to content

prathyushnallamothu/nexus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

NEXUS β—†

The AI agent that gets smarter and cheaper over time.

Fully open-source. Self-hosted. Every LLM provider. Powered by Bun.

License: MIT Bun TypeScript

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.

πŸš€ Quick Start

# 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 dev

The setup wizard will guide you through provider selection, API key configuration, model selection, and budget settings.

πŸ“š Documentation

✨ Key Features

System 1/2 Dual-Process Routing

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

Experience Learner

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

Cost Optimization

  • Task #1: Full reasoning β†’ $0.15, 3 minutes
  • Task #100: Skill match β†’ $0.04, 45 seconds
  • Task #1000: Internalized β†’ $0.01, 10 seconds

Multi-Provider Support

  • Anthropic (Claude)
  • OpenAI (GPT)
  • Google Gemini
  • Ollama (local, free)
  • OpenRouter (200+ models)
  • Zero SDK dependencies β€” direct HTTP calls

Zero-Code Modes

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

Enterprise Security

  • Prompt firewall (12 injection patterns)
  • Permission system (path + tool-level)
  • Audit logger (immutable trail)
  • Behavioral monitoring (anomaly detection)
  • Dynamic supervision (HITL approval)

Persistent Memory

  • Wiki knowledge base with FTS5 search
  • Semantic memory with vector embeddings
  • Episodic memory for task outcomes
  • User modeling (preferences, patterns)
  • Cross-session recall

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  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                            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”§ Configuration

Environment Variables

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

Setup Wizard

bun run dev setup

Interactive wizard for:

  • Provider selection
  • API key configuration
  • Model selection
  • Budget setting
  • Skill installation

Doctor Command

bun run dev doctor

Check configuration and diagnose issues.

πŸ“– Slash Commands

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

πŸ“ Project Structure

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

🀝 Contributing

Contributions are welcome! Please read our contributing guidelines before submitting PRs.

πŸ“„ License

MIT License β€” see LICENSE for details.

πŸ™ Acknowledgments

πŸ”— Links

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages