> ## Documentation Index
> Fetch the complete documentation index at: https://docs.braingrid.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI

> The power of BrainGrid in your terminal

Manage projects, requirements, and tasks from your terminal.

Common use cases:

* **Fetch a requirement's tasks** - Get the tasks for a requirement for your coding agent to implement.
* **Save agent plans** - Save your coding agent's plans to share and implement later.
* **Refine vague ideas** - Transform rough concepts into clear, actionable requirements with AI assistance.

## Installation

Install the BrainGrid CLI globally using npm:

```bash theme={null}
npm install -g @braingrid/cli
```

## Authentication

Before using the CLI, authenticate with your BrainGrid account:

```bash theme={null}
braingrid login
```

## Quick Start: One-Minute Flow

Get started with BrainGrid in four simple steps:

<Steps>
  <Step title="Initialize">
    Initialize your project with BrainGrid:

    ```bash theme={null}
    braingrid init
    ```
  </Step>

  <Step title="Specify">
    Create a requirement with AI refinement:

    ```bash theme={null}
    braingrid specify --prompt "Add user authentication with OAuth2"
    ```
  </Step>

  <Step title="Build">
    Get complete implementation plan:

    ```bash theme={null}
    braingrid requirement build REQ-1
    ```
  </Step>
</Steps>

<Note>
  The CLI automatically detects your current project from `.braingrid/project.json` and can extract requirement IDs from your git branch names (e.g., `feature/REQ-123-auth`).
</Note>

## AI Coding Integration

BrainGrid CLI integrates seamlessly with AI coding tools:

<CardGroup cols={2}>
  <Card title="Working with Claude Code" icon="robot" href="/claude-code">
    Skills and slash commands for Claude Code.
  </Card>

  <Card title="Working with Cursor" icon="code" href="/cursor">
    Rules and slash commands for Cursor.
  </Card>
</CardGroup>

## Typical Workflow

Here's how BrainGrid CLI fits into your development process:

1. **Capture Ideas** - Use `braingrid specify` to refine vague ideas into structured requirements
2. **Build Features** - Create a git branch and let your AI agent work through tasks
3. **Track Progress** - Update task status with `braingrid task update` as you complete work

## Auto-Detection Features

The CLI includes smart auto-detection to minimize typing:

* **Project Detection** - Automatically finds project from `.braingrid/project.json`
* **Branch-Based Requirements** - Extracts requirement IDs from branch names like `feature/REQ-123-description`
* **Flexible ID Formats** - Accepts `REQ-123`, `req-123`, `123`, or full UUIDs

## Output Formats

Commands support multiple output formats for different use cases:

* **`table`** (default) - Human-readable tables for terminal viewing
* **`json`** - Machine-readable format for scripting and automation
* **`xml`** - Structured data for enterprise integrations
* **`markdown`** - Rich formatted output perfect for AI agents

Use the `--format` flag on any command:

```bash theme={null}
braingrid requirement list --format json
braingrid requirement build REQ-123 --format markdown
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Command Reference" icon="book" href="/cli/commands">
    Explore all available commands and their options
  </Card>

  <Card title="MCP Server" icon="plug" href="/mcp-server/overview">
    Set up BrainGrid as a Model Context Protocol server
  </Card>
</CardGroup>
