Examples
This page provides practical examples of using Flux-CLI for common development tasks.
Example 1: Understanding a Codebase
Ask Flux-CLI to explore and explain an unfamiliar codebase:
Flux-CLI will use list_dir, read_file, and grep to map the codebase.
❯ Explore the project structure and explain how the authentication system worksWhat happens:
- Agent calls
list_dirto see the top-level structure - Agent calls
grepto find authentication-related code - Agent reads key files to understand the auth flow
- Agent provides a comprehensive explanation
Example 2: Refactoring Code
Ask Flux-CLI to refactor a function:
Flux-CLI will read the file, plan the refactor, and apply edits.
❯ Refactor the get_config() function in config/loader.py to use a cache patternWhat happens:
- Agent reads
config/loader.pyto understand the current implementation - Agent plans the refactoring approach
- Agent uses
editto make surgical changes - Agent verifies the changes are correct
Example 3: Debugging
Ask Flux-CLI to help debug an issue:
Flux-CLI searches for timeout-related code and explains the root cause.
❯ The shell tool keeps timing out. Find the timeout configuration and explain whyExample 4: Multi-Step Task
Use the todos tool to track a complex task:
Flux-CLI creates todo items and works through them systematically.
❯ I need to:
1. Add input validation to the WriteFileTool
2. Write tests for it
3. Update the documentation
Use todos to track thisExample 5: Web Research
Ask Flux-CLI to research a topic:
Flux-CLI uses web_search to find information and provides a summary.
❯ Search for the latest best practices for Python project structure in 2024Example 6: Using Sub-Agents
For complex codebase analysis, use sub-agents:
Flux-CLI delegates to a sub-agent with focused read-only tools.
❯ Use the codebase investigator to understand how the hook system worksExample 7: Working with MCP Tools
If you have an MCP server connected:
Flux-CLI uses the MCP-connected tool which may have additional capabilities.
❯ Use the filesystem MCP server to list all files in the projectExample 8: Session Persistence
Save and resume a complex session:
Session persistence allows long-running investigations without losing context.
❯ /save
# Later, in a new session:
❯ /resume 550e8400-e29b-41d4-a716-446655440000
# Continue from where you left offBest Practices
- Be specific — Clear, specific prompts yield better results
- Use todos — For multi-step tasks, let Flux-CLI track progress
- Check stats — Monitor token usage with
/statsto stay within limits - Save frequently — Use
/saveto preserve important sessions - Leverage sub-agents — For deep investigations, delegate to focused sub-agents