Install
openclaw skills install @space-cadet/mem-formatMemory Bank Template Compliance Cleaner Workflow Use when the user invokes $mem-format or asks for this workflow by name.
openclaw skills install @space-cadet/mem-formatThis skill is a Codex conversion of a personal Windsurf global workflow. Follow the workflow below, adapting Windsurf-specific slash-command wording to Codex skill invocation. If the workflow mentions running /mem-format, treat that as explicit invocation of $mem-format.
The mem-format workflow scans memory bank files and revises them to conform to established templates. This ensures consistency across all memory bank documentation and maintains proper formatting standards.
Run this workflow to:
/mem-format [file1.md] [file2.md]/mem-format all/mem-format tasks or /mem-format sessions// turbo Identify files to be processed based on user input:
// turbo For each file, determine the appropriate template:
// turbo Analyze each file against its template:
// turbo Extract existing content from files:
// turbo Reconstruct files using proper templates:
// turbo Validate revised files:
// turbo Generate comprehensive report:
| File Pattern | Template | Target Directory |
|---|---|---|
| tasks/T*.md | task-template.md | tasks/ |
| sessions/YYYY-MM-DD-*.md | session-template.md | sessions/ |
| tasks.md | tasks.md | memory-bank/ |
| session_cache.md | session_cache.md | memory-bank/ |
| edit_history.md | edit_history.md | memory-bank/ |
| activeContext.md | activeContext.md | memory-bank/ |
| errorLog.md | errorLog.md | memory-bank/ |
| progress.md | progress.md | memory-bank/ |
// turbo Before modifying files, create backups:
// turbo Ensure no content loss:
// turbo Apply changes incrementally:
function detectTemplate(filePath: string): string {
if (filePath.includes('tasks/T') && filePath.endsWith('.md')) {
return 'task-template.md';
}
if (filePath.includes('sessions/') && /^\d{4}-\d{2}-\d{2}/.test(filePath)) {
return 'session-template.md';
}
// ... other patterns
return 'default-template.md';
}
function extractContent(fileContent: string, template: string): Record<string, string> {
const sections = parseTemplateSections(template);
const extracted = {};
sections.forEach(section => {
extracted[section] = findSectionContent(fileContent, section);
});
return extracted;
}
function applyTemplate(template: string, extractedContent: Record<string, string>): string {
let result = template;
Object.entries(extractedContent).forEach(([section, content]) => {
result = result.replace(`[${section.toUpperCase()}]`, content || '');
});
return result;
}
This workflow ensures memory bank files maintain consistent structure and formatting while preserving all valuable content and implementation details.