aiwg 2026.2.2 → 2026.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +5 -1
- package/README.md +9 -0
- package/agentic/code/addons/rlm/README.md +386 -0
- package/agentic/code/addons/rlm/agents/rlm-agent.md +853 -0
- package/agentic/code/addons/rlm/commands/rlm-batch.md +657 -0
- package/agentic/code/addons/rlm/commands/rlm-query.md +465 -0
- package/agentic/code/addons/rlm/commands/rlm-status.md +568 -0
- package/agentic/code/addons/rlm/docs/deployment-guide.md +729 -0
- package/agentic/code/addons/rlm/docs/messaging-events.md +1141 -0
- package/agentic/code/addons/rlm/docs/multi-provider-guide.md +741 -0
- package/agentic/code/addons/rlm/docs/ralph-integration.md +1009 -0
- package/agentic/code/addons/rlm/docs/supervisor-integration.md +803 -0
- package/agentic/code/addons/rlm/docs/taskstore-persistence.md +959 -0
- package/agentic/code/addons/rlm/manifest.json +75 -0
- package/agentic/code/addons/rlm/rules/rlm-context-management.md +664 -0
- package/agentic/code/addons/rlm/schemas/rlm-cost.yaml +841 -0
- package/agentic/code/addons/rlm/schemas/rlm-state.yaml +601 -0
- package/agentic/code/addons/rlm/schemas/rlm-task-tree.yaml +641 -0
- package/agentic/code/addons/rlm/schemas/rlm-trajectory.yaml +805 -0
- package/agentic/code/addons/rlm/skills/rlm-mode/SKILL.md +496 -0
- package/agentic/code/addons/rlm/templates/cost-report.md +151 -0
- package/docs/_manifest.json +16 -0
- package/docs/cli-reference.md +17 -4
- package/docs/daemon-guide.md +797 -0
- package/docs/messaging-guide.md +385 -0
- package/docs/ralph-guide.md +52 -1
- package/docs/releases/v2026.2.3-announcement.md +140 -0
- package/package.json +1 -1
- package/src/cli/handlers/use.ts +69 -4
- package/src/extensions/commands/definitions.ts +3 -3
- package/tools/daemon/README.md +368 -0
- package/tools/daemon/agent-supervisor.mjs +297 -0
- package/tools/daemon/automation-engine.mjs +310 -0
- package/tools/daemon/config.mjs +137 -0
- package/tools/daemon/cron-scheduler.mjs +103 -0
- package/tools/daemon/daemon-main.mjs +518 -0
- package/tools/daemon/event-router.mjs +62 -0
- package/tools/daemon/file-watcher.mjs +141 -0
- package/tools/daemon/index.mjs +598 -0
- package/tools/daemon/ipc-client.mjs +197 -0
- package/tools/daemon/ipc-server.mjs +275 -0
- package/tools/daemon/repl-chat.mjs +357 -0
- package/tools/daemon/task-store.mjs +273 -0
- package/tools/daemon/tmux-manager.mjs +327 -0
- package/tools/messaging/adapter-registry.mjs +228 -0
- package/tools/messaging/adapters/base.mjs +230 -0
- package/tools/messaging/adapters/discord.mjs +414 -0
- package/tools/messaging/adapters/slack.mjs +398 -0
- package/tools/messaging/adapters/telegram.mjs +516 -0
- package/tools/messaging/chat-handler.mjs +292 -0
- package/tools/messaging/command-router.mjs +269 -0
- package/tools/messaging/event-bus.mjs +199 -0
- package/tools/messaging/index.mjs +386 -0
- package/tools/messaging/message-formatter.mjs +320 -0
- package/tools/messaging/types.mjs +89 -0
- package/tools/ralph-external/index.mjs +2 -1
package/CLAUDE.md
CHANGED
|
@@ -207,8 +207,9 @@ aiwg version # Show version and channel
|
|
|
207
207
|
aiwg doctor # Check installation health
|
|
208
208
|
aiwg update # Check for updates
|
|
209
209
|
|
|
210
|
-
# Framework management
|
|
210
|
+
# Framework and addon management
|
|
211
211
|
aiwg use sdlc # Deploy SDLC framework
|
|
212
|
+
aiwg use rlm # Deploy RLM addon
|
|
212
213
|
aiwg use sdlc --provider copilot # Deploy to GitHub Copilot
|
|
213
214
|
aiwg list # List installed frameworks
|
|
214
215
|
aiwg remove sdlc # Remove framework
|
|
@@ -259,6 +260,9 @@ aiwg reproducibility-validate # Validate workflow reproducibility
|
|
|
259
260
|
| **Creating Extensions** | `@docs/extensions/creating-extensions.md` |
|
|
260
261
|
| **Extension Types** | `@docs/extensions/extension-types.md` |
|
|
261
262
|
| **SDLC Framework** | `@agentic/code/frameworks/sdlc-complete/README.md` |
|
|
263
|
+
| **RLM Addon** | `@agentic/code/addons/rlm/README.md` |
|
|
264
|
+
| **Daemon Mode** | `@docs/daemon-guide.md` |
|
|
265
|
+
| **Messaging Integration** | `@docs/messaging-guide.md` |
|
|
262
266
|
| **Voice Profiles** | `@agentic/code/addons/voice-framework/voices/templates/` |
|
|
263
267
|
| **Natural Language Patterns** | `@docs/simple-language-translations.md` |
|
|
264
268
|
| **Agent Catalog** | `@agentic/code/frameworks/sdlc-complete/agents/` |
|
package/README.md
CHANGED
|
@@ -95,6 +95,7 @@ npm install -g aiwg
|
|
|
95
95
|
cd your-project
|
|
96
96
|
aiwg use sdlc # Full SDLC framework
|
|
97
97
|
aiwg use marketing # Marketing framework
|
|
98
|
+
aiwg use rlm # RLM addon (recursive context decomposition)
|
|
98
99
|
aiwg use all # All frameworks
|
|
99
100
|
|
|
100
101
|
# Or scaffold a new project
|
|
@@ -125,6 +126,7 @@ aiwg new my-project
|
|
|
125
126
|
|
|
126
127
|
| Addon | What it does |
|
|
127
128
|
|-------|--------------|
|
|
129
|
+
| **[RLM](agentic/code/addons/rlm/)** | Recursive context decomposition for processing 10M+ tokens via sub-agent delegation |
|
|
128
130
|
| **[Writing Quality](agentic/code/addons/writing-quality/)** | Content validation, AI pattern detection, voice profiles |
|
|
129
131
|
| **[Testing Quality](agentic/code/addons/testing-quality/)** | TDD enforcement, mutation testing, flaky test detection |
|
|
130
132
|
| **[Voice Framework](agentic/code/addons/voice-framework/)** | 4 built-in voice profiles with create/blend/apply skills |
|
|
@@ -153,6 +155,10 @@ aiwg new my-project
|
|
|
153
155
|
# Long-running tasks with crash recovery (6-8 hours)
|
|
154
156
|
/ralph-external "Migrate to TypeScript" --completion "npx tsc --noEmit exits 0"
|
|
155
157
|
|
|
158
|
+
# Process massive codebases with recursive decomposition
|
|
159
|
+
/rlm-query "src/**/*.ts" "Extract all exported interfaces" --model haiku
|
|
160
|
+
/rlm-batch "src/components/*.tsx" "Add TypeScript types" --parallel 4
|
|
161
|
+
|
|
156
162
|
# Deploy to production
|
|
157
163
|
/flow-deploy-to-production
|
|
158
164
|
```
|
|
@@ -244,6 +250,9 @@ AIWG's unified extension system enables dynamic discovery, semantic search, and
|
|
|
244
250
|
### Advanced Topics
|
|
245
251
|
|
|
246
252
|
- **[Ralph Loop](docs/ralph-guide.md)** — Iterative task execution with crash recovery
|
|
253
|
+
- **[RLM Addon](agentic/code/addons/rlm/README.md)** — Recursive context decomposition for 10M+ token processing
|
|
254
|
+
- **[Daemon Mode](docs/daemon-guide.md)** — Background file watching, cron scheduling, IPC
|
|
255
|
+
- **[Messaging Integration](docs/messaging-guide.md)** — Bidirectional Slack, Discord, and Telegram bots
|
|
247
256
|
- **[Workspace Architecture](docs/architecture/workspace-architecture.md)** — Multi-framework isolation
|
|
248
257
|
- **[Multi-Agent Orchestration](agentic/code/frameworks/sdlc-complete/docs/orchestrator-architecture.md)** — Parallel reviews and synthesis
|
|
249
258
|
- **[MCP Server](docs/mcp/)** — Model Context Protocol integration
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
# RLM — Recursive Language Models Addon
|
|
2
|
+
|
|
3
|
+
**Version**: 1.0.0
|
|
4
|
+
**Status**: Production Ready
|
|
5
|
+
**Research Foundation**: REF-089 (Zhang et al., 2026)
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
The Recursive Language Models (RLM) addon enables AIWG agents to process arbitrarily large codebases, documentation corpora, and multi-file operations through recursive sub-agent delegation and programmatic environment interaction. Instead of loading entire contexts into the conversation window, RLM treats context as an external environment accessed selectively through code.
|
|
10
|
+
|
|
11
|
+
**Key insight from REF-089**: Long prompts should not be fed into the neural network directly but should instead be treated as part of the environment that the LLM is tasked to symbolically and recursively interact with. This approach is lossless, cost-efficient, and scales to 10M+ tokens through recursive composition.
|
|
12
|
+
|
|
13
|
+
**AIWG alignment**: Claude Code already operates this way through Read, Grep, and Glob tools. RLM formalizes and extends these patterns with recursive decomposition, parallel fan-out processing, and explicit task tree management.
|
|
14
|
+
|
|
15
|
+
Research demonstrates up to 3x cost reduction compared to summarization approaches while maintaining stronger performance, because the agent can selectively access only relevant portions of context.
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Deploy RLM addon to current provider
|
|
21
|
+
aiwg use rlm
|
|
22
|
+
|
|
23
|
+
# Spawn focused sub-agent for specific context
|
|
24
|
+
/rlm-query src/auth/login.ts "identify security issues"
|
|
25
|
+
|
|
26
|
+
# Parallel fan-out processing across multiple files
|
|
27
|
+
/rlm-batch "src/**/*.ts" "extract all exported function names"
|
|
28
|
+
|
|
29
|
+
# Check execution status and cost
|
|
30
|
+
/rlm-status --cost
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Components
|
|
34
|
+
|
|
35
|
+
| Component | Type | Description |
|
|
36
|
+
|-----------|------|-------------|
|
|
37
|
+
| **rlm-agent** | Agent | Recursive decomposition specialist orchestrating environment interaction |
|
|
38
|
+
| **rlm-query** | Command | Sub-agent spawner (equivalent to RLM's `llm_query()`) for focused context processing |
|
|
39
|
+
| **rlm-batch** | Command | Parallel fan-out processing for batch operations across multiple files |
|
|
40
|
+
| **rlm-status** | Command | Real-time status dashboard showing task tree, progress, and cost |
|
|
41
|
+
| **rlm-mode** | Skill | Natural language trigger detecting large-scale operations requiring decomposition |
|
|
42
|
+
| **rlm-context-management** | Rule | Enforcement rules for symbolic handles, programmatic access, and recursive delegation |
|
|
43
|
+
|
|
44
|
+
## When to Use RLM
|
|
45
|
+
|
|
46
|
+
Use RLM for tasks that meet any of these criteria:
|
|
47
|
+
|
|
48
|
+
**1. Context Window Constraints**
|
|
49
|
+
- Task involves files or data exceeding available context window
|
|
50
|
+
- Need to analyze entire codebase larger than model capacity
|
|
51
|
+
- Working with multi-file operations spanning hundreds of files
|
|
52
|
+
|
|
53
|
+
**2. Information Density**
|
|
54
|
+
- Task requires selective access to specific details throughout large corpus
|
|
55
|
+
- Cannot afford lossy summarization (need full information preserved)
|
|
56
|
+
- Need to maintain complete detail while processing large volumes
|
|
57
|
+
|
|
58
|
+
**3. Batch Processing**
|
|
59
|
+
- Same operation applied to many files independently
|
|
60
|
+
- Parallel processing would improve speed and cost
|
|
61
|
+
- Results need to be aggregated from distributed sub-tasks
|
|
62
|
+
|
|
63
|
+
**4. Recursive Structure**
|
|
64
|
+
- Problem naturally decomposes into independent sub-problems
|
|
65
|
+
- Sub-problems can be solved in parallel or sequentially
|
|
66
|
+
- Final result synthesized from sub-results
|
|
67
|
+
|
|
68
|
+
## Architecture
|
|
69
|
+
|
|
70
|
+
### Mapping to AIWG
|
|
71
|
+
|
|
72
|
+
RLM's three-component architecture maps cleanly to AIWG's existing capabilities:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
RLM Component → AIWG Equivalent
|
|
76
|
+
─────────────────────────────────────────────
|
|
77
|
+
REPL (code execution) → Read, Grep, Glob, Bash tools
|
|
78
|
+
llm_query() → Task tool (sub-agent spawning)
|
|
79
|
+
Final env variable → Task completion criteria
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Execution Flow
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
┌────────────────────────────────────────────────────────┐
|
|
86
|
+
│ Root Agent (RLM) │
|
|
87
|
+
│ "Analyze authentication security across codebase" │
|
|
88
|
+
└─────────────┬──────────────────────────────────────────┘
|
|
89
|
+
│
|
|
90
|
+
│ Decompose
|
|
91
|
+
▼
|
|
92
|
+
┌─────────────────────────┐
|
|
93
|
+
│ Symbolic Environment │
|
|
94
|
+
│ src/auth/**/*.ts │
|
|
95
|
+
└─────────────────────────┘
|
|
96
|
+
│
|
|
97
|
+
│ Programmatic Query
|
|
98
|
+
▼
|
|
99
|
+
┌─────────────────────────┐
|
|
100
|
+
│ Grep: "password.*hash" │
|
|
101
|
+
│ → 12 relevant files │
|
|
102
|
+
└─────────────────────────┘
|
|
103
|
+
│
|
|
104
|
+
│ Spawn Sub-Agents
|
|
105
|
+
▼
|
|
106
|
+
┌──────────────┬──────────────┬──────────────┐
|
|
107
|
+
│ Sub-Agent 1 │ Sub-Agent 2 │ Sub-Agent 3 │
|
|
108
|
+
│ login.ts │ register.ts │ reset.ts │
|
|
109
|
+
└──────────────┴──────────────┴──────────────┘
|
|
110
|
+
│
|
|
111
|
+
│ Aggregate Results
|
|
112
|
+
▼
|
|
113
|
+
┌─────────────────────────────────────────────┐
|
|
114
|
+
│ Security Report: │
|
|
115
|
+
│ - Password hashing: bcrypt (GOOD) │
|
|
116
|
+
│ - Token generation: crypto.randomBytes (OK) │
|
|
117
|
+
│ - Reset flow: Missing rate limiting (BAD) │
|
|
118
|
+
└─────────────────────────────────────────────┘
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Key principles**:
|
|
122
|
+
1. Root agent never loads full file contents
|
|
123
|
+
2. Symbolic handles (file paths) used for references
|
|
124
|
+
3. Programmatic filtering (Grep/Glob) before reading
|
|
125
|
+
4. Independent sub-agents process chunks in parallel
|
|
126
|
+
5. Results aggregated incrementally through intermediate artifacts
|
|
127
|
+
|
|
128
|
+
## Configuration
|
|
129
|
+
|
|
130
|
+
Default settings from `manifest.json`:
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"maxDepth": 3,
|
|
135
|
+
"maxSubCalls": 20,
|
|
136
|
+
"defaultSubModel": "sonnet",
|
|
137
|
+
"budgetTokens": 500000,
|
|
138
|
+
"parallelSubCalls": true,
|
|
139
|
+
"persistState": true
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Override Configuration
|
|
144
|
+
|
|
145
|
+
**Project-level** (`aiwg.yml`):
|
|
146
|
+
```yaml
|
|
147
|
+
addons:
|
|
148
|
+
rlm:
|
|
149
|
+
maxDepth: 5
|
|
150
|
+
maxSubCalls: 50
|
|
151
|
+
budgetTokens: 1000000
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Command-level** (inline):
|
|
155
|
+
```bash
|
|
156
|
+
/rlm-query file.ts "analyze" --depth 2
|
|
157
|
+
/rlm-batch "src/**/*.ts" "check" --max-parallel 5
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Configuration Parameters
|
|
161
|
+
|
|
162
|
+
| Parameter | Default | Description |
|
|
163
|
+
|-----------|---------|-------------|
|
|
164
|
+
| `maxDepth` | 3 | Maximum recursion depth for sub-agent chains |
|
|
165
|
+
| `maxSubCalls` | 20 | Maximum number of sub-agents per task |
|
|
166
|
+
| `defaultSubModel` | sonnet | Model for sub-agents (root agent always uses opus) |
|
|
167
|
+
| `budgetTokens` | 500000 | Maximum token budget across entire task tree |
|
|
168
|
+
| `parallelSubCalls` | true | Enable parallel execution of independent sub-agents |
|
|
169
|
+
| `persistState` | true | Save task tree state for recovery and analysis |
|
|
170
|
+
|
|
171
|
+
## Research Foundation
|
|
172
|
+
|
|
173
|
+
**REF-089: Recursive Language Models (Zhang et al., 2026)**
|
|
174
|
+
|
|
175
|
+
Key findings:
|
|
176
|
+
- **10M+ token processing**: Scales beyond any fixed context window through recursion
|
|
177
|
+
- **3x cost reduction**: Selective access cheaper than loading full context
|
|
178
|
+
- **Superior performance**: Maintains details lost to summarization
|
|
179
|
+
- **28.3% improvement**: Additional gain from training on RLM trajectories
|
|
180
|
+
|
|
181
|
+
**Core design choices**:
|
|
182
|
+
1. **Treat context as environment**: Long prompts are not model input but external data
|
|
183
|
+
2. **Programmatic access**: Query context via code rather than reading sequentially
|
|
184
|
+
3. **Recursive composition**: Decompose problems into sub-problems solved by sub-agents
|
|
185
|
+
4. **Selective reading**: Access only relevant portions, not entire corpus
|
|
186
|
+
|
|
187
|
+
**Research quote**:
|
|
188
|
+
> "Compared to the summarization agent which ingests the entire input context, RLMs are up to 3× cheaper while maintaining stronger performance across all tasks because the RLM is able to selectively view context."
|
|
189
|
+
|
|
190
|
+
## Integration Points
|
|
191
|
+
|
|
192
|
+
RLM integrates with multiple AIWG systems:
|
|
193
|
+
|
|
194
|
+
### Agent Supervisor (`tools/daemon/agent-supervisor.mjs`)
|
|
195
|
+
- Sub-agent lifecycle management
|
|
196
|
+
- Model selection and routing
|
|
197
|
+
- Resource allocation and limits
|
|
198
|
+
|
|
199
|
+
### Task Store (`tools/daemon/task-store.mjs`)
|
|
200
|
+
- Persistent task tree storage
|
|
201
|
+
- State recovery after failures
|
|
202
|
+
- Progress tracking across restarts
|
|
203
|
+
|
|
204
|
+
### Messaging Hub (`tools/messaging/index.mjs`)
|
|
205
|
+
- Sub-agent result collection
|
|
206
|
+
- Parallel execution coordination
|
|
207
|
+
- Aggregation patterns
|
|
208
|
+
|
|
209
|
+
### Ralph Loops (`tools/ralph-external/`)
|
|
210
|
+
- Iterative refinement within sub-agents
|
|
211
|
+
- Best-output selection from multiple attempts
|
|
212
|
+
- Feedback-driven improvement
|
|
213
|
+
|
|
214
|
+
### Multi-Provider Support
|
|
215
|
+
- Codex, Claude, Copilot, Cursor, Factory, OpenCode, Warp, Windsurf
|
|
216
|
+
- Model mapping handles provider differences
|
|
217
|
+
- Consistent RLM patterns across all platforms
|
|
218
|
+
|
|
219
|
+
## Schemas
|
|
220
|
+
|
|
221
|
+
RLM defines four core schemas:
|
|
222
|
+
|
|
223
|
+
**1. Task Tree** (`schemas/rlm-task-tree.yaml`)
|
|
224
|
+
- Hierarchical decomposition structure
|
|
225
|
+
- Parent-child relationships
|
|
226
|
+
- Dependency tracking
|
|
227
|
+
|
|
228
|
+
**2. State** (`schemas/rlm-state.yaml`)
|
|
229
|
+
- Execution status per sub-task
|
|
230
|
+
- Intermediate results
|
|
231
|
+
- Completion signals
|
|
232
|
+
|
|
233
|
+
**3. Trajectory** (`schemas/rlm-trajectory.yaml`)
|
|
234
|
+
- Tool invocation history
|
|
235
|
+
- Decision points and rationale
|
|
236
|
+
- Learning data for future training
|
|
237
|
+
|
|
238
|
+
**4. Cost** (`schemas/rlm-cost.yaml`)
|
|
239
|
+
- Token usage by depth
|
|
240
|
+
- Model costs per sub-agent
|
|
241
|
+
- Total budget tracking
|
|
242
|
+
|
|
243
|
+
## Dependencies
|
|
244
|
+
|
|
245
|
+
**Required**: None (RLM operates independently)
|
|
246
|
+
|
|
247
|
+
**Optional**:
|
|
248
|
+
- **ralph**: Enhanced iteration loops with best-output selection
|
|
249
|
+
- **aiwg-utils**: Development utilities for testing and debugging
|
|
250
|
+
|
|
251
|
+
## Usage Patterns
|
|
252
|
+
|
|
253
|
+
### Pattern 1: Single-File Deep Analysis
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
# Large file that exceeds context window
|
|
257
|
+
/rlm-query src/large-module.ts "identify all async race conditions"
|
|
258
|
+
|
|
259
|
+
# RLM will:
|
|
260
|
+
# 1. Chunk file by function/class
|
|
261
|
+
# 2. Grep for async patterns
|
|
262
|
+
# 3. Spawn sub-agents for each async function
|
|
263
|
+
# 4. Aggregate race condition findings
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Pattern 2: Corpus-Wide Search
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
# Find all API endpoints across entire codebase
|
|
270
|
+
/rlm-batch "src/**/*.ts" "list all HTTP route handlers"
|
|
271
|
+
|
|
272
|
+
# RLM will:
|
|
273
|
+
# 1. Glob match 50 TypeScript files
|
|
274
|
+
# 2. Spawn 50 parallel sub-agents (respecting max-parallel)
|
|
275
|
+
# 3. Each extracts endpoints from one file
|
|
276
|
+
# 4. Aggregate into comprehensive API inventory
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Pattern 3: Cross-Cutting Refactor
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
# Rename function across entire codebase
|
|
283
|
+
/rlm-query "src/**/*.js" "find all calls to oldFunctionName()"
|
|
284
|
+
# → intermediate result: call-sites.json
|
|
285
|
+
|
|
286
|
+
/rlm-batch "@call-sites.json" "rename oldFunctionName to newFunctionName"
|
|
287
|
+
# → applies changes to each file independently
|
|
288
|
+
|
|
289
|
+
/rlm-query "src/**/*.js" "verify no references to oldFunctionName remain"
|
|
290
|
+
# → validation check
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Pattern 4: Research Synthesis
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
# Analyze 100 research papers for common themes
|
|
297
|
+
/rlm-batch ".aiwg/research/sources/**/*.pdf" "extract main contribution"
|
|
298
|
+
# → 100 summaries
|
|
299
|
+
|
|
300
|
+
/rlm-query "@summaries/*.txt" "identify 5 most common themes"
|
|
301
|
+
# → synthesized analysis
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
## Advanced Topics
|
|
305
|
+
|
|
306
|
+
See documentation in `docs/`:
|
|
307
|
+
|
|
308
|
+
- **Architecture Deep Dive**: `docs/architecture.md`
|
|
309
|
+
- **Cost Optimization**: `docs/cost-optimization.md`
|
|
310
|
+
- **Parallel Execution**: `docs/parallel-patterns.md`
|
|
311
|
+
- **Error Recovery**: `docs/error-recovery.md`
|
|
312
|
+
- **Trajectory Analysis**: `docs/trajectory-analysis.md`
|
|
313
|
+
- **Integration Guide**: `docs/integration.md`
|
|
314
|
+
- **Research Background**: `docs/research-foundation.md`
|
|
315
|
+
|
|
316
|
+
## Performance Characteristics
|
|
317
|
+
|
|
318
|
+
Based on REF-089 benchmarks:
|
|
319
|
+
|
|
320
|
+
| Metric | RLM | Summarization | Direct Context |
|
|
321
|
+
|--------|-----|---------------|----------------|
|
|
322
|
+
| **Max tokens** | 10M+ (unbounded) | ~1M (limited by compression ratio) | ~200K (context window) |
|
|
323
|
+
| **Cost** | 1x (baseline) | 3x (reads everything) | N/A (overflow) |
|
|
324
|
+
| **Quality** | High (lossless) | Medium (lossy) | N/A (fails) |
|
|
325
|
+
| **Latency** | Variable (parallel) | High (sequential) | N/A (fails) |
|
|
326
|
+
|
|
327
|
+
**When RLM excels**:
|
|
328
|
+
- Information-dense tasks requiring full detail
|
|
329
|
+
- Tasks that decompose naturally into independent sub-problems
|
|
330
|
+
- Operations benefiting from parallelism
|
|
331
|
+
|
|
332
|
+
**When alternatives better**:
|
|
333
|
+
- Small contexts (<50K tokens) where direct reading works
|
|
334
|
+
- Tasks requiring global understanding that cannot decompose
|
|
335
|
+
- Real-time latency-critical operations
|
|
336
|
+
|
|
337
|
+
## Troubleshooting
|
|
338
|
+
|
|
339
|
+
**Problem**: Sub-agents exceed budget
|
|
340
|
+
|
|
341
|
+
**Solution**: Reduce `maxSubCalls` or `budgetTokens`, or increase sub-agent focus
|
|
342
|
+
|
|
343
|
+
**Problem**: Task tree too deep
|
|
344
|
+
|
|
345
|
+
**Solution**: Reduce `maxDepth`, or improve decomposition strategy
|
|
346
|
+
|
|
347
|
+
**Problem**: Slow execution despite parallelization
|
|
348
|
+
|
|
349
|
+
**Solution**: Check `parallelSubCalls` is enabled, verify provider supports concurrency
|
|
350
|
+
|
|
351
|
+
**Problem**: Results incomplete after timeout
|
|
352
|
+
|
|
353
|
+
**Solution**: Use `/rlm-status` to check progress, increase timeout, or resume from checkpoint
|
|
354
|
+
|
|
355
|
+
## References
|
|
356
|
+
|
|
357
|
+
**Research**:
|
|
358
|
+
- `.aiwg/research/findings/REF-089-recursive-language-models.md` — Primary research paper
|
|
359
|
+
- `.aiwg/research/synthesis/topic-04-tool-grounding.md` — Tool grounding patterns
|
|
360
|
+
- `.aiwg/research/synthesis/topic-02-decomposition.md` — Task decomposition strategies
|
|
361
|
+
|
|
362
|
+
**AIWG Documentation**:
|
|
363
|
+
- `agentic/code/addons/rlm/docs/architecture.md` — Architecture details
|
|
364
|
+
- `agentic/code/addons/rlm/docs/cost-optimization.md` — Cost optimization guide
|
|
365
|
+
- `agentic/code/addons/rlm/docs/parallel-patterns.md` — Parallelization patterns
|
|
366
|
+
|
|
367
|
+
**Rules and Schemas**:
|
|
368
|
+
- `agentic/code/addons/rlm/rules/rlm-context-management.md` — Context management rules
|
|
369
|
+
- `agentic/code/addons/rlm/schemas/` — All schema definitions
|
|
370
|
+
|
|
371
|
+
**Related Issues**:
|
|
372
|
+
- #322 — Core RLM addon implementation
|
|
373
|
+
- #323 — Parallel batch processing
|
|
374
|
+
- #324 — Task tree visualization
|
|
375
|
+
- #325 — Cost tracking and budgets
|
|
376
|
+
|
|
377
|
+
**Related Addons**:
|
|
378
|
+
- `agentic/code/addons/ralph/` — Iterative refinement loops
|
|
379
|
+
- `agentic/code/addons/aiwg-utils/` — Development utilities
|
|
380
|
+
- `agentic/code/frameworks/sdlc-complete/` — SDLC agent workflows
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
**License**: MIT
|
|
385
|
+
**Author**: AIWG Contributors
|
|
386
|
+
**Repository**: https://github.com/jmagly/ai-writing-guide
|