claude-spotter 1.4.2 → 1.4.4

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.4.4
4
+
5
+ **Codex CLI auditor の default model を明示固定**。Spotter の hook 判定は高頻度・低遅延・低コストの
6
+ 構造化 JSON 監査であり、Codex CLI の暗黙 default model に依存すると、`--ignore-user-config` 環境で
7
+ 実際に呼ぶ model が不透明になるため修正。
8
+
9
+ ### 変更点
10
+
11
+ - **編集 [src/core/codex-cli-backend.mjs](src/core/codex-cli-backend.mjs)**:
12
+ `SPOTTER_CODEX_CLI_MODEL` 未設定時も `--model gpt-5.4-mini` を渡すようにした。
13
+ `SPOTTER_CODEX_CLI_REASONING_EFFORT` 未設定時の `model_reasoning_effort="low"` は維持。
14
+ - **編集 [test/codex-cli-backend.test.mjs](test/codex-cli-backend.test.mjs)**:
15
+ default args が `gpt-5.4-mini` を含むことと、明示的に `model: ""` を渡した場合だけ
16
+ `--model` を省略できることを固定。
17
+ - **編集 README / README.ja / CLAUDE.md / docs**: Codex CLI auditor child の既定を
18
+ `gpt-5.4-mini` + `model_reasoning_effort="low"` と明記。
19
+
20
+ ### ユーザー側で必要な手順
21
+
22
+ 1. `npm install -g claude-spotter@1.4.4`
23
+ 2. 各プロジェクトで `spotter install`
24
+
25
+ ## 1.4.3
26
+
27
+ **README の Codex refresh 手順表現を v1.4.2 の実装と一致させる docs patch release**。v1.4.2 で Codex hooks 登録は `spotter install` に集約済みだが、README / README.ja の common commands コメントに `codex-hook install` 後という古い表現が残っていたため修正。
28
+
29
+ ### 変更点
30
+
31
+ - **編集 [README.md](README.md) / [README.ja.md](README.ja.md)**: Codex SessionStart refresh は `spotter install` 後に自動実行される、と明記。`spotter codex-hook install` は修復 / 明示登録用 command として残す
32
+
33
+ ### ユーザー側で必要な手順
34
+
35
+ 1. `npm install -g claude-spotter@1.4.3`
36
+ 2. 各プロジェクトで `spotter install`
37
+
3
38
  ## 1.4.2
4
39
 
5
40
  **既存 project の hook command path を npm global 版へ更新する patch release**。v1.4.1 の `spotter install` は Codex hooks を自動登録するようになったが、既存 `.claude/settings.json` に `spotter.mjs` hook がある場合、登録済み判定で timeout だけ更新し、command path を現在の package root へ差し替えていなかった。local checkout 由来の hook が残ると、global npm update 後も古い checkout を呼び続け得るため修正。
@@ -398,7 +433,7 @@ v0.8.0 で claude.ai OAuth 系 MCP (Gmail / Calendar / Drive) を手書き basel
398
433
  - **編集 [docs/catalog-design.md](docs/catalog-design.md)**:
399
434
  - 新節「収集タイミング (v1.1.0 以降)」追加 — install 同期 seed / SessionStart bg refresh / db refresh / db rebuild の 4 経路を整理
400
435
  - 歴史節に v1.1.x の「収集タイミング自動化」を追記
401
- - **編集 [docs/spotter-plan.md](docs/spotter-plan.md)**:
436
+ - **編集 [docs/archive/spotter-plan.md](docs/archive/spotter-plan.md)**:
402
437
  - 冒頭に「v0.1 時点の設計議事録」である旨のブリッジ追加、現行設計の真実源 (catalog-design.md / open-issues.md / CLAUDE.md) へのリンクを明示
403
438
 
404
439
  ## 1.1.2
@@ -1161,7 +1196,7 @@ layers cover the same proliferation cases.
1161
1196
 
1162
1197
  ## 0.1.1 — ⚠️ DEPRECATED 2026-04-19
1163
1198
 
1164
- **Do not install this version.** Real-world testing against a live Claude Code session revealed that the "one daemon per session" model is based on a wrong assumption — `SessionStart` hooks fire per subagent (Task tool invocation), not only at top-level session startup. Within 41 seconds of install, 213 orphan daemons accumulated and Haiku API calls uniformly timed out. `npm uninstall -g` also did not execute `preuninstall`, leaving hook entries in `~/.claude/settings.json`. See [docs/spotter-plan.md §18](https://github.com/kitepon-rgb/Spotter/blob/main/docs/spotter-plan.md#18) for details and the v0.2 redesign plan.
1199
+ **Do not install this version.** Real-world testing against a live Claude Code session revealed that the "one daemon per session" model is based on a wrong assumption — `SessionStart` hooks fire per subagent (Task tool invocation), not only at top-level session startup. Within 41 seconds of install, 213 orphan daemons accumulated and Haiku API calls uniformly timed out. `npm uninstall -g` also did not execute `preuninstall`, leaving hook entries in `~/.claude/settings.json`. See [docs/archive/spotter-plan.md §18](https://github.com/kitepon-rgb/Spotter/blob/main/docs/archive/spotter-plan.md#18) for details and the v0.2 redesign plan.
1165
1200
 
1166
1201
  ## 0.1.1 (pre-deprecation notes)
1167
1202
 
@@ -1188,4 +1223,4 @@ Initial release.
1188
1223
 
1189
1224
  ### Design
1190
1225
 
1191
- All non-negotiable design decisions — including transparency vs invisibility, JSON I/O, socket abstraction, message envelope, SessionStart readiness — are documented in [docs/spotter-plan.md](docs/spotter-plan.md).
1226
+ All non-negotiable design decisions — including transparency vs invisibility, JSON I/O, socket abstraction, message envelope, SessionStart readiness — are documented in [docs/archive/spotter-plan.md](docs/archive/spotter-plan.md).
package/README.ja.md CHANGED
@@ -63,6 +63,10 @@ spotter uninstall # このプロジェクトの hook 登録を解除
63
63
 
64
64
  ### 1 ターンの監査フロー
65
65
 
66
+ Claude Code と Codex では `Stop` の受け口が違います。下の図は Claude host の流れです。
67
+ Codex native `Stop` は遅延配送で、不足ツールの指摘を queue し、次の same-session
68
+ `UserPromptSubmit` で提示します。
69
+
66
70
  ```mermaid
67
71
  flowchart TD
68
72
  U([User 発話]) --> UPH[UserPromptSubmit hook<br/>Spotter が発話とカタログから一次判定]
@@ -126,7 +130,7 @@ spotter db list --host-agent codex
126
130
  spotter db refresh # Claude MCP / スキル / サブエージェントから description を収集して Claude DB 更新
127
131
  spotter db refresh --host-agent codex
128
132
  # Codex MCP / スキルから description を収集して .spotter/tool-db.codex.json を更新
129
- # (Claude は install + Claude SessionStart、Codex は codex-hook install 後の
133
+ # (Claude は install + Claude SessionStart、Codex は spotter install 後の
130
134
  # Codex SessionStart で自動実行されるので通常は不要)
131
135
  spotter db rebuild # Claude local + global DB を両方消してから refresh (カタログ設計変更時のクリーン用)
132
136
  spotter status # 稼働中の daemon 一覧
@@ -159,21 +163,23 @@ SPOTTER_CODEX_RISK_CHECK=1 spotter daemon start --session-id ... --project-root
159
163
  Primary auditor backend policy: Claude hooks は現行の Haiku compatibility path を既定のまま維持します。
160
164
  Codex native hooks は Codex CLI を既定 backend とし、Haiku へ fallback しません。
161
165
  Codex 側の SessionStart hook は `.spotter/tool-db.codex.json` を bg refresh し、Claude DB には触れません。
166
+ Codex CLI auditor の子プロセスは、hook 判定を安く速く保つため既定で `gpt-5.4-mini` と
167
+ `model_reasoning_effort="low"` を明示指定します。実測や制御された実験では
168
+ `SPOTTER_CODEX_CLI_MODEL` / `SPOTTER_CODEX_CLI_REASONING_EFFORT` で上書きできます。
162
169
  明示 smoke には `SPOTTER_AUDITOR_BACKEND=codex-sidecar` も使えます。
163
170
 
164
171
  ## 設計ドキュメント
165
172
 
166
173
  - **現行設計 (カタログ / 収集経路 / 分類軸)**: [docs/catalog-design.md](docs/catalog-design.md) — v1.0.0 以降の真実源
167
174
  - **現時点で塞がっていない穴 + 実測未検証の懸念**: [docs/open-issues.md](docs/open-issues.md) — 新規作業に入る前に必読
168
- - **Claude contract capture**: [docs/SPOTTER_CLAUDE_CONTRACT.md](docs/SPOTTER_CLAUDE_CONTRACT.md) — Codex 作業で維持すべき hook / daemon / Haiku の現行契約
169
- - **Claude / Codex 両対応ブリーフ**: [docs/SPOTTER_CODEX_DUAL_SUPPORT.md](docs/SPOTTER_CODEX_DUAL_SUPPORT.md) と完了済み [TODO](docs/SPOTTER_CODEX_DUAL_SUPPORT_TODO.md) — second-pass `codex-sidecar` workflow
170
- - **Primary auditor backend migration**: [docs/SPOTTER_PRIMARY_BACKEND_TODO.md](docs/SPOTTER_PRIMARY_BACKEND_TODO.md) — Codex CLI / `codex-sidecar` auditor backend の rollout 状況
175
+ - **Runtime contract**: [docs/SPOTTER_CLAUDE_CONTRACT.md](docs/SPOTTER_CLAUDE_CONTRACT.md) — Claude hook / daemon / Haiku 契約と Codex native hook policy
171
176
  - **実装規範と不変条件 (§0)**: [CLAUDE.md](CLAUDE.md) — フォールバック禁止 / silent fallback 禁止 / 暫定コード禁止
172
- - **歴史記録 (v0.1 時点の設計議事録)**: [docs/spotter-plan.md](docs/spotter-plan.md) — 作成時点で固定された議論過程のスナップショット、現行設計は上記 3 点を参照
177
+ - **Archive**: [docs/archive/](docs/archive/) — 完了済み Codex rollout 計画、primary backend smoke log、v0.1 設計議事録
173
178
 
174
179
  ## 既知の制約
175
180
 
176
181
  - Stop hook は Bell の最初の応答が**出力された後**に発火するため、Spotter が Stop で差し戻した場合、ユーザーは「最初の応答 + 補正応答」の 2 連続を見ます (Claude Code の hook 仕様による制約)。UserPromptSubmit 段階での先回り検出を精度の軸にしています
182
+ - Codex native `Stop` は **即時ブロックではなく遅延配送**です。Codex `Stop` で不足ツールを見つけた場合、Spotter は `.spotter/codex-pending/` に指摘を保存し、次の same-session `UserPromptSubmit` で `additionalContext` として提示します。これは Codex の現行 `decision:"block"` が `Stop Blocked` / exit code 1 になりやすい実測結果を避けるためです
177
183
  - **JSON スキーマ違反は v0.5.0 以降「想定済み異常」として silent pass + session renew で回復**します (role collapse 検知パス、daemon ログに `role_collapse_reset` を残す)。一方 **Haiku timeout は引き続き throw** され、UserPromptSubmit がブロックされてユーザー入力が Bell に届かない症状として顕在化します (timeout は v0.5.0 で 30s、v0.13.1 で 45s に拡張)。timeout の fail-open 化 (pass 扱い) は §0 改訂とセットで今後検討
178
184
 
179
185
  <details>
package/README.md CHANGED
@@ -63,6 +63,10 @@ spotter uninstall # remove hooks from this project
63
63
 
64
64
  ### Audit flow per turn
65
65
 
66
+ Claude Code and Codex have different `Stop` surfaces. The diagram below is the Claude
67
+ host flow. Codex native `Stop` uses deferred delivery: findings are queued and shown on
68
+ the next same-session `UserPromptSubmit`.
69
+
66
70
  ```mermaid
67
71
  flowchart TD
68
72
  U([User prompt]) --> UPH[UserPromptSubmit hook<br/>Spotter audits prompt against catalog]
@@ -127,7 +131,7 @@ spotter db refresh # rediscover Claude MCP / skills / sub-agents and updat
127
131
  spotter db refresh --host-agent codex
128
132
  # rediscover Codex MCP / skills and update .spotter/tool-db.codex.json
129
133
  # (Claude refresh is automatic on install + Claude SessionStart;
130
- # Codex refresh is automatic on Codex SessionStart after codex-hook install)
134
+ # Codex refresh is automatic on Codex SessionStart after spotter install)
131
135
  spotter db rebuild # wipe Claude local + global DBs and refresh from scratch
132
136
  # (use after catalog-shape changes)
133
137
  spotter status # list running daemons
@@ -161,21 +165,24 @@ Primary auditor backend policy: Claude hooks keep the current Haiku-compatible p
161
165
  default. Codex native hooks use Codex CLI by default and do not fall back to Haiku;
162
166
  their SessionStart hook refreshes `.spotter/tool-db.codex.json` in the background
163
167
  without touching the Claude DB.
168
+ Codex CLI auditor child processes explicitly use `gpt-5.4-mini` with
169
+ `model_reasoning_effort="low"` by default so hook checks stay cheap and fast;
170
+ `SPOTTER_CODEX_CLI_MODEL` and `SPOTTER_CODEX_CLI_REASONING_EFFORT` can override
171
+ those values for smoke tests or controlled experiments.
164
172
  `SPOTTER_AUDITOR_BACKEND=codex-sidecar` is available for explicit sidecar auditor smoke.
165
173
 
166
174
  ## Design docs
167
175
 
168
176
  - **Current design** (catalog, discovery, classification axes): [docs/catalog-design.md](docs/catalog-design.md) — source of truth from v1.0.0
169
177
  - **Open issues + unverified concerns**: [docs/open-issues.md](docs/open-issues.md) — read this before starting new work
170
- - **Claude contract capture**: [docs/SPOTTER_CLAUDE_CONTRACT.md](docs/SPOTTER_CLAUDE_CONTRACT.md) — current hook / daemon / Haiku behavior that Codex work must preserve
171
- - **Claude / Codex dual-support brief**: [docs/SPOTTER_CODEX_DUAL_SUPPORT.md](docs/SPOTTER_CODEX_DUAL_SUPPORT.md) and completed [TODO](docs/SPOTTER_CODEX_DUAL_SUPPORT_TODO.md) — second-pass `codex-sidecar` workflows
172
- - **Primary auditor backend migration**: [docs/SPOTTER_PRIMARY_BACKEND_TODO.md](docs/SPOTTER_PRIMARY_BACKEND_TODO.md) — Codex CLI / `codex-sidecar` auditor backend rollout status
178
+ - **Runtime contract**: [docs/SPOTTER_CLAUDE_CONTRACT.md](docs/SPOTTER_CLAUDE_CONTRACT.md) — Claude hook / daemon / Haiku contract plus Codex native hook policy
173
179
  - **Implementation invariants (§0)**: [CLAUDE.md](CLAUDE.md) — no fallbacks, no silent failures, no provisional code
174
- - **Historical record (v0.1 design discussion)**: [docs/spotter-plan.md](docs/spotter-plan.md) — frozen design-discussion snapshot
180
+ - **Archived plans and history**: [docs/archive/](docs/archive/) — completed Codex rollout plans, primary backend smoke logs, and the frozen v0.1 design discussion
175
181
 
176
182
  ## Known limitations
177
183
 
178
184
  - The `Stop` hook fires **after** Bell's first answer has already been streamed to the user. When Spotter sends Bell back, the user sees both the original answer and the corrected one. Detection accuracy in `UserPromptSubmit` (the *pre-response* stage) is therefore Spotter's primary axis of quality
185
+ - Codex native `Stop` is **deferred**, not an immediate block. If Spotter finds a missed tool at Codex `Stop`, it writes the finding to `.spotter/codex-pending/` and surfaces it on the next same-session `UserPromptSubmit` as `additionalContext`. This avoids Codex's current `Stop Blocked` / exit-code-1 behavior for `decision:"block"`
179
186
  - **Since v0.5.0, JSON schema violations from Haiku are treated as expected-anomalies** (silent pass + session renew, logged as `role_collapse_reset`) — this is the role-collapse recovery path. **Haiku timeouts still throw**, which surfaces as `UserPromptSubmit` blocking the user's prompt from reaching Bell. Timeouts have been raised twice (30s in v0.5.0, 45s in v0.13.1); making timeouts fail-open is deferred until §0 is revisited
180
187
 
181
188
  <details>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-spotter",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "description": "Audit agent running alongside Claude Code that catches missed tool calls — 気づく役と実行する役の分離",
5
5
  "type": "module",
6
6
  "bin": {
@@ -7,6 +7,7 @@ import { AuditorBackendError } from './auditor-error.mjs';
7
7
  import { filterCatalogMisses, parseAuditorResponse } from './auditor-response.mjs';
8
8
 
9
9
  const DEFAULT_CODEX_CLI_TIMEOUT_MS = 45_000;
10
+ const DEFAULT_CODEX_CLI_MODEL = 'gpt-5.4-mini';
10
11
  const DEFAULT_CODEX_CLI_REASONING_EFFORT = 'low';
11
12
  const STDERR_LIMIT = 32 * 1024;
12
13
  const STDOUT_LIMIT = 64 * 1024;
@@ -73,7 +74,7 @@ export function createCodexCliAuditorBackend({
73
74
  env,
74
75
  spawnFn,
75
76
  timeoutMs,
76
- model: env?.SPOTTER_CODEX_CLI_MODEL,
77
+ model: env?.SPOTTER_CODEX_CLI_MODEL || DEFAULT_CODEX_CLI_MODEL,
77
78
  reasoningEffort: env?.SPOTTER_CODEX_CLI_REASONING_EFFORT || DEFAULT_CODEX_CLI_REASONING_EFFORT,
78
79
  });
79
80
  let rawFinal;
@@ -146,7 +147,7 @@ export function buildCodexCliAuditorPrompt({ catalog, input }) {
146
147
  return lines.join('\n');
147
148
  }
148
149
 
149
- export function buildCodexExecArgs({ schemaPath, lastMessagePath, projectRoot, prompt, model = '', reasoningEffort = DEFAULT_CODEX_CLI_REASONING_EFFORT }) {
150
+ export function buildCodexExecArgs({ schemaPath, lastMessagePath, projectRoot, prompt, model = DEFAULT_CODEX_CLI_MODEL, reasoningEffort = DEFAULT_CODEX_CLI_REASONING_EFFORT }) {
150
151
  for (const [name, value] of Object.entries({ schemaPath, lastMessagePath, projectRoot, prompt })) {
151
152
  if (typeof value !== 'string' || value.length === 0) {
152
153
  throw new TypeError(`buildCodexExecArgs: ${name} must be a non-empty string`);