1仕組みと動作原理
2段階の修正ループ:Stage 1では確定的辞書ルールにより既知の修正を一括適用し、Native AI修正(Claude/Codex内蔵、外部キー不要)が全文を精読して単発エラーを修正しつつ再利用可能な修正を蓄積します。Stage 3 APIはエージェントを介さない自動化にのみ対応します。
1. Stage 1 applies deterministic, already-known corrections. 2. Native AI Correction reads the complete transcript, fixes one-off errors, verifies uncertain entities, and compounds reusable fixes.
パーソナライズ修正データベース:SQLite(~/.transcript-fixer/corrections.db)に辞書、コンテキストルール、人名名簿、レビューキューを格納します。ディレクトリはchmod 0o700、configは0o600で保護され、ドメインコンテキストファイルは~/.transcript-fixer/contexts/<domain>.mdの規約に従います。
# Filesystem security CONFIG_DIR_MODE: Final[int] = 0o700 CONFIG_FILE_MODE: Final[int] = 0o600
人名修正ゲート:人名を変更する前に、グローバルなpeople名簿とプロジェクト明示の識別名簿の双方を必ず照合する必要があります。名簿にはASR表記揺れのみを保存し、プロジェクト名簿は自動読み込みされず、出現頻度は決して身元の証拠とはみなされません。
Before correcting any person name, directly read both the configured global people roster and the owning project's explicit identity roster or alias ledger. … Never use occurrence frequency as identity evidence.
セーフモード+多層マッチング防御:デフォルトでは低リスクなルールのみを自動適用し、中・高リスク項目は*_needs_review.mdおよび永続化レビューキューへ後回しにします。マッチング時の3層チェック(上位集合、一般語境界、単語境界)によって不適切なマッチをさらに排除します。
Safe mode is the Stage 1 default: low-risk rules apply; medium/high-risk matches defer to `*_needs_review.md` and the persistent review queue. `Applied: 0` is a valid result, not proof that the transcript is clean.
レビューキュー+ローカルダッシュボード:キューの行構造は{file, line, original, suggested, kind, context, evidence}です。review-dashboard/server.pyが127.0.0.1:8767でFastAPIを起動し、同一のSQLiteに読み取り専用で接続することで、CLIと人間のレビュアーが同一の判定ソースを共有します。
anchor guards, and audit logging stay the single source of truth — this UI never mutates the database itself. Agent (CLI) and human (this page) are equal writers of the same queue.
AI拡張ルーティング(エージェントレス):Claude/Codexが利用できない場合にのみGLMへルーティングします。Anthropic互換エンドポイントopen.bigmodel.cn/api/anthropicを利用し、x-api-key認証、/v1/messages、モデルGLM-5.2(フォールバックGLM-5-turbo)で通信します。
API_PROVIDER: Final[str] = "GLM" DEFAULT_MODEL: Final[str] = "GLM-5.2" FALLBACK_MODEL: Final[str] = "GLM-5-turbo" API_BASE_URL: Final[str] = "https://open.bigmodel.cn/api/anthropic" AUTH_HEADER_NAME: Final[str] = "x-api-key"
証拠チェーンと完了契約:修正にはfrom_text/to_textのトレーサビリティとasr_note行マスク保護が必要です。--close-sidecarsはすべてのキュー行が裁定され、ルールが無効化され、ファイルの保留(pending)行がゼロになった場合にのみclosedを報告します(exit 1: open、exit 2: blocked)。
`--close-sidecars --input "<absolute-canonical-file>"` reports `closed`: every entry reads applied in the file (or the original form no longer appears anywhere in the ledger-masked transcript) or is answered by a decided queue row for this exact file
2コア機能
3外部依存関係
| Kind | Dependency / Endpoint |
|---|---|
| network | open.bigmodel.cn(GLM/智谱,anthropic 兼容) |
| cli | uv / python3(PEP 723 入口,uv run) |
| package | httpx/filelock/aiofiles(ensure_deps 的共享 venv) |
| package | jieba / rapidfuzz(fix_transcription.py PEP 723 依赖,词边界/模糊匹配) |
| cli | lark-cli(飞书 CLI,音频取证;需已登录 profile) |
| cli | curl / ffprobe / sqlite3(工具链) |
4推奨統制措置と判定根拠
- scripts/: ローカルスクリプトまたはコマンドの実行: fix_transcription.py および同ディレクトリ内のユーティリティスクリプト(uv run経由)
- scripts/ 或 SKILL.md: 外部言語パッケージ依存関係の動的インストールを宣言
- 网络端点: 外部ネットワークアクセスの宣言: Stage 2/3(エージェントレスAPIルーティング)が https://open.bigmodel.cn/api/anthropic/v1/ へPOSTリクエストを送信
- 本地工作目录: ファイル読み書きと成果物の出力: ユーザーの文字起こし元ファイルを直接編集(Nativeモードではインプレース編集)し、*_stage1.md / *_changes.md / * などを生成
5二重目の独立検証
- [ok] SQLite 数据库与 0o700/0o600 权限 — defaults.py CONFIG_DIR_MODE=0o700/CONFIG_FILE_MODE=0o600;config.py DatabaseConfig/PathConfig __post_init__ 逐目录 mkdir+chmod;默认路径 Path.home()/'.transcript-fixer'/corrections.db。
- [ok] 凭证读取面(GLM/ANTHROPIC key 与 config.json) — config.py from_env 读 GLM_API_KEY/ANTHROPIC_API_KEY/ANTHROPIC_BASE_URL;from_file 读 config.json api.api_key;get_config 全局 env 覆盖 file。无其他 key/token 读取。
- [ok] 网络调用点仅 open.bigmodel.cn(+dashboard 本机) — ai_processor.py _process_chunk url=f'{base_url}/v1/messages' httpx POST;全目录 https?:// 扫描无其他外发端点;astral.sh 仅 ensure_deps 报错文案。
- [ok] 人名门禁(roster 双读/频率非证据) — commands.py 715-719/1330-1333 roster_path = getenv('TRANSCRIPT_FIXER_PEOPLE_ROSTER') or config…people_roster_path 存在;SKILL.md 操作契约原文存在;Stage1 只加载全局 ASR 变体。
- [ok] Safe mode 与 defer 行为 — SKILL.md『Safe mode is the Stage 1 default』;commands.py 1401 附近『Stage 1 defaults to conservative safe mode: only auto-apply low-risk』代码注释相符。
- [ok] review queue 结构(file/line/original/suggested/kind/context/evidence) — SKILL.md 最小条目 JSON 逐字段存在;review_queue.py 以 sqlite 实现(--init 后 db 必须存在)。
- [ok] dashboard 只读连库且仅本机 — server.py _connect_ro 用 'file:{DB_PATH}?mode=ro';uvicorn.run(host='127.0.0.1', port=PORT);docstring『never mutates the database itself』。
- [ok] fetch_minute_audio 网络/CLI 行为 — lark-cli minutes +download --url-only → json 取 download_url → curl -sSL --noproxy '*' 下载;LARK_CLI_NO_PROXY=1 防代理带走凭证。
6結論
1621eed101bbd789…