@rembr/vscode 1.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 +91 -0
- package/LICENSE +21 -0
- package/README.md +248 -0
- package/cli.js +56 -0
- package/package.json +62 -0
- package/postinstall.js +30 -0
- package/setup.js +303 -0
- package/templates/aider.conf.yml +52 -0
- package/templates/copilot-instructions.md +49 -0
- package/templates/cursorrules +141 -0
- package/templates/recursive-analyst.agent.md +285 -0
- package/templates/rlm-benchmarks.md +172 -0
- package/templates/rlm-getting-started.md +297 -0
- package/templates/rlm-helper.js +267 -0
- package/templates/vscode-mcp-settings.json +14 -0
- package/templates/windsurfrules +141 -0
package/setup.js
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
|
|
6
|
+
const MCP_CONFIG = {
|
|
7
|
+
servers: {
|
|
8
|
+
rembr: {
|
|
9
|
+
url: "https://rembr.ai/mcp",
|
|
10
|
+
type: "http"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
inputs: []
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function ensureDirectoryExists(dirPath) {
|
|
17
|
+
if (!fs.existsSync(dirPath)) {
|
|
18
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function setupMCPConfig(projectRoot, toolDir, configFile) {
|
|
23
|
+
const toolConfigDir = path.join(projectRoot, toolDir);
|
|
24
|
+
const mcpConfigPath = path.join(toolConfigDir, configFile);
|
|
25
|
+
|
|
26
|
+
ensureDirectoryExists(toolConfigDir);
|
|
27
|
+
|
|
28
|
+
let config = MCP_CONFIG;
|
|
29
|
+
|
|
30
|
+
// Merge with existing config if it exists
|
|
31
|
+
if (fs.existsSync(mcpConfigPath)) {
|
|
32
|
+
try {
|
|
33
|
+
const existingConfig = JSON.parse(fs.readFileSync(mcpConfigPath, 'utf8'));
|
|
34
|
+
config = {
|
|
35
|
+
...existingConfig,
|
|
36
|
+
servers: {
|
|
37
|
+
...existingConfig.servers,
|
|
38
|
+
rembr: MCP_CONFIG.servers.rembr
|
|
39
|
+
},
|
|
40
|
+
inputs: existingConfig.inputs || []
|
|
41
|
+
};
|
|
42
|
+
console.log(`✓ Updated existing ${toolDir}/${configFile} with REMBR server`);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.warn(`⚠ Could not parse existing ${configFile}, creating new file`);
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
console.log(`✓ Created ${toolDir}/${configFile} with REMBR server`);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
fs.writeFileSync(mcpConfigPath, JSON.stringify(config, null, 2));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function setupVSCodeMCP(projectRoot) {
|
|
54
|
+
setupMCPConfig(projectRoot, '.vscode', 'mcp.json');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function setupCursorMCP(projectRoot) {
|
|
58
|
+
setupMCPConfig(projectRoot, '.cursor', 'mcp.json');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function setupWindsurfMCP(projectRoot) {
|
|
62
|
+
setupMCPConfig(projectRoot, '.windsurf', 'mcp.json');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function setupClaudeDesktopMCP() {
|
|
66
|
+
const homeDir = os.homedir();
|
|
67
|
+
let configPath;
|
|
68
|
+
|
|
69
|
+
if (process.platform === 'darwin') {
|
|
70
|
+
configPath = path.join(homeDir, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
|
|
71
|
+
} else if (process.platform === 'win32') {
|
|
72
|
+
configPath = path.join(homeDir, 'AppData', 'Roaming', 'Claude', 'claude_desktop_config.json');
|
|
73
|
+
} else {
|
|
74
|
+
configPath = path.join(homeDir, '.config', 'Claude', 'claude_desktop_config.json');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const configDir = path.dirname(configPath);
|
|
78
|
+
|
|
79
|
+
if (!fs.existsSync(configDir)) {
|
|
80
|
+
console.log('⚠ Claude Desktop not found, skipping');
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
ensureDirectoryExists(configDir);
|
|
85
|
+
|
|
86
|
+
let config = { mcpServers: {} };
|
|
87
|
+
|
|
88
|
+
if (fs.existsSync(configPath)) {
|
|
89
|
+
try {
|
|
90
|
+
config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
91
|
+
if (!config.mcpServers) config.mcpServers = {};
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.warn('⚠ Could not parse Claude Desktop config');
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
config.mcpServers.rembr = {
|
|
98
|
+
url: "https://rembr.ai/mcp",
|
|
99
|
+
type: "http"
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
103
|
+
console.log('✓ Updated Claude Desktop config with REMBR server');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function setupGitHubCopilotAgent(projectRoot) {
|
|
107
|
+
const githubDir = path.join(projectRoot, '.github');
|
|
108
|
+
const agentsDir = path.join(githubDir, 'agents');
|
|
109
|
+
const agentPath = path.join(agentsDir, 'recursive-analyst.agent.md');
|
|
110
|
+
|
|
111
|
+
ensureDirectoryExists(agentsDir);
|
|
112
|
+
|
|
113
|
+
const templatePath = path.join(__dirname, 'templates', 'recursive-analyst.agent.md');
|
|
114
|
+
const agentContent = fs.readFileSync(templatePath, 'utf8');
|
|
115
|
+
|
|
116
|
+
if (fs.existsSync(agentPath)) {
|
|
117
|
+
console.log('⚠ .github/agents/recursive-analyst.agent.md already exists, skipping');
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
fs.writeFileSync(agentPath, agentContent);
|
|
122
|
+
console.log('✓ Created .github/agents/recursive-analyst.agent.md');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function setupGitHubCopilotInstructions(projectRoot) {
|
|
126
|
+
const githubDir = path.join(projectRoot, '.github');
|
|
127
|
+
const instructionsPath = path.join(githubDir, 'copilot-instructions.md');
|
|
128
|
+
|
|
129
|
+
ensureDirectoryExists(githubDir);
|
|
130
|
+
|
|
131
|
+
const templatePath = path.join(__dirname, 'templates', 'copilot-instructions.md');
|
|
132
|
+
const instructionsContent = fs.readFileSync(templatePath, 'utf8');
|
|
133
|
+
|
|
134
|
+
if (fs.existsSync(instructionsPath)) {
|
|
135
|
+
console.log('⚠ .github/copilot-instructions.md already exists, skipping');
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
fs.writeFileSync(instructionsPath, instructionsContent);
|
|
140
|
+
console.log('✓ Created .github/copilot-instructions.md with RLM patterns');
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function setupRLMHelper(projectRoot) {
|
|
144
|
+
const helperPath = path.join(projectRoot, 'rlm-helper.js');
|
|
145
|
+
const templatePath = path.join(__dirname, 'templates', 'rlm-helper.js');
|
|
146
|
+
|
|
147
|
+
if (fs.existsSync(helperPath)) {
|
|
148
|
+
console.log('⚠ rlm-helper.js already exists, skipping');
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
fs.copyFileSync(templatePath, helperPath);
|
|
153
|
+
fs.chmodSync(helperPath, '755'); // Make executable
|
|
154
|
+
console.log('✓ Created rlm-helper.js for task coordination');
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function setupRLMDocumentation(projectRoot) {
|
|
158
|
+
const docsDir = path.join(projectRoot, 'docs');
|
|
159
|
+
ensureDirectoryExists(docsDir);
|
|
160
|
+
|
|
161
|
+
// RLM Getting Started Guide
|
|
162
|
+
const gettingStartedPath = path.join(docsDir, 'rlm-patterns.md');
|
|
163
|
+
if (!fs.existsSync(gettingStartedPath)) {
|
|
164
|
+
const templatePath = path.join(__dirname, 'templates', 'rlm-getting-started.md');
|
|
165
|
+
fs.copyFileSync(templatePath, gettingStartedPath);
|
|
166
|
+
console.log('✓ Created docs/rlm-patterns.md');
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Benchmark Results
|
|
170
|
+
const benchmarkPath = path.join(docsDir, 'rlm-benchmarks.md');
|
|
171
|
+
if (!fs.existsSync(benchmarkPath)) {
|
|
172
|
+
const templatePath = path.join(__dirname, 'templates', 'rlm-benchmarks.md');
|
|
173
|
+
fs.copyFileSync(templatePath, benchmarkPath);
|
|
174
|
+
console.log('✓ Created docs/rlm-benchmarks.md');
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function setupCursorRules(projectRoot) {
|
|
179
|
+
const cursorRulesPath = path.join(projectRoot, '.cursorrules');
|
|
180
|
+
const templatePath = path.join(__dirname, 'templates', 'cursorrules');
|
|
181
|
+
|
|
182
|
+
if (fs.existsSync(cursorRulesPath)) {
|
|
183
|
+
// Append REMBR section if not already present
|
|
184
|
+
const existing = fs.readFileSync(cursorRulesPath, 'utf8');
|
|
185
|
+
if (existing.includes('REMBR') || existing.includes('rembr')) {
|
|
186
|
+
console.log('⚠ .cursorrules already contains REMBR instructions, skipping');
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const template = fs.readFileSync(templatePath, 'utf8');
|
|
190
|
+
fs.writeFileSync(cursorRulesPath, existing + '\n\n' + template);
|
|
191
|
+
console.log('✓ Appended REMBR instructions to .cursorrules');
|
|
192
|
+
} else {
|
|
193
|
+
fs.copyFileSync(templatePath, cursorRulesPath);
|
|
194
|
+
console.log('✓ Created .cursorrules with REMBR instructions');
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function setupWindsurfRules(projectRoot) {
|
|
199
|
+
const windsurfRulesPath = path.join(projectRoot, '.windsurfrules');
|
|
200
|
+
const templatePath = path.join(__dirname, 'templates', 'windsurfrules');
|
|
201
|
+
|
|
202
|
+
if (fs.existsSync(windsurfRulesPath)) {
|
|
203
|
+
const existing = fs.readFileSync(windsurfRulesPath, 'utf8');
|
|
204
|
+
if (existing.includes('REMBR') || existing.includes('rembr')) {
|
|
205
|
+
console.log('⚠ .windsurfrules already contains REMBR instructions, skipping');
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const template = fs.readFileSync(templatePath, 'utf8');
|
|
209
|
+
fs.writeFileSync(windsurfRulesPath, existing + '\n\n' + template);
|
|
210
|
+
console.log('✓ Appended REMBR instructions to .windsurfrules');
|
|
211
|
+
} else {
|
|
212
|
+
fs.copyFileSync(templatePath, windsurfRulesPath);
|
|
213
|
+
console.log('✓ Created .windsurfrules with REMBR instructions');
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function setupAiderConfig(projectRoot) {
|
|
218
|
+
const aiderConfigPath = path.join(projectRoot, '.aider.conf.yml');
|
|
219
|
+
const templatePath = path.join(__dirname, 'templates', 'aider.conf.yml');
|
|
220
|
+
|
|
221
|
+
if (fs.existsSync(aiderConfigPath)) {
|
|
222
|
+
console.log('⚠ .aider.conf.yml already exists, skipping');
|
|
223
|
+
console.log(' Add these lines manually:');
|
|
224
|
+
console.log(' - Use REMBR for persistent semantic memory');
|
|
225
|
+
console.log(' - MCP server: https://rembr.ai/mcp');
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
fs.copyFileSync(templatePath, aiderConfigPath);
|
|
230
|
+
console.log('✓ Created .aider.conf.yml with REMBR instructions');
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function setup(interactive = false) {
|
|
234
|
+
// Find project root (where package.json or .git exists)
|
|
235
|
+
let projectRoot = process.cwd();
|
|
236
|
+
|
|
237
|
+
while (!fs.existsSync(path.join(projectRoot, 'package.json')) &&
|
|
238
|
+
!fs.existsSync(path.join(projectRoot, '.git')) &&
|
|
239
|
+
projectRoot !== '/') {
|
|
240
|
+
projectRoot = path.dirname(projectRoot);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (projectRoot === '/') {
|
|
244
|
+
projectRoot = process.cwd();
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
console.log('\n🫐 Setting up REMBR client configuration...\n');
|
|
248
|
+
|
|
249
|
+
try {
|
|
250
|
+
// Set up MCP for all supported tools
|
|
251
|
+
console.log('📡 Configuring MCP servers...');
|
|
252
|
+
setupVSCodeMCP(projectRoot);
|
|
253
|
+
setupCursorMCP(projectRoot);
|
|
254
|
+
setupWindsurfMCP(projectRoot);
|
|
255
|
+
setupClaudeDesktopMCP(); // Global config
|
|
256
|
+
|
|
257
|
+
console.log('\n🤖 Configuring AI agents and RLM patterns...');
|
|
258
|
+
setupGitHubCopilotAgent(projectRoot);
|
|
259
|
+
setupGitHubCopilotInstructions(projectRoot);
|
|
260
|
+
setupRLMHelper(projectRoot);
|
|
261
|
+
setupRLMDocumentation(projectRoot);
|
|
262
|
+
|
|
263
|
+
console.log('\n⚙️ Configuring legacy AI tools...');
|
|
264
|
+
setupCursorRules(projectRoot);
|
|
265
|
+
setupWindsurfRules(projectRoot);
|
|
266
|
+
setupAiderConfig(projectRoot);
|
|
267
|
+
|
|
268
|
+
console.log('\n✨ @rembr/vscode setup complete!\n');
|
|
269
|
+
console.log('🧠 RLM Pattern System Installed:');
|
|
270
|
+
console.log(' • GitHub Copilot with auto-detection (51% token reduction)');
|
|
271
|
+
console.log(' • Recursive Analyst agent for complex tasks');
|
|
272
|
+
console.log(' • Semantic memory with rembr MCP integration');
|
|
273
|
+
console.log(' • Task coordination and workflow optimization');
|
|
274
|
+
console.log('\n📡 MCP Configured for:');
|
|
275
|
+
console.log(' • VS Code + GitHub Copilot');
|
|
276
|
+
console.log(' • Cursor');
|
|
277
|
+
console.log(' • Windsurf');
|
|
278
|
+
console.log(' • Claude Desktop');
|
|
279
|
+
console.log(' • Aider');
|
|
280
|
+
console.log('\n📖 Documentation Created:');
|
|
281
|
+
console.log(' • docs/rlm-patterns.md - Complete usage guide');
|
|
282
|
+
console.log(' • docs/rlm-benchmarks.md - Performance analysis');
|
|
283
|
+
console.log(' • rlm-helper.js - Task coordination script');
|
|
284
|
+
console.log('\nNext steps:');
|
|
285
|
+
console.log('1. Get your API key at https://rembr.ai/dashboard/settings');
|
|
286
|
+
console.log('2. Set REMBR_API_KEY in VS Code settings:');
|
|
287
|
+
console.log(' Settings → Extensions → MCP → rembr.env.REMBR_API_KEY');
|
|
288
|
+
console.log('3. Reload VS Code to activate RLM patterns');
|
|
289
|
+
console.log('4. Try a complex task like "implement rate limiting with Redis and monitoring"');
|
|
290
|
+
console.log('5. Watch GitHub Copilot automatically decompose into focused subagents\n');
|
|
291
|
+
console.log('💡 Tip: Use "node rlm-helper.js <task>" to analyze decomposition patterns\n');
|
|
292
|
+
} catch (error) {
|
|
293
|
+
console.error('❌ Setup failed:', error.message);
|
|
294
|
+
process.exit(1);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
module.exports = { setup };
|
|
299
|
+
|
|
300
|
+
// Run setup if called directly
|
|
301
|
+
if (require.main === module) {
|
|
302
|
+
setup(true);
|
|
303
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Aider configuration with REMBR semantic memory
|
|
2
|
+
|
|
3
|
+
# REMBR Integration
|
|
4
|
+
#
|
|
5
|
+
# REMBR provides persistent semantic memory for your coding sessions.
|
|
6
|
+
# While Aider doesn't natively support MCP, you can integrate REMBR via:
|
|
7
|
+
#
|
|
8
|
+
# 1. Manual tool calls in prompts:
|
|
9
|
+
# "First, search REMBR for authentication patterns, then implement..."
|
|
10
|
+
#
|
|
11
|
+
# 2. External scripts that call the REMBR API:
|
|
12
|
+
# curl -X POST https://rembr.ai/api/v1/search \
|
|
13
|
+
# -H "Authorization: Bearer $REMBR_API_KEY" \
|
|
14
|
+
# -d '{"query": "authentication patterns"}'
|
|
15
|
+
#
|
|
16
|
+
# 3. Pre/post hooks that store session context:
|
|
17
|
+
# - Before: Retrieve relevant context from REMBR
|
|
18
|
+
# - After: Store findings and decisions to REMBR
|
|
19
|
+
|
|
20
|
+
# Model configuration
|
|
21
|
+
model: claude-sonnet-4
|
|
22
|
+
|
|
23
|
+
# Enable git integration
|
|
24
|
+
auto-commits: true
|
|
25
|
+
dirty-commits: true
|
|
26
|
+
|
|
27
|
+
# Editor for commit messages
|
|
28
|
+
editor: vim
|
|
29
|
+
|
|
30
|
+
# Suggested workflow with REMBR:
|
|
31
|
+
#
|
|
32
|
+
# 1. Before starting: Query REMBR for relevant context
|
|
33
|
+
# $ rembr-query "database migration patterns"
|
|
34
|
+
#
|
|
35
|
+
# 2. During coding: Aider makes changes
|
|
36
|
+
#
|
|
37
|
+
# 3. After completing: Store findings to REMBR
|
|
38
|
+
# $ rembr-store "Migrated users table to support OAuth. Added provider column."
|
|
39
|
+
#
|
|
40
|
+
# You can create these wrapper scripts to integrate REMBR with Aider.
|
|
41
|
+
|
|
42
|
+
# Example bash aliases for ~/.bashrc:
|
|
43
|
+
#
|
|
44
|
+
# alias rembr-query='curl -X POST https://rembr.ai/api/v1/search \
|
|
45
|
+
# -H "Authorization: Bearer $REMBR_API_KEY" \
|
|
46
|
+
# -H "Content-Type: application/json" \
|
|
47
|
+
# -d "{\"query\": \"$1\", \"limit\": 5}" | jq -r ".memories[].content"'
|
|
48
|
+
#
|
|
49
|
+
# alias rembr-store='curl -X POST https://rembr.ai/api/v1/memories \
|
|
50
|
+
# -H "Authorization: Bearer $REMBR_API_KEY" \
|
|
51
|
+
# -H "Content-Type: application/json" \
|
|
52
|
+
# -d "{\"content\": \"$1\", \"category\": \"facts\"}"'
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<!-- Use this file to provide workspace-specific custom instructions to Copilot. For more details, visit https://code.visualstudio.com/docs/copilot/copilot-customization#_use-a-githubcopilotinstructionsmd-file -->
|
|
2
|
+
|
|
3
|
+
This project uses the Recursive Language Model (RLM) pattern for complex tasks.
|
|
4
|
+
|
|
5
|
+
## AUTOMATIC RLM PATTERN
|
|
6
|
+
|
|
7
|
+
**When you detect a complex task (multiple steps, technologies, or cross-cutting concerns), AUTOMATICALLY:**
|
|
8
|
+
|
|
9
|
+
1. **Generate taskId**: `${taskType}-${YYYYMMDD}-${randomId}`
|
|
10
|
+
2. **Query rembr**: `search_memory({ query: "relevant keywords", limit: 5 })`
|
|
11
|
+
3. **Spawn subagents**: Use `runSubagent` with retrieved context
|
|
12
|
+
4. **Enable recursion**: Allow subagents to spawn their own subagents (max 3 levels)
|
|
13
|
+
5. **Synthesize**: Coordinate hierarchical results and store to rembr
|
|
14
|
+
|
|
15
|
+
### Auto-Detection Triggers
|
|
16
|
+
- Multiple technologies: "React AND Go", "database AND API"
|
|
17
|
+
- Cross-cutting: "refactor", "migrate", "convert", "integrate"
|
|
18
|
+
- Complex modifiers: "comprehensive", "full-stack", "end-to-end"
|
|
19
|
+
- Multiple phases: "analyze and implement", "design and build"
|
|
20
|
+
|
|
21
|
+
### Recursive Depth Management
|
|
22
|
+
- **Level 0 (Root)**: Main task coordination
|
|
23
|
+
- **Level 1**: Major component decomposition
|
|
24
|
+
- **Level 2**: Specialized implementation
|
|
25
|
+
- **Level 3**: Micro-tasks and details
|
|
26
|
+
- **Max Depth**: 3 levels to prevent infinite recursion
|
|
27
|
+
|
|
28
|
+
### Example Auto-Execution
|
|
29
|
+
**User**: "Refactor this React app to Go with authentication"
|
|
30
|
+
**You**:
|
|
31
|
+
```javascript
|
|
32
|
+
// Auto-detected complex task, executing RLM pattern
|
|
33
|
+
const taskId = "react-go-auth-20260107-x9k2m";
|
|
34
|
+
const context = await search_memory({ query: "React Go authentication patterns" });
|
|
35
|
+
// Spawning 3 L1 subagents: analysis, conversion, auth
|
|
36
|
+
// Each L1 agent may spawn L2 agents for specialized tasks
|
|
37
|
+
// Max depth: 3 levels for complete decomposition
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Project Structure
|
|
41
|
+
- Modern development practices with AI-assisted workflows
|
|
42
|
+
- Clean, organized codebase with clear separation of concerns
|
|
43
|
+
- Comprehensive documentation and testing
|
|
44
|
+
|
|
45
|
+
## Development Guidelines
|
|
46
|
+
- Break complex tasks into focused subtasks
|
|
47
|
+
- Use semantic memory for context persistence
|
|
48
|
+
- Follow established patterns and best practices
|
|
49
|
+
- Maintain high code quality through automated decomposition
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# REMBR - Recursive Language Model with Semantic Memory
|
|
2
|
+
|
|
3
|
+
You have access to REMBR, a semantic memory system via MCP tools. Use it to implement the Recursive Language Model (RLM) pattern for complex tasks.
|
|
4
|
+
|
|
5
|
+
## Core Principles
|
|
6
|
+
|
|
7
|
+
1. **Never work with more context than necessary** - Query REMBR for only relevant prior knowledge
|
|
8
|
+
2. **Break down complex tasks** - Spawn focused subtasks with targeted context
|
|
9
|
+
3. **Store findings persistently** - Save discoveries to REMBR for future sessions
|
|
10
|
+
4. **Coordinate through structured returns** - Each subtask returns a standard result format
|
|
11
|
+
|
|
12
|
+
## Available REMBR Tools (via MCP)
|
|
13
|
+
|
|
14
|
+
### Memory Management
|
|
15
|
+
- `store_memory` - Store insights, facts, preferences, project info
|
|
16
|
+
- `search_memory` - Hybrid semantic + text search across memories
|
|
17
|
+
- `list_memories` - Browse recent memories by category
|
|
18
|
+
- `get_memory` - Retrieve specific memory by ID
|
|
19
|
+
- `delete_memory` - Remove outdated memories
|
|
20
|
+
|
|
21
|
+
### Context Workspaces
|
|
22
|
+
- `create_context` - Create workspace for related memories
|
|
23
|
+
- `add_memory_to_context` - Link memories to contexts
|
|
24
|
+
- `search_context` - Scoped search within a workspace
|
|
25
|
+
- `list_contexts` - View available workspaces
|
|
26
|
+
|
|
27
|
+
### Snapshots (for subtask handoffs)
|
|
28
|
+
- `create_snapshot` - Immutable memory bundle with TTL
|
|
29
|
+
- `get_snapshot` - Retrieve snapshot by ID
|
|
30
|
+
- `list_snapshots` - View available snapshots
|
|
31
|
+
|
|
32
|
+
### Insights
|
|
33
|
+
- `get_stats` - Usage and limits
|
|
34
|
+
- `get_context_insights` - Category distribution, patterns
|
|
35
|
+
- `get_memory_graph` - Memory relationships
|
|
36
|
+
- `detect_contradictions` - Find conflicting information
|
|
37
|
+
|
|
38
|
+
## Memory Categories
|
|
39
|
+
|
|
40
|
+
Organize memories semantically:
|
|
41
|
+
- **facts** - Concrete information and data
|
|
42
|
+
- **preferences** - User settings and choices
|
|
43
|
+
- **conversations** - Conversation context
|
|
44
|
+
- **projects** - Project-specific information
|
|
45
|
+
- **learning** - Knowledge and insights
|
|
46
|
+
- **goals** - Objectives and targets
|
|
47
|
+
- **context** - Situational context
|
|
48
|
+
- **reminders** - Future actions
|
|
49
|
+
|
|
50
|
+
## RLM Pattern: Parent-Subtask Protocol
|
|
51
|
+
|
|
52
|
+
### Before Decomposing
|
|
53
|
+
|
|
54
|
+
1. Generate unique `taskId` (e.g., `implement-auth-20240106`)
|
|
55
|
+
2. Query REMBR for relevant prior context:
|
|
56
|
+
```
|
|
57
|
+
search_memory({ query: "authentication patterns OAuth JWT", limit: 10 })
|
|
58
|
+
```
|
|
59
|
+
3. Identify subtasks and what context each needs
|
|
60
|
+
|
|
61
|
+
### When Spawning Subtasks
|
|
62
|
+
|
|
63
|
+
Provide each subtask with:
|
|
64
|
+
```
|
|
65
|
+
## Subtask
|
|
66
|
+
[Specific focused objective]
|
|
67
|
+
|
|
68
|
+
## Context from REMBR
|
|
69
|
+
[Relevant memories retrieved for this subtask]
|
|
70
|
+
|
|
71
|
+
## Storage Instructions
|
|
72
|
+
Store findings with:
|
|
73
|
+
- Category: "facts"
|
|
74
|
+
- Metadata: { "taskId": "implement-auth-20240106", "area": "oauth-flow" }
|
|
75
|
+
|
|
76
|
+
## Return Format
|
|
77
|
+
- Summary: [What you found/did]
|
|
78
|
+
- Findings stored: [Search query to retrieve details]
|
|
79
|
+
- Key points: [Most important items]
|
|
80
|
+
- Status: [complete/partial/blocked]
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### After Subtasks Complete
|
|
84
|
+
|
|
85
|
+
1. Read each subtask's summary and key points
|
|
86
|
+
2. If full details needed, query REMBR:
|
|
87
|
+
```
|
|
88
|
+
search_memory({ query: "implement-auth-20240106 oauth-flow", category: "facts" })
|
|
89
|
+
```
|
|
90
|
+
3. Synthesize findings and store to REMBR for future sessions
|
|
91
|
+
|
|
92
|
+
## Example Usage
|
|
93
|
+
|
|
94
|
+
### Storing a Discovery
|
|
95
|
+
```
|
|
96
|
+
store_memory({
|
|
97
|
+
category: "facts",
|
|
98
|
+
content: "API uses rate limiting: 100 req/min per user via express-rate-limit + Redis",
|
|
99
|
+
metadata: {
|
|
100
|
+
taskId: "rate-limit-analysis",
|
|
101
|
+
area: "api-middleware",
|
|
102
|
+
file: "src/middleware/rateLimit.ts"
|
|
103
|
+
}
|
|
104
|
+
})
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Retrieving Context
|
|
108
|
+
```
|
|
109
|
+
search_memory({
|
|
110
|
+
query: "rate limiting middleware patterns",
|
|
111
|
+
category: "facts",
|
|
112
|
+
limit: 5
|
|
113
|
+
})
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Creating a Workspace
|
|
117
|
+
```
|
|
118
|
+
create_context({
|
|
119
|
+
name: "payment-service-refactor",
|
|
120
|
+
description: "Refactoring payment service to microservices",
|
|
121
|
+
category: "projects"
|
|
122
|
+
})
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## When to Use REMBR
|
|
126
|
+
|
|
127
|
+
✅ **Do use** for:
|
|
128
|
+
- Storing architectural decisions
|
|
129
|
+
- Remembering project patterns and conventions
|
|
130
|
+
- Building knowledge across sessions
|
|
131
|
+
- Coordinating complex multi-step tasks
|
|
132
|
+
- Sharing context between subtasks
|
|
133
|
+
|
|
134
|
+
❌ **Don't use** for:
|
|
135
|
+
- Temporary variables or transient data
|
|
136
|
+
- Information already in the codebase
|
|
137
|
+
- Simple single-step tasks
|
|
138
|
+
|
|
139
|
+
## API Key Setup
|
|
140
|
+
|
|
141
|
+
Ensure `REMBR_API_KEY` is set in your Cursor environment settings.
|