/relamo:relamo <query> [--context <path>] [--depth <1-3>] [--iterations <max>]from relamo
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.
Ships in relamo. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
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.
NO ANSWER WITHOUT CONTEXT EXPLORATION FIRST
Never 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.
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.
Determine context source:
--codebase-dir--context-fileInitialize 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 execute call.
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>
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 context variable. Use extract_file(), search(), list_files(), slicing, regex, llm_query().
Execute — Run via Bash:
uv run ${CLAUDE_SKILL_DIR}/scripts/repl.py execute "<code>" --state-dir <dir>
For multi-line code, use heredoc with stdin (-):
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") or FINAL_VAR("result_variable"). When __RELAMO_FINAL__ appears in output, present the answer to the user.
Rules:
llm_query() for reasoning about extracted code — don't try to reason about large text chunks in Python.| 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.
Discover and apply these patterns as appropriate:
print(context[:3000]) or list_files() — orient yourself, understand structuresearch(r'useState|useReducer') — find relevant code across all filescode = extract_file('src/store.ts') then llm_query(f"Analyze this:\n{code}")llm_query_batched([f"Summarize:\n{c}" for c in chunks])recursive_llm("explain the auth flow", extract_file('src/auth.ts'))| 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.
| 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. |
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>
${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 for recursive_llm() sub-calls${CLAUDE_SKILL_DIR}/references/safety-config.md — Full safety configuration, cost estimates, recursion tradeoffsWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub ph3on1x/agent-plugins-skills --plugin relamo