Skip to content

Latest commit

 

History

History
101 lines (74 loc) · 3.35 KB

File metadata and controls

101 lines (74 loc) · 3.35 KB

// Helper methods for Cline and RooCode memory bank enforcement // Add these to InterceptorManager class in interceptor.ts

/**

  • Inject memory bank files for Cline (ALWAYS READ by AI) */ private async injectClineMemoryBank(workspacePath: string): Promise { const memoryBankDir = path.join(workspacePath, '.clinerules', 'memory-bank');

    const activeContextPath = path.join(memoryBankDir, 'activeContext.md'); const activeContext = `# Active Context

Current Development Requirements

agentMemory Integration (MANDATORY)

This project requires agentMemory MCP tools for all development work.

The agentMemory system is not optional—it's a core dependency of this project's architecture.

MCP Tools Available

  • `memory_read` - Retrieve specific memories
  • `memory_search` - Query by content, tags, or type
  • `memory_write` - Document decisions and patterns

Mandatory Workflow

Every development task MUST follow this pattern:

  1. Before starting: Call `memory_search()` to check existing knowledge
  2. During work: Reference established patterns from memory
  3. After completion: Call `memory_write()` to document your work

Failure to use memory tools = Incomplete work `;

try {
    await fs.mkdir(memoryBankDir, { recursive: true });
    await fs.writeFile(activeContextPath, activeContext, 'utf-8');
    this.outputChannel.appendLine(`  📄 Created: .clinerules/memory-bank/activeContext.md`);
} catch (error) {
    this.outputChannel.appendLine(`  ❌ Failed to create Cline memory bank files`);
}

}

/**

  • Inject memory bank files for RooCode (ALWAYS READ by AI) */ private async injectRooCodeMemoryBank(workspacePath: string): Promise { const memoryBankDir = path.join(workspacePath, '.roo', 'memory-bank');

    const activeContextPath = path.join(memoryBankDir, 'activeContext.md'); const activeContext = `# Active Context

Project Memory System

Agent Memory (REQUIRED SYSTEM)

This project uses agentMemory for persistent knowledge management.

Status: MANDATORY - This is a core project dependency.

Available MCP Tools

  • `memory_read({ key })` - Get specific memory
  • `memory_search({ query, tags, type })` - Search memories
  • `memory_write({ key, type, content, tags })` - Save memory

Required Development Pattern

EVERY task must:

  1. Query first: `memory_search()` before implementing
  2. Reference: Use existing patterns from memory
  3. Document: `memory_write()` after any significant work

The memory system is as essential as version control. `;

try {
    await fs.mkdir(memoryBankDir, { recursive: true });
    await fs.writeFile(activeContextPath, activeContext, 'utf-8');
    this.outputChannel.appendLine(`  📄 Created: .roo/memory-bank/activeContext.md`);
} catch (error) {
    this.outputChannel.appendLine(`  ❌ Failed to create RooCode memory bank files`);
}

}

/**

  • Update injectRules method to call these:
  • if (installedAgents.includes('cline')) {
  • promises.push(this.injectClineRules(workspacePath));
    
  • promises.push(this.injectClineMemoryBank(workspacePath)); // ADD THIS
    
  • }
  • if (installedAgents.includes('roocode')) {
  • promises.push(this.injectRooCodeRules(workspacePath));
    
  • promises.push(this.injectRooCodeMemoryBank(workspacePath)); // ADD THIS
    
  • } */