A practical approach to managing multiple AI agents in large codebases by enforcing strict file-tree partitioning. Inspired by cursor-boost.
This tool addresses a critical challenge in AI-assisted development: preventing merge conflicts and maintaining codebase coherence when using AI assistance across different parts of your codebase. It does this by:
- Partitioning the codebase into logical domains (e.g., frontend, API, database)
- Generating domain-specific markdown files with explicit file-tree boundaries
- Providing clear context and access rules for AI assistants through these markdown files
When working with AI assistance across different parts of a codebase:
- AI responses might modify files outside their intended domain
- Changes in one area can cascade into unintended modifications elsewhere
- Maintaining proper context becomes increasingly difficult as the codebase grows
- Clone the repository:
git clone https://github.com/yourusername/agentic-cursorrules.git .agentic-cursorrules
cd .agentic-cursorrules
- Create and activate a virtual environment:
python -m venv venv
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
- Set up your
.cursorrules
file ()):
# Add your favorite .cursorrules file
cp .cursorrules.example ../.cursorrules
Important note: The .cursorrules
file needs to be in your current working directory where you'll run the agent generator.
If there's already a .cursorrules
file available in the root folder, it will be used instead of the current directory files.
- A project with distinct architectural boundaries
- Clear domain separation (e.g., frontend/backend/database)
- Use
CMD/CTRL + Shift + P
to open the command palette - Search for "Duplicate as Workspace in New Window"
- Repeat this process for each desired agent window
- Arrange the windows according to your preferred layout
- Generate domain-specific markdown files using the tool
- When working with an AI assistant:
- Reference the appropriate markdown file for the domain you're working in
- Use
@domain_name.md
to provide context to the AI - Keep the AI focused on files within the specified domain
- Empirically tested to work well with up to 4 concurrent agents
- Consider system resources when running multiple instances
- Organize windows logically based on domain responsibilities
- Configure your domains in
config.yaml
:
project_title: "agentic-cursorrules"
tree_focus:
- "src" # Frontend logic
- "api" # Backend services
- "db" # Database layer
- Run the generator:
python main.py
If you want to run it every minute, use --recurring
flag:
python main.py --recurring
- Use the generated agent files in your prompts:
agentic-cursorrules_agent_src.md # Frontend-focused agent
agentic-cursorrules_agent_api.md # Backend-focused agent
agentic-cursorrules_agent_db.md # Database-focused agent
- Reference these files in your agent windows:
- Use
@agentic-cursorrules_agent_src.md
in the frontend agent window - Use
@agentic-cursorrules_agent_api.md
in the backend agent window - Use
@agentic-cursorrules_agent_db.md
in the database agent window
- Use
This @ reference system ensures each agent stays within its designated boundaries, preventing conflicting file edits across domains!
- Use one markdown file per domain
- Reference the appropriate markdown file when switching domains
- Keep domain boundaries clear and well-defined
The tool comes with sensible defaults for web development projects, tailor it as you like:
# Important directories that should always be included
important_dirs:
- components
- pages
- app
# ... and more common directories
# Directories that should always be excluded
exclude_dirs:
- node_modules
- dist
- build
# ... and more build/dependency directories
# File extensions to include
include_extensions:
- .py
- .ts
- .tsx
# ... and a lot more file types
-
Codebase Partitioning
- Defines clear boundaries through YAML configuration
- Generates separate file-trees for each domain
- Creates agent-specific markdown files containing:
- Base cursor rules
- Domain-specific file access rules
- Relevant file-tree context
-
Access Control
- Each agent receives only the file-tree information for its assigned domain
- Explicit instructions to operate only within defined boundaries
- Clear documentation of domain responsibilities
-
Conflict Prevention
- Physical separation of concerns through file-tree partitioning
- Clear ownership boundaries for each agent
- Reduced risk of overlapping modifications
- Limit to 3-4 agents for optimal management
- Define clear domain boundaries before starting
- Use semantic naming for domains
- Review agent interactions at domain boundaries
- Maintain separate version control branches per domain when possible
- Not a complete solution for all merge conflicts
- Requires careful domain boundary definition
- Best suited for codebases with clear architectural separation
- May need adjustment for highly interconnected modules
Contributions are welcome!
Agentic Cursor Rules: A practical implementation for managing multi-agent development through strict file-tree partitioning and access control.
Technical Overview:
- Generates domain-specific agent rulesets from base cursor rules
- Enforces physical separation of concerns through file-tree partitioning
- Prevents merge conflicts through explicit boundary definition
- Scales effectively up to 4 concurrent agents
- Supports custom domain definition via YAML configuration
- Generates markdown-based agent instruction sets
- Includes file-tree context for domain awareness
Primary Use Case:
Managing concurrent AI agent operations in large codebases where traditional merge resolution becomes impractical. Particularly effective for projects with clear architectural boundaries (e.g., frontend/backend separation, microservices).
Key Differentiator:
Unlike simple multi-agent approaches, this tool enforces physical boundaries through file-tree partitioning, significantly reducing the risk of conflicting modifications while maintaining agent context awareness.