A terminal-based AI coding assistant powered by GPT-4o that can read, write, and manage files in a local project directory through a structured agentic loop.
The agent follows a step-by-step reasoning chain for every user query:
- UNDERSTANDING — Interprets the user's intent
- PROCESSING — Plans the approach
- TOOL — Calls a file system tool if needed
- OUTPUT — Returns the final answer
Each step is a structured JSON object parsed via OpenAI's response_format with Pydantic, ensuring type-safe responses.
MyCursor/
├── src/
│ ├── main.py # Entry point; runs the agentic loop
│ ├── config.py # OpenAI client, file manager, and slow_print setup
│ ├── models.py # Pydantic models for Step and ToolParameter
│ ├── prompt.py # System prompt defining agent behavior and tool rules
│ └── utils/
│ └── CodingTools.py # File system tools (read, write, list, set_project)
├── .env # Stores OPENAI_API_KEY
├── requirements.txt
└── README.md
| Tool | Description |
|---|---|
set_project |
Sets the working project directory |
read_file |
Reads a file from the project directory |
write_file |
Creates or overwrites a file |
list_files |
Recursively lists files and folders |
All file operations are sandboxed to the project directory — paths outside it are rejected.
-
Clone the repo and install dependencies:
pip install -r requirements.txt
-
Add your OpenAI API key to
.env:OPENAI_API_KEY=<your_api_key> -
Run the agent:
cd src python main.py -
Enter your project directory path when prompted, then start chatting.
Enter project directory path: C:/Projects/my-app
You: Create a Flask REST API with a /health endpoint
You: Fix the bug in utils/parser.py
You: Add error handling to all routes in app.py
Type exit or quit to stop the agent.
