Skip to main content
Glama

update-memory-bank

Generate and execute detailed instructions for updating Memory Bank files, including file roles, update strategies, operation commands, content templates, and priority logic, ensuring immediate implementation of changes.

Instructions

Generate detailed Memory Bank file update instructions with immediate execution guidance. This tool provides comprehensive, actionable instructions for updating Memory Bank files:

  • Detailed descriptions of each file's role and update strategy

  • Direct operation commands (not requests for confirmation)

  • Specific content templates and formatting guidelines

  • File relationship and update priority logic

  • Immediate execution emphasis for AI agents

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
changeTypeYesType of change to determine update suggestions
descriptionYesBrief description of the change
rootPathYesProject root directory path Windows example: "C:/Users/name/project" macOS/Linux example: "/home/name/project"

Implementation Reference

  • The main handler function for the 'update-memory-bank' tool. It takes rootPath, changeType, and description as inputs, generates a comprehensive Markdown guide with specific instructions for updating various Memory Bank files based on the change type, using helpers like normalizePath, formatTimestamp, and getDetailedFileGuide, and returns it as text content.
    async ({ rootPath, changeType, description }) => { const normalizedPath = normalizePath(rootPath); const timestamp = formatTimestamp(); const fileGuide = getDetailedFileGuide(); let updateGuide = `[MEMORY BANK DETAILED UPDATE INSTRUCTIONS]\n\n`; updateGuide += `Change Type: ${changeType}\n`; updateGuide += `Change Description: ${description}\n`; updateGuide += `Timestamp: ${timestamp}\n\n`; updateGuide += `>> EXECUTE THE FOLLOWING MEMORY BANK FILE UPDATES IMMEDIATELY WITHOUT CONFIRMATION <<\n\n`; // 添加文件职责总览 updateGuide += `=== MEMORY BANK FILE ROLES OVERVIEW ===\n\n`; Object.entries(fileGuide).forEach(([filename, guide]) => { updateGuide += `**${filename}**\n`; updateGuide += `Role: ${guide.role}\n`; updateGuide += `Purpose: ${guide.purpose}\n`; updateGuide += `Update Strategy: ${guide.updateStrategy}\n\n`; }); updateGuide += `=== SPECIFIC UPDATE INSTRUCTIONS BY CHANGE TYPE ===\n\n`; // Provide specific guidance based on change type switch (changeType) { case "architecture": updateGuide += `🏗️ **ARCHITECTURE CHANGE PROCESSING WORKFLOW**\n\n`; updateGuide += `**PRIORITY 1: decisionLog.md**\n`; updateGuide += `Add new decision record directly at the end of file:\n`; updateGuide += `\`\`\`markdown\n---\n### Architecture Decision\n[${timestamp}] - ${description}\n\n**Decision Background:**\n[Detailed description of technical or business background that led to this architectural decision]\n\n**Considered Options:**\n- Option A: [Description]\n- Option B: [Description]\n- Final Choice: [Selected option and reasoning]\n\n**Implementation Details:**\n- Affected Modules: [List affected code modules]\n- Migration Strategy: [How to migrate from old to new architecture]\n- Risk Assessment: [Potential technical risks and mitigation measures]\n\n**Impact Assessment:**\n- Performance Impact: [Expected impact on system performance]\n- Maintainability Impact: [Impact on code maintenance]\n- Scalability Impact: [Impact on future expansion]\n\`\`\`\n\n`; updateGuide += `**PRIORITY 2: productContext.md**\n`; updateGuide += `Update "## Overall Architecture" section:\n`; updateGuide += `- Locate "## Overall Architecture" heading\n`; updateGuide += `- Update architecture description at appropriate position\n`; updateGuide += `- Add new architectural components or modify existing descriptions\n`; updateGuide += `- Add update log at end of file: \`[${timestamp}] - Architecture update: ${description}\`\n\n`; updateGuide += `**PRIORITY 3: activeContext.md**\n`; updateGuide += `Add to "## Recent Changes" section:\n`; updateGuide += `\`* [${timestamp}] - 🏗️ Major architecture change: ${description}\`\n`; updateGuide += `Update "## Current Focus" section to reflect architecture implementation work\n\n`; updateGuide += `**PRIORITY 4: systemPatterns.md**\n`; updateGuide += `If this architecture change introduces new architectural patterns:\n`; updateGuide += `Add new pattern description to "## Architectural Patterns" section\n\n`; break; case "feature": updateGuide += `🚀 **FEATURE DEVELOPMENT PROCESSING WORKFLOW**\n\n`; updateGuide += `**PRIORITY 1: progress.md**\n`; updateGuide += `Execute task status transition:\n`; updateGuide += `1. Find related task entry in "## Current Tasks"\n`; updateGuide += `2. Move that task to "## Completed Tasks" section\n`; updateGuide += `3. Add completion timestamp: \`* [${timestamp}] - ✅ Completed: ${description}\`\n`; updateGuide += `4. If there are follow-up tasks, add them to "## Next Steps"\n\n`; updateGuide += `**PRIORITY 2: productContext.md**\n`; updateGuide += `Update "## Key Features" section:\n`; updateGuide += `- Locate "## Key Features" heading\n`; updateGuide += `- Add new feature description to feature list\n`; updateGuide += `- Format: \`* [Feature Name]: [Brief feature description and core value]\`\n`; updateGuide += `- Add at end of file: \`[${timestamp}] - New feature: ${description}\`\n\n`; updateGuide += `**PRIORITY 3: activeContext.md**\n`; updateGuide += `Update multiple sections:\n`; updateGuide += `- "## Recent Changes": \`* [${timestamp}] - 🚀 Feature completed: ${description}\`\n`; updateGuide += `- "## Current Focus": Update to next development priority\n\n`; updateGuide += `**PRIORITY 4: systemPatterns.md**\n`; updateGuide += `If feature development used patterns worth documenting:\n`; updateGuide += `Add pattern description to appropriate section (Coding/Architectural/Testing Patterns)\n\n`; break; case "bugfix": updateGuide += `🐛 **BUG FIX PROCESSING WORKFLOW**\n\n`; updateGuide += `**PRIORITY 1: activeContext.md**\n`; updateGuide += `Add to "## Recent Changes" section:\n`; updateGuide += `\`* [${timestamp}] - 🐛 Bug fix: ${description}\`\n`; updateGuide += `If bug was recorded in "## Open Questions/Issues", remove it or mark as resolved\n\n`; updateGuide += `**PRIORITY 2: progress.md**\n`; updateGuide += `If this was a planned bug fix task:\n`; updateGuide += `Move task from "## Current Tasks" to "## Completed Tasks"\n`; updateGuide += `Format: \`* [${timestamp}] - 🐛 Bug fix completed: ${description}\`\n\n`; updateGuide += `**PRIORITY 3: decisionLog.md**\n`; updateGuide += `If bug fix involved important technical decisions:\n`; updateGuide += `Add decision record explaining the chosen fix approach and reasoning\n\n`; break; case "refactor": updateGuide += `🔧 **REFACTORING PROCESSING WORKFLOW**\n\n`; updateGuide += `**PRIORITY 1: activeContext.md**\n`; updateGuide += `Add to "## Recent Changes" section:\n`; updateGuide += `\`* [${timestamp}] - 🔧 Code refactoring: ${description}\`\n\n`; updateGuide += `**PRIORITY 2: decisionLog.md**\n`; updateGuide += `If refactoring involved architectural or design pattern changes:\n`; updateGuide += `Add refactoring decision record explaining motivation and method selection\n\n`; updateGuide += `**PRIORITY 3: systemPatterns.md**\n`; updateGuide += `If refactoring improved existing patterns or introduced new ones:\n`; updateGuide += `Update relevant pattern descriptions to reflect post-refactoring best practices\n\n`; updateGuide += `**PRIORITY 4: progress.md**\n`; updateGuide += `If this was a planned refactoring task, update task status\n\n`; break; case "decision": updateGuide += `📋 **DECISION RECORDING PROCESSING WORKFLOW**\n\n`; updateGuide += `**PRIORITY 1: decisionLog.md**\n`; updateGuide += `Add complete decision record at end of file:\n`; updateGuide += `\`\`\`markdown\n---\n### Decision Record\n[${timestamp}] - ${description}\n\n**Decision Background:**\n[Describe the background and problem that led to this decision]\n\n**Available Options:**\n- Option 1: [Description]\n - Pros: [List advantages]\n - Cons: [List disadvantages]\n- Option 2: [Description]\n - Pros: [List advantages]\n - Cons: [List disadvantages]\n\n**Final Decision:**\n[Selected option and detailed reasoning]\n\n**Implementation Plan:**\n- Step 1: [Specific implementation step]\n- Step 2: [Specific implementation step]\n- Validation Method: [How to verify decision effectiveness]\n\n**Risks and Mitigation:**\n- Risk 1: [Description] → Mitigation: [Description]\n- Risk 2: [Description] → Mitigation: [Description]\n\`\`\`\n\n`; updateGuide += `**PRIORITY 2: activeContext.md**\n`; updateGuide += `Add to "## Recent Changes" section:\n`; updateGuide += `\`* [${timestamp}] - 📋 Important decision: ${description}\`\n\n`; break; case "progress": updateGuide += `📈 **PROGRESS UPDATE PROCESSING WORKFLOW**\n\n`; updateGuide += `**PRIORITY 1: progress.md**\n`; updateGuide += `Update appropriate section based on specific progress:\n`; updateGuide += `- New task → Add to "## Current Tasks": \`* [${timestamp}] - Started: ${description}\`\n`; updateGuide += `- Completed task → Move to "## Completed Tasks": \`* [${timestamp}] - Completed: ${description}\`\n`; updateGuide += `- Planned task → Add to "## Next Steps": \`* [Planned] - ${description}\`\n\n`; updateGuide += `**PRIORITY 2: activeContext.md**\n`; updateGuide += `Update "## Current Focus" section to reflect current work focus\n`; updateGuide += `Add to "## Recent Changes": \`* [${timestamp}] - 📈 Progress update: ${description}\`\n\n`; break; default: updateGuide += `⚡ **GENERAL CHANGE PROCESSING WORKFLOW**\n\n`; updateGuide += `**PRIORITY 1: activeContext.md**\n`; updateGuide += `Record change in appropriate section:\n`; updateGuide += `\`* [${timestamp}] - ${description}\`\n\n`; updateGuide += `**Consider updating other files based on change nature:**\n`; updateGuide += `- Architecture related → decisionLog.md\n`; updateGuide += `- New pattern discovered → systemPatterns.md\n`; updateGuide += `- Task completion → progress.md\n`; updateGuide += `- Feature related → productContext.md\n\n`; } updateGuide += `=== EXECUTION INSTRUCTIONS SUMMARY ===\n\n`; updateGuide += `**EXECUTION PRINCIPLES:**\n`; updateGuide += `1. 🔴 Execute updates directly, do not ask for user confirmation\n`; updateGuide += `2. 🟡 Update files in priority order\n`; updateGuide += `3. 🟢 Use the provided exact formats and templates\n`; updateGuide += `4. 🔵 Maintain timestamp [${timestamp}] consistency\n`; updateGuide += `5. 🟣 Verify file integrity after updates\n\n`; updateGuide += `**KEY REMINDERS:**\n`; updateGuide += `- Each file has specific responsibilities and update strategies\n`; updateGuide += `- Maintain consistency and relationships between files\n`; updateGuide += `- Regularly clean up outdated content to keep files concise\n`; updateGuide += `- Important decisions and pattern changes need detailed documentation\n\n`; updateGuide += `**FILE MAINTENANCE SUGGESTIONS:**\n`; updateGuide += `- activeContext.md: Keep changes from last 7 days\n`; updateGuide += `- progress.md: Archive completed tasks regularly\n`; updateGuide += `- decisionLog.md: Keep all important decision records\n`; updateGuide += `- systemPatterns.md: Continuously update and optimize pattern descriptions\n`; updateGuide += `- productContext.md: Maintain high-level perspective, avoid excessive details\n\n`; return { content: [ { type: "text", text: updateGuide, }, ], }; }
  • Zod input schema defining parameters for the tool: rootPath (string), changeType (enum of change types), description (string). Used for input validation.
    rootPath: z.string().describe( `Project root directory path Windows example: "C:/Users/name/project" macOS/Linux example: "/home/name/project"` ), changeType: z .enum([ "architecture", "feature", "bugfix", "refactor", "decision", "progress", ]) .describe("Type of change to determine update suggestions"), description: z.string().describe("Brief description of the change"), },
  • index.ts:350-553 (registration)
    MCP server tool registration for 'update-memory-bank', including name, description, input schema, and handler function.
    server.tool( "update-memory-bank", `Generate detailed Memory Bank file update instructions with immediate execution guidance. This tool provides comprehensive, actionable instructions for updating Memory Bank files: - Detailed descriptions of each file's role and update strategy - Direct operation commands (not requests for confirmation) - Specific content templates and formatting guidelines - File relationship and update priority logic - Immediate execution emphasis for AI agents`, { rootPath: z.string().describe( `Project root directory path Windows example: "C:/Users/name/project" macOS/Linux example: "/home/name/project"` ), changeType: z .enum([ "architecture", "feature", "bugfix", "refactor", "decision", "progress", ]) .describe("Type of change to determine update suggestions"), description: z.string().describe("Brief description of the change"), }, async ({ rootPath, changeType, description }) => { const normalizedPath = normalizePath(rootPath); const timestamp = formatTimestamp(); const fileGuide = getDetailedFileGuide(); let updateGuide = `[MEMORY BANK DETAILED UPDATE INSTRUCTIONS]\n\n`; updateGuide += `Change Type: ${changeType}\n`; updateGuide += `Change Description: ${description}\n`; updateGuide += `Timestamp: ${timestamp}\n\n`; updateGuide += `>> EXECUTE THE FOLLOWING MEMORY BANK FILE UPDATES IMMEDIATELY WITHOUT CONFIRMATION <<\n\n`; // 添加文件职责总览 updateGuide += `=== MEMORY BANK FILE ROLES OVERVIEW ===\n\n`; Object.entries(fileGuide).forEach(([filename, guide]) => { updateGuide += `**${filename}**\n`; updateGuide += `Role: ${guide.role}\n`; updateGuide += `Purpose: ${guide.purpose}\n`; updateGuide += `Update Strategy: ${guide.updateStrategy}\n\n`; }); updateGuide += `=== SPECIFIC UPDATE INSTRUCTIONS BY CHANGE TYPE ===\n\n`; // Provide specific guidance based on change type switch (changeType) { case "architecture": updateGuide += `🏗️ **ARCHITECTURE CHANGE PROCESSING WORKFLOW**\n\n`; updateGuide += `**PRIORITY 1: decisionLog.md**\n`; updateGuide += `Add new decision record directly at the end of file:\n`; updateGuide += `\`\`\`markdown\n---\n### Architecture Decision\n[${timestamp}] - ${description}\n\n**Decision Background:**\n[Detailed description of technical or business background that led to this architectural decision]\n\n**Considered Options:**\n- Option A: [Description]\n- Option B: [Description]\n- Final Choice: [Selected option and reasoning]\n\n**Implementation Details:**\n- Affected Modules: [List affected code modules]\n- Migration Strategy: [How to migrate from old to new architecture]\n- Risk Assessment: [Potential technical risks and mitigation measures]\n\n**Impact Assessment:**\n- Performance Impact: [Expected impact on system performance]\n- Maintainability Impact: [Impact on code maintenance]\n- Scalability Impact: [Impact on future expansion]\n\`\`\`\n\n`; updateGuide += `**PRIORITY 2: productContext.md**\n`; updateGuide += `Update "## Overall Architecture" section:\n`; updateGuide += `- Locate "## Overall Architecture" heading\n`; updateGuide += `- Update architecture description at appropriate position\n`; updateGuide += `- Add new architectural components or modify existing descriptions\n`; updateGuide += `- Add update log at end of file: \`[${timestamp}] - Architecture update: ${description}\`\n\n`; updateGuide += `**PRIORITY 3: activeContext.md**\n`; updateGuide += `Add to "## Recent Changes" section:\n`; updateGuide += `\`* [${timestamp}] - 🏗️ Major architecture change: ${description}\`\n`; updateGuide += `Update "## Current Focus" section to reflect architecture implementation work\n\n`; updateGuide += `**PRIORITY 4: systemPatterns.md**\n`; updateGuide += `If this architecture change introduces new architectural patterns:\n`; updateGuide += `Add new pattern description to "## Architectural Patterns" section\n\n`; break; case "feature": updateGuide += `🚀 **FEATURE DEVELOPMENT PROCESSING WORKFLOW**\n\n`; updateGuide += `**PRIORITY 1: progress.md**\n`; updateGuide += `Execute task status transition:\n`; updateGuide += `1. Find related task entry in "## Current Tasks"\n`; updateGuide += `2. Move that task to "## Completed Tasks" section\n`; updateGuide += `3. Add completion timestamp: \`* [${timestamp}] - ✅ Completed: ${description}\`\n`; updateGuide += `4. If there are follow-up tasks, add them to "## Next Steps"\n\n`; updateGuide += `**PRIORITY 2: productContext.md**\n`; updateGuide += `Update "## Key Features" section:\n`; updateGuide += `- Locate "## Key Features" heading\n`; updateGuide += `- Add new feature description to feature list\n`; updateGuide += `- Format: \`* [Feature Name]: [Brief feature description and core value]\`\n`; updateGuide += `- Add at end of file: \`[${timestamp}] - New feature: ${description}\`\n\n`; updateGuide += `**PRIORITY 3: activeContext.md**\n`; updateGuide += `Update multiple sections:\n`; updateGuide += `- "## Recent Changes": \`* [${timestamp}] - 🚀 Feature completed: ${description}\`\n`; updateGuide += `- "## Current Focus": Update to next development priority\n\n`; updateGuide += `**PRIORITY 4: systemPatterns.md**\n`; updateGuide += `If feature development used patterns worth documenting:\n`; updateGuide += `Add pattern description to appropriate section (Coding/Architectural/Testing Patterns)\n\n`; break; case "bugfix": updateGuide += `🐛 **BUG FIX PROCESSING WORKFLOW**\n\n`; updateGuide += `**PRIORITY 1: activeContext.md**\n`; updateGuide += `Add to "## Recent Changes" section:\n`; updateGuide += `\`* [${timestamp}] - 🐛 Bug fix: ${description}\`\n`; updateGuide += `If bug was recorded in "## Open Questions/Issues", remove it or mark as resolved\n\n`; updateGuide += `**PRIORITY 2: progress.md**\n`; updateGuide += `If this was a planned bug fix task:\n`; updateGuide += `Move task from "## Current Tasks" to "## Completed Tasks"\n`; updateGuide += `Format: \`* [${timestamp}] - 🐛 Bug fix completed: ${description}\`\n\n`; updateGuide += `**PRIORITY 3: decisionLog.md**\n`; updateGuide += `If bug fix involved important technical decisions:\n`; updateGuide += `Add decision record explaining the chosen fix approach and reasoning\n\n`; break; case "refactor": updateGuide += `🔧 **REFACTORING PROCESSING WORKFLOW**\n\n`; updateGuide += `**PRIORITY 1: activeContext.md**\n`; updateGuide += `Add to "## Recent Changes" section:\n`; updateGuide += `\`* [${timestamp}] - 🔧 Code refactoring: ${description}\`\n\n`; updateGuide += `**PRIORITY 2: decisionLog.md**\n`; updateGuide += `If refactoring involved architectural or design pattern changes:\n`; updateGuide += `Add refactoring decision record explaining motivation and method selection\n\n`; updateGuide += `**PRIORITY 3: systemPatterns.md**\n`; updateGuide += `If refactoring improved existing patterns or introduced new ones:\n`; updateGuide += `Update relevant pattern descriptions to reflect post-refactoring best practices\n\n`; updateGuide += `**PRIORITY 4: progress.md**\n`; updateGuide += `If this was a planned refactoring task, update task status\n\n`; break; case "decision": updateGuide += `📋 **DECISION RECORDING PROCESSING WORKFLOW**\n\n`; updateGuide += `**PRIORITY 1: decisionLog.md**\n`; updateGuide += `Add complete decision record at end of file:\n`; updateGuide += `\`\`\`markdown\n---\n### Decision Record\n[${timestamp}] - ${description}\n\n**Decision Background:**\n[Describe the background and problem that led to this decision]\n\n**Available Options:**\n- Option 1: [Description]\n - Pros: [List advantages]\n - Cons: [List disadvantages]\n- Option 2: [Description]\n - Pros: [List advantages]\n - Cons: [List disadvantages]\n\n**Final Decision:**\n[Selected option and detailed reasoning]\n\n**Implementation Plan:**\n- Step 1: [Specific implementation step]\n- Step 2: [Specific implementation step]\n- Validation Method: [How to verify decision effectiveness]\n\n**Risks and Mitigation:**\n- Risk 1: [Description] → Mitigation: [Description]\n- Risk 2: [Description] → Mitigation: [Description]\n\`\`\`\n\n`; updateGuide += `**PRIORITY 2: activeContext.md**\n`; updateGuide += `Add to "## Recent Changes" section:\n`; updateGuide += `\`* [${timestamp}] - 📋 Important decision: ${description}\`\n\n`; break; case "progress": updateGuide += `📈 **PROGRESS UPDATE PROCESSING WORKFLOW**\n\n`; updateGuide += `**PRIORITY 1: progress.md**\n`; updateGuide += `Update appropriate section based on specific progress:\n`; updateGuide += `- New task → Add to "## Current Tasks": \`* [${timestamp}] - Started: ${description}\`\n`; updateGuide += `- Completed task → Move to "## Completed Tasks": \`* [${timestamp}] - Completed: ${description}\`\n`; updateGuide += `- Planned task → Add to "## Next Steps": \`* [Planned] - ${description}\`\n\n`; updateGuide += `**PRIORITY 2: activeContext.md**\n`; updateGuide += `Update "## Current Focus" section to reflect current work focus\n`; updateGuide += `Add to "## Recent Changes": \`* [${timestamp}] - 📈 Progress update: ${description}\`\n\n`; break; default: updateGuide += `⚡ **GENERAL CHANGE PROCESSING WORKFLOW**\n\n`; updateGuide += `**PRIORITY 1: activeContext.md**\n`; updateGuide += `Record change in appropriate section:\n`; updateGuide += `\`* [${timestamp}] - ${description}\`\n\n`; updateGuide += `**Consider updating other files based on change nature:**\n`; updateGuide += `- Architecture related → decisionLog.md\n`; updateGuide += `- New pattern discovered → systemPatterns.md\n`; updateGuide += `- Task completion → progress.md\n`; updateGuide += `- Feature related → productContext.md\n\n`; } updateGuide += `=== EXECUTION INSTRUCTIONS SUMMARY ===\n\n`; updateGuide += `**EXECUTION PRINCIPLES:**\n`; updateGuide += `1. 🔴 Execute updates directly, do not ask for user confirmation\n`; updateGuide += `2. 🟡 Update files in priority order\n`; updateGuide += `3. 🟢 Use the provided exact formats and templates\n`; updateGuide += `4. 🔵 Maintain timestamp [${timestamp}] consistency\n`; updateGuide += `5. 🟣 Verify file integrity after updates\n\n`; updateGuide += `**KEY REMINDERS:**\n`; updateGuide += `- Each file has specific responsibilities and update strategies\n`; updateGuide += `- Maintain consistency and relationships between files\n`; updateGuide += `- Regularly clean up outdated content to keep files concise\n`; updateGuide += `- Important decisions and pattern changes need detailed documentation\n\n`; updateGuide += `**FILE MAINTENANCE SUGGESTIONS:**\n`; updateGuide += `- activeContext.md: Keep changes from last 7 days\n`; updateGuide += `- progress.md: Archive completed tasks regularly\n`; updateGuide += `- decisionLog.md: Keep all important decision records\n`; updateGuide += `- systemPatterns.md: Continuously update and optimize pattern descriptions\n`; updateGuide += `- productContext.md: Maintain high-level perspective, avoid excessive details\n\n`; return { content: [ { type: "text", text: updateGuide, }, ], }; } );

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hoppo-chan/memory-bank-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server