Skip to main content
The --fast-context flag searches your codebase for relevant code and adds it as context to the agentโ€™s prompt.

Quick Start

praisonai "Find authentication code" --fast-context ./src

Usage

Basic Fast Context

praisonai "Explain how the login function works" --fast-context ./src
Expected Output:
โšก Fast Context enabled - searching ./src

๐Ÿ“‚ Found relevant files:
  โ€ข src/auth/login.py (95% relevance)
  โ€ข src/auth/utils.py (78% relevance)
  โ€ข src/models/user.py (65% relevance)

โ•ญโ”€ Agent Info โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚  ๐Ÿ‘ค Agent: DirectAgent                                                       โ”‚
โ”‚  Role: Assistant                                                             โ”‚
โ”‚  ๐Ÿ“„ Context: 3 files, 245 lines                                             โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Response โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Based on the codebase, the login function in `src/auth/login.py` works as   โ”‚
โ”‚ follows:                                                                     โ”‚
โ”‚                                                                              โ”‚
โ”‚ 1. **Input Validation**: The function first validates the email format      โ”‚
โ”‚    using the `validate_email()` helper from `utils.py`                      โ”‚
โ”‚                                                                              โ”‚
โ”‚ 2. **User Lookup**: It queries the database using the User model to find    โ”‚
โ”‚    the user by email                                                         โ”‚
โ”‚                                                                              โ”‚
โ”‚ 3. **Password Verification**: Uses bcrypt to compare the hashed password    โ”‚
โ”‚                                                                              โ”‚
โ”‚ 4. **Token Generation**: On success, generates a JWT token with user claims โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Specify Search Path

# Search specific directory
praisonai "How does the API handle errors?" --fast-context ./src/api

# Search from project root
praisonai "Explain the database schema" --fast-context /path/to/project

# Search current directory
praisonai "Find all test files" --fast-context .

Combine with Other Features

# Fast context with metrics
praisonai "Optimize this function" --fast-context ./src --metrics

# Fast context with guardrail
praisonai "Refactor the code" --fast-context ./src --guardrail "Maintain backward compatibility"

# Fast context with planning
praisonai "Add new feature" --fast-context ./src --planning

How It Works

  1. Query Analysis: Analyzes your prompt to understand what code is relevant
  2. Codebase Search: Searches the specified directory for matching files
  3. Relevance Ranking: Ranks files by relevance to your query
  4. Context Injection: Adds relevant code snippets to the agentโ€™s context
  5. Enhanced Response: Agent responds with full codebase awareness

Use Cases

Code Explanation

praisonai "Explain how the payment processing works" --fast-context ./src

Bug Investigation

praisonai "Why might the user session expire unexpectedly?" --fast-context ./src/auth
Expected Output:
โšก Fast Context enabled

๐Ÿ“‚ Found relevant files:
  โ€ข src/auth/session.py
  โ€ข src/auth/middleware.py
  โ€ข src/config/settings.py

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Response โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Based on the code analysis, there are several potential causes for          โ”‚
โ”‚ unexpected session expiration:                                               โ”‚
โ”‚                                                                              โ”‚
โ”‚ 1. **Short Timeout**: In `settings.py`, `SESSION_TIMEOUT` is set to 300     โ”‚
โ”‚    seconds (5 minutes), which may be too short for some use cases           โ”‚
โ”‚                                                                              โ”‚
โ”‚ 2. **Missing Refresh**: The `session.py` doesn't implement token refresh    โ”‚
โ”‚    on activity, so sessions expire even during active use                   โ”‚
โ”‚                                                                              โ”‚
โ”‚ 3. **Race Condition**: In `middleware.py` line 45, there's a potential      โ”‚
โ”‚    race condition when checking session validity                            โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Code Review

praisonai "Review the error handling in this codebase" --fast-context ./src

Feature Planning

praisonai "How would I add OAuth support based on the current auth system?" --fast-context ./src/auth

Documentation Generation

praisonai "Generate API documentation for the user endpoints" --fast-context ./src/api/users

Search Configuration

File Types Searched

By default, Fast Context searches common code files:
LanguageExtensions
Python.py
JavaScript.js, .jsx, .ts, .tsx
Go.go
Rust.rs
Java.java
C/C++.c, .cpp, .h, .hpp
Ruby.rb
PHP.php

Ignored Paths

These directories are automatically excluded:
  • node_modules/
  • venv/, .venv/
  • __pycache__/
  • .git/
  • dist/, build/

Best Practices

Be specific with your search path. Searching a smaller, relevant directory produces better results than searching the entire project.
Large codebases may result in high token usage. Use --metrics to monitor costs.

Specific Paths

Target specific directories for better relevance

Clear Prompts

Use specific technical terms that match your code

Iterative Search

Start broad, then narrow down to specific modules

Monitor Tokens

Use --metrics to track context size and costs

Performance Tips

ScenarioRecommendation
Large codebaseSearch specific subdirectories
Many files foundRefine your prompt to be more specific
Slow searchExclude unnecessary directories
High token usageLimit search depth or file count