Skip to main content

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

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

Metadata

Release files for opencursor 0.0.27

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opencursor 0.0.27
File Size Uploaded Provenance
opencursor-0.0.27.tar.gz 138.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for opencursor 0.0.27
File Interpreter ABI Platform
opencursor-0.0.27-py3-none-any.whl Python 3 none any Details

Total release size: 281.8 kB

Release files / opencursor-0.0.27.tar.gz

Download URL opencursor-0.0.27.tar.gz
Size 138.3 kB
Tags Source
SHA-256 checksum
How to use checksums
5d83400ef3b5acc6977d82280534f0b7dcfc3be1fdacbc7e6768a4376b3ad3fe
BLAKE2b-256 checksum
How to use checksums
f858c835534f735a5f0525a7ffd42a328cba62545a293a0d78329d8963b3e74e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.11.0rc1 Linux/6.8.0-59-generic

Release files / opencursor-0.0.27-py3-none-any.whl

Download URL opencursor-0.0.27-py3-none-any.whl
Size 143.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3c3928cd3d390e62749edf783a9b50babab70507cdcced4780055d0d6a81dd1
BLAKE2b-256 checksum
How to use checksums
b17e7033576f9f0b006197284bba30538a23e4e2f00972f4c091646a13cec8a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.11.0rc1 Linux/6.8.0-59-generic

Security for opencursor 0.0.27

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page