@wooojin/forgen 0.1.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 (268) hide show
  1. package/.claude-plugin/plugin.json +20 -0
  2. package/CHANGELOG.md +353 -0
  3. package/CONTRIBUTING.md +98 -0
  4. package/LICENSE +21 -0
  5. package/README.ja.md +469 -0
  6. package/README.ko.md +469 -0
  7. package/README.md +483 -0
  8. package/README.zh.md +469 -0
  9. package/agents/analyst.md +98 -0
  10. package/agents/architect.md +62 -0
  11. package/agents/code-reviewer.md +120 -0
  12. package/agents/code-simplifier.md +197 -0
  13. package/agents/critic.md +70 -0
  14. package/agents/debugger.md +117 -0
  15. package/agents/designer.md +131 -0
  16. package/agents/executor.md +54 -0
  17. package/agents/explore.md +145 -0
  18. package/agents/git-master.md +212 -0
  19. package/agents/performance-reviewer.md +172 -0
  20. package/agents/planner.md +29 -0
  21. package/agents/qa-tester.md +158 -0
  22. package/agents/refactoring-expert.md +168 -0
  23. package/agents/scientist.md +144 -0
  24. package/agents/security-reviewer.md +137 -0
  25. package/agents/test-engineer.md +153 -0
  26. package/agents/verifier.md +133 -0
  27. package/agents/writer.md +184 -0
  28. package/commands/api-design.md +268 -0
  29. package/commands/architecture-decision.md +314 -0
  30. package/commands/ci-cd.md +270 -0
  31. package/commands/code-review.md +233 -0
  32. package/commands/compound.md +117 -0
  33. package/commands/database.md +263 -0
  34. package/commands/debug-detective.md +99 -0
  35. package/commands/docker.md +274 -0
  36. package/commands/documentation.md +276 -0
  37. package/commands/ecomode.md +51 -0
  38. package/commands/frontend.md +271 -0
  39. package/commands/git-master.md +90 -0
  40. package/commands/incident-response.md +292 -0
  41. package/commands/migrate.md +101 -0
  42. package/commands/performance.md +288 -0
  43. package/commands/refactor.md +105 -0
  44. package/commands/security-review.md +288 -0
  45. package/commands/tdd.md +183 -0
  46. package/commands/testing-strategy.md +265 -0
  47. package/dist/cli.d.ts +2 -0
  48. package/dist/cli.js +295 -0
  49. package/dist/core/auto-compound-runner.d.ts +12 -0
  50. package/dist/core/auto-compound-runner.js +460 -0
  51. package/dist/core/config-hooks.d.ts +10 -0
  52. package/dist/core/config-hooks.js +112 -0
  53. package/dist/core/config-injector.d.ts +50 -0
  54. package/dist/core/config-injector.js +455 -0
  55. package/dist/core/doctor.d.ts +1 -0
  56. package/dist/core/doctor.js +163 -0
  57. package/dist/core/errors.d.ts +81 -0
  58. package/dist/core/errors.js +133 -0
  59. package/dist/core/global-config.d.ts +43 -0
  60. package/dist/core/global-config.js +25 -0
  61. package/dist/core/harness.d.ts +24 -0
  62. package/dist/core/harness.js +621 -0
  63. package/dist/core/init.d.ts +7 -0
  64. package/dist/core/init.js +37 -0
  65. package/dist/core/inspect-cli.d.ts +7 -0
  66. package/dist/core/inspect-cli.js +47 -0
  67. package/dist/core/legacy-detector.d.ts +33 -0
  68. package/dist/core/legacy-detector.js +66 -0
  69. package/dist/core/logger.d.ts +34 -0
  70. package/dist/core/logger.js +121 -0
  71. package/dist/core/mcp-config.d.ts +44 -0
  72. package/dist/core/mcp-config.js +177 -0
  73. package/dist/core/notepad.d.ts +31 -0
  74. package/dist/core/notepad.js +88 -0
  75. package/dist/core/paths.d.ts +85 -0
  76. package/dist/core/paths.js +101 -0
  77. package/dist/core/plugin-detector.d.ts +44 -0
  78. package/dist/core/plugin-detector.js +226 -0
  79. package/dist/core/runtime-detector.d.ts +8 -0
  80. package/dist/core/runtime-detector.js +49 -0
  81. package/dist/core/scope-resolver.d.ts +8 -0
  82. package/dist/core/scope-resolver.js +45 -0
  83. package/dist/core/session-logger.d.ts +6 -0
  84. package/dist/core/session-logger.js +111 -0
  85. package/dist/core/session-store.d.ts +28 -0
  86. package/dist/core/session-store.js +218 -0
  87. package/dist/core/settings-lock.d.ts +18 -0
  88. package/dist/core/settings-lock.js +125 -0
  89. package/dist/core/spawn.d.ts +3 -0
  90. package/dist/core/spawn.js +135 -0
  91. package/dist/core/types.d.ts +108 -0
  92. package/dist/core/types.js +1 -0
  93. package/dist/core/uninstall.d.ts +4 -0
  94. package/dist/core/uninstall.js +307 -0
  95. package/dist/core/v1-bootstrap.d.ts +26 -0
  96. package/dist/core/v1-bootstrap.js +155 -0
  97. package/dist/engine/compound-cli.d.ts +24 -0
  98. package/dist/engine/compound-cli.js +250 -0
  99. package/dist/engine/compound-extractor.d.ts +68 -0
  100. package/dist/engine/compound-extractor.js +860 -0
  101. package/dist/engine/compound-lifecycle.d.ts +32 -0
  102. package/dist/engine/compound-lifecycle.js +305 -0
  103. package/dist/engine/compound-loop.d.ts +32 -0
  104. package/dist/engine/compound-loop.js +511 -0
  105. package/dist/engine/match-eval-log.d.ts +139 -0
  106. package/dist/engine/match-eval-log.js +270 -0
  107. package/dist/engine/phrase-blocklist.d.ts +119 -0
  108. package/dist/engine/phrase-blocklist.js +208 -0
  109. package/dist/engine/skill-promoter.d.ts +20 -0
  110. package/dist/engine/skill-promoter.js +115 -0
  111. package/dist/engine/solution-format.d.ts +160 -0
  112. package/dist/engine/solution-format.js +432 -0
  113. package/dist/engine/solution-index.d.ts +13 -0
  114. package/dist/engine/solution-index.js +252 -0
  115. package/dist/engine/solution-matcher.d.ts +364 -0
  116. package/dist/engine/solution-matcher.js +656 -0
  117. package/dist/engine/solution-writer.d.ts +76 -0
  118. package/dist/engine/solution-writer.js +157 -0
  119. package/dist/engine/term-matcher.d.ts +81 -0
  120. package/dist/engine/term-matcher.js +268 -0
  121. package/dist/engine/term-normalizer.d.ts +116 -0
  122. package/dist/engine/term-normalizer.js +171 -0
  123. package/dist/fgx.d.ts +6 -0
  124. package/dist/fgx.js +42 -0
  125. package/dist/forge/cli.d.ts +11 -0
  126. package/dist/forge/cli.js +100 -0
  127. package/dist/forge/evidence-processor.d.ts +21 -0
  128. package/dist/forge/evidence-processor.js +87 -0
  129. package/dist/forge/mismatch-detector.d.ts +44 -0
  130. package/dist/forge/mismatch-detector.js +83 -0
  131. package/dist/forge/onboarding-cli.d.ts +6 -0
  132. package/dist/forge/onboarding-cli.js +89 -0
  133. package/dist/forge/onboarding.d.ts +25 -0
  134. package/dist/forge/onboarding.js +122 -0
  135. package/dist/hooks/compound-reflection.d.ts +45 -0
  136. package/dist/hooks/compound-reflection.js +82 -0
  137. package/dist/hooks/context-guard.d.ts +24 -0
  138. package/dist/hooks/context-guard.js +156 -0
  139. package/dist/hooks/dangerous-patterns.json +18 -0
  140. package/dist/hooks/db-guard.d.ts +17 -0
  141. package/dist/hooks/db-guard.js +105 -0
  142. package/dist/hooks/hook-config.d.ts +29 -0
  143. package/dist/hooks/hook-config.js +92 -0
  144. package/dist/hooks/hook-registry.d.ts +43 -0
  145. package/dist/hooks/hook-registry.js +31 -0
  146. package/dist/hooks/hooks-generator.d.ts +49 -0
  147. package/dist/hooks/hooks-generator.js +99 -0
  148. package/dist/hooks/intent-classifier.d.ts +12 -0
  149. package/dist/hooks/intent-classifier.js +62 -0
  150. package/dist/hooks/keyword-detector.d.ts +25 -0
  151. package/dist/hooks/keyword-detector.js +389 -0
  152. package/dist/hooks/notepad-injector.d.ts +18 -0
  153. package/dist/hooks/notepad-injector.js +51 -0
  154. package/dist/hooks/permission-handler.d.ts +14 -0
  155. package/dist/hooks/permission-handler.js +114 -0
  156. package/dist/hooks/post-tool-failure.d.ts +11 -0
  157. package/dist/hooks/post-tool-failure.js +118 -0
  158. package/dist/hooks/post-tool-handlers.d.ts +17 -0
  159. package/dist/hooks/post-tool-handlers.js +115 -0
  160. package/dist/hooks/post-tool-use.d.ts +29 -0
  161. package/dist/hooks/post-tool-use.js +151 -0
  162. package/dist/hooks/pre-compact.d.ts +10 -0
  163. package/dist/hooks/pre-compact.js +165 -0
  164. package/dist/hooks/pre-tool-use.d.ts +31 -0
  165. package/dist/hooks/pre-tool-use.js +325 -0
  166. package/dist/hooks/prompt-injection-filter.d.ts +56 -0
  167. package/dist/hooks/prompt-injection-filter.js +287 -0
  168. package/dist/hooks/rate-limiter.d.ts +21 -0
  169. package/dist/hooks/rate-limiter.js +86 -0
  170. package/dist/hooks/secret-filter.d.ts +14 -0
  171. package/dist/hooks/secret-filter.js +65 -0
  172. package/dist/hooks/session-recovery.d.ts +27 -0
  173. package/dist/hooks/session-recovery.js +406 -0
  174. package/dist/hooks/shared/atomic-write.d.ts +41 -0
  175. package/dist/hooks/shared/atomic-write.js +148 -0
  176. package/dist/hooks/shared/context-budget.d.ts +37 -0
  177. package/dist/hooks/shared/context-budget.js +45 -0
  178. package/dist/hooks/shared/file-lock.d.ts +56 -0
  179. package/dist/hooks/shared/file-lock.js +253 -0
  180. package/dist/hooks/shared/hook-response.d.ts +33 -0
  181. package/dist/hooks/shared/hook-response.js +62 -0
  182. package/dist/hooks/shared/injection-caps.d.ts +39 -0
  183. package/dist/hooks/shared/injection-caps.js +52 -0
  184. package/dist/hooks/shared/plugin-signal.d.ts +23 -0
  185. package/dist/hooks/shared/plugin-signal.js +104 -0
  186. package/dist/hooks/shared/read-stdin.d.ts +8 -0
  187. package/dist/hooks/shared/read-stdin.js +63 -0
  188. package/dist/hooks/shared/sanitize-id.d.ts +7 -0
  189. package/dist/hooks/shared/sanitize-id.js +9 -0
  190. package/dist/hooks/shared/sanitize.d.ts +7 -0
  191. package/dist/hooks/shared/sanitize.js +22 -0
  192. package/dist/hooks/skill-injector.d.ts +38 -0
  193. package/dist/hooks/skill-injector.js +285 -0
  194. package/dist/hooks/slop-detector.d.ts +18 -0
  195. package/dist/hooks/slop-detector.js +93 -0
  196. package/dist/hooks/solution-injector.d.ts +58 -0
  197. package/dist/hooks/solution-injector.js +436 -0
  198. package/dist/hooks/subagent-tracker.d.ts +10 -0
  199. package/dist/hooks/subagent-tracker.js +90 -0
  200. package/dist/i18n/index.d.ts +43 -0
  201. package/dist/i18n/index.js +224 -0
  202. package/dist/lib.d.ts +14 -0
  203. package/dist/lib.js +14 -0
  204. package/dist/mcp/server.d.ts +8 -0
  205. package/dist/mcp/server.js +40 -0
  206. package/dist/mcp/solution-reader.d.ts +90 -0
  207. package/dist/mcp/solution-reader.js +273 -0
  208. package/dist/mcp/tools.d.ts +16 -0
  209. package/dist/mcp/tools.js +302 -0
  210. package/dist/preset/facet-catalog.d.ts +17 -0
  211. package/dist/preset/facet-catalog.js +46 -0
  212. package/dist/preset/preset-manager.d.ts +31 -0
  213. package/dist/preset/preset-manager.js +111 -0
  214. package/dist/renderer/inspect-renderer.d.ts +11 -0
  215. package/dist/renderer/inspect-renderer.js +123 -0
  216. package/dist/renderer/rule-renderer.d.ts +18 -0
  217. package/dist/renderer/rule-renderer.js +159 -0
  218. package/dist/store/evidence-store.d.ts +23 -0
  219. package/dist/store/evidence-store.js +58 -0
  220. package/dist/store/profile-store.d.ts +12 -0
  221. package/dist/store/profile-store.js +53 -0
  222. package/dist/store/recommendation-store.d.ts +22 -0
  223. package/dist/store/recommendation-store.js +64 -0
  224. package/dist/store/rule-store.d.ts +22 -0
  225. package/dist/store/rule-store.js +62 -0
  226. package/dist/store/session-state-store.d.ts +11 -0
  227. package/dist/store/session-state-store.js +44 -0
  228. package/dist/store/types.d.ts +159 -0
  229. package/dist/store/types.js +7 -0
  230. package/hooks/hook-registry.json +21 -0
  231. package/hooks/hooks.json +185 -0
  232. package/package.json +89 -0
  233. package/plugin.json +20 -0
  234. package/scripts/postinstall.js +826 -0
  235. package/skills/api-design/SKILL.md +262 -0
  236. package/skills/architecture-decision/SKILL.md +309 -0
  237. package/skills/ci-cd/SKILL.md +264 -0
  238. package/skills/code-review/SKILL.md +228 -0
  239. package/skills/compound/SKILL.md +101 -0
  240. package/skills/database/SKILL.md +257 -0
  241. package/skills/debug-detective/SKILL.md +95 -0
  242. package/skills/docker/SKILL.md +268 -0
  243. package/skills/documentation/SKILL.md +270 -0
  244. package/skills/ecomode/SKILL.md +46 -0
  245. package/skills/frontend/SKILL.md +265 -0
  246. package/skills/git-master/SKILL.md +86 -0
  247. package/skills/incident-response/SKILL.md +286 -0
  248. package/skills/migrate/SKILL.md +96 -0
  249. package/skills/performance/SKILL.md +282 -0
  250. package/skills/refactor/SKILL.md +100 -0
  251. package/skills/security-review/SKILL.md +282 -0
  252. package/skills/tdd/SKILL.md +178 -0
  253. package/skills/testing-strategy/SKILL.md +260 -0
  254. package/starter-pack/solutions/starter-api-error-responses.md +37 -0
  255. package/starter-pack/solutions/starter-async-patterns.md +40 -0
  256. package/starter-pack/solutions/starter-caching-strategy.md +40 -0
  257. package/starter-pack/solutions/starter-code-review-checklist.md +39 -0
  258. package/starter-pack/solutions/starter-debugging-systematic.md +40 -0
  259. package/starter-pack/solutions/starter-dependency-injection.md +40 -0
  260. package/starter-pack/solutions/starter-error-handling-patterns.md +38 -0
  261. package/starter-pack/solutions/starter-git-atomic-commits.md +36 -0
  262. package/starter-pack/solutions/starter-input-validation.md +40 -0
  263. package/starter-pack/solutions/starter-n-plus-one-queries.md +37 -0
  264. package/starter-pack/solutions/starter-refactor-safely.md +38 -0
  265. package/starter-pack/solutions/starter-secret-management.md +37 -0
  266. package/starter-pack/solutions/starter-separation-of-concerns.md +36 -0
  267. package/starter-pack/solutions/starter-tdd-red-green-refactor.md +40 -0
  268. package/starter-pack/solutions/starter-typescript-strict-types.md +39 -0
package/README.md ADDED
@@ -0,0 +1,483 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/wooo-jin/forgen/main/assets/banner.png" alt="Forgen" width="100%"/>
3
+ </p>
4
+
5
+ <p align="center">
6
+ <strong>The Claude Code personalization harness.</strong><br/>
7
+ <strong>The more you use Claude, the better it knows you.</strong>
8
+ </p>
9
+
10
+ <p align="center">
11
+ <a href="https://www.npmjs.com/package//forgen"><img src="https://img.shields.io/npm/v//forgen.svg" alt="npm version"/></a>
12
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"/></a>
13
+ <a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg" alt="Node.js >= 20"/></a>
14
+ </p>
15
+
16
+ <p align="center">
17
+ <a href="#what-happens-when-you-use-forgen">What Happens</a> &middot;
18
+ <a href="#quick-start">Quick Start</a> &middot;
19
+ <a href="#how-it-works">How It Works</a> &middot;
20
+ <a href="#4-axis-personalization">4-Axis</a> &middot;
21
+ <a href="#commands">Commands</a> &middot;
22
+ <a href="#architecture">Architecture</a> &middot;
23
+ <a href="#safety">Safety</a>
24
+ </p>
25
+
26
+ <p align="center">
27
+ English &middot;
28
+ <a href="README.ko.md">한국어</a> &middot;
29
+ <a href="README.ja.md">日本語</a> &middot;
30
+ <a href="README.zh.md">简体中文</a>
31
+ </p>
32
+
33
+ ---
34
+
35
+ ## Two developers. Same Claude. Completely different behavior.
36
+
37
+ Developer A is careful. They want Claude to run all tests, explain reasoning, and ask before touching anything outside the current file.
38
+
39
+ Developer B moves fast. They want Claude to make assumptions, fix related files automatically, and report results in two lines.
40
+
41
+ Without forgen, both developers get the same generic Claude. With forgen, each gets a Claude that works the way *they* work.
42
+
43
+ ```
44
+ Developer A's Claude: Developer B's Claude:
45
+ "I found 3 related issues. "Fixed login + 2 related files.
46
+ Before proceeding, should I also Tests pass. One risk: session
47
+ fix the session handler? Here's timeout not covered. Done."
48
+ my analysis of each..."
49
+ ```
50
+
51
+ Forgen makes this happen. It profiles your work style, learns from your corrections, and renders personalized rules that Claude follows every session.
52
+
53
+ ---
54
+
55
+ ## What happens when you use forgen
56
+
57
+ ### First run (one time, ~1 minute)
58
+
59
+ ```bash
60
+ npm install -g /forgen
61
+ forgen
62
+ ```
63
+
64
+ Forgen detects this is your first run and launches a 4-question onboarding. Each question is a concrete scenario:
65
+
66
+ ```
67
+ Q1: Ambiguous implementation request
68
+
69
+ You receive "improve the login feature." Requirements are
70
+ unclear and adjacent modules may be affected.
71
+
72
+ A) Clarify requirements/scope first. Ask if scope expansion is possible.
73
+ B) Proceed if within same flow. Check when major scope expansion appears.
74
+ C) Make reasonable assumptions and fix adjacent files directly.
75
+
76
+ Choice (A/B/C):
77
+ ```
78
+
79
+ Four questions. Four axes measured. Your profile is created with a pack for each axis plus fine-grained facets. A personalized rule file is rendered and placed where Claude reads it.
80
+
81
+ ### Every session (daily use)
82
+
83
+ ```bash
84
+ forgen # Use this instead of `claude`
85
+ ```
86
+
87
+ Behind the scenes:
88
+
89
+ 1. Harness loads your profile from `~/.forgen/me/forge-profile.json`
90
+ 2. Preset manager composes the session: global safety rules + pack base rules + personal overlays + session overlays
91
+ 3. Rule renderer converts everything into natural language and writes `~/.claude/rules/v1-rules.md`
92
+ 4. Claude Code starts and reads those rules as behavioral instructions
93
+ 5. Safety hooks activate: blocking dangerous commands, filtering secrets, detecting prompt injection
94
+
95
+ ### When you correct Claude
96
+
97
+ You say: "Don't refactor files I didn't ask you to touch."
98
+
99
+ Claude calls the `correction-record` MCP tool. The correction is stored as structured evidence with axis classification (`judgment_philosophy`), kind (`avoid-this`), and confidence score. A temporary rule is created for immediate effect in the current session.
100
+
101
+ ### Between sessions (automatic)
102
+
103
+ When a session ends, auto-compound extracts:
104
+ - Solutions (reusable patterns with context)
105
+ - Behavioral observations (how you work)
106
+ - A session learning summary
107
+
108
+ Facets are micro-adjusted based on accumulated evidence. If your corrections consistently point away from your current pack, mismatch detection triggers after 3 sessions and recommends a pack change.
109
+
110
+ ### Next session
111
+
112
+ Updated rules are rendered with your corrections included. Compound knowledge is searchable via MCP. Claude gets better at being *your* Claude.
113
+
114
+ ---
115
+
116
+ ## Quick Start
117
+
118
+ ```bash
119
+ # 1. Install
120
+ npm install -g /forgen
121
+
122
+ # 2. First run — 4-question onboarding (English or Korean)
123
+ forgen
124
+
125
+ # 3. Every day after that
126
+ forgen
127
+ ```
128
+
129
+ ### Prerequisites
130
+
131
+ - **Node.js** >= 20 (>= 22 recommended for SQLite session search)
132
+ - **Claude Code** installed and authenticated (`npm i -g @anthropic-ai/claude-code`)
133
+
134
+ ---
135
+
136
+ ## How It Works
137
+
138
+ ### The learning loop
139
+
140
+ ```
141
+ +-------------------+
142
+ | Onboarding |
143
+ | (4 questions) |
144
+ +--------+----------+
145
+ |
146
+ v
147
+ +-------------------------------+
148
+ | Profile Created |
149
+ | 4 axes x pack + facets + trust |
150
+ +-------------------------------+
151
+ |
152
+ +-----------------------+------------------------+
153
+ | |
154
+ v |
155
+ +------------------+ |
156
+ | Rules Rendered | ~/.claude/rules/v1-rules.md |
157
+ | to Claude format | |
158
+ +--------+---------+ |
159
+ | |
160
+ v |
161
+ +------------------+ |
162
+ | Session Runs | Claude follows your rules |
163
+ | You correct | ---> correction-record MCP |
164
+ | Claude learns | Evidence stored |
165
+ +--------+---------+ Temp rule created |
166
+ | |
167
+ v |
168
+ +------------------+ |
169
+ | Session Ends | auto-compound extracts: |
170
+ | | solutions + observations + summary |
171
+ +--------+---------+ |
172
+ | |
173
+ v |
174
+ +------------------+ |
175
+ | Facets Adjusted | micro-adjustments to profile |
176
+ | Mismatch Check | rolling 3-session analysis |
177
+ +--------+---------+ |
178
+ | |
179
+ +------------------------------------------------+
180
+ (next session: updated rules)
181
+ ```
182
+
183
+ ### Compound knowledge
184
+
185
+ Knowledge accumulates across sessions and becomes searchable:
186
+
187
+ | Type | Source | How Claude uses it |
188
+ |------|--------|--------------------|
189
+ | **Solutions** | Extracted from sessions | `compound-search` via MCP |
190
+ | **Skills** | Promoted from verified solutions | Auto-loaded as slash commands |
191
+ | **Behavioral patterns** | Auto-detected at 3+ observations | Applied to `forge-behavioral.md` |
192
+ | **Evidence** | Corrections + observations | Drives facet adjustments |
193
+
194
+ ---
195
+
196
+ ## 4-Axis Personalization
197
+
198
+ Each axis has 3 packs. Each pack includes fine-grained facets (numerical values from 0-1) that are micro-adjusted over time based on your corrections.
199
+
200
+ ### Quality/Safety
201
+
202
+ | Pack | What Claude does |
203
+ |------|-----------------|
204
+ | **Conservative** | Runs all tests before reporting done. Checks types. Verifies edge cases. Won't say "complete" until everything passes. |
205
+ | **Balanced** | Runs key checks, summarizes remaining risks. Balances thoroughness with speed. |
206
+ | **Speed-first** | Quick smoke test. Reports results and risks immediately. Prioritizes delivery. |
207
+
208
+ ### Autonomy
209
+
210
+ | Pack | What Claude does |
211
+ |------|-----------------|
212
+ | **Confirm-first** | Asks before touching adjacent files. Clarifies ambiguous requirements. Requests approval for scope expansion. |
213
+ | **Balanced** | Proceeds within the same flow. Checks when major scope expansion appears. |
214
+ | **Autonomous** | Makes reasonable assumptions. Fixes related files directly. Reports what was done after. |
215
+
216
+ ### Judgment
217
+
218
+ | Pack | What Claude does |
219
+ |------|-----------------|
220
+ | **Minimal-change** | Preserves existing structure. Does not refactor working code. Keeps modification scope minimal. |
221
+ | **Balanced** | Focuses on current task. Suggests improvements when clearly beneficial. |
222
+ | **Structural** | Proactively suggests structural improvements. Prefers abstraction and reusable design. Maintains architectural consistency. |
223
+
224
+ ### Communication
225
+
226
+ | Pack | What Claude does |
227
+ |------|-----------------|
228
+ | **Concise** | Code and results only. No proactive elaboration. Explains only when asked. |
229
+ | **Balanced** | Summarizes key changes and reasons. Invites follow-up questions. |
230
+ | **Detailed** | Explains what, why, impact, and alternatives. Provides educational context. Structures reports with sections. |
231
+
232
+ ---
233
+
234
+ ## What the rendered rules actually look like
235
+
236
+ When forgen composes your session, it renders a `v1-rules.md` file that Claude reads. Here are two real examples showing how different profiles produce completely different Claude behavior.
237
+
238
+ ### Example 1: Conservative + Confirm-first + Structural + Detailed
239
+
240
+ ```markdown
241
+ [Conservative quality / Confirm-first autonomy / Structural judgment / Detailed communication]
242
+
243
+ ## Must Not
244
+ - Never commit or expose .env, credentials, or API keys.
245
+ - Never execute destructive commands (rm -rf, DROP, force-push) without user confirmation.
246
+
247
+ ## Working Defaults
248
+ - Trust: Dangerous bypass disabled. Always confirm before destructive commands or sensitive path access.
249
+ - Proactively suggest structural improvements when you spot repeated patterns or tech debt.
250
+ - Prefer abstraction and reusable design, but avoid over-abstraction.
251
+ - Maintain architectural consistency across changes.
252
+
253
+ ## When To Ask
254
+ - Clarify requirements before starting ambiguous tasks.
255
+ - Ask before modifying files outside the explicitly requested scope.
256
+
257
+ ## How To Validate
258
+ - Run all related tests, type checks, and key verifications before reporting completion.
259
+ - Do not say "done" until all checks pass.
260
+
261
+ ## How To Report
262
+ - Explain what changed, why, impact scope, and alternatives considered.
263
+ - Provide educational context — why this approach is better, compare with alternatives.
264
+ - Structure reports: changes, reasoning, impact, next steps.
265
+
266
+ ## Evidence Collection
267
+ - When the user corrects your behavior ("don't do that", "always do X", "stop doing Y"), call the correction-record MCP tool to record it as evidence.
268
+ - kind: fix-now (immediate fix), prefer-from-now (going forward), avoid-this (never do this)
269
+ - axis_hint: quality_safety, autonomy, judgment_philosophy, communication_style
270
+ - Do not record general feedback — only explicit behavioral corrections.
271
+ ```
272
+
273
+ ### Example 2: Speed-first + Autonomous + Minimal-change + Concise
274
+
275
+ ```markdown
276
+ [Speed-first quality / Autonomous autonomy / Minimal-change judgment / Concise communication]
277
+
278
+ ## Must Not
279
+ - Never commit or expose .env, credentials, or API keys.
280
+ - Never execute destructive commands (rm -rf, DROP, force-push) without user confirmation.
281
+
282
+ ## Working Defaults
283
+ - Trust: Minimal runtime friction. Free execution except explicit bans and destructive commands.
284
+ - Preserve existing code structure. Do not refactor working code unnecessarily.
285
+ - Keep modification scope minimal. Change adjacent files only when strictly necessary.
286
+ - Secure evidence (tests, error logs) before making changes.
287
+
288
+ ## How To Validate
289
+ - Quick smoke test. Report results and risks immediately.
290
+
291
+ ## How To Report
292
+ - Keep responses short and to the point. Focus on code and results.
293
+ - Only elaborate when asked. Do not proactively write long explanations.
294
+
295
+ ## Evidence Collection
296
+ - When the user corrects your behavior ("don't do that", "always do X", "stop doing Y"), call the correction-record MCP tool to record it as evidence.
297
+ - kind: fix-now (immediate fix), prefer-from-now (going forward), avoid-this (never do this)
298
+ - axis_hint: quality_safety, autonomy, judgment_philosophy, communication_style
299
+ - Do not record general feedback — only explicit behavioral corrections.
300
+ ```
301
+
302
+ Same Claude. Same codebase. Completely different working style, driven by a 1-minute onboarding.
303
+
304
+ ---
305
+
306
+ ## Commands
307
+
308
+ ### Core
309
+
310
+ ```bash
311
+ forgen # Start Claude Code with personalization
312
+ forgen "fix the login bug" # Start with a prompt
313
+ forgen --resume # Resume previous session
314
+ ```
315
+
316
+ ### Personalization
317
+
318
+ ```bash
319
+ forgen onboarding # Run 4-question onboarding
320
+ forgen forge --profile # View current profile
321
+ forgen forge --reset soft # Reset profile (soft / learning / full)
322
+ forgen forge --export # Export profile
323
+ ```
324
+
325
+ ### Inspection
326
+
327
+ ```bash
328
+ forgen inspect profile # 4-axis profile with packs and facets
329
+ forgen inspect rules # Active and suppressed rules
330
+ forgen inspect evidence # Correction history
331
+ forgen inspect session # Current session state
332
+ forgen me # Personal dashboard (shortcut for inspect profile)
333
+ ```
334
+
335
+ ### Knowledge management
336
+
337
+ ```bash
338
+ forgen compound # Preview accumulated knowledge
339
+ forgen compound --save # Save auto-analyzed patterns
340
+ forgen skill promote <name> # Promote a verified solution to a skill
341
+ forgen skill list # List promoted skills
342
+ ```
343
+
344
+ ### System
345
+
346
+ ```bash
347
+ forgen init # Initialize project
348
+ forgen doctor # System diagnostics
349
+ forgen config hooks # View hook status
350
+ forgen config hooks --regenerate # Regenerate hooks
351
+ forgen mcp # MCP server management
352
+ forgen uninstall # Remove forgen cleanly
353
+ ```
354
+
355
+ ### MCP tools (available to Claude during sessions)
356
+
357
+ | Tool | Purpose |
358
+ |------|---------|
359
+ | `compound-search` | Search accumulated knowledge by query |
360
+ | `compound-read` | Read full solution content |
361
+ | `compound-list` | List solutions with filters |
362
+ | `compound-stats` | Overview statistics |
363
+ | `session-search` | Search past session conversations (SQLite FTS5, Node.js 22+) |
364
+ | `correction-record` | Record user corrections as structured evidence |
365
+
366
+ ---
367
+
368
+ ## Architecture
369
+
370
+ ```
371
+ ~/.forgen/ Personalization home
372
+ |-- me/
373
+ | |-- forge-profile.json 4-axis profile (packs + facets + trust)
374
+ | |-- rules/ Rule store (one JSON file per rule)
375
+ | |-- behavior/ Evidence store (corrections + observations)
376
+ | |-- recommendations/ Pack recommendations (onboarding + mismatch)
377
+ | +-- solutions/ Compound knowledge
378
+ |-- state/
379
+ | |-- sessions/ Session effective state snapshots
380
+ | +-- raw-logs/ Raw session logs (7-day TTL auto-cleanup)
381
+ +-- config.json Global config (locale, trust, packs)
382
+
383
+ ~/.claude/
384
+ |-- settings.json Hooks + env vars injected by harness
385
+ |-- rules/
386
+ | |-- forge-behavioral.md Learned behavioral patterns (auto-generated)
387
+ | +-- v1-rules.md Rendered personalization rules (per-session)
388
+ |-- commands/forgen/ Slash commands (promoted skills)
389
+ +-- .claude.json MCP server registration
390
+
391
+ ~/.forgen/ Forgen home (v5.1 unified storage)
392
+ |-- me/
393
+ | |-- solutions/ Accumulated compound knowledge
394
+ | |-- behavior/ Behavioral patterns
395
+ | |-- rules/ Personal correction rules
396
+ | +-- forge-profile.json 4-axis personalization profile
397
+ |-- state/ Session state, checkpoints
398
+ +-- sessions.db SQLite session history (Node.js 22+)
399
+ ```
400
+
401
+ ### Data flow
402
+
403
+ ```
404
+ forge-profile.json Source of truth for personalization
405
+ |
406
+ v
407
+ preset-manager.ts Composes session state:
408
+ global safety rules hard constraints (always active)
409
+ + base pack rules from profile packs
410
+ + personal overlays from correction-generated rules
411
+ + session overlays temporary rules from current session
412
+ + runtime capability detection trust policy adjustment
413
+ |
414
+ v
415
+ rule-renderer.ts Converts Rule[] to natural language:
416
+ filter (active only) pipeline: filter -> dedupe -> group ->
417
+ dedupe (render_key) order -> template -> budget (4000 chars)
418
+ group by section
419
+ order: Must Not -> Working Defaults -> When To Ask -> How To Validate -> How To Report
420
+ |
421
+ v
422
+ ~/.claude/rules/v1-rules.md What Claude actually reads
423
+ ```
424
+
425
+ ---
426
+
427
+ ## Safety
428
+
429
+ Safety hooks are automatically registered in `settings.json` and run on every tool call Claude makes.
430
+
431
+ | Hook | Trigger | What it does |
432
+ |------|---------|-------------|
433
+ | **pre-tool-use** | Before any tool execution | Blocks `rm -rf`, `curl\|sh`, `--force` push, dangerous patterns |
434
+ | **db-guard** | SQL operations | Blocks `DROP TABLE`, `WHERE`-less `DELETE`, `TRUNCATE` |
435
+ | **secret-filter** | File writes and outputs | Warns when API keys, tokens, or credentials are about to be exposed |
436
+ | **slop-detector** | After code generation | Detects TODO remnants, `eslint-disable`, `as any`, `@ts-ignore` |
437
+ | **prompt-injection-filter** | All inputs | Blocks prompt injection attempts with pattern + heuristic detection |
438
+ | **context-guard** | During session | Warns when approaching context window limit |
439
+ | **rate-limiter** | MCP tool calls | Prevents excessive MCP tool invocations |
440
+
441
+ Safety rules are **hard constraints** -- they cannot be overridden by pack selection or corrections. The "Must Not" section in rendered rules is always present regardless of profile.
442
+
443
+ ---
444
+
445
+ ## Key Design Decisions
446
+
447
+ - **4-axis profile, not preference toggles.** Each axis has a pack (coarse) and facets (fine-grained, 0-1 numerical values). Packs give stable behavior; facets allow micro-adjustment without full reclassification.
448
+
449
+ - **Evidence-based learning, not regex matching.** Corrections are structured data (`CorrectionRequest` with kind, axis_hint, message). Claude classifies them; algorithms apply them. No pattern matching on user input.
450
+
451
+ - **Pack + overlay model.** Base packs provide stable defaults. Personal overlays from corrections layer on top. Session overlays for temporary rules. Conflict resolution: session > personal > pack (global safety is always hard constraint).
452
+
453
+ - **Rules rendered as natural language.** The `v1-rules.md` file contains English (or Korean) sentences, not configuration. Claude reads instructions like "Do not refactor working code unnecessarily" -- the same way a human mentor would give guidance.
454
+
455
+ - **Mismatch detection.** Rolling 3-session analysis checks if your corrections consistently diverge from your current pack. When detected, forgen proposes a pack re-recommendation rather than silently drifting.
456
+
457
+ - **Runtime trust computation.** Your desired trust policy is reconciled with Claude Code's actual runtime permission mode. If Claude Code runs with `--dangerously-skip-permissions`, forgen adjusts the effective trust level accordingly.
458
+
459
+ - **Internationalization.** English and Korean fully supported. Language selected at onboarding, applied throughout (onboarding questions, rendered rules, CLI output).
460
+
461
+ ---
462
+
463
+ ## Coexistence
464
+
465
+ Forgen detects other Claude Code plugins (oh-my-claudecode, superpowers, claude-mem) at install time and disables overlapping hooks. Core safety and compound hooks always remain active.
466
+
467
+ See [Coexistence Guide](docs/guides/with-omc.md) for details.
468
+
469
+ ---
470
+
471
+ ## Documentation
472
+
473
+ | Document | Description |
474
+ |----------|-------------|
475
+ | [Hooks Reference](docs/reference/hooks-reference.md) | 19 hooks across 3 tiers — events, timeouts, behavior |
476
+ | [Coexistence Guide](docs/guides/with-omc.md) | Using forgen alongside oh-my-claudecode |
477
+ | [CHANGELOG](CHANGELOG.md) | Version history and release notes |
478
+
479
+ ---
480
+
481
+ ## License
482
+
483
+ MIT