Skip to content

Latest commit

 

History

History
72 lines (52 loc) · 4.93 KB

File metadata and controls

72 lines (52 loc) · 4.93 KB

BrainRouter Development Manual

AGENT INSTRUCTION: This is your primary instruction hub for developing, maintaining, and building the BrainRouter repository. You are the AI engineer building BrainRouter, not a client using its MCP server.

Audience: AI Coding Agents and Developers building BrainRouter.


⚖️ Core Development Rules

  • No MCP Tool Calling for Development: Since we are the ones building BrainRouter, do NOT attempt to invoke mcp_brainrouter_* tools. Instead, perform all tasks locally using file system tools and local terminal commands.
  • Reference the skills/ Folder Directly: To maintain premium engineering workflow discipline, check the skills/ folder directly using filesystem tools (view_file, grep_search). If a task matches a skill (e.g., planning-skill, spec-driven-skill, debugging-and-error-recovery), read its SKILL.md directly and follow its steps.
  • Incremental & Test-Driven: When working on BrainRouter packages, dashboard, CLI, or MCP servers, write/update tests first and run the local test suites to prevent regressions.

📂 Codebase Directory Map

  • skills/: Universal skill workflows and markdown definitions (organized by category: agent, api, codebase, design, devops, lifecycle, memory, qa, ux).
  • brainrouter-cli/: Node.js/TypeScript CLI interface for working with local session memories and skills.
  • brainrouter/: Model Context Protocol (MCP) server implementations and tool definitions — the BrainRouter core (memory engine + tool registry). The recall pipeline lives in src/memory/recall.ts and runs four stages: keyword/vector/filepath retrieval → reranker → optional LLM relevance judge → graph expansion.
  • brainrouter-dashboard/: React/Vite/Next.js dashboard for visualizing cognitive graphs, recall histories, and memory states.
  • packages/: Shared core utility libraries and modules.

🗺️ Scenario Mapping: Developing BrainRouter

When you are assigned a development task in this codebase, look up the scenario below and read the corresponding skill file directly from the filesystem:

🔍 Scenario: Planning & Architecture

Focus: Clarifying ambiguous requirements, creating specs, and defining tasks.

  • planning-skill: Standard planning mode, tracking progress in task.md.
  • spec-driven-skill: Creating specs under brainrouter-docs/specs/ before writing core code.
  • adr-skill: Creating ADRs under brainrouter-docs/decisions/ for major database or routing decisions.

💻 Scenario: Code Implementation & Cleanups

Focus: Writing robust code, refactoring layers, and codebase cleanup.

🧪 Scenario: Testing, Debugging & QA

Focus: Running test runners, browser test cases, and error recovery.

🚀 Scenario: Shipping & Handovers

Focus: Creating changelogs, preparing rollouts, and documenting changes.


⚡ Development Workflow Checklists

Phase 1: Planning

  1. Create a task.md checklist in the workspace to track progress.
  2. If the user request is ambiguous, draft a micro-specification file and get explicit user approval.

Phase 2: Execution

  1. Implement in small, verifiable steps.
  2. Run build scripts (npm run build or equivalent) and local tests after each significant change.
  3. Write test cases for any new functionality added to brainrouter-cli or core packages.

Phase 3: Handover & Walkthrough

  1. Run linting and formatting suites to keep codebase clean.
  2. Record all completed checklist items in task.md.
  3. Generate a structured summary of changes in walkthrough.md for human review.