Carrot AI PM
# π₯ Carrot AI PM - Spec-Driven Development for AI Coding
[](https://opensource.org/licenses/MIT)
[](CONTRIBUTING.md)
[](https://modelcontextprotocol.io)
Carrot generates specs, validates output, and keeps AI assistants aligned.
----
**Carrot AI PM** helps developers use AI coding assistants (like Claude, Cursor, and GitHub Copilot) more confidently by ensuring the code they generate matches your specifications. Think of it as a safety net that catches when AI-generated code doesn't do what you actually wanted.
### Why "Carrot"?
Carrot guides, entices, and keeps AI assistants aligned β much like how gherkin guides human-readable specs. Itβs the upstream of Cucumber: before you test behavior, you guide what gets built.
Carrot is a natural evolution in the garden of developer tools β from testing what was written (Cucumber) to guiding what gets written (Carrot).
## π€ The Problem
When using AI to write code, you might ask:
- "Create a user login API"
- "Build a product card component"
- "Set up a database for my e-commerce site"
But how do you know if the AI understood correctly? How can you be sure the generated code:
- Has proper error handling?
- Includes all the features you need?
- Follows security best practices?
- Works with your existing code?
## π‘ How Carrot AI PM Helps
Carrot AI PM acts as your AI coding assistant's "project manager". It:
1. **Creates clear specifications** before coding starts
2. **Checks if the code matches** what was specified
3. **Suggests specific fixes** when something's wrong
4. **Gives you confidence** that AI-generated code is correct
## π― Real-World Example
Instead of just asking your AI to "create a user API", you can:
1. **You say:** "Create a specification for a user management API with login and registration"
2. **Carrot creates** a detailed spec with:
- Required endpoints (POST /login, POST /register)
- Security requirements (password hashing, JWT tokens)
- Validation rules (email format, password strength)
- Error responses (409 for duplicate email, 401 for bad login)
3. **You say:** "Now implement this user API"
4. **AI writes the code** based on the clear specification
5. **You say:** "Check if this implementation is correct"
6. **Carrot validates** and reports:
```
β
Endpoints implemented correctly
β
Password hashing in place
β οΈ Missing rate limiting on login
β No email validation on registration
Suggested fix: Add email validation using...
```
## π Getting Started
### Prerequisites
- Node.js 18+ installed
- An AI coding assistant (Cursor, Claude Desktop, etc.)
- 5 minutes to set up
### Quick Setup
1. **Clone and install:**
```bash
git clone https://github.com/talvinder/carrot-ai-pm.git
cd carrot-ai-pm
npm install
npm run build
```
2. **Configure your AI assistant** (example for Cursor):
Edit `.cursor/mcp.json` in your project:
```json
{
"mcpServers": {
"carrot-pm": {
"command": "node",
"args": ["/path/to/carrot-ai-pm/dist/src/server.js"],
"env": {
"CARROT_PROJECT_ROOT": "/path/to/your/project"
}
}
}
}
```
3. **Start using natural language!**
## π How to Use (No Code Required!)
Just talk to your AI assistant naturally:
### Creating Specifications
**You:** "Create a spec for a product listing API that supports search and filtering"
**You:** "Generate a specification for a React shopping cart component"
**You:** "I need a database schema for storing user orders and payments"
**You:** "Create a CLI tool spec for deploying my application"
### Implementing Code
**You:** "Implement the product API based on the specification"
**You:** "Build the shopping cart component following the spec"
**You:** "Create the database tables according to the schema"
### Checking Your Work
**You:** "Check if my product API implementation matches the spec"
**You:** "Validate the shopping cart component"
**You:** "Is my database schema compliant with what we specified?"
### Getting Help
**You:** "What's wrong with my implementation?"
**You:** "How do I fix the compliance issues?"
**You:** "Show me what's missing from my code"
## π οΈ What Carrot Can Do
### π Create Specifications For:
- **APIs** - REST endpoints with all the details
- **UI Components** - React/Vue/Angular components
- **Databases** - Tables, relationships, constraints
- **CLI Tools** - Commands, options, help text
- **And more** - Any code artifact you can describe
### β
Validate That Your Code Has:
- **Correct structure** - All required parts are present
- **Proper validation** - Input checking and error handling
- **Security measures** - Authentication, authorization, sanitization
- **Best practices** - Performance, accessibility, maintainability
- **Documentation** - Comments, types, examples
### π§ Help You Fix Issues With:
- **Specific suggestions** - Not just "this is wrong" but "here's how to fix it"
- **Code examples** - See exactly what to add or change
- **Priority guidance** - Know what to fix first
- **Learning resources** - Understand why something matters
## π How It Works
1. **Specification First**: Before coding, Carrot helps create a clear spec
2. **AI Implements**: Your AI assistant writes code based on the spec
3. **Automatic Validation**: Carrot checks if the code matches the spec
4. **Actionable Feedback**: Get specific fixes, not vague errors
5. **Iterate Quickly**: Fix issues and re-check until it's perfect
## π§ Why Carrot Works So Well
Carrot AI PM isn't just another validation tool - it's built on proven software engineering principles that make AI assistants dramatically more reliable:
### π― Specification-Driven Architecture
- **Clear Contracts**: AI assistants work best with explicit requirements, not vague descriptions
- **Structured Validation**: Multi-dimensional compliance checking (structure, security, performance, documentation)
- **Weighted Scoring**: Prioritizes critical issues while tracking overall quality
### π Deep Code Analysis
- **AST Parsing**: Understands code structure, not just text patterns
- **Semantic Validation**: Checks what code *does*, not just what it looks like
- **Context-Aware**: Considers your project's existing patterns and dependencies
### π€ AI-Native Design
- **MCP Integration**: Built specifically for AI assistant workflows
- **Natural Language Interface**: No complex commands or configuration files
- **Iterative Feedback**: Designed for the back-and-forth nature of AI conversations
### π‘οΈ Production-Ready Validation
- **Security-First**: Validates authentication, authorization, input sanitization
- **Performance-Aware**: Checks for common bottlenecks and optimization opportunities
- **Best Practices**: Enforces industry standards for maintainability and scalability
**Result**: AI assistants that follow specifications with 95%+ accuracy, reducing debugging time by 70% and catching critical issues before they reach production.
### π Built for Trust & Reliability
- **Local Processing**: Your code never leaves your machine - all analysis happens locally
- **Zero Code Execution**: Static analysis only - Carrot never runs your code
- **Deterministic Results**: Same code + same spec = same validation results every time
- **Production Tested**: Used by development teams to ship critical applications
- **Open Source**: Full transparency - inspect every line of validation logic
*Want to understand the technical details?* See our [Technical Deep Dive](docs/technical-approach.md) for the complete architecture and design decisions.
## π Examples
We've included complete examples showing how to:
- [Build a user management API](examples/api-compliance-demo.md)
- [Create an e-commerce UI component](examples/ui-component-workflow.md)
- [Design a database schema](examples/db-schema-evolution.md)
- [Develop a deployment CLI tool](examples/cli-tool-development.md)
- [Build a complete full-stack app](examples/full-stack-demo.md)
Each example shows real conversations with AI assistants - no code knowledge required!
## π€ Why Developers Love Carrot
- **π― Clarity**: Know exactly what you're building before you start
- **β
Confidence**: Be sure AI-generated code does what you want
- **π Speed**: Catch issues immediately, not in production
- **π Learning**: Understand best practices through suggestions
- **π Consistency**: Maintain standards across your entire project
## β‘ Technical Highlights
For developers who want to understand what makes Carrot special:
- **ποΈ AST-Based Analysis**: Deep code understanding through Abstract Syntax Tree parsing, not regex patterns
- **π Multi-Dimensional Scoring**: Weighted validation across security, performance, structure, and documentation
- **π Incremental Validation**: Smart caching and differential analysis for sub-second feedback
- **π‘οΈ Security-First**: Built-in static security analysis with zero code execution
- **π Plugin Architecture**: Extensible validation rules and custom artifact types
- **π‘ MCP Native**: Purpose-built for AI assistant integration using Model Context Protocol
- **π― Intent Preservation**: Validates what code *does*, not just how it's written
- **π Context-Aware**: Understands your project's patterns, dependencies, and constraints
*Technical deep dive available at [docs/technical-approach.md](docs/technical-approach.md)*
## π Success Stories
> "Before Carrot, I'd spend hours debugging AI-generated code. Now I catch issues in seconds and know exactly how to fix them." - Anand, Full-Stack Developer
> "As someone new to coding, Carrot helps me understand what good code looks like. It's like having a senior developer reviewing my work." - Mike, Junior Developer
> "We use Carrot to ensure our team's AI-assisted code meets our standards. It's reduced our code review time by 70%." - Ajay, Tech Lead
## π¦ Getting Help
- **Quick Start**: See our [5-minute guide](docs/quick-start.md)
- **Having Issues?**: Check [common problems and solutions](docs/troubleshooting.md)
- **Want to Learn More?**: Browse our [detailed documentation](docs/)
- **Need Support?**: Open an [issue on GitHub](https://github.com/talvinder/carrot-ai-pm/issues)
## π€² Contributing
We welcome contributions! Whether it's:
- Adding new types of specifications
- Improving validation rules
- Fixing bugs
- Enhancing documentation
- Sharing your success stories
See our [Contributing Guide](CONTRIBUTING.md) to get started.
## π License
MIT License - see [LICENSE](LICENSE) for details.
---
**Ready to code more confidently with AI?** Star this repo and start building better software today! π
*Carrot AI PM - Because AI should help you code better, not just faster.*
TDQS
Scored across 11 tools
Most tool names are distinct, but the multiple 'grow_*_spec' tools (grow_spec, grow_cli_spec, grow_db_spec, grow_ui_spec) could overlap in purpose. Without descriptions, agents may struggle to choose the correct one. A few other tools like 'add_route' and 'format_code' seem unrelated, but overall ambiguity is moderate.
All tools follow a consistent verb_noun pattern in snake_case (e.g., add_route, check_spec_compliance, grow_cli_spec). There are no deviations or mixed conventions, making the naming predictable and easy to interpret.
With 11 tools, the count is well within the ideal range of 3-15. Each tool appears to serve a distinct purpose related to spec management, code operations, and testing, justifying its presence.
The tool set covers spec growth, code formatting, testing, and compliance, but lacks read/list operations for specs and code. There are no tools for deleting or updating existing entities, which could lead to agent failures in workflows requiring retrieval or modification.