# Repository Briefing: BerryUIKI/CatCup-Tavern
> Source: https://repoforai.com/repo/BerryUIKI/CatCup-Tavern (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/BerryUIKI/CatCup-Tavern
- **Official Docs / Website**: https://berryuiki.github.io/CatCup-Tavern/
- **Category**: Chat UI & AI Apps (聊天界面与 AI 应用)
- **Primary Language**: TypeScript
- **License**: AGPL-3.0
- **Engineering Health**: B+ (75/100 · Maintenance 35/35 · Adoption 9/25 · Releases 20/20 · License 11/20)
- **Latest Release**: v0.6.4 (2026-12-02) — https://github.com/BerryUIKI/CatCup-Tavern/releases
- **Review Snapshot**: 2026-12-02 (Note: v0.6.4 on 2026-12-02 shipped after this review; verify latest release notes)
- **Deployment / Stack Signals**: Self-Hosted, Local AI
- **Momentum**: 82 ★ total (+0 24h / +36 7d) · 5 forks
- **Topics**: `ai`, `character-cards`, `fastify`, `llm`, `local-llm`, `openai-compatible`, `react`, `roleplay`, `sillytavern`, `tauri`
- **When to Use**: Best for: A solo roleplayer who wants to reuse a SillyTavern library, inspect lorebook activation and access one file-backed setup from Windows or a browser on a trusted LAN. Skip if: Your workflow needs STscript, SillyTavern extensions, automatic group turns, image input, vector memory, separate user accounts or a released macOS or Linux desktop build.

## Overview
```text
### Architecture & Core Mechanics
CatCup Tavern is a TypeScript workspace with a React SPA and one Fastify backend for browser, LAN and desktop use. Fastify owns password authentication, persistence, lorebook selection, prompt assembly, token budgeting and provider calls. The browser renders an SSE stream rather than implementing its own prompt pipeline. The Rust/Tauri desktop shell bundles the built web assets and a Node sidecar, then starts the same backend as a child process.

The persistence layer uses ordinary files: `data/characters/` holds cards, `data/chats/<character>/` holds JSONL conversations, and `data/worlds/` and `data/presets/` hold JSON configuration. This makes copying and inspecting a library straightforward, but distinguish portable content from server state: `secrets.json` holds API keys and `auth.json` holds the password hash and session secret. Interoperability is at the file-format level; SillyTavern extensions and `getContext` are not supported.

### Key Capabilities & Differentiators
Single-character chat supports streamed replies with separate reasoning display, regeneration, continuation, alternate greetings, editable messages and branches. Stopping generation preserves the partial reply. Group rooms support multiple characters and configurable reply order, but only one member replies per turn. Character cards support PNG V2/V3, JSON and CharX; chats preserve swipes and branches in JSONL. The app can use a local LLM backend or a remote provider through an OpenAI-compatible API. Importing an OpenAI prompt preset does not bring over every provider setting: the supported sampling controls are temperature, top p, max tokens and context size.

The lorebook pipeline covers primary and secondary keys, selective logic, recursion, inclusion groups, sticky/cooldown/delay effects, injection positions and a token budget. Its context inspector exposes which entries were considered and why they fired, making it possible to distinguish an activation problem from a prompt assembly problem. All four live regex placements are supported. Long chats are trimmed to fit the token budget; an editable rolling summary is the long-term memory mechanism, with no vector retrieval.

### Trade-offs & Limitations
CatCup is a plausible SillyTavern replacement for a library centered on cards, chats, lorebooks and prompt presets, not for a setup built around extensions and scripting. Typed slash commands go to the model as plain text; Quick Reply v2 runs seven commands but lacks auto-execution and context menus. Group chat has neither append modes nor automatic turns. There is no attachment upload, image input or vector memory. LAN mode gives one user access from several devices via a shared password; it is not a multi-user collaboration server.

Migration is easy to inspect but not a lossless transfer of the whole setup. The in-app importer skips groups and Quick Reply sets, imported lorebooks start disabled, and importing the same directory again creates suffixed copies rather than updating entries. SillyTavern 1.19 presets stored inside settings need to be imported individually. Test a copy of your library before switching, and check the AGPL-3.0 obligations before distributing a build or exposing a modified version as a hosted service.

### Hardware & Deployment Guide
Web or LAN deployment requires Node.js 22.13+ and pnpm 11. Run `pnpm install` and `pnpm dev` for development (Fastify on `:8000`, web on `:5173`), or `pnpm build && pnpm start` to serve the built SPA from Fastify. Set `CATCUP_HOST=0.0.0.0` for LAN access and `CATCUP_DATA_DIR` to relocate storage. First-run password setup is local by default. There is no built-in TLS, so use a reverse proxy or VPN beyond a trusted network. Local storage does not imply offline inference: offline use requires a reachable local model backend; a remote provider receives the assembled prompt.

The listed v0.6.3 release is early access and supports single-character and group roleplay end to end, within the group-turn limits above. Windows is the only released desktop target. Its per-user installer bundles Node and defaults to `%APPDATA%\dev.catcup.tavern`; the installer lacks Authenticode signing and can trigger SmartScreen, which is separate from the signed update artifacts. macOS and Linux shell compilation in CI does not establish desktop runtime support.
```

## Key Capabilities
```text
- Serving model: Browser, LAN and Windows deployments share one Fastify backend; Tauri launches it as a child process and React consumes SSE.
- File compatibility: Reads and writes PNG V2/V3 and JSON cards, handles CharX and ZIP-based .catcup packages, and preserves swipes and branches in JSONL chats.
- Lorebook diagnostics: The context inspector shows the assembled prompt, which entries were evaluated and why they did or did not trigger.
- Prompt budgeting: OpenAI presets support per-message injection depth, order and role; token counts use tiktoken for recognized OpenAI models, Claude's vocabulary for Anthropic and labeled estimates otherwise.
- Group turn control: Natural, list, manual and pooled turn orders are available, with one replying member per turn and no automatic turns.
- Access boundary: Single-user password authentication, loopback-only setup by default and API keys stored on the server; no built-in TLS.
```

## Quick Start / Clone
```bash
pnpm install
pnpm dev          # server :8000, web :5173
```
