gencode-ai 0.2.0 → 0.3.0

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.
Files changed (150) hide show
  1. package/dist/agent/agent.d.ts +9 -2
  2. package/dist/agent/agent.d.ts.map +1 -1
  3. package/dist/agent/agent.js +37 -8
  4. package/dist/agent/agent.js.map +1 -1
  5. package/dist/agent/types.d.ts +5 -1
  6. package/dist/agent/types.d.ts.map +1 -1
  7. package/dist/cli/components/App.d.ts.map +1 -1
  8. package/dist/cli/components/App.js +15 -9
  9. package/dist/cli/components/App.js.map +1 -1
  10. package/dist/cli/components/Messages.js +1 -1
  11. package/dist/cli/components/Messages.js.map +1 -1
  12. package/dist/cli/components/ModelSelector.d.ts +4 -3
  13. package/dist/cli/components/ModelSelector.d.ts.map +1 -1
  14. package/dist/cli/components/ModelSelector.js +54 -37
  15. package/dist/cli/components/ModelSelector.js.map +1 -1
  16. package/dist/cli/components/ProviderManager.d.ts +2 -2
  17. package/dist/cli/components/ProviderManager.d.ts.map +1 -1
  18. package/dist/cli/components/ProviderManager.js +137 -156
  19. package/dist/cli/components/ProviderManager.js.map +1 -1
  20. package/dist/cli/index.js +30 -13
  21. package/dist/cli/index.js.map +1 -1
  22. package/dist/config/index.d.ts +2 -2
  23. package/dist/config/index.d.ts.map +1 -1
  24. package/dist/config/index.js +1 -1
  25. package/dist/config/index.js.map +1 -1
  26. package/dist/config/levels.d.ts +5 -5
  27. package/dist/config/levels.d.ts.map +1 -1
  28. package/dist/config/levels.js +20 -20
  29. package/dist/config/levels.js.map +1 -1
  30. package/dist/config/merger.js +1 -1
  31. package/dist/config/merger.js.map +1 -1
  32. package/dist/config/providers-config.d.ts +8 -5
  33. package/dist/config/providers-config.d.ts.map +1 -1
  34. package/dist/config/providers-config.js +19 -22
  35. package/dist/config/providers-config.js.map +1 -1
  36. package/dist/config/test-utils.d.ts +2 -2
  37. package/dist/config/test-utils.d.ts.map +1 -1
  38. package/dist/config/test-utils.js +4 -4
  39. package/dist/config/test-utils.js.map +1 -1
  40. package/dist/config/types.d.ts +23 -17
  41. package/dist/config/types.d.ts.map +1 -1
  42. package/dist/config/types.js +14 -14
  43. package/dist/config/types.js.map +1 -1
  44. package/dist/memory/memory-manager.d.ts +25 -12
  45. package/dist/memory/memory-manager.d.ts.map +1 -1
  46. package/dist/memory/memory-manager.js +241 -112
  47. package/dist/memory/memory-manager.js.map +1 -1
  48. package/dist/memory/test-utils.d.ts +1 -1
  49. package/dist/memory/test-utils.d.ts.map +1 -1
  50. package/dist/memory/test-utils.js +3 -3
  51. package/dist/memory/test-utils.js.map +1 -1
  52. package/dist/memory/types.d.ts +20 -10
  53. package/dist/memory/types.d.ts.map +1 -1
  54. package/dist/memory/types.js +13 -13
  55. package/dist/memory/types.js.map +1 -1
  56. package/dist/migration/migrate.d.ts +24 -0
  57. package/dist/migration/migrate.d.ts.map +1 -0
  58. package/dist/migration/migrate.js +164 -0
  59. package/dist/migration/migrate.js.map +1 -0
  60. package/dist/permissions/persistence.d.ts +2 -2
  61. package/dist/permissions/persistence.js +4 -4
  62. package/dist/permissions/persistence.js.map +1 -1
  63. package/dist/planning/plan-file.d.ts +1 -1
  64. package/dist/planning/plan-file.js +2 -2
  65. package/dist/planning/plan-file.js.map +1 -1
  66. package/dist/prompts/index.d.ts +5 -4
  67. package/dist/prompts/index.d.ts.map +1 -1
  68. package/dist/prompts/index.js +11 -8
  69. package/dist/prompts/index.js.map +1 -1
  70. package/dist/providers/anthropic.d.ts +2 -1
  71. package/dist/providers/anthropic.d.ts.map +1 -1
  72. package/dist/providers/anthropic.js +7 -0
  73. package/dist/providers/anthropic.js.map +1 -1
  74. package/dist/providers/gemini.d.ts +2 -1
  75. package/dist/providers/gemini.d.ts.map +1 -1
  76. package/dist/providers/gemini.js +7 -0
  77. package/dist/providers/gemini.js.map +1 -1
  78. package/dist/providers/index.d.ts +20 -10
  79. package/dist/providers/index.d.ts.map +1 -1
  80. package/dist/providers/index.js +48 -24
  81. package/dist/providers/index.js.map +1 -1
  82. package/dist/providers/openai.d.ts +2 -1
  83. package/dist/providers/openai.d.ts.map +1 -1
  84. package/dist/providers/openai.js +7 -0
  85. package/dist/providers/openai.js.map +1 -1
  86. package/dist/providers/registry.d.ts +48 -34
  87. package/dist/providers/registry.d.ts.map +1 -1
  88. package/dist/providers/registry.js +72 -88
  89. package/dist/providers/registry.js.map +1 -1
  90. package/dist/providers/store.d.ts +43 -17
  91. package/dist/providers/store.d.ts.map +1 -1
  92. package/dist/providers/store.js +112 -19
  93. package/dist/providers/store.js.map +1 -1
  94. package/dist/providers/types.d.ts +23 -0
  95. package/dist/providers/types.d.ts.map +1 -1
  96. package/dist/providers/vertex-ai.d.ts +15 -7
  97. package/dist/providers/vertex-ai.d.ts.map +1 -1
  98. package/dist/providers/vertex-ai.js +46 -13
  99. package/dist/providers/vertex-ai.js.map +1 -1
  100. package/dist/session/types.js +1 -1
  101. package/dist/session/types.js.map +1 -1
  102. package/docs/config-system-comparison.md +50 -50
  103. package/docs/cost-tracking-comparison.md +2 -2
  104. package/docs/memory-system.md +124 -31
  105. package/docs/permissions.md +2 -2
  106. package/docs/proposals/0006-memory-system.md +4 -4
  107. package/docs/proposals/0008-checkpointing.md +109 -2
  108. package/docs/proposals/0011-custom-commands.md +2 -1
  109. package/docs/proposals/0021-skills-system.md +2 -1
  110. package/docs/proposals/0023-permission-enhancements.md +2 -2
  111. package/docs/proposals/0033-enterprise-deployment.md +1 -1
  112. package/docs/proposals/0041-configuration-system.md +17 -19
  113. package/docs/proposals/0042-prompt-optimization.md +17 -9
  114. package/docs/proposals/README.md +5 -5
  115. package/docs/providers.md +94 -9
  116. package/package.json +3 -2
  117. package/scripts/migrate.ts +449 -0
  118. package/src/agent/agent.ts +51 -9
  119. package/src/agent/types.ts +5 -1
  120. package/src/cli/components/App.tsx +17 -8
  121. package/src/cli/components/Messages.tsx +1 -1
  122. package/src/cli/components/ModelSelector.tsx +62 -43
  123. package/src/cli/components/ProviderManager.tsx +278 -323
  124. package/src/cli/index.tsx +36 -17
  125. package/src/config/index.ts +5 -3
  126. package/src/config/levels.test.ts +22 -22
  127. package/src/config/levels.ts +22 -22
  128. package/src/config/loader.test.ts +14 -14
  129. package/src/config/manager.test.ts +19 -19
  130. package/src/config/merger.test.ts +23 -23
  131. package/src/config/merger.ts +1 -1
  132. package/src/config/providers-config.ts +23 -21
  133. package/src/config/test-utils.ts +6 -6
  134. package/src/config/types.ts +30 -20
  135. package/src/memory/memory-manager.test.ts +242 -24
  136. package/src/memory/memory-manager.ts +270 -141
  137. package/src/memory/test-utils.ts +4 -4
  138. package/src/memory/types.ts +28 -17
  139. package/src/permissions/persistence.ts +4 -4
  140. package/src/planning/plan-file.ts +2 -2
  141. package/src/prompts/index.ts +13 -9
  142. package/src/providers/anthropic.ts +9 -0
  143. package/src/providers/gemini.ts +9 -0
  144. package/src/providers/index.ts +76 -33
  145. package/src/providers/openai.ts +9 -0
  146. package/src/providers/registry.ts +116 -111
  147. package/src/providers/store.ts +130 -28
  148. package/src/providers/types.ts +33 -1
  149. package/src/providers/vertex-ai.ts +49 -13
  150. package/src/session/types.ts +1 -1
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Overview
4
4
 
5
- GenCode implements a multi-level configuration system compatible with Claude Code, while also supporting OpenCode-style flexibility through the `GENCODE_CONFIG_DIRS` environment variable.
5
+ GenCode implements a multi-level configuration system compatible with Claude Code, while also supporting OpenCode-style flexibility through the `GEN_CONFIG` environment variable.
6
6
 
7
7
  ## Table of Contents
8
8
 
@@ -29,19 +29,19 @@ Priority (High → Low):
29
29
  │ Scope: Current session only │
30
30
  ├─────────────────────────────────────────────────────────────────────┤
31
31
  │ Level 4: Local (Personal) │
32
- │ Location: .gencode/*.local.* + .claude/*.local.* │
32
+ │ Location: .gen/*.local.* + .claude/*.local.* │
33
33
  │ Scope: Current user, current project only (gitignored) │
34
34
  ├─────────────────────────────────────────────────────────────────────┤
35
35
  │ Level 3: Project (Shared) │
36
- │ Location: .gencode/ + .claude/ (MERGED) │
36
+ │ Location: .gen/ + .claude/ (MERGED) │
37
37
  │ Scope: All collaborators (committed to git) │
38
38
  ├─────────────────────────────────────────────────────────────────────┤
39
- │ Level 2: Extra Dirs (GENCODE_CONFIG_DIRS) │
39
+ │ Level 2: Extra Dirs (GEN_CONFIG) │
40
40
  │ Location: Colon-separated paths from environment variable │
41
41
  │ Scope: Team/organization shared configs │
42
42
  ├─────────────────────────────────────────────────────────────────────┤
43
43
  │ Level 1: User (Global) - LOWEST PRIORITY │
44
- │ Location: ~/.gencode/ + ~/.claude/ (MERGED) │
44
+ │ Location: ~/.gen/ + ~/.claude/ (MERGED) │
45
45
  │ Scope: Current user, all projects │
46
46
  └─────────────────────────────────────────────────────────────────────┘
47
47
  ```
@@ -69,7 +69,7 @@ Priority (High → Low):
69
69
  ║ 同层级内合并 (claude 先加载,gencode 后加载覆盖): ║
70
70
  ║ ┌─────────────────────────────────────────────────────────────────────┐ ║
71
71
  ║ │ claude = load("~/.claude/settings.json") // 低优先级 │ ║
72
- ║ │ gencode = load("~/.gencode/settings.json") // 高优先级 │ ║
72
+ ║ │ gencode = load("~/.gen/settings.json") // 高优先级 │ ║
73
73
  ║ │ user = deepMerge(claude, gencode) // gencode 覆盖 │ ║
74
74
  ║ └─────────────────────────────────────────────────────────────────────┘ ║
75
75
  ║ ║
@@ -80,12 +80,12 @@ Priority (High → Low):
80
80
  └──────────────────┬──────────────────┘
81
81
 
82
82
  ╔══════════════════════════════════▼══════════════════════════════════════════╗
83
- ║ STEP 2: Load EXTRA Config Dirs (可选,GENCODE_CONFIG_DIRS) ║
83
+ ║ STEP 2: Load EXTRA Config Dirs (可选,GEN_CONFIG) ║
84
84
  ╠═════════════════════════════════════════════════════════════════════════════╣
85
85
  ║ ║
86
- ║ 环境变量: GENCODE_CONFIG_DIRS="/team/config:~/shared-rules" ║
86
+ ║ 环境变量: GEN_CONFIG="/team/config:~/shared-rules" ║
87
87
  ║ ║
88
- ║ For each dir in GENCODE_CONFIG_DIRS.split(':'): ║
88
+ ║ For each dir in GEN_CONFIG.split(':'): ║
89
89
  ║ ┌─────────────────────────────────────────────────────────────────────┐ ║
90
90
  ║ │ extra = load("{dir}/settings.json") │ ║
91
91
  ║ │ settings = deepMerge(settings, extra) │ ║
@@ -100,7 +100,7 @@ Priority (High → Low):
100
100
  ║ 同层级内合并: ║
101
101
  ║ ┌─────────────────────────────────────────────────────────────────────┐ ║
102
102
  ║ │ claude = load(".claude/settings.json") // 低优先级 │ ║
103
- ║ │ gencode = load(".gencode/settings.json") // 高优先级 │ ║
103
+ ║ │ gencode = load(".gen/settings.json") // 高优先级 │ ║
104
104
  ║ │ project = deepMerge(claude, gencode) // gencode 覆盖 │ ║
105
105
  ║ └─────────────────────────────────────────────────────────────────────┘ ║
106
106
  ║ ║
@@ -118,7 +118,7 @@ Priority (High → Low):
118
118
  ║ 同层级内合并: ║
119
119
  ║ ┌─────────────────────────────────────────────────────────────────────┐ ║
120
120
  ║ │ claude = load(".claude/settings.local.json") // 低优先级 │ ║
121
- ║ │ gencode = load(".gencode/settings.local.json") // 高优先级 │ ║
121
+ ║ │ gencode = load(".gen/settings.local.json") // 高优先级 │ ║
122
122
  ║ │ local = deepMerge(claude, gencode) // gencode 覆盖 │ ║
123
123
  ║ └─────────────────────────────────────────────────────────────────────┘ ║
124
124
  ║ ║
@@ -181,7 +181,7 @@ Priority (High → Low):
181
181
  ║ │ namespace: "claude", enforced: true │ ║
182
182
  ║ │ }) │ ║
183
183
  ║ │ if exists: memories.push({ │ ║
184
- ║ │ content: load("/Library/.../GenCode/AGENT.md"), │ ║
184
+ ║ │ content: load("/Library/.../GenCode/GEN.md"), │ ║
185
185
  ║ │ namespace: "gencode", enforced: true │ ║
186
186
  ║ │ }) │ ║
187
187
  ║ └─────────────────────────────────────────────────────────────────────┘ ║
@@ -195,13 +195,13 @@ Priority (High → Low):
195
195
  ║ 都加载 (先 claude 后 gencode): ║
196
196
  ║ ┌─────────────────────────────────────────────────────────────────────┐ ║
197
197
  ║ │ if exists: memories.push(load("~/.claude/CLAUDE.md")) │ ║
198
- ║ │ if exists: memories.push(load("~/.gencode/AGENT.md")) │ ║
198
+ ║ │ if exists: memories.push(load("~/.gen/GEN.md")) │ ║
199
199
  ║ └─────────────────────────────────────────────────────────────────────┘ ║
200
200
  ║ ║
201
201
  ║ 同样加载 rules: ║
202
202
  ║ ┌─────────────────────────────────────────────────────────────────────┐ ║
203
203
  ║ │ ~/.claude/rules/*.md → memories.push(each) │ ║
204
- ║ │ ~/.gencode/rules/*.md → memories.push(each) │ ║
204
+ ║ │ ~/.gen/rules/*.md → memories.push(each) │ ║
205
205
  ║ └─────────────────────────────────────────────────────────────────────┘ ║
206
206
  ║ ║
207
207
  ╚══════════════════════════════════╤══════════════════════════════════════════╝
@@ -210,10 +210,10 @@ Priority (High → Low):
210
210
  ║ STEP 3: Load EXTRA Config Dirs Memory (可选) ║
211
211
  ╠═════════════════════════════════════════════════════════════════════════════╣
212
212
  ║ ║
213
- ║ For each dir in GENCODE_CONFIG_DIRS: ║
213
+ ║ For each dir in GEN_CONFIG: ║
214
214
  ║ ┌─────────────────────────────────────────────────────────────────────┐ ║
215
215
  ║ │ if exists: memories.push(load("{dir}/CLAUDE.md")) │ ║
216
- ║ │ if exists: memories.push(load("{dir}/AGENT.md")) │ ║
216
+ ║ │ if exists: memories.push(load("{dir}/GEN.md")) │ ║
217
217
  ║ │ for each: memories.push(load("{dir}/rules/*.md")) │ ║
218
218
  ║ └─────────────────────────────────────────────────────────────────────┘ ║
219
219
  ║ ║
@@ -230,8 +230,8 @@ Priority (High → Low):
230
230
  ║ │ else if exists: memories.push(load("./.claude/CLAUDE.md")) │ ║
231
231
  ║ │ │ ║
232
232
  ║ │ # GenCode files (pick first found) │ ║
233
- ║ │ if exists: memories.push(load("./AGENT.md")) │ ║
234
- ║ │ else if exists: memories.push(load("./.gencode/AGENT.md")) │ ║
233
+ ║ │ if exists: memories.push(load("./GEN.md")) │ ║
234
+ ║ │ else if exists: memories.push(load("./.gen/GEN.md")) │ ║
235
235
  ║ └─────────────────────────────────────────────────────────────────────┘ ║
236
236
  ║ ║
237
237
  ╚══════════════════════════════════╤══════════════════════════════════════════╝
@@ -243,7 +243,7 @@ Priority (High → Low):
243
243
  ║ 加载规则目录 (都加载): ║
244
244
  ║ ┌─────────────────────────────────────────────────────────────────────┐ ║
245
245
  ║ │ .claude/rules/*.md → memories.push(each, namespace: "claude") │ ║
246
- ║ │ .gencode/rules/*.md → memories.push(each, namespace: "gencode") │ ║
246
+ ║ │ .gen/rules/*.md → memories.push(each, namespace: "gencode") │ ║
247
247
  ║ │ │ ║
248
248
  ║ │ 支持 paths frontmatter 条件加载: │ ║
249
249
  ║ │ --- │ ║
@@ -262,8 +262,8 @@ Priority (High → Low):
262
262
  ║ ┌─────────────────────────────────────────────────────────────────────┐ ║
263
263
  ║ │ if exists: memories.push(load("./CLAUDE.local.md")) │ ║
264
264
  ║ │ if exists: memories.push(load("./.claude/CLAUDE.local.md")) │ ║
265
- ║ │ if exists: memories.push(load("./AGENT.local.md")) │ ║
266
- ║ │ if exists: memories.push(load("./.gencode/AGENT.local.md")) │ ║
265
+ ║ │ if exists: memories.push(load("./GEN.local.md")) │ ║
266
+ ║ │ if exists: memories.push(load("./.gen/GEN.local.md")) │ ║
267
267
  ║ └─────────────────────────────────────────────────────────────────────┘ ║
268
268
  ║ ║
269
269
  ╚══════════════════════════════════╤══════════════════════════════════════════╝
@@ -365,10 +365,10 @@ src/memory/
365
365
 
366
366
  | Aspect | GenCode | OpenCode | Claude Code |
367
367
  |--------|---------|----------|-------------|
368
- | **User Config Dir** | `~/.gencode/` + `~/.claude/` (merge) | `~/.config/opencode/` (XDG) | `~/.claude/` |
369
- | **Project Config Dir** | `.gencode/` + `.claude/` (merge) | `.opencode/` | `.claude/` |
368
+ | **User Config Dir** | `~/.gen/` + `~/.claude/` (merge) | `~/.config/opencode/` (XDG) | `~/.claude/` |
369
+ | **Project Config Dir** | `.gen/` + `.claude/` (merge) | `.opencode/` | `.claude/` |
370
370
  | **Config File Format** | JSON | JSON/JSONC/TOML | JSON |
371
- | **Memory File** | `AGENT.md` / `CLAUDE.md` | N/A (uses instructions) | `CLAUDE.md` |
371
+ | **Memory File** | `GEN.md` / `CLAUDE.md` | N/A (uses instructions) | `CLAUDE.md` |
372
372
  | **Rules Dir** | `rules/*.md` | N/A | `rules/*.md` |
373
373
 
374
374
  ### Loading Semantics
@@ -390,10 +390,10 @@ src/memory/
390
390
  │ GenCode (6 levels): OpenCode (6 levels): Claude Code (5): │
391
391
  │ ───────────────── ──────────────────── ─────────────── │
392
392
  │ 1. User 1. Remote (well-known) 1. User │
393
- │ ~/.claude/ + ~/.gencode/ 2. Global (~/.config/) 2. Project │
394
- │ 2. Extra (GENCODE_CONFIG_DIRS) 3. OPENCODE_CONFIG 3. Local │
393
+ │ ~/.claude/ + ~/.gen/ 2. Global (~/.config/) 2. Project │
394
+ │ 2. Extra (GEN_CONFIG) 3. OPENCODE_CONFIG 3. Local │
395
395
  │ 3. Project 4. Project 4. CLI │
396
- │ .claude/ + .gencode/ 5. .opencode/ 5. Managed │
396
+ │ .claude/ + .gen/ 5. .opencode/ 5. Managed │
397
397
  │ 4. Local 6. OPENCODE_CONFIG_CONTENT │
398
398
  │ *.local.json │
399
399
  │ 5. CLI │
@@ -406,12 +406,12 @@ src/memory/
406
406
 
407
407
  #### 1. Dual Namespace Merge (GenCode Unique)
408
408
 
409
- GenCode loads **both** `.gencode/` and `.claude/` directories at each level and merges them:
409
+ GenCode loads **both** `.gen/` and `.claude/` directories at each level and merges them:
410
410
 
411
411
  ```typescript
412
412
  // At User level:
413
413
  claude = load("~/.claude/settings.json") // lower priority
414
- gencode = load("~/.gencode/settings.json") // higher priority
414
+ gencode = load("~/.gen/settings.json") // higher priority
415
415
  result = deepMerge(claude, gencode) // gencode wins on conflicts
416
416
  ```
417
417
 
@@ -419,10 +419,10 @@ OpenCode and Claude Code only use their own namespace.
419
419
 
420
420
  #### 2. Extra Config Dirs (GenCode Feature)
421
421
 
422
- GenCode supports `GENCODE_CONFIG_DIRS` for team/organization config:
422
+ GenCode supports `GEN_CONFIG` for team/organization config:
423
423
 
424
424
  ```bash
425
- export GENCODE_CONFIG_DIRS="/team/shared-config:~/my-custom-rules"
425
+ export GEN_CONFIG="/team/shared-config:~/my-custom-rules"
426
426
  ```
427
427
 
428
428
  OpenCode has `OPENCODE_CONFIG` for single file and `OPENCODE_CONFIG_CONTENT` for inline JSON.
@@ -430,7 +430,7 @@ OpenCode has `OPENCODE_CONFIG` for single file and `OPENCODE_CONFIG_CONTENT` for
430
430
  #### 3. Memory System (GenCode/Claude Code Feature)
431
431
 
432
432
  GenCode implements a full memory system like Claude Code:
433
- - `AGENT.md` / `CLAUDE.md` files
433
+ - `GEN.md` / `CLAUDE.md` files
434
434
  - `rules/*.md` with path-scoped activation
435
435
  - `@import` syntax for file references
436
436
 
@@ -512,9 +512,9 @@ console.log(config.getDebugSummary());
512
512
  // Output:
513
513
  // Configuration Sources (in priority order):
514
514
  // user:claude - ~/.claude/settings.json
515
- // user:gencode - ~/.gencode/settings.json
515
+ // user:gencode - ~/.gen/settings.json
516
516
  // project:claude - .claude/settings.json
517
- // project:gencode - .gencode/settings.json
517
+ // project:gencode - .gen/settings.json
518
518
  ```
519
519
 
520
520
  ### Loading Memory
@@ -533,20 +533,20 @@ console.log(memory.getDebugSummary());
533
533
  // Output:
534
534
  // Memory Sources (in load order):
535
535
  // user:claude - ~/.claude/CLAUDE.md (1024 bytes)
536
- // user:gencode - ~/.gencode/AGENT.md (512 bytes)
536
+ // user:gencode - ~/.gen/GEN.md (512 bytes)
537
537
  // project:claude - ./CLAUDE.md (2048 bytes)
538
- // project:gencode - ./AGENT.md (1024 bytes)
538
+ // project:gencode - ./GEN.md (1024 bytes)
539
539
  ```
540
540
 
541
541
  ### Using Extra Config Dirs
542
542
 
543
543
  ```bash
544
544
  # Set up team config
545
- export GENCODE_CONFIG_DIRS="/team/shared-config"
545
+ export GEN_CONFIG="/team/shared-config"
546
546
 
547
547
  # Create team settings
548
548
  echo '{"provider": "anthropic"}' > /team/shared-config/settings.json
549
- echo '# Team Guidelines' > /team/shared-config/AGENT.md
549
+ echo '# Team Guidelines' > /team/shared-config/GEN.md
550
550
 
551
551
  # Run GenCode - it will merge team config
552
552
  npx gencode
@@ -557,12 +557,12 @@ npx gencode
557
557
  GenCode is fully backward compatible with Claude Code:
558
558
 
559
559
  1. Existing `.claude/` directories work automatically
560
- 2. `CLAUDE.md` files are loaded alongside `AGENT.md`
560
+ 2. `CLAUDE.md` files are loaded alongside `GEN.md`
561
561
  3. No changes needed for existing Claude Code users
562
562
 
563
563
  To migrate:
564
- 1. Optionally rename `.claude/` to `.gencode/`
565
- 2. Optionally rename `CLAUDE.md` to `AGENT.md`
564
+ 1. Optionally rename `.claude/` to `.gen/`
565
+ 2. Optionally rename `CLAUDE.md` to `GEN.md`
566
566
  3. Or keep both - GenCode will merge them
567
567
 
568
568
  ## API Reference
@@ -626,19 +626,19 @@ class MemoryManager {
626
626
  ║ LEVEL 1: USER Settings ║
627
627
  ╠═════════════════════════════════════════════════════════════════════════════╣
628
628
  ║ claude = load("~/.claude/settings.json") // lower priority ║
629
- ║ gencode = load("~/.gencode/settings.json") // higher priority ║
629
+ ║ gencode = load("~/.gen/settings.json") // higher priority ║
630
630
  ║ user = deepMerge(claude, gencode) ║
631
631
  ╚══════════════════════════════════╤══════════════════════════════════════════╝
632
632
 
633
633
  ╔══════════════════════════════════▼══════════════════════════════════════════╗
634
- ║ LEVEL 2: EXTRA Config Dirs (GENCODE_CONFIG_DIRS) ║
634
+ ║ LEVEL 2: EXTRA Config Dirs (GEN_CONFIG) ║
635
635
  ╚══════════════════════════════════╤══════════════════════════════════════════╝
636
636
 
637
637
  ╔══════════════════════════════════▼══════════════════════════════════════════╗
638
638
  ║ LEVEL 3: PROJECT Settings ║
639
639
  ╠═════════════════════════════════════════════════════════════════════════════╣
640
640
  ║ claude = load(".claude/settings.json") // lower priority ║
641
- ║ gencode = load(".gencode/settings.json") // higher priority ║
641
+ ║ gencode = load(".gen/settings.json") // higher priority ║
642
642
  ║ project = deepMerge(claude, gencode) ║
643
643
  ╚══════════════════════════════════╤══════════════════════════════════════════╝
644
644
 
@@ -671,33 +671,33 @@ class MemoryManager {
671
671
  ╔══════════════════════════════════▼══════════════════════════════════════════╗
672
672
  ║ 1. ENTERPRISE Memory (enforced) ║
673
673
  ║ /Library/.../ClaudeCode/CLAUDE.md → push ║
674
- ║ /Library/.../GenCode/AGENT.md → push ║
674
+ ║ /Library/.../GenCode/GEN.md → push ║
675
675
  ╚══════════════════════════════════╤══════════════════════════════════════════╝
676
676
 
677
677
  ╔══════════════════════════════════▼══════════════════════════════════════════╗
678
678
  ║ 2. USER Memory ║
679
679
  ║ ~/.claude/CLAUDE.md → push ║
680
- ║ ~/.gencode/AGENT.md → push ║
680
+ ║ ~/.gen/GEN.md → push ║
681
681
  ╚══════════════════════════════════╤══════════════════════════════════════════╝
682
682
 
683
683
  ╔══════════════════════════════════▼══════════════════════════════════════════╗
684
- ║ 3. EXTRA Memory (GENCODE_CONFIG_DIRS) ║
684
+ ║ 3. EXTRA Memory (GEN_CONFIG) ║
685
685
  ╚══════════════════════════════════╤══════════════════════════════════════════╝
686
686
 
687
687
  ╔══════════════════════════════════▼══════════════════════════════════════════╗
688
688
  ║ 4. PROJECT Memory ║
689
689
  ║ ./CLAUDE.md or .claude/CLAUDE.md → push ║
690
- ║ ./AGENT.md or .gencode/AGENT.md → push ║
690
+ ║ ./GEN.md or .gen/GEN.md → push ║
691
691
  ╚══════════════════════════════════╤══════════════════════════════════════════╝
692
692
 
693
693
  ╔══════════════════════════════════▼══════════════════════════════════════════╗
694
- ║ 5. RULES (.claude/rules/ + .gencode/rules/) ║
694
+ ║ 5. RULES (.claude/rules/ + .gen/rules/) ║
695
695
  ╚══════════════════════════════════╤══════════════════════════════════════════╝
696
696
 
697
697
  ╔══════════════════════════════════▼══════════════════════════════════════════╗
698
698
  ║ 6. LOCAL Memory (*.local.md) ║
699
699
  ║ ./CLAUDE.local.md → push ║
700
- ║ ./AGENT.local.md → push ║
700
+ ║ ./GEN.local.md → push ║
701
701
  ╚══════════════════════════════════╤══════════════════════════════════════════╝
702
702
 
703
703
  ┌────────▼────────┐
@@ -391,7 +391,7 @@ interface CostConfig {
391
391
  │ │ output: session.tokenUsage.output + 567, │ │
392
392
  │ │ } │ │
393
393
  │ │ │ │
394
- │ │ 存储到: ~/.gencode/sessions/{id}.json │ │
394
+ │ │ 存储到: ~/.gen/sessions/{id}.json │ │
395
395
  │ └─────────────────────────────────────────────────────────────┘ │
396
396
  └─────────────────────────────────────────────────────────────────────┘
397
397
 
@@ -495,7 +495,7 @@ interface CostConfig {
495
495
  │ │ session.totalCost = (session.totalCost || 0) + │ │
496
496
  │ │ response.cost.totalCost; │ │
497
497
  │ │ │ │
498
- │ │ 存储到: ~/.gencode/sessions/{id}.json │ │
498
+ │ │ 存储到: ~/.gen/sessions/{id}.json │ │
499
499
  │ │ { │ │
500
500
  │ │ "id": "...", │ │
501
501
  │ │ "tokenUsage": { "input": 1234, "output": 567 }, │ │
@@ -6,11 +6,11 @@ GenCode implements a hierarchical memory system compatible with Claude Code's CL
6
6
 
7
7
  | Level | Primary (GenCode) | Fallback (Claude Code) |
8
8
  |-------|-------------------|------------------------|
9
- | User | `~/.gencode/AGENT.md` | `~/.claude/CLAUDE.md` |
10
- | User Rules | `~/.gencode/rules/*.md` | `~/.claude/rules/*.md` |
11
- | Project | `./AGENT.md` or `./.gencode/AGENT.md` | `./CLAUDE.md` or `./.claude/CLAUDE.md` |
12
- | Project Rules | `./.gencode/rules/*.md` | `./.claude/rules/*.md` |
13
- | Local | `./.gencode/AGENT.local.md` | `./.claude/CLAUDE.local.md` |
9
+ | User | `~/.gen/GEN.md` | `~/.claude/CLAUDE.md` |
10
+ | User Rules | `~/.gen/rules/*.md` | `~/.claude/rules/*.md` |
11
+ | Project | `./GEN.md` or `./.gen/GEN.md` | `./CLAUDE.md` or `./.claude/CLAUDE.md` |
12
+ | Project Rules | `./.gen/rules/*.md` | `./.claude/rules/*.md` |
13
+ | Local | `./.gen/GEN.local.md` | `./.claude/CLAUDE.local.md` |
14
14
 
15
15
  **Loading Logic**: Primary path is checked first; if not found, fallback path is used.
16
16
 
@@ -61,24 +61,24 @@ GenCode implements a hierarchical memory system compatible with Claude Code's CL
61
61
 
62
62
  ┌─────────────────────────────────────────────────────────────────────┐
63
63
  │ 1. User Level │
64
- │ Primary: ~/.gencode/AGENT.md │
64
+ │ Primary: ~/.gen/GEN.md │
65
65
  │ Fallback: ~/.claude/CLAUDE.md │
66
- │ Rules: ~/.gencode/rules/*.md → ~/.claude/rules/*.md │
66
+ │ Rules: ~/.gen/rules/*.md → ~/.claude/rules/*.md │
67
67
  └─────────────────────────────────────────────────────────────────────┘
68
68
 
69
69
 
70
70
  ┌─────────────────────────────────────────────────────────────────────┐
71
71
  │ 2. Project Level │
72
- │ Primary: ./AGENT.md or ./.gencode/AGENT.md │
72
+ │ Primary: ./GEN.md or ./.gen/GEN.md │
73
73
  │ Fallback: ./CLAUDE.md or ./.claude/CLAUDE.md │
74
- │ Rules: ./.gencode/rules/*.md → ./.claude/rules/*.md │
74
+ │ Rules: ./.gen/rules/*.md → ./.claude/rules/*.md │
75
75
  │ (with paths: frontmatter for scoping) │
76
76
  └─────────────────────────────────────────────────────────────────────┘
77
77
 
78
78
 
79
79
  ┌─────────────────────────────────────────────────────────────────────┐
80
80
  │ 3. Local Level (gitignored) │
81
- │ Primary: ./.gencode/AGENT.local.md │
81
+ │ Primary: ./.gen/GEN.local.md │
82
82
  │ Fallback: ./.claude/CLAUDE.local.md │
83
83
  └─────────────────────────────────────────────────────────────────────┘
84
84
 
@@ -102,34 +102,127 @@ GenCode implements a hierarchical memory system compatible with Claude Code's CL
102
102
 
103
103
  | Feature | Claude Code | GenCode |
104
104
  |---------|-------------|---------|
105
- | Primary filename | CLAUDE.md | AGENT.md |
105
+ | Primary filename | CLAUDE.md | GEN.md |
106
106
  | Fallback support | No | Yes (→ CLAUDE.md) |
107
- | User directory | ~/.claude/ | ~/.gencode/ → ~/.claude/ |
108
- | Project directory | .claude/ | .gencode/ → .claude/ |
109
- | Rules directory | .claude/rules/ | .gencode/rules/ → .claude/rules/ |
107
+ | User directory | ~/.claude/ | ~/.gen/ → ~/.claude/ |
108
+ | Project directory | .claude/ | .gen/ → .claude/ |
109
+ | Rules directory | .claude/rules/ | .gen/rules/ → .claude/rules/ |
110
110
  | Path scoping | Yes (paths: frontmatter) | Yes (paths: frontmatter) |
111
111
  | @import syntax | Yes | Yes (max 5 levels) |
112
- | Local files | CLAUDE.local.md | AGENT.local.md |
112
+ | Local files | CLAUDE.local.md | GEN.local.md |
113
113
  | Directory-specific | Yes (on-demand) | Not in v1 |
114
114
 
115
+ ## Memory Merge Strategies
116
+
117
+ GenCode supports multiple strategies for loading memory files when both CLAUDE.md and GEN.md exist at the same level. This allows you to optimize context size and control which files are loaded.
118
+
119
+ ### Available Strategies
120
+
121
+ | Strategy | Behavior | Use Case |
122
+ |----------|----------|----------|
123
+ | `fallback` (default) | Load GEN.md if exists, else CLAUDE.md | **Recommended**: Reduces context size while maintaining flexibility |
124
+ | `both` | Load both CLAUDE.md and GEN.md | Maximum context, useful when you need both file's content |
125
+ | `gencode-only` | Only load .gen/GEN.md files | Strict GenCode-only mode |
126
+ | `claude-only` | Only load .claude/CLAUDE.md files | Strict Claude Code compatibility mode |
127
+
128
+ ### How Fallback Works
129
+
130
+ At each level (user, project, local), the system:
131
+ 1. Checks for `.gen/GEN.md` (or `./GEN.md` at project root)
132
+ 2. If found: Load GEN.md only, skip CLAUDE.md
133
+ 3. If not found: Load `.claude/CLAUDE.md` (or `./CLAUDE.md`) as fallback
134
+
135
+ **Example:**
136
+ ```
137
+ ~/.claude/CLAUDE.md exists (global instructions)
138
+ ~/.gen/GEN.md does NOT exist
139
+ ./project1/.gen/GEN.md exists (project-specific)
140
+ ./project2/ has no GEN.md
141
+
142
+ Loading for project1 (fallback mode):
143
+ - User level: ~/.claude/CLAUDE.md (no ~/.gen/GEN.md)
144
+ - Project level: ./project1/.gen/GEN.md (skip ./CLAUDE.md)
145
+ = Result: Global + Project configs, ~50% context reduction
146
+
147
+ Loading for project2 (fallback mode):
148
+ - User level: ~/.claude/CLAUDE.md (no ~/.gen/GEN.md)
149
+ - Project level: Nothing found
150
+ = Result: Only global config, maximum context reduction
151
+ ```
152
+
153
+ ### Configuring the Strategy
154
+
155
+ #### 1. Environment Variable (Highest Priority)
156
+
157
+ ```bash
158
+ export GEN_MEMORY_STRATEGY=fallback # or both, gencode-only, claude-only
159
+ gencode "help me with this code"
160
+ ```
161
+
162
+ #### 2. Settings File (User or Project Level)
163
+
164
+ Add to `~/.gen/settings.json` or `./.gen/settings.json`:
165
+
166
+ ```json
167
+ {
168
+ "memoryMergeStrategy": "fallback"
169
+ }
170
+ ```
171
+
172
+ #### 3. Default Behavior
173
+
174
+ If not specified, defaults to `fallback` mode.
175
+
176
+ ### Verbose Mode
177
+
178
+ See which files were loaded and skipped:
179
+
180
+ ```bash
181
+ # Set verbose in config
182
+ {
183
+ "verbose": true,
184
+ "memoryMergeStrategy": "fallback"
185
+ }
186
+
187
+ # Output shows:
188
+ [Memory] Strategy: fallback
189
+ [Memory] user: ~/.gen/GEN.md (0.1 KB)
190
+ [Memory] project: ./GEN.md (3.2 KB)
191
+ [Memory] Skipped: ~/.claude/CLAUDE.md
192
+ [Memory] Total: 3.3 KB (2 files loaded, 1 skipped)
193
+ ```
194
+
195
+ ### Context Size Comparison
196
+
197
+ Real-world example with both user and project memory:
198
+
199
+ | Strategy | Files Loaded | Total Size | Savings |
200
+ |----------|--------------|------------|---------|
201
+ | `both` (old default) | CLAUDE.md + GEN.md (both levels) | 8.9 KB | Baseline |
202
+ | `fallback` (new default) | GEN.md (user) + CLAUDE.md (project) | 3.4 KB | **61% reduction** |
203
+ | `gencode-only` | GEN.md only | 0.1 KB | **99% reduction** |
204
+ | `claude-only` | CLAUDE.md only | 8.7 KB | 2% reduction |
205
+
206
+ **Recommendation**: Use `fallback` mode (default) for best balance between context size and flexibility. Only use `both` if you specifically need content from both files at the same level.
207
+
115
208
  ## Commands
116
209
 
117
210
  ### /init
118
211
 
119
- Analyzes your codebase and generates an AGENT.md file:
212
+ Analyzes your codebase and generates an GEN.md file:
120
213
 
121
214
  ```
122
215
  > /init
123
216
 
124
217
  Analyzing codebase...
125
218
  Found 3 context file(s): package.json, README.md, tsconfig.json
126
- Generating AGENT.md...
219
+ Generating GEN.md...
127
220
  ```
128
221
 
129
222
  The command:
130
223
  1. Scans for package.json, README.md, Makefile, etc.
131
224
  2. Builds a prompt asking the AI to generate project instructions
132
- 3. Creates or updates AGENT.md via the Write tool
225
+ 3. Creates or updates GEN.md via the Write tool
133
226
 
134
227
  ### /memory
135
228
 
@@ -139,11 +232,11 @@ Shows all loaded memory files:
139
232
  > /memory
140
233
 
141
234
  Loaded Memory Files:
142
- [1] ~/.gencode/AGENT.md (user, 1.2KB)
143
- [2] ./AGENT.md (project, 856B)
235
+ [1] ~/.gen/GEN.md (user, 1.2KB)
236
+ [2] ./GEN.md (project, 856B)
144
237
 
145
238
  Loaded Rules:
146
- [1] .gencode/rules/api.md (project-rules, 234B)
239
+ [1] .gen/rules/api.md (project-rules, 234B)
147
240
  ```
148
241
 
149
242
  ### # Quick Add
@@ -152,10 +245,10 @@ Add notes to memory directly:
152
245
 
153
246
  ```
154
247
  # Always use 2-space indentation
155
- Added to project memory: ./AGENT.md
248
+ Added to project memory: ./GEN.md
156
249
 
157
250
  ## Prefer async/await over callbacks
158
- Added to user memory: ~/.gencode/AGENT.md
251
+ Added to user memory: ~/.gen/GEN.md
159
252
  ```
160
253
 
161
254
  - `# note` → adds to project memory
@@ -163,12 +256,12 @@ Added to user memory: ~/.gencode/AGENT.md
163
256
 
164
257
  ## Rules Directory
165
258
 
166
- Create path-scoped rules in `.gencode/rules/`:
259
+ Create path-scoped rules in `.gen/rules/`:
167
260
 
168
261
  ```
169
262
  your-project/
170
- ├── .gencode/
171
- │ ├── AGENT.md # Main project instructions
263
+ ├── .gen/
264
+ │ ├── GEN.md # Main project instructions
172
265
  │ └── rules/
173
266
  │ ├── code-style.md # Always loaded
174
267
  │ ├── testing.md # Always loaded
@@ -197,7 +290,7 @@ Rules with `paths:` frontmatter only load when working with matching files.
197
290
  Include other files in your memory files:
198
291
 
199
292
  ```markdown
200
- # AGENT.md
293
+ # GEN.md
201
294
 
202
295
  @./docs/architecture.md
203
296
  @./docs/conventions.md
@@ -219,13 +312,13 @@ Memory content is injected into the system prompt:
219
312
  <claudeMd>
220
313
  Codebase and user instructions are shown below...
221
314
 
222
- Contents of ~/.gencode/AGENT.md (user's private global instructions):
315
+ Contents of ~/.gen/GEN.md (user's private global instructions):
223
316
  [user memory content]
224
317
 
225
- Contents of ./AGENT.md (project instructions):
318
+ Contents of ./GEN.md (project instructions):
226
319
  [project memory content]
227
320
 
228
- Rule from .gencode/rules/api.md (applies to: src/api/**):
321
+ Rule from .gen/rules/api.md (applies to: src/api/**):
229
322
  [rule content]
230
323
  </claudeMd>
231
324
  ```
@@ -233,6 +326,6 @@ Rule from .gencode/rules/api.md (applies to: src/api/**):
233
326
  ## Best Practices
234
327
 
235
328
  1. **Keep memory concise** - Memory files are loaded every session
236
- 2. **Use rules for path-specific guidance** - Avoid cluttering main AGENT.md
329
+ 2. **Use rules for path-specific guidance** - Avoid cluttering main GEN.md
237
330
  3. **Use local files for personal notes** - .gitignore automatically includes them
238
331
  4. **Leverage fallback for Claude Code users** - Existing CLAUDE.md files work automatically
@@ -165,7 +165,7 @@ GenCode uses a multi-level configuration system (Claude Code compatible):
165
165
  | Project | `.claude/settings.json` | Project settings (tracked in git) |
166
166
  | Project local | `.claude/settings.local.json` | Project settings (gitignored) |
167
167
 
168
- **Fallback**: If `.claude/` doesn't exist, GenCode falls back to `.gencode/` directories.
168
+ **Fallback**: If `.claude/` doesn't exist, GenCode falls back to `.gen/` directories.
169
169
 
170
170
  **Loading order**: User → Project → Project local (later overrides earlier for scalar values, arrays are concatenated)
171
171
 
@@ -231,7 +231,7 @@ When a tool requires confirmation, you can choose:
231
231
  2. **Yes, and don't ask again** - Add a persistent rule to project settings
232
232
  3. **No** - Block this operation
233
233
 
234
- When you select "don't ask again", the rule is saved to `.claude/settings.local.json` (or `.gencode/settings.local.json` if using GenCode directories).
234
+ When you select "don't ask again", the rule is saved to `.claude/settings.local.json` (or `.gen/settings.local.json` if using GenCode directories).
235
235
 
236
236
  ## Prompt-Based Permissions
237
237