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

# AI Chat & Codebase Memory

Blame’s **AI Chat** combines GraphRAG code retrieval with persistent **Workspace Memory** and active **GitHub Tool Execution**.

Rather than acting as a passive question-and-answer box, Blame's conversational agent can navigate multi-repository codebases, discover project-specific architectural rules, inspect live pull requests, and commit fixes directly back to GitHub branches.

***

## Multi-Repository Intelligence

In modern engineering organizations, features and microservices span multiple repositories. Blame allows developers to query across several codebases simultaneously in a single conversation thread.

```mermaid theme={null}
graph TD
    User([Developer Query]) --> ChatAgent[Blame LangGraph Agent]

    subgraph Multi-Repo Graph Retrieval
        ChatAgent --> RepoA[Frontend: njs_frontend]
        ChatAgent --> RepoB[Backend API: backend_service]
        ChatAgent --> RepoC[Contracts: shared_types]
    end

    subgraph Context Assembly
        RepoA --> Hybrid[pgvector + Voyage Rerank-3]
        RepoB --> Hybrid
        RepoC --> Hybrid

        Memory[(Workspace & Repository Memory)] --> Context[Unified Prompt Context]
        Hybrid --> Context
    end

    subgraph Actions & Generation
        Context --> LLM[Chat Model]
        LLM --> Stream[Stream Response to Web UI]
        LLM --> ToolUse[Execute GitHub Tools: PRs, Branches, Commits]
    end
```

### How Cross-Repo Queries Work

1. **Multi-Repo Selection:** Select one connected repository in the chat header.
2. **Parallel AST Search:** The query is embedded and dispatched across the repository's Tree-sitter vector index.
3. **Cross-Encoder Reranking:** Candidate code chunks across the selected repository are re-ranked using Voyage AI `rerank-3` to assemble the optimal context window.
4. **Unified Reasoning:** The AI answers queries that trace data flows from the frontend client down to backend database schemas and shared microservice interfaces.

***

## Actionable Tool Execution

Blame's Chat Agent is powered by an autonomous **LangGraph state machine** equipped with direct GitHub tool capabilities:

| **Tool** | **Capability** | **Example Prompt** |
| :- | :- | :- |
| `github_list_pull_requests` | Query active, closed, or draft PRs with SHAs and author metadata. | *"List open PRs on backend and check which one modified the auth handler."* |
| `github_get_pr_details` | Fetch full diffs, descriptions, and commit histories for a PR. | *"What changes were introduced in PR #42?"* |
| `trigger_pr_review` | Queue an adversarial AI code review run directly from chat. | *"Trigger a Blame review for PR #128."* |
| `github_create_branch` | Create a new git branch from `main` or another target branch. | *"Create a new branch* `blame/fix-jwt-expiration`*."* |
| `github_create_or_update_file` | Commit modified file contents directly to a branch. | *"Apply this bugfix and commit it to the new branch."* |
| `github_create_pull_request` | Open a fully documented Pull Request on GitHub with a title and summary. | *"Open a PR from my fix branch back to main."* |

<Frame>
  <img src="https://mintcdn.com/blame-085dcc89/2YZScLQxf5nAwcUa/images/Group-1-2.jpg?fit=max&auto=format&n=2YZScLQxf5nAwcUa&q=85&s=b5faf419cfab37bb831547eedffb47d4" alt="Group 1 2" width="2400" height="1260" data-path="images/Group-1-2.jpg" />
</Frame>

***

## Codebase & Workspace Memory

Generic AI tools forget your architectural decisions between chats. Blame solves this with two persistent memory layers:

```mermaid theme={null}
graph LR
    subgraph Memory Layers
        Auto[1. Auto-Discovered Rules] --> Injection[Prompt Injection Pipeline]
        Dashboard[2. Workspace & Repo Memory Store] --> Injection
    end

    subgraph Ingestion Sources
        F1[.cursorrules / CLAUDE.md] --> Auto
        F2[AGENTS.md / blame.yaml] --> Auto
        UI[Team Guidelines in Settings] --> Dashboard
    end

    Injection --> ActiveChat[Active Chat & Review Agents]
```

<Frame>
  <img src="https://mintcdn.com/blame-085dcc89/4grevPpx2M1cJ7Wh/images/Group-1-3.jpg?fit=max&auto=format&n=4grevPpx2M1cJ7Wh&q=85&s=f190545ff548b1b5be0cb104682502cb" alt="Group 1 3" width="2400" height="1260" data-path="images/Group-1-3.jpg" />
</Frame>

### 1. Auto-Discovered Rule Files

Blame scans every repository for standard guideline files and automatically incorporates them into chat reasoning:

* `.cursorrules` and `.cursor/rules/*.mdc` (including glob scopes)
* `CLAUDE.md` and `.claude/CLAUDE.md`
* `AGENTS.md` and `.agents/AGENTS.md`
* `blame.yaml` and `.coderabbit.yaml`
* `.github/copilot-instructions.md`

### 2. Dashboard Memory Store

Team leads can add persistent rules, architectural invariants, or reference files in the **Memory** page via the app sidebar:

* **Rules:** Explicit behavioral instructions (e.g. *"Always use Zod for API request validation"* or *"Wrap all mutations in PostgreSQL database transactions"*).
* **Scope Patterns:** Restrict memories to specific paths (e.g., `services/billing/**` or `app/(auth)/**`).
* **Global Workspace Memories:** Apply organization-wide security, style, or dependency guidelines across all repositories.

***

## Related Guides

* [**Graph-Based Codebase Context**](/graph-rag-and-code-intelligence) — How Blame parses AST symbols and builds dependency graphs.
* [**Automated Pull Request Reviews**](/automated-pull-request-reviews) — Automated CI/CD review workflows on GitHub.
* [**Workspace Settings**](/workspace-settings) — Configuring workspace defaults and permissions.
