Documentation Index
Fetch the complete documentation index at: https://icrl.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The codebase patterns demo shows ICRL’s ability to learn and apply your team’s specific coding patterns, conventions, and architectural decisions. Vanilla LLMs use generic patterns; ICRL learns from successful trajectories and applies yourAPIResponse wrapper, custom exceptions, and service layer conventions automatically.
The Problem
Every time you ask a vanilla LLM to add a new API endpoint, it uses generic patterns:- Generic error handling (
raise HTTPException(...)) - Standard response formats (raw dicts)
- Default logging approaches
APIResponse wrapper!”
How ICRL Solves This
After successfully completing 2–3 similar tasks, ICRL:- Stores successful trajectories with your corrections baked in
- Retrieves relevant examples when you ask for similar tasks
- Applies your patterns automatically without re-prompting
Demo Structure
examples/codebase_patterns_demo
README.md
setup_demo.py
run_demo.sh
validate_patterns.py
mock_codebase
app
main.py
core
response.py
exceptions.py
logging.py
models
routes
services
tests
_reference
pyproject.toml
Custom Patterns (What ICRL Learns)
- Response wrapper — All endpoints return
APIResponse[T], not raw dicts - Exception handling — Use
NotFoundError,ValidationErrorfromapp.core.exceptions, notHTTPException - Service layer — Routes delegate to services; business logic lives in services
- Structured logging — Use
get_logger(__name__)and consistent context
Running the Demo
This demo uses the ICRL CLI (icrl chat) interactively:
What to Observe
- First task — ICRL explores
users.py,products.py,response.py, etc., and creates the endpoint following exact patterns - Second task — ICRL retrieves the orders trajectory and applies correct patterns from step 1: fewer exploration steps, faster completion
- Ablation —
--ablateruns with and without retrieved examples and prints a comparison
Prerequisites
OPENAI_API_KEYorANTHROPIC_API_KEYset- ICRL CLI installed (
uv run icrl chatfrom project root)

