KnightCode Docs

Input Bar & Chat

Use file referencing, autocomplete, and interactive chat modes to converse with the agent.


The input bar at the bottom of the TUI is the main control surface for KnightCode. It is keyboard-driven, supporting inline file tagging, command autocompletion, and mode switching.

Keyboard Mode Toggling

Pressing Tab while focusing the input bar cycles the active prompt mode (BUILD → PLAN → AUTO → BUILD). The prompt caret (and, in PLAN/AUTO, the prompt border) changes color to show the active state:

  • BUILD (Default): The agent runs read-only tools automatically but prompts you for approval before file edits, non-allowlisted shell commands, spawning subagents, and writing settings.
  • PLAN: A planning-focused mode. The agent explores the codebase, designs solutions, and populates the Todo panel. Its file-editing and shell tools (Write, Edit, Bash, subagent spawning) are removed, so it cannot edit files or run commands (a few non-file tools like Config/Memory writes do remain). See Security for the exact boundaries.
  • AUTO: The agent runs autonomously, executing every tool call without prompting (except when it explicitly asks you a question), to quickly complete a multi-step objective.

File References with @

You can attach file context to your prompt without copy-pasting code:

  • Type @ inside the text box.
  • An autocomplete menu appears showing files and folders in your repository.
  • Type to fuzzy search, select using arrow keys ( / ), and press Enter to attach.
  • Selecting a directory appends a trailing /, allowing you to traverse down the file tree.

Command Autocomplete with /

Type / to open the command menu overlay. Start typing to filter commands (e.g., /undo, /models, /theme), then press Enter to run the command directly.

Conversation Compaction

Over long coding sessions, the prompt transcript can grow extremely large and consume too many API tokens.

  • Auto-Compaction: KnightCode automatically monitors token usage. If the conversation exceeds safety thresholds, the engine compresses older messages, writing a compaction summary block into the chat.
  • Manual Compaction: You can manually trigger compaction at any time using the /compact command.