Nexus Is A CLI-Based AI Coding Agent That Transforms Natural Language Into Efficient, Production-Ready Code!
Project description
Nexus - AI Coding Agent
Nexus is a modern, CLI-based AI coding agent that transforms natural language into efficient, production-ready code.
Powered by LangChain, LangGraph, and LangSmith, Nexus provides a persistent, stateful coding assistant with advanced capabilities like human-in-the-loop approvals, full observability, and the Model Context Protocol (MCP) for extensible tooling.
โก Project Showcase โก
โจ Features
-
๐ Stateful Conversations - Persistent conversation history with SQLite checkpointing.
-
๐ Model Context Protocol (MCP) - Connect external tools using the open standard MCP.
-
๐ ๏ธ Powerful Built-in Tools - File operations, shell commands, and code analysis.
-
๐ค Human-in-the-Loop - Secure approval workflows (
y/n/d) for tool execution. -
๐ก๏ธ Operational Modes - Security-focused CODE, ARCHITECT, and ASK modes.
-
๐ Intelligent Guidance - Context-aware mode switch suggestions and agent-initiated transitions.
-
๐ Production-Ready - Built with modern best practices, type safety, and structured logging.
๐๏ธ Architecture
Nexus is built on a robust stack:
- LangChain - Orchestration and tool integration.
- LangGraph - State machine for reliable agent workflows.
- LangSmith - Observability, tracing, and evaluation.
- MCP (Model Context Protocol) - Standardized connection to external data and tools.
- Rich-Click - Modern, beautiful CLI interface.
- Pydantic - Strict configuration and validation.
- SQLite - Local persistence for conversation threads.
๐ Prerequisites
- Python 3.10+
- OpenAI API key
- (Optional) LangSmith API key for tracing
- (Optional) Docker/Node.js for specific MCP servers
๐ Installation
-
Clone the repository:
git clone https://github.com/datarohit/nexus.git cd nexus
-
Create and activate virtual environment:
# Using uv (recommended) uv venv source .venv/Scripts/activate # Windows (Git Bash) # Or using standard venv python -m venv .venv source .venv/Scripts/activate
-
Install dependencies:
# Using uv (fastest) uv pip install -e . # Or using pip pip install -e .
-
Configure environment:
Copy the example environment file:
cp .env.example .env
Edit
.envwith your keys:OPENAI_API_KEY=sk-... LANGSMITH_API_KEY=ls__... # Optional LANGSMITH_PROJECT=nexus LANGSMITH_TRACING=true
๐ Model Context Protocol (MCP)
Nexus supports the Model Context Protocol, allowing you to easily extend its capabilities with external servers.
Configuration
Create or edit .nexus/mcp_config.json in your project root to define servers.
Example Configuration:
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
},
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "C:/Projects"]
}
}
}
Nexus automatically loads these servers, counts their tools, and injects their descriptions into the agent's system prompt so it knows exactly how to use them.
๐ญ Multi-Mode System
Nexus supports three operational modes to provide structure and safety during complex tasks:
| Mode | Allowed Tools | File Access | Description |
|---|---|---|---|
| CODE | All tools | Unrestricted | Full access for implementation and debugging. |
| ARCHITECT | All tools | .nexus/plans/ |
Restricted mode for project planning and design. |
| ASK | MCP Tools | None | Conversation-only mode for questions and research. |
Nexus defaults to CODE mode. When a restricted action is attempted, Nexus will intelligently suggest a mode switch. The agent can also programmatically request a mode change via the switch_mode tool when it recognizes a shift in task requirements.
๐ป Usage
Interactive Chat
Start the agent in interactive mode:
nexus chat
You will see a dashboard showing the active session, loaded prompts, rules, and connected MCP servers.
Slash Commands: While in chat mode, you can use the following slash commands:
-
/help- Show all available commands. -
/mode <name>- Switch betweencode,architect, andask. -
/config- View configuration and the active operational mode. -
/mcps- List active MCP servers and their tools. -
/about- Show application information.
Command Line Mode
Send a single instruction without entering interactive mode:
nexus chat "Refactor main.py to use async/await"
Thread Management
Maintain context across sessions using thread IDs:
nexus chat --thread-id feature-auth "Add login endpoint"
nexus chat --thread-id feature-auth "Now add logout"
View History
Review past conversations:
nexus history --thread-id feature-auth
Configuration Check
Verify your settings and loaded components:
nexus config
๐๏ธ Project Structure
nexus/
โโโ nexus/
โ โโโ agent/ # Core agent logic
โ โ โโโ graph.py # LangGraph definition & tool loading
โ โ โโโ nodes.py # Agent reasoning & approval nodes
โ โ โโโ state.py # State schema
โ โ โโโ modes.py # Mode definitions & configs
โ โ โโโ restrictions.py # Tool restriction logic
โ โ โโโ approval.py # Interactive approval workflow
โ โ
โ โโโ tools/ # Tool definitions
โ โ โโโ mcp.py # MCP client & configuration handler
โ โ โโโ file_ops.py # Built-in file tools
โ โ โโโ shell.py # Built-in shell tools
โ โ โโโ mode.py # Mode management tools
โ โ
โ โโโ config/ # Configuration
โ โ โโโ settings.py # Pydantic settings
โ โ โโโ prompts.py # System prompts
โ โ
โ โโโ ui/ # Terminal Interface
โ โ โโโ cli.py # CLI entry point & UI components
โ โ โโโ console.py # Rich console instance
โ โ
โ โโโ main.py # App entry point
โ
โโโ .nexus/ # Local config directory
โ โโโ mcp_config.json # MCP server definitions
โ โโโ prompts/ # Custom user prompts
โ
โโโ readme.md # Documentation
โ๏ธ Configuration Variables
| Variable | Description | Default |
|---|---|---|
OPENAI_API_KEY |
OpenAI API key | Required |
OPENAI_BASE_URL |
OpenAI base URL | None |
LANGSMITH_TRACING |
Enable tracing | true |
LOG_LEVEL |
Logging verbosity | INFO |
CHECKPOINT_DB |
SQLite DB path | checkpoints.db |
๐ค Contributing
Contributions are welcome! Please follow the code style guidelines:
- Use Ruff for linting.
- Use MyPy/Ty for type checking.
- Ensure all functions have docstrings.
ruff check .
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- LangChain & LangGraph for the agent framework.
- Anthropic & MCP Team for the Model Context Protocol standard.
- Rich for the terminal UI.
Made with โค๏ธ by Rohit Vilas Ingole
Project details
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 agent_nexus_cli-0.1.2.tar.gz.
File metadata
- Download URL: agent_nexus_cli-0.1.2.tar.gz
- Upload date:
- Size: 562.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7d958286e9121f758ca95cb195ad53b628fb527d0997a5a94f5a3ea364594f3
|
|
| MD5 |
1652bc457fb60954ceea664209224c64
|
|
| BLAKE2b-256 |
5ef486e6fa9dc93e117aa2ec9b0e76620fe80b46e63fa6a1f41e3b8ffec0d9ca
|
Provenance
The following attestation bundles were made for agent_nexus_cli-0.1.2.tar.gz:
Publisher:
publish.yml on DataRohit/Nexus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_nexus_cli-0.1.2.tar.gz -
Subject digest:
f7d958286e9121f758ca95cb195ad53b628fb527d0997a5a94f5a3ea364594f3 - Sigstore transparency entry: 850021591
- Sigstore integration time:
-
Permalink:
DataRohit/Nexus@e29f112ea62003c54da96e86a189dcbcaec66c50 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/DataRohit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e29f112ea62003c54da96e86a189dcbcaec66c50 -
Trigger Event:
push
-
Statement type:
File details
Details for the file agent_nexus_cli-0.1.2-py3-none-any.whl.
File metadata
- Download URL: agent_nexus_cli-0.1.2-py3-none-any.whl
- Upload date:
- Size: 38.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a921b8f08bbd6a64c0b880e6e032f532364e684430bf90f6a7f0f801fd44639
|
|
| MD5 |
bbd960f62ae68291f8a0788c4e9c465b
|
|
| BLAKE2b-256 |
52ba61e01bf70dd7b75c24ccbb66b9e953ec01d91404704d4d051cdaf36c30aa
|
Provenance
The following attestation bundles were made for agent_nexus_cli-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on DataRohit/Nexus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_nexus_cli-0.1.2-py3-none-any.whl -
Subject digest:
4a921b8f08bbd6a64c0b880e6e032f532364e684430bf90f6a7f0f801fd44639 - Sigstore transparency entry: 850021593
- Sigstore integration time:
-
Permalink:
DataRohit/Nexus@e29f112ea62003c54da96e86a189dcbcaec66c50 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/DataRohit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e29f112ea62003c54da96e86a189dcbcaec66c50 -
Trigger Event:
push
-
Statement type: