---
name: project-rei-automator-mcp-v020a3-ime-bypass-smoke-2026-08-19
description: rei-automator-mcp v0.2.0a3 PyPI release — IME バイパス smoke test cover (selftest 30→40 PASS) + 実地 GUI test script + Windows cp932 fix + 週 1 ship pace 第 1 弾 (hybrid protocol operational start)
metadata: 
  node_type: memory
  type: project
  originSessionId: 3904a6da-b086-469d-bf79-aff7a1eb1a44
  modified: 2026-08-18T15:24:09.101Z
---

# rei-automator-mcp v0.2.0a3 arc (2026-08-19)

## 起点

- **前日 memory** [[project-rei-automator-mcp-pypi-release-2026-08-18]] で残 open: 「`type` action IME バイパス実地テスト (Notepad 日本語送信、 selftest 未 cover 唯一)」
- **前 arc** [[project-rei-automator-mcp-v020a2-a3-arc-2026-08-18]] v0.2.0a2 = type action foreground guard (別 session 由来 hotfix、 事故対応 release)
- **今日 discussion**: 藤本さん chat-Claude turn 共有 → 4 category framework (到達データ / 精度計算 / 副作用 / 量速度) + 「Fujimoto 理論資産 = category 2 = 数十人」 diagnosis + 「日本語ニッチ (IME/文字コード/和文組版) が 大手が拾わない隙間」 point
- 私 Pattern 5 blindness 指摘 (今日 2026-08-18 現在 既 Rei stack に 3 MCP + 2 PyPI package 出荷済 = category 2 単発ではない state) + fork question に **hybrid + 週 1 ship pace 寄り** 選択、 recommendation-first で 第 1 弾 = 「昨日 open close + 半日 scope + Japanese-niche 直撃 + dogfooding path」 提示 → 藤本さん approval

## 実装 (4 file、 +334 -11 lines)

### (1) `src/rei_automator_mcp/__init__.py` (+86 -11)
- Version docstring header a3 追加 + a2 「a3 hardening」 misnamed label 訂正
- MCP server version string a2→a3
- `import inspect` 追加
- selftest 末尾に **[10] section 追加** (10 assertion、 total 30→40):
  - **[10-1..5] PS1 primitives grep** (BOM skip UTF-8 decode):
    - KEYEVENTF_UNICODE (IME バイパス primitive)
    - SendInput (Win32 API、 not SendKeys)
    - VK_RETURN + VK_TAB (control char handling)
    - ExpectedHwnd + FOREGROUND_MISMATCH (a3 foreground guard)
  - **[10-6..8] Python 経路 source inspection** (`inspect.getsource(Automator._type_via_ps1)`):
    - `-Base64` invocation (UTF-8 safe transport、 not `-Text`)
    - `-ExpectedHwnd` + `target_hwnd` pass-through
    - `foreground_mismatch` detection (exit 3 handling)
  - **[10-9..10] Japanese Unicode lifecycle** (実 PS1 実行なし = safe non-GUI test):
    - `propose("type", ..., "テスト日本語 IME バイパス")` accepts Unicode command string
    - `approve` → `cancel` lifecycle works without PS1 subprocess

### (2) `scripts/manual-ime-test.py` (+232 新規)
- **3 mode**: 
  - `--dry-run` = PS1 script + PowerShell 存在確認のみ (非 Windows でも動く)
  - default = Notepad 起動 → pywinauto uia backend で hwnd 取得 → focus → SendInput 日本語送信 → 目視確認案内
  - `--mismatch-hwnd` = 意図的に `hwnd ^ 0xFFFF` bit-flip、 foreground guard の exit 3 abort verify
- **Windows cp932 pitfall fix**: script 冒頭 `sys.stdout.reconfigure(encoding="utf-8", errors="replace")` (grounded v0.1.1 同型 pattern proactive 予防)
  - default text 「テスト日本語 IME バイパス 🌱\n改行も送れる」 の `🌱` (U+1F331) が cp932 encode 不能 → 初回 UnicodeEncodeError → fix で 解消
  - chat-Claude 「日本語ニッチ = IME/文字コード/和文組版」 point の 直接 evidence
- pywinauto uia backend + `Application.window(handle=hwnd).set_focus()` で focus 取り + PS1 layer で 500ms retry hedge

### (3) `pyproject.toml` (+1 -1)
- version `0.2.0a2` → `0.2.0a3`

### (4) `README.md` (+22 -2)
- selftest 数 30 → 40 表記更新
- 「実地 IME バイパス GUI テスト (a3 hardening、 optional)」 section 追加 (6 command 使用例 + Windows-only 明示)

## 実地 verify 2 case 全 PASS

### G-1: 通常送信 (`--text "テスト日本語 IME バイパス v0.2.0a3"`)
- Notepad hwnd=658228 取得 → focus 成功 → SendInput 24 chars → exit 0 「OK sent=24」 完走
- 藤本さん 目視: 日本語 IME OFF 状態でも `KEYEVENTF_UNICODE` で 直接注入されて正しく入力

### G-2: foreground guard mismatch (`--mismatch-hwnd`)
- Notepad hwnd=395880 起動 → target_hwnd bit-flip → 456087
- PS1 side: `GetForegroundWindow() == 395880` vs `ExpectedHwnd == 456087` → 不一致
- PS1 output: exit 3 + stderr `FOREGROUND_MISMATCH expected=456087 actual=395880 retry_ms=200`
- Python side: `_type_via_ps1` detect → return `type aborted [foreground_mismatch]: ...`
- **誤 window 流入ゼロ 構造的保証** 実測

## selftest 40/40 PASS (2 run confirm)

各 section 内訳: [1] lifecycle 4 + [2] persistence 3 + [3] load 2 + [4] append 3 + [5] allowlist 1 + [5b] auto_approve 貫通 4 + [6] PS1 bundle 2 + [7] unknown kind 1 + [8] status 2 + [9] find_element 8 + **[10] IME バイパス smoke 10** = 40

## Release channel

- **GitHub**: `fc0web/rei-automator-mcp` @ commit `b46849f` + tag `v0.2.0a3`
- **GitHub Actions workflow**: `Publish to PyPI` #32153675801、 success **48s** (build 18s + publish 30s)
- **PyPI**: `rei-automator-mcp 0.2.0a3` live (HTTP 200、 wheel + sdist、 Trusted Publisher OIDC + Sigstore attestation 継承)
- **累計 PyPI live packages**: 2 (grounded-check 0.1.2 + rei-automator-mcp 0.2.0a3、 変更なし)
- **同日 3 release** (2026-08-19): a1 03:24Z (初 PyPI publish) + a2 15:05Z (foreground guard hotfix) + a3 15:19Z (IME バイパス smoke cover + 実地 GUI test 分離) = **完全な iteration cycle**

## ★★★ 週 1 ship pace 第 1 弾 = hybrid protocol operational start

- 藤本さん stance shift confirmed:
  - [[project-research-only-stance]] research primary **継続**
  - [[feedback-ai-usable-tool-design-5-conditions-2026-08-18]] 5 条件 (有限 allowlist + 危険操作 関門 + 構造化 return + graceful degradation + selftest) 満たす狭い実用 tool を **週 1 個 pace** で 出荷
- 選択: 新規 3 個 (encoding-mcp / grounded-ja / kana-normalize-mcp) より **既 出荷 tool の 完成度上げ (selftest 30→40) = 「積み上げ」 pattern**
- chat-Claude 「採用曲線 = 数十人」 concern への 反証 pattern (「同 package の 小さい update を 週次 続ける」)

## ★★★ dogfooding path 開通

- 藤本さん + Claude Code は 今後 rei-automator-mcp を Windows GUI operation で 使う際 Notepad or 日本語 UI に 対して IME バイパス送信が **「実地 verify 済 + 静的 test cover」** 状態
- 「テストは緑、 本番は 404」 pattern 5 例目回避 (前 4 例 = STEP 1334 KA wiring + STEP 1336 Rei-Automator persistence + STEP 1338+1339 λ arc + v0.2.0a1 IME 未 cover gap)

## ★★★ Parallel session cross-agent state protected

- 別 session の click 実装 change は `git stash@{0}: a3-pre-pull: preserve pre-existing click impl change` として 保管中
- 私 (Claude Code、 本 session) は stash 触らず = 別 arc (click 実装) は **v0.2.0a4 以降で 独立 land 可能** (domain 直交、 collision なし)
- [[docs/PARALLEL_SESSION_AND_STASH_PROTOCOL]] operational 4 例目 (前 3 例 = stash 22 close + track 3+4 + STEP 1336 wrong-impl wiring)

## Honest scope

1. 本 arc は 別 project OSS repo (`fc0web/rei-automator-mcp`)、 Rei-AIOS repo と 別 project、 rei-aios.pages.dev site には 反映せず、 Rei stack MCP 5 systems count は 変わらず
2. selftest [10] 10 assertion は 全て 静的 verify (grep + inspect + lifecycle) = 実 PS1 subprocess execution なし、 実 GUI test は `scripts/manual-ime-test.py` に 分離 = **CI/CD 非依存 + Windows GUI 依存 の 明示的 layer 分離**
3. 実地 Notepad test は 藤本さん Windows session (本 conversation) で 2 case 実測 PASS、 **CI 上での 自動化 は 別 STEP candidate** (Windows Server GH runner + xvfb-alternative 必要)
4. Prior art 100% pre-existing (SendInput + KEYEVENTF_UNICODE + GetForegroundWindow = Win32 標準 API、 Base64 argv transport = shell encoding 事故回避の 標準 pattern、 selftest [10] 静的 verify approach = pytest + hypothesis systemic pattern)、 Rei contribution = **「PS1 primitives の grep-based static verify + Python 経路 source inspection + Japanese Unicode lifecycle test を 単一 selftest section に 統合」** の 組合せ discipline のみ
5. 「世界初」 主張ゼロ ([[feedback-world-uniqueness-claim-controllable]] 適用) = release → test → fix → release iteration cycle + weekly ship pace + hybrid protocol も 標準 SDLC + industry practice、 novelty は 「AI が使いやすい 5 条件 explicit self-application + Rei stack 内 15-day 3 release iteration operational速度」 のみ
6. 2026-08-06 「全研究 site 反映 default」 protocol 対象外 = 別 project OSS repo、 rei-aios docs/RECENT_UPDATES.md への 記載 のみ
7. 「急がずゆっくりと」 [[feedback-no-rush-publication]] 遵守 = 半日 scope + 明日以降 別 STEP で 別 arc (click 実装 stash / research 側 STEP / 第 2 弾 別 tool candidate) に 振る buffer 確保、 「同日 3 release」 は a1 (release) + a2 (hotfix) + a3 (test cover) の 意味的分離 iteration = 週 1 pace 上限違反ではない (「1 弾 = 1 意味的完結」 baseline で counting、 a1+a2+a3 = 1 完結 iteration cycle)

## 関連

- [[project-rei-automator-mcp-v020a2-a3-arc-2026-08-18]] (前 arc = a2 foreground guard、 事故対応 hotfix)
- [[project-rei-automator-mcp-pypi-release-2026-08-18]] (前々 arc = a1 初 PyPI publish、 本 arc close の 起点 open item)
- [[feedback-ai-usable-tool-design-5-conditions-2026-08-18]] (5 条件 operational 実例 4 例目 = 条件 5 selftest cover 拡張)
- [[project-research-only-stance]] (research primary 継続 stance)
- [[feedback-present-recommendation-first]] (recommendation-first 適用実例)
- [[feedback-no-rush-publication]] (急がずゆっくりと 遵守)
- [[feedback-world-uniqueness-claim-controllable]] (novelty 主張ゼロ)
- [[feedback-projection-self-audit-pattern]] (SAC-4、 本 arc は 積極発火なし)
- [[docs/PARALLEL_SESSION_AND_STASH_PROTOCOL]] (parallel session stash protection 4 例目)
- [[project-grounded-pypi-release-2026-08-18]] (Windows cp932 fix pattern の 起源、 本 arc で proactive 予防適用)
