@andyqiu/codeforge 0.7.10 → 0.8.1

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.
@@ -15,16 +15,15 @@ permissions:
15
15
  bash: deny
16
16
  webfetch: deny
17
17
  allowed_tools: [read, repo_map, task, plan_read, review_approval, session_merge]
18
- model: anthropic/claude-sonnet-4-6
19
- model_category: deep
20
- tier: deep
18
+ model: google/gemini-3.1-pro
19
+ model_category: balanced
20
+ tier: balanced
21
21
  model_thinking:
22
22
  type: enabled
23
- budget_tokens: 4000
23
+ thinking_level: low
24
24
  fallback_models:
25
- - anthropic/claude-opus-4-8 # 路由判断失败 / 复杂场景升档
25
+ - anthropic/claude-sonnet-4-6
26
26
  - anthropic/claude-opus-4-8
27
- - google/gemini-3-pro
28
27
  ---
29
28
 
30
29
  # CodeForge Agent
@@ -116,7 +115,7 @@ fallback_models:
116
115
  1. 派 planner 时,要求其 boomerang 摘要必须含 `plan_id: plan-YYYYMMDD-HHmmss-NNN` **独占一行**
117
116
  2. 派 coder 时,prompt 里塞 `plan_id` + `sessionId`(当前 session id),明示「**第一步调 `plan_read(plan_id=<id>)`** 拿完整方案」
118
117
  3. 派 reviewer 时按模式填写 prompt:
119
- - **新模式(`[Session Merge Review]`)**:prompt 必须含 `sessionId` + `worktreePath` + `baseSha` + `plan_id`(四项均必填;reviewer 调 `review_approval` 时用 `["session:<sessionId>"]`)
118
+ - **新模式(`[Session Merge Review]`)**:prompt 必须含 `sessionId` + `worktreePath` + `baseSha` + `plan_id`(四项均必填;reviewer 调 `review_approval` 时用 `["session:<sessionId>"]` + `worktreePath`)。⚠️ **owner 归一**(ADR:worktree-approval-owner-reconciliation):`sessionId` 应传 **worktree owner(root session id,即合入时 `session_merge` 用的那个 id)**,不确定时**不要**传子会话 id;即便误传子会话 id,`review_approval` 工具也会用 `worktreePath` 自动归一到 owner(child alias + owner key 双写),merge gate 兜底识别 —— 但显式传 owner 最稳
120
119
  - **审方案**:`review_target=plan_only` + `plan_id`
121
120
  - **审决策**:`review_target=decision_only` + 用户选项 + 候选派单
122
121
  4. **走 spec 路径时**,派 planner / coder 的 prompt 额外塞 `spec=<slug>`;派 coder 时再塞 `pre_ack=<PRE-id>,<PRE-id>`
@@ -20,11 +20,10 @@ model_category: deep
20
20
  tier: deep
21
21
  model_thinking:
22
22
  type: enabled
23
- budget_tokens: 8000
23
+ budget_tokens: 16000
24
24
  fallback_models:
25
- - anthropic/claude-opus-4-8
26
- - anthropic/claude-sonnet-4-6
27
- - google/gemini-3-pro
25
+ - openai/gpt-5.5
26
+ - google/gemini-3.1-pro
28
27
  ---
29
28
 
30
29
 
@@ -23,7 +23,7 @@ model_thinking:
23
23
  budget_tokens: 2000
24
24
  fallback_models:
25
25
  - anthropic/claude-opus-4-8
26
- - anthropic/claude-sonnet-4-6
26
+ - google/gemini-3.1-pro
27
27
  ---
28
28
 
29
29
 
package/agents/coder.md CHANGED
@@ -20,11 +20,10 @@ model_category: balanced
20
20
  tier: balanced
21
21
  model_thinking:
22
22
  type: enabled
23
- budget_tokens: 4000
23
+ budget_tokens: 6000
24
24
  fallback_models:
25
25
  - anthropic/claude-opus-4-8
26
- - anthropic/claude-opus-4-8
27
- - google/gemini-3-pro
26
+ - google/gemini-3.1-pro
28
27
  ---
29
28
 
30
29
 
@@ -16,16 +16,15 @@ allowed_tools:
16
16
  # 故意不给 save_chat_insight:challenger 是过程角色,不沉淀
17
17
  # 故意不给 task:物理禁止派子 agent(避免嵌套对抗)
18
18
  # 故意不给 edit/write:零写权(worktree 也不允许写)
19
- model: anthropic/claude-opus-4-8
20
- model_category: deep
19
+ model: openai/gpt-5.5
20
+ model_category: ultrabrain
21
21
  tier: deep
22
22
  model_thinking:
23
23
  type: enabled
24
- budget_tokens: 3000
24
+ reasoning_effort: high
25
25
  fallback_models:
26
26
  - anthropic/claude-opus-4-8
27
- - anthropic/claude-sonnet-4-6
28
- - google/gemini-3-pro
27
+ - google/gemini-3.1-pro
29
28
  ---
30
29
 
31
30
  # Discover Challenger
@@ -40,11 +40,10 @@ model_category: deep
40
40
  tier: deep
41
41
  model_thinking:
42
42
  type: enabled
43
- budget_tokens: 6000
43
+ budget_tokens: 16000
44
44
  fallback_models:
45
- - anthropic/claude-opus-4-8
46
- - anthropic/claude-sonnet-4-6
47
- - google/gemini-3-pro
45
+ - openai/gpt-5.5
46
+ - google/gemini-3.1-pro
48
47
  ---
49
48
 
50
49
  # Discover Agent
package/agents/planner.md CHANGED
@@ -20,11 +20,11 @@ model_category: deep
20
20
  tier: deep
21
21
  model_thinking:
22
22
  type: enabled
23
- budget_tokens: 8000
23
+ budget_tokens: 16000
24
24
  fallback_models:
25
25
  - anthropic/claude-opus-4-8
26
26
  - anthropic/claude-sonnet-4-6
27
- - google/gemini-3-pro
27
+ - google/gemini-3.1-pro
28
28
  ---
29
29
 
30
30
  <!--
@@ -15,12 +15,15 @@ permissions:
15
15
  bash: allow
16
16
  webfetch: deny
17
17
  allowed_tools: [plan_read, bash, read, task, review_approval]
18
- model: anthropic/claude-sonnet-4-6
18
+ model: google/gemini-3.1-pro
19
19
  model_category: balanced
20
20
  tier: balanced
21
+ model_thinking:
22
+ type: enabled
23
+ thinking_level: medium
21
24
  fallback_models:
22
- - anthropic/claude-sonnet-4-5
23
- - google/gemini-2.5-flash
25
+ - anthropic/claude-sonnet-4-6
26
+ - openai/gpt-5.5
24
27
  ---
25
28
 
26
29
  <!-- ADR:reviewer-multi-profile -->
@@ -165,10 +168,13 @@ reviewer 的 `read` 工具**仅允许**读以下路径(白名单):
165
168
  // 模式 2:传 ["decision:<hash>"]
166
169
  notes: "审阅摘要(建议 ≤ 500 字)",
167
170
  decisionLine: "APPROVE", // 可选
171
+ worktreePath: "<worktree_path>", // 模式 3 必传:prompt 的 worktree_path(owner 归一反查)
168
172
  })
169
173
  ```
170
174
  否则 codeforge / `/merge` workflow 后续会被 `plugins/tool-policy.ts` / merge-loop 硬拦截。`REQUEST_CHANGES` / `BLOCK` **不**调此工具。
171
175
 
176
+ - **模式 3 owner 归一**(ADR:worktree-approval-owner-reconciliation):子会话场景下 prompt 里的 `session_id` 可能是子会话 id,而 worktree 实际归属父/root(canonical owner)。`review_approval` 工具会用 `session:<sid>` + 你传的 `worktreePath` 把审批**自动归一**到 owner key(并写一条 child alias),使父 session 合入时无需重复 review。**你只需照传 `session:<sessionId>` + `worktreePath`,归一由工具内部完成。**
177
+
172
178
  - **两层 token 语义独立**(ADR:decision-token-vs-approval-verdict-layering):
173
179
 
174
180
  | 层 | 出现位置 | 合法值 | 用途 |
@@ -15,16 +15,15 @@ permissions:
15
15
  bash: allow
16
16
  webfetch: deny
17
17
  allowed_tools: [plan_read, bash, read, task, review_approval]
18
- model: anthropic/claude-opus-4-8
18
+ model: openai/gpt-5.5
19
19
  model_category: ultrabrain
20
20
  tier: deep
21
21
  model_thinking:
22
22
  type: enabled
23
- budget_tokens: 2000
23
+ reasoning_effort: xhigh
24
24
  fallback_models:
25
25
  - anthropic/claude-opus-4-8
26
- - anthropic/claude-sonnet-4-6
27
- - google/gemini-3-pro
26
+ - google/gemini-3.1-pro
28
27
  ---
29
28
 
30
29
  <!-- ADR:reviewer-multi-profile -->
@@ -164,10 +163,13 @@ reviewer 的 `read` 工具**仅允许**读以下路径(白名单):
164
163
  // 模式 2:传 ["decision:<hash>"]
165
164
  notes: "审阅摘要(建议 ≤ 500 字)",
166
165
  decisionLine: "APPROVE", // 可选
166
+ worktreePath: "<worktree_path>", // 模式 3 必传:prompt 的 worktree_path(owner 归一反查)
167
167
  })
168
168
  ```
169
169
  否则 codeforge / `/merge` workflow 后续会被 `plugins/tool-policy.ts` / merge-loop 硬拦截。`REQUEST_CHANGES` / `BLOCK` **不**调此工具。
170
170
 
171
+ - **模式 3 owner 归一**(ADR:worktree-approval-owner-reconciliation):子会话场景下 prompt 里的 `session_id` 可能是子会话 id,而 worktree 实际归属父/root(canonical owner)。`review_approval` 工具会用 `pendingIds` 里的 `session:<sid>` + 你传的 `worktreePath` 把审批**自动归一**到 owner key(并写一条 child alias),使父 session 合入时无需重复 review。**你只需照传 `session:<sessionId>` + `worktreePath`,归一由工具内部完成,无需手算 owner。**
172
+
171
173
  - **两层 token 语义独立**(ADR:decision-token-vs-approval-verdict-layering):
172
174
 
173
175
  | 层 | 出现位置 | 合法值 | 用途 |
package/bin/codeforge.mjs CHANGED
@@ -139,7 +139,8 @@ function uninstallOpencode({ scope }) {
139
139
  }
140
140
 
141
141
  function detectOpencode() {
142
- const r = spawnSync("opencode", ["--version"], { stdio: "pipe", encoding: "utf8", shell: true })
142
+ const opencodeCmd = process.platform === "win32" ? "opencode.cmd" : "opencode"
143
+ const r = spawnSync(opencodeCmd, ["--version"], { stdio: "pipe", encoding: "utf8" })
143
144
  if (r.status === 0) return { installed: true, version: (r.stdout ?? "").trim() }
144
145
  return { installed: false }
145
146
  }
@@ -249,7 +250,7 @@ async function cmdUpgrade(args) {
249
250
  log(`当前版本:${currentVersion} → 最新版本:${latestVersion}`)
250
251
  }
251
252
 
252
- const npmCmd = "npm"
253
+ const npmCmd = process.platform === "win32" ? "npm.cmd" : "npm"
253
254
  // 有明确版本号时用精确版本,绕过 @latest dist-tag 缓存
254
255
  const installTarget = latestVersion
255
256
  ? `@andyqiu/codeforge@${latestVersion}`
@@ -263,7 +264,7 @@ async function cmdUpgrade(args) {
263
264
  return 0
264
265
  }
265
266
 
266
- const r = spawnSync(npmCmd, npmArgs, { stdio: "pipe", shell: true })
267
+ const r = spawnSync(npmCmd, npmArgs, { stdio: "pipe" })
267
268
  if (r.status !== 0) {
268
269
  if (r.stderr) process.stderr.write(r.stderr)
269
270
  if (r.stdout) process.stderr.write(r.stdout)
package/codeforge.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "_doc": "CodeForge 总配置文件。所有 agent 的模型映射 + 全局运行时偏好。改完跑 `npm run sync:models` 把 models 同步到 agents/*.md。",
4
4
 
5
5
  "models": {
6
- "_doc": "agent → 主模型 + fallback 链。效果优先:主模型用各家最新旗舰,fallback 跨家保高可用。Anthropic Opus 4.8 / Sonnet 4.6 / Haiku 4.5;OpenAI GPT-5.5 (2026-04-23) / GPT-5.4;Google Gemini 3 Pro / 2.5 Pro。",
6
+ "_doc": "agent → 主模型 + fallback 链。三家分工:Anthropic 负责生产(规划+编码),OpenAI 负责审查(跨家偏见隔离),Gemini 负责调度和轻量快速任务。",
7
7
  "default": "anthropic/claude-opus-4-8",
8
8
 
9
9
  "agents": {
@@ -12,11 +12,11 @@
12
12
  "model": "anthropic/claude-opus-4-8",
13
13
  "category": "deep",
14
14
  "tier": "deep",
15
- "thinking": { "type": "enabled", "budget_tokens": 8000 },
15
+ "thinking": { "type": "enabled", "budget_tokens": 16000 },
16
16
  "fallback_models": [
17
17
  "anthropic/claude-opus-4-8",
18
18
  "anthropic/claude-sonnet-4-6",
19
- "google/gemini-3-pro"
19
+ "google/gemini-3.1-pro"
20
20
  ]
21
21
  },
22
22
  "coder": {
@@ -24,11 +24,10 @@
24
24
  "model": "anthropic/claude-sonnet-4-6",
25
25
  "category": "balanced",
26
26
  "tier": "balanced",
27
- "thinking": { "type": "enabled", "budget_tokens": 4000 },
27
+ "thinking": { "type": "enabled", "budget_tokens": 6000 },
28
28
  "fallback_models": [
29
29
  "anthropic/claude-opus-4-8",
30
- "anthropic/claude-opus-4-8",
31
- "google/gemini-3-pro"
30
+ "google/gemini-3.1-pro"
32
31
  ]
33
32
  },
34
33
  "coder-quick": {
@@ -39,7 +38,7 @@
39
38
  "thinking": { "type": "enabled", "budget_tokens": 2000 },
40
39
  "fallback_models": [
41
40
  "anthropic/claude-opus-4-8",
42
- "anthropic/claude-sonnet-4-6"
41
+ "google/gemini-3.1-pro"
43
42
  ]
44
43
  },
45
44
  "coder-deep": {
@@ -47,23 +46,21 @@
47
46
  "model": "anthropic/claude-opus-4-8",
48
47
  "category": "deep",
49
48
  "tier": "deep",
50
- "thinking": { "type": "enabled", "budget_tokens": 8000 },
49
+ "thinking": { "type": "enabled", "budget_tokens": 16000 },
51
50
  "fallback_models": [
52
- "anthropic/claude-opus-4-8",
53
- "anthropic/claude-sonnet-4-6",
54
- "google/gemini-3-pro"
51
+ "openai/gpt-5.5",
52
+ "google/gemini-3.1-pro"
55
53
  ]
56
54
  },
57
55
  "reviewer": {
58
- "_doc": "审查者:Opus 4.8 主(稳定性优先),GPT-5.5 降 fallback(跨家族偏见隔离)。thinking 2000:审查 prompt 一般不大,长思考链浪费。",
59
- "model": "anthropic/claude-opus-4-8",
56
+ "_doc": "审查者:GPT-5.5 主(跨家族偏见隔离),Opus 4.8 降 fallbackthinking 2000:审查 prompt 一般不大,长思考链浪费。",
57
+ "model": "openai/gpt-5.5",
60
58
  "category": "ultrabrain",
61
59
  "tier": "deep",
62
- "thinking": { "type": "enabled", "budget_tokens": 2000 },
60
+ "thinking": { "type": "enabled", "reasoning_effort": "xhigh" },
63
61
  "fallback_models": [
64
62
  "anthropic/claude-opus-4-8",
65
- "anthropic/claude-sonnet-4-6",
66
- "google/gemini-3-pro"
63
+ "google/gemini-3.1-pro"
67
64
  ]
68
65
  },
69
66
  "discover": {
@@ -71,49 +68,58 @@
71
68
  "model": "anthropic/claude-opus-4-8",
72
69
  "category": "deep",
73
70
  "tier": "deep",
74
- "thinking": { "type": "enabled", "budget_tokens": 6000 },
71
+ "thinking": { "type": "enabled", "budget_tokens": 16000 },
75
72
  "fallback_models": [
76
- "anthropic/claude-opus-4-8",
77
- "anthropic/claude-sonnet-4-6",
78
- "google/gemini-3-pro"
73
+ "openai/gpt-5.5",
74
+ "google/gemini-3.1-pro"
79
75
  ]
80
76
  },
81
77
  "discover-challenger": {
82
- "_doc": "强对抗子 agent:Opus 4.8 主(稳定),GPT-5.5 降 fallback(跨家族偏见隔离),结论由离散触发组合锁死。",
83
- "model": "anthropic/claude-opus-4-8",
78
+ "_doc": "强对抗子 agent:GPT-5.5 主(跨家族偏见隔离),Opus 4.8 降 fallback,结论由离散触发组合锁死。",
79
+ "model": "openai/gpt-5.5",
84
80
  "category": "ultrabrain",
85
81
  "tier": "deep",
86
- "thinking": { "type": "enabled", "budget_tokens": 3000 },
82
+ "thinking": { "type": "enabled", "reasoning_effort": "high" },
87
83
  "fallback_models": [
88
84
  "anthropic/claude-opus-4-8",
85
+ "google/gemini-3.1-pro"
86
+ ]
87
+ },
88
+ "codeforge": {
89
+ "_doc": "编排者(调度专用):Gemini 3.1 Pro 主(轻量快速路由),Sonnet 4.6 / Opus 4.8 备用。codeforge 无写权限,只路由不生产,用 Gemini 降成本。category=balanced 对应模型档次,tier=balanced 对应任务难度(路由判断本身是轻量任务)。",
90
+ "model": "google/gemini-3.1-pro",
91
+ "category": "balanced",
92
+ "tier": "balanced",
93
+ "thinking": { "type": "enabled", "thinking_level": "low" },
94
+ "fallback_models": [
89
95
  "anthropic/claude-sonnet-4-6",
90
- "google/gemini-3-pro"
96
+ "anthropic/claude-opus-4-8"
91
97
  ]
92
98
  }
93
99
  },
94
100
 
95
- "categories": {
101
+ "categories": {
96
102
  "deep": {
97
- "_doc": "用于规划 / 架构 / 复杂推理(Opus 4.8 + 8K thinking)",
103
+ "_doc": "用于规划 / 架构 / 复杂推理(Opus 4.8 + 16K thinking)",
98
104
  "model": "anthropic/claude-opus-4-8",
99
- "thinking": { "type": "enabled", "budget_tokens": 8000 },
105
+ "thinking": { "type": "enabled", "budget_tokens": 16000 },
100
106
  "fallback_models": ["anthropic/claude-opus-4-8", "anthropic/claude-sonnet-4-6"]
101
107
  },
102
108
  "ultrabrain": {
103
- "_doc": "用于代码审查 / 独立评估 / 跨视角(Opus 4.8 旗舰,GPT-5.5 备用)",
104
- "model": "anthropic/claude-opus-4-8",
109
+ "_doc": "用于代码审查 / 独立评估 / 跨视角(GPT-5.5 主,Opus 4.8 备用;跨家偏见隔离)",
110
+ "model": "openai/gpt-5.5",
105
111
  "fallback_models": ["anthropic/claude-opus-4-8", "anthropic/claude-sonnet-4-6"]
106
112
  },
107
113
  "balanced": {
108
114
  "_doc": "速度+智能平衡(Sonnet 4.6 + 4K thinking)",
109
115
  "model": "anthropic/claude-sonnet-4-6",
110
116
  "thinking": { "type": "enabled", "budget_tokens": 4000 },
111
- "fallback_models": ["openai/gpt-5.4", "google/gemini-3-pro"]
117
+ "fallback_models": ["openai/gpt-5.5", "google/gemini-3.1-pro"]
112
118
  },
113
119
  "quick": {
114
120
  "_doc": "短上下文 / 快速校验(Haiku 4.5)",
115
121
  "model": "anthropic/claude-haiku-4-5",
116
- "fallback_models": ["anthropic/claude-sonnet-4-6", "openai/gpt-5.4"]
122
+ "fallback_models": ["anthropic/claude-sonnet-4-6", "openai/gpt-5.5"]
117
123
  }
118
124
  },
119
125