agentic/code/addons/rlm/skills/rlm-mode/SKILL.md
Detect requests for recursive decomposition and large-scale operations that benefit from RLM processing
npx skillsauth add jmagly/aiwg rlm-modeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You detect when users need large-scale operations that would benefit from recursive decomposition and route to RLM commands instead of attempting to load everything into context.
Alternate expressions and non-obvious activations (primary phrases are matched automatically from the skill description):
Loading entire codebases or directory trees into context causes:
RLM solution: Decompose → Process in chunks → Aggregate results
| Pattern | Example | Why RLM? |
|---------|---------|----------|
| analyze all files | "analyze all TypeScript files for security issues" | Scope exceeds context window |
| search the entire codebase | "search the entire codebase for authentication logic" | Need to traverse full tree |
| review every module | "review every module for proper error handling" | Many independent reviews |
| find all instances | "find all instances of deprecated API usage" | Requires exhaustive search |
| summarize the whole repository | "summarize the whole repository structure" | Hierarchical decomposition |
| check every file | "check every file for missing tests" | File-by-file evaluation |
| scan all directories | "scan all directories for outdated dependencies" | Directory tree traversal |
| across the entire project | "find TODOs across the entire project" | Project-wide aggregation |
| throughout the repository | "identify duplicated code throughout the repository" | Cross-file comparison |
| recursively process | "recursively process src/ and generate docs" | Explicit recursion request |
| batch process | "batch process all markdown files for formatting" | Parallel batch operation |
| apply to all | "apply linting rules to all JavaScript files" | Bulk transformation |
| update every | "update every component to use new API" | Mass refactoring |
| generate for each | "generate tests for each module in lib/" | Templated generation |
Patterns that almost always need RLM:
Heuristics:
src/, lib/, test/)Patterns that might need RLM:
In these cases: Ask user to clarify scope before recommending RLM
Patterns that DON'T need RLM:
When RLM is appropriate, suggest the right strategy:
rlm-query)Use when: User wants to find, list, or aggregate information
Example triggers:
Suggested command:
/rlm-query "{context-source}" "{query}" --depth {N}
The first positional argument is the context source — a single file path or glob pattern. The second is the sub-prompt for the spawned sub-agent.
Example:
User: "find all TODO comments across the entire codebase"
Decomposition:
Context source: "**/*.{js,ts,jsx,tsx}" (all code files)
Query: "Extract TODO comments with file:line locations"
Suggested: /rlm-query "**/*.{js,ts,jsx,tsx}" "Extract TODO comments with file:line locations"
rlm-batch)Use when: User wants to transform, update, or generate for multiple files
Example triggers:
Suggested command:
/rlm-batch "{glob-pattern}" "{operation}" --max-parallel {N}
The first positional argument is the glob pattern that selects target files. The second is the operation applied to each file (use {file} as the placeholder for the current file path).
Example:
User: "add TypeScript types to every JavaScript file in src/"
Decomposition:
Glob pattern: "src/**/*.js"
Operation: "Add TypeScript type annotations to {file}"
Max parallel: 4 (concurrent workers)
Suggested: /rlm-batch "src/**/*.js" "Add TypeScript type annotations to {file}" --max-parallel 4
rlm-batch with summarize aggregation)Use when: User wants to understand large-scale structure or relationships
Example triggers:
Suggested command:
/rlm-batch "{glob-pattern}" "Summarize {file} for repository structure analysis" --aggregate summarize --max-parallel {N}
Pick a glob pattern that matches your repository layout. Common patterns:
**/README.md — works for monolith and monorepo layouts (use a .gitignore-aware glob to avoid node_modules/)apps/*/README.md — multi-app monorepospackages/*/README.md — workspace-style monorepossrc/*/index.{ts,js} — top-level module entry pointsExample:
User: "summarize the whole repository so I can understand the architecture"
Decomposition:
Glob pattern: "**/README.md" (adapt to your layout)
Operation: "Summarize {file} for architecture overview"
Max parallel: 3
Aggregate: summarize (collapse all sub-summaries into one overview)
Suggested: /rlm-batch "**/README.md" "Summarize {file} for architecture overview" --aggregate summarize --max-parallel 3
This request involves processing {N estimated} files, which exceeds comfortable
context window usage.
I recommend using RLM (Recursive Language Model) processing:
**Suggested approach:**
{command}
This will:
1. Decompose the task into manageable chunks
2. Process files independently (avoiding context overflow)
3. Aggregate results into a coherent summary
Would you like me to proceed with this RLM approach, or would you prefer a
different strategy?
This could involve processing many files. To choose the right approach:
1. How many files are we talking about?
- A few (1-5): I can handle directly
- Several (5-20): Borderline, depends on size
- Many (20+): RLM processing recommended
2. What's the scope?
- Specific directory: {suggest path}
- Whole repository: Definitely use RLM
- Filtered by pattern: {suggest glob pattern}
Please clarify and I'll recommend the best approach.
I can attempt to load {estimated files} directly, but I should warn you:
⚠️ Risks:
- Context window overflow (may truncate output)
- Degraded quality (too much information to process well)
- Slow response time
- Possible incomplete results
**Recommended**: Use RLM processing instead via:
{command}
Do you want to proceed with direct loading anyway, or use the recommended
RLM approach?
The context source is the first positional argument — a single file path or glob pattern. Construct it from explicit and implicit signals.
From explicit mention:
src/**/*lib/components/**/*test/**/*From implicit context:
**/* (whole repo)**/*src/**/* (if src/ exists)Combine the directory scope with a type filter to narrow the glob.
From file type mention:
*.ts*.{jsx,tsx}*.test.{js,ts}*.mdFrom explicit pattern:
**/*.config.jsDefault:
**/*)From explicit mention:
--depth 1--depth 2From implicit context:
--depth 3 (reasonable overview)For batch operations (rlm-batch):
--max-parallel 4 (balanced, mid-sweet-spot)--max-parallel 7 (upper bound; see context-budget rule)--max-parallel 2 (conservative)When AIWG_CONTEXT_WINDOW is declared in the project context, the parallel cap is bounded by the context-budget rule. See @$AIWG_ROOT/agentic/code/addons/aiwg-utils/rules/context-budget.md.
To set up RLM processing, I need to clarify:
1. **Scope**: Which directories?
- [ ] Entire repository (.)
- [ ] Specific directory: _______
- [ ] Multiple directories: _______
2. **Files**: Which file types?
- [ ] All files
- [ ] Code files only (*.js, *.ts, etc.)
- [ ] Specific pattern: _______
3. **Operation**: What should I do with each file?
- [ ] Extract information (use rlm-query)
- [ ] Transform/update (use rlm-batch)
- [ ] Summarize structure (use rlm-batch with summarize aggregation)
Please provide these details.
This request would process approximately {N estimated} files.
**Options:**
1. **Narrow the scope** (recommended):
- Specific directory: {suggest path}
- File type filter: {suggest pattern}
- Depth limit: {suggest depth}
2. **Proceed with full scope** using RLM:
- Command: {command}
- Estimated time: {estimate}
- This will process in chunks to avoid overflow
3. **Sample first**:
- Process a subset to verify approach
- Then expand to full scope
Which option do you prefer?
User: "find all instances of console.log across the entire project"
Detection:
Extraction:
Response:
This requires searching across the entire codebase. I'll use RLM processing:
/rlm-query "**/*.{js,ts,jsx,tsx}" "Find all console.log statements with file and line number"
This will:
1. Recursively scan all JavaScript/TypeScript files
2. Extract console.log locations
3. Aggregate results into a summary report
Proceeding...
User: "update every React component to use the new useAuth hook instead of the old AuthContext"
Detection:
Extraction:
Response:
This is a batch refactoring task that will affect multiple components. Using RLM:
/rlm-batch "src/**/*.{jsx,tsx}" "Replace AuthContext with useAuth hook in {file}" --max-parallel 4
This will:
1. Identify all React components using AuthContext
2. Refactor each to use useAuth hook
3. Process 4 files concurrently for efficiency
4. Verify changes compile before proceeding to next
Proceeding with batch operation...
User: "summarize the whole repository structure so I can understand what this project does"
Detection:
Extraction:
apps/*/README.md or packages/*/README.md for monorepos)Response:
I'll create a hierarchical summary of the repository using RLM batch aggregation:
/rlm-batch "**/README.md" "Summarize {file} for architecture overview" --aggregate summarize --max-parallel 3
This will:
1. Summarize each README independently (sub-agent per file)
2. Aggregate the summaries into one overview
3. Preserve chunked processing for large repositories
4. Generate a concise architecture summary
Proceeding...
User: "check for missing error handling"
Detection:
Response:
I can check for missing error handling. To choose the right approach:
**Scope unclear**:
1. Current file only? (I can do this directly)
2. Specific module/directory? (Please specify path)
3. Entire codebase? (I'll use RLM processing)
**If entire codebase, I recommend:**
/rlm-query "**/*.{js,ts}" "Identify functions missing try-catch or error handling"
Which scope did you have in mind?
Per REF-089 Appendix B (GRADE: LOW, peer-review pending) — RLM relies on the root agent emitting code, so non-coding-capable models underperform.
When suggesting a strategy, also recommend the model:
| Sub-prompt complexity | Recommended sub-agent model |
|---|---|
| Simple extraction (count, list, yes/no) | --model haiku |
| Moderate analysis (summarize, classify, code review) | --model sonnet (default) |
| Complex reasoning (architectural review, multi-step inference) | --model opus |
The orchestrating agent (the one invoking /rlm-query or /rlm-batch) should itself be coding-capable — sonnet or opus, never haiku — because it must emit dispatch code, parse sub-agent results, and aggregate. Output token limits below 4k cap orchestrator effectiveness.
Quick heuristics for estimating whether RLM is needed:
| Directory | Typical File Count | RLM Recommended? |
|-----------|-------------------|------------------|
| src/ (small project) | 10-50 | Maybe (depends on size) |
| src/ (medium project) | 50-200 | Yes |
| src/ (large project) | 200+ | Definitely |
| node_modules/ | 10,000+ | Always (if user really wants this) |
| test/ | Usually ~50-100 | Probably |
| Single directory | <10 | No |
| Single directory | 10-30 | Maybe |
| Single directory | 30+ | Yes |
Rule of thumb: If estimated total file size exceeds 50% of context window, use RLM.
Estimates:
Context windows:
/rlm-query command — recursive information extraction (positional: context-source, sub-prompt)/rlm-batch command — parallel batch processing (positional: glob-pattern, operation; supports --aggregate summarize for hierarchical summary)@$AIWG_ROOT/agentic/code/addons/rlm/schemas/rlm-config.yaml - RLM configuration schema@$AIWG_ROOT/agentic/code/addons/rlm/docs/rlm-architecture.md - RLM system design@.aiwg/research/findings/REF-087-recursive-decomposition.md - Decomposition researchrlm-summarize with rlm-batch --aggregate summarize; renamed --parallel to --max-parallel; generalized Strategy 3 example for monolith and monorepo layouts (Gitea #1191, #1193, #1194; tracks upstream PR #103)data-ai
Report which research-corpus radar sidecars are overdue for refresh. Computes staleness (days since last refresh vs the cadence window) for every radar, sorted most-overdue-first. Runs via `aiwg corpus radar-status`.
data-ai
Aggregate research-corpus radar sidecars into a corpus or per-cluster freshness report — totals, overdue count, per-cluster / per-GRADE / per-trajectory breakdowns, an overdue table, and per-radar rationale snippets. Runs via `aiwg corpus radar-report`.
testing
Scaffold radar/freshness sidecars for research-corpus REFs. Pulls title/authors from the citation sidecar and GRADE from the analysis doc, defaults the refresh cadence from GRADE and the cluster from a corpus-local map, and stamps documentation/radar/REF-XXX-radar.md. Runs via `aiwg corpus radar-init`.
data-ai
Compute an entity's publication trajectory — per-year paper counts, topic drift, hot-streak detection (≥3 consecutive A-grade years), and career phase. Runs via `aiwg corpus profile-temporal`.