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.
- package/dist/agent/agent.d.ts +9 -2
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/agent.js +37 -8
- package/dist/agent/agent.js.map +1 -1
- package/dist/agent/types.d.ts +5 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/cli/components/App.d.ts.map +1 -1
- package/dist/cli/components/App.js +15 -9
- package/dist/cli/components/App.js.map +1 -1
- package/dist/cli/components/Messages.js +1 -1
- package/dist/cli/components/Messages.js.map +1 -1
- package/dist/cli/components/ModelSelector.d.ts +4 -3
- package/dist/cli/components/ModelSelector.d.ts.map +1 -1
- package/dist/cli/components/ModelSelector.js +54 -37
- package/dist/cli/components/ModelSelector.js.map +1 -1
- package/dist/cli/components/ProviderManager.d.ts +2 -2
- package/dist/cli/components/ProviderManager.d.ts.map +1 -1
- package/dist/cli/components/ProviderManager.js +137 -156
- package/dist/cli/components/ProviderManager.js.map +1 -1
- package/dist/cli/index.js +30 -13
- package/dist/cli/index.js.map +1 -1
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -1
- package/dist/config/index.js.map +1 -1
- package/dist/config/levels.d.ts +5 -5
- package/dist/config/levels.d.ts.map +1 -1
- package/dist/config/levels.js +20 -20
- package/dist/config/levels.js.map +1 -1
- package/dist/config/merger.js +1 -1
- package/dist/config/merger.js.map +1 -1
- package/dist/config/providers-config.d.ts +8 -5
- package/dist/config/providers-config.d.ts.map +1 -1
- package/dist/config/providers-config.js +19 -22
- package/dist/config/providers-config.js.map +1 -1
- package/dist/config/test-utils.d.ts +2 -2
- package/dist/config/test-utils.d.ts.map +1 -1
- package/dist/config/test-utils.js +4 -4
- package/dist/config/test-utils.js.map +1 -1
- package/dist/config/types.d.ts +23 -17
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js +14 -14
- package/dist/config/types.js.map +1 -1
- package/dist/memory/memory-manager.d.ts +25 -12
- package/dist/memory/memory-manager.d.ts.map +1 -1
- package/dist/memory/memory-manager.js +241 -112
- package/dist/memory/memory-manager.js.map +1 -1
- package/dist/memory/test-utils.d.ts +1 -1
- package/dist/memory/test-utils.d.ts.map +1 -1
- package/dist/memory/test-utils.js +3 -3
- package/dist/memory/test-utils.js.map +1 -1
- package/dist/memory/types.d.ts +20 -10
- package/dist/memory/types.d.ts.map +1 -1
- package/dist/memory/types.js +13 -13
- package/dist/memory/types.js.map +1 -1
- package/dist/migration/migrate.d.ts +24 -0
- package/dist/migration/migrate.d.ts.map +1 -0
- package/dist/migration/migrate.js +164 -0
- package/dist/migration/migrate.js.map +1 -0
- package/dist/permissions/persistence.d.ts +2 -2
- package/dist/permissions/persistence.js +4 -4
- package/dist/permissions/persistence.js.map +1 -1
- package/dist/planning/plan-file.d.ts +1 -1
- package/dist/planning/plan-file.js +2 -2
- package/dist/planning/plan-file.js.map +1 -1
- package/dist/prompts/index.d.ts +5 -4
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +11 -8
- package/dist/prompts/index.js.map +1 -1
- package/dist/providers/anthropic.d.ts +2 -1
- package/dist/providers/anthropic.d.ts.map +1 -1
- package/dist/providers/anthropic.js +7 -0
- package/dist/providers/anthropic.js.map +1 -1
- package/dist/providers/gemini.d.ts +2 -1
- package/dist/providers/gemini.d.ts.map +1 -1
- package/dist/providers/gemini.js +7 -0
- package/dist/providers/gemini.js.map +1 -1
- package/dist/providers/index.d.ts +20 -10
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +48 -24
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/openai.d.ts +2 -1
- package/dist/providers/openai.d.ts.map +1 -1
- package/dist/providers/openai.js +7 -0
- package/dist/providers/openai.js.map +1 -1
- package/dist/providers/registry.d.ts +48 -34
- package/dist/providers/registry.d.ts.map +1 -1
- package/dist/providers/registry.js +72 -88
- package/dist/providers/registry.js.map +1 -1
- package/dist/providers/store.d.ts +43 -17
- package/dist/providers/store.d.ts.map +1 -1
- package/dist/providers/store.js +112 -19
- package/dist/providers/store.js.map +1 -1
- package/dist/providers/types.d.ts +23 -0
- package/dist/providers/types.d.ts.map +1 -1
- package/dist/providers/vertex-ai.d.ts +15 -7
- package/dist/providers/vertex-ai.d.ts.map +1 -1
- package/dist/providers/vertex-ai.js +46 -13
- package/dist/providers/vertex-ai.js.map +1 -1
- package/dist/session/types.js +1 -1
- package/dist/session/types.js.map +1 -1
- package/docs/config-system-comparison.md +50 -50
- package/docs/cost-tracking-comparison.md +2 -2
- package/docs/memory-system.md +124 -31
- package/docs/permissions.md +2 -2
- package/docs/proposals/0006-memory-system.md +4 -4
- package/docs/proposals/0008-checkpointing.md +109 -2
- package/docs/proposals/0011-custom-commands.md +2 -1
- package/docs/proposals/0021-skills-system.md +2 -1
- package/docs/proposals/0023-permission-enhancements.md +2 -2
- package/docs/proposals/0033-enterprise-deployment.md +1 -1
- package/docs/proposals/0041-configuration-system.md +17 -19
- package/docs/proposals/0042-prompt-optimization.md +17 -9
- package/docs/proposals/README.md +5 -5
- package/docs/providers.md +94 -9
- package/package.json +3 -2
- package/scripts/migrate.ts +449 -0
- package/src/agent/agent.ts +51 -9
- package/src/agent/types.ts +5 -1
- package/src/cli/components/App.tsx +17 -8
- package/src/cli/components/Messages.tsx +1 -1
- package/src/cli/components/ModelSelector.tsx +62 -43
- package/src/cli/components/ProviderManager.tsx +278 -323
- package/src/cli/index.tsx +36 -17
- package/src/config/index.ts +5 -3
- package/src/config/levels.test.ts +22 -22
- package/src/config/levels.ts +22 -22
- package/src/config/loader.test.ts +14 -14
- package/src/config/manager.test.ts +19 -19
- package/src/config/merger.test.ts +23 -23
- package/src/config/merger.ts +1 -1
- package/src/config/providers-config.ts +23 -21
- package/src/config/test-utils.ts +6 -6
- package/src/config/types.ts +30 -20
- package/src/memory/memory-manager.test.ts +242 -24
- package/src/memory/memory-manager.ts +270 -141
- package/src/memory/test-utils.ts +4 -4
- package/src/memory/types.ts +28 -17
- package/src/permissions/persistence.ts +4 -4
- package/src/planning/plan-file.ts +2 -2
- package/src/prompts/index.ts +13 -9
- package/src/providers/anthropic.ts +9 -0
- package/src/providers/gemini.ts +9 -0
- package/src/providers/index.ts +76 -33
- package/src/providers/openai.ts +9 -0
- package/src/providers/registry.ts +116 -111
- package/src/providers/store.ts +130 -28
- package/src/providers/types.ts +33 -1
- package/src/providers/vertex-ai.ts +49 -13
- 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 `
|
|
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: .
|
|
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: .
|
|
36
|
+
│ Location: .gen/ + .claude/ (MERGED) │
|
|
37
37
|
│ Scope: All collaborators (committed to git) │
|
|
38
38
|
├─────────────────────────────────────────────────────────────────────┤
|
|
39
|
-
│ Level 2: Extra 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: ~/.
|
|
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("~/.
|
|
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 (可选,
|
|
83
|
+
║ STEP 2: Load EXTRA Config Dirs (可选,GEN_CONFIG) ║
|
|
84
84
|
╠═════════════════════════════════════════════════════════════════════════════╣
|
|
85
85
|
║ ║
|
|
86
|
-
║ 环境变量:
|
|
86
|
+
║ 环境变量: GEN_CONFIG="/team/config:~/shared-rules" ║
|
|
87
87
|
║ ║
|
|
88
|
-
║ For each dir in
|
|
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(".
|
|
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(".
|
|
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/
|
|
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("~/.
|
|
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
|
-
║ │ ~/.
|
|
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
|
|
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}/
|
|
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("./
|
|
234
|
-
║ │ else if exists: memories.push(load("./.
|
|
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
|
-
║ │ .
|
|
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("./
|
|
266
|
-
║ │ if exists: memories.push(load("./.
|
|
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** | `~/.
|
|
369
|
-
| **Project Config Dir** | `.
|
|
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** | `
|
|
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/ + ~/.
|
|
394
|
-
│ 2. Extra (
|
|
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/ + .
|
|
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** `.
|
|
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("~/.
|
|
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 `
|
|
422
|
+
GenCode supports `GEN_CONFIG` for team/organization config:
|
|
423
423
|
|
|
424
424
|
```bash
|
|
425
|
-
export
|
|
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
|
-
- `
|
|
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 - ~/.
|
|
515
|
+
// user:gencode - ~/.gen/settings.json
|
|
516
516
|
// project:claude - .claude/settings.json
|
|
517
|
-
// project:gencode - .
|
|
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 - ~/.
|
|
536
|
+
// user:gencode - ~/.gen/GEN.md (512 bytes)
|
|
537
537
|
// project:claude - ./CLAUDE.md (2048 bytes)
|
|
538
|
-
// project:gencode - ./
|
|
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
|
|
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/
|
|
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 `
|
|
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 `.
|
|
565
|
-
2. Optionally rename `CLAUDE.md` to `
|
|
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("~/.
|
|
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 (
|
|
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(".
|
|
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/
|
|
674
|
+
║ /Library/.../GenCode/GEN.md → push ║
|
|
675
675
|
╚══════════════════════════════════╤══════════════════════════════════════════╝
|
|
676
676
|
│
|
|
677
677
|
╔══════════════════════════════════▼══════════════════════════════════════════╗
|
|
678
678
|
║ 2. USER Memory ║
|
|
679
679
|
║ ~/.claude/CLAUDE.md → push ║
|
|
680
|
-
║ ~/.
|
|
680
|
+
║ ~/.gen/GEN.md → push ║
|
|
681
681
|
╚══════════════════════════════════╤══════════════════════════════════════════╝
|
|
682
682
|
│
|
|
683
683
|
╔══════════════════════════════════▼══════════════════════════════════════════╗
|
|
684
|
-
║ 3. EXTRA Memory (
|
|
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
|
-
║ ./
|
|
690
|
+
║ ./GEN.md or .gen/GEN.md → push ║
|
|
691
691
|
╚══════════════════════════════════╤══════════════════════════════════════════╝
|
|
692
692
|
│
|
|
693
693
|
╔══════════════════════════════════▼══════════════════════════════════════════╗
|
|
694
|
-
║ 5. RULES (.claude/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
|
-
║ ./
|
|
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
|
-
│ │ 存储到: ~/.
|
|
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
|
-
│ │ 存储到: ~/.
|
|
498
|
+
│ │ 存储到: ~/.gen/sessions/{id}.json │ │
|
|
499
499
|
│ │ { │ │
|
|
500
500
|
│ │ "id": "...", │ │
|
|
501
501
|
│ │ "tokenUsage": { "input": 1234, "output": 567 }, │ │
|
package/docs/memory-system.md
CHANGED
|
@@ -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 | `~/.
|
|
10
|
-
| User Rules | `~/.
|
|
11
|
-
| Project | `./
|
|
12
|
-
| Project Rules | `./.
|
|
13
|
-
| Local | `./.
|
|
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: ~/.
|
|
64
|
+
│ Primary: ~/.gen/GEN.md │
|
|
65
65
|
│ Fallback: ~/.claude/CLAUDE.md │
|
|
66
|
-
│ Rules: ~/.
|
|
66
|
+
│ Rules: ~/.gen/rules/*.md → ~/.claude/rules/*.md │
|
|
67
67
|
└─────────────────────────────────────────────────────────────────────┘
|
|
68
68
|
│
|
|
69
69
|
▼
|
|
70
70
|
┌─────────────────────────────────────────────────────────────────────┐
|
|
71
71
|
│ 2. Project Level │
|
|
72
|
-
│ Primary: ./
|
|
72
|
+
│ Primary: ./GEN.md or ./.gen/GEN.md │
|
|
73
73
|
│ Fallback: ./CLAUDE.md or ./.claude/CLAUDE.md │
|
|
74
|
-
│ Rules: ./.
|
|
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: ./.
|
|
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 |
|
|
105
|
+
| Primary filename | CLAUDE.md | GEN.md |
|
|
106
106
|
| Fallback support | No | Yes (→ CLAUDE.md) |
|
|
107
|
-
| User directory | ~/.claude/ | ~/.
|
|
108
|
-
| Project directory | .claude/ | .
|
|
109
|
-
| Rules directory | .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 |
|
|
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
|
|
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
|
|
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
|
|
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] ~/.
|
|
143
|
-
[2] ./
|
|
235
|
+
[1] ~/.gen/GEN.md (user, 1.2KB)
|
|
236
|
+
[2] ./GEN.md (project, 856B)
|
|
144
237
|
|
|
145
238
|
Loaded Rules:
|
|
146
|
-
[1] .
|
|
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: ./
|
|
248
|
+
Added to project memory: ./GEN.md
|
|
156
249
|
|
|
157
250
|
## Prefer async/await over callbacks
|
|
158
|
-
Added to user memory: ~/.
|
|
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 `.
|
|
259
|
+
Create path-scoped rules in `.gen/rules/`:
|
|
167
260
|
|
|
168
261
|
```
|
|
169
262
|
your-project/
|
|
170
|
-
├── .
|
|
171
|
-
│ ├──
|
|
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
|
-
#
|
|
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 ~/.
|
|
315
|
+
Contents of ~/.gen/GEN.md (user's private global instructions):
|
|
223
316
|
[user memory content]
|
|
224
317
|
|
|
225
|
-
Contents of ./
|
|
318
|
+
Contents of ./GEN.md (project instructions):
|
|
226
319
|
[project memory content]
|
|
227
320
|
|
|
228
|
-
Rule from .
|
|
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
|
|
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
|
package/docs/permissions.md
CHANGED
|
@@ -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 `.
|
|
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 `.
|
|
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
|
|