The hook was converting total_chars to string before calculating tokens, resulting in ~0 tokens reported. Fixed to calculate directly from char count. - Remove unused estimate_tokens() function - Calculate tokens as total_chars // 4 directly - Archive fix-context-usage-hook change
2.2 KiB
2.2 KiB
Change: Add CLI Reference Lesson
Why
The Claude How To repository covers nine major Claude Code features (01-09), but lacks a dedicated lesson for the CLI reference - the command-line interface that users interact with directly. Understanding CLI commands, flags, and options is fundamental to using Claude Code effectively. Users need a comprehensive reference to leverage features like model selection, output formats, permission management, and session handling via CLI.
What Changes
- NEW
10-cli/directory with comprehensive CLI reference lesson - NEW
10-cli/README.md- Main lesson content following established structure - UPDATE Root
README.md- Add CLI lesson to navigation and learning path - UPDATE Root
README.md- Add CLI to feature comparison and use case matrix - UPDATE
LEARNING-ROADMAP.md- Include CLI lesson in learning progression
Key Content Areas
- CLI Commands - Start interactive REPL, query mode, continue/resume sessions, updates
- Core Flags - Print mode, continue, resume, version
- Model Configuration - Model selection, fallback models, agent configuration
- System Prompt Customization - Replace, append, file-based prompts
- Tool & Permission Management - Allowed/disallowed tools, permission modes
- Output & Format - JSON, stream-JSON, text formats
- MCP Configuration - Server loading, strict mode
- Session Management - Session IDs, forking, resumption
- Advanced Features - Chrome integration, IDE connection, debug mode
High-Value Use Cases
- CI/CD Integration - Headless mode with JSON output for automation pipelines
- Script Piping - Process files, logs, and data through Claude
- Multi-Session Workflows - Resume and fork sessions for complex projects
- Custom Agent Configurations - Define specialized subagents via CLI
- Batch Processing - Process multiple queries with consistent settings
- Security-Conscious Development - Permission modes and tool restrictions
- API Integration - Structured JSON output for programmatic consumption
Impact
- Affected specs: None (new capability)
- Affected code: Root README.md, LEARNING-ROADMAP.md
- New files:
10-cli/README.md