An AI-powered code agent for workspace operations
Project description
OpenCursor
An AI-powered code agent for workspace operations with a rich terminal 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
Core Functionality
- AI-powered code assistance with autonomous and interactive modes
- Rich terminal UI with syntax highlighting and markdown support
- File context management to focus on relevant files
- Repository exploration and visualization
- Web search integration for up-to-date information
- Code editing and terminal command execution capabilities
Agent Modes
- Autonomous Mode: Agent works step-by-step without user interaction
- Interactive Mode: Agent performs one tool call at a time, waiting for user input
- Chat Mode: Direct conversation with the LLM without using tools
Tools
- File Operations: Read, edit, list, search, and delete files
- Code Analysis: Semantic search, grep search, and code usage analysis
- Terminal Operations: Execute terminal commands
- Web Tools: Search the web and fetch webpage content
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:
@filepathto 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
- OpenCursorApp: Main application class that handles the UI and command processing
- CodeAgent: Handles autonomous and interactive modes, manages tool execution
- LLMClient: Interacts with the Ollama API, manages conversation history
- 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.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Project details
Release history Release notifications | RSS feed
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 opencursor-0.0.16.tar.gz.
File metadata
- Download URL: opencursor-0.0.16.tar.gz
- Upload date:
- Size: 47.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.10.12 Linux/6.8.0-59-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c43e0c2c82e0ea32d6bc193dbb11ae44c572242a73f59e89f2f4283a5f33b569
|
|
| MD5 |
2b33a3bb30b6a08a6a3a85e493ce5a1b
|
|
| BLAKE2b-256 |
242e2d3f76b80bf0af8f90d1d911d3d1a4f0bd40234ac4d81c896661a802290b
|
File details
Details for the file opencursor-0.0.16-py3-none-any.whl.
File metadata
- Download URL: opencursor-0.0.16-py3-none-any.whl
- Upload date:
- Size: 52.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.10.12 Linux/6.8.0-59-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
045330a02956b34d1c32290b53bcd219e00743bc35574ba5a5aa3207ccd86146
|
|
| MD5 |
c5897ff6e79d22e6b0fe463e67e257c1
|
|
| BLAKE2b-256 |
65fcd8decc6cf0f97f7d8b8ab1994975c2bc5f3a95d37aa790115f1439db5f2d
|