Skip to content

Conversation

semikolon
Copy link
Contributor

@semikolon semikolon commented Aug 22, 2025

Inline Reasoning Control Token System

Problem: GPT-5 reasoning parameter compatibility crisis blocking Claude Code interactive mode

Solution: Complete end-to-end fix spanning both repositories:

  • LLMS: Parameter transformation & API compatibility (LLMS PR #1) ✅
  • CCR: Intuitive user experience via inline tokens ✅

✨ Features

  • Prefix Tokens: Deep: <prompt>, Quick: <prompt>, Explain: <prompt>, Brief: <prompt>
  • Colon Tokens: :deep, :quick, :explain, :brief anywhere in prompt
  • Automatic Parameter Mapping: Tokens automatically set reasoning_effort and verbosity
  • Provider Agnostic: Works with both Anthropic thinking and OpenAI reasoning
  • Cross-Router Compatibility: Seamless integration with transformer chain

🎮 Usage Examples

Deep: Analyze this complex algorithm for performance bottlenecks
:quick What's 2+2?
Explain: How does JWT authentication work in modern web apps?  
Brief: Summarize this 50-page technical document

📊 Token Mapping Reference

Token Reasoning Effort Verbosity Ideal Use Case
:quick low low Fast answers, simple queries
:deep high medium Complex analysis, debugging
:explain medium high Teaching, tutorials, detailed explanations
:brief medium low Concise responses, summaries

🔗 Dependencies

  • Requires: LLMS PR #1 for GPT-5 parameter processing
  • Built on: Transformer chain reasoningopenai
  • Architecture: Router middleware processes tokens → LLMS transforms parameters

🧪 Testing

  • ✅ Prefix tokens properly detected and stripped from prompts
  • ✅ Colon tokens work anywhere in user messages
  • ✅ Parameters correctly mapped to reasoning_effort and verbosity
  • ✅ Compatible with both Anthropic and OpenAI reasoning systems
  • ✅ No conflicts with Claude Code's existing # memory system

📋 Related PRs

🔄 Implementation

This PR represents commit d64dc24 - a complete standalone implementation of the inline reasoning control system.


Related PRs (complete series)

semikolon and others added 4 commits August 19, 2025 13:34
Prevent local Claude Code settings from being committed to repository.
These files contain personal development tool preferences that should
remain local to each developer.
- Update package.json to use llms v1.0.26 with GPT-5 support
- Add comprehensive debug logging in index.ts for troubleshooting
- Implement GPT-5 parameter mapping in router.ts (max_tokens → max_completion_tokens)
- Working GPT-5 through CCR with tool format conversion

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Add comprehensive inline token system for controlling GPT-5 reasoning effort
and verbosity without requiring separate CLI flags or configuration.

Features:
- Prefix tokens: Quick:, Deep:, Explain:, Brief: (beginning of prompt)
- Colon tokens: :quick, :deep, :explain, :brief (anywhere in prompt)
- Automatic token detection, parameter mapping, and prompt stripping
- Integration with CCR router middleware for seamless processing
- Avoids conflicts with Claude Code's # memory system

Token mappings:
- Quick/:quick → low effort, low verbosity (500 token budget)
- Deep/:deep → high effort, medium verbosity (2000 token budget)
- Explain/:explain → medium effort, high verbosity (1000 token budget)
- Brief/:brief → medium effort, low verbosity (1000 token budget)

Implementation in src/utils/router.ts:153-210 processes tokens before
API calls, automatically strips them from prompts, and sets appropriate
reasoning_effort, verbosity, and thinking parameters for downstream
transformers.

Documentation includes comprehensive reference table and usage examples
in CLAUDE.md inline token section.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@semikolon
Copy link
Contributor Author

@claude Review this please?

semikolon added a commit to semikolon/claude-code-router that referenced this pull request Aug 23, 2025
- LLMS: fix/gpt5-openai-normalization → review/llms-pr1-head (PR musistudio#28)
- CCR: main → review/ccr-pr1-head (PR musistudio#677)
- This ensures users get ALL PR work combined, not just normalization fixes
semikolon added a commit to semikolon/claude-code-router that referenced this pull request Aug 23, 2025
Updated to use feature/dev-workflow-docs branches which contain:
- LLMS: PRs musistudio#28, musistudio#29, musistudio#30 (Core API + Documentation + Workflow)
- CCR: PRs musistudio#677, musistudio#678, musistudio#679 (Reasoning Control + Docs + Workflow)

This ensures users get the complete feature set, not just partial work.
semikolon added a commit to semikolon/claude-code-router that referenced this pull request Aug 23, 2025
…usistudio#679)

✅ COMBINED CCR FUNCTIONALITY:
- PR musistudio#677: Inline Reasoning Control Tokens (:quick, :deep, :explain, :brief)
- PR musistudio#678: Enhanced Documentation & API Guide
- PR musistudio#679: Development Workflow Scripts

🎯 COMPLETE CCR FEATURES:
- Reasoning token processing and parameter mapping
- Background model routing enhancements
- Complete documentation for GPT-5 integration
- Development workflow automation
- Enhanced logging and debugging capabilities

This branch contains ALL CCR enhancements for GPT-5 integration!
semikolon added a commit to semikolon/claude-code-router that referenced this pull request Aug 23, 2025
✅ UNIFIED BRANCHES CREATED:
- LLMS: gpt5-complete-integration (commit d43f50f)
  Contains: PR musistudio#28 + PR musistudio#29 + PR musistudio#30 (all functionality merged)
- CCR: gpt5-complete-integration
  Contains: PR musistudio#677 + PR musistudio#678 + PR musistudio#679 (all functionality merged)

🔧 COMPLETE FUNCTIONALITY GUARANTEED:
✅ GPT-5 normalization fixes (prevents 400 errors)
✅ Usage format conversion (fixes subagent metrics)
✅ Reasoning control tokens (:quick, :deep, etc)
✅ Complete documentation and workflow scripts
✅ All parameter transformations and API compatibility
✅ Enhanced logging and debugging capabilities

🎯 ONE-COMMAND SETUP:
Users now get EVERYTHING with a single script - no missing features!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant