rebut-mcp 0.1.0 → 0.2.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 (41) hide show
  1. package/README.en.md +32 -24
  2. package/README.ja.md +32 -24
  3. package/README.md +33 -24
  4. package/README.zh-CN.md +32 -24
  5. package/bin/rebut.mjs +1 -1
  6. package/docs/guide/en/architecture.md +9 -0
  7. package/docs/guide/en/configuration.md +6 -4
  8. package/docs/guide/en/installation.md +25 -24
  9. package/docs/guide/en/operations.md +21 -0
  10. package/docs/guide/en/reviewer-integration.md +8 -8
  11. package/docs/guide/en/validation.md +13 -0
  12. package/docs/guide/en.md +2 -2
  13. package/docs/guide/ja/architecture.md +9 -0
  14. package/docs/guide/ja/configuration.md +6 -4
  15. package/docs/guide/ja/installation.md +25 -24
  16. package/docs/guide/ja/operations.md +21 -0
  17. package/docs/guide/ja/reviewer-integration.md +8 -8
  18. package/docs/guide/ja/validation.md +13 -0
  19. package/docs/guide/ja.md +2 -2
  20. package/docs/guide/ko/architecture.md +9 -0
  21. package/docs/guide/ko/configuration.md +6 -4
  22. package/docs/guide/ko/installation.md +25 -24
  23. package/docs/guide/ko/operations.md +21 -0
  24. package/docs/guide/ko/reviewer-integration.md +8 -8
  25. package/docs/guide/ko/validation.md +13 -0
  26. package/docs/guide/ko.md +2 -2
  27. package/docs/guide/zh-CN/architecture.md +9 -0
  28. package/docs/guide/zh-CN/configuration.md +6 -4
  29. package/docs/guide/zh-CN/installation.md +25 -24
  30. package/docs/guide/zh-CN/operations.md +21 -0
  31. package/docs/guide/zh-CN/reviewer-integration.md +8 -8
  32. package/docs/guide/zh-CN/validation.md +13 -0
  33. package/docs/guide/zh-CN.md +2 -2
  34. package/docs/releases/0.1.0.ko.md +43 -0
  35. package/docs/releases/0.2.0.ko.md +72 -0
  36. package/docs/releases/release-checklist.ko.md +35 -0
  37. package/lib/cli.mjs +1244 -112
  38. package/migrations/0001_ledger.sql +20 -0
  39. package/migrations/0002_profiles.sql +6 -0
  40. package/package.json +11 -6
  41. package/src/contracts.ts +19 -0
package/README.en.md CHANGED
@@ -2,56 +2,64 @@
2
2
 
3
3
  # Rebut
4
4
 
5
- **Independent, evidence-grounded reviews through the OpenAI Responses API.**
5
+ **Local-first independent code review MCP. Cloudflare Worker is optional.**
6
6
 
7
7
  [한국어](README.md) · **English** · [简体中文](README.zh-CN.md) · [日本語](README.ja.md)
8
8
 
9
- **An authenticated Cloudflare Worker MCP that reviews the frozen material you explicitly provide.**
10
-
11
9
  </div>
12
10
 
13
- Rebut is an **opt-in reviewer**. It does not replace an existing Claude/Gemini workflow or automatically call three reviewers. MIT licensed; deploy with your own Cloudflare account and OpenAI key. Source publication and a personal paid deployment are separate actions.
11
+ Rebut reviews code using your own OpenAI API key. New installations run a local stdio server without a Cloudflare account or a separate HTTP daemon.
12
+
13
+ Review material is sent to the OpenAI API; the local ledger stores only request and usage metadata.
14
+
15
+ The tested release targets macOS/Linux; Windows behavior and ACLs are not validated.
14
16
 
15
17
  ## Quick start
16
18
 
17
- Requires **Node.js 24 or later**. Install the npm CLI and configure your own deployed Worker:
19
+ Use Node.js 24 or later. This example uses macOS Keychain.
18
20
 
19
21
  ```sh
20
22
  npm install -g rebut-mcp
21
- rebut set endpoint https://YOUR_HOST/mcp
22
- rebut set token
23
+ rebut set api-key
23
24
  rebut setup --client codex
24
- rebut doctor
25
25
  rebut doctor --connect
26
26
  ```
27
27
 
28
- On macOS, `rebut set token` uses a hidden interactive prompt and stores the bearer in Keychain by default. Never pass a token as an argument. See [installation](docs/guide/en/installation.md) for explicit Vaultwarden/env backends and Codex migration options.
28
+ `rebut set api-key` accepts hidden OpenAI API key input and stores it in Keychain. On Linux and other environments, select `rebut set secret-store env` and supply `REBUT_OPENAI_API_KEY` through the actual MCP host’s secure environment. Setup records the variable name only; never put keys in arguments or tracked files.
29
29
 
30
- `rebut-mcp` (initial CLI version `0.1.0`, executable `rebut`) is a client and stdio bridge for a **self-hosted Worker**. Deploy Worker/D1 from a GitHub source checkout with your own Cloudflare account and OpenAI key. Public source or the npm package grants no access to a personal Worker or credits. The package contains no real endpoint, private config, bearer, provider key, or reviews. These instructions target CLI `0.1.0`.
30
+ ## Optional Worker
31
31
 
32
- Keep developer validation in the source checkout:
32
+ Choose a self-hosted Worker when multiple machines need a shared budget and request ledger. `rebut set endpoint URL` selects Worker mode. On macOS, `rebut set token` stores the separate Worker access token. The OpenAI API key, Worker access token and admin token are different credentials.
33
33
 
34
34
  ```sh
35
- npm ci
36
- npm run typecheck
37
- npm run build
38
- npm test
35
+ rebut set endpoint https://YOUR_HOST/mcp
36
+ rebut setup --client codex --replace
39
37
  ```
40
38
 
41
- Automated tests mock the provider and make no paid model calls. Actual API tests use **gpt-6-luna**; production uses **gpt-6-astra / medium**. Luna results do not establish Astra availability or equivalent review quality. Worker deployment requires D1 and the secrets `OPENAI_API_KEY`, `REBUT_CONFIG`, and `AUTH_TOKENS`; follow [installation and private deployment](docs/guide/en/installation.md).
42
-
43
- Choose local defaults with `rebut set model MODEL_ID`, `rebut set reasoning EFFORT`, or `rebut set profile PROFILE_ID`. Preferences resolve server-allowlisted profiles for new collection; explicit `collect --profile` wins, and `review` keeps the frozen bundle profile. With no preferences the default is `astra-medium`. `rebut profile list` reads authenticated server model/rate metadata without a provider call. Owners can manage profiles in D1 after a one-time Worker upgrade, migration `0002`, and separate admin credential setup; see [configuration](docs/guide/en/configuration.md).
39
+ Existing endpoint configurations remain in Worker mode. Switch explicitly with `rebut set mode local`; failures never trigger automatic backend fallback. Switching does not move existing requests or reservations.
44
40
 
45
41
  ## What it does
46
42
 
47
- - Collects explicitly allowed text sources, removes common secret patterns, and hashes frozen evidence. Inspect redaction before sending.
48
- - Checks authentication, an allowlisted profile, duplicate request IDs and a deployment-wide atomic budget reservation before one bounded Responses call.
49
- - Returns structured findings with supplied file/line evidence, model identity, token usage and estimated cost.
50
- - Exposes `review` and metadata-only `review_status`. After timeout/unknown, keep the same request ID; the server never automatically creates a replacement paid call.
43
+ - Collect, redact and freeze explicitly supplied files, diffs and requirements, then make one provider call.
44
+ - Use atomic budget reservations and deduplication in local SQLite or Worker D1. Source, reviews and keys are not stored in the ledger.
45
+ - Return structured findings with supplied file/line evidence, model identity, usage and estimated cost.
46
+ - Expose review and metadata-only review_status. Keep the same ID after uncertainty and do not replay an unknown on another backend.
51
47
 
52
- The example limits are **$6.66 per UTC day**, **$200 per UTC month**, one pending/unknown request at a time, and 100 new review requests/day. The ledger tracks Rebut, not the account-wide credit balance. Unknown execution retains its reservation. Review bodies are not replayable; save the initial response locally.
48
+ Example defaults are $6.66/day and $200/month in UTC, one pending/unknown request, and 100 new requests/day. **Local limits cover only that device’s data directory**: they do not aggregate another Mac, Worker, external API usage or the OpenAI account balance. Worker users share that deployment’s ledger. Estimates are not invoices; uncertain executions keep their reservations and slots.
49
+
50
+ The provider waiting ceiling is 30 minutes, with corresponding HTTP/MCP and Codex deadlines. Local profile changes require OS ownership; Worker changes use separate admin authentication. See [installation](docs/guide/en/installation.md) and [configuration](docs/guide/en/configuration.md) for credentials, models, budgets and optional Worker deployment.
51
+
52
+ ## Developer validation
53
+
54
+ ```sh
55
+ npm ci --ignore-scripts
56
+ npm run typecheck
57
+ npm run build
58
+ npm test
59
+ npm run test:package
60
+ ```
53
61
 
54
- The reviewer cannot clone repositories, fetch arbitrary URLs, execute commands/tests, edit files, or create pull requests. Source, review bodies and keys are not stored in D1 or Worker logs. `store:false` is not a zero-retention guarantee for the provider.
62
+ Automated tests and package smoke tests mock the provider. Default real API tests use gpt-6-luna; production uses gpt-6-astra / medium. Luna success does not establish Astra review quality.
55
63
 
56
64
  ## Documentation
57
65
 
package/README.ja.md CHANGED
@@ -2,56 +2,64 @@
2
2
 
3
3
  # Rebut
4
4
 
5
- **OpenAI Responses API による、証拠に基づく独立したレビュー。**
5
+ **ローカル実行を標準とする独立コードレビューMCP。Cloudflare Workerは任意です。**
6
6
 
7
7
  [한국어](README.md) · [English](README.en.md) · [简体中文](README.zh-CN.md) · **日本語**
8
8
 
9
- **明示的に提供された確定済みの資料をレビューする、認証付き Cloudflare Worker MCP。**
10
-
11
9
  </div>
12
10
 
13
- Rebut は**明示的に選択して利用するレビュアー**です。既存の Claude/Gemini ワークフローを置き換えたり、3 つのレビュアーを自動で呼び出したりしません。MIT ライセンスで提供され、自分の Cloudflare アカウントと OpenAI キーでデプロイします。ソースの公開と個人用の有料デプロイは、それぞれ別の操作です。
11
+ Rebutは自分のOpenAI APIキーでコードをレビューします。新規インストールはローカルstdioサーバーとして動作し、Cloudflareアカウントや別のHTTPデーモンは不要です。
12
+
13
+ レビュー資料はOpenAI APIへ送信し、ローカル台帳には要求・使用量メタデータのみ保存します。
14
+
15
+ 検証対象はmacOS/Linuxで、Windows動作・ACLは未検証です。
14
16
 
15
17
  ## クイックスタート
16
18
 
17
- **Node.js 24 以降**が必要です。npm CLI をインストールし、自分でデプロイした Worker を設定します。
19
+ Node.js 24以降が必要です。以下はmacOS Keychainを使う例です。
18
20
 
19
21
  ```sh
20
22
  npm install -g rebut-mcp
21
- rebut set endpoint https://YOUR_HOST/mcp
22
- rebut set token
23
+ rebut set api-key
23
24
  rebut setup --client codex
24
- rebut doctor
25
25
  rebut doctor --connect
26
26
  ```
27
27
 
28
- macOS の `rebut set token` は入力を隠す対話型プロンプトを使い、既定では Bearer トークンを Keychain に保存します。トークンを引数で渡さないでください。Vaultwarden/env バックエンドの明示的な選択と Codex 移行オプションは[インストール手順](docs/guide/ja/installation.md)を参照してください。
28
+ `rebut set api-key` はOpenAI APIキーを非表示入力で受け取りKeychainに保存します。Linux等では `rebut set secret-store env` を選び、実際のMCPホストの安全な環境で `REBUT_OPENAI_API_KEY` を提供してください。登録には変数名だけを記録し、キーを引数や追跡対象ファイルに書きません。
29
29
 
30
- `rebut-mcp`(初期 CLI バージョン `0.1.0`、実行コマンド `rebut`)は**セルフホストした Worker**のクライアントと stdio ブリッジです。Worker/D1 は引き続き GitHub のソースチェックアウトから、自分の Cloudflare アカウントと OpenAI キーでデプロイします。公開ソースや npm パッケージは、個人の Worker やクレジットへのアクセスを付与しません。パッケージに実際のエンドポイント、非公開設定、Bearer、プロバイダーキー、レビュー本文は含まれません。この手順は CLI `0.1.0` を対象としています。
30
+ ## 任意のWorker
31
31
 
32
- 開発者向けの検証はソースチェックアウトで実行します。
32
+ 複数端末で予算と要求台帳を共有する場合はセルフホストのWorkerを選べます。`rebut set endpoint URL` はWorkerモードを選択します。macOSでは `rebut set token` で別のWorker接続トークンを保存します。OpenAI APIキー・Worker接続トークン・管理者トークンは別の資格情報です。
33
33
 
34
34
  ```sh
35
- npm ci
36
- npm run typecheck
37
- npm run build
38
- npm test
35
+ rebut set endpoint https://YOUR_HOST/mcp
36
+ rebut setup --client codex --replace
39
37
  ```
40
38
 
41
- 自動テストはプロバイダーをモックし、有料モデルを呼び出しません。実際の API テストには **gpt-6-luna**、本番には **gpt-6-astra / medium** を使います。Luna の結果は Astra の利用可否や同等のレビュー品質を実証しません。Worker には D1 と `OPENAI_API_KEY`、`REBUT_CONFIG`、`AUTH_TOKENS` のシークレットが必要です。[インストールと非公開デプロイ](docs/guide/ja/installation.md)に従ってください。
42
-
43
- `rebut set model MODEL_ID`、`rebut set reasoning EFFORT`、`rebut set profile PROFILE_ID` でローカルの既定値を選びます。新しい収集ではサーバーの許可リスト内のプロファイルに解決され、明示的な `collect --profile` が優先し、`review` は確定済みバンドルのプロファイルを保持します。設定がなければ `astra-medium` です。`rebut profile list` はプロバイダーを呼ばず、認証付きでサーバーのモデルと料金のメタデータを読み取ります。所有者は一度限りの Worker 更新、マイグレーション `0002`、別の管理認証情報の設定後に D1 でプロファイルを管理できます。[設定](docs/guide/ja/configuration.md)を参照してください。
39
+ 既存endpoint設定はWorkerモードを維持します。`rebut set mode local` で明示的に切り替え、障害時の自動切り替えはしません。切り替えても既存の要求や予約は移行されません。
44
40
 
45
41
  ## 主な機能
46
42
 
47
- - 明示的に許可したテキストソースを収集し、一般的なシークレットのパターンを除去して、確定済みの証拠のハッシュを計算します。送信前にマスキング結果を確認してください。
48
- - 認証、許可リスト内のプロファイル、リクエスト ID の重複、デプロイ全体のアトミックな予算予約を確認してから、制限付きの Responses 呼び出しを 1 回実行します。
49
- - 提供されたファイルと行に基づく証拠、モデル情報、トークン使用量、推定費用を含む構造化された指摘を返します。
50
- - `review` と、メタデータのみを返す `review_status` を公開します。タイムアウトや結果不明の後も同じリクエスト ID を使ってください。サーバーは代わりの有料呼び出しを自動で作成しません。
43
+ - 明示されたファイル・diff・要件だけを収集・秘匿処理・固定し、プロバイダーを1回呼び出します。
44
+ - ローカルSQLiteまたはWorker D1で原子的な予算予約と重複排除を行い、原文・レビュー本文・キーは台帳に保存しません。
45
+ - 指定ファイル・行の根拠、モデル識別、使用量、推定費用を含む構造化された指摘を返します。
46
+ - reviewとメタデータ専用review_statusを提供します。不確かな結果後は同じIDを維持し、unknownを別backendで再実行しません。
51
47
 
52
- 設定例の上限は **UTC の 1 日あたり $6.66**、**UTC の 1 か月あたり $200**、保留中または結果不明のリクエストは同時に 1 件、新規レビューリクエストは 1 日あたり 100 件です。台帳は Rebut の利用を追跡し、アカウント全体のクレジット残高は追跡しません。実行結果が不明な場合は予約を保持します。レビュー本文は再取得できないため、最初のレスポンスをローカルに保存してください。
48
+ 既定例はUTCで日額$6.66・月額$200、pending/unknown同時1件、日100件の新規要求です。**ローカル制限はその端末のデータディレクトリのみが対象**で、別のMac・Worker・外部API・OpenAIアカウント残高は合算しません。Worker利用者はそのデプロイの台帳を共有します。推定は請求書ではなく、不確かな実行の予約と枠は保持します。
49
+
50
+ プロバイダー待機上限は30分で、HTTP/MCP・Codexの期限も合わせます。ローカルプロファイルはOS所有者、Workerは別の管理者認証で管理します。資格情報・モデル・予算・任意のWorkerデプロイは[インストール](docs/guide/ja/installation.md)と[設定](docs/guide/ja/configuration.md)を参照してください。
51
+
52
+ ## 開発者向け検証
53
+
54
+ ```sh
55
+ npm ci --ignore-scripts
56
+ npm run typecheck
57
+ npm run build
58
+ npm test
59
+ npm run test:package
60
+ ```
53
61
 
54
- レビュアーは、リポジトリのクローン、任意の URL の取得、コマンドやテストの実行、ファイルの編集、プルリクエストの作成を行えません。ソース、レビュー本文、キーは D1 や Worker のログに保存されません。`store:false` は、プロバイダーによるデータ保持がゼロであることを保証しません。
62
+ 自動テストとパッケージsmokeはプロバイダーを模擬します。既定の実APIテストはgpt-6-luna、運用はgpt-6-astra / mediumです。Lunaの成功はAstraのレビュー品質を証明しません。
55
63
 
56
64
  ## ドキュメント
57
65
 
package/README.md CHANGED
@@ -2,56 +2,64 @@
2
2
 
3
3
  # Rebut
4
4
 
5
- **OpenAI Responses API를 통한 독립적이고 근거에 기반한 검토.**
5
+ **로컬에서 바로 실행하는 독립 코드 검토 MCP. Cloudflare Worker는 선택 사항입니다.**
6
6
 
7
7
  **한국어** · [English](README.en.md) · [简体中文](README.zh-CN.md) · [日本語](README.ja.md)
8
8
 
9
- **명시적으로 제공한 고정 자료를 검토하는 인증 기반 Cloudflare Worker MCP.**
10
-
11
9
  </div>
12
10
 
13
- Rebut은 **명시적으로 선택하여 사용하는 검토 도구**입니다. 기존 Claude/Gemini 작업 흐름을 대체하거나 검토자 세 명을 자동으로 호출하지 않습니다. MIT 라이선스로 제공되며, 자신의 Cloudflare 계정과 OpenAI 키로 배포합니다. 소스 공개와 개인 유료 배포는 별개의 작업입니다.
11
+ Rebut은 자신의 OpenAI API 키로 실행하는 코드 검토 도구입니다. 새 설치는 로컬 stdio 서버를 사용하며 Cloudflare 계정이나 별도 HTTP 서버가 필요하지 않습니다.
12
+
13
+ 검토 자료는 OpenAI API로 전송하며, 로컬 원장에는 요청·사용량 메타데이터만 저장합니다.
14
+
15
+ 검증 대상은 macOS/Linux이며 Windows 동작·ACL은 확인하지 않았습니다.
14
16
 
15
17
  ## 빠른 시작
16
18
 
17
- **Node.js 24 이상**이 필요합니다. npm CLI를 설치하고 직접 배포한 Worker를 설정합니다.
19
+ Node.js 24 이상이 필요합니다. 다음은 macOS Keychain을 사용하는 예입니다.
18
20
 
19
21
  ```sh
20
22
  npm install -g rebut-mcp
21
- rebut set endpoint https://YOUR_HOST/mcp
22
- rebut set token
23
+ rebut set api-key
23
24
  rebut setup --client codex
24
- rebut doctor
25
25
  rebut doctor --connect
26
26
  ```
27
27
 
28
- macOS에서 `rebut set token`은 입력을 숨기는 대화형 프롬프트로 bearer를 받아 기본 Keychain에 저장합니다. 토큰을 인자로 전달하지 마세요. 명시적인 Vaultwarden/env 백엔드와 Codex 마이그레이션 옵션은 [설치 안내](docs/guide/ko/installation.md)를 참고하세요.
28
+ `rebut set api-key`는 OpenAI API 키를 숨김 입력으로 받아 Keychain에 저장합니다. Linux 등에서는 `rebut set secret-store env`를 선택하고 실제 MCP 호스트의 안전한 환경에 `REBUT_OPENAI_API_KEY`를 제공하세요. 설정에는 변수명만 기록하며 키를 인자나 추적 파일에 넣지 않습니다.
29
29
 
30
- `rebut-mcp`(초기 CLI 버전 `0.1.0`, 실행 명령 `rebut`)는 **직접 호스팅한 Worker**의 클라이언트이자 stdio 브리지입니다. Worker/D1은 GitHub 소스 체크아웃에서 자신의 Cloudflare 계정과 OpenAI 키로 배포합니다. 공개 소스나 npm 패키지는 개인 Worker 또는 크레딧 접근 권한을 주지 않습니다. 패키지에는 실제 엔드포인트, 비공개 설정, bearer, 공급자 키, 검토 본문이 포함되지 않습니다. 이 안내는 CLI `0.1.0`을 대상으로 합니다.
30
+ ## Worker 선택
31
31
 
32
- 개발자 검증은 소스 체크아웃에서 수행합니다.
32
+ 여러 기기가 하나의 예산과 요청 장부를 공유하려면 직접 호스팅한 Worker를 선택할 수 있습니다. `rebut set endpoint URL`은 Worker 모드를 선택합니다. macOS에서는 `rebut set token`으로 별도의 Worker 접속 토큰을 저장합니다. OpenAI API 키와 접속·관리자 토큰은 서로 다른 자격증명입니다.
33
33
 
34
34
  ```sh
35
- npm ci
36
- npm run typecheck
37
- npm run build
38
- npm test
35
+ rebut set endpoint https://YOUR_HOST/mcp
36
+ rebut setup --client codex --replace
39
37
  ```
40
38
 
41
- 자동화 테스트는 공급자를 모의 처리하며 유료 모델을 호출하지 않습니다. 실제 API 테스트에는 **gpt-6-luna**, 운영에는 **gpt-6-astra / medium**을 사용합니다. Luna 결과로 Astra의 사용 가능 여부나 동등한 검토 품질을 입증할 수는 없습니다. Worker 배포에는 D1과 `OPENAI_API_KEY`, `REBUT_CONFIG`, `AUTH_TOKENS` 시크릿이 필요합니다. [설치 및 비공개 배포](docs/guide/ko/installation.md)를 따르세요.
42
-
43
- `rebut set model MODEL_ID`, `rebut set reasoning EFFORT`, `rebut set profile PROFILE_ID`로 로컬 기본값을 선택합니다. 새 수집에서 서버 허용 목록의 프로필을 찾으며 명시적인 `collect --profile`이 우선하고 `review`는 고정 번들의 프로필을 유지합니다. 환경설정이 없으면 `astra-medium`입니다. `rebut profile list`는 공급자 호출 없이 인증된 서버 모델·요금 메타데이터를 조회합니다. 소유자는 일회성 Worker 업그레이드, 마이그레이션 `0002`, 별도 관리자 자격증명 설정 뒤 D1에서 프로필을 관리할 수 있습니다. [설정](docs/guide/ko/configuration.md)을 참고하세요.
39
+ 기존 endpoint 설정은 Worker 모드로 유지됩니다. `rebut set mode local`로 명시적으로 전환할 수 있으며 장애 시 다른 backend로 자동 대체하지 않습니다. backend 전환은 기존 기록이나 예약을 이전하지 않습니다.
44
40
 
45
41
  ## 주요 기능
46
42
 
47
- - 명시적으로 허용한 텍스트 소스를 수집하고, 흔한 비밀정보 패턴을 제거한 뒤 고정한 증거 자료의 해시를 계산합니다. 전송 전에 마스킹 결과를 확인하세요.
48
- - 인증, 허용 목록의 프로필, 중복 요청 ID, 배포 전체의 원자적 예산 예약을 확인한 뒤 한도가 설정된 Responses 호출을 한 번 수행합니다.
49
- - 제공한 파일·행 근거, 모델 식별 정보, 토큰 사용량, 예상 비용을 포함한 구조화된 지적 사항을 반환합니다.
50
- - `review`와 메타데이터만 제공하는 `review_status`를 노출합니다. 시간 초과 또는 unknown 이후에도 같은 요청 ID를 유지하세요. 서버는 대체 유료 호출을 자동으로 만들지 않습니다.
43
+ - 명시한 파일·diff·요구사항만 수집·마스킹·해시 고정하고 공급자를 한 번 호출합니다.
44
+ - 로컬 SQLite 또는 Worker D1에서 원자적 예산 예약과 요청 중복 방지를 적용합니다. 원문·리뷰·키는 장부에 저장하지 않습니다.
45
+ - 파일·행 근거, 모델 식별, 사용량, 예상 비용을 포함한 구조화된 검토 결과를 반환합니다.
46
+ - `review`와 메타데이터 전용 `review_status`를 제공합니다. unknown 이후 같은 ID를 유지하며 다른 backend로 우회 재실행하지 않습니다.
51
47
 
52
- 예시 한도는 **UTC 기준 하루 $6.66**, **UTC 기준 한 달 $200**, 동시 pending/unknown 요청 한 개, 하루 신규 검토 요청 100개입니다. 원장은 Rebut 사용량을 추적하며 계정 전체의 크레딧 잔액을 추적하지 않습니다. 실행 결과를 알 수 없으면 예약을 유지합니다. 검토 본문은 다시 조회할 수 없으므로 최초 응답을 로컬에 저장하세요.
48
+ 기본 예시는 UTC 하루 $6.66·월 $200, 동시 pending/unknown 한 건, 하루 신규 요청 100건입니다. **로컬 한도는 해당 기기의 데이터 디렉터리에만 적용**됩니다. 다른 Mac·Worker·외부 API 사용량이나 OpenAI 계정 잔액을 합산하지 않습니다. Worker는 해당 배포의 장부를 공유합니다. 예상 비용은 청구서가 아니며 불확실한 실행의 예약과 슬롯은 유지합니다.
49
+
50
+ 공급자 대기 상한은 30분이며 HTTP/MCP·Codex의 외부 제한도 함께 조정합니다. 로컬 프로필은 OS 소유자가, Worker 프로필은 별도 관리자 인증으로 관리합니다. 자세한 키 설정·모델·예산·Worker 배포는 [설치](docs/guide/ko/installation.md)와 [설정](docs/guide/ko/configuration.md)을 참고하세요.
51
+
52
+ ## 개발 검증
53
+
54
+ ```sh
55
+ npm ci --ignore-scripts
56
+ npm run typecheck
57
+ npm run build
58
+ npm test
59
+ npm run test:package
60
+ ```
53
61
 
54
- 검토자는 저장소 복제, 임의 URL 가져오기, 명령·테스트 실행, 파일 수정, 풀 리퀘스트 생성을 할 수 없습니다. 소스, 검토 본문, 키는 D1이나 Worker 로그에 저장하지 않습니다. `store:false`는 공급자의 보관 기간이 0임을 보장하지 않습니다.
62
+ 자동화 테스트와 패키지 smoke는 공급자를 모의 처리합니다. 기본 실제 API 테스트는 gpt-6-luna, 운영 프로필은 gpt-6-astra / medium이며 Luna 성공으로 Astra 품질을 추론하지 않습니다.
55
63
 
56
64
  ## 문서
57
65
 
@@ -62,4 +70,5 @@ npm test
62
70
  - [선택적 검토자 연동](docs/guide/ko/reviewer-integration.md)
63
71
  - [아키텍처](docs/guide/ko/architecture.md)
64
72
  - [검증 및 결과의 한계](docs/guide/ko/validation.md)
73
+ - [최초 릴리즈 기록](docs/releases/0.1.0.ko.md) · [0.2.0 릴리즈 후보](docs/releases/0.2.0.ko.md)
65
74
  - [MIT 라이선스](LICENSE)
package/README.zh-CN.md CHANGED
@@ -2,56 +2,64 @@
2
2
 
3
3
  # Rebut
4
4
 
5
- **通过 OpenAI Responses API 提供独立、基于证据的审查。**
5
+ **默认本地运行的独立代码审查 MCP,可选 Cloudflare Worker。**
6
6
 
7
7
  [한국어](README.md) · [English](README.en.md) · **简体中文** · [日本語](README.ja.md)
8
8
 
9
- **一个经过身份验证的 Cloudflare Worker MCP,仅审查您明确提供并已冻结的材料。**
10
-
11
9
  </div>
12
10
 
13
- Rebut 是一个**需要明确选择启用的审查器**。它不会替代现有的 Claude/Gemini 工作流,也不会自动调用三个审查器。采用 MIT 许可证;使用您自己的 Cloudflare 账户和 OpenAI 密钥部署。公开源代码与部署个人付费服务是两个独立的操作。
11
+ Rebut 使用您自己的 OpenAI API 密钥审查代码。新安装默认运行本地 stdio 服务器,无需 Cloudflare 账户或独立 HTTP 守护进程。
12
+
13
+ 审查资料会发送至 OpenAI API;本地账本仅存储请求和用量元数据。
14
+
15
+ 验证目标为 macOS/Linux,Windows 行为与 ACL 未验证。
14
16
 
15
17
  ## 快速开始
16
18
 
17
- 需要 **Node.js 24 或更高版本**。安装 npm CLI,并配置您自行部署的 Worker:
19
+ 需要 Node.js 24 或更高版本。以下示例使用 macOS Keychain。
18
20
 
19
21
  ```sh
20
22
  npm install -g rebut-mcp
21
- rebut set endpoint https://YOUR_HOST/mcp
22
- rebut set token
23
+ rebut set api-key
23
24
  rebut setup --client codex
24
- rebut doctor
25
25
  rebut doctor --connect
26
26
  ```
27
27
 
28
- 在 macOS 上,`rebut set token` 使用隐藏输入的交互式提示,默认将 Bearer 令牌保存在 Keychain 中。绝不要将令牌作为参数传递。明确选择 Vaultwarden/env 后端及 Codex 迁移选项见[安装指南](docs/guide/zh-CN/installation.md)。
28
+ `rebut set api-key` 隐藏输入 OpenAI API 密钥并存入 Keychain。Linux 等环境请选择 `rebut set secret-store env`,通过实际 MCP 宿主的安全环境提供 `REBUT_OPENAI_API_KEY`。配置仅记录变量名,不要把密钥写入参数或受版本控制的文件。
29
29
 
30
- `rebut-mcp`(初始 CLI 版本 `0.1.0`,命令 `rebut`)是**自托管 Worker**的客户端和 stdio 桥接程序。Worker/D1 仍需从 GitHub 源代码检出目录使用您自己的 Cloudflare 账户和 OpenAI 密钥部署。公开源代码或 npm 包不会授予个人 Worker 或额度的访问权限。包中不包含真实端点、私有配置、Bearer 令牌、提供商密钥或审查正文。这些说明适用于 CLI `0.1.0`。
30
+ ## 可选 Worker
31
31
 
32
- 开发者验证仍在源代码检出目录中执行:
32
+ 多台设备需要共享预算和请求账本时,可选择自托管 Worker。`rebut set endpoint URL` 会选择 Worker 模式。macOS 可通过 `rebut set token` 保存独立的 Worker 访问令牌。OpenAI API 密钥、Worker 访问令牌和管理员令牌是不同凭据。
33
33
 
34
34
  ```sh
35
- npm ci
36
- npm run typecheck
37
- npm run build
38
- npm test
35
+ rebut set endpoint https://YOUR_HOST/mcp
36
+ rebut setup --client codex --replace
39
37
  ```
40
38
 
41
- 自动化测试模拟提供商,不会进行付费模型调用。真实 API 测试使用 **gpt-6-luna**,生产使用 **gpt-6-astra / medium**。Luna 结果不能证明 Astra 可用或审查质量相当。Worker 部署需要 D1 及 `OPENAI_API_KEY`、`REBUT_CONFIG`、`AUTH_TOKENS` 三个 Secret;请按照[安装与私有部署](docs/guide/zh-CN/installation.md)操作。
42
-
43
- 使用 `rebut set model MODEL_ID`、`rebut set reasoning EFFORT` 或 `rebut set profile PROFILE_ID` 选择本地默认值。新收集时偏好会匹配服务器允许列表的配置方案;显式 `collect --profile` 优先,`review` 保留冻结输入包中的配置方案。无偏好时默认为 `astra-medium`。`rebut profile list` 无需调用提供商即可读取经过身份验证的服务器模型/费率元数据。所有者完成一次 Worker 升级、迁移 `0002` 及单独管理凭据设置后,可在 D1 中管理配置方案;见[配置](docs/guide/zh-CN/configuration.md)。
39
+ 已有 endpoint 配置继续使用 Worker 模式。通过 `rebut set mode local` 明确切换;失败不会自动切换后端。切换不会迁移已有请求或预留。
44
40
 
45
41
  ## 功能
46
42
 
47
- - 收集明确允许的文本来源,移除常见的秘密信息模式,并对冻结的证据计算哈希。发送前请检查脱敏结果。
48
- - 在进行一次受限的 Responses 调用之前,检查身份验证、允许列表中的配置、重复请求 ID,以及部署范围内的原子预算预留。
49
- - 返回结构化发现,包含所提供文件和行的证据、模型身份、令牌用量及估算费用。
50
- - 提供 `review` 和仅返回元数据的 `review_status`。超时或结果未知后,请保留同一个请求 ID;服务器绝不会自动创建替代的付费调用。
43
+ - 仅收集、脱敏并冻结明确提供的文件、diff 和要求,再调用供应商一次。
44
+ - 在本地 SQLite 或 Worker D1 中进行原子预算预留和去重;账本不存储源码、审查正文或密钥。
45
+ - 返回结构化发现、给定文件及行号证据、模型标识、用量与预估成本。
46
+ - 提供 review 和仅元数据的 review_status。不确定后保留同一 ID,不在另一后端重放 unknown 请求。
51
47
 
52
- 示例限制为:**每个 UTC 日 $6.66**、**每个 UTC 月 $200**、同一时间仅允许一个待处理/结果未知的请求,以及每天 100 个新的审查请求。账本仅跟踪 Rebut,不代表整个账户的余额。执行结果未知时会保留预算预留。审查正文无法重放;请将首次响应保存在本地。
48
+ 默认示例为 UTC 每日 $6.66、每月 $200、一个 pending/unknown 请求及每日 100 个新请求。**本地限额仅覆盖该设备的数据目录**,不汇总另一台 Mac、Worker、外部 API 或 OpenAI 账户余额。Worker 用户共享该部署的账本。预估不是账单;不确定的执行继续占用预留和并发槽。
49
+
50
+ 供应商等待上限为 30 分钟,并配套调整 HTTP/MCP 和 Codex 期限。本地配置方案由 OS 所有者管理;Worker 变更需要独立管理员认证。凭据、模型、预算与可选部署见[安装](docs/guide/zh-CN/installation.md)和[配置](docs/guide/zh-CN/configuration.md)。
51
+
52
+ ## 开发者验证
53
+
54
+ ```sh
55
+ npm ci --ignore-scripts
56
+ npm run typecheck
57
+ npm run build
58
+ npm test
59
+ npm run test:package
60
+ ```
53
61
 
54
- 审查器不能克隆仓库、获取任意 URL、执行命令或测试、编辑文件,也不能创建拉取请求。源代码、审查正文和密钥不会存储在 D1 或 Worker 日志中。`store:false` 不保证提供商零保留数据。
62
+ 自动化测试与包 smoke 测试模拟供应商。默认真实 API 测试使用 gpt-6-luna,生产使用 gpt-6-astra / medium。Luna 成功不证明 Astra 的审查质量。
55
63
 
56
64
  ## 文档
57
65
 
package/bin/rebut.mjs CHANGED
@@ -2,5 +2,5 @@
2
2
  import { runCli, safeError } from "../lib/cli.mjs";
3
3
  runCli(process.argv.slice(2)).catch((error) => {
4
4
  process.stderr.write(safeError(error) + "\n");
5
- process.exitCode = 1;
5
+ if (!process.exitCode) process.exitCode = 1;
6
6
  });
@@ -4,6 +4,15 @@
4
4
 
5
5
  [Rebut](../../../README.en.md) · [User guide](../en.md)
6
6
 
7
+ ## Local and Worker execution
8
+
9
+ New installations use local stdio MCP → the shared review service → private SQLite reservation → one OpenAI Responses call → validation and metadata settlement. No Cloudflare account, local HTTP port or daemon is required. Explicit Worker mode retains authenticated HTTP MCP → D1 → the same provider adapter.
10
+
11
+ src/service.ts owns hash/profile selection, request ownership and settlement; src/review.ts owns provider and evidence validation; src/local.ts adapts Node SQLite and stdio; src/worker.ts retains HTTP authentication and D1 bindings. Local provider keys, Worker access tokens and admin tokens are separate. Neither ledger stores source, review bodies or keys. Local budgets and IDs cover only one local directory; Worker principals share one deployment. Switching backends does not migrate history or authorize replay of an uncertain request.
12
+
13
+ The existing Worker-specific path and references follow.
14
+
15
+
7
16
  Client explicit allowlist → redact/freeze/hash → authenticated Streamable HTTP MCP → validated profile/hash → atomic D1 reservation → one bounded Responses call → schema/evidence/usage validation → metadata settlement → return review to client.
8
17
 
9
18
  The host-independent contract and provider adapter live in `src/contracts.ts` and `src/review.ts`; `src/worker.ts` supplies MCP/authentication and `src/ledger.ts` supplies the D1 adapter. Cloudflare's per-request `createMcpHandler` uses MCP SDK v2 and supports legacy stateless clients. Stateful sessions, background tasks, OAuth, model-driven tools, repository access, and persisted review replay are outside this MVP.
@@ -4,13 +4,11 @@
4
4
 
5
5
  [Rebut](../../../README.en.md) · [User guide](../en.md)
6
6
 
7
- ## Local CLI configuration
8
7
 
9
- Install with `npm install -g rebut-mcp`; set the Worker with `rebut set endpoint https://YOUR_HOST/mcp`. macOS defaults to Keychain: `rebut set token` uses hidden interactive input; `rebut set token --stdin` explicitly accepts a protected pipe. Never pass bearer values in argv or tracked files. Select an existing Vaultwarden workflow with `rebut set secret-store vaultwarden`; its default item is `Rebut — MCP Access Token`, configurable with `rebut set vaultwarden-item NAME`. On non-macOS, explicitly use `rebut set secret-store env` and supply `REBUT_TOKEN` via a secure execution environment. There is no automatic backend fallback.
8
+ ## Local profiles and budget scope
10
9
 
11
- For the `env` backend, Codex setup stores only `env_vars = ['REBUT_TOKEN']` (the variable name), never its value. Supply the token in the secure execution environment of the actual Codex host; setting it only for the setup command does not make it available to later Codex sessions.
10
+ New settings use local mode; endpoint-only legacy settings remain Worker. `rebut set api-key` stores a local OpenAI key in Keychain, while Worker `set token` and `set admin-token` store different credentials. env uses REBUT_OPENAI_API_KEY locally, REBUT_TOKEN/REBUT_ADMIN_TOKEN for Worker. Vaultwarden local keys use vaultwarden-api-key-item. `rebut profile list/set/remove` targets the selected backend; local profile changes require no Worker admin token. Local profiles, revisions and metadata are stored in private SQLite. Limits apply to one data directory, not all devices or the OpenAI account. Use a shared Worker for a central ledger. A mode switch does not migrate uncertain requests or release reservations.
12
11
 
13
- `rebut setup --client codex` uses `CODEX_HOME` or `~/.codex`; `--codex-home PATH` selects another home. It registers `rebut mcp`, preserves other MCP entries, and requires `--replace` to migrate an existing private `rebut` bridge. `rebut doctor` shows sanitized local configuration/credential availability; `rebut doctor --connect` checks remote `tools/list` for free. Neither performs a paid review. See [installation](installation.md).
14
12
 
15
13
  ## Model and reasoning preferences
16
14
 
@@ -26,6 +24,10 @@ rebut set profile PROFILE_ID
26
24
 
27
25
  ## Owner-managed server profiles
28
26
 
27
+ Worker mode only: local profile management does not require these admin credentials.
28
+
29
+ The owner/admin instructions in this section apply only to Worker mode. Local profile commands use OS ownership and the local SQLite registry.
30
+
29
31
  `rebut profile list` makes an authenticated, read-only GET to list server profiles, models, reasoning settings, output limits, rates, and revisions. It does not call the provider or start a paid review.
30
32
 
31
33
  ```sh
@@ -4,53 +4,46 @@
4
4
 
5
5
  [Rebut](../../../README.en.md) · [User guide](../en.md)
6
6
 
7
- ## npm CLI installation
8
7
 
9
- Use Node.js **24 or later** and npm. Install the client/stdio bridge for your self-hosted Worker with:
8
+ Use Node.js **24 or later**. New installations default to a local stdio MCP server. No Cloudflare account, Worker endpoint or HTTP daemon is required.
10
9
 
11
10
  ```sh
12
11
  npm install -g rebut-mcp
13
12
  ```
14
13
 
15
- ## Configure the client
14
+ ## Local setup
16
15
 
17
- Set your own endpoint, then store your bearer token. On macOS the default is Keychain; `rebut set token` prompts with hidden input. `rebut set token --stdin` explicitly accepts a protected pipe. Never supply token values as arguments or in tracked files.
16
+ On macOS, `rebut set api-key` takes hidden OpenAI API key input and stores it in the login Keychain. The provider account is `openai-api-key` under `com.abruption.rebut`, separate from the Worker access/admin accounts. `--stdin` accepts a protected pipe; never use credential values as command arguments.
18
17
 
19
18
  ```sh
20
- rebut set endpoint https://YOUR_HOST/mcp
21
- rebut set token
19
+ rebut set api-key
22
20
  ```
23
21
 
24
- For an existing Vaultwarden installation, select the backend explicitly. It uses `bw-get` and the default item `Rebut — MCP Access Token`; customize the item name if needed:
22
+ For environment-backed credentials, select `rebut set secret-store env` and provide `REBUT_OPENAI_API_KEY` in the secure environment of the actual MCP host. Setup records only that variable name. For Vaultwarden, use `rebut set secret-store vaultwarden` and `rebut set vaultwarden-api-key-item NAME`; the default local item is `Rebut — OpenAI API Key`. Existing bw-get login is required. There is no automatic credential or backend fallback.
23
+
24
+ ## Connect and verify
25
25
 
26
26
  ```sh
27
- rebut set secret-store vaultwarden
28
- rebut set vaultwarden-item NAME
27
+ rebut setup --client codex
28
+ rebut doctor --connect
29
29
  ```
30
30
 
31
- On non-macOS, explicitly select `env` and supply `REBUT_TOKEN` through a secure execution environment. Do not write it to tracked files or command arguments. Backends never fall back automatically. The client needs no OpenAI provider key.
31
+ `rebut setup --client codex` registers `rebut mcp` using CODEX_HOME or ~/.codex; select another home with --codex-home PATH. The host starts the server automatically. `doctor --connect` checks local credential availability, SQLite and real MCP tool registration without making a provider call; it does not prove API account access. Local env setup forwards REBUT_OPENAI_API_KEY by name only. Preserve custom REBUT_CONFIG_DIR when replacing a registration.
32
32
 
33
- For the `env` backend, Codex setup stores only `env_vars = ['REBUT_TOKEN']` (the variable name), never its value. Supply the token in the secure execution environment of the actual Codex host; setting it only for the setup command does not make it available to later Codex sessions.
33
+ ## Optional Worker mode
34
34
 
35
- ```sh
36
- rebut set secret-store env
37
- ```
38
-
39
- ## Connect Codex and check configuration
35
+ Setting an endpoint explicitly selects Worker mode. Existing endpoint-only configurations keep Worker mode on upgrade. Worker mode uses its separate MCP access token, not the local OpenAI key: on macOS store it with `rebut set token`; env mode reads REBUT_TOKEN and Vaultwarden uses vaultwarden-item. Admin operations use the separate admin credential. Use the private deployment section below if you need to create a Worker.
40
36
 
41
37
  ```sh
42
- rebut setup --client codex
43
- rebut doctor
44
- rebut doctor --connect
38
+ rebut set endpoint https://YOUR_HOST/mcp
39
+ rebut setup --client codex --replace
45
40
  ```
46
41
 
47
- Setup uses `CODEX_HOME` or `~/.codex`; use `--codex-home PATH` for an explicit destination. It registers `rebut mcp` as the stdio server, preserves other MCP entries, and requires `--replace` to migrate an existing private `rebut` bridge.
48
-
49
- `rebut doctor` reports sanitized local configuration and credential availability. `rebut doctor --connect` makes a free remote `tools/list` check; neither command starts a paid review.
42
+ Use `rebut set mode local` to switch explicitly. No automatic fallback occurs. Backends do not share or migrate request history, reservations or budgets: never replay an unknown against another backend. Local SQLite lives at ~/.local/share/rebut/local/ledger.sqlite, or local/ under a custom REBUT_CONFIG_DIR. Defaults are UTC $6.66/day and $200/month for this data directory only; local budget commands are `set daily-budget`, `set monthly-budget`, and `set request-budget` with decimal USD values. Worker limits remain deployment configuration.
50
43
 
51
44
  ## Source checkout and developer validation
52
45
 
53
- The npm package is a client, not a hosted review service. Deploy Worker/D1 from a GitHub source checkout using your own Cloudflare account with Workers/D1 permissions and your own OpenAI Responses API key. Public source/npm grants no access to a personal Worker or credits. The package includes no real endpoint, private config, bearer, provider key, or reviews. These instructions target CLI `0.1.0`.
46
+ This guide targets CLI 0.2.0. The npm package runs the local server and optional Worker bridge; it is not a hosted review service and grants no API credits. Only optional Worker deployment needs a Cloudflare account and source checkout. Packages contain no real endpoint, private settings, credentials or review bodies.
54
47
 
55
48
  ```sh
56
49
  npm ci
@@ -95,8 +88,16 @@ rebut review < /protected/path/request-001.bundle.json
95
88
  rebut status request-001
96
89
  ```
97
90
 
98
- Save the initial response locally with restrictive permissions; the server stores only metadata and cannot replay review bodies. Keep the same request ID after timeout or uncertainty. Set the MCP client deadline above 60 seconds; the provider timeout is 45 seconds. See the [opt-in reviewer workflow](reviewer-integration.md).
91
+ Save the initial response locally with restrictive permissions; the server stores only metadata and cannot replay review bodies. Keep the same request ID after timeout or uncertainty. The provider deadline is 1,800 seconds (30 minutes). The MCP HTTP client allows 1,830 seconds and Codex `tool_timeout_sec` is 1,860 seconds, leaving time to record and deliver the outcome. Startup and handshake limits remain short and separate. Update both the Worker and CLI, refresh existing registration with `rebut setup --client codex --replace`, and restart Codex. Editing host configuration alone does not update the older limit inside the 0.1.0 CLI. See the [opt-in reviewer workflow](reviewer-integration.md).
99
92
 
100
93
  ## Upgrade or remove
101
94
 
102
95
  Use the [operations guide](operations.md) to preserve the D1 ledger and reconcile pending executions before upgrading or removing a deployment. Source publication and a private paid deployment are separate actions.
96
+
97
+ Upgrade in this order: **install the CLI → refresh Codex registration with existing options preserved → restart Codex/MCP → deploy the Worker**. Deploying the longer Worker deadline first can let the old CLI disconnect at 65 seconds. Preserve custom registration options such as `REBUT_CONFIG_DIR`. Node HTTP headers/body deadlines also match the MCP tool deadline. Thirty minutes is an application upper bound, not a guarantee from every network or host. Sleep, termination or disconnection can leave a request reserved or unknown; query its original ID without automatic replay or reservation release.
98
+
99
+ After changing mode, credential backend or local budgets, refresh registration with `rebut setup --client codex --replace` when needed and restart MCP hosts. Existing processes keep their startup settings; doctor does not reload them. Preserve custom `REBUT_CONFIG_DIR` (for example, provide the same environment variable when rerunning setup). The chosen secret-store backend applies to all credential roles, which use separate accounts/items.
100
+
101
+ Local env mode defaults to REBUT_OPENAI_API_KEY so a key belonging to Codex or another application is not silently reused. To deliberately share OPENAI_API_KEY, run `rebut set api-key-env OPENAI_API_KEY`, refresh registration and restart. There is no fallback between these variables. Daily, monthly and per-request ceilings are independent; changing one does not scale the others. Custom limits are retained across upgrades. Tool descriptions are startup hints; execution resolves the explicit request profile dynamically.
102
+
103
+ The tested release targets macOS/Linux; Windows behavior and ACLs are not validated.
@@ -4,6 +4,13 @@
4
4
 
5
5
  [Rebut](../../../README.en.md) · [User guide](../en.md)
6
6
 
7
+ ## Local operations
8
+
9
+ Stop local MCP processes before backing up the metadata-only SQLite ledger and its settings. Preserve request history and unknown reservations; do not delete or live-sync an open ledger to clear a limit. API keys are not in SQLite and stay in the selected credential backend. SIGTERM attempts to abort and record uncertain in-flight work before closing; a crash, SIGKILL or network interruption may still leave reserved state. Look up the original ID without replaying it. `rebut remove` removes registration only, not the ledger or credentials. The D1 operations below apply only to Worker mode.
10
+
11
+ ## Worker
12
+
13
+
7
14
  Back up the metadata-only D1 ledger using Cloudflare's supported export/Time Travel mechanisms. Do not delete the ledger to clear an inconvenient pending request: doing so loses spend and duplicate protection. Retain request rows for the lifetime of IDs clients may reuse; pruning permits old IDs to execute again.
8
15
 
9
16
  Use `rebut status REQUEST_ID` for a free metadata lookup under the original principal. `rebut doctor` checks sanitized local configuration and credential availability; `rebut doctor --connect` performs a free remote `tools/list` check. None of these commands starts a paid review. Preserve the request ID and reservation after any uncertain result.
@@ -28,3 +35,17 @@ Run `npm ci`, typecheck, build, and tests. Review migration SQL first, then appl
28
35
  ## Rotate or remove
29
36
 
30
37
  Rotate a token by generating a new random value and replacing that principal's digest in `AUTH_TOKENS`, then updating the authorized client's password-manager-backed configuration. Do not change the principal ID merely to rotate a token. Rotate the OpenAI key by updating only `OPENAI_API_KEY`; other consumers of a shared key need their own coordination. Delete the Worker to stop new requests. Export and review the ledger before separately removing D1; deletion is irreversible and makes deduplication history unavailable.
38
+
39
+ ## Local recovery and bounded capacity
40
+
41
+ 1. Stop MCP hosts and inspect the original request with `rebut status REQUEST_ID`; do not resubmit it.
42
+ 2. Back up the closed local ledger and settings. Review provider evidence when available. `budget_reserved_microusd` and `budget_accounted_microusd` are application accounting, not confirmed invoices for unknown executions.
43
+ 3. If the execution remains uncertain, retain its row, full accounted reservation and ID. Do not mark it unbilled, delete it or manufacture a completed result.
44
+ 4. After explicitly accepting that retained accounting, an operator may add bounded capacity for intentionally new reviews. For one uncertain request occupying the default one slot, `rebut set max-concurrent 2` adds one slot; the range is 1–10. It does not release the old slot, refund money or authorize retry of the old input.
45
+ 5. Restart MCP hosts. Daily/monthly/request limits still apply to the total accounted spend. Actual ledger settlement needs independent evidence and a targeted operator review; it is not automated.
46
+
47
+ If the ID is missing, start with `rebut status --pending`: it lists up to 100 local reserved/unknown metadata records without keys or provider calls, with has_more if more exist. It is a diagnostic snapshot, not authorization for a new paid invocation. If no rows are pending, a money or daily-request ceiling may still be responsible for limit_exceeded.
48
+
49
+ Capacity is capped at 10. If all slots remain uncertain, stop for evidence-based operator reconciliation rather than deleting history or mislabelling unknown as unbilled. Once independently reconciled, reduce temporary capacity back to the intended normal limit (default 1) and restart.
50
+
51
+ Choose capacity from the pending count plus the deliberately allowed new parallel requests (maximum 10), rather than copying the example 2 over an existing custom limit. Capacity/budget commands retain a complete local-limit snapshot. If the original ID is missing, run status --pending before step 1.