relamo
Skill0 starsChanged 17 days agoMITView on GitHub
This skill should be used when the user asks to "process large codebase", "recursive language model", "RLM", "explore entire codebase", "analyze codebase", "REPL loop for code", "context as variable", "chunk and process codebase", or needs to programmatically explore a codebase too large for the context window using iterative Python-based exploration.
In this repository3 other files it gives its agents.
- adveloopSkill
- cmuxSkill
- refine-promptSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 19
Never synthesize an answer from the query alone.
- Very specific: line 30
If $ARGUMENTS is empty, ask the user for a query.
- Very specific: line 47
If --depth or --iterations were specified, override defaults in the first execute call:
- Distinctive: line 79
After 3 iterations without progress, reassess strategy entirely.
- Very specific: line 80
Use llm_query() for reasoning about extracted code — don't try to reason about large text chunks in Python.
- Very specific: line 135
After FINAL() emits the answer, present results to the user:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
/relamo — Recursive Language Model
Explore codebases programmatically through a persistent Python REPL. The entire codebase is concatenated into a single context variable. Write Python code to search, slice, chunk, and analyze it — with llm_query() for LLM-in-the-loop sub-analysis and recursive_llm() for deep dives.
This is NOT prompt-stuffing. Context lives outside the prompt as a Python variable. Claude writes code to interact with it iteratively, accumulating findings in variables across REPL invocations.
The Iron Law
NO ANSWER WITHOUT CONTEXT EXPLORATION FIRSTNever synthesize an answer from the query alone. Always explore the codebase programmatically first — peek at structure, search for relevant code, extract and analyze files. Even if the answer seems obvious, verify it against the actual code.
Argument Parsing
Parse $ARGUMENTS:
<query>(required) — the task or question to answer--context <path>(optional) — path to codebase directory or single file. Defaults to${CLAUDE_WORK_DIR}.--depth <1-3>(optional) — recursion depth limit. Default 1.--iterations <max>(optional) — max REPL loop iterations. Default 15.
If $ARGUMENTS is empty, ask the user for a query.
Initialization
- Determine context source:
- Directory (default): use
--codebase-dir - Single file: use
--context-file
- Directory (default): use
- Initialize the REPL:
Bash: uv run ${CLAUDE_SKILL_DIR}/scripts/repl.py init --codebase-dir ${CLAUDE_WORK_DIR} --state-dir /tmp/relamo-$(date +%s) - Record the state directory path from output — pass it to every subsequent
executecall. - Review the init summary: file count, context size, sample files. If context is empty or unexpectedly small, investigate before proceeding.
If --depth or --iterations were specified, override defaults in the first execute call:
config["recursion_limit"] = <depth>
config["max_iterations"] = <iterations>The REPL Loop
Iterate until FINAL() is called or max iterations reached:
- Assess — State what you know so far and what you need to find out next. Every iteration MUST have a stated goal.
- Write code — Compose Python targeting the
contextvariable. Useextract_file(),search(),list_files(), slicing, regex,llm_query(). - Execute — Run via Bash:
For multi-line code, use heredoc with stdin (uv run ${CLAUDE_SKILL_DIR}/scripts/repl.py execute "<code>" --state-dir <dir>-):uv run ${CLAUDE_SKILL_DIR}/scripts/repl.py execute - --state-dir <dir> <<'PYEOF' <multi-line code> PYEOF - Read output — Parse stdout. If truncated, refine the query to target specific sections.
- Decide — Need more exploration? → back to step 1. Ready to answer? → step 6.
- Terminate — Call
FINAL("your answer")orFINAL_VAR("result_variable"). When__RELAMO_FINAL__appears in output, present the answer to the user.
Rules:
- After 3 iterations without progress, reassess strategy entirely.
- Use
llm_query()for reasoning about extracted code — don't try to reason about large text chunks in Python. - Store intermediate results in variables — they persist across iterations.
Available REPL Functions
| Function | Purpose |
context | Full concatenated codebase as string |
list_files() | All file paths in context |
extract_file(path) | Extract single file content by path |
search(pattern, context_chars=200) | Regex search returning matches with surrounding context |
llm_query(prompt) | LLM completion via claude -p |
llm_query_batched(prompts) | Sequential LLM calls on a list of prompts |
recursive_llm(query, sub_context) | Spawn child RLM (respects depth limit) |
FINAL(answer) | Emit final answer — terminates loop |
FINAL_VAR(var_name) | Emit a namespace variable as the answer |
config | Mutable safety config dict |
For full function signatures, read ${CLAUDE_SKILL_DIR}/references/repl-setup.md.
Emergent Strategies
Discover and apply these patterns as appropriate:
- Peek:
print(context[:3000])orlist_files()— orient yourself, understand structure - Search:
search(r'useState|useReducer')— find relevant code across all files - Extract + Analyze:
code = extract_file('src/store.ts')thenllm_query(f"Analyze this:\n{code}") - Partition + Map: chunk a large file,
llm_query_batched([f"Summarize:\n{c}" for c in chunks]) - Recursive deep dive:
recursive_llm("explain the auth flow", extract_file('src/auth.ts')) - Aggregate: store findings in variables across iterations, synthesize at the end
Safety Guardrails
| Parameter | Default |
recursion_limit | 1 |
max_iterations | 15 |
timeout_seconds | 120 |
max_output_chars | 10000 |
For full configuration and rationale, read ${CLAUDE_SKILL_DIR}/references/safety-config.md.
Common Rationalizations
| Thought | Reality |
| "I can answer from the query alone" | The codebase has the ground truth. Explore first. |
| "The codebase is small, just read it all" | Use the REPL — variables persist for verification. |
"One llm_query on everything" | That defeats the purpose. Target specific files. |
| "Skip the REPL, use Read/Grep directly" | REPL enables variable persistence and batch processing. |
| "Recursion is overkill" | Even depth-1 outperforms flat prompting on large context. |
| "15 iterations aren't enough" | Wrong approach. Reassess strategy. |
Output Format
After FINAL() emits the answer, present results to the user:
## RLM Result
### Exploration Summary
<Strategies used, iterations taken, llm_query calls made>
### Answer
<The FINAL answer>
### Evidence
<Key code excerpts from the context that support the answer>Additional Resources
${CLAUDE_SKILL_DIR}/references/repl-setup.md— REPL architecture, context loading, helper function signatures, sandboxing, troubleshooting${CLAUDE_SKILL_DIR}/references/system-prompt.md— System prompt template forrecursive_llm()sub-calls${CLAUDE_SKILL_DIR}/references/safety-config.md— Full safety configuration, cost estimates, recursion tradeoffs
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

