From 68c7661409108897304a97a51a90c733e7b3005c Mon Sep 17 00:00:00 2001 From: Layne Penney Date: Mon, 26 Jan 2026 07:30:50 -0600 Subject: [PATCH 1/4] docs: remove redundancies and clean up CODI.md - Remove duplicate paragraph in Codi's Capabilities section - Remove duplicate non-interactive mode examples from Quick Reference - Fix chaotic feature numbering in Lower Priority section (reordered to 12-31) - Remove redundant security vulnerability paragraph Wingman: Codi --- CODI.md | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/CODI.md b/CODI.md index 34ac9f8..5b91eff 100644 --- a/CODI.md +++ b/CODI.md @@ -44,9 +44,7 @@ grep("saveSession", "src/") // Finds all references to saveSession get_context_status() // Checks current context usage ``` -This project's architecture anticipates intelligent tool use and context management. - -**Codi** is your AI coding wingman for the terminal - a CLI tool that supports multiple AI providers (Claude, OpenAI, Ollama, Ollama Cloud, RunPod). It enables developers to work with AI models through a conversational interface while giving the AI access to filesystem tools. +**Codi** is your AI coding wingman for the terminal - a CLI tool that supports multiple AI providers (Claude, OpenAI, Ollama, Ollama Cloud, RunPod). It enables developers to work with AI models through a conversational interface while giving the AI access to filesystem tools, and this project's architecture anticipates intelligent tool use and context management. ## Quick Reference @@ -60,11 +58,6 @@ pnpm test:watch # Watch mode # Interactive mode (default) ANTHROPIC_API_KEY=... pnpm dev -# Non-interactive mode (single prompt and exit) -codi -P "explain this code" -f json # JSON output -codi --prompt "fix the bug" --quiet # Suppress spinners -codi -P "write tests" -y # Auto-approve all tools - # Testing with different providers ANTHROPIC_API_KEY=... pnpm dev OPENAI_API_KEY=... pnpm dev -- --provider openai @@ -853,7 +846,7 @@ export default { ### Lower Priority / Nice to Have -#### 9. Interactive File Selection +#### 12. Interactive File Selection **What**: Fuzzy file finder for commands. **Implementation**: @@ -863,7 +856,7 @@ export default { **Dependencies**: `inquirer` or `prompts` package -#### 10. Parallel Tool Execution +#### 13. Parallel Tool Execution **What**: Execute independent tools concurrently. **Implementation**: @@ -874,7 +867,7 @@ export default { **Files to modify**: - Modify: `src/agent.ts` (parallel execution logic) -#### 16. Web Search Tool - IMPLEMENTED +#### 21. Web Search Tool - IMPLEMENTED **Status**: Complete @@ -907,7 +900,7 @@ Search results for: "TypeScript 5.0 features" - `src/tools/web-search.ts` - Web search tool implementation - `tests/web-search.test.ts` - Unit tests -#### 17. Multi-Model Orchestration - IMPLEMENTED +#### 22. Multi-Model Orchestration - IMPLEMENTED **Status**: Complete @@ -956,7 +949,7 @@ codi --summarize-provider anthropic --summarize-model claude-3-5-haiku-latest - `src/agent.ts` - `getSummaryProvider()` method - `tests/multi-model.test.ts` - Unit tests -#### 18. Model Map (Multi-Model Orchestration) - COMPLETE +#### 23. Model Map (Multi-Model Orchestration) - COMPLETE **Status**: Complete (Phases 1-3 + Model Roles) @@ -1100,7 +1093,7 @@ pipelines: - [ ] Config hot-reload support (watch file changes) - [ ] Cost tracking per model/pipeline -#### 19. Multi-Agent Orchestration - IMPLEMENTED +#### 24. Multi-Agent Orchestration - IMPLEMENTED **Status**: Complete @@ -1186,7 +1179,7 @@ codi - ✅ Ollama (glm-4.7:cloud, qwen3-coder:480b-cloud) - ✅ OpenAI -#### 20. Symbol Index - IMPLEMENTED +#### 25. Symbol Index - IMPLEMENTED **Status**: Complete @@ -1216,7 +1209,7 @@ codi - [ ] Symbol rename/refactor support - [ ] Call graph tracking -#### 15. Code Snippets Library +#### 26. Code Snippets Library **What**: Save and reuse code snippets. **Implementation**: @@ -1224,7 +1217,7 @@ codi - Add `/snippet save ` and `/snippet use ` commands - Support tags and search -#### 16. Multi-file Refactoring +#### 27. Multi-file Refactoring **What**: Coordinated changes across multiple files. **Implementation**: @@ -1233,7 +1226,7 @@ codi - Generate coordinated edit plan - Apply changes atomically (all or nothing) -#### 12. Test Runner Integration - IMPLEMENTED +#### 29. Test Runner Integration - IMPLEMENTED **Status**: Complete @@ -1254,7 +1247,7 @@ codi - `src/tools/run-tests.ts` - Test runner tool implementation - `tests/run-tests.test.ts` - Comprehensive test coverage -#### 13. Context Optimization - IMPLEMENTED +#### 30. Context Optimization - IMPLEMENTED **Status**: Complete @@ -1284,7 +1277,7 @@ codi - `-c, --compress` - Enable context compression (entity normalization) at startup - Automatic compaction happens regardless of flag when needed -#### 14. RAG System (Embeddings) - IMPLEMENTED +#### 31. RAG System (Embeddings) - IMPLEMENTED **Status**: Complete @@ -1311,7 +1304,7 @@ codi - OpenAI API key (for embeddings) - Automatic fallback if unavailable -#### 15. Debug UI - IMPLEMENTED +#### 28. Debug UI - IMPLEMENTED **Status**: Complete @@ -1476,8 +1469,6 @@ See `workflow-status-roadmap.md` for detailed roadmap: **Status**: ✅ **Production Ready** - Workflow execution fully functional -Previous versions had a vulnerability where chained commands like `!echo "?" | pnpm dev --quiet` only required permission for the first command (`echo`) but would silently execute subsequent commands (`pnpm`). This has been fixed by requiring explicit permission for ALL commands in a chain. - ### AI-Powered Security Model Validation Codi supports optional AI-powered security analysis for bash commands using a local Ollama model. When enabled, commands are analyzed for security risks before user confirmation. From dbd4139c863853bd4412e485ef41404165ecd338 Mon Sep 17 00:00:00 2001 From: Layne Penney Date: Mon, 26 Jan 2026 10:07:35 -0600 Subject: [PATCH 2/4] docs: fix sequential feature numbering in CODI.md - Renumbered features from chaotic sequence to clean 1-24 numbering - Removed gap between features 13 and 21 by integrating implemented features - Fixed duplicate entries by properly organizing Lower Priority section - Updated Implementation Priority Recommendation to match feature order - No content removed - only organizational improvements Wingman: Codi --- CODI.md | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/CODI.md b/CODI.md index 5b91eff..c91f967 100644 --- a/CODI.md +++ b/CODI.md @@ -867,7 +867,7 @@ export default { **Files to modify**: - Modify: `src/agent.ts` (parallel execution logic) -#### 21. Web Search Tool - IMPLEMENTED +#### 14. Web Search Tool - IMPLEMENTED **Status**: Complete @@ -900,7 +900,7 @@ Search results for: "TypeScript 5.0 features" - `src/tools/web-search.ts` - Web search tool implementation - `tests/web-search.test.ts` - Unit tests -#### 22. Multi-Model Orchestration - IMPLEMENTED +#### 15. Multi-Model Orchestration - IMPLEMENTED **Status**: Complete @@ -949,7 +949,7 @@ codi --summarize-provider anthropic --summarize-model claude-3-5-haiku-latest - `src/agent.ts` - `getSummaryProvider()` method - `tests/multi-model.test.ts` - Unit tests -#### 23. Model Map (Multi-Model Orchestration) - COMPLETE +#### 16. Model Map (Multi-Model Orchestration) - COMPLETE **Status**: Complete (Phases 1-3 + Model Roles) @@ -1093,7 +1093,7 @@ pipelines: - [ ] Config hot-reload support (watch file changes) - [ ] Cost tracking per model/pipeline -#### 24. Multi-Agent Orchestration - IMPLEMENTED +#### 17. Multi-Agent Orchestration - IMPLEMENTED **Status**: Complete @@ -1179,7 +1179,7 @@ codi - ✅ Ollama (glm-4.7:cloud, qwen3-coder:480b-cloud) - ✅ OpenAI -#### 25. Symbol Index - IMPLEMENTED +#### 18. Symbol Index - IMPLEMENTED **Status**: Complete @@ -1209,7 +1209,7 @@ codi - [ ] Symbol rename/refactor support - [ ] Call graph tracking -#### 26. Code Snippets Library +#### 19. Code Snippets Library **What**: Save and reuse code snippets. **Implementation**: @@ -1217,7 +1217,7 @@ codi - Add `/snippet save ` and `/snippet use ` commands - Support tags and search -#### 27. Multi-file Refactoring +#### 20. Multi-file Refactoring **What**: Coordinated changes across multiple files. **Implementation**: @@ -1226,7 +1226,7 @@ codi - Generate coordinated edit plan - Apply changes atomically (all or nothing) -#### 29. Test Runner Integration - IMPLEMENTED +#### 21. Test Runner Integration - IMPLEMENTED **Status**: Complete @@ -1247,7 +1247,7 @@ codi - `src/tools/run-tests.ts` - Test runner tool implementation - `tests/run-tests.test.ts` - Comprehensive test coverage -#### 30. Context Optimization - IMPLEMENTED +#### 22. Context Optimization - IMPLEMENTED **Status**: Complete @@ -1277,7 +1277,7 @@ codi - `-c, --compress` - Enable context compression (entity normalization) at startup - Automatic compaction happens regardless of flag when needed -#### 31. RAG System (Embeddings) - IMPLEMENTED +#### 23. RAG System (Embeddings) - IMPLEMENTED **Status**: Complete @@ -1304,7 +1304,7 @@ codi - OpenAI API key (for embeddings) - Automatic fallback if unavailable -#### 28. Debug UI - IMPLEMENTED +#### 24. Debug UI - IMPLEMENTED **Status**: Complete @@ -1357,15 +1357,22 @@ For maximum impact with reasonable effort: 4. ~~**Diff Preview** - Safety improvement~~ DONE 5. ~~**Undo System** - Safety net for file changes~~ DONE 6. ~~**Cost Tracking** - API usage and cost monitoring~~ DONE -7. ~~**Test Runner** - Automated test execution~~ DONE -8. ~~**Context Optimization** - Smart compaction and deduplication~~ DONE -9. ~~**RAG System** - Semantic code search~~ DONE -10. ~~**Debug UI** - Spinners and graduated verbosity~~ DONE +7. ~~**Plugin System** - Third-party extensions (DISABLED)~~ DONE +8. ~~**Vision Support** - Image analysis capabilities~~ DONE +9. ~~**Interactive File Selection** - Fuzzy file finder (LOWER PRIORITY)~~ PLANNED +10. ~~**Parallel Tool Execution** - Concurrent operations (LOWER PRIORITY)~~ PLANNED 11. ~~**Web Search** - Search web via DuckDuckGo~~ DONE 12. ~~**Multi-Model Orchestration** - Use cheaper models for summarization~~ DONE 13. ~~**Model Map** - Docker-compose style multi-model config~~ DONE (Phases 1-3 complete) 14. ~~**Multi-Agent Orchestration** - Parallel agents with IPC permission bubbling~~ DONE -15. ~~**Security Model Validation** - AI-powered security analysis for bash commands~~ DONE +15. ~~**Symbol Index** - Code navigation enhancements~~ DONE +16. ~~**Code Snippets Library** - Code reuse system (LOWER PRIORITY)~~ PLANNED +17. ~~**Multi-file Refactoring** - Coordinated changes (LOWER PRIORITY)~~ PLANNED +18. ~~**Test Runner** - Automated test execution~~ DONE +19. ~~**Context Optimization** - Smart compaction and deduplication~~ DONE +20. ~~**RAG System** - Semantic code search~~ DONE +21. ~~**Debug UI** - Spinners and graduated verbosity~~ DONE +22. ~~**Security Model Validation** - AI-powered security analysis for bash commands~~ DONE ## Security Guidelines From 42bdd0bee1687fa74d295cffec0a4652bcc2eafb Mon Sep 17 00:00:00 2001 From: Layne Penney Date: Mon, 26 Jan 2026 11:56:35 -0600 Subject: [PATCH 3/4] feat(compact): add debug subcommand for context window inspection Adds a new /compact debug subcommand that provides detailed information about the current context window contents including: - Token counts by category (messages, system prompt, tool definitions) - Message breakdown by role (user, assistant, tool results) - Current limits and budget information - Compression status and statistics - Working set file count - Message previews with content length information This helps developers understand what's consuming context space and troubleshoot context-related issues. Wingman: Codi --- src/commands/compact-commands.ts | 50 ++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/src/commands/compact-commands.ts b/src/commands/compact-commands.ts index a7d0dff..f0185ea 100644 --- a/src/commands/compact-commands.ts +++ b/src/commands/compact-commands.ts @@ -17,7 +17,7 @@ export const compactCommand: Command = { name: 'compact', aliases: ['summarize', 'compress', 'compression'], description: 'Manage context size through summarization and compression', - usage: '/compact [summarize|compress|status|memory] [options]', + usage: '/compact [summarize|compress|status|memory|debug] [options]', taskType: 'fast', execute: async (args: string, context: CommandContext): Promise => { if (!context.agent) { @@ -28,6 +28,52 @@ export const compactCommand: Command = { const subcommand = parts[0] || 'status'; const subArgs = parts.slice(1).join(' '); + // /compact debug - Show detailed context debugging info + if (subcommand === 'debug') { + const info = context.agent.getContextInfo(); + const messages = context.agent.getMessages(); + const snapshot = context.agent.getStateSnapshot(); + + // Build detailed debug output + const debugInfo = { + context: { + tokens: info.tokens, + messageTokens: info.messageTokens, + systemPromptTokens: info.systemPromptTokens, + toolDefinitionTokens: info.toolDefinitionTokens, + messages: info.messages, + userMessages: info.userMessages, + assistantMessages: info.assistantMessages, + toolResultMessages: info.toolResultMessages, + }, + limits: { + maxTokens: info.maxTokens, + contextWindow: info.contextWindow, + effectiveLimit: info.effectiveLimit, + outputReserve: info.outputReserve, + safetyBuffer: info.safetyBuffer, + tierName: info.tierName, + }, + state: { + hasSummary: info.hasSummary, + compressionEnabled: info.compressionEnabled, + compressionStats: info.compression, + workingSetFiles: info.workingSetFiles, + }, + messages: messages.map((msg, index) => ({ + index, + role: msg.role, + contentPreview: typeof msg.content === 'string' + ? msg.content.slice(0, 200) + (msg.content.length > 200 ? '...' : '') + : `[complex content: ${msg.content.length} blocks]`, + contentLength: typeof msg.content === 'string' ? msg.content.length : msg.content.reduce((acc, block) => acc + (typeof block.text === 'string' ? block.text.length : 0), 0), + })), + conversationSummary: info.hasSummary ? '[summary exists - use /compact status for token info]' : null, + }; + + return `CONTEXT_DEBUG:${JSON.stringify(debugInfo, null, 2)}`; + } + // /compact memory - Show memory usage if (subcommand === 'memory') { const monitor = getMemoryMonitor(); @@ -146,7 +192,7 @@ export const compactCommand: Command = { return `COMPRESS_STATS:${JSON.stringify(output)}`; } - return `COMPACT_ERROR:Unknown subcommand "${subcommand}". Use: status, summarize, compress`; + return `COMPACT_ERROR:Unknown subcommand "${subcommand}". Use: status, summarize, compress, debug`; }, }; From e0fb5266a493c3119d46332c9c72e9ef3542d22e Mon Sep 17 00:00:00 2001 From: Layne Penney Date: Mon, 26 Jan 2026 12:49:26 -0600 Subject: [PATCH 4/4] fix: remove unused snapshot variable from debug subcommand --- src/commands/compact-commands.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/commands/compact-commands.ts b/src/commands/compact-commands.ts index f0185ea..99f6cfa 100644 --- a/src/commands/compact-commands.ts +++ b/src/commands/compact-commands.ts @@ -32,7 +32,6 @@ export const compactCommand: Command = { if (subcommand === 'debug') { const info = context.agent.getContextInfo(); const messages = context.agent.getMessages(); - const snapshot = context.agent.getStateSnapshot(); // Build detailed debug output const debugInfo = {