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.

16 stars

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

$curl -o ~/.claude/skills/recursive-context-coding-agent/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/data-ai/recursive-context-coding-agent/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/recursive-context-coding-agent/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How recursive-context-coding-agent Compares

Feature / Agentrecursive-context-coding-agentStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/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 loops

Related Skills

extracting-ai-context

16
from diegosouzapw/awesome-omni-skill

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

16
from diegosouzapw/awesome-omni-skill

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

16
from diegosouzapw/awesome-omni-skill

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

16
from diegosouzapw/awesome-omni-skill

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

16
from diegosouzapw/awesome-omni-skill

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

16
from diegosouzapw/awesome-omni-skill

Recognize patterns of context failure: lost-in-middle, poisoning, distraction, and clash

context-assembler

16
from diegosouzapw/awesome-omni-skill

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

16
from diegosouzapw/awesome-omni-skill

Create a lightweight codebase_context.md that anchors the idea in the existing repo (modules, constraints, extension points). Generic framework prompt.

ai-coding-agents

16
from diegosouzapw/awesome-omni-skill

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

16
from diegosouzapw/awesome-omni-skill

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

16
from diegosouzapw/awesome-omni-skill

为Flutter页面添加路由上下文记录功能,支持日期等参数的AI上下文识别。当需要让AI助手通过"询问当前上下文"功能获取页面状态(如日期、ID等参数)时使用。适用场景:(1) 日期驱动的页面(日记、活动、日历等),(2) ID驱动的页面(用户详情、订单详情等),(3) 任何需要AI理解当前页面参数的场景

localsetup-context

16
from diegosouzapw/awesome-omni-skill

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.