trampoline-ai/predict-rlm/rlm
Claude Code and agent skill by trampoline-ai/predict-rlm
- community
Checking that the SKILL.md file is still in the repository.
Plan and build a new callable Recursive Language Model with predict-rlm. Use when a user wants to design an RLM, assess whether an RLM fits a workflow, or implement an RLM package with structured boundaries, skills, host-side tools, custom adapters, or runtime-kernel extensions. For optimization of an existing RLM, use rlm-gepa instead.
Install
npx vskill@latest install trampoline-ai/predict-rlm/rlmSKILL.md
Create a PredictRLM
Check for skill updates
Before planning or building, check whether the installed rlm skill has an update:
Replace npx with pnpx, bunx, or the equivalent package runner in use. After an update, re-read the skill before continuing.
An RLM is a callable, pre-configured agent. It autonomously explores context, writes and executes code in a sandboxed REPL, calls tools, inspects results, and iterates until the task is done. Unlike a chat agent, an RLM is a function — you define its inputs, outputs, and tools, then call it from your code. It returns structured data, not chat messages.
Mental model
The caller supplies a DSPy signature. Its input and output fields are the function contract, and its docstring is the operating procedure. On each call:
- PredictRLM prepares the typed inputs and acquires a sandboxed execution
session. The default backend is a stateful Python REPL running through Deno and Pyodide/WASM.
- The outer LM reads the signature and strategy, then writes Python code
to inspect inputs, preserve intermediate state, branch, retry, and verify. Python variables persist across iterations of that call.
- Sandbox code can use
await predict(...)for focused sub-LM perception
or extraction. Each predict() call has its own context window and can use a typed DSPy signature, Pydantic schemas, and dspy.Image.
- Sandbox code can also use packages and modules supplied by
Skillobjects,
call host-side tools for capabilities outside WASM, and access explicitly allowed network domains.
- When the work is complete, the outer LM calls
SUBMIT(...). PredictRLM
validates the declared outputs, synchronizes file outputs to the host, and returns a dspy.Prediction with the output fields and a structured trace.
The separation is deliberate: the outer LM owns planning and code execution; the sub-LM owns narrow understanding tasks; deterministic libraries and tools do the work they are better suited for. Large context stays in files, sandbox variables, and focused subcalls instead of accumulating in one prompt.
Core API
A minimal typed RLM has a signature, a configured PredictRLM, and a normal sync or async call:
The signature class docstring is the model instruction prompt passed to the outer LM. It is not merely developer documentation: put the RLM's workflow, decision rules, verification steps, and completion criteria there. Changing the docstring changes the model's runtime behavior.
Use rlm(...) for a synchronous call and await rlm.acall(...) for an asynchronous call. Both return a dspy.Prediction; each declared output is available as an attribute such as result.analysis.
The main constructor surface is:
signature— a DSPy signature class or compact string signature;lm— the outer LM that writes code;sub_lm— the LM behind the built-inpredict()tool;skills— reusable instructions, PyPI packages, sandbox modules, and tools;tools— sync or async host callables exposed inside the sandbox;allowed_domains— the sandbox network allowlist, empty by default;max_iterations,max_llm_calls, andmax_output_chars— execution budgets;output_dir— host collection root for declaredFileoutputs;verboseanddebug— human-readable run output and lifecycle diagnostics.
Use File or list[File] for large file inputs and generated artifacts. Use CtxStr for a direct string input, such as a rubric, whose full runtime value must be added to the outer LM prompt as well as exposed as a Python variable. Use a Skill when the sandbox needs reusable instructions, packages, modules, or bundled tools. Use tools= directly for specific host-side actions such as authenticated APIs, databases, native libraries, or host filesystem access.
Runtime kernel and extension model
Most RLMs should use only signatures, File, CtxStr, Workspace, skills, and host tools. Extend the kernel only when the workflow needs a new typed boundary, resource lifecycle, execution substrate, or correctness-critical event stream. Do not reach for a custom adapter merely because a signature uses a Pydantic model.
At construction, PredictRLM resolves direct options and RuntimeContribution module factories into one immutable RuntimeSpec: instructions, adapters, tools, packages, exactly one execution backend, event sinks, validators, and tool operations. Module factories run once at construction. Every invocation then creates a fresh RunContext for mutable state, prepared inputs, bindings, output reservations, cleanup callbacks, and evidence status.
Kernel lifecycle and ownership
The ownership boundaries are strict:
- Adapters declare requirements and destinations before session acquisition.
- The
ExecutionBackendcreates the invocation-scopedExecutionSession. - Adapters may use supported backend or session capabilities, but never acquire,
finalize, or release the session.
- Mutable provider clients, leases, baselines, and retry state belong in the
invocation's PreparedInput or RunContext, never on a shared adapter.
- Sandbox destination overlaps fail before generated code runs.
- Adapter resources finalize on success, failure, setup failure, and
cancellation. Framework-owned session finalization still runs after adapter errors.
Choose the smallest extension point
Use the first boundary that can express the requirement:
- Signature docstring or `CtxStr` — task strategy or invocation-specific
criteria the outer LM must read.
- `Skill` — reusable outer-LM instructions plus sandbox packages,
importable Python modules, or bundled host tools.
- `tools=` — a narrow sync or async host callable. Use this for native
libraries, credentials, APIs, databases, and host filesystem access. Return plain JSON-like data or Pydantic values that can be normalized at the transport boundary.
- `File`, `Workspace`, or an existing adapter — ordinary copied files,
generated files, or a mutable directory. Prefer these built-ins over a new type.
- `InputAdapter` with `PreparedInput.path()`, `.paths()`, or `.glob()` — a
custom typed input can first be materialized as host paths. The kernel owns destination normalization, overlap checks, copying or explicit mounting, backend requirements, and the model-visible sandbox paths.
- Full `InputAdapter` lifecycle — an external resource needs a provider
lease, live handle, per-attempt synchronization, or a custom session capability that cannot be represented as host paths.
- `OutputAdapter` — a custom output needs a reserved destination and
provider-specific materialization while the session is still active.
- `RuntimeContribution` through `modules=` — several host-side extensions
belong together and should compose as one reusable construction-time unit.
- `EventSink` through `events=` — a consumer needs ordered lifecycle events
during the run. Use prediction.trace for the completed trajectory and prediction.evidence for the separate completed lifecycle log.
- `ExecutionBackend` through `execution=` — only for a genuinely new
sandbox or execution substrate. Use sandbox_backend="jspi" or "sbx" for maintained backends.
interpreter= is a compatibility bridge for older CodeInterpreter-shaped integrations, not the root extension contract. New session-native integrations must implement ExecutionBackend and use execution=.
Input adapters
An InputAdapter[T] selects signature fields through value_type and turns the caller's value into model-visible data and runtime requirements. Adapter instances are construction-time objects and may serve concurrent calls, so keep them immutable or concurrency-safe.
Use the current lifecycle names and responsibilities:
prepare(field, value, ctx) -> PreparedInputruns before backend acquisition.
It receives no backend or session. Return declarative paths, artifacts, sandbox-root reservations, metadata, requirements, and input instructions.
open(field, prepared, ctx, backend)may acquire an adapter-owned client or
lease after all inputs are prepared but before a session exists. Store the handle in ctx.state under an adapter-owned key.
bind(field, prepared, ctx, session) -> BoundInputruns after acquisition.
Use it only when the default artifact mounting is insufficient; return the final value and bindings visible to generated code.
append_prompt(prompt, field, prepared, ctx) -> strmay add invocation-local
context to the outer action and forced-extraction prompts after binding. It must not mutate the canonical PredictRLM.signature.
after_execution(field, prepared, ctx, session, result, error)runs after
each completed generated-code attempt. Use it for durability or sync work, including changes made before that attempt raised an error.
finalize(field, prepared, ctx, session, error)performs the final save and
releases adapter-owned resources. Opened adapters finalize once in reverse order; session is None if acquisition failed.
For the common path case, implement only prepare():
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/rlm/SKILL.md
Popularity
- Repository stars
- 435
- Repository forks
- 47
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/trampoline-ai/predict-rlm/rlm)