An AI assistant integrated into Kate that replicates Zed Editor's agent functionality: LLM chat, tool execution, context from open buffers, and iteration loops.
- Type messages and receive AI responses as they stream in real-time
- Compatible with any OpenAI-compatible API (OpenAI, Anthropic, Ollama, LM Studio, etc.)
- Model selection dropdown to switch between different AI models
- Agent profiles: Write (code changes), Ask (questions/debugging), Minimal (concise)
- Streaming text with proper word wrapping and formatting
- Keyboard shortcuts:
Ctrl+Enterto send message,Enterfor new line
The AI can automatically execute tools based on your request:
| Tool | Description |
|---|---|
| read_file | Reads file contents to understand your code |
| edit_file | Suggests code changes with diff preview |
| grep | Searches for patterns across the project |
| find_files | Lists files matching a pattern |
| terminal | Executes shell commands (sandboxed for safety) |
Security: Terminal commands block dangerous operations (rm, curl, wget, sh, bash, cp, mv, python, perl, ruby).
- Files you're currently editing are automatically included in the AI's context
- Helps the AI understand your project without manual file mentions
- AI → Tool → Result → AI (automatic cycle)
- Maximum 20 iterations to prevent infinite loops
- Tool outputs displayed inline in the chat
- AI decides which tools to use based on your request
- Create unlimited chat tabs with the
+button - Each tab maintains its own conversation history
- Close tabs with the
×button - Named automatically (Chat 1, Chat 2, etc.)
- All conversations persist across Kate restarts
- Type
@to trigger file autocomplete - Fuzzy search across your project files
- Files are automatically read and included in the AI's context
- Example:
@src/main.cpp fix the null pointer issue
- All chat histories save automatically
- Survives Kate restarts
- Organized by project (git repository)
- Kate ≥ 23.08 (KTextEditor KF6)
- Qt 6.4+
- CMake 3.16+
- GCC/Clang with C++17 support
cd kate-agent-plugin
cmake -S . -B build
cmake --build build -j$(nproc)
sudo cmake --install build# Copy the library
sudo cp build/libkateagentplugin.so \
/usr/lib/x86_64-linux-gnu/qt6/plugins/kf6/ktexteditor/
# Copy the metadata file
sudo cp src/kateagentplugin.json \
/usr/lib/x86_64-linux-gnu/qt6/plugins/kf6/ktexteditor/- Open Kate
- Go to
Settings → Configure Kate → Plugins - Enable Kate Agent Plugin
- Restart Kate
- Press
Ctrl+Alt+Ato open the panel
- Type your request in the input field
- Use
@to mention specific files - Select the profile (Write/Ask/Minimal)
- Press Enter
The agent will respond and can:
- Read files
- Execute searches
- Modify code (with confirmation)
- Execute safe commands
When the agent proposes changes:
- Tab: Accept the suggestion
- Esc: Reject
- Shift+Tab: Accept line by line
Problem: The plugin cannot access Kate's integrated LSP Client.
What's missing:
- Jump to definition (CTRL+click)
- Cross-file symbol search
- Hover information
- Intelligent completion based on LSP
Current fallback:
- Regex search on open files
- Works only for symbols in documents currently open in Kate
- Does not index the entire project
Temporary solution:
- Enable Kate's "LSP Client" plugin (
Settings → Configure Kate → Plugins) - Install appropriate language servers (clangd, rust-analyzer, pylsp)
- Kate will handle them internally (but my plugin cannot use them directly)
Future plan:
- Wait for KTextEditor to expose a public API for the LSP client
- Or implement a standalone LSP client (complex, not priority)
| Feature | Status | Notes |
|---|---|---|
| Multi-file edit (batch) | Diff preview works, batch editing no | |
| Codebase indexing | ❌ No | Only open files, not entire project |
| LSP hover | ❌ No | Requires exposed LSP API |
| Go to definition | ❌ No | Requires real LSP |
| Test UI/E2E | 3/3 unit tests passing (93%) |
# Run all tests
cd build
ctest --output-on-failure
# Specific tests
./tests/test_configmanager
./tests/test_editorcontext
./tests/test_threadjsonstoragecmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build -j$(nproc)# Install to ~/.local
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$HOME/.local
cmake --build build
cmake --install build
# Manually copy to ~/.local/lib/qt6/plugins/ktexteditor/Set environment variable:
export KATEAGENT_DEBUG=1
kate