Skip to content

ankit5054/MyCursor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MyCursor — AI Coding Agent

Architecture Diagram

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.

How It Works

The agent follows a step-by-step reasoning chain for every user query:

  1. UNDERSTANDING — Interprets the user's intent
  2. PROCESSING — Plans the approach
  3. TOOL — Calls a file system tool if needed
  4. OUTPUT — Returns the final answer

Each step is a structured JSON object parsed via OpenAI's response_format with Pydantic, ensuring type-safe responses.

Project Structure

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

Available Tools

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.

Setup

  1. Clone the repo and install dependencies:

    pip install -r requirements.txt
  2. Add your OpenAI API key to .env:

    OPENAI_API_KEY=<your_api_key>
    
  3. Run the agent:

    cd src
    python main.py
  4. Enter your project directory path when prompted, then start chatting.

Example Usage

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages