ContextAgent.
ContextAgent is a specialized agent for Context Engineering - comprehensive codebase analysis and Product Requirements Prompt (PRP) generation.
Not to be confused with Context Window Management (
context=ContextConfig()).
This agent analyzes codebases and generates implementation guidance, while ContextConfig manages token budgets and compaction.Quick Start
1
Simple Usage
Create the agent and analyse a project.
2
With PRP Generation
Turn a feature request into an implementation prompt.
How It Works
Key Features
API Reference
Core Methods
Async Methods
Configurable Output
Control output using theoutput= parameter (inherited from Agent):
Protocol Compliance
ContextAgent implementsContextEngineerProtocol:
GitHub Analysis
Multi-Agent Workflow
Output Directory
Context Engineering outputs are saved to.praison/prp/:
Context Engineering vs Context Window Management
Best Practices
Analyse once, reuse the analysis
Analyse once, reuse the analysis
analyze_codebase is the expensive step. Cache its result and pass it into generate_prp and create_implementation_blueprint rather than re-scanning for each call.Scope file patterns to what matters
Scope file patterns to what matters
Pass
file_patterns=["*.py"] (or your language) so the agent focuses on relevant source instead of walking test fixtures and generated files.Feed the PRP to an implementation agent
Feed the PRP to an implementation agent
The generated PRP is designed to prime another agent. Hand it to a
Developer agent’s instructions for higher first-try success.Don't confuse it with ContextConfig
Don't confuse it with ContextConfig
This agent engineers implementation context. For token budgeting and compaction inside a run, use
context=ContextConfig() instead — they solve different problems.Related
Implement the PRP with the sandboxed CodeAgent.
Token budgeting and context-window compaction.

