peaks-loop 4.2.5 → 4.2.6

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.
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "metadata": {
3
3
  "pluginRoot": ".",
4
- "version": "4.2.5"
4
+ "version": "4.2.6"
5
5
  },
6
6
  "plugins": [
7
7
  {
8
8
  "name": "peaks-loop",
9
9
  "description": "Loop Engineering CLI — workflow primitive / loop guards / evaluators / slice orchestration",
10
- "version": "4.2.5",
10
+ "version": "4.2.6",
11
11
  "author": {
12
12
  "name": "SquabbyZ"
13
13
  },
package/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.2.6 — 2026-11-22(默认压缩窗口 250K → 1M:交给 harness 按模型上下文钳制)
4
+
5
+ **版本级别**:**patch**(只改一个默认常量及其文档注释;无新能力,无 schema 变更,无门禁阈值放宽)。
6
+
7
+ **一句话:`workspace init` 的默认窗口从 `250000` 改成 `1000000`——这是 harness 接受的上限,会被 harness 钳制到模型的真实上下文,因此同一个默认对 1M 模型等于 800K 触发,对 200K 模型等于 160K。**
8
+
9
+ ### 1. 为什么改
10
+
11
+ Claude Code 会把 `CLAUDE_CODE_AUTO_COMPACT_WINDOW` 钳制到模型自身的上下文。本机实测结果:
12
+
13
+ | 模型 | 配置窗口 | `effectiveWindow` | 80% 触发阈值 |
14
+ |---|---|---|---|
15
+ | 1M(默认) | 1,000,000 | 980,000 | **800,000** |
16
+ | 200K(`CLAUDE_CODE_DISABLE_1M_CONTEXT=1`) | 1,000,000 | 180,000 | **160,000** |
17
+
18
+ 也就是说 `window = 1,000,000` 对**任何**模型都表现为「真实容量的 80%」,而旧默认 `250,000` 把 1M 模型硬压在 25%、在 200,000 就触发压缩——远早于用户预期。1,000,000 正是 harness 文档波段(100,000..1,000,000)的上限,所以它才是最中性的默认值。
19
+
20
+ ### 2. 改了什么
21
+
22
+ - `DEFAULT_HARNESS_COMPACT_WINDOW_TOKENS`:`250_000` → `1_000_000`(`src/services/context/harness-compact-threshold-config.ts`)。
23
+ - `DEFAULT_HARNESS_COMPACT_PERCENT` 保持 `80`。
24
+ - 常量文档注释写明钳制实测与上表数值。
25
+
26
+ ### 3. 影响面
27
+
28
+ - 全新项目跑 `peaks workspace init`,`.claude/settings.local.json` 现在写入 `CLAUDE_CODE_AUTO_COMPACT_WINDOW=1000000` 与 `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=80`(各带 provenance 标记)。
29
+ - 已有项目不会被改写:init 只在槽位为空时填默认值。本仓库自己的 `.claude/settings.local.json` 已是 `1000000`,实测 init 后文件字节不变。
30
+ - 仍需固定窗口的项目照旧直接编辑该文件。
31
+
32
+ ### 4. 验证
33
+
34
+ | 项 | 结果 |
35
+ |---|---|
36
+ | `tsc -p tsconfig.json --noEmit` | 0 |
37
+ | `node .husky/peaks-gate.mjs repo` | 0 |
38
+ | 单元测试(`tests/unit/` 全量) | 705 文件 / 7623 通过 / 0 失败 |
39
+ | 变异(6 模块) | 90.57%,`passed: true`(最低单模块 85.66%) |
40
+ | 全新 git 项目 `workspace init` | 写入 `CLAUDE_CODE_AUTO_COMPACT_WINDOW=1000000` 与 `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=80` |
41
+ | 本仓库现有 settings 上重跑 init | 文件字节不变 |
42
+
3
43
  ## 4.2.5 — 2026-11-22(修 4.2.4 的严重缺陷:探针会把项目窗口覆盖回 1M)
4
44
 
5
45
  **版本级别**:**patch**(只修缺陷,无新能力,无 schema 变更,无门禁阈值放宽)。
@@ -34,17 +34,18 @@ import { type HarnessPercentOwnership } from './harness-percent-ownership.js';
34
34
  /**
35
35
  * The window peaks-loop configures when nobody has said otherwise.
36
36
  *
37
- * 250_000 is the value the user calibrated on 2026-11-20
38
- * (`CLAUDE_CODE_AUTO_COMPACT_WINDOW=250000` + 80% → a 200_000-token trigger),
39
- * and it is the one the harness accepts as a plain token count inside its
40
- * documented 100_000..1_000_000 band. A fresh downstream project gets THIS
41
- * rather than an unset slot, because an unset slot means "no early compaction
42
- * at all" — the state this slice exists to end.
37
+ * 1_000_000 is the harness's accepted MAXIMUM (band 100_000..1_000_000), and
38
+ * that is why it is the neutral default: the harness CLAMPS the window to the
39
+ * model's own context, so the maximum means "as much as this model holds".
40
+ * Measured 2026-11-22: a 1M model gets effectiveWindow 980_000 → threshold
41
+ * 800_000; a 200K model given the same window is clamped to 180_000 → 160_000.
42
+ * The old 250_000 default capped a 1M model at 25% and fired at 200_000. A
43
+ * fresh project gets THIS rather than an unset slot ("no early compaction").
43
44
  */
44
- export declare const DEFAULT_HARNESS_COMPACT_WINDOW_TOKENS = 250000;
45
+ export declare const DEFAULT_HARNESS_COMPACT_WINDOW_TOKENS = 1000000;
45
46
  /**
46
47
  * The percent peaks-loop configures when nobody has said otherwise — 80% of
47
- * the window above, i.e. a 200_000-token trigger on a 250_000 window.
48
+ * the window above, i.e. an 800_000-token trigger on the 1_000_000 default.
48
49
  *
49
50
  * The single named default, exported here and nowhere else.
50
51
  */
@@ -39,17 +39,18 @@ import { HARNESS_PERCENT_WRITTEN_KEY, boundedRawNote, isHarnessPercentPeaksOwned
39
39
  /**
40
40
  * The window peaks-loop configures when nobody has said otherwise.
41
41
  *
42
- * 250_000 is the value the user calibrated on 2026-11-20
43
- * (`CLAUDE_CODE_AUTO_COMPACT_WINDOW=250000` + 80% → a 200_000-token trigger),
44
- * and it is the one the harness accepts as a plain token count inside its
45
- * documented 100_000..1_000_000 band. A fresh downstream project gets THIS
46
- * rather than an unset slot, because an unset slot means "no early compaction
47
- * at all" — the state this slice exists to end.
42
+ * 1_000_000 is the harness's accepted MAXIMUM (band 100_000..1_000_000), and
43
+ * that is why it is the neutral default: the harness CLAMPS the window to the
44
+ * model's own context, so the maximum means "as much as this model holds".
45
+ * Measured 2026-11-22: a 1M model gets effectiveWindow 980_000 → threshold
46
+ * 800_000; a 200K model given the same window is clamped to 180_000 → 160_000.
47
+ * The old 250_000 default capped a 1M model at 25% and fired at 200_000. A
48
+ * fresh project gets THIS rather than an unset slot ("no early compaction").
48
49
  */
49
- export const DEFAULT_HARNESS_COMPACT_WINDOW_TOKENS = 250_000;
50
+ export const DEFAULT_HARNESS_COMPACT_WINDOW_TOKENS = 1_000_000;
50
51
  /**
51
52
  * The percent peaks-loop configures when nobody has said otherwise — 80% of
52
- * the window above, i.e. a 200_000-token trigger on a 250_000 window.
53
+ * the window above, i.e. an 800_000-token trigger on the 1_000_000 default.
53
54
  *
54
55
  * The single named default, exported here and nowhere else.
55
56
  */
@@ -30,9 +30,10 @@ export interface HarnessCompactThresholdResult {
30
30
  * resolves to the value already in the file when there is one and to the
31
31
  * default only when the slot is empty. Init carries no new MEASUREMENT, so
32
32
  * rewriting an existing value from it would be peaks-loop overruling its own
33
- * probe with a policy constant — this repository's own file holds a
34
- * peaks-written 1M window that a 250_000 default must not cut down on every
35
- * init. An explicit argument (`number`), or `null` for "do not manage this one
33
+ * probe with a policy constant — an existing peaks-written value stands even
34
+ * when the current default differs, and this repository's own file is the
35
+ * shape that rule protects. An explicit argument (`number`), or `null` for
36
+ * "do not manage this one
36
37
  * on this call", is passed through as given (the provenance and band gates
37
38
  * still apply).
38
39
  *
@@ -40,9 +40,10 @@ function resolveEnsured(arg, fileRaw, parse, fallback) {
40
40
  * resolves to the value already in the file when there is one and to the
41
41
  * default only when the slot is empty. Init carries no new MEASUREMENT, so
42
42
  * rewriting an existing value from it would be peaks-loop overruling its own
43
- * probe with a policy constant — this repository's own file holds a
44
- * peaks-written 1M window that a 250_000 default must not cut down on every
45
- * init. An explicit argument (`number`), or `null` for "do not manage this one
43
+ * probe with a policy constant — an existing peaks-written value stands even
44
+ * when the current default differs, and this repository's own file is the
45
+ * shape that rule protects. An explicit argument (`number`), or `null` for
46
+ * "do not manage this one
46
47
  * on this call", is passed through as given (the provenance and band gates
47
48
  * still apply).
48
49
  *
@@ -82,7 +82,7 @@ function isPlainWindowSpelling(raw) {
82
82
  * as 1000000, and a value of `1e6` equals a marker of `1000000` only because the
83
83
  * parser is lenient. Neither is evidence of ownership, so the pair is `human`
84
84
  * and is KEPT. An UNPARSEABLE value beside a plain, valid marker still proves
85
- * corruption of peaks-loop's own write (`500k` beside `250000`) and stays
85
+ * corruption of peaks-loop's own write (`500k` beside `1000000`) and stays
86
86
  * removable — that recovery is the feature.
87
87
  */
88
88
  function isWindowRemovable(input) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peaks-loop",
3
- "version": "4.2.5",
3
+ "version": "4.2.6",
4
4
  "description": "Loop Engineering CLI — workflow primitive / loop guards / evaluators / slice orchestration",
5
5
  "author": "SquabbyZ",
6
6
  "keywords": [
@@ -133,11 +133,11 @@
133
133
  "picomatch": "4.0.7",
134
134
  "yaml": "^2.9.1",
135
135
  "zod": "^4.6.7",
136
- "peaks-loop-internal-runtime": "0.0.72",
137
- "peaks-loop-shared": "0.0.121",
138
- "peaks-loop-shared-channel": "0.0.89",
139
- "peaks-loop-workspace-runtime": "0.0.6",
140
- "peaks-loop-mut": "0.1.86"
136
+ "peaks-loop-internal-runtime": "0.0.73",
137
+ "peaks-loop-mut": "0.1.87",
138
+ "peaks-loop-shared": "0.0.122",
139
+ "peaks-loop-workspace-runtime": "0.0.7",
140
+ "peaks-loop-shared-channel": "0.0.90"
141
141
  },
142
142
  "devDependencies": {
143
143
  "@changesets/cli": "2.31.1",