recursive-context-coding-agent
Use recursive context processing with grep/find/uv to handle large codebases. When working with codebases larger than your context window, treat the codebase as an external environment and recursively process it using symbolic execution.
Best use case
recursive-context-coding-agent is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Use recursive context processing with grep/find/uv to handle large codebases. When working with codebases larger than your context window, treat the codebase as an external environment and recursively process it using symbolic execution.
Teams using recursive-context-coding-agent should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/recursive-context-coding-agent/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How recursive-context-coding-agent Compares
| Feature / Agent | recursive-context-coding-agent | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Use recursive context processing with grep/find/uv to handle large codebases. When working with codebases larger than your context window, treat the codebase as an external environment and recursively process it using symbolic execution.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Recursive Context Coding Agent
## When to Use This Skill
- Working with codebases larger than your context window
- Tasks requiring dense access to code throughout a large codebase
- Multi-file refactoring or analysis tasks
- When grep/find operations would be more effective than loading everything into context
## Core Principles (from MIT RLM Paper)
1. **Treat Codebase as External Environment**
- Don't load entire codebase into context window
- Store codebase as a variable in a REPL environment
- Use symbolic handles to reference code sections
2. **Symbolic Recursion**
- Write code that can invoke itself programmatically
- Use loops to process slices of the codebase
- Launch sub-calls for different code sections
3. **REPL Environment**
- Use grep, find, and other tools to examine code
- Execute Python scripts with `uv run` to process code
- Store intermediate results symbolically
## Workflow
### Step 1: Initialize REPL Environment
```bash
# Set up the codebase as a variable
CODEBASE=$(pwd)
Step 2: Recursive Analysis
# Use grep to find relevant code
grep -r "pattern" $CODEBASE --include="*.py" --include="*.js" --include="*.ts"
# Use find to explore directory structure
find $CODEBASE -type f -name "*.py" | head -20
```
### Step 3: Symbolic Processing with Python
# Use uv to run Python scripts for complex processing
```bash
uv run python << 'EOF'
import os
import subprocess
# Process codebase recursively
for root, dirs, files in os.walk('/path/to/codebase'):
for file in files:
if file.endswith('.py'):
filepath = os.path.join(root, file)
# Process each file
print(f"Processing: {filepath}")
EOF
```
### Step 4: Recursive Sub-Calls
When you need to focus on a specific section:
Extract the relevant code section
Create a new prompt with just that section
Invoke yourself recursively with the focused context
Aggregate results
Example: Large Codebase Refactoring
Problem: Refactor a 10,000-line codebase
RLM Approach:
Store codebase as CODEBASE variable
Use find to identify all files
Use grep to find patterns to refactor
For each file, create a focused prompt
Process files recursively
Aggregate changes
Commands:
```bash
# 1. Find all Python files
FILES=$(find $CODEBASE -name "*.py")
# 2. Process each file recursively
for file in $FILES; do
# Extract file content
CONTENT=$(cat $file)
# Create focused prompt
PROMPT="Refactor this code: $CONTENT"
# Invoke recursively (you would call yourself here)
# RESULT=$(recursive-call $PROMPT)
# Apply changes
# echo "$RESULT" > $file
done
```
### Tools to Use
- grep: Search for patterns across the codebase
- find: Navigate and locate files
- `uv run`: Execute Python scripts for complex processing
- sed/awk: Text processing within files
- git: Track changes and revert if needed
### Best Practices
Never load entire codebase into context window
Use symbolic handles for code sections
Process recursively - break down problems into sub-problems
Store intermediate results in variables
Use REPL environment for code execution
Test incrementally - verify changes after each recursive call
### Error Handling
If a recursive call fails, try a different code slice
Use git to revert changes if something goes wrong
Log intermediate results for debugging
Limit recursion depth to prevent infinite loopsRelated Skills
extracting-ai-context
Extracts and manages AI context (skills, AGENTS.md) from workflow-kotlin library JARs. Use when setting up AI tooling for a workflow-kotlin project, updating skills after a library version change, or configuring agent-specific directories.
create-agent-with-sanity-context
Build AI agents with structured access to Sanity content via Context MCP. Covers Studio setup, agent implementation, and advanced patterns like client-side tools and custom rendering.
context-optimizer
Analyzes Copilot Chat debug logs, agent definitions, skills, and instruction files to audit context window utilization. Provides log parsing, turn-cost profiling, redundancy detection, hand-off gap analysis, and optimization recommendations. Use when optimizing agent context efficiency, identifying where to add subagent hand-offs, or reducing token waste across agent systems.
context-fundamentals
Understand the components, mechanics, and constraints of context in agent systems. Use when designing agent architectures, debugging context-related failures, or optimizing context usage.
context-engineering
Use when designing agent system prompts, optimizing RAG retrieval, or when context is too expensive or slow. Reduces tokens while maintaining quality through strategic positioning and attention-aware design.
context-degradation
Recognize patterns of context failure: lost-in-middle, poisoning, distraction, and clash
context-assembler
Assembles relevant context for agent spawns with prioritized ranking. Ranks packages by relevance, enforces token budgets with graduated zones, captures error patterns for learning, and supports configurable per-agent retrieval limits.
Codebase context
Create a lightweight codebase_context.md that anchors the idea in the existing repo (modules, constraints, extension points). Generic framework prompt.
ai-coding-agents
Comprehensive guide for using Codex CLI (OpenAI) and Claude Code CLI (Anthropic) - AI-powered coding agents. Use when orchestrating CLI commands, automating tasks, configuring agents, or troubleshooting issues.
agent-context-system
A persistent local-only memory system for AI coding agents. Two files, one idea — AGENTS.md (committed, shared) + .agents.local.md (gitignored, personal). Agents read both at session start, update the scratchpad at session end, and promote stable patterns over time. Works across Claude Code, Cursor, Copilot, Windsurf. Subagent-ready. No plugins, no infrastructure, no background processes.
add-route-context
为Flutter页面添加路由上下文记录功能,支持日期等参数的AI上下文识别。当需要让AI助手通过"询问当前上下文"功能获取页面状态(如日期、ID等参数)时使用。适用场景:(1) 日期驱动的页面(日记、活动、日历等),(2) ID驱动的页面(用户详情、订单详情等),(3) 任何需要AI理解当前页面参数的场景
localsetup-context
Localsetup v2 framework context - overview, invariants, and skills index. Load first when working in a repo that uses Localsetup v2. Use when starting work in this repo or when user asks about framework rules.