Skip to main content
Analyse a codebase and generate a Product Requirements Prompt (PRP) for first-try implementation success with the ContextAgent.
The 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 the output= parameter (inherited from Agent):

Protocol Compliance

ContextAgent implements ContextEngineerProtocol:

GitHub Analysis

Multi-Agent Workflow

Output Directory

Context Engineering outputs are saved to .praison/prp/:

Context Engineering vs Context Window Management


Best Practices

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.
Pass file_patterns=["*.py"] (or your language) so the agent focuses on relevant source instead of walking test fixtures and generated files.
The generated PRP is designed to prime another agent. Hand it to a Developer agent’s instructions for higher first-try success.
This agent engineers implementation context. For token budgeting and compaction inside a run, use context=ContextConfig() instead — they solve different problems.

Implement the PRP with the sandboxed CodeAgent.

Token budgeting and context-window compaction.