Skip to content

Commit 5a31567

Browse files
blafourcadeclaude
andcommitted
fix(memory): convert update_memory script to CommonJS and add ls fallback
Renames update_memory.mjs to update_memory.js and converts from ESM to CommonJS (require) so the script works without "type":"module" in user projects. Adds a fallback ls instruction outside <aidd_project_memory> in AGENTS.md template so agents can discover memory files if the hook did not run. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent eb1dd38 commit 5a31567

4 files changed

Lines changed: 8 additions & 7 deletions

File tree

aidd_docs/templates/AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@ All instructions and information above are willing to be up to date, but always
3232
<aidd_project_memory>
3333
</aidd_project_memory>
3434

35+
- If memory is not loaded above: run `ls -1tr {{DOCS}}/memory/` then read each file
3536
- If needed: load files from `{{DOCS}}/memory/external/*` when user request it
3637
- If needed: load files from `{{DOCS}}/memory/internal/*`, you have to think about it

commands/01_onboard/init.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@ All templates are in:
7373
4. Spawn parallel task sub-agents for each template files
7474
5. Write generated files to `{{DOCS}}/memory/`
7575
6. Launch an agent to review all files for consistency and accuracy
76-
7. Execute `.aidd/scripts/update_memory.mjs` to sync memory references in context files
76+
7. Execute `.aidd/scripts/update_memory.js` to sync memory references in context files

commands/07_documentation/learn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@ Propose where to save each learning.
100100

101101
### Phase 4: Sync memory references
102102

103-
Execute `.aidd/scripts/update_memory.mjs` to sync memory references in context files
103+
Execute `.aidd/scripts/update_memory.js` to sync memory references in context files
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
22
/**
3-
* update_memory.mjs — Syncs <aidd_project_memory> block in AI context files.
3+
* update_memory.js — Syncs <aidd_project_memory> block in AI context files.
44
*
55
* Scans {docsDir}/memory/ for .md files and updates the <aidd_project_memory>
66
* block in each context file (CLAUDE.md, AGENTS.md, .github/copilot-instructions.md)
@@ -10,12 +10,12 @@
1010
* CLAUDE.md / AGENTS.md → @{docsDir}/memory/file.md
1111
* .github/copilot-instructions → [{docsDir}/memory/file.md](../{docsDir}/memory/file.md)
1212
*
13-
* Usage: node .aidd/scripts/update_memory.mjs [docsDir]
13+
* Usage: node .aidd/scripts/update_memory.js [docsDir]
1414
*/
1515

16-
import { readFileSync, writeFileSync, readdirSync, existsSync } from 'fs';
17-
import { join } from 'path';
18-
import { execSync } from 'child_process';
16+
const { readFileSync, writeFileSync, readdirSync, existsSync } = require('fs');
17+
const { join } = require('path');
18+
const { execSync } = require('child_process');
1919

2020
// ── Constants ─────────────────────────────────────────────────────
2121

0 commit comments

Comments
 (0)