← Back to Files
KaiChat-Test-Mode.instructions.md
---
description: "When testing KaiChat changes in the browser, know about Test Mode — it controls whether conversations go to real chat storage or a separate test folder."
applyTo: "KaiChat/**"
---
# KaiChat Test Mode Awareness
KaiChat has a **Test Mode** checkbox on the Settings page (`/Settings`). When checked, conversations are stored in a separate folder to keep tests distinct from real chats.
## How to Check and Toggle Test Mode
1. **Check current state**: GET `/api/settings/testmode` returns `{"testMode": true}` or `{"testMode": false}`. This reads from the live in-memory config, not a file.
2. **Toggle via browser**: Navigate to `/Settings`, locate the "Test Mode" checkbox, interact with it, and click "Save Settings". The change takes effect **immediately** — no restart needed.
3. **Visual indicator**: When test mode is on, a "TEST" badge appears in the top bar of the chat page (`id="testModeBadge"`).
## How It Works Under the Hood
- `SettingsModel` saves to `.kaichatconfig.json` for persistence across restarts AND applies the change instantly to the `KaiChatConfig` singleton.
- `ConversationService` resolves the conversations folder dynamically via `GetConvFolder()`, appending `_Test` to the folder name when test mode is active. This means conversations in test mode go to `Conversations_Test/` instead of `Conversations/`.
- The `/api/settings/testmode` endpoint reads from the live `KaiChatConfig` singleton, not `IConfiguration`.
## When to Use It
- **Enable test mode** before sending test messages or interacting with the chat so that test conversations don't pollute real chat history.
- **Disable test mode** only when verifying that production behavior is correct.
- When testing in the browser, always check that test mode is in the appropriate state for what you're testing.