From ac97f38596fcd8603d3d3c535d4001bcdbdedddd Mon Sep 17 00:00:00 2001 From: Layne Penney Date: Mon, 9 Feb 2026 06:08:51 -0600 Subject: [PATCH] feat: add Claude Code skill files for codi and codi-rs Add skill definitions so Claude Code can discover and use codi-specific context when working in the TypeScript or Rust codebases. Updates .gitignore to allow .claude/skills/ while keeping other .claude/ data ignored. Co-Authored-By: Claude Opus 4.6 --- .claude/skills/codi-rs/SKILL.md | 77 ++++++++++++++++++++++++++++ .claude/skills/codi/SKILL.md | 91 +++++++++++++++++++++++++++++++++ .gitignore | 3 +- 3 files changed, 170 insertions(+), 1 deletion(-) create mode 100644 .claude/skills/codi-rs/SKILL.md create mode 100644 .claude/skills/codi/SKILL.md diff --git a/.claude/skills/codi-rs/SKILL.md b/.claude/skills/codi-rs/SKILL.md new file mode 100644 index 00000000..1a096455 --- /dev/null +++ b/.claude/skills/codi-rs/SKILL.md @@ -0,0 +1,77 @@ +--- +name: codi-rs +description: Codi AI coding wingman (Rust implementation). Use when working on the Rust port in codi-rs/ - the agent, TUI, providers, tools, MCP, or any Rust source. +allowed-tools: Bash(cargo *) +--- + +# Codi Rust Implementation + +Rust port of Codi, located in `codi-rs/` within the codi repo. + +## Build / Test / Bench + +```bash +cd codi-rs +cargo build # Debug build +cargo build --release # Release build +cargo test # Run tests +cargo test -- --nocapture # Show output +cargo clippy # Lint +cargo fmt # Format +cargo bench # Run benchmarks +``` + +## Architecture + +``` +src/ +├── main.rs # CLI entry (clap) +├── lib.rs # Library exports +├── agent/ # Core agent loop +├── cli/ # CLI command implementations +├── config/ # Configuration +├── providers/ # AI model backends +├── tools/ # Filesystem interaction tools +├── tui/ # Terminal UI (ratatui + crossterm) +├── mcp/ # Model Context Protocol (rmcp) +├── orchestrate/ # Multi-agent orchestration +├── rag/ # RAG system (embeddings) +├── symbol_index/ # SQLite code navigation (tree-sitter) +├── model_map/ # Multi-model orchestration +├── session/ # Session persistence +├── lsp/ # Language Server Protocol +├── completion/ # Shell completions +├── telemetry/ # Tracing and metrics +├── error.rs # Error types +└── types.rs # Core types +``` + +## Key Dependencies + +- **tokio** - Async runtime +- **clap** - CLI argument parsing +- **ratatui + crossterm** - Terminal UI +- **reqwest** - HTTP client +- **serde + serde_json + serde_yaml** - Serialization +- **tree-sitter** - Code parsing for symbol index +- **rmcp** - MCP protocol +- **rusqlite** - SQLite for symbol index +- **indicatif** - Progress bars + +## Coding Conventions + +- **anyhow** for application errors, **thiserror** for library errors +- **async-trait** for async trait methods +- Use `colored` for terminal output +- Follow standard Rust idioms (clippy clean) +- Tests alongside modules or in `tests/` + +## Feature Flags + +```toml +[features] +default = ["telemetry"] +telemetry = [] # Tracing spans and metrics +release-logs = ["tracing/release_max_level_info"] # Strip debug logs in release +max-perf = ["tracing/max_level_off"] # Disable all tracing +``` diff --git a/.claude/skills/codi/SKILL.md b/.claude/skills/codi/SKILL.md new file mode 100644 index 00000000..5cb09148 --- /dev/null +++ b/.claude/skills/codi/SKILL.md @@ -0,0 +1,91 @@ +--- +name: codi +description: Codi AI coding wingman (TypeScript CLI). Use when working on the codi TypeScript codebase - the agent loop, tools, commands, providers, or any TypeScript source. +allowed-tools: Bash(pnpm *), Bash(npx *) +--- + +# Codi TypeScript CLI + +Codi is an AI coding wingman for the terminal - a TypeScript CLI supporting multiple AI providers (Claude, OpenAI, Ollama). + +## Build / Dev / Test + +```bash +pnpm install # Install dependencies +pnpm build # Compile TypeScript to JavaScript +pnpm dev # Run with ts-node (dev mode) +pnpm test # Run Vitest tests +pnpm test:watch # Watch mode +``` + +## Architecture + +``` +src/ +├── index.ts # CLI entry, REPL loop +├── agent.ts # Core agent loop (model + tools orchestration) +├── config.ts # Workspace configuration (.codi.json) +├── context.ts # Project detection (Node, Python, Rust, Go) +├── session.ts # Session persistence +├── types.ts # TypeScript interfaces +├── logger.ts # Level-aware logging (NORMAL/VERBOSE/DEBUG/TRACE) +├── spinner.ts # Ora spinner manager +├── compression.ts # Entity-based context compression +├── commands/ # Slash command system (/git, /save, /config, etc.) +├── providers/ # AI model backends (Anthropic, OpenAI, Ollama) +├── tools/ # Filesystem interaction tools (read, write, edit, grep, etc.) +├── orchestrate/ # Multi-agent orchestration (parallel workers via IPC) +├── rag/ # Semantic code search (embeddings + vectra) +├── model-map/ # Multi-model orchestration (docker-compose style) +└── symbol-index/ # SQLite-based code navigation +``` + +## Key Patterns + +- **Provider Abstraction**: `BaseProvider` + factory pattern. Add backends in `src/providers/`. +- **Tool Registry**: Self-describing tools with JSON schema definitions in `src/tools/`. +- **Slash Commands**: `src/commands/` with `registerCommand()`. +- **Streaming-First**: Provider `streamChat()` for incremental text display. +- **Context Compaction**: Auto-summarization when approaching token limits. + +## Coding Conventions + +- **ES Modules** with `.js` extension in imports (even for `.ts` files) +- **Async/Await** over callbacks +- **TypeScript interfaces**, avoid `any` +- **Vitest** for testing (`tests/` directory) +- Error handling: tools catch errors and return descriptive messages + +## Adding a Tool + +```typescript +// 1. Create src/tools/my-tool.ts +export class MyTool extends BaseTool { + getDefinition(): ToolDefinition { /* JSON schema */ } + async execute(input: Record): Promise { /* logic */ } +} +// 2. Register in src/tools/index.ts +registry.register(new MyTool()); +``` + +## Adding a Command + +```typescript +// In src/commands/*.ts +export const myCommand: Command = { + name: 'mycommand', + aliases: ['mc'], + description: 'Description', + usage: '/mycommand ', + execute: async (args, context) => `Prompt for AI: ${args}`, +}; +registerCommand(myCommand); +``` + +## Adding a Provider + +```typescript +// 1. Create src/providers/my-provider.ts extending BaseProvider +// 2. Implement: chat(), streamChat(), getName(), getModel(), supportsToolUse() +// 3. Add to createProvider() in src/providers/index.ts +``` diff --git a/.gitignore b/.gitignore index 877b98f1..6ff1f1c8 100644 --- a/.gitignore +++ b/.gitignore @@ -30,7 +30,8 @@ npm-debug.log* coverage/ # Local settings -.claude/ +.claude/* +!.claude/skills/ *.code-review .codi.local.json