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

# Special systems

> In-depth reference for Claurst's advanced internal systems: BUDDY, KAIROS, ULTRAPLAN, Undercover Mode, Penguin Mode, system prompt architecture, and beta API headers.

Several subsystems in Claurst go beyond the core query loop. Some are gated behind compile-time feature flags and absent from standard external builds; others are always present but not exposed through the public interface.

<Warning>
  BUDDY, KAIROS, and ULTRAPLAN are controlled by **compile-time feature flags**. They are dead-code-eliminated from builds that do not set the corresponding flag. Do not expect these subsystems to be available unless you build Claurst with the appropriate feature enabled.
</Warning>

***

<AccordionGroup>
  <Accordion title="BUDDY — companion pet system">
    **Feature flag:** `BUDDY`\
    **Crate:** `cc-buddy` (`crates/buddy`)\
    **Status:** Teaser window April 1–7 2026; full launch planned May 2026

    BUDDY is a Tamagotchi-style companion pet that lives in your terminal alongside the input prompt. Each user gets a deterministic companion — same user always hatches the same species.

    ### Gacha and PRNG

    Species is determined by a **Mulberry32 PRNG** seeded from your `userId` hash with the salt `'friend-2026-401'`:

    ```rust theme={null}
    // Mulberry32 — deterministic, reproducible per user
    fn mulberry32(seed: u32) -> impl FnMut() -> f64 {
        move || {
            // seed |= 0; seed = seed + 0x6D2B79F5 | 0;
            // ... fast 32-bit mixing
        }
    }
    ```

    The seed is derived from your user ID, so the same user always hatches the same buddy.

    ### Species and rarity

    18 species across 5 rarity tiers. Rarity determines drop probability; shiny is a separate 1% roll independent of rarity.

    | Rarity    | Drop chance | Species                                                        |
    | --------- | ----------- | -------------------------------------------------------------- |
    | Common    | 60%         | Pebblecrab, Dustbunny, Mossfrog, Twigling, Dewdrop, Puddlefish |
    | Uncommon  | 25%         | Cloudferret, Gustowl, Bramblebear, Thornfox                    |
    | Rare      | 10%         | Crystaldrake, Deepstag, Lavapup                                |
    | Epic      | 4%          | Stormwyrm, Voidcat, Aetherling                                 |
    | Legendary | 1%          | Cosmoshale, Nebulynx                                           |

    <Note>
      A shiny Legendary Nebulynx has a **0.01%** chance (1% rarity × 1% shiny).
    </Note>

    ### Stats

    Each buddy has 5 procedurally generated stats in the range 0–100:

    | Stat        | Description                          |
    | ----------- | ------------------------------------ |
    | `DEBUGGING` | Aptitude for finding bugs            |
    | `PATIENCE`  | Tolerance for long compilation times |
    | `CHAOS`     | Tendency toward unexpected behavior  |
    | `WISDOM`    | Accumulated experience               |
    | `SNARK`     | Commentary sharpness                 |

    ### Sprites

    Sprites are rendered as **5 lines × 12 characters** ASCII art with multiple animation frames (idle and reaction). They sit next to the user input prompt.

    ### Soul description

    On first hatch, Claude generates a short personality description for the buddy — its "soul". The system prompt tells Claude:

    ```
    A small {species} named {name} sits beside the user's input box and
    occasionally comments in a speech bubble. You're not {name} — it's a
    separate watcher.
    ```

    The buddy has its own personality and responds when addressed by name.

    ### Key types (`cc-buddy`)

    | Type      | Description                                                                      |
    | --------- | -------------------------------------------------------------------------------- |
    | `Buddy`   | Species, name, rarity, `is_shiny`, stats, soul description, current sprite frame |
    | `Species` | 18-variant enum with associated rarity tier                                      |
    | `Stats`   | Five `u8` fields, 0–100 each                                                     |
  </Accordion>

  <Accordion title="KAIROS — always-on assistant">
    **Feature flags:** `PROACTIVE` / `KAIROS`\
    **Status:** Internal only; absent from all external builds

    KAIROS is a persistent, always-running Claude assistant that does not wait for user input. It watches, logs, and proactively acts on things it notices.

    ### How it works

    KAIROS maintains **append-only daily log files** tracking observations, decisions, and actions throughout the day. On a regular interval it receives `<tick>` prompts that let it decide whether to act proactively or stay quiet.

    ```
    <tick>
    ```

    The system has a **15-second blocking budget**: any proactive action that would block the user's workflow for more than 15 seconds is deferred.

    ### Brief mode

    When KAIROS is active, the `Brief` output mode produces extremely concise responses — suitable for a persistent assistant that should not flood the terminal.

    ### Exclusive tools

    KAIROS has access to three tools not available to regular Claude Code sessions:

    | Tool               | Description                                                |
    | ------------------ | ---------------------------------------------------------- |
    | `SendUserFile`     | Push files directly to the user (notifications, summaries) |
    | `PushNotification` | Send push notifications to the user's device               |
    | `SubscribePR`      | Subscribe to and monitor pull request activity             |

    <Warning>
      These tools are only compiled when the `KAIROS` feature flag is enabled. Attempting to invoke them in a standard build will result in an unknown-tool error.
    </Warning>
  </Accordion>

  <Accordion title="ULTRAPLAN — 30-minute remote planning">
    **Status:** Internal; gated behind feature configuration\
    **Model:** Opus 4.6 (configured via `tengu_ultraplan_model`)

    ULTRAPLAN offloads a complex planning task to a remote **Cloud Container Runtime (CCR) session**, gives it up to 30 minutes to think, and lets the user approve the result from a browser.

    ### Flow

    1. Claude Code identifies a task that needs deep planning.
    2. It spins up a remote CCR session running Opus 4.6.
    3. The terminal enters a polling state — checking every **3 seconds** for the result.
    4. A browser-based UI lets you watch the planning happen and approve or reject it.
    5. On approval, the sentinel value `__ULTRAPLAN_TELEPORT_LOCAL__` is used to return the result to the local terminal.

    ```
    sentinel: __ULTRAPLAN_TELEPORT_LOCAL__
    poll interval: 3 seconds
    max planning time: 30 minutes
    remote model: opus-4-6 (tengu_ultraplan_model)
    ```

    <Note>
      The sentinel string `__ULTRAPLAN_TELEPORT_LOCAL__` is how the remote planning result is "teleported" back into the local session. It is never meant to be typed by the user.
    </Note>
  </Accordion>

  <Accordion title="Undercover Mode — internal identity protection">
    **Activation:** `CLAUDE_CODE_UNDERCOVER=1` (explicit) or automatic in public/open-source repos\
    **Status:** Present in all builds; injected into system prompt when active

    Undercover Mode prevents Claude from accidentally revealing Anthropic-internal information in commits and pull requests. It is activated automatically unless the repo remote matches an internal allowlist.

    ### System prompt injection

    When active, the following block is injected into the system prompt:

    ```
    ## UNDERCOVER MODE - CRITICAL

    You are operating UNDERCOVER in a PUBLIC/OPEN-SOURCE repository. Your commit
    messages, PR titles, and PR bodies MUST NOT contain ANY Anthropic-internal
    information. Do not blow your cover.

    NEVER include in commit messages or PR descriptions:
    - Internal model codenames (animal names like Capybara, Tengu, etc.)
    - Unreleased model version numbers (e.g., opus-4-7, sonnet-4-8)
    - Internal repo or project names
    - Internal tooling, Slack channels, or short links (e.g., go/cc, #claude-code-…)
    - The phrase "Claude Code" or any mention that you are an AI
    - Co-Authored-By lines or any other attribution
    ```

    ### Activation logic

    | Condition                              | Result                                |
    | -------------------------------------- | ------------------------------------- |
    | `CLAUDE_CODE_UNDERCOVER=1`             | Forces Undercover Mode ON in any repo |
    | Repo remote matches internal allowlist | Undercover Mode OFF                   |
    | Repo remote does not match allowlist   | Undercover Mode ON (automatic)        |

    <Warning>
      There is **no force-OFF**. If the system is not confident it is in an internal repo, it stays undercover. `CLAUDE_CODE_UNDERCOVER=1` can only force it on, not off.
    </Warning>

    ### Internal model codenames referenced

    The instruction explicitly lists animal names as internal codenames to suppress: **Capybara**, **Tengu**, **Fennec**.
  </Accordion>

  <Accordion title="Penguin Mode — fast mode">
    **Internal name:** Penguin Mode\
    **User-facing name:** Fast mode\
    **Slash command:** `/fast`

    Fast mode is internally called "Penguin Mode" throughout the codebase.

    ### Configuration keys

    | Key              | Value                                 |
    | ---------------- | ------------------------------------- |
    | API endpoint     | `/api/claude_code_penguin_mode`       |
    | Config key       | `penguinModeOrgEnabled`               |
    | Kill-switch flag | `tengu_penguins_off`                  |
    | Analytics event  | `tengu_org_penguin_mode_fetch_failed` |
    | Beta header      | `fast-mode-2026-02-01`                |

    ### Enabling

    ```
    /fast
    ```

    Penguin Mode is enabled per-organization. The org-level setting is fetched at startup and cached. If the fetch fails, the analytics event `tengu_org_penguin_mode_fetch_failed` is recorded and the mode falls back to standard.
  </Accordion>

  <Accordion title="System prompt architecture">
    The system prompt is not a single static string. It is assembled at runtime from **modular, cached sections**.

    ### Structure

    ```
    ┌─────────────────────────────────────────────────┐
    │  Static sections (cacheable across orgs)        │
    │  - Core instructions                            │
    │  - Tool descriptions                            │
    │  - CYBER_RISK_INSTRUCTION                       │
    ├─────────────────────────────────────────────────┤
    │  SYSTEM_PROMPT_DYNAMIC_BOUNDARY                 │
    ├─────────────────────────────────────────────────┤
    │  Dynamic sections (per user / per session)      │
    │  - User context                                 │
    │  - CLAUDE.md content                            │
    │  - Git status                                   │
    │  - Undercover Mode injection (if active)        │
    └─────────────────────────────────────────────────┘
    ```

    ### Key markers and functions

    | Symbol                                    | Description                                                                                                                |
    | ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
    | `SYSTEM_PROMPT_DYNAMIC_BOUNDARY`          | Marker string that splits cacheable static sections from volatile dynamic sections                                         |
    | `DANGEROUS_uncachedSystemPromptSection()` | Explicitly marks a section as non-cacheable (volatile)                                                                     |
    | `ContextBuilder::build_system_context()`  | Builds OS, working directory, and git context                                                                              |
    | `ContextBuilder::build_user_context()`    | Discovers and concatenates CLAUDE.md files from the current directory up to filesystem root and from `~/.claude/CLAUDE.md` |

    <Note>
      The naming `DANGEROUS_uncachedSystemPromptSection` reflects a hard lesson: adding volatile content to the cached portion of the prompt silently breaks prompt caching for all users. The `DANGEROUS_` prefix is a deliberate warning to future engineers.
    </Note>

    ### CYBER\_RISK\_INSTRUCTION

    One section of the static prompt carries a mandatory review header:

    ```
    IMPORTANT: DO NOT MODIFY THIS INSTRUCTION WITHOUT SAFEGUARDS TEAM REVIEW
    This instruction is owned by the Safeguards team (David Forsythe, Kyla Guru)
    ```

    This instruction draws clear lines around authorized security research — permitted actions versus destructive techniques and supply chain compromise.

    ### Caching

    Static sections are wrapped with `CacheControl::ephemeral()` via the `SystemPrompt::Blocks` variant in `cc-api`. The dynamic boundary ensures only truly volatile content bypasses the cache.
  </Accordion>

  <Accordion title="Beta API headers">
    Claude Code negotiates a set of beta feature headers with the Anthropic API on every request. These are set via the `anthropic-beta` header in `cc-api`.

    The base header constant in `cc-core::constants`:

    ```
    ANTHROPIC_BETA_HEADER =
      "interleaved-thinking-2025-05-14,token-efficient-tools-2025-02-19,files-api-2025-04-14"
    ```

    The full list of beta features negotiated (from `constants/betas.ts` in the original TypeScript source):

    | Beta header                           | Feature                                        |
    | ------------------------------------- | ---------------------------------------------- |
    | `interleaved-thinking-2025-05-14`     | Extended thinking interleaved with text        |
    | `context-1m-2025-08-07`               | 1 million token context window                 |
    | `structured-outputs-2025-12-15`       | Structured output format                       |
    | `web-search-2025-03-05`               | Web search tool                                |
    | `advanced-tool-use-2025-11-20`        | Advanced tool use                              |
    | `effort-2025-11-24`                   | Effort level control                           |
    | `task-budgets-2026-03-13`             | Task budget management                         |
    | `prompt-caching-scope-2026-01-05`     | Prompt cache scoping                           |
    | `fast-mode-2026-02-01`                | Fast mode (Penguin Mode)                       |
    | `redact-thinking-2026-02-12`          | Redacted thinking blocks                       |
    | `token-efficient-tools-2026-03-28`    | Token-efficient tool schemas                   |
    | `afk-mode-2026-01-31`                 | AFK mode                                       |
    | `cli-internal-2026-02-09`             | Internal-only features (Anthropic employees)   |
    | `advisor-tool-2026-03-01`             | Advisor tool                                   |
    | `summarize-connector-text-2026-03-13` | Connector text summarization                   |
    | `files-api-2025-04-14`                | Files API                                      |
    | `token-efficient-tools-2025-02-19`    | Token-efficient tool schemas (earlier version) |

    <Note>
      `redact-thinking`, `afk-mode`, and `advisor-tool` are not yet publicly released at the time of writing.
    </Note>

    Not all headers are sent on every request. The `cc-api` `AnthropicClient` selects the appropriate subset based on the request configuration (e.g., `thinking` enabled, `KAIROS` mode, etc.).
  </Accordion>
</AccordionGroup>
