Skip to main content

An AI-powered code agent for workspace operations

Project description

OpenCursor

An AI-powered code agent for workspace operations with a rich terminal UI.

UI

Overview

OpenCursor is a terminal-based AI coding assistant that helps you navigate, understand, and modify codebases. It provides both autonomous and interactive agent modes, along with direct LLM chat capabilities. The tool uses a variety of AI-powered features to help you work with code more efficiently.

Features

๐Ÿค– Local LLM Support - Works with Ollama models locally

๐Ÿ”„ Autonomous Mode - Complete tasks without intervention

๐ŸŒ Playwright Web Search - No API limits or blocking

๐Ÿ“ Full Editor Toolkit - Search, edit, delete files & run commands

๐Ÿ” Transparent UI - See exactly what the model is doing

Example Queries

  • "Create a simple Flask API with user authentication"
  • "Refactor this React component to use hooks instead of classes"
  • "Find all usages of this function and update its parameters"
  • "Analyze this codebase and explain its architecture"
  • "Debug why this test is failing and propose a fix"
  • "Research and implement the latest best practices for API security"

Installation

Using pip (recommended)

pip install -U opencursor

Using Poetry

# Clone the repository
git clone https://github.com/santhoshkammari/OpenCursor.git
cd OpenCursor

# Install with Poetry
poetry install

Usage

Once installed, you can use OpenCursor from the command line:

# Basic usage
opencursor

# Specify a workspace directory
opencursor -w /path/to/workspace

# Use a different model
opencursor -m "gpt-4"

# Start with an initial query
opencursor -q "Create a simple Flask app"

Command-line Options

  • -w, --workspace: Path to the workspace directory (default: current directory)
  • -q, --query: Initial query to process
  • -m, --model: LLM model to use (default: qwen3_14b_q6k:latest)
  • -H, --host: Ollama API host URL (default: http://192.168.170.76:11434)
  • --no-thinking: Disable thinking process in responses

Commands

OpenCursor provides several commands that you can use within the application:

  • /agent <message>: Send a message to the agent (autonomous mode)
  • /interactive <message>: Send a message to the agent (interactive mode)
  • /chat <message>: Chat with the LLM directly (no tools)
  • /add <filepath>: Add a file to the chat context
  • /drop <filepath>: Remove a file from the chat context
  • /clear: Clear all files from the chat context
  • /repomap: Show a map of the repository
  • /focus <filepath>: Focus on a specific file
  • /diff <filepath>: Show git diff for a file with syntax highlighting
  • /help: Show help information
  • /exit: Exit the application

You can also use shortcuts:

  • @filepath to quickly add a file to the context

Development

Project Structure

opencursor/
โ”œโ”€โ”€ code_agent/
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ app.py         # Main application with UI
โ”‚   โ”‚   โ”œโ”€โ”€ agent.py       # Agent implementation
โ”‚   โ”‚   โ”œโ”€โ”€ llm.py         # LLM client
โ”‚   โ”‚   โ”œโ”€โ”€ tools.py       # Tool implementations
โ”‚   โ”‚   โ”œโ”€โ”€ prompts.py     # System prompts
โ”‚   โ”‚   โ”œโ”€โ”€ tool_playwright.py  # Web search tools
โ”‚   โ”‚   โ””โ”€โ”€ tool_browser.py     # Browser tools
โ”‚   โ”œโ”€โ”€ cli_entry.py       # CLI entry point
โ”‚   โ””โ”€โ”€ __init__.py
โ”œโ”€โ”€ pyproject.toml         # Poetry configuration
โ”œโ”€โ”€ requirements.txt       # Dependencies
โ””โ”€โ”€ README.md

Core Components

  1. OpenCursorApp: Main application class that handles the UI and command processing
  2. CodeAgent: Handles autonomous and interactive modes, manages tool execution
  3. LLMClient: Interacts with the Ollama API, manages conversation history
  4. Tools: Implements various tools for file operations, code analysis, etc.

Setting Up Development Environment

# Clone the repository
git clone https://github.com/santhoshkammari/OpenCursor.git
cd OpenCursor

# Install dependencies
pip install -e .
# or with poetry
poetry install

# Run the application
python -m code_agent.cli_entry

Dependencies

  • Python 3.11+
  • Rich: Terminal UI and formatting
  • Ollama: LLM API client
  • Prompt_toolkit: Command completion and input handling
  • Playwright: Web search functionality
  • SentenceTransformer: Semantic code search

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

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

opencursor-0.0.24.tar.gz (138.1 kB view details)

Uploaded Source

Built Distribution

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

opencursor-0.0.24-py3-none-any.whl (143.2 kB view details)

Uploaded Python 3

File details

Details for the file opencursor-0.0.24.tar.gz.

File metadata

  • Download URL: opencursor-0.0.24.tar.gz
  • Upload date:
  • Size: 138.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.0rc1 Linux/6.8.0-59-generic

File hashes

Hashes for opencursor-0.0.24.tar.gz
Algorithm Hash digest
SHA256 bee80a5f2c9330d79222707cdac586b8174624ac154167adf1d2ccc7c920770c
MD5 6d6deec9cf1ea010cfb6d8d9670cccfc
BLAKE2b-256 a7f520a82171c5f93942293929ec2b6f8c011464de6a3f745d92ba41973ff558

See more details on using hashes here.

File details

Details for the file opencursor-0.0.24-py3-none-any.whl.

File metadata

  • Download URL: opencursor-0.0.24-py3-none-any.whl
  • Upload date:
  • Size: 143.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.0rc1 Linux/6.8.0-59-generic

File hashes

Hashes for opencursor-0.0.24-py3-none-any.whl
Algorithm Hash digest
SHA256 31a463be3765b5d360ff3bd624f9081a06c62d18e47becc880305317b28ae09e
MD5 165633440805759e55166f5c800ed950
BLAKE2b-256 6b621022df483b9983330a89815a9e5b9ee3fd0014b8a636cb91e806bdcd2505

See more details on using hashes here.

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