Skip to main content

kota/kota_code/
mod.rs

1//! # Kota Code - AI Code Agent Library
2//!
3//! Kota Code is a lightweight AI code agent library that provides a comprehensive set of tools
4//! for building AI-powered code assistants. It supports multiple LLM providers and comes
5//! with built-in file operations, code analysis, and task management capabilities.
6//!
7//! ## Quick Start
8//!
9//! ```rust,ignore
10//! use kota::kota_code::{AgentBuilder, ContextManager, SkillManager};
11//! use anyhow::Result;
12
13//! #[tokio::main]
14//! async fn main() -> Result<()> {
15//!     // Create context and skill managers
16//!     let context = ContextManager::new(".chat_sessions", "my-session".to_string())?;
17//!     let skill_manager = SkillManager::new();
18
19//!     // Create an agent instance with context and skills
20//!     let agent_instance = AgentBuilder::new(
21//!         "your-api-key".to_string(),
22//!         "gpt-4".to_string()
23//!     )?
24//!     .with_context(context)
25//!     .with_skill_manager(skill_manager)
26//!     .build()?;
27
28//!     // Access the agent, context, and skill manager
29//!     // agent_instance.agent
30//!     // agent_instance.context()
31//!     // agent_instance.skill_manager()
32
33//!     Ok(())
34//! }
35//! ```
36//!
37//! ## Features
38//!
39//! - **Multiple LLM Providers**: OpenAI, Anthropic, DeepSeek, Cohere, Ollama
40//! - **File Operations**: Read, write, edit, delete files with built-in tools
41//! - **Code Analysis**: Scan codebase, grep search, pattern matching
42//! - **Task Management**: Plan mode with task dependencies and status tracking
43//! - **Skills System**: Specialized agent behaviors (code review, refactoring, debugging, documentation)
44//! - **Context Management**: Persistent conversation history with session support
45//! - **Extensible**: Easy to add custom tools and behaviors
46
47// Core modules
48pub mod agent;
49pub mod context;
50pub mod mcp;
51pub mod plan;
52pub mod runtime;
53pub mod skills;
54pub mod tools;
55
56// Re-export commonly used types for convenience
57pub use agent::{create_agent, AgentBuilder, AgentInstance, AgentType, Provider};
58pub use context::{ContextManager, SerializableMessage, SessionMetadata};
59pub use mcp::{client::McpClient, McpManager};
60pub use plan::{Plan, PlanManager, Task, TaskStatus};
61pub use runtime::{CommandDef, KotaConfig, SessionIdHook, ToolRegistry};
62pub use skills::{Skill, SkillManager};
63pub use tools::{
64    FileToolError, WrappedCreateDirectoryTool, WrappedDeleteFileTool, WrappedEditFileTool,
65    WrappedExecuteBashCommandTool, WrappedGrepSearchTool, WrappedReadFileTool,
66    WrappedScanCodebaseTool, WrappedUpdatePlanTool, WrappedWriteFileTool,
67};
68
69/// Prelude module for convenient imports
70pub mod prelude {
71    pub use super::agent::{create_agent, AgentBuilder, AgentInstance, AgentType, Provider};
72    pub use super::context::{ContextManager, SerializableMessage, SessionMetadata};
73    pub use super::mcp::{client::McpClient, McpManager};
74    pub use super::plan::{Plan, PlanManager, Task, TaskStatus};
75    pub use super::runtime::{CommandDef, KotaConfig, SessionIdHook, ToolRegistry};
76    pub use super::skills::{Skill, SkillManager};
77    pub use super::tools::FileToolError;
78}