# BUBU Brain — Reference for AI agents

Version 1.7.1 | 2026-10-12

BUBU BRAIN — OPERATING INSTRUCTIONS
MCP: https://bubu-brain.com/mcp
Authentication: Authorization: Bearer <BUBU_API_KEY> or x-api-key: <BUBU_API_KEY>.
Store the key in the client's credential store.
1. Initialize MCP, load tools/list and use its input schemas. Map client prefixes by the original tool name.
2. Call bubu_health and show its status.
3. Store every accessible user message and your visible response with bubu_ingest_turn in full original wording, including line breaks and code blocks. No summaries or relevance filters.
4. Exclude passwords, tokens, API keys, empty messages and internal system/runtime context blocks. Report storage errors.
5. Use a unique session_id per conversation. turn_id={session_id}-{YYYYMMDDTHHMM}-{role}; add a unique suffix for multiple turns of the same role within one minute. role=user|assistant|system. Use an ISO-8601 timestamp with time zone. Reuse identical IDs and content for retries.
6. Use bubu_recall with specific keywords. Retrieve context within ±30 minutes of a match as needed: from=t-30min, to=t+30min. Use window separately from from/to. Search uses fuzzy word matching.
7. Use bubu_write for standalone notes, facts and decisions; bubu_verify for integrity. Before bubu_correct, present the current text, entry ID and full replacement for confirmation.
8. Perform export, deletion, consent management and restriction in the dashboard.
9. Leave at least 500 ms between calls. Pause on rate limits and limit retries.
10. Implement complete turn capture in the host application's lifecycle hook or workflow.
START RESULT: health status and available BUBU tools.

## MCP connection

HTTPS POST, JSON-RPC 2.0. Protocol version 2025-03-26. Content-Type: application/json. For Streamable HTTP use Accept: application/json, text/event-stream. The MCP client manages initialization and sessions. If the server returns Mcp-Session-Id, include it in subsequent requests. After successful initialize, send notifications/initialized, followed by tools/list and tools/call.

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "initialize",
  "params": {
    "protocolVersion": "2025-03-26",
    "capabilities": {},
    "clientInfo": {
      "name": "bubu-agent",
      "version": "1.0"
    }
  }
}
```

```json
{
  "jsonrpc": "2.0",
  "method": "notifications/initialized"
}
```

```json
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/list",
  "params": {}
}
```

## bubu_health

Check the operational status of the memory service.

No parameters. arguments = {}.

Request:
```json
{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "bubu_health",
    "arguments": {}
  }
}
```

Return value: Status: ok or degraded.

## bubu_stats

Count sessions and messages in the active memory window.

No parameters. arguments = {}.

Request:
```json
{
  "jsonrpc": "2.0",
  "id": 4,
  "method": "tools/call",
  "params": {
    "name": "bubu_stats",
    "arguments": {}
  }
}
```

Return value: Session and message counts: total, visible, restricted, deleted. Unavailable values: n/a. No storage size is reported.

## bubu_list_consents

Show consent and the connection's effective permissions.

No parameters. arguments = {}.

Request:
```json
{
  "jsonrpc": "2.0",
  "id": 5,
  "method": "tools/call",
  "params": {
    "name": "bubu_list_consents",
    "arguments": {}
  }
}
```

Return value: Consent scopes, Article 9 status, grant time, expiry, revocation and connection permissions. One consent per kernel, covering its connections.

## bubu_recall

Keyword search with fuzzy word matching, not semantic search. For very long entries, approximately the first 16,000 characters are searchable; the full text is returned. Results are ranked by score: user messages before assistant messages, with slightly higher scores for longer texts; ties are newest first. An empty query lists the newest entries first.

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| query | string | yes | — | Keywords; empty to list the newest entries. |
| limit | integer | no | 5 | 1–100 results per page. |
| offset | integer | no | 0 | Results to skip; maximum 900. |
| window | enum | no | — | 1h, 1d, 1w, 30d, all; do not combine with from/to. |
| from | string / ISO-8601 | no | — | Start of the time range; do not combine with window. |
| to | string / ISO-8601 | no | — | End of the time range; do not combine with window. |

Request:
```json
{
  "jsonrpc": "2.0",
  "id": 6,
  "method": "tools/call",
  "params": {
    "name": "bubu_recall",
    "arguments": {
      "query": "project budget",
      "limit": 5,
      "window": "30d"
    }
  }
}
```

Return value: Total match count, next offset, full text, storage timestamp, role, session and entry ID. When available: turn_id, occurred_at, correction time and reason.

## bubu_ingest_turn

Store a conversation turn verbatim. Give each message a unique turn ID. Repeated calls with the same session ID, turn ID and identical content are deduplicated within the active memory window. The same ID with different content produces IDEMPOTENCY_CONFLICT.

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| session_id | string | yes | — | Unique conversation ID. |
| turn_id | string | yes | — | Unique turn ID within the session. |
| role | enum | yes | — | user, assistant, system. |
| content | string | yes | — | Full original text, including line breaks and code blocks. |
| timestamp | string / ISO-8601 | no | — | Time of the turn; stored separately as occurred_at. |
| project_id | string | no | — | Project label; recorded only when the session is created. Not a recall filter. |

Request:
```json
{
  "jsonrpc": "2.0",
  "id": 7,
  "method": "tools/call",
  "params": {
    "name": "bubu_ingest_turn",
    "arguments": {
      "session_id": "agent-2026-10-12",
      "turn_id": "agent-2026-10-12-20261012T1826-user",
      "role": "user",
      "content": "The budget remains €12,000.",
      "timestamp": "2026-10-12T18:26:00Z"
    }
  }
}
```

Return value: stored or already_stored, entry_id, storage time, turn time if supplied, and SHA-256 of the received content.

## bubu_write

Store a standalone note, decision or fact. Use bubu_ingest_turn for conversation turns. Without sourceId, the entry uses the kernel's fixed mcp-notes session.

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| content | string | yes | — | Verbatim content. |
| type | string | no | message | Must not be user, assistant or system. |
| sourceId | string | no | — | Must be an existing session ID. |
| idempotency_key | string | no | — | Maximum 200 characters. The same key and content within 60 seconds protect against retries. The same key with different content is stored as a new entry. |

Request:
```json
{
  "jsonrpc": "2.0",
  "id": 8,
  "method": "tools/call",
  "params": {
    "name": "bubu_write",
    "arguments": {
      "content": "Project budget: €12,000",
      "type": "note",
      "idempotency_key": "budget-20261012-01"
    }
  }
}
```

Return value: stored or already_stored and entry_id. Identical content in the same session is stored only once within 60 seconds.

## bubu_verify

Check integrity. Without parameters, compute the current fingerprint across all entries in the active memory window and compare it with the last saved fingerprint. The fingerprint changes when entries are added, corrected or leave the active window.

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| entry_id | string | no | — | Entry ID from recall or ingest; do not combine with sessionId/timestamp. |
| sessionId | string | no | — | Only together with timestamp. |
| timestamp | string / ISO-8601 | no | — | Storage timestamp of a recall result; only together with sessionId. |

Request:
```json
{
  "jsonrpc": "2.0",
  "id": 9,
  "method": "tools/call",
  "params": {
    "name": "bubu_verify",
    "arguments": {
      "entry_id": "ENTRY_ID_FROM_RECALL"
    }
  }
}
```

Return value: Fingerprint and result: intact or MISMATCH. An individual check recomputes the ID from session, role, current text and timestamp and compares it with the stored ID.

## bubu_correct

Correct an entry. Before calling, show the original text, entry ID and full replacement text, and obtain confirmation of that specific correction. Restricted and deleted entries cannot be corrected.

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| entry_id | string | yes | — | ID from recall, not the result's list position. |
| content | string | yes | — | Full corrected text. |
| reason | string | no | Art. 16 DSGVO | Reason for the correction. |

Request:
```json
{
  "jsonrpc": "2.0",
  "id": 10,
  "method": "tools/call",
  "params": {
    "name": "bubu_correct",
    "arguments": {
      "entry_id": "ENTRY_ID_FROM_RECALL",
      "content": "Project budget: €15,000",
      "reason": "Confirmed correction"
    }
  }
}
```

Return value: previous_text, new_text and new_id. The entry ID changes; the old ID no longer addresses the entry. The original text remains stored, while recall and export return the corrected text. The correction records its reason, time and connection.

## Recall time range

Match at 2026-10-12T18:26:00Z → from=2026-10-12T17:56:00Z, to=2026-10-12T18:56:00Z. Omit window. Use the entry ID, not the result list position.

## Error codes

- -32001 UNAUTHORIZED: check key/header.
- -32002 NO_CONSENT: check/grant consent in the dashboard.
- -32003 RATE_LIMITED: pause and increase call spacing.
- -32603 INTERNAL_ERROR: check health; limit retries.
- IDEMPOTENCY_CONFLICT: same turn key with different content; do not treat it as a successful retry.

## REST

REST base: https://bubu-brain.com/api/*
JWKS: https://auth.bubu-brain.com/.well-known/jwks.json
Authentication: Authorization: Bearer <token> or x-api-key: <token>.

| Endpoint | Method | Authentication |
|---|---|---|
| /health | GET | none |
| /api/health | GET | Bearer |

## Client profiles

### Hermes

Direct remote MCP access through the agent's configuration.

Add mcp_servers.bubu to Hermes config.yaml with url and the Authorization header from ${BUBU_API_KEY}. Preserve existing servers and start a new session.

Configuration: Hermes config.yaml — merge into the existing block
```
mcp_servers:
  bubu:
    url: "https://bubu-brain.com/mcp"
    headers:
      Authorization: "Bearer ${BUBU_API_KEY}"
```

### OpenClaw

Outbound Streamable HTTP server in the OpenClaw MCP registry.

Open /settings/mcp in the OpenClaw Control UI. Add an outbound BUBU MCP server with https://bubu-brain.com/mcp and transport=streamable-http plus an Authorization bearer header. Inspect the entry with openclaw mcp status --verbose and the connection with openclaw mcp doctor bubu --probe.

Configuration: OpenClaw — mcp.servers
```
{
  "mcp": {
    "servers": {
      "bubu": {
        "url": "https://bubu-brain.com/mcp",
        "transport": "streamable-http",
        "headers": {
          "Authorization": "Bearer YOUR_API_KEY"
        }
      }
    }
  }
}
```

### ChatGPT

Connect the BUBU Brain app and enable it for the chat.

Connect the BUBU-BRAIN app in Apps and enable it for this conversation. Use its BUBU tools. Optionally add the operating rules to the project instructions.

### Claude

Claude Web/Desktop through a connected BUBU connector.

Add a remote MCP connector with https://bubu-brain.com/mcp in Claude connector settings. Complete the offered authentication flow and enable the connector in chat.

### Claude Code

Remote HTTP MCP with a secret reference in the configuration.

Add bubu to the project .mcp.json using type=http, url and Authorization: Bearer ${BUBU_API_KEY}. Set BUBU_API_KEY in the client environment. Inspect the connection with /mcp.

Configuration: .mcp.json — merge into the existing block
```
{
  "mcpServers": {
    "bubu": {
      "type": "http",
      "url": "https://bubu-brain.com/mcp",
      "headers": {
        "Authorization": "Bearer ${BUBU_API_KEY}"
      }
    }
  }
}
```

### Gemini CLI

Gemini through an HTTP MCP client, rather than a text-only chat.

Set BUBU_API_KEY in the shell environment. Register BUBU for HTTP using the shown gemini mcp add command; the shell substitutes the header value. Inspect the connection and tools with /mcp.

Configuration: Shell — register HTTP server
```
gemini mcp add --transport http --header "Authorization: Bearer $BUBU_API_KEY" bubu https://bubu-brain.com/mcp
```

### Gemini API

Remote MCP through the Gemini Interactions API.

Use the Gemini Interactions API with a tool of type mcp_server, name=bubu, url=https://bubu-brain.com/mcp and an Authorization bearer header. Load the BUBU key server-side from BUBU_API_KEY. Provide the operating rules as application system instructions. Provide system_instruction and tools on every request.

Configuration: Python — Gemini Interactions API
```
from google import genai
import os

client = genai.Client()
result = client.interactions.create(
    model=os.environ["GEMINI_MODEL"],
    input="Call bubu_health.",
    tools=[{
        "type": "mcp_server",
        "name": "bubu",
        "url": "https://bubu-brain.com/mcp",
        "headers": {"Authorization": "Bearer " + os.environ["BUBU_API_KEY"]}
    }]
)
```

### Codex

Remote MCP with a bearer token read from an environment variable.

Add mcp_servers.bubu to ~/.codex/config.toml with url and bearer_token_env_var=BUBU_API_KEY. Set BUBU_API_KEY in the client environment and start a new session.

Configuration: Codex config.toml — merge into the existing block
```
[mcp_servers.bubu]
url = "https://bubu-brain.com/mcp"
bearer_token_env_var = "BUBU_API_KEY"
```

### Cursor

A Cursor MCP server with an environment reference for the key.

Add bubu to .cursor/mcp.json or ~/.cursor/mcp.json with url and Authorization: Bearer ${env:BUBU_API_KEY}. Set the environment variable before starting the client. Enable the server and use its tools in Agent mode.

Configuration: Cursor mcp.json — merge into the existing block
```
{
  "mcpServers": {
    "bubu": {
      "url": "https://bubu-brain.com/mcp",
      "headers": {
        "Authorization": "Bearer ${env:BUBU_API_KEY}"
      }
    }
  }
}
```

### GitHub Copilot / VS Code

The editor's MCP client, with tool access in agent mode.

Use MCP: Add Server in VS Code to register an HTTP server at https://bubu-brain.com/mcp. Set the Authorization bearer header through a protected input. Project configuration uses servers in .vscode/mcp.json. Enable the server and its tools in Agent chat.

Configuration: .vscode/mcp.json
```
{
  "inputs": [
    {
      "type": "promptString",
      "id": "bubu-key",
      "description": "BUBU API key",
      "password": true
    }
  ],
  "servers": {
    "bubu": {
      "type": "http",
      "url": "https://bubu-brain.com/mcp",
      "headers": {
        "Authorization": "Bearer ${input:bubu-key}"
      }
    }
  }
}
```

### Windsurf / Cascade

MCP integration in the installed Cascade version.

Add bubu to Cascade mcp_config.json with serverUrl and Authorization: Bearer ${env:BUBU_API_KEY}. Set the environment variable before starting the client and refresh MCP tools in Cascade.

Configuration: Configuration
```
{
  "mcpServers": {
    "bubu": {
      "serverUrl": "https://bubu-brain.com/mcp",
      "headers": {
        "Authorization": "Bearer ${env:BUBU_API_KEY}"
      }
    }
  }
}
```

### LM Studio

Remote MCP with bearer header through the LM Studio API.

Use LM Studio 0.4.0 or newer. Enable Allow per-request MCPs in Server Settings. Send an integrations configuration to /api/v1/chat using type=ephemeral_mcp, server_label=bubu, server_url=https://bubu-brain.com/mcp and the Authorization bearer header. Select a tool-capable model. The health example allows only bubu_health. Add the required tools to allowed_tools for memory operation.

Configuration: JSON — POST /api/v1/chat
```
{
  "model": "YOUR_LOADED_MODEL",
  "input": "Call bubu_health.",
  "integrations": [
    {
      "type": "ephemeral_mcp",
      "server_label": "bubu",
      "server_url": "https://bubu-brain.com/mcp",
      "allowed_tools": [
        "bubu_health"
      ],
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  ]
}
```

### n8n

Automatic turn storage through workflow steps, rather than a chat instruction alone.

Use an MCP Client Tool node with typeVersion 1.1 or newer. Explicitly select serverTransport=httpStreamable and endpointUrl=https://bubu-brain.com/mcp. Configure bearer authentication as a credential and connect the node to the AI Agent. Capture user and assistant turns in workflow steps with stable session/turn IDs and identical retry IDs. typeVersion denotes the node version.

### Custom agent / other AI suite

For LangGraph, SDK agents or local models with an MCP host.

Connect the host application MCP client to https://bubu-brain.com/mcp over Streamable HTTP with bearer authentication. Initialize the session, load tools/list and expose its tools to the agent. Capture user and assistant turns in a lifecycle hook with stable IDs, at least 500 ms spacing and idempotent retries.



## Persistent rules per client

### Hermes

Location: .hermes.md / AGENTS.md

Scope: Project context of the active Hermes session

- Append the BUBU section to the project context file already being loaded.
- .hermes.md takes precedence over AGENTS.md; creating a higher-priority file can displace existing project instructions.
- Start a new session to load updated project instructions.

```
## BUBU Brain Memory
- Use only actually available BUBU tools. Check bubu_health at session start; report a missing connection or write permissions.
- Store every accessible user message and visible response you produce with bubu_ingest_turn in full original wording, without summaries or relevance filtering.
- Never store passwords, tokens, API keys, empty messages or internal system/runtime context blocks. Report exceptions and storage failures openly.
- Use a unique session_id per conversation and turn_id per turn. For retries, reuse the same IDs and content. Supply timestamp as ISO-8601 with a time zone.
- Search with bubu_recall and specific keywords. If needed, retrieve again within ±30 minutes of the match time; never combine window with from/to.
- Use bubu_write only for standalone notes/facts/decisions. Call bubu_correct only after confirmation of the old and new full text and entry ID.
- Export, deletion, consent management and restriction are dashboard-only operations; never call corresponding MCP tools.
- Leave at least 500 ms between calls and limit retries. Report success only after an actual tool result.
- Implement complete turn capture in the host application lifecycle hook or workflow.
```

### OpenClaw

Location: AGENTS.md in the configured agent workspace

Scope: The agent whose workspace uses this AGENTS.md

- Use the selected agent's actual workspace; do not assume the default workspace.
- Append BUBU operating rules to AGENTS.md. Keep SOUL.md for identity and tone.
- Start a new session and verify that the added instructions are included in the agent context.

```
## BUBU Brain Memory
- Use only actually available BUBU tools. Check bubu_health at session start; report a missing connection or write permissions.
- Store every accessible user message and visible response you produce with bubu_ingest_turn in full original wording, without summaries or relevance filtering.
- Never store passwords, tokens, API keys, empty messages or internal system/runtime context blocks. Report exceptions and storage failures openly.
- Use a unique session_id per conversation and turn_id per turn. For retries, reuse the same IDs and content. Supply timestamp as ISO-8601 with a time zone.
- Search with bubu_recall and specific keywords. If needed, retrieve again within ±30 minutes of the match time; never combine window with from/to.
- Use bubu_write only for standalone notes/facts/decisions. Call bubu_correct only after confirmation of the old and new full text and entry ID.
- Export, deletion, consent management and restriction are dashboard-only operations; never call corresponding MCP tools.
- Leave at least 500 ms between calls and limit retries. Report success only after an actual tool result.
- Implement complete turn capture in the host application lifecycle hook or workflow.
```

### ChatGPT

Location: Project instructions in the BUBU project

Scope: Chats inside the selected ChatGPT project

- Open the intended project and append the BUBU rules to its project instructions.
- Also connect the BUBU app and enable it for the conversation.
- Start a new conversation in that project and verify an actual health call.

```
## BUBU Brain Memory
- Use only actually available BUBU tools. Check bubu_health at session start; report a missing connection or write permissions.
- Store every accessible user message and visible response you produce with bubu_ingest_turn in full original wording, without summaries or relevance filtering.
- Never store passwords, tokens, API keys, empty messages or internal system/runtime context blocks. Report exceptions and storage failures openly.
- Use a unique session_id per conversation and turn_id per turn. For retries, reuse the same IDs and content. Supply timestamp as ISO-8601 with a time zone.
- Search with bubu_recall and specific keywords. If needed, retrieve again within ±30 minutes of the match time; never combine window with from/to.
- Use bubu_write only for standalone notes/facts/decisions. Call bubu_correct only after confirmation of the old and new full text and entry ID.
- Export, deletion, consent management and restriction are dashboard-only operations; never call corresponding MCP tools.
- Leave at least 500 ms between calls and limit retries. Report success only after an actual tool result.
- Implement complete turn capture in the host application lifecycle hook or workflow.
```

### Claude

Location: Claude project instructions

Scope: Chats in the selected Claude project

- Add BUBU rules to the project's instructions while preserving existing instructions.
- Connect the BUBU connector separately and make it available in the chat.
- Open a new conversation in the project and check whether BUBU tools are actually available.

```
## BUBU Brain Memory
- Use only actually available BUBU tools. Check bubu_health at session start; report a missing connection or write permissions.
- Store every accessible user message and visible response you produce with bubu_ingest_turn in full original wording, without summaries or relevance filtering.
- Never store passwords, tokens, API keys, empty messages or internal system/runtime context blocks. Report exceptions and storage failures openly.
- Use a unique session_id per conversation and turn_id per turn. For retries, reuse the same IDs and content. Supply timestamp as ISO-8601 with a time zone.
- Search with bubu_recall and specific keywords. If needed, retrieve again within ±30 minutes of the match time; never combine window with from/to.
- Use bubu_write only for standalone notes/facts/decisions. Call bubu_correct only after confirmation of the old and new full text and entry ID.
- Export, deletion, consent management and restriction are dashboard-only operations; never call corresponding MCP tools.
- Leave at least 500 ms between calls and limit retries. Report success only after an actual tool result.
- Implement complete turn capture in the host application lifecycle hook or workflow.
```

### Claude Code

Location: CLAUDE.md / ~/.claude/CLAUDE.md

Scope: Project-wide in CLAUDE.md; personal across projects in ~/.claude/CLAUDE.md

- Append project BUBU rules to CLAUDE.md; optionally use ~/.claude/CLAUDE.md for personal rules across projects.
- Configure the MCP connection and secret reference separately; never put keys in the instructions file.
- Start a new session and inspect the loaded instructions.

```
## BUBU Brain Memory
- Use only actually available BUBU tools. Check bubu_health at session start; report a missing connection or write permissions.
- Store every accessible user message and visible response you produce with bubu_ingest_turn in full original wording, without summaries or relevance filtering.
- Never store passwords, tokens, API keys, empty messages or internal system/runtime context blocks. Report exceptions and storage failures openly.
- Use a unique session_id per conversation and turn_id per turn. For retries, reuse the same IDs and content. Supply timestamp as ISO-8601 with a time zone.
- Search with bubu_recall and specific keywords. If needed, retrieve again within ±30 minutes of the match time; never combine window with from/to.
- Use bubu_write only for standalone notes/facts/decisions. Call bubu_correct only after confirmation of the old and new full text and entry ID.
- Export, deletion, consent management and restriction are dashboard-only operations; never call corresponding MCP tools.
- Leave at least 500 ms between calls and limit retries. Report success only after an actual tool result.
- Implement complete turn capture in the host application lifecycle hook or workflow.
```

### Gemini CLI

Location: GEMINI.md

Scope: Hierarchical context of the Gemini CLI environment

- Append to the appropriate project GEMINI.md and account for global and parent context files.
- Reload with /memory reload and inspect the actual loaded text with /memory show.
- Configure BUBU MCP separately in settings.json.

```
## BUBU Brain Memory
- Use only actually available BUBU tools. Check bubu_health at session start; report a missing connection or write permissions.
- Store every accessible user message and visible response you produce with bubu_ingest_turn in full original wording, without summaries or relevance filtering.
- Never store passwords, tokens, API keys, empty messages or internal system/runtime context blocks. Report exceptions and storage failures openly.
- Use a unique session_id per conversation and turn_id per turn. For retries, reuse the same IDs and content. Supply timestamp as ISO-8601 with a time zone.
- Search with bubu_recall and specific keywords. If needed, retrieve again within ±30 minutes of the match time; never combine window with from/to.
- Use bubu_write only for standalone notes/facts/decisions. Call bubu_correct only after confirmation of the old and new full text and entry ID.
- Export, deletion, consent management and restriction are dashboard-only operations; never call corresponding MCP tools.
- Leave at least 500 ms between calls and limit retries. Report success only after an actual tool result.
- Implement complete turn capture in the host application lifecycle hook or workflow.
```

### Gemini API

Location: system_instruction on each Gemini Interactions request

Scope: Requests in this Gemini API application

- Pass the rule text as system_instruction on each request, including requests with previous_interaction_id.
- Add BUBU as mcp_server with URL and bearer header in tools.
- Capture user and assistant turns in the application lifecycle.

```
## BUBU Brain Memory
- Use only actually available BUBU tools. Check bubu_health at session start; report a missing connection or write permissions.
- Store every accessible user message and visible response you produce with bubu_ingest_turn in full original wording, without summaries or relevance filtering.
- Never store passwords, tokens, API keys, empty messages or internal system/runtime context blocks. Report exceptions and storage failures openly.
- Use a unique session_id per conversation and turn_id per turn. For retries, reuse the same IDs and content. Supply timestamp as ISO-8601 with a time zone.
- Search with bubu_recall and specific keywords. If needed, retrieve again within ±30 minutes of the match time; never combine window with from/to.
- Use bubu_write only for standalone notes/facts/decisions. Call bubu_correct only after confirmation of the old and new full text and entry ID.
- Export, deletion, consent management and restriction are dashboard-only operations; never call corresponding MCP tools.
- Leave at least 500 ms between calls and limit retries. Report success only after an actual tool result.
- Implement complete turn capture in the host application lifecycle hook or workflow.
```

### Codex

Location: AGENTS.md / ~/.codex/AGENTS.md

Scope: Project instructions or personal global Codex instructions

- Append BUBU rules to the appropriate AGENTS.md section and account for narrower subdirectory instructions.
- Check AGENTS.override.md and existing precedence before creating an additional file.
- Start a new session. Configure MCP and bearer_token_env_var separately in config.toml.

```
## BUBU Brain Memory
- Use only actually available BUBU tools. Check bubu_health at session start; report a missing connection or write permissions.
- Store every accessible user message and visible response you produce with bubu_ingest_turn in full original wording, without summaries or relevance filtering.
- Never store passwords, tokens, API keys, empty messages or internal system/runtime context blocks. Report exceptions and storage failures openly.
- Use a unique session_id per conversation and turn_id per turn. For retries, reuse the same IDs and content. Supply timestamp as ISO-8601 with a time zone.
- Search with bubu_recall and specific keywords. If needed, retrieve again within ±30 minutes of the match time; never combine window with from/to.
- Use bubu_write only for standalone notes/facts/decisions. Call bubu_correct only after confirmation of the old and new full text and entry ID.
- Export, deletion, consent management and restriction are dashboard-only operations; never call corresponding MCP tools.
- Leave at least 500 ms between calls and limit retries. Report success only after an actual tool result.
- Implement complete turn capture in the host application lifecycle hook or workflow.
```

### Cursor

Location: .cursor/rules/bubu-memory.mdc

Scope: Cursor Agent in this project; Always Apply

- Create a Cursor rule through rule management or add the .mdc file to the project.
- Keep the included alwaysApply: true frontmatter if the rule should always apply.
- Verify the loaded rule in the agent context; MCP configuration remains in mcp.json.

```
---
description: BUBU Brain memory
alwaysApply: true
---

## BUBU Brain Memory
- Use only actually available BUBU tools. Check bubu_health at session start; report a missing connection or write permissions.
- Store every accessible user message and visible response you produce with bubu_ingest_turn in full original wording, without summaries or relevance filtering.
- Never store passwords, tokens, API keys, empty messages or internal system/runtime context blocks. Report exceptions and storage failures openly.
- Use a unique session_id per conversation and turn_id per turn. For retries, reuse the same IDs and content. Supply timestamp as ISO-8601 with a time zone.
- Search with bubu_recall and specific keywords. If needed, retrieve again within ±30 minutes of the match time; never combine window with from/to.
- Use bubu_write only for standalone notes/facts/decisions. Call bubu_correct only after confirmation of the old and new full text and entry ID.
- Export, deletion, consent management and restriction are dashboard-only operations; never call corresponding MCP tools.
- Leave at least 500 ms between calls and limit retries. Report success only after an actual tool result.
- Implement complete turn capture in the host application lifecycle hook or workflow.
```

### GitHub Copilot / VS Code

Location: .github/copilot-instructions.md

Scope: Repository-wide Copilot instructions

- Append the BUBU section to .github/copilot-instructions.md without replacing existing project rules.
- Check host and editor settings for instruction files.
- In a new agent conversation, verify that the file is used as an instructions source.

```
## BUBU Brain Memory
- Use only actually available BUBU tools. Check bubu_health at session start; report a missing connection or write permissions.
- Store every accessible user message and visible response you produce with bubu_ingest_turn in full original wording, without summaries or relevance filtering.
- Never store passwords, tokens, API keys, empty messages or internal system/runtime context blocks. Report exceptions and storage failures openly.
- Use a unique session_id per conversation and turn_id per turn. For retries, reuse the same IDs and content. Supply timestamp as ISO-8601 with a time zone.
- Search with bubu_recall and specific keywords. If needed, retrieve again within ±30 minutes of the match time; never combine window with from/to.
- Use bubu_write only for standalone notes/facts/decisions. Call bubu_correct only after confirmation of the old and new full text and entry ID.
- Export, deletion, consent management and restriction are dashboard-only operations; never call corresponding MCP tools.
- Leave at least 500 ms between calls and limit retries. Report success only after an actual tool result.
- Implement complete turn capture in the host application lifecycle hook or workflow.
```

### Windsurf / Cascade

Location: .devin/rules/bubu-memory.md / .windsurf/rules/bubu-memory.md

Scope: Cascade workspace rule; Always On

- Create the appropriate workspace rule with Always On in rule management.
- Current builds use .devin/rules; older Windsurf projects may use .windsurf/rules. Verify which path is loaded.
- Keep the frontmatter and check the active runtime; Devin Local and Cascade can use different instruction paths.

```
---
trigger: always_on
---

## BUBU Brain Memory
- Use only actually available BUBU tools. Check bubu_health at session start; report a missing connection or write permissions.
- Store every accessible user message and visible response you produce with bubu_ingest_turn in full original wording, without summaries or relevance filtering.
- Never store passwords, tokens, API keys, empty messages or internal system/runtime context blocks. Report exceptions and storage failures openly.
- Use a unique session_id per conversation and turn_id per turn. For retries, reuse the same IDs and content. Supply timestamp as ISO-8601 with a time zone.
- Search with bubu_recall and specific keywords. If needed, retrieve again within ±30 minutes of the match time; never combine window with from/to.
- Use bubu_write only for standalone notes/facts/decisions. Call bubu_correct only after confirmation of the old and new full text and entry ID.
- Export, deletion, consent management and restriction are dashboard-only operations; never call corresponding MCP tools.
- Leave at least 500 ms between calls and limit retries. Report success only after an actual tool result.
- Implement complete turn capture in the host application lifecycle hook or workflow.
```

### LM Studio

Location: system_prompt in POST /api/v1/chat

Scope: LM Studio API requests from the calling application

- Pass the rule text as system_prompt in the API request.
- Add BUBU with URL and bearer header to integrations.
- Capture user and assistant turns in the application lifecycle.

```
## BUBU Brain Memory
- Use only actually available BUBU tools. Check bubu_health at session start; report a missing connection or write permissions.
- Store every accessible user message and visible response you produce with bubu_ingest_turn in full original wording, without summaries or relevance filtering.
- Never store passwords, tokens, API keys, empty messages or internal system/runtime context blocks. Report exceptions and storage failures openly.
- Use a unique session_id per conversation and turn_id per turn. For retries, reuse the same IDs and content. Supply timestamp as ISO-8601 with a time zone.
- Search with bubu_recall and specific keywords. If needed, retrieve again within ±30 minutes of the match time; never combine window with from/to.
- Use bubu_write only for standalone notes/facts/decisions. Call bubu_correct only after confirmation of the old and new full text and entry ID.
- Export, deletion, consent management and restriction are dashboard-only operations; never call corresponding MCP tools.
- Leave at least 500 ms between calls and limit retries. Report success only after an actual tool result.
- Implement complete turn capture in the host application lifecycle hook or workflow.
```

### n8n

Location: AI Agent node's system message

Scope: Executions of this agent node in the workflow

- Append the rules to the AI Agent node's system message.
- Connect the BUBU credential and a compatible MCP client separately.
- For complete turn capture, also use workflow steps with stable session/turn IDs.

```
## BUBU Brain Memory
- Use only actually available BUBU tools. Check bubu_health at session start; report a missing connection or write permissions.
- Store every accessible user message and visible response you produce with bubu_ingest_turn in full original wording, without summaries or relevance filtering.
- Never store passwords, tokens, API keys, empty messages or internal system/runtime context blocks. Report exceptions and storage failures openly.
- Use a unique session_id per conversation and turn_id per turn. For retries, reuse the same IDs and content. Supply timestamp as ISO-8601 with a time zone.
- Search with bubu_recall and specific keywords. If needed, retrieve again within ±30 minutes of the match time; never combine window with from/to.
- Use bubu_write only for standalone notes/facts/decisions. Call bubu_correct only after confirmation of the old and new full text and entry ID.
- Export, deletion, consent management and restriction are dashboard-only operations; never call corresponding MCP tools.
- Leave at least 500 ms between calls and limit retries. Report success only after an actual tool result.
- Implement complete turn capture in the host application lifecycle hook or workflow.
```

### Custom agent / other AI suite

Location: Host application's system/developer instructions

Scope: The configured agent in the host application

- Add the rules to the instructions area actually loaded by the host application.
- Load the instructions when assembling the agent context.
- Implement the MCP connection, secret store and turn lifecycle hook separately.

```
## BUBU Brain Memory
- Use only actually available BUBU tools. Check bubu_health at session start; report a missing connection or write permissions.
- Store every accessible user message and visible response you produce with bubu_ingest_turn in full original wording, without summaries or relevance filtering.
- Never store passwords, tokens, API keys, empty messages or internal system/runtime context blocks. Report exceptions and storage failures openly.
- Use a unique session_id per conversation and turn_id per turn. For retries, reuse the same IDs and content. Supply timestamp as ISO-8601 with a time zone.
- Search with bubu_recall and specific keywords. If needed, retrieve again within ±30 minutes of the match time; never combine window with from/to.
- Use bubu_write only for standalone notes/facts/decisions. Call bubu_correct only after confirmation of the old and new full text and entry ID.
- Export, deletion, consent management and restriction are dashboard-only operations; never call corresponding MCP tools.
- Leave at least 500 ms between calls and limit retries. Report success only after an actual tool result.
- Implement complete turn capture in the host application lifecycle hook or workflow.
```

