7 unstable releases (3 breaking)
Uses new Rust 2024
| 0.4.1 | Jun 8, 2026 |
|---|---|
| 0.4.0 | Apr 5, 2026 |
| 0.3.2 | Apr 1, 2026 |
| 0.2.0 | Mar 9, 2026 |
| 0.1.0 | Mar 9, 2026 |
#1033 in Network programming
1,877 downloads per month
Used in 9 crates
81KB
1.5K
SLoC
agent-kit
Toolkit for CLI tools integrating with AI agent loops.
agent-kit provides shared infrastructure so CLI tools can install skill definitions, detect agent environments, coordinate across sessions, and integrate cleanly with any AI coding assistant — Claude Code, Codex, OpenCode, Pi, Grok, or plain API calls.
Features
- Skill Management — Install, check, and uninstall SKILL.md files for agent environments
- Environment Detection — Auto-detect Claude Code, OpenCode, Codex, or generic environments
- Hook System (
hooksfeature) — File-based event coordination between multiple agent sessionsHookRegistry— fire/poll/gc events in.agent-doc/hooks/directoriesHookTransporttrait — abstract delivery (file, Unix socket, chain)FileTransport— JSON file events, always availableSocketTransport— Unix domain socket delivery with ack protocolChainTransport— try transports in order until one succeeds
- Instruction Audit (
auditfeature) — Validate instruction files viainstruction-filescrate
Usage
Add to your Cargo.toml:
[dependencies]
agent-kit = "0.4"
# Optional features:
# agent-kit = { version = "0.4", features = ["hooks"] }
# agent-kit = { version = "0.4", features = ["audit"] }
Skill Management
Bundle a SKILL.md in your crate and use SkillConfig to manage installation:
use agent_kit::skill::SkillConfig;
const BUNDLED_SKILL: &str = include_str!("../SKILL.md");
const VERSION: &str = env!("CARGO_PKG_VERSION");
fn main() -> anyhow::Result<()> {
let config = SkillConfig::new("my-tool", BUNDLED_SKILL, VERSION);
// Install to .claude/skills/my-tool/SKILL.md
config.install(None)?;
// Check if installed version matches bundled version
let up_to_date = config.check(None)?;
// Remove installed skill
config.uninstall(None)?;
Ok(())
}
Hook System
Coordinate multiple agent sessions via file-based events:
use agent_kit::hooks::{HookRegistry, Event, FileTransport, SocketTransport, ChainTransport, HookTransport};
let registry = HookRegistry::new(".agent-doc/hooks");
// Fire an event
registry.fire("post_write", Event {
file: "doc.md".into(),
session_id: "abc123".into(),
data: serde_json::json!({"patches": 3}),
})?;
// Poll for events
let events = registry.poll("post_write", last_poll_timestamp)?;
// Deliver via transport chain (socket first, file fallback)
let transport = ChainTransport::new(vec![
Box::new(SocketTransport::from_project_root(Path::new("."))),
Box::new(FileTransport::new(".agent-doc/hooks")),
]);
registry.fire_and_deliver("post_write", event, &transport, &target_sessions)?;
Roadmap
- Structured output for agents (
--agent-outputflag support) - Context injection (CLAUDE.md / AGENTS.md management)
- MCP tool description generation
- MCP transport for hook delivery
License
MIT
Dependencies
~1.8–3.5MB
~56K SLoC