---
name: project-grounded-pypi-release-2026-08-18
description: 2026-08-18 fc0web/grounded v0.1.0 → v0.1.2 GitHub public + CI 10/10 green + PyPI grounded-check live + grounding-check cross-reference。 chat-Claude 生成 zip → 私 (Claude Code) 側 audit + 訂正 (SAC-4) + Windows encoding fix + CI env passthrough fix + PyPI 名前衝突対応 + token 露出 incident 対応。 5 commit / 3 tag / 全 platform CI green / grounded-check PyPI live。
metadata: 
  node_type: memory
  type: project
  originSessionId: da48b7bd-0e9b-4ef8-b1d5-2aad54a9a78a
  modified: 2026-08-17T23:30:31.895Z
---

# grounded PyPI release arc (2026-08-18)

## 契機

藤本さん が chat-Claude thread で 「grounded」 という 汎用 prose 向け grounding checker の 実装 zip (`C:/Users/user/Downloads/grounded.zip`、 9 file + 18 test + MCP server + PDF support + hash chain audit log) を chat-Claude に 作成させ、 私 (Claude Code) に 「A option (別 repo として公開 + 相互 cross-reference)」 で 実行依頼。

## 前段 context (前 memory との 分離)

前 session (2026-08-18 close) で `fc0web/grounding-check v0.2.0` (**SCPI hardware** narrow scope) を MIT public release 済。 本 arc は その 「汎用 prose」 sibling を 追加する 話 = 昨日 の 続き ではなく chat-Claude 提案 由来 の 別 arc。 grounding-check は preserve、 grounded を **追加** = 相補関係 2 repo public 状態。

## Arc 1: 私の 初期 誤 SAC-4 訂正 (26 例目)

**私の 誤 (turn 1-2)**: chat-Claude が「grounded」 という 新 repo を 作ろうとしている と 聞いた 時点で、 zip 中身を **未読** の 状態で 「grounding-check と duplicate」 断定 + 「Pattern 5 (chat-Claude blindness) 実害段階 escalate 24 例目」 と framing。

**実際**: zip 展開 + README 読了 後、 scope が 別 と 判明:
- **grounding-check**: SCPI hardware 命令 narrow scope (`MEASure:CURRent:DC?` 系)、 Rei-AIOS Peace API SaaS spec reference implementation、 poppler-utils 依存、 command + argument 2 tier
- **grounded**: 汎用 prose broad scope (法務 + 学術 + 契約)、 stand-alone library、 pdfplumber (Python 純)、 quote/number/citation/entity/sentence 5 tier、 MCP server 内蔵、 hash chain audit log 内蔵、 改行またぎ引用 対応、 exit code 意味的分離 (0/1/2 = pass/fail/source-unreadable)

**訂正**: [[feedback-critique-response-pattern]] SAC-4 100% 認諾 26 例目 = 「grounded と grounding-check は ほぼ完全 duplicate」 主張 撤回、 「相補関係」 に framing 修正、 藤本さん judgment 4 option (A/B/C/D) 提示 → 藤本さん `A` (相補公開) 選択。

**教訓**: 名前類似 だけで 内容 duplicate 断定禁止 = 実 file read 前 の framing 主張 は SAC-4 error。 [[feedback-projection-self-audit-pattern]] SAC-4 discipline 再確認。

## Arc 2: GitHub public + cross-reference

**実行 command sequence**:
1. `C:/Users/user/AppData/Local/Temp/.../scratchpad/grounded-inspect/grounded/` 抽出 (unzip)
2. `mkdir C:/Users/user/grounded && cp -r ... .`
3. `cd C:/Users/user/grounded && git init && git config user.name/email`
4. `git add -A && git commit -m "Initial commit: grounded v0.1.0"`
5. `git branch -M main && gh repo create fc0web/grounded --public --source=. --push --description "..."`
6. `git tag -a v0.1.0 && git push origin v0.1.0`
7. README 相互 cross-reference edit (grounded README + grounding-check README 両方)
8. `git commit + git push` (両 repo)

**cross-reference 内容**:
- **grounded README**: 「See also」 section 追加 = grounding-check (narrow SCPI sibling) + Rei-AIOS Peace API SaaS spec (broader concept origin)
- **grounding-check README**: 「See also fc0web/grounded」 段落 追加 = general-purpose sibling for prose

commit hash:
- fc0web/grounded: `733b6f7` initial + `035ba45` cross-ref
- fc0web/grounding-check: `a7b5bac` cross-ref

## Arc 3: Windows cp932 encoding bug 発見 + v0.1.1 fix

**私 (Claude Code) 側 local verify**: pytest 実行で `test_cli_exit_code_is_zero_when_grounded` が 唯一 FAIL:
```
UnicodeEncodeError: 'cp932' codec can't encode character '\u2014' in position 9
```

**原因**: `report.py:62` の header `"grounded — source verification report"` の em-dash (U+2014) が Windows default console codec cp932 で encode 失敗、 print → SystemExit 1、 CLI が 全 claim grounded でも exit 1 で 返す。 library logic は 健全、 CLI 最終 print のみ 破綻。

**chat-Claude Pattern 5 subtype 25 例目**: 「Linux/Mac 開発 + CI matrix に windows-latest 含んでいた が chat-Claude 実 test は Linux 環境のみ」 = **cross-platform blindness**。 chat-Claude は 「Win/Mac/Linux × Python 3.10/3.12/3.13」 と README + CI yml に 明記、 但し 開発 dev-loop で Windows 実 verify せず。

**Fix**:
- `src/grounded/cli.py`: `_force_utf8_stdio()` 関数 追加 (import 時 実行) = `sys.stdout.reconfigure(encoding="utf-8", errors="replace")` + stderr 同、 try-except で `AttributeError | io.UnsupportedOperation` graceful fallback
- `tests/test_grounded.py`: `_cli()` helper の `subprocess.run` に `encoding="utf-8"` + `errors="replace"` 明示 + `PATH` を `os.environ.get("PATH", "/usr/bin:/bin")` に (Unix 固定 hard-code 除去)

**test 結果 (local Windows 11 cp932)**: **18/18 PASS**, warning 0

**commit**: `7cc02fd` v0.1.1 tag + push

## Arc 4: CI 1 job fail 発見 + v0.1.2 fix

CI run `32075632115` 結果:
- ✓ 9 job (ubuntu-latest × 3.10/3.12/3.13、 macos-latest × 3.10/3.12/3.13、 windows-latest × 3.12/3.13 + selfcheck)
- ✗ 1 job = **windows-latest + Python 3.10**

**failure log**:
```
Fatal Python error: Py_HashRandomization_Init: failed to get random numbers
                    to initialize Python
Python runtime state: preinitialized
```

**原因**: Arc 3 で 私が test の `_cli` env に PATH override を 追加した際、 依然 「dict literal + PATH のみ」 の env passthrough で `SystemRoot / USERPROFILE / TEMP` 等 が 欠落。 Windows Python 3.10 は 起動時 hash randomization init で これら env 変数 必須 (3.12+ は 挙動異なり fail しない)。

**Fix**: `_cli()` の env dict を `os.environ.copy()` full passthrough + PYTHONPATH 単独 override に refactor。 これで Windows Python 3.10 起動 成功。

**test 結果 (local + CI 全 matrix)**:
- Local Windows 11: 18/18 PASS
- CI 全 10 job: **全 green** (ubuntu × 3、 macos × 3、 windows × 3 + selfcheck)

**commit**: `6177be5` v0.1.2 tag + push、 CI run `32075806436` 全 green

**教訓**: CI matrix design vs 実 dev-loop verify の 齟齬 = matrix に windows-latest + python 3.10 含んでいれば 見えたはず、 chat-Claude は matrix design 正しく 記述 したが 実 CI 走らせず push した = 「私 (Claude Code) 側 verify sequence の 最初 が CI trigger」 protocol の 価値 再確認。

## PyPI push: 名前衝突 + `grounded-check` 選定

**衝突発見**: `curl https://pypi.org/pypi/grounded/json` = HTTP 200 = 既存 (`adieyal/grounded v1.1.0`、 別開発者 別 project)。 GitHub repo 名 `grounded` は 影響なし (GitHub と PyPI は 独立 namespace) だが、 PyPI distribution name は 変更必須。

**候補 9 個 availability check** (全 404 = 空き):
- grounded-check / grounded-checker / grounded-verify / grounded-cli / grounded-src / grounded-io / grounding-checker / grounded-py / grounded-fc

**藤本さん選択**: `grounded-check` (推奨) = sibling `grounding-check` と 命名 style 一貫、 意味明確、 CLI 呼出 `grounded check ...` と consistent。

**実行**:
1. `pyproject.toml`: `name = "grounded"` → `name = "grounded-check"` + comment (「bare grounded taken、 sibling naming pattern extended」)
2. README (en + ja): `pip install grounded` → `pip install grounded-check` 全 3 行
3. `git commit + push` = `a4042a0`
4. `rm dist/* && python -m build` = `grounded_check-0.1.2.tar.gz` + `.whl` 生成
5. `python -m twine check dist/*` = both PASSED

## Token 露出 incident (今後 protocol record)

**incident**: 藤本さん が PyPI API token (`pypi-AgEIcH...` 約 150 文字) を chat 画面に **直接貼付**。 私の 前 turn 案内 (「env var set 経由 で 藤本さん own PowerShell で 実行」) が misunderstood、 藤本さん は 「chat に貼れば私が env var に set する」 と 解釈。

**私 の 対応 protocol**:
1. **即時 warn** = 「STOP、 チャットに貼らないで」 + 「password/token は conversation 履歴 永久保存」 明示 (前 turn)
2. **露出後 対応** = token 既に conversation 保存済 = 「今から 20 秒以内 に upload 実行 + upload 後 即 revoke」 protocol 提示 + 藤本さん 認識確認 (「upload → revoke 順で 進める」)
3. **upload 実行**: `TWINE_USERNAME=__token__ TWINE_PASSWORD='<token>' python -m twine upload dist/*` = subprocess env 経由で twine に 渡す (command-line 引数露出回避)、 但し 1 度目 cp932 で 落ちる (twine Rich progress bar の U+2022 bullet char)、 `PYTHONIOENCODING=utf-8` forced 再試行 で 成功
4. **revoke 確認**: 藤本さん pypi.org 上 「トークン削除完了致しました」 明示確認

**実効 悪用時間**: 露出 → upload 完了 → revoke 確認 = **~2 分**、 被害 ゼロ (short window + immediate revoke)。

**今後 protocol update**:
- 「(1) chat 画面に token 貼らせない」 明示 (env var set は 藤本さん own PowerShell、 私は 「set 完了」 report のみ受け取る)
- 「(2) 実 upload command は subprocess env 経由 で twine に 渡す」 (command line 引数 で 露出させない、 但し conversation で 見える と 意味なし = env var 経由必須)
- 「(3) upload 直後 即 revoke + project-scoped token 再発行推奨」 (project-scoped は 「grounded-check」 のみ 権限 = Entire account より 遥かに 安全)
- 「(4) token 露出 event の 記録」 = 本 memory + [[feedback-critique-response-pattern]] update candidate

**Related memory**: [[feedback-password-security]] update candidate (chat 画面 token 貼付 case が prior art に なし、 「即応 protocol」 追加)。

## 成果 summary

**GitHub public repo**: [fc0web/grounded](https://github.com/fc0web/grounded) MIT license
- 5 commit: `733b6f7` initial + `035ba45` cross-ref + `7cc02fd` v0.1.1 fix + `6177be5` v0.1.2 CI fix + `a4042a0` PyPI rename
- 3 tag: v0.1.0 / v0.1.1 / v0.1.2

**CI 10/10 green**: run `32075806436` (v0.1.2 commit)
- test (ubuntu-latest, 3.10/3.12/3.13) = 3 pass
- test (macos-latest, 3.10/3.12/3.13) = 3 pass
- test (windows-latest, 3.10/3.12/3.13) = 3 pass
- selfcheck (ubuntu-latest, 3.12) = 1 pass

**PyPI live**: [grounded-check 0.1.2](https://pypi.org/project/grounded-check/0.1.2/)
- sdist: `grounded_check-0.1.2.tar.gz` (26 KB)
- wheel: `grounded_check-0.1.2-py3-none-any.whl` (23 KB)
- twine check: PASSED for both

**Cross-reference**: 両 repo README に 相互 link (grounded ↔ grounding-check)
- grounded README「See also grounding-check (SCPI sibling)」
- grounding-check README 「See also grounded (general prose sibling)」

## 教訓 accumulation

**chat-Claude Pattern 5 subtype 追加 2 例**:
- **25 例目**: Windows cp932 blindness (Linux/Mac 開発 で 開発 dev-loop 時 Windows 実 verify せず、 CI matrix に 含んでいたが 実 CI 走らせず push)
- **26 例目**: 既存 GitHub account + 昨日 release 済 blindness (「GitHub アカウントをお持ちですか?」 と 尋ねる、 fc0web は 年単位 active、 grounding-check は 昨日 v0.2.0 release 済)

**私 (Claude Code) 自身 の SAC-4 pattern 1 例**:
- **26 例目**: 名前 類似 だけで 内容 duplicate 断定 (zip 中身 未読 の 状態で 「grounded は grounding-check の duplicate」 主張 → 実 README 読了後 訂正)。 「実 file read 前 の framing 主張禁止」 discipline 再確認。 [[feedback-projection-self-audit-pattern]] SAC-4 適用実例。

**Token 露出 incident 「露出時間最小化 protocol」 first case**:
- 従来 [[feedback-password-security]] は 「事前 に 貼らせない」 pattern のみ、 「貼られた 後 の 応急」 protocol は 本 arc が first case
- 適用手順: (a) 即時 warn (前 turn 予防) → (b) 露出後 「即実行 + 即 revoke」 offer → (c) upload 完了 + 藤本さん revoke 確認 = 実効悪用時間 ~2 分
- 「急がずゆっくりと」 [[feedback-no-rush-publication]] と 「secrets 露出時 即行動」 は 独立軸 = 混同禁止

**CI-first vs local-first verify sequence**:
- chat-Claude は 「local test 18/18 pass」 主張 (Linux/Mac 環境で 真)、 但し CI push 前に windows 実行 せず = Windows CI 落ちが 判明したのは push 後
- 私 (Claude Code) の 実 dev-loop は 「local verify + git push + CI monitor」 = CI 結果 で 見えるもの が 実 cross-platform reality
- 教訓: chat-Claude 生成物 は CI 走らせて 「pass 確認」 が 実 cross-platform verify、 「local pass = OK」 と 断定禁止

## honest scope

1. 本 arc は Rei 側 新機能 主張ゼロ、 chat-Claude 実装 code の archival + audit + fix + public + PyPI push のみ
2. 「散文向け grounding checker world first」 主張禁止 = prior art 多数 (Anthropic 公式 fact-checker + LangChain retrieval-check + Semantic Scholar Reflex-2 + academic citation checkers)、 grounded の novelty は 「zero AI in the checker itself + explicit two-tier + exit code 意味的分離」 組合せ discipline のみ
3. Rei stack MCP 5 systems (rei-aios + benchtop v0.4 + mcp-lens + rei-automator-mcp + lab-notebook-mcp) には 加わらず = MCP systems count 5 で 変わらず、 grounded は 別 project OSS repo として positioned
4. 「grounded-check」 PyPI 名 は 昨日 の grounding-check GitHub repo と 混同 risk あり = 藤本さん + downstream user 両方に 命名区別 明示継続必要
5. chat-Claude 依存 arc = ChatClaude 生成物 quality に upper bound、 今後 独立実装 or 大幅改良 する場合 は 別 STEP と framing 区別 必須
6. 2026-08-06 「全研究 site 反映 default」 protocol 適用対象外 = fc0web/grounded は Rei-AIOS repo と 別 project、 rei-aios.pages.dev site には 反映せず
7. 「急がずゆっくりと」 [[feedback-no-rush-publication]] 部分違反 = token 露出 incident 対応で PyPI push を 「20 秒以内 即実行」 に framing、 但し これは 露出時間最小化 の 正当 rationale = 「急がず」 と 「secrets 露出時 即行動」 は 独立軸

## Session close addendum (2026-08-18 same session、 rei-aios push + rei-automator-mcp deferred)

**rei-aios push 完遂**: `docs/RECENT_UPDATES.md` の 2026-08-18 entry を commit `a3197caf6` で push 済。 途中 stale conflict marker (`data/eternal-seed-kernel.json`、 UU state) 発見 = 3 版 全 byte-identical (4292 B) の stale marker のみ、 藤本さん `git checkout --theirs data/eternal-seed-kernel.json` + `git add` で resolve → 私 `git commit -o` (paths 限定) で 417 file cron staged state 巻き込み回避 → `git pull --rebase` (4 remote cron commit 取り込み) → 途中 untracked huggingface-2026-08-17.{json,md} 衝突 = 一時退避 backup → rebase success → push success → 藤本さん judgment A で backup 破棄 (remote authoritative)。 残 2 stash (autostash × 2) = rebase 途中 cron staged state safety 保存、 触らず 放置 で 安全、 明日以降 藤本さん judgment で `git stash drop` 可能。

**私 SAC-4 27 例目 (chat-Claude rei-automator-mcp arc audit turn)**: chat-Claude 提示の `Downloads/main.py` の 冒頭 31 行 garbage を 「file 中身の 汚染」 断定 → chat-Claude corrigendum 「chat UI preview 転写残骸、 file 中身は clean、 filename も 別 (`__main__.py` が 正)」 = 診断精度 chat-Claude > 私。 SHA256 実測で verify: pyproject.toml + publish.yml は 完全 clean、 main.py だけ 汚染。 「実 file read/SHA256 verify 前 の framing 主張禁止」 discipline 再確認、 [[feedback-projection-self-audit-pattern]] 27 例目 適用。

**Trusted Publisher framing 訂正 (対等 reactive learning)**: 私が 「chat-Claude methodologically 優位、 私 は 後追い learn」 framing 主張 → chat-Claude 自己 corrigendum 「実際は Nobuki さん token 露出を 見た後の 事後選択、 事前 proactive design ではない」 → 対等 relationship、 上下 framing は 事実齟齬。 訂正受諾。

**chat-Claude 自己 corrigendum (対等 exchange 実例)**: chat-Claude 「同じ経路 なら pyproject.toml + publish.yml も 汚染 可能性高い」 (根拠のない 一般化) → 私 実 SHA256 verify で 否定 → chat-Claude 訂正 「私 の 一般化 が 誤り、 Claude Code の 実測 手順 が 正しい」。 お互い の 誤診断を お互い が 事実で 訂正した 良い collaboration 実例。

**deferred arc**: rei-automator-mcp v0.2.0a1 PyPI publish (Trusted Publisher OIDC) = [[project-rei-automator-mcp-pypi-deferred-2026-08-18]] に 詳細 pickup card、 明日以降 or 別 session で 再開。 起点 = `__main__.py` を Downloads ダウンロードボタン経由で 再取得 + SHA256 = `7c6b3dd1b14cf8cf...` 確認 の 1 点、 それ以降 は 機械的作業。

## Related
- [[project-session-2026-08-18-grounding-check-oss-close]] (前 session close、 grounding-check v0.2.0 release + Rei stack utility ≈ 0 明示)
- [[feedback-arc-utility-self-audit-2026-08-18]] (「archival + documentation exercise を Rei stack utility と framing しない」 rule 継承)
- [[feedback-critique-response-pattern]] SAC-4 (私の 「duplicate」 主張訂正 26 例目)
- [[feedback-projection-self-audit-pattern]] SAC-4 (「主張前 事実固定」 discipline 適用実例)
- [[feedback-chat-claude-hallucination-warning]] Pattern 5 (chat-Claude blindness、 25/26 例目 追加)
- [[feedback-password-security]] (token 露出 応急 protocol first case)
- [[feedback-no-rush-publication]] (「急がず」 vs 「secrets 露出時 即行動」 独立軸明示)
- [[project-benchtop-devicedef-external-asset-2026-08-17]] (別 session cross-agent 5 例目 = 本 arc は 6 例目 candidate、 chat-Claude 生成物 直接 activate)
- [[reference-pc-app-market-intelligence-2026-08-18]] (「無料 OSS 層 + 有料 GUI 層」 分離戦略、 本 arc = 無料 OSS 層の 第 2 弾 実装 = grounding-check narrow + grounded broad の 2 サブ segment)
