7.6 KiB
Update Memory Bank
This workflow helps maintain and update the Kilocode Memory Bank documentation to keep the AI context current with project changes.
When to Run This Workflow
Update the Memory Bank after:
- Significant architectural changes
- New features or modules added
- Major refactoring or restructuring
- Technology stack changes
- Development process updates
- Completion of major milestones
Frequency: After every significant change or weekly for active projects
Memory Bank Files
The Memory Bank consists of 5 core files in .kilocode/rules/memory-bank/:
- brief.md - High-level project overview (changes rarely)
- product.md - Problem statements and user goals (changes occasionally)
- context.md - Current work focus and recent changes (changes frequently)
- architecture.md - System design and technical decisions (changes with architecture)
- tech.md - Technologies and setup (changes with tech stack)
Update Workflow
Step 1: Review Current Context
First, review what has changed since the last update:
git log --oneline --since="1 week ago"
Note the key changes:
- New features added
- Bug fixes
- Refactoring
- Architecture changes
- Dependency updates
Step 2: Identify Affected Files
Determine which Memory Bank files need updates:
| Changed Area | Files to Update |
|---|---|
| New features/capabilities | brief.md, context.md |
| Architecture changes | architecture.md, context.md |
| Tech stack changes | tech.md, context.md |
| Process changes | context.md, product.md |
| Documentation | context.md |
Step 3: Update context.md (Most Frequent)
Current Development Context - Always update this section:
## Active Development Focus
**Branch**: [current branch name]
**Status**: [current status]
## Recent Major Changes
### [Date or Version]
- [Change 1]
- [Change 2]
- [Change 3]
## Current Work Areas
1. **[Area 1]**: [Description]
2. **[Area 2]**: [Description]
## Next Priorities
1. [Priority 1]
2. [Priority 2]
Use read_file() to load current context.md, then edit() to update specific sections.
Step 4: Update architecture.md (As Needed)
Update when:
- New components or modules added
- Integration points change
- Data flow modifications
- Performance optimizations
- Security changes
Sections to Review:
- System Design diagrams
- Core Components descriptions
- Technical Decisions rationale
- Integration Points
- Data Flow
Step 5: Update tech.md (Tech Stack Changes)
Update when:
- New dependencies added
- Version upgrades (major)
- New tools introduced
- Build process changes
- Deployment process changes
Sections to Review:
- Dependencies list
- Technology versions
- Development setup
- Build & deployment
Step 6: Update product.md (Product Evolution)
Update when:
- Problem statement evolves
- New target users identified
- User experience goals change
- Key features added
- Product strategy shifts
Step 7: Update brief.md (Major Changes Only)
Update when:
- Project mission changes
- Core philosophy evolves
- Major restructuring
- New modules added
- Rebranding or renaming
Step 8: Validate Updates
After updating, verify:
- Consistency: All files align with each other
- Accuracy: Information reflects current state
- Completeness: All major changes documented
- Clarity: Explanations are clear and concise
Step 9: Test with AI
Start a new AI session and check:
[Memory Bank: Active]
Message should appear with accurate context summary.
Ask the AI to explain:
- Current project status
- Recent changes
- Architecture overview
- Technology stack
Verify responses align with your updates.
Step 10: Commit Changes
Commit the Memory Bank updates:
git add .kilocode/rules/memory-bank/
git commit -m "docs: update Memory Bank with [brief description]"
Quick Update Template
For rapid updates to context.md:
## Recent Major Changes
### [YYYY-MM-DD]
**Summary**: [One-line summary]
**Changes**:
- [Change 1]: [Brief description]
- [Change 2]: [Brief description]
- [Change 3]: [Brief description]
**Impact**: [How this affects development]
**Next Steps**: [What comes next]
Detailed Update Process
For context.md
- Read current file:
read_file(".kilocode/rules/memory-bank/context.md") - Update sections:
- Move "Current Work Areas" to "Recent Major Changes" if complete
- Add new current work to "Current Work Areas"
- Update "Known Constraints" if relevant
- Update "Next Priorities"
- Add timestamp: Include date for time context
- Save changes: Use
edit()tool
For architecture.md
- Review architecture changes: Check code structure
- Update diagrams: If visual representations changed
- Document decisions: Add new ADRs (Architecture Decision Records)
- Update integration points: If APIs or interfaces changed
- Revise data flow: If data handling changed
For tech.md
- Check package.json: For dependency changes
- Review build config: For tooling changes
- Update versions: Document version upgrades
- Add new tools: Document new development tools
- Update setup: If setup process changed
Automation Opportunities
Consider automating updates for:
- Git hooks: Prompt for Memory Bank update after major commits
- CI/CD: Generate change summaries automatically
- Version tags: Update Memory Bank as part of release process
- Weekly reminder: Calendar reminder to review Memory Bank
Best Practices
- Update frequently: Don't let it get stale
- Be concise: Focus on what's important for AI context
- Stay current: Remove outdated information
- Be specific: Vague descriptions don't help
- Think ahead: What will future you or AI need to know?
- Version awareness: Note which version/branch info applies to
- Consistency: Use similar formatting across files
Common Mistakes to Avoid
- Too much detail: Memory Bank is context, not full documentation
- Outdated info: Leaving old information creates confusion
- Inconsistency: Contradictions between files
- No dates: Hard to know when something changed
- Missing rationale: Document why, not just what
- Forgetting context.md: Most frequently needs updates
Example Update Scenarios
Scenario 1: New Feature Added
Files to update:
context.md- Add to "Current Work Areas" or "Recent Major Changes"brief.md- If major feature, add to overviewarchitecture.md- If architectural impact
Scenario 2: Technology Change
Files to update:
tech.md- Update dependencies and versionscontext.md- Note the change and impactarchitecture.md- If affects architecture
Scenario 3: Process Improvement
Files to update:
context.md- Document new processproduct.md- If affects user experiencearchitecture.md- If affects technical flow
Verification Checklist
After updating Memory Bank:
- All changed areas documented
- Dates/versions included
- Files internally consistent
- Outdated info removed or updated
- Clear and concise language
- Tested with new AI session
- Changes committed to git
Resources
Next Steps
- Set calendar reminder for next Memory Bank review
- Consider automating parts of this process
- Share updated context with team
- Monitor AI's understanding in next sessions