AI Chat Assistant
The AI Chat Assistant provides an interactive interface for cluster configuration, troubleshooting, and learning. Powered by GitHub Copilot, it understands KSailâs CLI, configuration schemas, and can execute commands with your approval.
Prerequisites
Section titled âPrerequisitesâ- GitHub Copilot CLI must be installed and authenticated
- Set
COPILOT_CLI_PATHenvironment variable if the CLI is not in your PATH
Starting a Chat Session
Section titled âStarting a Chat Sessionâksail chatThis opens an interactive TUI (Terminal User Interface) with markdown rendering, syntax highlighting, and conversation history.
Command Options
Section titled âCommand Optionsâ| Flag | Description | Default |
|---|---|---|
-m, --model | Model to use (e.g., gpt-5, claude-sonnet-4, auto) | Auto-detected from config or gpt-5 |
-r, --reasoning-effort | Reasoning effort level for supported models (low, medium, high) | Model default |
-s, --streaming | Enable streaming responses | true |
-t, --timeout | Response timeout duration | 5m0s |
--tui | Use interactive TUI mode with markdown rendering | true |
Examples:
# Use a specific model with high reasoning effortksail chat --model gpt-5 --reasoning-effort high
# Use auto model selection (applies 10% discount when available)ksail chat --model auto --timeout 10mAuthentication
Section titled âAuthenticationâThe chat assistant supports multiple authentication methods via environment variables:
KSAIL_COPILOT_TOKEN- KSail-specific Copilot token (preferred)COPILOT_TOKEN- General Copilot token- GitHub Copilot CLI authentication (default)
Note: GITHUB_TOKEN and GH_TOKEN are intentionally filtered as they are general-purpose personal access tokens that may lack Copilot-specific scopes, which can cause authentication errors.
Chat Modes
Section titled âChat ModesâPress Tab to cycle between three modes:
Agent Mode (</>)
Section titled âAgent Mode (</>)âExecutes both read and write operations. Write operations (create, modify, delete) require explicit confirmation. Use for cluster operations, deploying workloads, and configuration changes.
Plan Mode (âĄ)
Section titled âPlan Mode (âĄ)âBlocks all tool execution and provides step-by-step explanations without making changes. Use for learning workflows or reviewing potential changes before execution.
Ask Mode (?)
Section titled âAsk Mode (?)âExecutes read-only tools (inspect, list, describe) while blocking writes. Use for troubleshooting and investigating cluster state without risk of changes.
Advanced Features
Section titled âAdvanced FeaturesâReasoning Effort
Section titled âReasoning EffortâControl analysis depth with --reasoning-effort (low, medium, high) or press Ctrl+E in the TUI. Higher effort provides more thorough reasoning for complex problems but takes longer.
Auto Model Selection
Section titled âAuto Model SelectionâUse --model auto for automatic model selection with 10% discount (when available). The TUI shows the resolved model (e.g., Model: auto â gpt-4o).
Quota Tracking
Section titled âQuota TrackingâThe TUI displays your premium request usage (e.g., 300/300 reqs ¡ 0% ¡ resets Jan 2) or â reqs for unlimited entitlements.
Infinite Sessions
Section titled âInfinite SessionsâChat sessions support unlimited conversation length through automatic background compaction using a background compaction threshold of 80% (0.80) and a buffer exhaustion threshold of 95% (0.95) of the context window.
Keyboard Shortcuts
Section titled âKeyboard ShortcutsâNavigation
Section titled âNavigationâ- Enter â Send message
- Alt + Enter â New line in input
- â/â â Navigate command history (when input is empty) or scroll viewport
- PgUp/PgDn â Scroll conversation viewport
Modes & Settings
Section titled âModes & Settingsâ- Tab â Cycle chat mode (Agent â Plan â Ask â Agent)
- Ctrl+Y â Toggle auto-approve mode (bypasses permission prompts)
- Ctrl+T â Expand/collapse tool execution details
- Ctrl+O â Change AI model (lazy-loaded picker)
- Ctrl+E â Change reasoning effort level
- Ctrl+H â View session history
- Ctrl+N â Start new chat session
- Ctrl+R â Copy latest assistant response to clipboard
Help & Exit
Section titled âHelp & Exitâ- F1 â Toggle help overlay
- Esc â Close modals or cancel current operation
- Ctrl+C â Force quit
Usage Tracking
Section titled âUsage TrackingâWhen available, the footer displays real-time quota information showing used/total requests, remaining percentage, and reset date (may be hidden on narrow terminals). Example: 45/100 reqs ¡ 55% ¡ resets Feb 15. For unlimited premium quota, shows â reqs instead of numeric total.
Mode Comparison
Section titled âMode Comparisonâ| Feature | Agent Mode | Plan Mode | Ask Mode |
|---|---|---|---|
| Icon | </> | ⥠| ? |
| Read Tools | â Auto | â None | â Auto |
| Write Tools | â With approval | â None | â None |
| Makes Changes | Yes (approved) | No | No |
| Best For | Execution | Learning | Investigation |
Configuration
Section titled âConfigurationâSet your preferred model and reasoning effort in ksail.yaml:
spec: chat: model: claude-sonnet-4.5 # or gpt-5, gpt-4o, auto, etc. reasoningEffort: medium # low, medium, or highIf not set, the assistant uses the model specified via --model flag or defaults to gpt-5.
Common Workflows
Section titled âCommon WorkflowsâUse Plan mode (âĄ) to learn workflows, Ask mode (?) for safe troubleshooting, and Agent mode (</>) to execute operations with approval. Press Tab to switch modes as needed.
Session Management
Section titled âSession ManagementâView Past Sessions
Section titled âView Past SessionsâPress Ctrl+H to open session history. Navigate with â/â, filter with /, rename with r, delete with d, or select with Enter. Sessions persist in ~/.ksail/chat/sessions/.
Start New Session
Section titled âStart New SessionâPress Ctrl+N to start a fresh conversation. Previous sessions are automatically saved.
Start with Plan mode for learning, use Ask mode for safe troubleshooting, and enable auto-approve (Ctrl+Y) for trusted operations. Adjust reasoning effort (Ctrl+E) based on task complexity, use --model auto to optimize costs, and filter session history (Ctrl+H then /) to find past conversations.
Troubleshooting
Section titled âTroubleshootingâChat wonât start: Ensure GitHub Copilot CLI is installed (which copilot) and authenticated (copilot auth login).
Model not available: Try different models (--model gpt-5) or use auto-selection (--model auto).
Timeout errors: Increase timeout for complex operations (--timeout 15m).
Authentication errors: Authenticate Copilot CLI (copilot auth login), use KSAIL_COPILOT_TOKEN or COPILOT_TOKEN environment variables, and avoid GITHUB_TOKEN/GH_TOKEN (may lack Copilot scopes).
See Also
Section titled âSee Alsoâ- CLI Flags Reference â Complete flag documentation
- Configuration â Chat configuration options
- MCP Server â Expose KSail to other AI assistants