Skip to main content

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 โšก

Nexus Hero

Showcase 2 Showcase 3
Showcase 4 Showcase 5
Showcase 6 Showcase 7

โœจ 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

  1. Clone the repository:

    git clone https://github.com/datarohit/nexus.git
    cd nexus
    
  2. 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
    
  3. Install dependencies:

    # Using uv (fastest)
    uv pip install -e .
    
    # Or using pip
    pip install -e .
    
  4. Configure environment:

    Copy the example environment file:

    cp .env.example .env
    

    Edit .env with 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 between code, architect, and ask.

  • /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:

  1. Use Ruff for linting.
  2. Use MyPy/Ty for type checking.
  3. 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

agent_nexus_cli-0.1.2.tar.gz (562.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent_nexus_cli-0.1.2-py3-none-any.whl (38.4 kB view details)

Uploaded Python 3

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

Hashes for agent_nexus_cli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f7d958286e9121f758ca95cb195ad53b628fb527d0997a5a94f5a3ea364594f3
MD5 1652bc457fb60954ceea664209224c64
BLAKE2b-256 5ef486e6fa9dc93e117aa2ec9b0e76620fe80b46e63fa6a1f41e3b8ffec0d9ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_nexus_cli-0.1.2.tar.gz:

Publisher: publish.yml on DataRohit/Nexus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agent_nexus_cli-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_nexus_cli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4a921b8f08bbd6a64c0b880e6e032f532364e684430bf90f6a7f0f801fd44639
MD5 bbd960f62ae68291f8a0788c4e9c465b
BLAKE2b-256 52ba61e01bf70dd7b75c24ccbb66b9e953ec01d91404704d4d051cdaf36c30aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_nexus_cli-0.1.2-py3-none-any.whl:

Publisher: publish.yml on DataRohit/Nexus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page