gencode-ai 0.1.3 → 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 (260) hide show
  1. package/README.md +2 -1
  2. package/dist/agent/agent.d.ts +44 -2
  3. package/dist/agent/agent.d.ts.map +1 -1
  4. package/dist/agent/agent.js +130 -11
  5. package/dist/agent/agent.js.map +1 -1
  6. package/dist/agent/types.d.ts +11 -1
  7. package/dist/agent/types.d.ts.map +1 -1
  8. package/dist/checkpointing/checkpoint-manager.d.ts +87 -0
  9. package/dist/checkpointing/checkpoint-manager.d.ts.map +1 -0
  10. package/dist/checkpointing/checkpoint-manager.js +281 -0
  11. package/dist/checkpointing/checkpoint-manager.js.map +1 -0
  12. package/dist/checkpointing/index.d.ts +29 -0
  13. package/dist/checkpointing/index.d.ts.map +1 -0
  14. package/dist/checkpointing/index.js +29 -0
  15. package/dist/checkpointing/index.js.map +1 -0
  16. package/dist/checkpointing/types.d.ts +98 -0
  17. package/dist/checkpointing/types.d.ts.map +1 -0
  18. package/dist/checkpointing/types.js +7 -0
  19. package/dist/checkpointing/types.js.map +1 -0
  20. package/dist/cli/components/App.d.ts.map +1 -1
  21. package/dist/cli/components/App.js +171 -14
  22. package/dist/cli/components/App.js.map +1 -1
  23. package/dist/cli/components/CommandSuggestions.d.ts.map +1 -1
  24. package/dist/cli/components/CommandSuggestions.js +5 -0
  25. package/dist/cli/components/CommandSuggestions.js.map +1 -1
  26. package/dist/cli/components/Messages.d.ts +7 -1
  27. package/dist/cli/components/Messages.d.ts.map +1 -1
  28. package/dist/cli/components/Messages.js +12 -3
  29. package/dist/cli/components/Messages.js.map +1 -1
  30. package/dist/cli/components/ModeIndicator.d.ts +42 -0
  31. package/dist/cli/components/ModeIndicator.d.ts.map +1 -0
  32. package/dist/cli/components/ModeIndicator.js +52 -0
  33. package/dist/cli/components/ModeIndicator.js.map +1 -0
  34. package/dist/cli/components/ModelSelector.d.ts +4 -3
  35. package/dist/cli/components/ModelSelector.d.ts.map +1 -1
  36. package/dist/cli/components/ModelSelector.js +54 -37
  37. package/dist/cli/components/ModelSelector.js.map +1 -1
  38. package/dist/cli/components/PlanApproval.d.ts +36 -0
  39. package/dist/cli/components/PlanApproval.d.ts.map +1 -0
  40. package/dist/cli/components/PlanApproval.js +154 -0
  41. package/dist/cli/components/PlanApproval.js.map +1 -0
  42. package/dist/cli/components/ProviderManager.d.ts +2 -2
  43. package/dist/cli/components/ProviderManager.d.ts.map +1 -1
  44. package/dist/cli/components/ProviderManager.js +137 -156
  45. package/dist/cli/components/ProviderManager.js.map +1 -1
  46. package/dist/cli/components/theme.d.ts +2 -0
  47. package/dist/cli/components/theme.d.ts.map +1 -1
  48. package/dist/cli/components/theme.js +3 -0
  49. package/dist/cli/components/theme.js.map +1 -1
  50. package/dist/cli/index.js +30 -13
  51. package/dist/cli/index.js.map +1 -1
  52. package/dist/config/index.d.ts +2 -2
  53. package/dist/config/index.d.ts.map +1 -1
  54. package/dist/config/index.js +1 -1
  55. package/dist/config/index.js.map +1 -1
  56. package/dist/config/levels.d.ts +5 -5
  57. package/dist/config/levels.d.ts.map +1 -1
  58. package/dist/config/levels.js +20 -20
  59. package/dist/config/levels.js.map +1 -1
  60. package/dist/config/merger.js +1 -1
  61. package/dist/config/merger.js.map +1 -1
  62. package/dist/config/providers-config.d.ts +8 -5
  63. package/dist/config/providers-config.d.ts.map +1 -1
  64. package/dist/config/providers-config.js +19 -22
  65. package/dist/config/providers-config.js.map +1 -1
  66. package/dist/config/test-utils.d.ts +2 -2
  67. package/dist/config/test-utils.d.ts.map +1 -1
  68. package/dist/config/test-utils.js +4 -4
  69. package/dist/config/test-utils.js.map +1 -1
  70. package/dist/config/types.d.ts +23 -17
  71. package/dist/config/types.d.ts.map +1 -1
  72. package/dist/config/types.js +14 -14
  73. package/dist/config/types.js.map +1 -1
  74. package/dist/index.d.ts +1 -0
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +2 -0
  77. package/dist/index.js.map +1 -1
  78. package/dist/memory/memory-manager.d.ts +25 -12
  79. package/dist/memory/memory-manager.d.ts.map +1 -1
  80. package/dist/memory/memory-manager.js +241 -112
  81. package/dist/memory/memory-manager.js.map +1 -1
  82. package/dist/memory/test-utils.d.ts +1 -1
  83. package/dist/memory/test-utils.d.ts.map +1 -1
  84. package/dist/memory/test-utils.js +3 -3
  85. package/dist/memory/test-utils.js.map +1 -1
  86. package/dist/memory/types.d.ts +20 -10
  87. package/dist/memory/types.d.ts.map +1 -1
  88. package/dist/memory/types.js +13 -13
  89. package/dist/memory/types.js.map +1 -1
  90. package/dist/migration/migrate.d.ts +24 -0
  91. package/dist/migration/migrate.d.ts.map +1 -0
  92. package/dist/migration/migrate.js +164 -0
  93. package/dist/migration/migrate.js.map +1 -0
  94. package/dist/permissions/persistence.d.ts +2 -2
  95. package/dist/permissions/persistence.js +4 -4
  96. package/dist/permissions/persistence.js.map +1 -1
  97. package/dist/planning/index.d.ts +13 -0
  98. package/dist/planning/index.d.ts.map +1 -0
  99. package/dist/planning/index.js +15 -0
  100. package/dist/planning/index.js.map +1 -0
  101. package/dist/planning/plan-file.d.ts +59 -0
  102. package/dist/planning/plan-file.d.ts.map +1 -0
  103. package/dist/planning/plan-file.js +278 -0
  104. package/dist/planning/plan-file.js.map +1 -0
  105. package/dist/planning/state.d.ts +127 -0
  106. package/dist/planning/state.d.ts.map +1 -0
  107. package/dist/planning/state.js +261 -0
  108. package/dist/planning/state.js.map +1 -0
  109. package/dist/planning/tools/enter-plan-mode.d.ts +25 -0
  110. package/dist/planning/tools/enter-plan-mode.d.ts.map +1 -0
  111. package/dist/planning/tools/enter-plan-mode.js +98 -0
  112. package/dist/planning/tools/enter-plan-mode.js.map +1 -0
  113. package/dist/planning/tools/exit-plan-mode.d.ts +24 -0
  114. package/dist/planning/tools/exit-plan-mode.d.ts.map +1 -0
  115. package/dist/planning/tools/exit-plan-mode.js +149 -0
  116. package/dist/planning/tools/exit-plan-mode.js.map +1 -0
  117. package/dist/planning/types.d.ts +100 -0
  118. package/dist/planning/types.d.ts.map +1 -0
  119. package/dist/planning/types.js +28 -0
  120. package/dist/planning/types.js.map +1 -0
  121. package/dist/pricing/calculator.d.ts +21 -0
  122. package/dist/pricing/calculator.d.ts.map +1 -0
  123. package/dist/pricing/calculator.js +59 -0
  124. package/dist/pricing/calculator.js.map +1 -0
  125. package/dist/pricing/index.d.ts +7 -0
  126. package/dist/pricing/index.d.ts.map +1 -0
  127. package/dist/pricing/index.js +7 -0
  128. package/dist/pricing/index.js.map +1 -0
  129. package/dist/pricing/models.d.ts +20 -0
  130. package/dist/pricing/models.d.ts.map +1 -0
  131. package/dist/pricing/models.js +322 -0
  132. package/dist/pricing/models.js.map +1 -0
  133. package/dist/pricing/types.d.ts +30 -0
  134. package/dist/pricing/types.d.ts.map +1 -0
  135. package/dist/pricing/types.js +5 -0
  136. package/dist/pricing/types.js.map +1 -0
  137. package/dist/prompts/index.d.ts +5 -4
  138. package/dist/prompts/index.d.ts.map +1 -1
  139. package/dist/prompts/index.js +11 -8
  140. package/dist/prompts/index.js.map +1 -1
  141. package/dist/providers/anthropic.d.ts +2 -1
  142. package/dist/providers/anthropic.d.ts.map +1 -1
  143. package/dist/providers/anthropic.js +24 -10
  144. package/dist/providers/anthropic.js.map +1 -1
  145. package/dist/providers/gemini.d.ts +2 -1
  146. package/dist/providers/gemini.d.ts.map +1 -1
  147. package/dist/providers/gemini.js +28 -14
  148. package/dist/providers/gemini.js.map +1 -1
  149. package/dist/providers/index.d.ts +20 -10
  150. package/dist/providers/index.d.ts.map +1 -1
  151. package/dist/providers/index.js +48 -24
  152. package/dist/providers/index.js.map +1 -1
  153. package/dist/providers/openai.d.ts +2 -1
  154. package/dist/providers/openai.d.ts.map +1 -1
  155. package/dist/providers/openai.js +19 -8
  156. package/dist/providers/openai.js.map +1 -1
  157. package/dist/providers/registry.d.ts +48 -34
  158. package/dist/providers/registry.d.ts.map +1 -1
  159. package/dist/providers/registry.js +72 -88
  160. package/dist/providers/registry.js.map +1 -1
  161. package/dist/providers/store.d.ts +43 -17
  162. package/dist/providers/store.d.ts.map +1 -1
  163. package/dist/providers/store.js +112 -19
  164. package/dist/providers/store.js.map +1 -1
  165. package/dist/providers/types.d.ts +25 -0
  166. package/dist/providers/types.d.ts.map +1 -1
  167. package/dist/providers/vertex-ai.d.ts +15 -7
  168. package/dist/providers/vertex-ai.d.ts.map +1 -1
  169. package/dist/providers/vertex-ai.js +63 -23
  170. package/dist/providers/vertex-ai.js.map +1 -1
  171. package/dist/session/manager.d.ts +4 -0
  172. package/dist/session/manager.d.ts.map +1 -1
  173. package/dist/session/manager.js +8 -0
  174. package/dist/session/manager.js.map +1 -1
  175. package/dist/session/types.js +1 -1
  176. package/dist/session/types.js.map +1 -1
  177. package/dist/tools/index.d.ts +7 -1
  178. package/dist/tools/index.d.ts.map +1 -1
  179. package/dist/tools/index.js +7 -0
  180. package/dist/tools/index.js.map +1 -1
  181. package/dist/tools/registry.d.ts +13 -0
  182. package/dist/tools/registry.d.ts.map +1 -1
  183. package/dist/tools/registry.js +79 -2
  184. package/dist/tools/registry.js.map +1 -1
  185. package/docs/config-system-comparison.md +50 -50
  186. package/docs/cost-tracking-comparison.md +904 -0
  187. package/docs/memory-system.md +124 -31
  188. package/docs/operating-modes.md +96 -0
  189. package/docs/permissions.md +2 -2
  190. package/docs/proposals/0006-memory-system.md +4 -4
  191. package/docs/proposals/0008-checkpointing.md +109 -2
  192. package/docs/proposals/0011-custom-commands.md +2 -1
  193. package/docs/proposals/0021-skills-system.md +2 -1
  194. package/docs/proposals/0023-permission-enhancements.md +2 -2
  195. package/docs/proposals/0025-cost-tracking.md +60 -2
  196. package/docs/proposals/0033-enterprise-deployment.md +1 -1
  197. package/docs/proposals/0041-configuration-system.md +17 -19
  198. package/docs/proposals/0042-prompt-optimization.md +17 -9
  199. package/docs/proposals/README.md +6 -6
  200. package/docs/providers.md +94 -9
  201. package/examples/test-checkpointing.ts +121 -0
  202. package/examples/test-cost-tracking.ts +77 -0
  203. package/examples/test-interrupt-cleanup.ts +94 -0
  204. package/package.json +3 -2
  205. package/scripts/migrate.ts +449 -0
  206. package/src/agent/agent.ts +161 -12
  207. package/src/agent/types.ts +11 -1
  208. package/src/checkpointing/checkpoint-manager.ts +327 -0
  209. package/src/checkpointing/index.ts +45 -0
  210. package/src/checkpointing/types.ts +104 -0
  211. package/src/cli/components/App.tsx +221 -13
  212. package/src/cli/components/CommandSuggestions.tsx +5 -0
  213. package/src/cli/components/Messages.tsx +24 -5
  214. package/src/cli/components/ModeIndicator.tsx +174 -0
  215. package/src/cli/components/ModelSelector.tsx +62 -43
  216. package/src/cli/components/PlanApproval.tsx +327 -0
  217. package/src/cli/components/ProviderManager.tsx +278 -323
  218. package/src/cli/components/theme.ts +3 -0
  219. package/src/cli/index.tsx +36 -17
  220. package/src/config/index.ts +5 -3
  221. package/src/config/levels.test.ts +22 -22
  222. package/src/config/levels.ts +22 -22
  223. package/src/config/loader.test.ts +14 -14
  224. package/src/config/manager.test.ts +19 -19
  225. package/src/config/merger.test.ts +23 -23
  226. package/src/config/merger.ts +1 -1
  227. package/src/config/providers-config.ts +23 -21
  228. package/src/config/test-utils.ts +6 -6
  229. package/src/config/types.ts +30 -20
  230. package/src/index.ts +15 -0
  231. package/src/memory/memory-manager.test.ts +242 -24
  232. package/src/memory/memory-manager.ts +270 -141
  233. package/src/memory/test-utils.ts +4 -4
  234. package/src/memory/types.ts +28 -17
  235. package/src/permissions/persistence.ts +4 -4
  236. package/src/planning/index.ts +53 -0
  237. package/src/planning/plan-file.ts +326 -0
  238. package/src/planning/state.ts +305 -0
  239. package/src/planning/tools/enter-plan-mode.ts +111 -0
  240. package/src/planning/tools/exit-plan-mode.ts +170 -0
  241. package/src/planning/types.ts +150 -0
  242. package/src/pricing/calculator.ts +71 -0
  243. package/src/pricing/index.ts +7 -0
  244. package/src/pricing/models.ts +334 -0
  245. package/src/pricing/types.ts +32 -0
  246. package/src/prompts/index.ts +13 -9
  247. package/src/providers/anthropic.ts +30 -10
  248. package/src/providers/gemini.ts +34 -14
  249. package/src/providers/index.ts +76 -33
  250. package/src/providers/openai.ts +26 -8
  251. package/src/providers/registry.ts +116 -111
  252. package/src/providers/store.ts +130 -28
  253. package/src/providers/types.ts +36 -1
  254. package/src/providers/vertex-ai.ts +70 -23
  255. package/src/session/manager.ts +9 -0
  256. package/src/session/types.ts +1 -1
  257. package/src/tools/index.ts +8 -0
  258. package/src/tools/registry.ts +95 -2
  259. package/.gencode/settings.local.json +0 -7
  260. package/CLAUDE.md +0 -86
@@ -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
@@ -0,0 +1,96 @@
1
+ # Operating Modes
2
+
3
+ > Reference: [Claude Code](https://claude.ai/code) operating modes
4
+
5
+ GenCode has **3 operating modes** that can be cycled with `Shift+Tab`:
6
+
7
+ ```
8
+ Normal (default)
9
+ ↓ Shift+Tab
10
+ Plan (⏸ plan mode on)
11
+ ↓ Shift+Tab
12
+ Accept (⏵⏵ accept edits on)
13
+ ↓ Shift+Tab
14
+ Normal
15
+ ...
16
+ ```
17
+
18
+ ## Mode Comparison
19
+
20
+ | Mode | Status Indicator | Edit Confirmation | Available Tools |
21
+ |------|------------------|-------------------|-----------------|
22
+ | **Normal** | _(none)_ | Required | All |
23
+ | **Plan** | `⏸ plan mode on (shift+tab to cycle)` | N/A (edits blocked) | Read-only |
24
+ | **Accept** | `⏵⏵ accept edits on (shift+tab to cycle)` | Auto-approved | All |
25
+
26
+ ## Mode Details
27
+
28
+ ### 1. Normal Mode (Default)
29
+
30
+ - Normal execution mode
31
+ - Every Write/Edit operation requires user confirmation
32
+ - All tools available
33
+ - Default mode when GenCode starts
34
+
35
+ ### 2. Plan Mode
36
+
37
+ - Read-only exploration mode for designing implementation approaches
38
+ - Write, Edit, and Bash tools are blocked
39
+ - Used for understanding codebase and creating implementation plans
40
+
41
+ **Allowed Tools:** Read, Glob, Grep, WebFetch, WebSearch, TodoWrite, AskUserQuestion
42
+
43
+ **Blocked Tools:** Write, Edit, Bash
44
+
45
+ ### 3. Auto-accept Mode
46
+
47
+ - Automatic edit acceptance mode
48
+ - Write/Edit operations are automatically approved without confirmation
49
+ - Useful when trusting the agent or after approving a plan
50
+ - **Caution**: May cause unintended file changes
51
+
52
+ ## Plan Mode Workflow
53
+
54
+ When in Plan mode, the agent goes through 5 phases:
55
+
56
+ ```
57
+ EnterPlanMode
58
+
59
+ ┌─────────────┐
60
+ │Understanding│ ← Explore codebase
61
+ └──────┬──────┘
62
+
63
+ ┌─────────────┐
64
+ │ Design │ ← Design approach
65
+ └──────┬──────┘
66
+
67
+ ┌─────────────┐
68
+ │ Review │ ← (Optional) Clarify requirements
69
+ └──────┬──────┘
70
+
71
+ ┌─────────────┐
72
+ │ Final │ ← Write plan to file
73
+ └──────┬──────┘
74
+
75
+ ExitPlanMode
76
+
77
+ ┌─────────────┐
78
+ │ Approval │ ← User approves/modifies/cancels
79
+ └─────────────┘
80
+ ```
81
+
82
+ ## Plan Approval Options
83
+
84
+ When exiting Plan mode:
85
+
86
+ | Option | Description | Next Mode |
87
+ |--------|-------------|-----------|
88
+ | **approve** | Accept plan, auto-accept edits | Accept |
89
+ | **approve_manual** | Accept plan, manually approve each edit | Normal |
90
+ | **modify** | Return to modify the plan | Plan |
91
+ | **cancel** | Cancel plan entirely | Normal |
92
+
93
+ ## References
94
+
95
+ - [Claude Code Best Practices](https://www.anthropic.com/engineering/claude-code-best-practices)
96
+ - [Plan Mode Proposal](./proposals/0004-plan-mode.md)
@@ -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
 
@@ -1,4 +1,4 @@
1
- # Proposal: Memory System (AGENT.md) with /init Command
1
+ # Proposal: Memory System (GEN.md) with /init Command
2
2
 
3
3
  - **Proposal ID**: 0006
4
4
  - **Author**: mycode team
@@ -10,13 +10,13 @@
10
10
  ## Summary
11
11
 
12
12
  Implement a comprehensive memory system inspired by Claude Code, including:
13
- 1. **AGENT.md files** - Project-specific context that persists across sessions (with CLAUDE.md fallback for compatibility)
13
+ 1. **GEN.md files** - Project-specific context that persists across sessions (with CLAUDE.md fallback for compatibility)
14
14
  2. **Hierarchical memory loading** - User → Project → Local with rules directories
15
- 3. **/init command** - Automatic project analysis and AGENT.md generation
15
+ 3. **/init command** - Automatic project analysis and GEN.md generation
16
16
  4. **# prefix** - Quick memory adds during sessions (`# note` for project, `## note` for user)
17
17
  5. **/memory command** - View loaded memory files
18
18
  6. **@import syntax** - Include other files into memory (max 5 levels)
19
- 7. **.gencode/rules/ directory** - Modular, path-scoped rules with frontmatter
19
+ 7. **.gen/rules/ directory** - Modular, path-scoped rules with frontmatter
20
20
 
21
21
  ## Motivation
22
22
 
@@ -2,9 +2,9 @@
2
2
 
3
3
  - **Proposal ID**: 0008
4
4
  - **Author**: mycode team
5
- - **Status**: Draft
5
+ - **Status**: Partially Implemented
6
6
  - **Created**: 2025-01-15
7
- - **Updated**: 2025-01-15
7
+ - **Updated**: 2025-01-17
8
8
 
9
9
  ## Summary
10
10
 
@@ -325,3 +325,110 @@ No breaking changes to existing functionality.
325
325
 
326
326
  - [Claude Code Checkpointing](https://code.claude.com/docs/en/checkpointing)
327
327
  - [Git Reset and Revert](https://git-scm.com/docs/git-reset)
328
+
329
+ ## Implementation Status
330
+
331
+ ### ✅ Implemented (Phase 1-2)
332
+
333
+ **Core Checkpointing System**:
334
+ - ✅ `CheckpointManager` class with full API
335
+ - `recordChange()` - Record file changes
336
+ - `getCheckpoints()` - Get all checkpoints
337
+ - `getFileHistory()` - Get file-specific history
338
+ - `rewind()` - Rewind with multiple options (checkpointId, path, all, count)
339
+ - `getSummary()` - Get change summary
340
+ - `clearCheckpoints()` - Clear checkpoints
341
+ - `formatCheckpointList()` - Format for display
342
+
343
+ **Tool Integration**:
344
+ - ✅ Automatic tracking in `ToolRegistry`
345
+ - Pre-execution file state capture
346
+ - Post-execution checkpoint recording
347
+ - Support for Write and Edit tools
348
+ - Automatic detection of create/modify/delete operations
349
+
350
+ **CLI Commands**:
351
+ - ✅ `/changes` - List all file changes in session
352
+ - ✅ `/rewind [n]` - Rewind specific checkpoint by index
353
+ - ✅ `/rewind all` - Rewind all changes
354
+ - ✅ `/rewind` - Show changes list with usage info
355
+
356
+ **Type System**:
357
+ - ✅ Complete type definitions (`src/checkpointing/types.ts`)
358
+ - ✅ All interfaces from the proposal
359
+
360
+ **Testing**:
361
+ - ✅ Test example (`examples/test-checkpointing.ts`)
362
+
363
+ ### ❌ Not Implemented (Phase 3-5)
364
+
365
+ **Session Persistence**:
366
+ - ❌ Checkpoints not saved to session files
367
+ - ❌ No checkpoint restoration when resuming sessions
368
+ - ❌ Session type doesn't include checkpoint data
369
+ - **Impact**: Checkpoints are lost when the session ends
370
+
371
+ **User Experience Enhancements**:
372
+ - ❌ Confirmation prompt for `/rewind all`
373
+ - Currently executes immediately without confirmation
374
+ - Proposal shows interactive confirmation UI
375
+ - ❌ Inline change indicators
376
+ - Proposal shows checkpoint saved message after each file modification
377
+ - Currently no visual feedback when checkpoint is created
378
+ - ❌ Formatted change list UI with boxes/borders
379
+ - Current implementation uses simple text list
380
+ - Proposal shows fancy bordered display
381
+
382
+ **Git Integration** (Phase 3):
383
+ - ❌ Optional git-based versioning
384
+ - ❌ Git commits as checkpoints
385
+ - ❌ Integration with git workflow
386
+
387
+ **Advanced Features** (Phase 4-5):
388
+ - ❌ Selective rewind by time range
389
+ - ❌ Checkpoint browsing UI
390
+ - ❌ Diff viewing between checkpoints
391
+ - ❌ Storage limits and cleanup policies
392
+ - ❌ Large file optimization
393
+
394
+ ### 📋 Remaining Work
395
+
396
+ To complete this proposal, the following tasks are needed:
397
+
398
+ 1. **Session Persistence** (High Priority):
399
+ - Add `checkpoints` field to `SessionMetadata` or `Session` type
400
+ - Save/load checkpoints in `SessionManager`
401
+ - Restore checkpoint manager state when resuming sessions
402
+
403
+ 2. **Confirmation UI** (Medium Priority):
404
+ - Add confirmation prompt for `/rewind all` command
405
+ - Show list of files that will be affected
406
+ - Allow user to confirm or cancel
407
+
408
+ 3. **Visual Feedback** (Medium Priority):
409
+ - Show checkpoint saved message after Write/Edit operations
410
+ - Improve `/changes` display with better formatting
411
+ - Add color coding for different change types
412
+
413
+ 4. **Git Integration** (Low Priority):
414
+ - Optional: Use git for checkpoint storage
415
+ - Optional: Create git commits as checkpoints
416
+ - Optional: Integrate with existing git workflow
417
+
418
+ 5. **Advanced Features** (Future):
419
+ - Time-based rewind
420
+ - Diff viewing
421
+ - Storage optimization
422
+
423
+ ### 📁 Implementation Files
424
+
425
+ | File | Status | Notes |
426
+ |------|--------|-------|
427
+ | `src/checkpointing/types.ts` | ✅ Complete | All types defined |
428
+ | `src/checkpointing/checkpoint-manager.ts` | ✅ Complete | Core logic implemented |
429
+ | `src/checkpointing/index.ts` | ✅ Complete | Module exports |
430
+ | `src/tools/registry.ts` | ✅ Modified | Checkpoint tracking added |
431
+ | `src/cli/components/App.tsx` | ✅ Modified | `/changes` and `/rewind` commands |
432
+ | `examples/test-checkpointing.ts` | ✅ Complete | Test coverage |
433
+ | `src/session/types.ts` | ❌ Not Modified | Missing checkpoint fields |
434
+ | `src/session/manager.ts` | ❌ Not Modified | No persistence logic |
@@ -3,8 +3,9 @@
3
3
  - **Proposal ID**: 0011
4
4
  - **Author**: mycode team
5
5
  - **Status**: Draft
6
+ - **Priority**: P2 (Enhanced Feature)
6
7
  - **Created**: 2025-01-15
7
- - **Updated**: 2025-01-15
8
+ - **Updated**: 2025-01-17
8
9
 
9
10
  ## Summary
10
11
 
@@ -3,8 +3,9 @@
3
3
  - **Proposal ID**: 0021
4
4
  - **Author**: mycode team
5
5
  - **Status**: Draft
6
+ - **Priority**: P1 (Core Feature)
6
7
  - **Created**: 2025-01-15
7
- - **Updated**: 2025-01-15
8
+ - **Updated**: 2025-01-17
8
9
 
9
10
  ## Summary
10
11
 
@@ -487,7 +487,7 @@ Backward compatible with existing rules.
487
487
 
488
488
  1. **Pattern-Based Rules**: Supports Claude Code format like `Bash(git add:*)` with glob-style wildcards
489
489
  2. **Prompt-Based Permissions**: ExitPlanMode style with semantic matching for common operations (run tests, install dependencies, etc.)
490
- 3. **Multi-Scope Permissions**: Session (in-memory), Project (.gencode/permissions.json), Global (~/.gencode/permissions.json)
490
+ 3. **Multi-Scope Permissions**: Session (in-memory), Project (.gen/permissions.json), Global (~/.gen/permissions.json)
491
491
  4. **Approval Options**: Allow once, Allow for session, Always allow (persistent), Deny
492
492
  5. **Audit Logging**: In-memory audit trail with optional file persistence
493
493
  6. **CLI Commands**: `/permissions` shows rules, `/permissions audit` shows decision history, `/permissions stats` shows statistics
@@ -507,7 +507,7 @@ Backward compatible with existing rules.
507
507
 
508
508
  ### Settings Configuration
509
509
 
510
- Add to `~/.gencode/settings.json`:
510
+ Add to `~/.gen/settings.json`:
511
511
  ```json
512
512
  {
513
513
  "permissions": {
@@ -2,9 +2,10 @@
2
2
 
3
3
  - **Proposal ID**: 0025
4
4
  - **Author**: mycode team
5
- - **Status**: Draft
5
+ - **Status**: Implemented
6
6
  - **Created**: 2025-01-15
7
- - **Updated**: 2025-01-15
7
+ - **Updated**: 2026-01-16
8
+ - **Implemented**: 2026-01-16
8
9
 
9
10
  ## Summary
10
11
 
@@ -439,6 +440,63 @@ Only show costs after session ends.
439
440
 
440
441
  No breaking changes.
441
442
 
443
+ ## Implementation Notes
444
+
445
+ ### Phase 1 Complete (2026-01-16)
446
+
447
+ Implemented core cost tracking functionality with real-time display in CLI.
448
+
449
+ ### Files Created
450
+
451
+ | File | Description |
452
+ |------|-------------|
453
+ | `src/pricing/types.ts` | Type definitions for pricing and costs |
454
+ | `src/pricing/models.ts` | Model pricing database (updated Jan 2025) |
455
+ | `src/pricing/calculator.ts` | Cost calculation and formatting utilities |
456
+ | `src/pricing/index.ts` | Module exports |
457
+ | `examples/test-cost-tracking.ts` | Test script for cost tracking |
458
+ | `docs/cost-tracking-comparison.md` | Detailed comparison with OpenCode |
459
+
460
+ ### Files Modified
461
+
462
+ | File | Changes |
463
+ |------|---------|
464
+ | `src/providers/types.ts` | Added `cost?: CostEstimate` to `CompletionResponse` |
465
+ | `src/providers/anthropic.ts` | Calculate and return cost in responses |
466
+ | `src/providers/openai.ts` | Calculate and return cost in responses |
467
+ | `src/providers/gemini.ts` | Calculate and return cost in responses |
468
+ | `src/providers/vertex-ai.ts` | Calculate and return cost in responses |
469
+ | `src/agent/types.ts` | Added `usage` and `cost` to `AgentEventDone` |
470
+ | `src/agent/agent.ts` | Pass usage and cost to done event |
471
+ | `src/cli/components/App.tsx` | Pass cost data to CompletionMessage |
472
+ | `src/cli/components/Messages.tsx` | Display cost and token usage |
473
+
474
+ ### Key Implementation Details
475
+
476
+ 1. **Pricing Database**: Comprehensive pricing for all major models (Anthropic, OpenAI, Google Gemini/Vertex AI) as of January 2025
477
+
478
+ 2. **Cost Calculation**: Simple formula `(tokens / 1M) * pricePerMillion` for each token type
479
+
480
+ 3. **CLI Display Format**: `✻ Done for 2.3s • Tokens: 1.2K in / 567 out • (~$0.02)`
481
+
482
+ 4. **Provider Integration**: All 4 providers (Anthropic, OpenAI, Gemini, Vertex AI) calculate cost when usage data is available
483
+
484
+ 5. **Graceful Degradation**: Cost displays only when provider returns usage data (some stream modes may not include it)
485
+
486
+ ### Testing
487
+
488
+ - Tested cost calculation with sample data
489
+ - Verified correct pricing for all providers
490
+ - Confirmed CLI display formatting
491
+
492
+ ### Future Enhancements (Phase 2+)
493
+
494
+ - Session cost aggregation
495
+ - Budget system with alerts
496
+ - Cost reporting (`/costs` command)
497
+ - Multi-provider cost comparison
498
+ - Advanced token types (reasoning, cache)
499
+
442
500
  ## References
443
501
 
444
502
  - [Anthropic Pricing](https://www.anthropic.com/pricing)
@@ -179,7 +179,7 @@ Enterprise Mode: Acme Corp
179
179
  Authenticating via SSO...
180
180
 
181
181
  Opening browser for authentication...
182
- ✓ Authenticated as john.doe@acme.com
182
+ ✓ Authenticated as user@company.com
183
183
 
184
184
  Session policies:
185
185
  - Allowed providers: anthropic, openai