---
description: Add bluera-knowledge status indicator to the statusline
allowed-tools: [Read, Edit, Write, Bash]
---

# Bluera Knowledge Statusline

Add a 📘 blue book icon with MCP connectivity LED to the Claude Code statusline.

## What it shows

- `📘●` (green) — MCP server process is running
- `📘●` (red) — MCP server not detected

## Instructions

### 1. Check if already installed

```bash
grep -c "# --- bluera-knowledge ---" ~/.claude/statusline.sh 2>/dev/null
```

**If the count is >= 1: already installed.** Tell the user it's already present and stop. Do NOT inject again.

**If 0 or file missing:** proceed to install.

### 2. Read the current statusline

```bash
cat ~/.claude/statusline.sh
```

If the file doesn't exist, create a minimal statusline with just the BK module.

### 3. Inject the module

Read the module from the plugin:

```bash
cat "${CLAUDE_PLUGIN_ROOT:-.}/scripts/statusline-module.sh"
```

Insert the block between `# --- bluera-knowledge ---` and `# --- end bluera-knowledge ---` into `~/.claude/statusline.sh`:

- Place the function **before** the final output `printf`/`echo` statement(s)
- Place it **after** other module functions (like `get_bluera_status`, `get_project_type`, etc.)
- The leading space in the printf output is intentional — it separates from the previous badge

### 4. Wire into the output

Find the output `printf` lines (there are typically 3 — one per context color threshold). Add `%s` and `"$BK_STATUS"` to each, positioned **after** `"$BLUERA_STATUS"` and **before** `"$GIT_INFO"`.

For example, if the current format is:
```bash
printf "... %s%s%s ..." "$PROJECT_TYPE" "$BLUERA_STATUS" "$GIT_INFO" ...
```

Change to:
```bash
printf "... %s%s%s%s ..." "$PROJECT_TYPE" "$BLUERA_STATUS" "$BK_STATUS" "$GIT_INFO" ...
```

**Important:** Add exactly one `%s` to each format string AND one `"$BK_STATUS"` to each argument list. Count the format specifiers vs arguments to ensure they match.

### 5. Verify

```bash
bash -n ~/.claude/statusline.sh && echo "Syntax OK"
```

### 6. Edge cases

- **No statusline.sh exists**: Create a minimal one that reads stdin, runs `get_bk_status`, and echoes the result
- **Non-bluera preset**: Find the output `echo`/`printf` and append `$BK_STATUS` to it
- **No `$BLUERA_STATUS` in output**: Place `$BK_STATUS` at the end of the output, before any separators
