Conversation
- Cost tracking module (src/cost.rs): Per-model pricing, session/turn aggregation, /cost command, token usage in stats line and transcripts - Add -O flag for optimization mode (terse, token-efficient output) - Config validation: Validate targets, thresholds, hook regexes, MCP configs - Tool filter consolidation (src/tool_filter.rs): Unified pattern matching for policy.rs and subagent.rs (exact, wildcards, argument patterns) - Regex caching in plan.rs using once_cell::Lazy - 58 tests passing, clippy clean 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Layer 1: Replace verbose 60-token system prompt with terse 15-token
version using positive framing ("AI-to-AI mode. Maximum information
density. Structure over prose. No narration.")
Layer 2: Add SchemaOptions struct for extensibility and implement
compressed tool schemas that strip descriptions in optimize mode
(e.g., "Read file content. Paths relative to project root." → "Read file").
Also adds IDEAS.md documenting future optimization layers (result
compression, history summarization, output style enforcement).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Features implemented: - Context compaction: /compact command to summarize older messages and reclaim context space when conversations grow long - Slash commands: User-defined markdown commands in .yo/commands/<name>.md with $ARGUMENTS placeholder and optional YAML frontmatter - HTTP/SSE MCP transport: Support for HTTP and SSE transports in addition to stdio for Model Context Protocol servers - force_continue: Stop hooks can now request continuation with a new prompt New files: - src/compact.rs: Context compaction/summarization module - src/commands.rs: Slash commands system 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR implements multiple major features including token optimization mode (-O flag), comprehensive cost tracking, context compaction, user-defined slash commands, and HTTP/SSE transport support for MCP servers. It also consolidates tool filtering logic and adds configuration validation.
Key changes:
- Token optimization system with compressed tool schemas and AI-to-AI communication mode
- Session-level cost tracking with per-model pricing and turn-by-turn breakdown
- Context compaction to manage conversation history and reduce token usage
- User-defined slash commands loaded from
.yo/commands/directories - HTTP and SSE transport support for MCP servers alongside existing stdio
- Configuration validation with detailed error reporting
- Consolidated tool pattern matching logic into dedicated module
Reviewed changes
Copilot reviewed 28 out of 29 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
src/transcript.rs |
Adds token_usage logging method for tracking LLM API calls |
src/tools/write.rs |
Implements schema optimization with terse descriptions when -O flag is set |
src/tools/task.rs |
Adds optimized schema support for Task tool delegation |
src/tools/read.rs |
Implements compressed schema for file reading operations |
src/tools/mod.rs |
Introduces SchemaOptions struct for controlling schema verbosity |
src/tools/grep.rs |
Adds schema optimization for grep search operations |
src/tools/glob.rs |
Implements terse schema for file pattern matching |
src/tools/edit.rs |
Adds optimized schema for file editing operations |
src/tools/bash.rs |
Implements schema optimization and adds test for optimized mode |
src/tools/activate_skill.rs |
Adds schema optimization for skill pack activation |
src/tool_filter.rs |
New module consolidating tool pattern matching logic from policy and subagent |
src/subagent.rs |
Integrates tool filtering module, adds cost tracking and optimization mode support |
src/policy.rs |
Refactors to use consolidated tool_filter module |
src/plan.rs |
Optimizes regex compilation with once_cell caching |
src/mcp/transport.rs |
Adds HTTP and SSE transport implementations alongside stdio |
src/mcp/manager.rs |
Updates to support multiple transport types (stdio/HTTP/SSE) |
src/mcp/client.rs |
Abstracts transport layer with McpTransportImpl enum |
src/main.rs |
Adds new modules, command index initialization, and config validation |
src/llm.rs |
Introduces LlmClient trait for abstraction and testing |
src/hooks.rs |
Removes trailing whitespace |
src/cost.rs |
New comprehensive cost tracking system with model pricing and session management |
src/config.rs |
Adds validation framework, MCP transport config, and cost tracking configuration |
src/compact.rs |
New context compaction module for conversation history summarization |
src/commands.rs |
New slash commands system for user-defined markdown command templates |
src/cli.rs |
Integrates cost display, compaction, slash commands, and turn counter |
src/agent.rs |
Adds cost tracking, optimization mode instructions, and force_continue support |
IDEAS.md |
Documents future optimization strategies based on LLM research |
Cargo.toml |
Adds once_cell dependency for regex caching |
Cargo.lock |
Updates lock file with once_cell dependency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.