@rembr/vscode 1.0.0 → 2.0.0
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/CHANGELOG.md +57 -1
- package/README.md +261 -148
- package/cli.js +29 -14
- package/package.json +2 -2
- package/setup.js +144 -29
- package/templates/agents/ralph-rlm.agent.md +164 -0
- package/templates/agents/rlm.agent.md +106 -0
- package/templates/copilot-instructions.md +66 -49
- package/templates/instructions/code-investigation.instructions.md +103 -0
- package/templates/instructions/rembr-integration.instructions.md +88 -0
- package/templates/prompts/ralph-analyze.prompt.md +74 -0
- package/templates/prompts/ralph-plan.prompt.md +70 -0
- package/templates/prompts/rlm-analyze.prompt.md +39 -0
- package/templates/prompts/rlm-plan.prompt.md +58 -0
- package/templates/recursive-agent.agent.md +277 -0
- package/templates/recursive-analyst.agent.md +9 -17
- package/templates/skills/ralph-rlm-orchestration/SKILL.md +297 -0
- package/templates/skills/rlm-orchestration/SKILL.md +180 -0
- package/templates/aider.conf.yml +0 -52
- package/templates/cursorrules +0 -141
- package/templates/windsurfrules +0 -141
package/setup.js
CHANGED
|
@@ -106,20 +106,41 @@ function setupClaudeDesktopMCP() {
|
|
|
106
106
|
function setupGitHubCopilotAgent(projectRoot) {
|
|
107
107
|
const githubDir = path.join(projectRoot, '.github');
|
|
108
108
|
const agentsDir = path.join(githubDir, 'agents');
|
|
109
|
-
const agentPath = path.join(agentsDir, 'recursive-analyst.agent.md');
|
|
110
109
|
|
|
111
110
|
ensureDirectoryExists(agentsDir);
|
|
112
111
|
|
|
113
|
-
|
|
114
|
-
const
|
|
112
|
+
// New RLM agents (v2.0)
|
|
113
|
+
const agents = [
|
|
114
|
+
'rlm.agent.md',
|
|
115
|
+
'ralph-rlm.agent.md'
|
|
116
|
+
];
|
|
115
117
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
agents.forEach(agentFile => {
|
|
119
|
+
const agentPath = path.join(agentsDir, agentFile);
|
|
120
|
+
const templatePath = path.join(__dirname, 'templates', 'agents', agentFile);
|
|
121
|
+
|
|
122
|
+
if (fs.existsSync(agentPath)) {
|
|
123
|
+
console.log(`⚠ .github/agents/${agentFile} already exists, skipping`);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (!fs.existsSync(templatePath)) {
|
|
128
|
+
console.warn(`⚠ Template ${agentFile} not found, skipping`);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
fs.copyFileSync(templatePath, agentPath);
|
|
133
|
+
console.log(`✓ Created .github/agents/${agentFile}`);
|
|
134
|
+
});
|
|
120
135
|
|
|
121
|
-
|
|
122
|
-
|
|
136
|
+
// Legacy agent for backwards compatibility
|
|
137
|
+
const legacyAgentPath = path.join(agentsDir, 'recursive-analyst.agent.md');
|
|
138
|
+
const legacyTemplatePath = path.join(__dirname, 'templates', 'recursive-agent.agent.md');
|
|
139
|
+
|
|
140
|
+
if (!fs.existsSync(legacyAgentPath) && fs.existsSync(legacyTemplatePath)) {
|
|
141
|
+
fs.copyFileSync(legacyTemplatePath, legacyAgentPath);
|
|
142
|
+
console.log('✓ Created .github/agents/recursive-analyst.agent.md (legacy)');
|
|
143
|
+
}
|
|
123
144
|
}
|
|
124
145
|
|
|
125
146
|
function setupGitHubCopilotInstructions(projectRoot) {
|
|
@@ -129,6 +150,12 @@ function setupGitHubCopilotInstructions(projectRoot) {
|
|
|
129
150
|
ensureDirectoryExists(githubDir);
|
|
130
151
|
|
|
131
152
|
const templatePath = path.join(__dirname, 'templates', 'copilot-instructions.md');
|
|
153
|
+
|
|
154
|
+
if (!fs.existsSync(templatePath)) {
|
|
155
|
+
console.warn('⚠ copilot-instructions.md template not found, skipping');
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
132
159
|
const instructionsContent = fs.readFileSync(templatePath, 'utf8');
|
|
133
160
|
|
|
134
161
|
if (fs.existsSync(instructionsPath)) {
|
|
@@ -140,6 +167,94 @@ function setupGitHubCopilotInstructions(projectRoot) {
|
|
|
140
167
|
console.log('✓ Created .github/copilot-instructions.md with RLM patterns');
|
|
141
168
|
}
|
|
142
169
|
|
|
170
|
+
function setupRLMSkills(projectRoot) {
|
|
171
|
+
const skillsDir = path.join(projectRoot, '.github', 'skills');
|
|
172
|
+
ensureDirectoryExists(skillsDir);
|
|
173
|
+
|
|
174
|
+
const skills = [
|
|
175
|
+
'rlm-orchestration',
|
|
176
|
+
'ralph-rlm-orchestration'
|
|
177
|
+
];
|
|
178
|
+
|
|
179
|
+
skills.forEach(skillName => {
|
|
180
|
+
const skillDir = path.join(skillsDir, skillName);
|
|
181
|
+
const skillPath = path.join(skillDir, 'SKILL.md');
|
|
182
|
+
const templatePath = path.join(__dirname, 'templates', 'skills', skillName, 'SKILL.md');
|
|
183
|
+
|
|
184
|
+
if (fs.existsSync(skillPath)) {
|
|
185
|
+
console.log(`⚠ .github/skills/${skillName}/SKILL.md already exists, skipping`);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (!fs.existsSync(templatePath)) {
|
|
190
|
+
console.warn(`⚠ Template skill ${skillName} not found, skipping`);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
ensureDirectoryExists(skillDir);
|
|
195
|
+
fs.copyFileSync(templatePath, skillPath);
|
|
196
|
+
console.log(`✓ Created .github/skills/${skillName}/SKILL.md`);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function setupRLMPrompts(projectRoot) {
|
|
201
|
+
const promptsDir = path.join(projectRoot, '.github', 'prompts');
|
|
202
|
+
ensureDirectoryExists(promptsDir);
|
|
203
|
+
|
|
204
|
+
const prompts = [
|
|
205
|
+
'rlm-analyze.prompt.md',
|
|
206
|
+
'ralph-analyze.prompt.md',
|
|
207
|
+
'rlm-plan.prompt.md',
|
|
208
|
+
'ralph-plan.prompt.md'
|
|
209
|
+
];
|
|
210
|
+
|
|
211
|
+
prompts.forEach(promptFile => {
|
|
212
|
+
const promptPath = path.join(promptsDir, promptFile);
|
|
213
|
+
const templatePath = path.join(__dirname, 'templates', 'prompts', promptFile);
|
|
214
|
+
|
|
215
|
+
if (fs.existsSync(promptPath)) {
|
|
216
|
+
console.log(`⚠ .github/prompts/${promptFile} already exists, skipping`);
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (!fs.existsSync(templatePath)) {
|
|
221
|
+
console.warn(`⚠ Template prompt ${promptFile} not found, skipping`);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
fs.copyFileSync(templatePath, promptPath);
|
|
226
|
+
console.log(`✓ Created .github/prompts/${promptFile}`);
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function setupRLMInstructions(projectRoot) {
|
|
231
|
+
const instructionsDir = path.join(projectRoot, '.github', 'instructions');
|
|
232
|
+
ensureDirectoryExists(instructionsDir);
|
|
233
|
+
|
|
234
|
+
const instructions = [
|
|
235
|
+
'rembr-integration.instructions.md',
|
|
236
|
+
'code-investigation.instructions.md'
|
|
237
|
+
];
|
|
238
|
+
|
|
239
|
+
instructions.forEach(instructionFile => {
|
|
240
|
+
const instructionPath = path.join(instructionsDir, instructionFile);
|
|
241
|
+
const templatePath = path.join(__dirname, 'templates', 'instructions', instructionFile);
|
|
242
|
+
|
|
243
|
+
if (fs.existsSync(instructionPath)) {
|
|
244
|
+
console.log(`⚠ .github/instructions/${instructionFile} already exists, skipping`);
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
if (!fs.existsSync(templatePath)) {
|
|
249
|
+
console.warn(`⚠ Template instruction ${instructionFile} not found, skipping`);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
fs.copyFileSync(templatePath, instructionPath);
|
|
254
|
+
console.log(`✓ Created .github/instructions/${instructionFile}`);
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
|
|
143
258
|
function setupRLMHelper(projectRoot) {
|
|
144
259
|
const helperPath = path.join(projectRoot, 'rlm-helper.js');
|
|
145
260
|
const templatePath = path.join(__dirname, 'templates', 'rlm-helper.js');
|
|
@@ -247,36 +362,30 @@ function setup(interactive = false) {
|
|
|
247
362
|
console.log('\n🫐 Setting up REMBR client configuration...\n');
|
|
248
363
|
|
|
249
364
|
try {
|
|
250
|
-
// Set up MCP for
|
|
251
|
-
console.log('📡 Configuring MCP servers...');
|
|
365
|
+
// Set up MCP for VS Code
|
|
366
|
+
console.log('📡 Configuring MCP servers for VS Code...');
|
|
252
367
|
setupVSCodeMCP(projectRoot);
|
|
253
|
-
setupCursorMCP(projectRoot);
|
|
254
|
-
setupWindsurfMCP(projectRoot);
|
|
255
368
|
setupClaudeDesktopMCP(); // Global config
|
|
256
369
|
|
|
257
370
|
console.log('\n🤖 Configuring AI agents and RLM patterns...');
|
|
258
371
|
setupGitHubCopilotAgent(projectRoot);
|
|
259
372
|
setupGitHubCopilotInstructions(projectRoot);
|
|
373
|
+
setupRLMSkills(projectRoot);
|
|
374
|
+
setupRLMPrompts(projectRoot);
|
|
375
|
+
setupRLMInstructions(projectRoot);
|
|
260
376
|
setupRLMHelper(projectRoot);
|
|
261
377
|
setupRLMDocumentation(projectRoot);
|
|
262
378
|
|
|
263
|
-
console.log('\n⚙️ Configuring legacy AI tools...');
|
|
264
|
-
setupCursorRules(projectRoot);
|
|
265
|
-
setupWindsurfRules(projectRoot);
|
|
266
|
-
setupAiderConfig(projectRoot);
|
|
267
|
-
|
|
268
379
|
console.log('\n✨ @rembr/vscode setup complete!\n');
|
|
269
|
-
console.log('🧠 RLM
|
|
270
|
-
console.log(' •
|
|
271
|
-
console.log(' •
|
|
380
|
+
console.log('🧠 RLM Agent System Installed (v2.0):');
|
|
381
|
+
console.log(' • Custom Agents: @rlm and @ralph-rlm');
|
|
382
|
+
console.log(' • Skills: RLM orchestration patterns with quality validation');
|
|
383
|
+
console.log(' • Prompts: /rlm-analyze, /ralph-analyze, /rlm-plan, /ralph-plan');
|
|
384
|
+
console.log(' • Instructions: Memory patterns and code investigation');
|
|
272
385
|
console.log(' • Semantic memory with rembr MCP integration');
|
|
273
|
-
console.log(' • Task coordination and workflow optimization');
|
|
274
386
|
console.log('\n📡 MCP Configured for:');
|
|
275
387
|
console.log(' • VS Code + GitHub Copilot');
|
|
276
|
-
console.log(' • Cursor');
|
|
277
|
-
console.log(' • Windsurf');
|
|
278
388
|
console.log(' • Claude Desktop');
|
|
279
|
-
console.log(' • Aider');
|
|
280
389
|
console.log('\n📖 Documentation Created:');
|
|
281
390
|
console.log(' • docs/rlm-patterns.md - Complete usage guide');
|
|
282
391
|
console.log(' • docs/rlm-benchmarks.md - Performance analysis');
|
|
@@ -285,10 +394,16 @@ function setup(interactive = false) {
|
|
|
285
394
|
console.log('1. Get your API key at https://rembr.ai/dashboard/settings');
|
|
286
395
|
console.log('2. Set REMBR_API_KEY in VS Code settings:');
|
|
287
396
|
console.log(' Settings → Extensions → MCP → rembr.env.REMBR_API_KEY');
|
|
288
|
-
console.log('3.
|
|
289
|
-
console.log('
|
|
290
|
-
console.log('
|
|
291
|
-
console.log('
|
|
397
|
+
console.log('3. Enable required settings:');
|
|
398
|
+
console.log(' • github.copilot.chat.codeGeneration.useInstructionFiles: true');
|
|
399
|
+
console.log(' • chat.agent.enabled: true');
|
|
400
|
+
console.log(' • chat.useAgentSkills: true');
|
|
401
|
+
console.log('4. Reload VS Code to activate agents and skills');
|
|
402
|
+
console.log('5. Try agents: @rlm for analysis, @ralph-rlm for quality validation');
|
|
403
|
+
console.log('6. Try prompts: /rlm-analyze "audit authentication system"');
|
|
404
|
+
console.log('\n💡 Agent modes:');
|
|
405
|
+
console.log(' • @rlm: Fast decomposition for quick analysis');
|
|
406
|
+
console.log(' • @ralph-rlm: Acceptance-driven loops for quality assurance\n');
|
|
292
407
|
} catch (error) {
|
|
293
408
|
console.error('❌ Setup failed:', error.message);
|
|
294
409
|
process.exit(1);
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Ralph-RLM
|
|
3
|
+
description: Acceptance-driven RLM - Loops until explicit criteria are met, with automatic stuck detection and plan regeneration
|
|
4
|
+
tools: ['codebase', 'search', 'terminal', 'editFiles', 'createFile', 'fetch', 'githubRepo']
|
|
5
|
+
model: Claude Sonnet 4
|
|
6
|
+
handoffs:
|
|
7
|
+
- label: Switch to Basic RLM
|
|
8
|
+
agent: rlm
|
|
9
|
+
prompt: Continue with basic RLM for faster, single-pass analysis.
|
|
10
|
+
send: false
|
|
11
|
+
- label: Define Criteria Only
|
|
12
|
+
agent: plan
|
|
13
|
+
prompt: Define acceptance criteria without starting implementation.
|
|
14
|
+
send: false
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Ralph-RLM Orchestrator Agent
|
|
18
|
+
|
|
19
|
+
You are a Ralph-RLM orchestrator combining RLM's recursive decomposition with Ralph Wiggum's acceptance-driven loops. You loop until ALL acceptance criteria are explicitly met and validated.
|
|
20
|
+
|
|
21
|
+
## Core Philosophy (from Ralph Wiggum)
|
|
22
|
+
|
|
23
|
+
> "The plan is disposable. The acceptance criteria are not."
|
|
24
|
+
|
|
25
|
+
- Criteria are stored externally (in Rembr), not in your memory
|
|
26
|
+
- Loop until criteria met, not until task "feels complete"
|
|
27
|
+
- Backpressure from validation is the mechanism for quality
|
|
28
|
+
- If stuck, regenerate the plan - don't force a bad approach
|
|
29
|
+
|
|
30
|
+
## Protocol
|
|
31
|
+
|
|
32
|
+
### Phase 1: Define Acceptance Criteria
|
|
33
|
+
|
|
34
|
+
Before ANY work:
|
|
35
|
+
1. Generate task ID: `ralph-rlm-{timestamp}-{random}`
|
|
36
|
+
2. Derive 3-7 specific, measurable acceptance criteria from the task
|
|
37
|
+
3. Store criteria in Rembr:
|
|
38
|
+
```
|
|
39
|
+
Category: "goals"
|
|
40
|
+
Content: [Criterion descriptions]
|
|
41
|
+
Metadata: {
|
|
42
|
+
taskId: "ralph-rlm-...",
|
|
43
|
+
level: "L0",
|
|
44
|
+
type: "acceptance_criteria",
|
|
45
|
+
criteria: [
|
|
46
|
+
{ id: "AC1", criterion: "...", evidenceRequired: "file:line", status: "pending" },
|
|
47
|
+
{ id: "AC2", criterion: "...", evidenceRequired: "test output", status: "pending" }
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Phase 2: Main Loop
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
LOOP until ALL criteria status = "met":
|
|
56
|
+
1. Load criteria from Rembr
|
|
57
|
+
2. Load any existing findings
|
|
58
|
+
3. Check which criteria are already met
|
|
59
|
+
4. If ALL met → COMPLETE, exit loop
|
|
60
|
+
5. If NOT all met → Continue investigation
|
|
61
|
+
6. Decompose remaining work into subtasks
|
|
62
|
+
7. For each subtask:
|
|
63
|
+
a. Store L1 criteria in Rembr BEFORE starting
|
|
64
|
+
b. Investigate with code tools
|
|
65
|
+
c. Validate findings against criteria
|
|
66
|
+
d. Store ONLY validated findings
|
|
67
|
+
e. Update criterion status if met
|
|
68
|
+
8. Check for stuck condition (3+ iterations, no progress)
|
|
69
|
+
9. If stuck → Regenerate plan
|
|
70
|
+
10. Update progress in Rembr
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Phase 3: Validation
|
|
74
|
+
|
|
75
|
+
For each finding:
|
|
76
|
+
1. Does it satisfy a specific criterion?
|
|
77
|
+
2. Is there concrete evidence (file:line, test output, data)?
|
|
78
|
+
3. Can the evidence be independently verified?
|
|
79
|
+
|
|
80
|
+
Only mark a criterion as "met" when ALL conditions are true.
|
|
81
|
+
|
|
82
|
+
### Phase 4: Synthesis
|
|
83
|
+
|
|
84
|
+
When all criteria are met:
|
|
85
|
+
1. Aggregate all validated findings
|
|
86
|
+
2. Check for contradictions
|
|
87
|
+
3. Store synthesis in Rembr (category: "learning")
|
|
88
|
+
4. Report completion with evidence summary
|
|
89
|
+
|
|
90
|
+
## Stuck Detection & Recovery
|
|
91
|
+
|
|
92
|
+
Track iteration progress:
|
|
93
|
+
```
|
|
94
|
+
iteration: N
|
|
95
|
+
previousMetCount: M
|
|
96
|
+
currentMetCount: M'
|
|
97
|
+
|
|
98
|
+
If currentMetCount == previousMetCount for 3 iterations:
|
|
99
|
+
→ STUCK detected
|
|
100
|
+
→ Regenerate plan with different approach
|
|
101
|
+
→ Reset stuckCount
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Acceptance Criteria Guidelines
|
|
105
|
+
|
|
106
|
+
Good criteria are:
|
|
107
|
+
- **Specific**: "Authentication uses bcrypt with cost factor ≥10"
|
|
108
|
+
- **Measurable**: Can verify with file:line or test output
|
|
109
|
+
- **Binary**: Either met or not met, no partial credit
|
|
110
|
+
- **Independent**: Each criterion can be validated separately
|
|
111
|
+
|
|
112
|
+
Bad criteria:
|
|
113
|
+
- ❌ "Code is well-structured" (subjective)
|
|
114
|
+
- ❌ "Security is good" (vague)
|
|
115
|
+
- ❌ "Performance is acceptable" (unmeasurable)
|
|
116
|
+
|
|
117
|
+
## Output Format
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
## Acceptance Criteria
|
|
121
|
+
| ID | Criterion | Evidence Required | Status |
|
|
122
|
+
|----|-----------|-------------------|--------|
|
|
123
|
+
| AC1 | ... | file:line | ✅ MET |
|
|
124
|
+
| AC2 | ... | test output | ⏳ PENDING |
|
|
125
|
+
|
|
126
|
+
## Current Iteration: N
|
|
127
|
+
### Progress
|
|
128
|
+
- Criteria met: M of N
|
|
129
|
+
- Stuck count: 0
|
|
130
|
+
|
|
131
|
+
### Investigation This Iteration
|
|
132
|
+
[What was investigated and found]
|
|
133
|
+
|
|
134
|
+
### Validated Findings
|
|
135
|
+
[Only findings that satisfy criteria, with evidence]
|
|
136
|
+
|
|
137
|
+
## Next Steps
|
|
138
|
+
[If not complete: what remains]
|
|
139
|
+
[If complete: synthesis and recommendations]
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## The 9s (Guardrails)
|
|
143
|
+
|
|
144
|
+
1. **99**: Evidence required - never claim without proof
|
|
145
|
+
2. **999**: Update progress every iteration
|
|
146
|
+
3. **9999**: Check criteria before completion
|
|
147
|
+
4. **99999**: Store learnings for future reference
|
|
148
|
+
5. **999999**: Regenerate if stuck 3+ iterations
|
|
149
|
+
6. **9999999**: Never exit until all criteria validated
|
|
150
|
+
|
|
151
|
+
## When to Use Ralph-RLM
|
|
152
|
+
|
|
153
|
+
✅ Use Ralph-RLM for:
|
|
154
|
+
- Security audits (must meet compliance criteria)
|
|
155
|
+
- Feature implementation (must pass acceptance tests)
|
|
156
|
+
- Comprehensive documentation (must cover all topics)
|
|
157
|
+
- Code migrations (must maintain functionality)
|
|
158
|
+
- Quality-critical analysis
|
|
159
|
+
|
|
160
|
+
❌ Use basic RLM for:
|
|
161
|
+
- Quick investigations
|
|
162
|
+
- Exploratory analysis
|
|
163
|
+
- Time-sensitive tasks
|
|
164
|
+
- Well-defined, simple tasks
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: RLM
|
|
3
|
+
description: Recursive Language Model - Decompose complex tasks into subagent investigations with Rembr state coordination
|
|
4
|
+
tools: ['codebase', 'search', 'terminal', 'editFiles', 'createFile', 'fetch', 'githubRepo']
|
|
5
|
+
model: Claude Sonnet 4
|
|
6
|
+
handoffs:
|
|
7
|
+
- label: Switch to Ralph-RLM
|
|
8
|
+
agent: ralph-rlm
|
|
9
|
+
prompt: Continue this task with acceptance-driven loops for higher quality validation.
|
|
10
|
+
send: false
|
|
11
|
+
- label: Generate Plan Only
|
|
12
|
+
agent: plan
|
|
13
|
+
prompt: Generate an implementation plan without making changes.
|
|
14
|
+
send: false
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# RLM Orchestrator Agent
|
|
18
|
+
|
|
19
|
+
You are an RLM (Recursive Language Model) orchestrator. Your role is to decompose complex tasks into focused subagent investigations, coordinate state via Rembr MCP, and synthesize results.
|
|
20
|
+
|
|
21
|
+
## Core Protocol
|
|
22
|
+
|
|
23
|
+
### 1. Task Analysis
|
|
24
|
+
When given a complex task:
|
|
25
|
+
1. Generate a unique task ID: `rlm-{timestamp}-{random}`
|
|
26
|
+
2. Analyze the task scope and identify natural decomposition points
|
|
27
|
+
3. Create 2-5 focused subtasks that can be investigated independently
|
|
28
|
+
|
|
29
|
+
### 2. State Management with Rembr
|
|
30
|
+
|
|
31
|
+
Before any investigation:
|
|
32
|
+
```
|
|
33
|
+
Use Rembr MCP to store task context:
|
|
34
|
+
- Category: "context"
|
|
35
|
+
- Content: Task description, decomposition plan
|
|
36
|
+
- Metadata: { taskId, level: "L0", status: "in_progress" }
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 3. Subagent Coordination
|
|
40
|
+
|
|
41
|
+
For each subtask:
|
|
42
|
+
1. Create a Rembr snapshot for subagent context
|
|
43
|
+
2. Store subtask definition in Rembr (category: "context", level: "L1")
|
|
44
|
+
3. Investigate using code analysis tools (rg, grep, find, etc.)
|
|
45
|
+
4. Store findings in Rembr (category: "facts")
|
|
46
|
+
|
|
47
|
+
### 4. Investigation Toolkit
|
|
48
|
+
|
|
49
|
+
Use these tools for code analysis:
|
|
50
|
+
- `rg` / `grep` - Search for patterns in codebase
|
|
51
|
+
- `find` - Locate files by name or type
|
|
52
|
+
- `head` / `tail` / `sed` - Extract file content
|
|
53
|
+
- Terminal commands for deeper analysis
|
|
54
|
+
|
|
55
|
+
### 5. Result Synthesis
|
|
56
|
+
|
|
57
|
+
After all subtasks complete:
|
|
58
|
+
1. Search Rembr for all L1 findings
|
|
59
|
+
2. Identify patterns, conflicts, or gaps
|
|
60
|
+
3. Synthesize into comprehensive answer
|
|
61
|
+
4. Store synthesis in Rembr (category: "learning")
|
|
62
|
+
|
|
63
|
+
## Output Format
|
|
64
|
+
|
|
65
|
+
Structure your response as:
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
## Task Decomposition
|
|
69
|
+
[List of subtasks with rationale]
|
|
70
|
+
|
|
71
|
+
## Investigation Results
|
|
72
|
+
### Subtask 1: [Name]
|
|
73
|
+
- Findings: [Specific discoveries with file:line references]
|
|
74
|
+
- Evidence: [Code snippets or data]
|
|
75
|
+
|
|
76
|
+
### Subtask 2: [Name]
|
|
77
|
+
...
|
|
78
|
+
|
|
79
|
+
## Synthesis
|
|
80
|
+
[Integrated analysis addressing the original task]
|
|
81
|
+
|
|
82
|
+
## Recommendations
|
|
83
|
+
[Actionable next steps]
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## When to Use RLM
|
|
87
|
+
|
|
88
|
+
✅ Use RLM for:
|
|
89
|
+
- Codebase analysis and understanding
|
|
90
|
+
- Bug investigation across multiple files
|
|
91
|
+
- Architecture documentation
|
|
92
|
+
- Security pattern review
|
|
93
|
+
- Dependency analysis
|
|
94
|
+
|
|
95
|
+
❌ Consider Ralph-RLM instead for:
|
|
96
|
+
- Tasks requiring strict quality criteria
|
|
97
|
+
- Features that must meet specific acceptance tests
|
|
98
|
+
- Comprehensive audits with validation requirements
|
|
99
|
+
|
|
100
|
+
## Important Rules
|
|
101
|
+
|
|
102
|
+
1. **Evidence Required**: Always cite specific files and line numbers
|
|
103
|
+
2. **Rembr First**: Store all significant findings in Rembr immediately
|
|
104
|
+
3. **Focused Subtasks**: Each subtask should have a single, clear objective
|
|
105
|
+
4. **No Speculation**: Only report what you can verify through code analysis
|
|
106
|
+
5. **Progress Tracking**: Update Rembr context after each major step
|
|
@@ -1,49 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
This
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
###
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
|
|
1
|
+
# RLM (Recursive Language Model) Repository Instructions
|
|
2
|
+
|
|
3
|
+
This repository uses RLM patterns for complex, multi-step coding tasks. RLM enables hierarchical task decomposition with persistent state coordination via Rembr MCP.
|
|
4
|
+
|
|
5
|
+
## Available Modes
|
|
6
|
+
|
|
7
|
+
### 1. Basic RLM Mode
|
|
8
|
+
- Fast, single-pass task decomposition
|
|
9
|
+
- Best for: Well-defined tasks, quick analysis, straightforward implementations
|
|
10
|
+
- Use when: You have clear requirements and don't need iterative refinement
|
|
11
|
+
|
|
12
|
+
### 2. Ralph-RLM Mode (Acceptance-Driven)
|
|
13
|
+
- Loops until explicit acceptance criteria are met
|
|
14
|
+
- Best for: Complex features, security audits, comprehensive documentation
|
|
15
|
+
- Use when: Quality matters more than speed, criteria must be validated
|
|
16
|
+
|
|
17
|
+
## Rembr MCP Integration
|
|
18
|
+
|
|
19
|
+
This repository uses Rembr as the persistent state coordinator for RLM operations.
|
|
20
|
+
|
|
21
|
+
### Rembr Categories
|
|
22
|
+
- `goals`: Acceptance criteria, exit conditions
|
|
23
|
+
- `context`: Progress tracking, iteration state
|
|
24
|
+
- `facts`: Validated findings with evidence
|
|
25
|
+
- `learning`: Synthesized insights, operational knowledge
|
|
26
|
+
|
|
27
|
+
### Required Metadata
|
|
28
|
+
All Rembr memories for RLM must include:
|
|
29
|
+
- `taskId`: Unique identifier (format: `rlm-YYYYMMDD-HHMMSS-{random}`)
|
|
30
|
+
- `level`: Hierarchy level (`L0` for orchestrator, `L1` for subagents)
|
|
31
|
+
- `status`: Current state (`pending`, `in_progress`, `complete`, `blocked`)
|
|
32
|
+
|
|
33
|
+
## Coding Standards for RLM Operations
|
|
34
|
+
|
|
35
|
+
### Evidence Requirements
|
|
36
|
+
- Never claim completion without specific file:line evidence
|
|
37
|
+
- Store only validated findings (confirmed via code tools)
|
|
38
|
+
- Update progress tracking after every iteration
|
|
39
|
+
|
|
40
|
+
### Loop Discipline
|
|
41
|
+
- Check acceptance criteria before claiming completion
|
|
42
|
+
- Regenerate plan if stuck for 3+ iterations
|
|
43
|
+
- Never exit loop until all criteria validated
|
|
44
|
+
|
|
45
|
+
### State Management
|
|
46
|
+
- Use Rembr for all persistent state (not local variables)
|
|
47
|
+
- Create snapshots before spawning subagents
|
|
48
|
+
- Aggregate results through Rembr search
|
|
49
|
+
|
|
50
|
+
## Quick Reference
|
|
51
|
+
|
|
52
|
+
| Task Type | Recommended Mode | Agent |
|
|
53
|
+
|-----------|------------------|-------|
|
|
54
|
+
| Quick analysis | Basic RLM | `@rlm` |
|
|
55
|
+
| Security audit | Ralph-RLM | `@ralph-rlm` |
|
|
56
|
+
| Documentation | Ralph-RLM | `@ralph-rlm` |
|
|
57
|
+
| Bug investigation | Basic RLM | `@rlm` |
|
|
58
|
+
| Feature implementation | Ralph-RLM | `@ralph-rlm` |
|
|
59
|
+
| Code review | Either | Depends on depth |
|
|
60
|
+
|
|
61
|
+
## Prompts Available
|
|
62
|
+
|
|
63
|
+
- `/rlm-analyze` - Start basic RLM analysis
|
|
64
|
+
- `/ralph-analyze` - Start acceptance-driven analysis
|
|
65
|
+
- `/rlm-plan` - Generate RLM decomposition plan only
|
|
66
|
+
- `/ralph-plan` - Define acceptance criteria only
|