@vuau/agent-memory 0.3.1 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @vuau/agent-memory
2
2
 
3
- Structured AI memory for codebases. Works with OpenCode, GitHub Copilot, Cursor, Windsurf, and any AI coding assistant that reads markdown files.
3
+ Structured AI memory for codebases. Uses `AGENTS.md` to work with OpenCode, GitHub Copilot, Cursor, Windsurf, and any AI coding assistant that reads markdown files.
4
4
 
5
5
  **[Tiếng Việt →](./README.vi.md)**
6
6
 
@@ -16,24 +16,14 @@ AI coding assistants lose context between sessions. They can't remember:
16
16
  ## Quick Start
17
17
 
18
18
  ```bash
19
- # Interactive mode — choose your IDEs
20
19
  npx @vuau/agent-memory init
21
-
22
- # Or specify directly
23
- npx @vuau/agent-memory init --opencode # OpenCode only
24
- npx @vuau/agent-memory init --copilot --cursor # Multiple IDEs
25
- npx @vuau/agent-memory init --all # All IDEs
26
20
  ```
27
21
 
28
22
  ## What It Creates
29
23
 
30
24
  ```
31
25
  / (Project Root)
32
- ├── AGENTS.md # OpenCode rules
33
- ├── .cursorrules # Cursor rules
34
- ├── .windsurfrules # Windsurf rules
35
- ├── .github/
36
- │ └── copilot-instructions.md # GitHub Copilot rules
26
+ ├── AGENTS.md # Root agent rules
37
27
  └── .agents/
38
28
  ├── MEMORY.md # Long-term memory (decisions, patterns)
39
29
  ├── TASKS.md # Working memory (current tasks)
@@ -42,13 +32,13 @@ npx @vuau/agent-memory init --all # All IDEs
42
32
 
43
33
  ## How It Works
44
34
 
45
- 1. **You run `init`** → Creates IDE config files + `.agents/` structure
35
+ 1. **You run `init`** → Creates `AGENTS.md` + `.agents/` structure
46
36
  2. **Agent reads rules** → Finds documentation map pointing to `.agents/`
47
37
  3. **Agent works** → Reads MEMORY.md before implementing, updates TASKS.md
48
38
  4. **You approve decision** → Agent writes 1-line entry to MEMORY.md
49
39
  5. **Next session** → Agent reads memory, continues where you left off
50
40
 
51
- **No plugin required.** The rules in AGENTS.md/copilot-instructions.md instruct the agent what to do.
41
+ **No plugin required.** The rules in `AGENTS.md` instruct the agent what to do.
52
42
 
53
43
  ## CLI Options
54
44
 
@@ -56,11 +46,6 @@ npx @vuau/agent-memory init --all # All IDEs
56
46
  npx @vuau/agent-memory init [options]
57
47
 
58
48
  Options:
59
- --opencode Create AGENTS.md for OpenCode
60
- --copilot Create .github/copilot-instructions.md
61
- --cursor Create .cursorrules
62
- --windsurf Create .windsurfrules
63
- --all Create config for all IDEs
64
49
  --force Overwrite existing files without asking
65
50
  --name <n> Project name (default: from package.json)
66
51
 
@@ -99,7 +84,7 @@ Agents follow this protocol (defined in config files):
99
84
 
100
85
  | Layer | File | Purpose |
101
86
  |-------|------|---------|
102
- | Router | AGENTS.md / .cursorrules / etc | Rules + pointers (~100 lines) |
87
+ | Router | AGENTS.md | Rules + pointers (~100 lines) |
103
88
  | Memory | .agents/MEMORY.md | Curated decisions (1-line each) |
104
89
  | Tasks | .agents/TASKS.md | Current work, next steps |
105
90
  | Specs | .agents/spec/*.md | Detailed docs (on-demand) |
@@ -119,14 +104,19 @@ File-based solution:
119
104
 
120
105
  ## Cross-IDE Compatibility
121
106
 
122
- | IDE | Config File | Reads .agents/* |
123
- |-----|-------------|-----------------|
124
- | OpenCode | AGENTS.md | |
125
- | GitHub Copilot | .github/copilot-instructions.md | ✅ |
126
- | Cursor | .cursorrules | ✅ |
127
- | Windsurf | .windsurfrules | ✅ |
107
+ By default, we only scaffold `AGENTS.md`, which is an emerging standard router file.
108
+
109
+ If your tool requires a specific file (e.g. Cursor requires `.cursorrules`, GitHub Copilot requires `.github/copilot-instructions.md`), you can simply symlink or copy `AGENTS.md`:
110
+
111
+ ```bash
112
+ # For Cursor
113
+ ln -s AGENTS.md .cursorrules
114
+
115
+ # For GitHub Copilot
116
+ mkdir -p .github && ln -s ../AGENTS.md .github/copilot-instructions.md
117
+ ```
128
118
 
129
- All IDEs use the same `.agents/` memory structure.
119
+ All tools will read from the same underlying `.agents/` memory structure.
130
120
 
131
121
  ## Documentation
132
122
 
package/README.vi.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @vuau/agent-memory
2
2
 
3
- Bộ nhớ AI có cấu trúc cho các codebase. Hoạt động với OpenCode, GitHub Copilot, Cursor, Windsurf, và bất kỳ AI coding assistant nào đọc markdown files.
3
+ Bộ nhớ AI có cấu trúc cho các codebase. Sử dụng `AGENTS.md` để hoạt động với OpenCode, GitHub Copilot, Cursor, Windsurf, và bất kỳ AI coding assistant nào đọc markdown files.
4
4
 
5
5
  ## Bài toán
6
6
 
@@ -14,24 +14,14 @@ AI coding assistants mất bối cảnh giữa các phiên. Họ không thể nh
14
14
  ## Bắt đầu nhanh
15
15
 
16
16
  ```bash
17
- # Interactive mode — chọn IDEs của bạn
18
17
  npx @vuau/agent-memory init
19
-
20
- # Hoặc chỉ định trực tiếp
21
- npx @vuau/agent-memory init --opencode # Chỉ OpenCode
22
- npx @vuau/agent-memory init --copilot --cursor # Nhiều IDEs
23
- npx @vuau/agent-memory init --all # Tất cả IDEs
24
18
  ```
25
19
 
26
20
  ## Cấu trúc tạo ra
27
21
 
28
22
  ```
29
23
  / (Project Root)
30
- ├── AGENTS.md # OpenCode rules
31
- ├── .cursorrules # Cursor rules
32
- ├── .windsurfrules # Windsurf rules
33
- ├── .github/
34
- │ └── copilot-instructions.md # GitHub Copilot rules
24
+ ├── AGENTS.md # Root agent rules
35
25
  └── .agents/
36
26
  ├── MEMORY.md # Long-term memory (decisions, patterns)
37
27
  ├── TASKS.md # Working memory (current tasks)
@@ -40,13 +30,13 @@ npx @vuau/agent-memory init --all # Tất cả IDEs
40
30
 
41
31
  ## Cách hoạt động
42
32
 
43
- 1. **Bạn chạy `init`** → Tạo IDE config files + `.agents/` structure
33
+ 1. **Bạn chạy `init`** → Tạo `AGENTS.md` + `.agents/` structure
44
34
  2. **Agent đọc rules** → Tìm documentation map trỏ đến `.agents/`
45
35
  3. **Agent làm việc** → Đọc MEMORY.md trước khi implement, update TASKS.md
46
36
  4. **Bạn approve decision** → Agent ghi 1-line entry vào MEMORY.md
47
37
  5. **Phiên tiếp theo** → Agent đọc memory, tiếp tục từ nơi dừng lại
48
38
 
49
- **Không cần plugin.** Rules trong AGENTS.md/copilot-instructions.md hướng dẫn agent phải làm gì.
39
+ **Không cần plugin.** Rules trong `AGENTS.md` hướng dẫn agent phải làm gì.
50
40
 
51
41
  ## CLI Options
52
42
 
@@ -54,11 +44,6 @@ npx @vuau/agent-memory init --all # Tất cả IDEs
54
44
  npx @vuau/agent-memory init [options]
55
45
 
56
46
  Options:
57
- --opencode Tạo AGENTS.md cho OpenCode
58
- --copilot Tạo .github/copilot-instructions.md
59
- --cursor Tạo .cursorrules
60
- --windsurf Tạo .windsurfrules
61
- --all Tạo config cho tất cả IDEs
62
47
  --force Ghi đè files có sẵn mà không hỏi
63
48
  --name <n> Tên project (mặc định: từ package.json)
64
49
 
@@ -97,7 +82,7 @@ Agents follow protocol này (defined trong config files):
97
82
 
98
83
  | Layer | File | Mục đích |
99
84
  |-------|------|----------|
100
- | Router | AGENTS.md / .cursorrules / etc | Rules + pointers (~100 dòng) |
85
+ | Router | AGENTS.md | Rules + pointers (~100 dòng) |
101
86
  | Memory | .agents/MEMORY.md | Curated decisions (1-line each) |
102
87
  | Tasks | .agents/TASKS.md | Current work, next steps |
103
88
  | Specs | .agents/spec/*.md | Detailed docs (on-demand) |
@@ -117,14 +102,19 @@ File-based solution:
117
102
 
118
103
  ## Cross-IDE Compatibility
119
104
 
120
- | IDE | Config File | Reads .agents/* |
121
- |-----|-------------|-----------------|
122
- | OpenCode | AGENTS.md | |
123
- | GitHub Copilot | .github/copilot-instructions.md | ✅ |
124
- | Cursor | .cursorrules | ✅ |
125
- | Windsurf | .windsurfrules | ✅ |
105
+ Mặc định, công cụ chỉ scaffold `AGENTS.md`, một chuẩn router file đang phổ biến.
106
+
107
+ Nếu công cụ của bạn yêu cầu một file cụ thể (vd: Cursor yêu cầu `.cursorrules`, GitHub Copilot yêu cầu `.github/copilot-instructions.md`), bạn thể đơn giản dùng symlink hoặc copy `AGENTS.md`:
108
+
109
+ ```bash
110
+ # Cho Cursor
111
+ ln -s AGENTS.md .cursorrules
112
+
113
+ # Cho GitHub Copilot
114
+ mkdir -p .github && ln -s ../AGENTS.md .github/copilot-instructions.md
115
+ ```
126
116
 
127
- Tất cả IDEs dùng cùng `.agents/` memory structure.
117
+ Tất cả các công cụ sẽ cùng đọc chung cấu trúc bộ nhớ bên trong thư mục `.agents/`.
128
118
 
129
119
  ## Tài liệu
130
120
 
package/dist/bin/cli.js CHANGED
@@ -1,10 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // bin/cli.ts
4
- import * as readline from "readline";
5
- import { existsSync as existsSync3 } from "fs";
6
- import { join as join3 } from "path";
7
-
8
3
  // src/core/scaffold.ts
9
4
  import { existsSync, mkdirSync, writeFileSync, readFileSync } from "fs";
10
5
  import { join, resolve, dirname } from "path";
@@ -17,9 +12,6 @@ var MEMORY_FILE = ".agents/MEMORY.md";
17
12
  var MEMORY_DETAIL_FILE = ".agents/MEMORY-DETAIL.md";
18
13
  var TASKS_FILE = ".agents/TASKS.md";
19
14
  var AGENTS_MD = "AGENTS.md";
20
- var COPILOT_INSTRUCTIONS = ".github/copilot-instructions.md";
21
- var CURSOR_RULES = ".cursorrules";
22
- var WINDSURF_RULES = ".windsurfrules";
23
15
 
24
16
  // src/core/scaffold.ts
25
17
  function getTemplatesDir() {
@@ -50,18 +42,10 @@ function scaffold(projectDir, options = {}) {
50
42
  const projectName = options.projectName || guessProjectName(projectDir);
51
43
  const vars = { PROJECT_NAME: projectName };
52
44
  const force = options.force || false;
53
- const hasAnyIde = options.opencode || options.copilot || options.cursor || options.windsurf;
54
- const useOpencode = hasAnyIde ? options.opencode : true;
55
- const useCopilot = options.copilot || false;
56
- const useCursor = options.cursor || false;
57
- const useWindsurf = options.windsurf || false;
58
45
  const dirs = [
59
46
  join(projectDir, AGENTS_DIR),
60
47
  join(projectDir, SPEC_DIR)
61
48
  ];
62
- if (useCopilot) {
63
- dirs.push(join(projectDir, ".github"));
64
- }
65
49
  for (const dir of dirs) {
66
50
  if (!existsSync(dir)) {
67
51
  mkdirSync(dir, { recursive: true });
@@ -87,42 +71,13 @@ function scaffold(projectDir, options = {}) {
87
71
  writeFileSync(specKeep, "");
88
72
  result.created.push(`${SPEC_DIR}/.gitkeep`);
89
73
  }
90
- if (useOpencode) {
91
- writeFileIfNeeded(
92
- join(projectDir, AGENTS_MD),
93
- applyVars(readTemplate("AGENTS.md"), vars),
94
- AGENTS_MD,
95
- result,
96
- force
97
- );
98
- }
99
- if (useCopilot) {
100
- writeFileIfNeeded(
101
- join(projectDir, COPILOT_INSTRUCTIONS),
102
- applyVars(readTemplate("copilot-instructions.md"), vars),
103
- COPILOT_INSTRUCTIONS,
104
- result,
105
- force
106
- );
107
- }
108
- if (useCursor) {
109
- writeFileIfNeeded(
110
- join(projectDir, CURSOR_RULES),
111
- applyVars(readTemplate("cursorrules.md"), vars),
112
- CURSOR_RULES,
113
- result,
114
- force
115
- );
116
- }
117
- if (useWindsurf) {
118
- writeFileIfNeeded(
119
- join(projectDir, WINDSURF_RULES),
120
- applyVars(readTemplate("windsurfrules.md"), vars),
121
- WINDSURF_RULES,
122
- result,
123
- force
124
- );
125
- }
74
+ writeFileIfNeeded(
75
+ join(projectDir, AGENTS_MD),
76
+ applyVars(readTemplate("AGENTS.md"), vars),
77
+ AGENTS_MD,
78
+ result,
79
+ force
80
+ );
126
81
  return result;
127
82
  }
128
83
  function writeFileIfNeeded(targetPath, content, displayName, result, force) {
@@ -166,14 +121,6 @@ function doctor(projectDir) {
166
121
  issues.push({ level: "error", file: dir, message: "Directory missing" });
167
122
  }
168
123
  }
169
- const copilotPath = join2(projectDir, COPILOT_INSTRUCTIONS);
170
- if (!existsSync2(copilotPath)) {
171
- issues.push({
172
- level: "warning",
173
- file: COPILOT_INSTRUCTIONS,
174
- message: "Copilot instructions missing \u2014 VSCode/GitHub Copilot won't have context"
175
- });
176
- }
177
124
  const agentsPath = join2(projectDir, AGENTS_MD);
178
125
  if (existsSync2(agentsPath)) {
179
126
  const content = readFileSync2(agentsPath, "utf-8");
@@ -203,182 +150,39 @@ function doctor(projectDir) {
203
150
  });
204
151
  }
205
152
  }
206
- const opencodePkgPath = join2(projectDir, ".opencode", "package.json");
207
- const opencodeJsonPath = join2(projectDir, "opencode.json");
208
- const opencodeExists = existsSync2(join2(projectDir, ".opencode"));
209
- if (opencodeExists) {
210
- if (!existsSync2(opencodePkgPath)) {
211
- issues.push({
212
- level: "warning",
213
- file: ".opencode/package.json",
214
- message: "Missing \u2014 run 'agent-memory init --opencode' to wire up the plugin"
215
- });
216
- } else {
217
- try {
218
- const pkg = JSON.parse(readFileSync2(opencodePkgPath, "utf-8"));
219
- const deps = { ...pkg.dependencies, ...pkg.devDependencies };
220
- if (!deps["@vuau/agent-memory"]) {
221
- issues.push({
222
- level: "warning",
223
- file: ".opencode/package.json",
224
- message: "@vuau/agent-memory not in dependencies \u2014 run 'agent-memory init --opencode'"
225
- });
226
- }
227
- } catch {
228
- issues.push({ level: "warning", file: ".opencode/package.json", message: "Invalid JSON" });
229
- }
230
- }
231
- if (!existsSync2(opencodeJsonPath)) {
232
- issues.push({
233
- level: "warning",
234
- file: "opencode.json",
235
- message: "Missing \u2014 run 'agent-memory init --opencode' to wire up the plugin"
236
- });
237
- } else {
238
- try {
239
- const config = JSON.parse(readFileSync2(opencodeJsonPath, "utf-8"));
240
- const plugins = config.plugin || [];
241
- if (!plugins.includes("@vuau/agent-memory")) {
242
- issues.push({
243
- level: "warning",
244
- file: "opencode.json",
245
- message: "@vuau/agent-memory not in plugin array \u2014 run 'agent-memory init --opencode'"
246
- });
247
- }
248
- } catch {
249
- issues.push({ level: "warning", file: "opencode.json", message: "Invalid JSON" });
250
- }
251
- }
252
- }
253
153
  return { ok: issues.filter((i) => i.level === "error").length === 0, issues };
254
154
  }
255
155
 
256
156
  // bin/cli.ts
257
157
  var args = process.argv.slice(2);
258
158
  var command = args[0];
259
- var rl = readline.createInterface({
260
- input: process.stdin,
261
- output: process.stdout
262
- });
263
- function ask(question) {
264
- return new Promise((resolve2) => {
265
- rl.question(question, (answer) => resolve2(answer.trim()));
266
- });
267
- }
268
- function askYesNo(question, defaultYes = true) {
269
- const hint = defaultYes ? "(Y/n)" : "(y/N)";
270
- return ask(`${question} ${hint} `).then((answer) => {
271
- if (!answer) return defaultYes;
272
- return answer.toLowerCase().startsWith("y");
273
- });
274
- }
275
- async function askMultiSelect(question, options) {
276
- console.log(`
277
- ${question}`);
278
- for (const opt of options) {
279
- console.log(` [${opt.key}] ${opt.label}`);
280
- }
281
- const answer = await ask("Enter choices (e.g., 1,2 or 1 2): ");
282
- const selected = answer.split(/[,\s]+/).filter(Boolean);
283
- return selected;
284
- }
285
159
  function printUsage() {
286
160
  console.log(`
287
161
  @vuau/agent-memory \u2014 Structured AI memory for codebases
288
162
 
289
163
  Usage:
290
- agent-memory init [options] Scaffold .agents/ structure
164
+ agent-memory init [options] Scaffold .agents/ structure and AGENTS.md
291
165
  agent-memory doctor Validate .agents/ structure
292
166
  agent-memory help Show this help
293
167
 
294
168
  Options (init):
295
- --opencode Create AGENTS.md for OpenCode
296
- --copilot Create .github/copilot-instructions.md for GitHub Copilot
297
- --cursor Create .cursorrules for Cursor
298
- --windsurf Create .windsurfrules for Windsurf
299
- --all Create config for all IDEs
300
169
  --force Overwrite existing files without asking
301
170
  --name <name> Project name (default: from package.json)
302
171
 
303
172
  Examples:
304
- npx @vuau/agent-memory init # Interactive mode
305
- npx @vuau/agent-memory init --opencode # OpenCode only
306
- npx @vuau/agent-memory init --copilot --cursor # Copilot + Cursor
307
- npx @vuau/agent-memory init --all # All IDEs
173
+ npx @vuau/agent-memory init
174
+ npx @vuau/agent-memory init --force
308
175
  `);
309
176
  }
310
177
  async function runInit() {
311
178
  const cwd = process.cwd();
312
179
  const force = args.includes("--force");
313
- const hasOpencode = args.includes("--opencode");
314
- const hasCopilot = args.includes("--copilot");
315
- const hasCursor = args.includes("--cursor");
316
- const hasWindsurf = args.includes("--windsurf");
317
- const hasAll = args.includes("--all");
318
180
  const nameIdx = args.indexOf("--name");
319
181
  const projectName = nameIdx !== -1 ? args[nameIdx + 1] : void 0;
320
- let selectedIdes = [];
321
- if (hasAll) {
322
- selectedIdes = ["1", "2", "3", "4"];
323
- } else if (hasOpencode || hasCopilot || hasCursor || hasWindsurf) {
324
- if (hasOpencode) selectedIdes.push("1");
325
- if (hasCopilot) selectedIdes.push("2");
326
- if (hasCursor) selectedIdes.push("3");
327
- if (hasWindsurf) selectedIdes.push("4");
328
- } else {
329
- console.log("\n@vuau/agent-memory \u2014 Structured AI memory for codebases\n");
330
- selectedIdes = await askMultiSelect("What are your coding tools?", [
331
- { key: "1", label: "OpenCode (AGENTS.md)" },
332
- { key: "2", label: "GitHub Copilot (.github/copilot-instructions.md)" },
333
- { key: "3", label: "Cursor (.cursorrules)" },
334
- { key: "4", label: "Windsurf (.windsurfrules)" }
335
- ]);
336
- if (selectedIdes.length === 0) {
337
- console.log("\nNo tools selected. Defaulting to OpenCode.\n");
338
- selectedIdes = ["1"];
339
- }
340
- }
341
182
  const options = {
342
183
  projectName,
343
- opencode: selectedIdes.includes("1"),
344
- copilot: selectedIdes.includes("2"),
345
- cursor: selectedIdes.includes("3"),
346
- windsurf: selectedIdes.includes("4")
184
+ force
347
185
  };
348
- if (!force) {
349
- const filesToCheck = [
350
- { path: MEMORY_FILE, name: ".agents/MEMORY.md" },
351
- { path: TASKS_FILE, name: ".agents/TASKS.md" }
352
- ];
353
- if (options.opencode) {
354
- filesToCheck.push({ path: AGENTS_MD, name: "AGENTS.md" });
355
- }
356
- if (options.copilot) {
357
- filesToCheck.push({ path: COPILOT_INSTRUCTIONS, name: ".github/copilot-instructions.md" });
358
- }
359
- if (options.cursor) {
360
- filesToCheck.push({ path: ".cursorrules", name: ".cursorrules" });
361
- }
362
- if (options.windsurf) {
363
- filesToCheck.push({ path: ".windsurfrules", name: ".windsurfrules" });
364
- }
365
- const existingFiles = filesToCheck.filter((f) => existsSync3(join3(cwd, f.path)));
366
- if (existingFiles.length > 0) {
367
- console.log("\nExisting files found:");
368
- for (const f of existingFiles) {
369
- console.log(` - ${f.name}`);
370
- }
371
- const overwrite = await askYesNo("\nOverwrite these files?", false);
372
- if (!overwrite) {
373
- console.log("\nAborted. Use --force to overwrite without asking.\n");
374
- rl.close();
375
- return;
376
- }
377
- options.force = true;
378
- }
379
- } else {
380
- options.force = true;
381
- }
382
186
  console.log(`
383
187
  Initializing agent memory in ${cwd}...
384
188
  `);
@@ -394,13 +198,15 @@ Initializing agent memory in ${cwd}...
394
198
  for (const f of result.skipped) {
395
199
  console.log(` - ${f}`);
396
200
  }
201
+ if (!force) {
202
+ console.log("\nTip: Use --force to overwrite existing files.");
203
+ }
397
204
  }
398
205
  console.log("\nNext steps:");
399
- console.log(" 1. Edit your IDE config file \u2014 add project-specific rules");
206
+ console.log(" 1. Edit AGENTS.md \u2014 add project-specific rules");
400
207
  console.log(" 2. Add spec files to .agents/spec/ for detailed documentation");
401
208
  console.log(" 3. Agent will read rules and write to .agents/MEMORY.md automatically");
402
209
  console.log("");
403
- rl.close();
404
210
  }
405
211
  function runDoctor() {
406
212
  const cwd = process.cwd();
@@ -425,7 +231,6 @@ switch (command) {
425
231
  case "init":
426
232
  runInit().catch((err) => {
427
233
  console.error("Error:", err.message);
428
- rl.close();
429
234
  process.exit(1);
430
235
  });
431
236
  break;
@@ -440,7 +245,6 @@ switch (command) {
440
245
  case void 0:
441
246
  runInit().catch((err) => {
442
247
  console.error("Error:", err.message);
443
- rl.close();
444
248
  process.exit(1);
445
249
  });
446
250
  break;
package/dist/index.js CHANGED
@@ -10,9 +10,6 @@ var MEMORY_FILE = ".agents/MEMORY.md";
10
10
  var MEMORY_DETAIL_FILE = ".agents/MEMORY-DETAIL.md";
11
11
  var TASKS_FILE = ".agents/TASKS.md";
12
12
  var AGENTS_MD = "AGENTS.md";
13
- var COPILOT_INSTRUCTIONS = ".github/copilot-instructions.md";
14
- var CURSOR_RULES = ".cursorrules";
15
- var WINDSURF_RULES = ".windsurfrules";
16
13
 
17
14
  // src/core/scaffold.ts
18
15
  function getTemplatesDir() {
@@ -43,18 +40,10 @@ function scaffold(projectDir, options = {}) {
43
40
  const projectName = options.projectName || guessProjectName(projectDir);
44
41
  const vars = { PROJECT_NAME: projectName };
45
42
  const force = options.force || false;
46
- const hasAnyIde = options.opencode || options.copilot || options.cursor || options.windsurf;
47
- const useOpencode = hasAnyIde ? options.opencode : true;
48
- const useCopilot = options.copilot || false;
49
- const useCursor = options.cursor || false;
50
- const useWindsurf = options.windsurf || false;
51
43
  const dirs = [
52
44
  join(projectDir, AGENTS_DIR),
53
45
  join(projectDir, SPEC_DIR)
54
46
  ];
55
- if (useCopilot) {
56
- dirs.push(join(projectDir, ".github"));
57
- }
58
47
  for (const dir of dirs) {
59
48
  if (!existsSync(dir)) {
60
49
  mkdirSync(dir, { recursive: true });
@@ -80,42 +69,13 @@ function scaffold(projectDir, options = {}) {
80
69
  writeFileSync(specKeep, "");
81
70
  result.created.push(`${SPEC_DIR}/.gitkeep`);
82
71
  }
83
- if (useOpencode) {
84
- writeFileIfNeeded(
85
- join(projectDir, AGENTS_MD),
86
- applyVars(readTemplate("AGENTS.md"), vars),
87
- AGENTS_MD,
88
- result,
89
- force
90
- );
91
- }
92
- if (useCopilot) {
93
- writeFileIfNeeded(
94
- join(projectDir, COPILOT_INSTRUCTIONS),
95
- applyVars(readTemplate("copilot-instructions.md"), vars),
96
- COPILOT_INSTRUCTIONS,
97
- result,
98
- force
99
- );
100
- }
101
- if (useCursor) {
102
- writeFileIfNeeded(
103
- join(projectDir, CURSOR_RULES),
104
- applyVars(readTemplate("cursorrules.md"), vars),
105
- CURSOR_RULES,
106
- result,
107
- force
108
- );
109
- }
110
- if (useWindsurf) {
111
- writeFileIfNeeded(
112
- join(projectDir, WINDSURF_RULES),
113
- applyVars(readTemplate("windsurfrules.md"), vars),
114
- WINDSURF_RULES,
115
- result,
116
- force
117
- );
118
- }
72
+ writeFileIfNeeded(
73
+ join(projectDir, AGENTS_MD),
74
+ applyVars(readTemplate("AGENTS.md"), vars),
75
+ AGENTS_MD,
76
+ result,
77
+ force
78
+ );
119
79
  return result;
120
80
  }
121
81
  function writeFileIfNeeded(targetPath, content, displayName, result, force) {
@@ -262,14 +222,6 @@ function doctor(projectDir) {
262
222
  issues.push({ level: "error", file: dir, message: "Directory missing" });
263
223
  }
264
224
  }
265
- const copilotPath = join4(projectDir, COPILOT_INSTRUCTIONS);
266
- if (!existsSync4(copilotPath)) {
267
- issues.push({
268
- level: "warning",
269
- file: COPILOT_INSTRUCTIONS,
270
- message: "Copilot instructions missing \u2014 VSCode/GitHub Copilot won't have context"
271
- });
272
- }
273
225
  const agentsPath = join4(projectDir, AGENTS_MD);
274
226
  if (existsSync4(agentsPath)) {
275
227
  const content = readFileSync4(agentsPath, "utf-8");
@@ -299,65 +251,15 @@ function doctor(projectDir) {
299
251
  });
300
252
  }
301
253
  }
302
- const opencodePkgPath = join4(projectDir, ".opencode", "package.json");
303
- const opencodeJsonPath = join4(projectDir, "opencode.json");
304
- const opencodeExists = existsSync4(join4(projectDir, ".opencode"));
305
- if (opencodeExists) {
306
- if (!existsSync4(opencodePkgPath)) {
307
- issues.push({
308
- level: "warning",
309
- file: ".opencode/package.json",
310
- message: "Missing \u2014 run 'agent-memory init --opencode' to wire up the plugin"
311
- });
312
- } else {
313
- try {
314
- const pkg = JSON.parse(readFileSync4(opencodePkgPath, "utf-8"));
315
- const deps = { ...pkg.dependencies, ...pkg.devDependencies };
316
- if (!deps["@vuau/agent-memory"]) {
317
- issues.push({
318
- level: "warning",
319
- file: ".opencode/package.json",
320
- message: "@vuau/agent-memory not in dependencies \u2014 run 'agent-memory init --opencode'"
321
- });
322
- }
323
- } catch {
324
- issues.push({ level: "warning", file: ".opencode/package.json", message: "Invalid JSON" });
325
- }
326
- }
327
- if (!existsSync4(opencodeJsonPath)) {
328
- issues.push({
329
- level: "warning",
330
- file: "opencode.json",
331
- message: "Missing \u2014 run 'agent-memory init --opencode' to wire up the plugin"
332
- });
333
- } else {
334
- try {
335
- const config = JSON.parse(readFileSync4(opencodeJsonPath, "utf-8"));
336
- const plugins = config.plugin || [];
337
- if (!plugins.includes("@vuau/agent-memory")) {
338
- issues.push({
339
- level: "warning",
340
- file: "opencode.json",
341
- message: "@vuau/agent-memory not in plugin array \u2014 run 'agent-memory init --opencode'"
342
- });
343
- }
344
- } catch {
345
- issues.push({ level: "warning", file: "opencode.json", message: "Invalid JSON" });
346
- }
347
- }
348
- }
349
254
  return { ok: issues.filter((i) => i.level === "error").length === 0, issues };
350
255
  }
351
256
  export {
352
257
  AGENTS_DIR,
353
258
  AGENTS_MD,
354
- COPILOT_INSTRUCTIONS,
355
- CURSOR_RULES,
356
259
  MEMORY_DETAIL_FILE,
357
260
  MEMORY_FILE,
358
261
  SPEC_DIR,
359
262
  TASKS_FILE,
360
- WINDSURF_RULES,
361
263
  appendMemory,
362
264
  doctor,
363
265
  readMemory,
@@ -168,28 +168,21 @@ This document proposes a generalizable architecture for AI memory across codebas
168
168
 
169
169
  ---
170
170
 
171
- ## IDE Integration Points
171
+ ## Integration Points
172
172
 
173
- ### OpenCode
174
- - Reads: AGENTS.md (via plugin hook)
175
- - Plugin auto-injects: `.agents/MEMORY.md` context on session start
176
- - Plugin reminds: Update TASKS.md on session idle
177
- - Writes: Agent appends to MEMORY.md/TASKS.md/spec/
173
+ By default, we scaffold `AGENTS.md` which acts as the root router for your AI coding assistant. This file contains rules and documentation maps that point to the `.agents/` folder.
178
174
 
179
- ### GitHub Copilot (VSCode)
180
- - Reads: `.github/copilot-instructions.md` (GitHub convention)
181
- - copilot-instructions.md = same router format as AGENTS.md
182
- - Points to `.agents/MEMORY.md` + spec files
183
- - Writes: User includes `@save memory: <decision>` in chat → agent appends
175
+ If your specific AI tool requires a different file name, you can simply symlink the `AGENTS.md` file:
184
176
 
185
- ### Cursor / Windsurf
186
- - Reads: `.cursorrules` / `.windsurfrules` (IDE convention)
187
- - Same router format, points to `.agents/`
188
- - Writes: Agent rules instruct direct append
177
+ ```bash
178
+ # Example: For Cursor
179
+ ln -s AGENTS.md .cursorrules
189
180
 
190
- ### CLI / Non-IDE Workflows
191
- - Humans can read/edit `.agents/` files directly
192
- - No special IDE integration needed
181
+ # Example: For GitHub Copilot
182
+ mkdir -p .github && ln -s ../AGENTS.md .github/copilot-instructions.md
183
+ ```
184
+
185
+ This ensures a single source of truth (`AGENTS.md`) is maintained while providing backward compatibility with any tool.
193
186
 
194
187
  ---
195
188
 
@@ -219,12 +212,12 @@ This document proposes a generalizable architecture for AI memory across codebas
219
212
  - Keep `.memsearch/memory/` as archive (1 year retention)
220
213
  - Delete milvus.db
221
214
 
222
- ### From .github/copilot-instructions.md (monolithic)
215
+ ### From Monolithic Config Files (e.g. .cursorrules)
223
216
 
224
217
  1. **Extract decisions** → `.agents/MEMORY.md`
225
218
  2. **Extract patterns** → `.agents/spec/patterns.md`
226
219
  3. **Extract commands** → `AGENTS.md`
227
- 4. **Keep router** → update `.github/copilot-instructions.md` to point to `.agents/`
220
+ 4. **Keep router** → Create symlink from your old config file to `AGENTS.md`
228
221
 
229
222
  ---
230
223
 
@@ -254,10 +247,8 @@ This document proposes a generalizable architecture for AI memory across codebas
254
247
  ## Tooling Support
255
248
 
256
249
  ### CLI
257
- - ✓ `npx @vuau/agent-memory init` — scaffold structure (interactive or with flags)
258
- - ✓ `npx @vuau/agent-memory init --opencode` — OpenCode only
259
- - ✓ `npx @vuau/agent-memory init --copilot --cursor` — multiple IDEs
260
- - ✓ `npx @vuau/agent-memory init --all` — all IDEs
250
+ - ✓ `npx @vuau/agent-memory init` — scaffold structure (`AGENTS.md` + `.agents/`)
251
+ - ✓ `npx @vuau/agent-memory init --force` — overwrite existing files
261
252
  - ✓ `npx @vuau/agent-memory doctor` — validate structure
262
253
  - Planned: ✗ `report` — generate memory stats, archival suggestions
263
254
 
@@ -168,27 +168,21 @@ Tài liệu này đề xuất kiến trúc khả năng skalabiliti cho AI memory
168
168
 
169
169
  ---
170
170
 
171
- ## IDE Integration Points
171
+ ## Điểm Tích Hợp
172
172
 
173
- ### OpenCode
174
- - Reads: `AGENTS.md` (native)
175
- - Agents follow rules trong AGENTS.md
176
- - Writes: Agent appends đến MEMORY.md/TASKS.md/spec/
173
+ Mặc định, chúng tôi scaffold `AGENTS.md` hoạt động như root router cho AI coding assistant của bạn. File này chứa các rules và documentation maps trỏ đến thư mục `.agents/`.
177
174
 
178
- ### GitHub Copilot (VSCode)
179
- - Reads: `.github/copilot-instructions.md` (GitHub convention)
180
- - copilot-instructions.md = cùng router format với AGENTS.md
181
- - Points đến `.agents/MEMORY.md` + spec files
182
- - Writes: Agent follows rules → appends khi appropriate
175
+ Nếu công cụ AI cụ thể của bạn yêu cầu một tên file khác, bạn có thể dễ dàng dùng symlink file `AGENTS.md`:
183
176
 
184
- ### Cursor / Windsurf
185
- - Reads: `.cursorrules` / `.windsurfrules` (IDE convention)
186
- - Cùng router format, points đến `.agents/`
187
- - Writes: Agent rules instruct direct append
177
+ ```bash
178
+ # dụ: Cho Cursor
179
+ ln -s AGENTS.md .cursorrules
188
180
 
189
- ### CLI / Non-IDE Workflows
190
- - Humans thể read/edit `.agents/` files trực tiếp
191
- - Không cần special IDE integration
181
+ # dụ: Cho GitHub Copilot
182
+ mkdir -p .github && ln -s ../AGENTS.md .github/copilot-instructions.md
183
+ ```
184
+
185
+ Điều này đảm bảo single source of truth (`AGENTS.md`) được duy trì trong khi cung cấp khả năng tương thích ngược với mọi công cụ.
192
186
 
193
187
  ---
194
188
 
@@ -218,12 +212,12 @@ Tài liệu này đề xuất kiến trúc khả năng skalabiliti cho AI memory
218
212
  - Keep `.memsearch/memory/` như archive (1 year retention)
219
213
  - Delete milvus.db
220
214
 
221
- ### Từ .github/copilot-instructions.md (monolithic)
215
+ ### Từ Monolithic Config Files (vd: .cursorrules)
222
216
 
223
217
  1. **Extract decisions** → `.agents/MEMORY.md`
224
218
  2. **Extract patterns** → `.agents/spec/patterns.md`
225
219
  3. **Extract commands** → `AGENTS.md`
226
- 4. **Keep router** → update `.github/copilot-instructions.md` để point đến `.agents/`
220
+ 4. **Keep router** → Tạo symlink từ config file cũ của bạn trỏ tới `AGENTS.md`
227
221
 
228
222
  ---
229
223
 
@@ -253,10 +247,8 @@ Tài liệu này đề xuất kiến trúc khả năng skalabiliti cho AI memory
253
247
  ## Công cụ Support
254
248
 
255
249
  ### CLI
256
- - ✓ `npx @vuau/agent-memory init` — scaffold structure (interactive hoặc với flags)
257
- - ✓ `npx @vuau/agent-memory init --opencode` — chỉ OpenCode
258
- - ✓ `npx @vuau/agent-memory init --copilot --cursor` — nhiều IDEs
259
- - ✓ `npx @vuau/agent-memory init --all` — tất cả IDEs
250
+ - ✓ `npx @vuau/agent-memory init` — scaffold structure (`AGENTS.md` + `.agents/`)
251
+ - ✓ `npx @vuau/agent-memory init --force` — ghi đè files có sẵn
260
252
  - ✓ `npx @vuau/agent-memory doctor` — validate structure
261
253
  - Planned: ✗ `report` — generate memory stats, archival suggestions
262
254
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuau/agent-memory",
3
- "version": "0.3.1",
3
+ "version": "0.4.1",
4
4
  "description": "Structured AI memory for codebases — scaffolding CLI for OpenCode, Copilot, Cursor, Windsurf",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,31 +0,0 @@
1
- # {{PROJECT_NAME}} - Copilot Instructions (VSCode)
2
-
3
- Router file for GitHub Copilot. Points to shared agent documentation.
4
-
5
- ## Priority
6
- 1. Follow direct user request.
7
- 2. Follow this file.
8
- 3. Follow spec files in `.agents/spec/`.
9
- 4. If conflict remains, choose smallest safe change and state assumptions.
10
-
11
- ## Documentation Map
12
-
13
- | Task | Spec File |
14
- |------|-----------|
15
- | Past decisions (1-line) | `.agents/MEMORY.md` |
16
- | Past decisions (full context) | `.agents/MEMORY-DETAIL.md` |
17
- | Current work in progress | `.agents/TASKS.md` |
18
-
19
- > Add your own spec files to `.agents/spec/` and reference them here.
20
-
21
- ## Response Style
22
- - Concise, concrete, implementation-focused.
23
- - If uncertain, say "I don't know" and give fastest verification step.
24
- - Do not invent files, APIs, or command results.
25
- - Keep diffs minimal, aligned with existing conventions.
26
-
27
- ## Memory Protocol
28
- - When user approves a decision → append 1-line entry to `.agents/MEMORY.md` under appropriate category.
29
- - Format: `- YYYY-MM-DD: <decision> → detail` (add `→ detail` when full context exists in MEMORY-DETAIL.md).
30
- - Read `.agents/MEMORY.md` before implementing; follow pointers for details.
31
- - Do not create additional memory files.
@@ -1,44 +0,0 @@
1
- # {{PROJECT_NAME}} - Cursor Rules
2
-
3
- Instructions for Cursor AI. Keep under 150 lines.
4
-
5
- ## Priority
6
- 1. User request first.
7
- 2. These rules.
8
- 3. Spec files in `.agents/spec/`.
9
- 4. If conflict remains, choose smallest safe change and state assumption.
10
-
11
- ## Documentation Map
12
-
13
- | Task | Location |
14
- |------|----------|
15
- | Past decisions (1-line) | `.agents/MEMORY.md` |
16
- | Past decisions (full context) | `.agents/MEMORY-DETAIL.md` |
17
- | Current work in progress | `.agents/TASKS.md` |
18
- | Detailed specs | `.agents/spec/*.md` |
19
-
20
- ## Memory Protocol
21
-
22
- ### When to write
23
- - User approves a decision or pattern → append to `.agents/MEMORY.md`
24
- - Explore codebase/architecture → update relevant `.agents/spec/*.md`
25
- - Start/finish a large task → update `.agents/TASKS.md`
26
-
27
- ### MEMORY.md entry format
28
- ```
29
- - YYYY-MM-DD: <1-line decision or pattern> → detail
30
- ```
31
- Place under the appropriate category. Add `→ detail` pointer when full context exists in MEMORY-DETAIL.md.
32
-
33
- ### TASKS.md update
34
- Before ending a session with unfinished work, move items to `## In Progress` or `## Up Next`.
35
-
36
- ### Rules
37
- - Keep MEMORY.md entries to 1 line each. Details go in spec files.
38
- - If MEMORY.md > 150 lines, archive old entries.
39
- - Do not create additional memory files outside `.agents/`.
40
-
41
- ## Response Style
42
- - Concise, concrete, implementation-focused.
43
- - If uncertain, say `I don't know`, then give fastest verification step.
44
- - Do not invent files, APIs, or command outputs.
@@ -1,44 +0,0 @@
1
- # {{PROJECT_NAME}} - Windsurf Rules
2
-
3
- Instructions for Windsurf AI. Keep under 150 lines.
4
-
5
- ## Priority
6
- 1. User request first.
7
- 2. These rules.
8
- 3. Spec files in `.agents/spec/`.
9
- 4. If conflict remains, choose smallest safe change and state assumption.
10
-
11
- ## Documentation Map
12
-
13
- | Task | Location |
14
- |------|----------|
15
- | Past decisions (1-line) | `.agents/MEMORY.md` |
16
- | Past decisions (full context) | `.agents/MEMORY-DETAIL.md` |
17
- | Current work in progress | `.agents/TASKS.md` |
18
- | Detailed specs | `.agents/spec/*.md` |
19
-
20
- ## Memory Protocol
21
-
22
- ### When to write
23
- - User approves a decision or pattern → append to `.agents/MEMORY.md`
24
- - Explore codebase/architecture → update relevant `.agents/spec/*.md`
25
- - Start/finish a large task → update `.agents/TASKS.md`
26
-
27
- ### MEMORY.md entry format
28
- ```
29
- - YYYY-MM-DD: <1-line decision or pattern> → detail
30
- ```
31
- Place under the appropriate category. Add `→ detail` pointer when full context exists in MEMORY-DETAIL.md.
32
-
33
- ### TASKS.md update
34
- Before ending a session with unfinished work, move items to `## In Progress` or `## Up Next`.
35
-
36
- ### Rules
37
- - Keep MEMORY.md entries to 1 line each. Details go in spec files.
38
- - If MEMORY.md > 150 lines, archive old entries.
39
- - Do not create additional memory files outside `.agents/`.
40
-
41
- ## Response Style
42
- - Concise, concrete, implementation-focused.
43
- - If uncertain, say `I don't know`, then give fastest verification step.
44
- - Do not invent files, APIs, or command outputs.