kader coding agent
Project description
Kader
Kader is an intelligent coding agent designed to assist with software development tasks. It provides a comprehensive framework for building AI-powered agents with advanced reasoning capabilities and tool integration.
Features
- ๐ค AI-powered Code Assistance - Support for multiple LLM providers:
- Ollama: Local LLM execution for privacy and speed.
- Ollama Cloud: Cloud-based models via ollama.com.
- Google Gemini: Cloud-based powerful models via the Google GenAI SDK.
- Anthropic: High-quality Claude models via the Anthropic SDK.
- ๐ฅ๏ธ Interactive CLI - Modern terminal interface built with Rich & prompt_toolkit:
- Beautiful Output: Markdown rendering, styled panels, and dynamic tables.
- Interactive Tools: Built-in interactive prompts for model selection and tool confirmation.
- ๐ ๏ธ Tool Integration - File system, command execution, web search, and more.
- ๐ง Memory Management - State persistence, conversation history, and isolated sub-agent memory.
- ๐ Session Management - Save and load conversation sessions.
- โจ๏ธ Keyboard Shortcuts - Efficient navigation and operations.
- ๐ YAML Configuration - Agent configuration via YAML files.
- ๐ Planner-Executor Framework - Sophisticated reasoning and acting architecture using task planning and delegation.
- ๐๏ธ File System Tools - Read, write, search, and edit files with automatic
.gitignorefiltering. - ๐ค Agent-As-Tool - Spawn sub-agents for specific tasks with isolated memory and automated context aggregation.
- ๐ฏ Agent Skills - Modular skill system for specialized domain knowledge and task-specific instructions.
- โก Special Commands - Create custom command agents from
CONTENT.mdfiles in~/.kader/commands
Installation
Prerequisites
Using uv (recommended)
# Clone the repository
git clone https://github.com/your-repo/kader.git
cd kader
# Install dependencies with uv
uv sync
# Run the CLI
uv run python -m cli
Using uv tool
With uv tool, you can install Kader globally and run it directly with the kader command:
# Install Kader globally using uv tool
uv tool install kader
# Run the CLI
kader
Using pip
# Clone the repository
git clone https://github.com/your-repo/kader.git
cd kader
# Install in development mode
pip install -e .
# Run the CLI
python -m cli
Quick Start
Running the CLI
# Run the Kader CLI using uv
uv run python -m cli
# Or using pip
python -m cli
First Steps in CLI
Once the CLI is running:
- Type any question to start chatting with the agent.
- Use
/helpto see available commands. - Use
/modelsto check and interactively switch available models. - Run terminal commands directly by prefixing with
!(e.g.!ls -la).
Configuration
When the kader module is imported for the first time, it automatically creates a .kader directory in your home directory and a .env file.
Environment Variables
The application automatically loads environment variables from ~/.kader/.env:
OLLAMA_API_KEY: API key for Ollama Cloud (for cloud models at ollama.com). Get your key from https://ollama.com/settingsGOOGLE_API_KEY: API key for Google Gemini (required for Google Provider).ANTHROPIC_API_KEY: API key for Anthropic Claude (required for Anthropic Provider).- Additional variables can be added to the
.envfile and will be automatically loaded.
Memory and Sessions
Kader stores data in ~/.kader/:
- Sessions:
~/.kader/memory/sessions/ - Configuration:
~/.kader/ - Memory files:
~/.kader/memory/ - Checkpoints:
~/.kader/memory/sessions/<session-id>/executors/(Aggregated context from sub-agents)
CLI Commands
| Command | Description |
|---|---|
/help |
Show command reference |
/models |
Show available models (Ollama local & cloud, Google & Anthropic) |
/clear |
Clear conversation |
/save |
Save current session |
/load <id> |
Load a saved session |
/sessions |
List saved sessions |
/skills |
List loaded skills |
/commands |
List special commands |
/cost |
Show usage costs |
/init |
Initialize .kader directory with KADER.md |
/exit |
Exit the CLI |
!cmd |
Run terminal command |
Keyboard Shortcuts
| Shortcut | Action |
|---|---|
Ctrl+C |
Cancel current operation |
Ctrl+D |
Exit the CLI |
Project Structure
kader/
โโโ cli/ # Interactive command-line interface
โ โโโ app.py # Main application entry point (Rich + prompt_toolkit)
โ โโโ utils.py # Constants and helpers
โ โโโ llm_factory.py # Provider selection logic
โ โโโ __init__.py # Package exports
โ โโโ commands/ # CLI command handlers
โ โโโ base.py # Base command class
โ โโโ initialize.py # /init command
โ โโโ README.md # CLI documentation
โโโ examples/ # Example implementations
โ โโโ memory_example.py # Memory management examples
โ โโโ google_example.py # Google Gemini provider examples
โ โโโ anthropic_example.py # Anthropic Claude provider examples
โ โโโ planner_executor_example.py # Advanced workflow examples
โ โโโ skills/ # Agent skills examples
โ โ โโโ hello/ # Greeting skill with instructions
โ โ โโโ calculator/ # Math calculation skill
โ โ โโโ react_agent.py # Skills demo with ReAct agent
โ โโโ README.md # Examples documentation
โโโ kader/ # Core framework
โ โโโ agent/ # Agent implementations (Planning, ReAct)
โ โโโ memory/ # Memory management & persistence
โ โโโ providers/ # LLM providers (Ollama, Google, Anthropic)
โ โโโ tools/ # Tools (File System, Web, Command, AgentTool)
โ โโโ prompts/ # Prompt templates (Jinja2)
โ โโโ utils/ # Utilities (Checkpointer, ContextAggregator)
โโโ pyproject.toml # Project dependencies
โโโ README.md # This file
โโโ uv.lock # Dependency lock file
Core Components
Agents
Kader provides a robust agent architecture:
- ReActAgent: Reasoning and Acting agent that combines thoughts with actions.
- PlanningAgent: High-level agent that breaks complex tasks into manageable plans.
- BaseAgent: Abstract base class for creating custom agent behaviors.
LLM Providers
Kader supports multiple backends:
- OllamaProvider: Connects to locally running Ollama instances.
- OllamaProvider (Cloud): Connects to cloud models at ollama.com (requires OLLAMA_API_KEY).
- GoogleProvider: High-performance access to Gemini models.
- AnthropicProvider: Full support for Claude models.
Agent-As-Tool (AgentTool)
The AgentTool allows a PlanningAgent (Architect) to delegate work to a ReActAgent (Worker). It features:
- Persistent Memory: Sub-agent conversations are saved to JSON.
- Context Aggregation: Sub-agent research and actions are automatically merged into the main session's
checkpoint.mdviaContextAggregator.
Agent Skills
Kader supports a modular skill system for domain-specific knowledge and specialized instructions:
- Skill Structure: Skills are defined as directories containing
SKILL.mdfiles with YAML frontmatter - Skill Loading: Skills are loaded from
~/.kader/skills(high priority) and./.kader/directories - Skill Injection: Available skills are automatically injected into the system prompt
- Skills Tool: Agents can load skills dynamically using the
skills_tool
Special Commands
Kader supports special commands โ custom command agents that can be invoked from the CLI:
- Command Structure: Commands are defined as directories containing
CONTENT.mdfiles - Command Loading: Commands are loaded from
./.kader/commands/(higher priority) and~/.kader/commands/ - Command Invocation: Use
/<command-name> <task>to execute a command - Memory Persistence: Command executions are saved to
~/.kader/memory/sessions/<session-id>/executors/<command-name>-<uuid>/conversation.json
Creating a Special Command
Create a command directory with a CONTENT.md file:
~/.kader/commands/mycommand/
โโโ CONTENT.md # Required - command instructions
โโโ templates/ # Optional - templates, scripts
โโโ assets/ # Optional - files
CONTENT.md format:
---
description: What this command does
---
# Command Instructions
Your command agent instructions here...
## Guidelines
- Guideline 1
- Guideline 2
Example: Lint and Test Command
~/.kader/commands/lint-test/
โโโ CONTENT.md
---
description: Lint and test the codebase
---
You are a Lint and Test Agent. Run linting and tests when requested.
## Instructions
1. Run: uv run ruff check .
2. Run: uv run ruff format --check .
3. Run: uv run pytest -v
4. Report results
Usage:
/lint-test
/lint-test run full check
Use /commands to list all available special commands.
File System Tools with Gitignore Filtering
The file system tools (read_directory, grep, glob) automatically filter out files and directories that match patterns defined in .gitignore files.
You can disable this filtering by passing apply_gitignore_filter=False when creating tools:
from pathlib import Path
from kader.tools.filesys import get_filesystem_tools
# With filtering (default)
tools = get_filesystem_tools(base_path=Path.cwd())
# Without filtering
tools = get_filesystem_tools(base_path=Path.cwd(), apply_gitignore_filter=False)
Example skill structure:
~/.kader/skills/hello/
โโโ SKILL.md
โโโ scripts/
โโโ hello.py
Example skill (SKILL.md):
---
name: hello
description: Skill for ALL greeting requests
---
# Hello Skill
This skill provides the greeting format you must follow.
## How to greet
Always greet the user with:
- A warm welcome
- Their name if mentioned
- A friendly emoji
Memory Management
- SlidingWindowConversationManager: Maintains context within token limits.
- PersistentSlidingWindowConversationManager: Auto-saves sub-agent history.
- Checkpointer: Generates markdown summaries of agent actions.
Development
Setting up for Development
# Clone the repository
git clone https://github.com/your-repo/kader.git
cd kader
# Install in development mode with uv
uv sync
# Run the CLI
uv run python -m cli
Running Tests
# Run tests with uv
uv run pytest
# Run tests with specific options
uv run pytest --verbose
Code Quality
Kader uses various tools for maintaining code quality:
# Run linter
uv run ruff check .
# Format code
uv run ruff format .
Troubleshooting
Common Issues
- No models found: Ensure your providers are correctly configured. For Ollama, run
ollama serve. For Google, ensureGOOGLE_API_KEYis set. For Anthropic, ensureANTHROPIC_API_KEYis set. - Connection errors: Verify internet access for cloud providers and local service availability for Ollama.
Contributing
We welcome contributions! Please see CONTRIBUTING.md for detailed guidelines on:
- Setting up your development environment
- Code style guidelines
- Running tests
- Submitting pull requests
Quick Start for Contributors
# Fork and clone
git clone https://github.com/your-username/kader.git
cd kader
# Install dependencies
uv sync
# Run tests
uv run pytest
# Run linter
uv run ruff check .
Coding with AI
This project includes a specialized skill for AI coding agents. When working with AI assistants on this codebase, they should use the contributing-to-kader skill located in .kader/skills/contributing-to-kader. This skill provides AI agents with essential guidelines including:
- Core development rules (linting, formatting, testing)
- Key commands for development workflow
- Project structure overview
- Best practices for contributing
AI assistants can load this skill using the skills_tool to get specialized instructions for working with this project.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Built with Rich and prompt_toolkit for the beautiful CLI interface.
- Uses Ollama for local LLM execution.
- Powered by Google Gemini for advanced cloud-based reasoning.
- Enhanced by Anthropic Claude for high-quality coding assistance.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kader-2.7.5.tar.gz.
File metadata
- Download URL: kader-2.7.5.tar.gz
- Upload date:
- Size: 981.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
056e0f672020bb71b7cc56b3e6be37e1741f9dca1184642028a90bbab80b5b5c
|
|
| MD5 |
54e2f385538ac3cc70c7934c0533d189
|
|
| BLAKE2b-256 |
7a1a9551c98ec8b04a5567c1ab295c12038cfcac62ce3cc761e504350ac54f54
|
File details
Details for the file kader-2.7.5-py3-none-any.whl.
File metadata
- Download URL: kader-2.7.5-py3-none-any.whl
- Upload date:
- Size: 168.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26daad160b2bce2ba164a49bcc99e5b49e1e10b9a4ef039bfd501e0e5172d304
|
|
| MD5 |
d1efaa83c1ea9a3824808564e1b9292d
|
|
| BLAKE2b-256 |
da63471038ac63f9a2d949b189c0a870beac4f0d331d96ca3e0a93538195e010
|