ask — AI Assistant
The ask
command is the heart of Rawi — your direct interface to AI assistance. Use it to ask questions, get code reviews, analyze data, and much more.
Basic Usage
Section titled “Basic Usage”rawi ask [query] [options]
Simple Questions
Section titled “Simple Questions”# Basic questionrawi ask "What is TypeScript?"
# Multi-word questions (quotes recommended)rawi ask "How do I deploy a Node.js application to AWS?"
# Code-related questionsrawi ask "Explain async/await in JavaScript with examples"
Options
Section titled “Options”Option | Alias | Description | Default |
---|---|---|---|
--profile <profile> | -p | Profile to use for AI configuration | default |
--session <sessionId> | -s | Continue an existing chat session | |
--new-session | -n | Start a new chat session | |
--act <template> | Use an act template by ID | ||
--file <path> | -f | Process content from a file | |
--files <paths...> | -F | Process content from multiple files | |
--batch <patterns...> | -b | Process files matching glob patterns | |
--file-type <type> | Override automatic file type detection | ||
--parallel | Process multiple files in parallel | ||
--max-concurrency <number> | Maximum concurrent files to process | 5 | |
--continue-on-error | Continue processing other files if one fails | ||
--verbose | Show detailed status and debug information | ||
--filter-sensitive | Filter sensitive information from prompts and responses | ||
--filter-types <types> | Comma-separated list of information types to filter | ||
--show-filtered | Show which information was filtered and display filtering statistics | ||
--highlight-filtered | Show filtered content with highlighting in terminal output | ||
--save-filter-config | Save current filtering configuration as default for future use | ||
--reset-filter-config | Reset filtering configuration to defaults (enables all filter types) |
File Processing Options
Section titled “File Processing Options”Supported File Types:
Category | Extensions | Description |
---|---|---|
Documents | pdf , docx , pptx , xlsx | PDF documents, Word docs, PowerPoint, Excel |
OpenDocument | odt , odp , ods | OpenDocument text, presentations, spreadsheets |
Text & Markup | txt , md , xml , html , htm | Plain text, Markdown, XML, HTML files |
Web Technologies | js , jsx , ts , tsx , css , json | JavaScript, TypeScript, CSS, JSON |
Programming Languages | py , java , cpp , c , h , go , rs | Python, Java, C/C++, Go, Rust |
rb , kt , swift , dart , scala | Ruby, Kotlin, Swift, Dart, Scala | |
r , m , pl , lua , php | R, Objective-C, Perl, Lua, PHP | |
Configuration | yml , yaml , toml , env , ini | YAML, TOML, environment, config files |
conf , cfg | General configuration files | |
Scripts & Tools | sql , sh , bash , vim | SQL, shell scripts, Vim config |
dockerfile , makefile , gitignore | Docker, Make, Git ignore files | |
Logs | log | Log files and system output |
File Type Override:
# Process unknown file as textrawi ask --file data.unknown --file-type txt "Analyze this data"
# Force PDF processingrawi ask --file document --file-type pdf "Extract text from this"
# Override auto-detection for config filesrawi ask --file config.custom --file-type yaml "Parse this YAML configuration"
Sensitive Information Filtering
Section titled “Sensitive Information Filtering”Rawi includes built-in filtering to protect sensitive information in your prompts and AI responses.
Basic Filtering
Section titled “Basic Filtering”# Enable sensitive information filteringrawi ask --filter-sensitive "Review this log file with user data"
# Process files with filtering enabledrawi ask --file user-data.txt --filter-sensitive "Analyze this data"
Custom Filter Types
Section titled “Custom Filter Types”# Filter specific types of informationrawi ask --filter-types "email,phone" "Process this customer contact list"
# Filter multiple typesrawi ask --filter-types "email,phone,creditcard,ssn" --file sensitive-data.csv "Analyze patterns"
# Combine with file processingrawi ask --files logs/*.log --filter-types "ip,email" "Check for security issues"
Filter Visibility and Debugging
Section titled “Filter Visibility and Debugging”# Show what was filteredrawi ask --filter-sensitive --show-filtered "Analyze this user database"
# Highlight filtered content in outputrawi ask --filter-sensitive --highlight-filtered "Review this authentication log"
# Combine visibility optionsrawi ask --filter-types "email,phone" --show-filtered --highlight-filtered "Process contacts"
Filter Configuration Management
Section titled “Filter Configuration Management”# Save current filter settings as defaultrawi ask --filter-types "email,phone,creditcard" --save-filter-config "Set up my preferred filtering"
# Reset to default filter configurationrawi ask --reset-filter-config "Reset filtering to defaults"
# Use saved configuration (automatic)rawi ask "Process data with my saved filter settings"
Common Filter Types
Section titled “Common Filter Types”Filter Type | Description | Examples |
---|---|---|
email | Email addresses | user@example.com , test@domain.org |
phone | Phone numbers | (555) 123-4567 , +1-800-555-0199 |
creditcard | Credit card numbers | 4111-1111-1111-1111 |
ssn | Social Security Numbers | 123-45-6789 |
ip | IP addresses | 192.168.1.1 , 10.0.0.1 |
url | URLs and web addresses | https://example.com/private |
api_key | API keys and tokens | sk-1234567890abcdef |
password | Password-like strings | password123 , secretkey |
Session Management
Section titled “Session Management”Sessions allow you to have continuous conversations where each question remembers the previous context.
Start a New Session
Section titled “Start a New Session”# Explicitly start a new sessionrawi ask "I'm building a React application" --new-session
# Shorter versionrawi ask "I'm building a React application" -n
Continue a Conversation
Section titled “Continue a Conversation”# Continue current session (automatic)rawi ask "How should I structure my components?"
# Continue specific sessionrawi ask "What about state management?" --session abc123-def456
Session Workflow Example
Section titled “Session Workflow Example”# Start a project conversation$ rawi ask "I'm building a REST API with Node.js and Express" --new-session🤖 Great! I'd be happy to help you build a REST API with Node.js and Express.What specific aspects would you like to focus on? Here are some areas I can assist with:...
# Continue the conversation$ rawi ask "How should I structure my project folders?"🤖 Based on our discussion about your REST API, here's a recommended folder structure:...
# Add more context$ rawi ask "What about database integration with MongoDB?"🤖 For your Express REST API, here's how to integrate MongoDB effectively:...
Act Templates
Section titled “Act Templates”Act templates transform the AI into specialized experts for different domains.
Using Templates
Section titled “Using Templates”# Use template with questionrawi ask --act code-reviewer "Review this function for performance issues"
# Combine with file inputcat server.js | rawi ask --act security-expert "Analyze for vulnerabilities"
# Use with profilerawi ask --act database-admin "Optimize this query" --profile work
Popular Templates
Section titled “Popular Templates”Development
Section titled “Development”# Code reviewrawi ask --act code-reviewer "Review this Python function"
# Linux terminal simulationrawi ask --act linux-terminal "list files in /home with details"
# Software engineeringrawi ask --act software-engineer "Design a scalable authentication system"
Security
Section titled “Security”# Security analysisrawi ask --act security-expert "Audit this authentication code"
# Cybersecurity specialistrawi ask --act cybersecurity-specialist "Assess web application vulnerabilities"
Documentation
Section titled “Documentation”# Technical writingrawi ask --act technical-writer "Document this API endpoint"
# API documentationrawi ask --act api-documentation-expert "Create docs for these REST endpoints"
Database
Section titled “Database”# Database administrationrawi ask --act database-expert "Optimize this SQL query"
# Data analysisrawi ask --act data-scientist "Analyze trends in this dataset"
Browse Templates
Section titled “Browse Templates”# List all available templatesrawi act --list
# Show template detailsrawi act --show code-reviewer
Profile Usage
Section titled “Profile Usage”Profiles let you use different AI providers and configurations for different tasks.
Using Specific Profiles
Section titled “Using Specific Profiles”# Use work profilerawi ask "Review this code" --profile work
# Use local profile (e.g., Ollama)rawi ask "Quick question" --profile local
# Use analysis profile (e.g., Claude)rawi ask "Analyze this data" --profile analysis
Profile + Template Combinations
Section titled “Profile + Template Combinations”# Use Claude for deep code analysisrawi ask --act code-reviewer "Analyze architecture" --profile claude
# Use local AI for quick questionsrawi ask --act linux-terminal "ls -la" --profile local
# Use GPT-4 for documentationrawi ask --act technical-writer "Create README" --profile openai
Shell Integration
Section titled “Shell Integration”Rawi integrates seamlessly with shell commands and pipes.
Input from Pipes
Section titled “Input from Pipes”# Analyze code filescat app.js | rawi ask --act code-reviewer "Review this JavaScript code"
# Process command outputps aux | rawi ask "Which processes are using the most memory?"
# Analyze logstail -f error.log | rawi ask "Monitor for critical issues"
# Git integrationgit diff | rawi ask "Summarize these changes"
Chaining Commands
Section titled “Chaining Commands”# Save AI responsesrawi ask "Explain Docker containers" > docker-notes.txt
# Process AI outputrawi ask "List popular Python libraries" | grep -i "data"
# Complex pipelinescat data.csv | rawi ask --act data-scientist "Analyze this data" | tee analysis.txt
Advanced Usage
Section titled “Advanced Usage”File Processing with Filtering
Section titled “File Processing with Filtering”# Process sensitive documents safelyrawi ask --file employee-data.xlsx --filter-sensitive "Create summary statistics"
# Analyze logs with IP and email filteringrawi ask --file access.log --filter-types "ip,email" --show-filtered "Find unusual access patterns"
# Batch process with filteringrawi ask --batch "logs/**/*.log" --filter-sensitive --parallel "Analyze all logs for security issues"
# Review code with API key filteringrawi ask --files src/**/*.js --filter-types "api_key,password" --act code-reviewer "Security review"
Security-Focused Analysis
Section titled “Security-Focused Analysis”# Audit configuration filesrawi ask --file .env --filter-types "password,api_key" --act security-expert "Review configuration security"
# Process database dumps safelyrawi ask --file backup.sql --filter-sensitive --show-filtered "Analyze schema structure"
# Review application logsrawi ask --file app.log --filter-types "email,ip,creditcard" --highlight-filtered "Check for data leaks"
File Analysis
Section titled “File Analysis”# Code review entire filescat src/server.js | rawi ask --act code-reviewer "Comprehensive code review focusing on security and performance"
# Documentation generationcat api/routes.js | rawi ask --act technical-writer "Generate API documentation for these routes"
# Error analysiscat error.log | rawi ask --act debugging-expert "Identify and categorize these errors"
Multi-Step Workflows
Section titled “Multi-Step Workflows”# Development workflowrawi ask --new-session --act software-engineer "I'm building a user authentication system"rawi ask "What are the security considerations?"rawi ask "Show me the database schema"rawi ask "How should I handle password reset?"
Batch Processing
Section titled “Batch Processing”# Review multiple filesfor file in src/*.js; do echo "Reviewing $file..." cat "$file" | rawi ask --act code-reviewer "Quick review of this file"done
# Analyze logs from multiple serversfor log in logs/*.log; do cat "$log" | rawi ask --act system-administrator "Summarize issues in this log"done
Tips and Best Practices
Section titled “Tips and Best Practices”Effective Prompting
Section titled “Effective Prompting”-
Be Specific: Include context and requirements
Terminal window rawi ask --act code-reviewer "Review this React component for performance issues and accessibility compliance" -
Provide Context: Mention your tech stack and constraints
Terminal window rawi ask "How do I implement caching in a Node.js Express API using Redis?" -
Use Templates: Choose appropriate expertise for your task
Terminal window rawi ask --act database-expert "Optimize this PostgreSQL query for large datasets"
Session Management
Section titled “Session Management”- Start Sessions for Related Work: Group related questions together
- Use Descriptive First Messages: Set clear context
- Reference Previous Discussion: Build on earlier conversation points
Performance Optimization
Section titled “Performance Optimization”- Choose Appropriate Models: Use lighter models for simple tasks
- Limit Input Size: Process large files in chunks if needed
- Use Local Providers: For speed and privacy when possible
Security and Privacy
Section titled “Security and Privacy”-
Filter Sensitive Data: Use
--filter-sensitive
when processing sensitive filesTerminal window rawi ask --file user-data.csv --filter-sensitive "Analyze user behavior patterns" -
Custom Filtering: Specify exactly what to filter for better control
Terminal window rawi ask --filter-types "email,phone,ssn" --file contacts.txt "Process contact information" -
Verify Filtering: Use
--show-filtered
to see what was filteredTerminal window rawi ask --filter-sensitive --show-filtered --file logs.txt "Review application logs"
Error Handling
Section titled “Error Handling”Common Issues
Section titled “Common Issues”Session not found:
# List available sessionsrawi history --sessions
# Start new session if old one expiredrawi ask --new-session "Continuing previous work on authentication"
Large input errors:
# Process in chunks for large fileshead -100 large-file.txt | rawi ask "Analyze this sample"
Network issues:
# Check configurationrawi info
# Try different profile/providerrawi ask --profile backup "Test question"
Integration Examples
Section titled “Integration Examples”Git Workflows
Section titled “Git Workflows”# Pre-commit code reviewgit diff --cached | rawi ask --act code-reviewer "Review staged changes"
# Commit message generationgit diff --cached | rawi ask "Generate a conventional commit message"
# Release notesgit log --oneline v1.0..HEAD | rawi ask --act technical-writer "Create release notes"
Development Automation
Section titled “Development Automation”# API testingcurl -s https://api.example.com/users | rawi ask --act api-tester "Analyze this API response"
# Log monitoringtail -f /var/log/app.log | rawi ask --act incident-responder "Monitor for critical alerts"
# Documentation updatesfind . -name "*.js" -newer docs/ | while read file; do cat "$file" | rawi ask --act technical-writer "Update documentation for changes in this file"done
Show details of a specific act template:
$ rawi ask --act ethereum-developer --show
For more information, see the Rawi documentation or run rawi ask --help
.