@wooojin/forgen 0.4.3 → 0.4.5

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 (38) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +235 -0
  3. package/README.ko.md +14 -0
  4. package/README.md +32 -0
  5. package/assets/claude/commands/calibrate.md +4 -3
  6. package/assets/claude/commands/forge-loop.md +62 -2
  7. package/assets/claude/commands/retro.md +2 -2
  8. package/dist/checks/_shared/text-sanitizer.d.ts +21 -0
  9. package/dist/checks/_shared/text-sanitizer.js +60 -0
  10. package/dist/checks/dangerous-response-pattern.d.ts +32 -0
  11. package/dist/checks/dangerous-response-pattern.js +65 -0
  12. package/dist/checks/fact-vs-agreement.js +25 -1
  13. package/dist/cli.js +8 -0
  14. package/dist/core/auto-compound-runner.js +31 -4
  15. package/dist/core/settings-injector.js +8 -2
  16. package/dist/core/statusline-cli.d.ts +13 -0
  17. package/dist/core/statusline-cli.js +150 -0
  18. package/dist/hooks/hook-registry.js +9 -4
  19. package/dist/hooks/stop-guard.js +56 -39
  20. package/dist/host/install-claude.js +34 -3
  21. package/dist/mcp/tools.js +4 -0
  22. package/dist/renderer/rule-renderer.d.ts +1 -1
  23. package/dist/renderer/rule-renderer.js +73 -1
  24. package/dist/store/compound-usage-store.d.ts +28 -0
  25. package/dist/store/compound-usage-store.js +59 -0
  26. package/package.json +1 -1
  27. package/plugin.json +1 -1
  28. package/scripts/postinstall.js +61 -6
  29. package/skills/architecture-decision/SKILL.md +21 -0
  30. package/skills/calibrate/SKILL.md +25 -3
  31. package/skills/code-review/SKILL.md +21 -0
  32. package/skills/compound/SKILL.md +21 -0
  33. package/skills/deep-interview/SKILL.md +21 -0
  34. package/skills/docker/SKILL.md +21 -0
  35. package/skills/forge-loop/SKILL.md +76 -1
  36. package/skills/learn/SKILL.md +21 -0
  37. package/skills/retro/SKILL.md +23 -2
  38. package/skills/ship/SKILL.md +21 -0
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Forgen — compound usage signal store (Pathfinder D11 fix, MVP).
3
+ *
4
+ * 배경 (Deep Interview 2026-04-30 Round 5):
5
+ * verified compound 23개, candidate 8개 — 그러나 mature 0. retro 회고에서
6
+ * "활용률 측정 불가 — compound-search 호출 카운터 미수집" 확인. 즉 사용자가
7
+ * compound 를 reuse 했다는 신호 자체가 잡히지 않아서 mature 승격 입력이 없음.
8
+ *
9
+ * 원칙(user-mirror, Round 4 Contrarian): forgen 자기 학습이 아니라 *사용자
10
+ * reuse* 가 mature 의 권위 종착점. 따라서 compound-read 호출이 있을 때마다
11
+ * "이 패턴이 사용됐다" 신호를 한 줄 기록.
12
+ *
13
+ * MVP 스코프: 신호 *수집*만. 승격 정책(예: 5회 reuse → mature) 은 다음 사이클.
14
+ * 기록만 잘 쌓이면 임계 설정·승격 로직은 위에 얹기 쉬움.
15
+ *
16
+ * 데이터: append-only JSONL at ~/.forgen/state/compound-usage.jsonl
17
+ * 각 라인: {"at": ISO, "name": "<solution-slug>", "via": "mcp|cli|hook"}
18
+ * crash-safe: 단순 fs.appendFileSync — 동시 append 는 OS 가 atomic 보장 (POSIX <PIPE_BUF).
19
+ */
20
+ export declare const COMPOUND_USAGE_LOG: string;
21
+ export interface UsageEntry {
22
+ at: string;
23
+ name: string;
24
+ via: 'mcp' | 'cli' | 'hook';
25
+ }
26
+ export declare function recordUsage(name: string, via?: UsageEntry['via']): void;
27
+ /** 단순 카운터 — 승격 정책에서 호출. MVP 에선 미사용. */
28
+ export declare function readUsageCounts(): Map<string, number>;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Forgen — compound usage signal store (Pathfinder D11 fix, MVP).
3
+ *
4
+ * 배경 (Deep Interview 2026-04-30 Round 5):
5
+ * verified compound 23개, candidate 8개 — 그러나 mature 0. retro 회고에서
6
+ * "활용률 측정 불가 — compound-search 호출 카운터 미수집" 확인. 즉 사용자가
7
+ * compound 를 reuse 했다는 신호 자체가 잡히지 않아서 mature 승격 입력이 없음.
8
+ *
9
+ * 원칙(user-mirror, Round 4 Contrarian): forgen 자기 학습이 아니라 *사용자
10
+ * reuse* 가 mature 의 권위 종착점. 따라서 compound-read 호출이 있을 때마다
11
+ * "이 패턴이 사용됐다" 신호를 한 줄 기록.
12
+ *
13
+ * MVP 스코프: 신호 *수집*만. 승격 정책(예: 5회 reuse → mature) 은 다음 사이클.
14
+ * 기록만 잘 쌓이면 임계 설정·승격 로직은 위에 얹기 쉬움.
15
+ *
16
+ * 데이터: append-only JSONL at ~/.forgen/state/compound-usage.jsonl
17
+ * 각 라인: {"at": ISO, "name": "<solution-slug>", "via": "mcp|cli|hook"}
18
+ * crash-safe: 단순 fs.appendFileSync — 동시 append 는 OS 가 atomic 보장 (POSIX <PIPE_BUF).
19
+ */
20
+ import * as fs from 'node:fs';
21
+ import * as path from 'node:path';
22
+ import { STATE_DIR } from '../core/paths.js';
23
+ export const COMPOUND_USAGE_LOG = path.join(STATE_DIR, 'compound-usage.jsonl');
24
+ export function recordUsage(name, via = 'mcp') {
25
+ if (!name)
26
+ return;
27
+ try {
28
+ fs.mkdirSync(STATE_DIR, { recursive: true });
29
+ const entry = { at: new Date().toISOString(), name, via };
30
+ fs.appendFileSync(COMPOUND_USAGE_LOG, JSON.stringify(entry) + '\n');
31
+ }
32
+ catch {
33
+ // fail-open: 신호 수집 실패가 사용자 경험을 방해하면 안 됨
34
+ }
35
+ }
36
+ /** 단순 카운터 — 승격 정책에서 호출. MVP 에선 미사용. */
37
+ export function readUsageCounts() {
38
+ const counts = new Map();
39
+ if (!fs.existsSync(COMPOUND_USAGE_LOG))
40
+ return counts;
41
+ try {
42
+ const lines = fs.readFileSync(COMPOUND_USAGE_LOG, 'utf-8').split('\n').filter(Boolean);
43
+ for (const line of lines) {
44
+ try {
45
+ const entry = JSON.parse(line);
46
+ if (typeof entry.name === 'string') {
47
+ counts.set(entry.name, (counts.get(entry.name) ?? 0) + 1);
48
+ }
49
+ }
50
+ catch {
51
+ // skip malformed
52
+ }
53
+ }
54
+ }
55
+ catch {
56
+ // fail-open
57
+ }
58
+ return counts;
59
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wooojin/forgen",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "preferGlobal": true,
5
5
  "main": "dist/lib.js",
6
6
  "types": "./dist/lib.d.ts",
package/plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://claude.ai/schemas/claude-plugin.json",
3
3
  "name": "forgen",
4
- "version": "0.4.3",
4
+ "version": "0.4.5",
5
5
  "description": "Claude Code harness — the more you use Claude, the better it gets",
6
6
  "author": {
7
7
  "name": "jang-ujin",
@@ -516,10 +516,34 @@ function generateAndWriteHooksJson() {
516
516
  }
517
517
 
518
518
  // ── 4. Install slash commands ──
519
+ /** Build-time injected --with-codex shared snippet. Mirror of scripts/copy-assets.js. */
520
+ const WITH_CODEX_SNIPPET = `
521
+
522
+ ---
523
+
524
+ ## \`--with-codex\` flag (cross-model review)
525
+
526
+ If \`$ARGUMENTS\` contains any of \`--with-codex\`, \`--코덱스\`, \`with codex\`, \`코덱스 검토\`, \`코덱스로 검토\`,
527
+ then after completing the primary skill work, perform a cross-model review pass:
528
+
529
+ 1. Save your primary output text to a temp file (e.g., \`/tmp/forgen-with-codex-$(date +%s).md\`).
530
+ 2. Invoke codex via Bash:
531
+ \`\`\`bash
532
+ codex exec --json --ignore-user-config --ignore-rules --ephemeral \\
533
+ -s read-only -c approval_policy="never" --skip-git-repo-check \\
534
+ "$(printf 'You are a second-opinion reviewer for another AI assistant\\\\u0027s output. Read the work product below and report ONLY:\\n1. Defects, gaps, or risks the original work missed\\n2. Specific disagreements with the original\\n3. Topics that should have been covered but were not\\n\\nOutput format: prioritized bullet list (max 15 items, severity-sorted, no prose intro). If you find nothing material, say "No critical issues found."\\n\\n<work>\\n%s\\n</work>' "$(cat /tmp/forgen-with-codex-*.md)")"
535
+ \`\`\`
536
+ 3. Append the codex output under heading \`## Codex Cross-Review (--with-codex)\` in your final response.
537
+ 4. If codex flags critical issues, briefly acknowledge + suggest follow-up.
538
+ 5. If \`codex: command not found\`, note in response and skip the review pass (do not fail).
539
+
540
+ OPT-IN per invocation. Without the flag, skip this entire section.
541
+ `;
542
+
519
543
  function buildCommandContent(skillContent, skillName) {
520
544
  const descMatch = skillContent.match(/description:\s*(.+)/);
521
545
  const desc = descMatch?.[1]?.trim() ?? skillName;
522
- return `# ${desc}\n\n<!-- forgen-managed -->\n\nActivate Forgen "${skillName}" mode for the task: $ARGUMENTS\n\n${skillContent}`;
546
+ return `# ${desc}\n\n<!-- forgen-managed -->\n\nActivate Forgen "${skillName}" mode for the task: $ARGUMENTS\n\n${skillContent}${WITH_CODEX_SNIPPET}`;
523
547
  }
524
548
 
525
549
  function safeWriteCommand(cmdPath, content) {
@@ -729,7 +753,7 @@ function cleanLegacyMcpFromSettings(settings) {
729
753
  * 이전 방식(3곳에서 각각 read-modify-write)은 중간에 다른 프로세스가
730
754
  * settings.json을 수정하면 데이터 유실 가능성이 있었습니다.
731
755
  */
732
- function main() {
756
+ async function main() {
733
757
  // W-V2: 로컬 설치 시 전역 설정 수정 방지
734
758
  if (!process.env.npm_config_global && process.env.INIT_CWD && process.env.INIT_CWD !== PKG_ROOT) {
735
759
  // npm install (로컬) — postinstall 스킵
@@ -906,6 +930,39 @@ function main() {
906
930
  // sudo 실행 시 파일 소유권을 실제 유저로 변경
907
931
  fixOwnership(join(HOME, '.claude'), join(HOME, '.forgen'));
908
932
 
933
+ // ── 9. Self-check: 설치 산출물이 현재 Node 에서 실제로 로드되는지 확인 ──
934
+ //
935
+ // Why: 0.4.4 이전 빌드는 `import ... with { type: 'json' }` 를 사용해 Node
936
+ // 20.0-20.9 에서 모든 훅이 SyntaxError 로 깨졌다. 사용자는 npm i -g 가 정상
937
+ // 종료된 직후에야 "각종 훅들이 에러난다"는 증상을 보았다. self-check 가 있었
938
+ // 다면 install 시점에 즉시 실패를 노출했을 것.
939
+ //
940
+ // 동작: dist/hooks/hook-registry.js 를 dynamic import 로 로드 → HOOK_REGISTRY
941
+ // 배열에 entry 가 있는지 확인. 실패 시 stderr 로 구체적 원인 + Node 버전을
942
+ // 알리고 npm install 자체는 깨뜨리지 않음 (postinstall 정책 유지).
943
+ let selfCheckOk = false;
944
+ let selfCheckErr = '';
945
+ try {
946
+ const registryUrl = new URL('../dist/hooks/hook-registry.js', import.meta.url);
947
+ const mod = await import(registryUrl.href);
948
+ if (Array.isArray(mod?.HOOK_REGISTRY) && mod.HOOK_REGISTRY.length > 0) {
949
+ selfCheckOk = true;
950
+ } else {
951
+ selfCheckErr = 'HOOK_REGISTRY is empty or not an array';
952
+ }
953
+ } catch (err) {
954
+ selfCheckErr = err?.message ?? String(err);
955
+ }
956
+ if (!selfCheckOk) {
957
+ console.error('');
958
+ console.error(`[forgen] WARNING: hook self-check FAILED on Node ${process.version}.`);
959
+ console.error(`[forgen] reason: ${selfCheckErr}`);
960
+ console.error('[forgen] 훅이 Claude Code 실행 시 로드 실패할 수 있습니다.');
961
+ console.error('[forgen] Node 20.10+ 또는 22.x 사용을 권장합니다.');
962
+ console.error('[forgen] 문제 지속 시: https://github.com/forgen-team/forgen/issues');
963
+ console.error('');
964
+ }
965
+
909
966
  const parts = [];
910
967
  if (plugin) parts.push('plugin');
911
968
  if (hooksJsonResult) parts.push(`hooks.json (${hooksJsonResult.active}/${hooksJsonResult.total} active)`);
@@ -940,9 +997,7 @@ function main() {
940
997
  }
941
998
  }
942
999
 
943
- try {
944
- main();
945
- } catch (err) {
1000
+ main().catch((err) => {
946
1001
  // postinstall 실패가 npm install을 깨뜨리지 않되, 원인은 표시
947
1002
  console.error(`[forgen] postinstall warning: ${err?.message ?? err}`);
948
- }
1003
+ });
@@ -163,3 +163,24 @@ Positive / Negative / Risks / Follow-up
163
163
  </Arguments>
164
164
 
165
165
  $ARGUMENTS
166
+
167
+ ---
168
+
169
+ ## `--with-codex` flag (cross-model review)
170
+
171
+ If `$ARGUMENTS` contains any of `--with-codex`, `--코덱스`, `with codex`, `코덱스 검토`, `코덱스로 검토`,
172
+ then after completing the primary skill work, perform a cross-model review pass:
173
+
174
+ 1. Save your primary output text to a temp file (e.g., `/tmp/forgen-with-codex-$(date +%s).md`).
175
+ 2. Invoke codex via Bash:
176
+ ```bash
177
+ codex exec --json --ignore-user-config --ignore-rules --ephemeral \
178
+ -s read-only -c approval_policy="never" --skip-git-repo-check \
179
+ "$(printf 'You are a second-opinion reviewer for another AI assistant\\u0027s output. Read the work product below and report ONLY:\n1. Defects, gaps, or risks the original work missed\n2. Specific disagreements with the original\n3. Topics that should have been covered but were not\n\nOutput format: prioritized bullet list (max 15 items, severity-sorted, no prose intro). If you find nothing material, say "No critical issues found."\n\n<work>\n%s\n</work>' "$(cat /tmp/forgen-with-codex-*.md)")"
180
+ ```
181
+ 3. Append the codex output under heading `## Codex Cross-Review (--with-codex)` in your final response.
182
+ 4. If codex flags critical issues, briefly acknowledge + suggest follow-up.
183
+ 5. If `codex: command not found`, note in response and skip the review pass (do not fail).
184
+
185
+ OPT-IN per invocation. Without the flag, skip this entire section.
186
+
@@ -21,7 +21,8 @@ description: This skill should be used when the user asks to "calibrate, 캘리
21
21
  calibrate는 두 가지 데이터 소스를 사용합니다:
22
22
 
23
23
  ### 1차 소스: Evidence 파일
24
- `~/.forgen/me/evidence/` 디렉토리의 JSON 파일을 읽습니다.
24
+ `~/.forgen/me/behavior/` 디렉토리의 JSON 파일을 읽습니다.
25
+ (파일명: UUID.json — correction-record MCP 도구가 작성. 같은 디렉토리의 auto-*.md 는 auto-compound 산출이므로 calibrate 분석 대상 아님.)
25
26
  각 파일의 구조:
26
27
  ```json
27
28
  {
@@ -52,8 +53,8 @@ evidence 0건 + compound 교정 패턴 0건이면:
52
53
  ## Phase 1: Evidence 로드 및 검증
53
54
 
54
55
  ```bash
55
- ls ~/.forgen/me/evidence/ 2>/dev/null || echo "EMPTY"
56
- cat ~/.forgen/me/evidence/*.json 2>/dev/null || echo "NO_FILES"
56
+ ls ~/.forgen/me/behavior/*.json 2>/dev/null || echo "EMPTY"
57
+ cat ~/.forgen/me/behavior/*.json 2>/dev/null || echo "NO_FILES"
57
58
  ```
58
59
 
59
60
  로드한 JSON 파일마다 다음을 검증합니다:
@@ -205,3 +206,24 @@ Compound 교차 검증:
205
206
  </Arguments>
206
207
 
207
208
  $ARGUMENTS
209
+
210
+ ---
211
+
212
+ ## `--with-codex` flag (cross-model review)
213
+
214
+ If `$ARGUMENTS` contains any of `--with-codex`, `--코덱스`, `with codex`, `코덱스 검토`, `코덱스로 검토`,
215
+ then after completing the primary skill work, perform a cross-model review pass:
216
+
217
+ 1. Save your primary output text to a temp file (e.g., `/tmp/forgen-with-codex-$(date +%s).md`).
218
+ 2. Invoke codex via Bash:
219
+ ```bash
220
+ codex exec --json --ignore-user-config --ignore-rules --ephemeral \
221
+ -s read-only -c approval_policy="never" --skip-git-repo-check \
222
+ "$(printf 'You are a second-opinion reviewer for another AI assistant\\u0027s output. Read the work product below and report ONLY:\n1. Defects, gaps, or risks the original work missed\n2. Specific disagreements with the original\n3. Topics that should have been covered but were not\n\nOutput format: prioritized bullet list (max 15 items, severity-sorted, no prose intro). If you find nothing material, say "No critical issues found."\n\n<work>\n%s\n</work>' "$(cat /tmp/forgen-with-codex-*.md)")"
223
+ ```
224
+ 3. Append the codex output under heading `## Codex Cross-Review (--with-codex)` in your final response.
225
+ 4. If codex flags critical issues, briefly acknowledge + suggest follow-up.
226
+ 5. If `codex: command not found`, note in response and skip the review pass (do not fail).
227
+
228
+ OPT-IN per invocation. Without the flag, skip this entire section.
229
+
@@ -199,3 +199,24 @@ VERDICT: {APPROVE / REQUEST CHANGES / COMMENT}
199
199
  </Arguments>
200
200
 
201
201
  $ARGUMENTS
202
+
203
+ ---
204
+
205
+ ## `--with-codex` flag (cross-model review)
206
+
207
+ If `$ARGUMENTS` contains any of `--with-codex`, `--코덱스`, `with codex`, `코덱스 검토`, `코덱스로 검토`,
208
+ then after completing the primary skill work, perform a cross-model review pass:
209
+
210
+ 1. Save your primary output text to a temp file (e.g., `/tmp/forgen-with-codex-$(date +%s).md`).
211
+ 2. Invoke codex via Bash:
212
+ ```bash
213
+ codex exec --json --ignore-user-config --ignore-rules --ephemeral \
214
+ -s read-only -c approval_policy="never" --skip-git-repo-check \
215
+ "$(printf 'You are a second-opinion reviewer for another AI assistant\\u0027s output. Read the work product below and report ONLY:\n1. Defects, gaps, or risks the original work missed\n2. Specific disagreements with the original\n3. Topics that should have been covered but were not\n\nOutput format: prioritized bullet list (max 15 items, severity-sorted, no prose intro). If you find nothing material, say "No critical issues found."\n\n<work>\n%s\n</work>' "$(cat /tmp/forgen-with-codex-*.md)")"
216
+ ```
217
+ 3. Append the codex output under heading `## Codex Cross-Review (--with-codex)` in your final response.
218
+ 4. If codex flags critical issues, briefly acknowledge + suggest follow-up.
219
+ 5. If `codex: command not found`, note in response and skip the review pass (do not fail).
220
+
221
+ OPT-IN per invocation. Without the flag, skip this entire section.
222
+
@@ -157,3 +157,24 @@ NEVER: **Health Dashboard 건너뛰기**: 추출 후 반드시 Phase 5 실행.
157
157
  </Arguments>
158
158
 
159
159
  $ARGUMENTS
160
+
161
+ ---
162
+
163
+ ## `--with-codex` flag (cross-model review)
164
+
165
+ If `$ARGUMENTS` contains any of `--with-codex`, `--코덱스`, `with codex`, `코덱스 검토`, `코덱스로 검토`,
166
+ then after completing the primary skill work, perform a cross-model review pass:
167
+
168
+ 1. Save your primary output text to a temp file (e.g., `/tmp/forgen-with-codex-$(date +%s).md`).
169
+ 2. Invoke codex via Bash:
170
+ ```bash
171
+ codex exec --json --ignore-user-config --ignore-rules --ephemeral \
172
+ -s read-only -c approval_policy="never" --skip-git-repo-check \
173
+ "$(printf 'You are a second-opinion reviewer for another AI assistant\\u0027s output. Read the work product below and report ONLY:\n1. Defects, gaps, or risks the original work missed\n2. Specific disagreements with the original\n3. Topics that should have been covered but were not\n\nOutput format: prioritized bullet list (max 15 items, severity-sorted, no prose intro). If you find nothing material, say "No critical issues found."\n\n<work>\n%s\n</work>' "$(cat /tmp/forgen-with-codex-*.md)")"
174
+ ```
175
+ 3. Append the codex output under heading `## Codex Cross-Review (--with-codex)` in your final response.
176
+ 4. If codex flags critical issues, briefly acknowledge + suggest follow-up.
177
+ 5. If `codex: command not found`, note in response and skip the review pass (do not fail).
178
+
179
+ OPT-IN per invocation. Without the flag, skip this entire section.
180
+
@@ -264,3 +264,24 @@ NEVER: **챌린지 모드 건너뛰기**: Round 4+ 이후 반드시 적용.
264
264
  </Arguments>
265
265
 
266
266
  $ARGUMENTS
267
+
268
+ ---
269
+
270
+ ## `--with-codex` flag (cross-model review)
271
+
272
+ If `$ARGUMENTS` contains any of `--with-codex`, `--코덱스`, `with codex`, `코덱스 검토`, `코덱스로 검토`,
273
+ then after completing the primary skill work, perform a cross-model review pass:
274
+
275
+ 1. Save your primary output text to a temp file (e.g., `/tmp/forgen-with-codex-$(date +%s).md`).
276
+ 2. Invoke codex via Bash:
277
+ ```bash
278
+ codex exec --json --ignore-user-config --ignore-rules --ephemeral \
279
+ -s read-only -c approval_policy="never" --skip-git-repo-check \
280
+ "$(printf 'You are a second-opinion reviewer for another AI assistant\\u0027s output. Read the work product below and report ONLY:\n1. Defects, gaps, or risks the original work missed\n2. Specific disagreements with the original\n3. Topics that should have been covered but were not\n\nOutput format: prioritized bullet list (max 15 items, severity-sorted, no prose intro). If you find nothing material, say "No critical issues found."\n\n<work>\n%s\n</work>' "$(cat /tmp/forgen-with-codex-*.md)")"
281
+ ```
282
+ 3. Append the codex output under heading `## Codex Cross-Review (--with-codex)` in your final response.
283
+ 4. If codex flags critical issues, briefly acknowledge + suggest follow-up.
284
+ 5. If `codex: command not found`, note in response and skip the review pass (do not fail).
285
+
286
+ OPT-IN per invocation. Without the flag, skip this entire section.
287
+
@@ -144,3 +144,24 @@ SECURITY SCAN / 보안 스캔
144
144
  </Arguments>
145
145
 
146
146
  $ARGUMENTS
147
+
148
+ ---
149
+
150
+ ## `--with-codex` flag (cross-model review)
151
+
152
+ If `$ARGUMENTS` contains any of `--with-codex`, `--코덱스`, `with codex`, `코덱스 검토`, `코덱스로 검토`,
153
+ then after completing the primary skill work, perform a cross-model review pass:
154
+
155
+ 1. Save your primary output text to a temp file (e.g., `/tmp/forgen-with-codex-$(date +%s).md`).
156
+ 2. Invoke codex via Bash:
157
+ ```bash
158
+ codex exec --json --ignore-user-config --ignore-rules --ephemeral \
159
+ -s read-only -c approval_policy="never" --skip-git-repo-check \
160
+ "$(printf 'You are a second-opinion reviewer for another AI assistant\\u0027s output. Read the work product below and report ONLY:\n1. Defects, gaps, or risks the original work missed\n2. Specific disagreements with the original\n3. Topics that should have been covered but were not\n\nOutput format: prioritized bullet list (max 15 items, severity-sorted, no prose intro). If you find nothing material, say "No critical issues found."\n\n<work>\n%s\n</work>' "$(cat /tmp/forgen-with-codex-*.md)")"
161
+ ```
162
+ 3. Append the codex output under heading `## Codex Cross-Review (--with-codex)` in your final response.
163
+ 4. If codex flags critical issues, briefly acknowledge + suggest follow-up.
164
+ 5. If `codex: command not found`, note in response and skip the review pass (do not fail).
165
+
166
+ OPT-IN per invocation. Without the flag, skip this entire section.
167
+
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: forge-loop
3
- description: This skill should be used when the user asks to "forge-loop, 포지루프, 끝까지, don't stop". 주어진 작업을 PRD(User Story)로 분해하고, 모든 수용 기준이 충족될 때까지 반복 실행합니다.
3
+ description: This skill should be used when the user asks to "forge-loop, 포지루프, 끝까지, don't stop, goal, 목표, goal lock, scope lock". 작업을 PRD(User Story)로 분해 + 모든 수용 기준 충족까지 반복 실행. `--goal-only` 플래그로 PRD/수용기준 박제만 (실행 사이클 없이) 가능 — goal-locking pattern lightweight 진입점.
4
4
  ---
5
5
 
6
6
  <Purpose>
@@ -73,6 +73,35 @@ EOF
73
73
  이 파일이 있어야 Claude가 중간에 멈추지 않도록 Stop 훅이 차단합니다.
74
74
  스토리 완료 시 `passes: true`로 업데이트. 전체 완료는 Stop 훅이 자동 처리.
75
75
 
76
+ ### goal-only 모드 — Phase 1 종료 분기
77
+
78
+ `$ARGUMENTS` 에 `--goal-only` / `--goal` / `--lock-only` 중 하나가 포함된 경우,
79
+ Phase 1 종료 직후 다음을 산출하고 종료 (Phase 2/3 건너뜀):
80
+
81
+ 1. 위 PRD JSON 의 stories 배열을 markdown Goal 박스로 변환:
82
+ ```
83
+ GOAL: <stories[0].title — 단일 story 면 한 문장 요약>
84
+ 완료 기준 (Acceptance Criteria):
85
+ - [ ] <story[i].acceptanceCriteria[j] 각각 — 구체적 증거 타입 포함>
86
+ 제약 (Out-of-Scope):
87
+ - <"수용 기준 품질 규칙" 표의 금지 패턴들>
88
+ - <사용자가 명시한 dry-run / touch 안 할 경로 등>
89
+ 검증 방법:
90
+ - <각 AC 의 verification command (bash / curl / file check)>
91
+ 컴파운드 패턴 (참고):
92
+ - <compound-search top 1-2 결과 — 본 작업 키워드로 검색>
93
+ ```
94
+
95
+ 2. 사용자에게 박스를 보여주고 안내:
96
+ ```
97
+ GOAL 박제 완료. 다음 옵션:
98
+ - 이 박스를 다른 컨텍스트/에이전트에 위임 → 복사 사용
99
+ - 본 세션에서 자동 실행 → `forge-loop resume` 로 Phase 2 이어 실행
100
+ 상태 파일: ~/.forgen/state/forge-loop.json (resume 시 재활용)
101
+ ```
102
+
103
+ 3. 종료. **Anti-Polite-Stop 규칙은 goal-only 모드에 적용 안 함** — 박제가 목적이고 실행은 명시적 escalation 시에만.
104
+
76
105
  ## Phase 2: 스토리 실행 루프
77
106
 
78
107
  ### 2-1. Compound-In (스토리별)
@@ -193,6 +222,52 @@ compound에 저장하시겠습니까? [Y/n]
193
222
  <Arguments>
194
223
  - `[task description]`: 실행할 작업 설명. 생략 시 현재 대화 컨텍스트에서 추론.
195
224
  - `resume`: 이전에 중단된 루프를 재개합니다.
225
+ - `--goal-only` (또는 `--goal`, `--lock-only`): **goal-locking lightweight 모드**.
226
+ Phase 1 (PRD + 수용 기준 + 상태 파일 저장) 까지만 실행하고 Phase 2/3 (자동
227
+ 실행 루프 + 최종 검증) 은 건너뜁니다. 산출물은 *구조화된 Goal 박스* — 작업
228
+ 범위 / 완료 기준 / 제약 / 검증 방법을 한 markdown 으로 박제. 사용자가 다른
229
+ 컨텍스트나 에이전트에 그대로 붙여 위임 가능. 추후 `forge-loop resume` 로
230
+ 자동 실행 사이클 escalate 가능 (상태 파일 재활용).
231
+
232
+ goal-only 모드의 산출물 포맷:
233
+ ```
234
+ GOAL: <한 문장 요약>
235
+ 완료 기준 (Acceptance Criteria — 증거 타입 포함):
236
+ - [ ] AC1: <테스트 로그 / 파일 변경 / dry-run 출력>
237
+ - [ ] AC2: ...
238
+ 제약 (Out-of-Scope / 안 할 것):
239
+ - <실 발송·배포·삭제 금지 / dry-run 한정>
240
+ - <touch 안 할 경로>
241
+ 검증 방법:
242
+ - <bash 명령 / 파일 확인 / 외부 verification>
243
+ 컴파운드 패턴 (참고):
244
+ - <compound-search 결과 top 1-2>
245
+ ```
246
+
247
+ goal-only 모드는 stop-guard 의 fact-vs-agreement / self-score-inflation
248
+ 체크와 직접 연동 — Goal 박스 박제 후 응답이 "완료" 주장 시 AC 의 증거가
249
+ 포함되어야 통과.
196
250
  </Arguments>
197
251
 
198
252
  $ARGUMENTS
253
+
254
+ ---
255
+
256
+ ## `--with-codex` flag (cross-model review)
257
+
258
+ If `$ARGUMENTS` contains any of `--with-codex`, `--코덱스`, `with codex`, `코덱스 검토`, `코덱스로 검토`,
259
+ then after completing the primary skill work, perform a cross-model review pass:
260
+
261
+ 1. Save your primary output text to a temp file (e.g., `/tmp/forgen-with-codex-$(date +%s).md`).
262
+ 2. Invoke codex via Bash:
263
+ ```bash
264
+ codex exec --json --ignore-user-config --ignore-rules --ephemeral \
265
+ -s read-only -c approval_policy="never" --skip-git-repo-check \
266
+ "$(printf 'You are a second-opinion reviewer for another AI assistant\\u0027s output. Read the work product below and report ONLY:\n1. Defects, gaps, or risks the original work missed\n2. Specific disagreements with the original\n3. Topics that should have been covered but were not\n\nOutput format: prioritized bullet list (max 15 items, severity-sorted, no prose intro). If you find nothing material, say "No critical issues found."\n\n<work>\n%s\n</work>' "$(cat /tmp/forgen-with-codex-*.md)")"
267
+ ```
268
+ 3. Append the codex output under heading `## Codex Cross-Review (--with-codex)` in your final response.
269
+ 4. If codex flags critical issues, briefly acknowledge + suggest follow-up.
270
+ 5. If `codex: command not found`, note in response and skip the review pass (do not fail).
271
+
272
+ OPT-IN per invocation. Without the flag, skip this entire section.
273
+
@@ -214,3 +214,24 @@ PRUNE CANDIDATES / 정리 후보
214
214
  </Arguments>
215
215
 
216
216
  $ARGUMENTS
217
+
218
+ ---
219
+
220
+ ## `--with-codex` flag (cross-model review)
221
+
222
+ If `$ARGUMENTS` contains any of `--with-codex`, `--코덱스`, `with codex`, `코덱스 검토`, `코덱스로 검토`,
223
+ then after completing the primary skill work, perform a cross-model review pass:
224
+
225
+ 1. Save your primary output text to a temp file (e.g., `/tmp/forgen-with-codex-$(date +%s).md`).
226
+ 2. Invoke codex via Bash:
227
+ ```bash
228
+ codex exec --json --ignore-user-config --ignore-rules --ephemeral \
229
+ -s read-only -c approval_policy="never" --skip-git-repo-check \
230
+ "$(printf 'You are a second-opinion reviewer for another AI assistant\\u0027s output. Read the work product below and report ONLY:\n1. Defects, gaps, or risks the original work missed\n2. Specific disagreements with the original\n3. Topics that should have been covered but were not\n\nOutput format: prioritized bullet list (max 15 items, severity-sorted, no prose intro). If you find nothing material, say "No critical issues found."\n\n<work>\n%s\n</work>' "$(cat /tmp/forgen-with-codex-*.md)")"
231
+ ```
232
+ 3. Append the codex output under heading `## Codex Cross-Review (--with-codex)` in your final response.
233
+ 4. If codex flags critical issues, briefly acknowledge + suggest follow-up.
234
+ 5. If `codex: command not found`, note in response and skip the review pass (do not fail).
235
+
236
+ OPT-IN per invocation. Without the flag, skip this entire section.
237
+
@@ -53,8 +53,8 @@ compound-list
53
53
  ### 1-3: 교정 기록
54
54
 
55
55
  ```bash
56
- ls -la ~/.forgen/me/evidence/ 2>/dev/null || echo "교정 데이터 없음"
57
- find ~/.forgen/me/evidence/ -name "*.json" -mtime -{period_days} 2>/dev/null | wc -l
56
+ ls -la ~/.forgen/me/behavior/ 2>/dev/null || echo "교정 데이터 없음"
57
+ find ~/.forgen/me/behavior/ -name "*.json" -mtime -{period_days} 2>/dev/null | wc -l
58
58
  ```
59
59
 
60
60
  ## Phase 2: 코드 활동 분석
@@ -197,3 +197,24 @@ RECOMMENDATIONS
197
197
  </Arguments>
198
198
 
199
199
  $ARGUMENTS
200
+
201
+ ---
202
+
203
+ ## `--with-codex` flag (cross-model review)
204
+
205
+ If `$ARGUMENTS` contains any of `--with-codex`, `--코덱스`, `with codex`, `코덱스 검토`, `코덱스로 검토`,
206
+ then after completing the primary skill work, perform a cross-model review pass:
207
+
208
+ 1. Save your primary output text to a temp file (e.g., `/tmp/forgen-with-codex-$(date +%s).md`).
209
+ 2. Invoke codex via Bash:
210
+ ```bash
211
+ codex exec --json --ignore-user-config --ignore-rules --ephemeral \
212
+ -s read-only -c approval_policy="never" --skip-git-repo-check \
213
+ "$(printf 'You are a second-opinion reviewer for another AI assistant\\u0027s output. Read the work product below and report ONLY:\n1. Defects, gaps, or risks the original work missed\n2. Specific disagreements with the original\n3. Topics that should have been covered but were not\n\nOutput format: prioritized bullet list (max 15 items, severity-sorted, no prose intro). If you find nothing material, say "No critical issues found."\n\n<work>\n%s\n</work>' "$(cat /tmp/forgen-with-codex-*.md)")"
214
+ ```
215
+ 3. Append the codex output under heading `## Codex Cross-Review (--with-codex)` in your final response.
216
+ 4. If codex flags critical issues, briefly acknowledge + suggest follow-up.
217
+ 5. If `codex: command not found`, note in response and skip the review pass (do not fail).
218
+
219
+ OPT-IN per invocation. Without the flag, skip this entire section.
220
+
@@ -257,3 +257,24 @@ Action: {다음 행동}
257
257
  </Arguments>
258
258
 
259
259
  $ARGUMENTS
260
+
261
+ ---
262
+
263
+ ## `--with-codex` flag (cross-model review)
264
+
265
+ If `$ARGUMENTS` contains any of `--with-codex`, `--코덱스`, `with codex`, `코덱스 검토`, `코덱스로 검토`,
266
+ then after completing the primary skill work, perform a cross-model review pass:
267
+
268
+ 1. Save your primary output text to a temp file (e.g., `/tmp/forgen-with-codex-$(date +%s).md`).
269
+ 2. Invoke codex via Bash:
270
+ ```bash
271
+ codex exec --json --ignore-user-config --ignore-rules --ephemeral \
272
+ -s read-only -c approval_policy="never" --skip-git-repo-check \
273
+ "$(printf 'You are a second-opinion reviewer for another AI assistant\\u0027s output. Read the work product below and report ONLY:\n1. Defects, gaps, or risks the original work missed\n2. Specific disagreements with the original\n3. Topics that should have been covered but were not\n\nOutput format: prioritized bullet list (max 15 items, severity-sorted, no prose intro). If you find nothing material, say "No critical issues found."\n\n<work>\n%s\n</work>' "$(cat /tmp/forgen-with-codex-*.md)")"
274
+ ```
275
+ 3. Append the codex output under heading `## Codex Cross-Review (--with-codex)` in your final response.
276
+ 4. If codex flags critical issues, briefly acknowledge + suggest follow-up.
277
+ 5. If `codex: command not found`, note in response and skip the review pass (do not fail).
278
+
279
+ OPT-IN per invocation. Without the flag, skip this entire section.
280
+