Use rlm_query for recursive task decomposition
masterThe core pattern for solving large tasks is size up → search → delegate → combine. Instead of attempting to process massive files or complex repositories in a single context window, use rlm_query to spawn sub-agents. Each sub-agent receives a fresh context window, allowing you to stay effective on long-running tasks.
Execution Modes:
- Synchronous (Default): Blocks the parent process until the child completes. Use this when the next step depends on the child's output.
- Asynchronous (
--async): Returns immediately, running the child in the background. This is the preferred method for parallel work. It returns a JSON object containingjob_id,output(path to result),sentinel(path to a completion file), andpid.
# Synchronous: Child inherits environment and blocks
rlm_query "Refactor the error handling in src/api.py"
# Asynchronous: Returns immediately for parallel work
rlm_query --async "Write tests for the auth module"
# Piping data as context (Synchronous)
sed -n '100,200p' bigfile.txt | rlm_query "Summarize this section"