create-sparc Documentation

repository·main·Indexed 19 days ago

https://github.com/ruvnet/ruv-dev

An agentic toolkit and NPX package (v1.2.5) that implements the SPARC (Specification, Pseudocode, Architecture, Refinement, Completion) methodology for AI-driven development. It provides project scaffolding, specialized Roo Code modes, and a Model Context Protocol (MCP) Wizard to integrate AI agents with external services like Supabase, OpenAI, and AWS. Features include a Cline Rules Bank for modular rule activation and support for AIGI (AI-driven Code Generation) and minimal Roo mode frameworks.

Tokens
60.3K
Snippets
149
Records
277
Agent score
61%

What's inside create-sparc

  1. Practical Applications of the AIGI Framework

    main

    The AIGI Framework is designed for several key software development scenarios:

    • Rapid Prototyping: Generating functional prototypes from high-level specs for fast iteration.
    • Boilerplate Automation: Creating repetitive structures, standard patterns, and project scaffolding.
    • Complex Algorithm Implementation: Translating concepts into efficient code and sophisticated data structures.
    • Cross-language Translation: Converting code between languages while preserving intent and adapting to idioms.
    • Legacy Code Modernization: Refactoring outdated code to modern standards and updating deprecated APIs.
  2. Architect Role responsibilities and components

    main

    The Architect Role is responsible for the structural integrity of a system. The following components and responsibilities define the scope of work:

    Core Responsibilities

    • Designing system architecture and establishing design patterns.
    • Defining component boundaries and interfaces.
    • Creating data flow models.
    • Ensuring scalability, maintainability, and performance.

    Required Architecture Components

    Every architectural design should include:

    • System overview and Technology stack.
    • Component diagrams and Interface definitions.
    • Data flow models.
    • Design patterns.
    • Security considerations and Scalability approach.
  3. Browse available rule categories

    main

    The Cline Rules Bank is organized into several categories to allow for modular rule activation:

    • clients/: Client-specific rule sets (e.g., client-a.md, client-b.md).
    • frameworks/: Framework-specific rules (e.g., react.md, vue.md).
    • project-types/: Standards for specific project types (e.g., api-service.md, frontend-app.md).
    • orchestration/: Role-based rules following the SPARC methodology. This includes roles such as architect-role.md, auto-coder-role.md, debugger-role.md, security-reviewer-role.md, and others.
  4. Technical implementation details of AIGI

    main

    The AIGI Framework is built using the following technology stack:

    • Runtime/Language: Node.js and TypeScript for core infrastructure.
    • Data Storage: Vector Databases for efficient retrieval of code snippets and context.
    • Communication: REST APIs for interacting with AI models and external services.
    • Validation: JSON Schema for structured data validation throughout the pipeline.
    • Version Control: Git integration for tracking changes.
    • Security/Extensibility: MCP (Model Context Protocol) for secure interaction with external resources.
  5. Understand the Create-SPARC package structure

    main

    The create-sparc package is organized into several distinct layers to manage project scaffolding and configuration:

    • bin/: The executable entry point for NPX.
    • src/cli/: The user interface layer that handles command routing, argument parsing, and terminal output formatting.
    • src/core/: The engine of the package, containing the project-generator (workflow orchestration), template-engine (variable replacement and processing), file-manager (filesystem operations and symlinking), and config-manager (schema validation and configuration handling).
    • src/templates/: Contains the source files for base projects, .roo directory resources (rules and modes), and .roomodes configurations.
    • src/utils/: Shared services like logging, error handling, and constants.
    • test/: Contains unit and integration tests.
  6. Key features of create-sparc

    main

    The create-sparc NPX package provides the following capabilities for project scaffolding and management:

    • CLI Interface: Command-line tools for creating and managing SPARC projects.
    • Symlink Management: Specialized handling for .roo folders and .roomode files using symlinks to prevent duplication across projects.
    • Template-Based Generation: Uses templates to generate new project structures.
    • Extensibility: Supports plugins, custom templates, command extensions, hooks, and configuration extensions.
    • Cross-Platform Support: Designed to work on Windows, macOS, and Linux within the Node.js ecosystem.
  7. Project File Structure and Modular Design

    main

    The project follows a modular TypeScript architecture to separate concerns between orchestration, agent logic, memory management, and server hosting:

    • src/orchestrator/: Contains the core loop logic (e.g., Orchestrator.ts).
    • src/agents/: Individual agent implementations (e.g., GeneratorAgent.ts, CriticAgent.ts, ScoringAgent.ts).
    • src/memory/: Wrapper for Mem0 (e.g., MemoryManager.ts).
    • src/server/: Express app and routes (e.g., sseRoute.ts, mcpRoute.ts).
    • src/utils/: Shared utilities like PromptTemplates.ts and EmbedUtil.ts.
    • src/index.ts: Main entry point.
    • src/cli.ts: CLI tool definitions.
  8. What is MCP and how does it integrate with SPARC?

    main

    Model Context Protocol (MCP) acts as a bridge between AI assistants and external services (databases, APIs, cloud resources).

    In a create-sparc project, MCP integration allows your Roo Code assistant to interact directly with services like Supabase, OpenAI, GitHub, AWS, and Firebase. This enables the AI to query databases, deploy applications, and manage infrastructure using natural language.

    Security Model:

    • Uses environment variable references for all sensitive credentials.
    • Implements permission scoping following the principle of least privilege.
    • Ensures no hardcoded secrets exist in configuration files.
  9. What is the SPARC Methodology?

    main
    SPARC (Specification, Planning, Architecture, Realization, Completion) is a software development methodology designed to manage complex projects by breaking them into five distinct, specialized phases. It relies on modularity, specialization of roles, and continuous iteration to ensure quality and clear documentation throughout the development lifecycle.
  10. Directory structure of the Minimal Roo Mode Framework

    main

    The framework relies on a specific directory structure for configuration and rules:

    • .roo/: The core configuration directory.
      • mcp.json: MCP server configuration.
      • rules/: General guidelines (e.g., general_guidelines.md, tool_usage_guidelines.md).
      • rules-code/: Code-specific guidelines (e.g., code_guidelines.md).
      • rules-<mode-slug>/: (Optional) Mode-specific rules.
    • .roomodes: File containing custom mode definitions.
    templates/minimal-roo/
    ├── .roo/                  # Configuration and rules
    │   ├── README.md          # Overview and usage instructions
    │   ├── mcp.json           # MCP server configuration
    │   ├── rules/             # General rules
    │   │   ├── general_guidelines.md
    │   │   ├── tool_usage_guidelines.md
    │   │   └── orchestration_template.md
    │   └── rules-code/        # Code-specific rules
    │       └── code_guidelines.md
    └── .roomodes              # Custom mode definitions
  11. Implement the LS3 Scoring and Orchestrator Loop

    main

    The LS3 layer completes the reflection loop by scoring answers and driving iterative refinement via the Orchestrator.

    Core Components:

    • ScoringAgent: Implements score(prompt: string, answer: string, critique: string): Promise<number>. It prompts the LLM to provide a numerical score (e.g., 0–10) for coherence, correctness, and completeness.
    • Orchestrator Loop: The orchestrator uses the score to decide whether to loop back to the LS1 Generator. If the score is below a defined threshold (e.g., < 8/10), the orchestrator incorporates the critique into a revised prompt and calls the Generator again.

    Loop Control & Optimization:

    • Max Iterations: A configurable limit (e.g., 2 or 3) to prevent infinite loops.
    • Reflection Pruning: The loop should break early if the second iteration's critique is too similar to the first (detected via similarity checks) or if the score does not improve significantly.

    Testing:

    • Unit Test (ScoringAgent): Verify the parsing logic for extracting a number from LLM responses like "7 - The answer misses some details.".
    • Unit Test (Orchestrator): Mock sub-agents to simulate a low-score scenario that requires a second iteration, asserting that the final answer is the improved version.
    // Conceptual Orchestrator loop logic
    async getFinalAnswer(prompt: string) {
      let currentAnswer = await this.generator.generate(prompt);
      for (let i = 0; i < maxIterations; i++) {
        const critique = await this.critic.critique(prompt, currentAnswer);
        const score = await this.scorer.score(prompt, currentAnswer, critique);
        
        if (score >= threshold) break;
        
        // Refine prompt with critique
        currentAnswer = await this.generator.generate(prompt + "\nCritique: " + critique);
      }
      return currentAnswer;
    }
  12. Architect frontend applications with component-based design

    main

    When building frontend applications, follow these architectural principles to ensure scalability and maintainability:

    • Component-based architecture: Break the UI into reusable, independent components.
    • State management: Implement a structured approach to managing application state.
    • Separation of concerns: Keep logic, presentation, and data fetching distinct.
    • Responsive design: Ensure all UI elements adapt to different screen sizes.
    • Routing and navigation: Implement a robust system for handling application routes.