From cc2c6a90f40022664d58fa0ce9ef0e335b81f1de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=20=E9=A7=BF=E7=94=AB=20=28Shunsuke=20Hayashi=29?= Date: Fri, 10 Apr 2026 06:28:15 +0900 Subject: [PATCH] =?UTF-8?q?[=E8=BF=BD=E5=8A=A0]=20Sprint=201-4=20=E3=82=A2?= =?UTF-8?q?=E3=82=AF=E3=82=B7=E3=83=A7=E3=83=B3=E3=83=97=E3=83=A9=E3=83=B3?= =?UTF-8?q?=20+=20miyabi=20gate=20CLI=20=E3=82=B9=E3=82=AD=E3=83=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit autorun/: sprint-1-today/TASKS.md + GATE.md: verify_merge + escape hatch + E2E テスト sprint-2-this-week/TASKS.md: OpenClaw ドッキング (hooks/sync/サブエージェント) sprint-3-next-week/TASKS.md: 運用基盤 (Heartbeat/Telegram/VOICEBOX/Maestro) sprint-4-this-month/TASKS.md: 品質ゲート多層化 (rust-ai-pipeline/proptest/mutants) skills/miyabi-gate-cli/SKILL.md: 全11サブコマンドの使い方 Claude Code / Codex / OpenClaw からの呼び出し方法 exit code (0/1/2) とエージェントの対処方法 GATE フロー図 ~/.claude/skills/miyabi-gate-cli → シンボリックリンク設定 Co-Authored-By: Claude Opus 4.6 (1M context) --- AGENTS.md | 2 +- CLAUDE.md | 2 +- autorun/sprint-1-today/GATE.md | 20 +++ autorun/sprint-1-today/TASKS.md | 70 ++++++++ autorun/sprint-2-this-week/TASKS.md | 39 +++++ autorun/sprint-3-next-week/TASKS.md | 38 +++++ autorun/sprint-4-this-month/TASKS.md | 27 +++ skills/miyabi-gate-cli/SKILL.md | 160 ++++++++++++++++++ skills/self-improving-skills/skill-runs.jsonl | 3 + 9 files changed, 359 insertions(+), 2 deletions(-) create mode 100644 autorun/sprint-1-today/GATE.md create mode 100644 autorun/sprint-1-today/TASKS.md create mode 100644 autorun/sprint-2-this-week/TASKS.md create mode 100644 autorun/sprint-3-next-week/TASKS.md create mode 100644 autorun/sprint-4-this-month/TASKS.md create mode 100644 skills/miyabi-gate-cli/SKILL.md create mode 100644 skills/self-improving-skills/skill-runs.jsonl diff --git a/AGENTS.md b/AGENTS.md index 8ea5482..f52b069 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -29,7 +29,7 @@ # GitNexus — Code Intelligence -This project is indexed by GitNexus as **miyabi-cli-standalone** (5232 symbols, 11415 relationships, 300 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely. +This project is indexed by GitNexus as **miyabi-cli-standalone** (5414 symbols, 11907 relationships, 300 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely. > If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first. diff --git a/CLAUDE.md b/CLAUDE.md index 322cc49..b5d7d68 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -121,7 +121,7 @@ miyabi agent run coordinator --issue <番号> # GitNexus — Code Intelligence -This project is indexed by GitNexus as **miyabi-cli-standalone** (5232 symbols, 11415 relationships, 300 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely. +This project is indexed by GitNexus as **miyabi-cli-standalone** (5414 symbols, 11907 relationships, 300 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely. > If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first. diff --git a/autorun/sprint-1-today/GATE.md b/autorun/sprint-1-today/GATE.md new file mode 100644 index 0000000..ddac92e --- /dev/null +++ b/autorun/sprint-1-today/GATE.md @@ -0,0 +1,20 @@ +# Sprint 1 承認ゲート + +## 通過条件(全て GREEN で Sprint 2 へ進む) + +- [ ] `cargo test --all` → 全 GREEN(900+ テスト) +- [ ] `cargo clippy --all-targets --all-features -- -D warnings` → ゼロエラー +- [ ] `cargo build --release` → 成功 +- [ ] verify_merge が mock で動作する +- [ ] force_unlock が event log に記録する +- [ ] manual_complete が done に遷移する +- [ ] E2E テスト: register → done の全シーケンスが通る +- [ ] GATE 拒否テスト: 6件以上が正しく拒否する +- [ ] GNI 再インデックス完了 +- [ ] `v1.0-dtp-complete` タグが打たれている + +## 失敗時 + +- テスト失敗 → 原因特定 → 修正 → 再テスト(最大3回) +- clippy エラー → 該当行修正 → 再チェック +- 3回連続失敗 → エスカレーション(人間判断) diff --git a/autorun/sprint-1-today/TASKS.md b/autorun/sprint-1-today/TASKS.md new file mode 100644 index 0000000..2f5b2da --- /dev/null +++ b/autorun/sprint-1-today/TASKS.md @@ -0,0 +1,70 @@ +# Sprint 1: 品質確定(今日) + +> Phase C + clippy 完了 → v1.0 タグ + +## 1.1 verify_merge ラッパー (~50行) + +- [ ] `crates/miyabi-core/src/protocol.rs` に `verify_merge()` を追加 + - 既存の `get_pull_request()` (github.rs) を呼ぶ + - `PullRequest.merge_commit_sha` を取得 + - `pr.state == "merged"` を検証 + - SHA が 40hex であることを検証 + - tasks.json 更新: merge_commit + state → done + - ロック解放 + - 後続タスク blocked → pending +- [ ] CLI に `miyabi gate verify-merge ` サブコマンド追加 +- [ ] テスト: mock PullRequest で merged → done 遷移 + +## 1.2 escape hatch (~50行) + +- [ ] `protocol.rs` に `force_unlock()` 追加 + ``` + fn force_unlock(&self, task_id: &str, reason: &str, operator: &str) -> Result<()> + ``` + - ロック即解放 + - event log に reason + operator を記録 + - state は変更しない(implementing のまま) +- [ ] `protocol.rs` に `manual_complete()` 追加 + ``` + fn manual_complete(&self, task_id: &str, reason: &str, operator: &str) -> Result<()> + ``` + - PR/merge なしで done に遷移 + - event log に reason + operator + "manual" を記録 + - CompletionMode::Manual として区別 +- [ ] CLI に `miyabi gate force-unlock --reason R --operator O` 追加 +- [ ] CLI に `miyabi gate manual-complete --reason R --operator O` 追加 +- [ ] テスト: force_unlock → ロック解放確認 +- [ ] テスト: manual_complete → done 遷移 + event 記録 + +## 1.3 E2E テスト (~100行) + +- [ ] `crates/miyabi-core/src/protocol.rs` の tests モジュールに E2E 追加 + ``` + #[test] + fn full_lifecycle_register_to_done() { + // 1. register(issue=1, title="test") + // 2. check_dependencies → ready + // 3. record_impact(risk=LOW) + // 4. assign_and_lock(agent="test", files=["src/test.rs"]) + // 5. record_branch("feature/issue-1-test") + // 6. record_pr(42) + // 7. record_merge("a1b2c3d4...40hex") + // 8. assert: state == Done, lock == None + } + ``` +- [ ] GATE 拒否テスト: issue=0 → GateError +- [ ] GATE 拒否テスト: impact なしで assign → GateError +- [ ] GATE 拒否テスト: HIGH risk + 承認なし → GateError +- [ ] GATE 拒否テスト: ロック競合 → LockError +- [ ] GATE 拒否テスト: 不正 SHA → GateError +- [ ] escape hatch テスト: force_unlock + manual_complete + +## 1.4 最終確認 + +- [ ] `cargo test --all` → 全 GREEN +- [ ] `cargo clippy --all-targets --all-features -- -D warnings` → ゼロエラー +- [ ] `cargo build --release` → リリースビルド成功 +- [ ] `npx gitnexus analyze --force` → 再インデックス +- [ ] `git tag v1.0-dtp-complete` +- [ ] `git push origin v1.0-dtp-complete` +- [ ] `~/bin/announce "Polaris v1.0 完成。全 GATE 実装済み。テスト GREEN。"` diff --git a/autorun/sprint-2-this-week/TASKS.md b/autorun/sprint-2-this-week/TASKS.md new file mode 100644 index 0000000..5662411 --- /dev/null +++ b/autorun/sprint-2-this-week/TASKS.md @@ -0,0 +1,39 @@ +# Sprint 2: OpenClaw ドッキング(今週) + +> Sprint 1 の v1.0 タグ完了後に開始 + +## 2.1 JSON 出力の標準化 (~30行) + +- [ ] 全コマンドの JSON 出力スキーマを統一 + ```json + { "status": "ok"|"gate_rejected"|"error", "exit_code": 0|1|2, "task_id": "...", "data": {} } + ``` +- [ ] テスト: 各コマンドの JSON が上記スキーマに準拠 + +## 2.2 OpenClaw hooks 連携 (~100行) + +- [ ] `miyabi gate register` 完了時に stdout に JSON イベント出力 +- [ ] `miyabi gate merge` 完了時に stdout に JSON イベント出力 +- [ ] OpenClaw hooks 設定に DTP イベントテンプレート追加 +- [ ] テスト: イベント出力が正しい形式 + +## 2.3 OpenClaw main 呼び出しテスト + +- [ ] OpenClaw main セッションで register → status → assign を実行 +- [ ] exit code で分岐する SOUL.md 追記 +- [ ] サブエージェント(カエデ)に作業を配布するテスト + +## 2.4 tasks.json の memory sync (~30行) + +- [ ] OpenClaw memory sync 対象に `project_memory/` を追加 +- [ ] sync 頻度設定(タスク変更時 + 定期5分) + +## 2.5 E2E: OpenClaw → miyabi gate → エージェント → merge + +- [ ] register → dispatchable → spawn kade → assign → pr → merge → done +- [ ] 全ステップのログ確認 + +## 承認ゲート + +- [ ] OpenClaw main が register → merge を完走 +- [ ] `git tag v1.1-openclaw-dock` diff --git a/autorun/sprint-3-next-week/TASKS.md b/autorun/sprint-3-next-week/TASKS.md new file mode 100644 index 0000000..013b4e9 --- /dev/null +++ b/autorun/sprint-3-next-week/TASKS.md @@ -0,0 +1,38 @@ +# Sprint 3: 運用基盤(来週) + +> Sprint 2 の v1.1 タグ完了後に開始 + +## 3.1 Heartbeat デーモン (~50行) + +- [ ] `miyabi gate heartbeat --all` で全アクティブタスクの lease 更新 +- [ ] launchd plist 作成(60秒間隔) +- [ ] `launchctl load` で自動起動 +- [ ] stale 検出テスト + +## 3.2 tasks.json git 自動同期 (~30行) + +- [ ] merge 完了時に自動 git add + commit + push +- [ ] hooks.rs に DtpTaskCompleted イベント追加 +- [ ] hooks.yaml に自動コミットフック登録 + +## 3.3 Telegram 通知 (~50行) + +- [ ] GATE 通過/拒否を Telegram に通知 +- [ ] HIGH/CRITICAL 承認要求を Telegram ボタンで +- [ ] Phase 完了報告 + +## 3.4 VOICEBOX アナウンス自動化 (~20行) + +- [ ] hooks.yaml で DTP イベント → announce 連携 +- [ ] テンプレート: "Polaris: {task_id} のゲート {gate_name} を通過しました" + +## 3.5 Maestro Playbook 登録 + +- [ ] Auto Run 形式に変換 +- [ ] Maestro GUI で実行確認 +- [ ] Session Isolation + Worktree Support + +## 承認ゲート + +- [ ] Heartbeat + Telegram + VOICEBOX が全て動作 +- [ ] `git tag v1.2-ops-ready` diff --git a/autorun/sprint-4-this-month/TASKS.md b/autorun/sprint-4-this-month/TASKS.md new file mode 100644 index 0000000..7a776e7 --- /dev/null +++ b/autorun/sprint-4-this-month/TASKS.md @@ -0,0 +1,27 @@ +# Sprint 4: 品質ゲート多層化(今月) + +> Sprint 3 の v1.2 タグ完了後に開始 + +## 4.1 rust-ai-pipeline Phase 1 統合 (~50行) + +- [ ] `miyabi gate assign` 後に `ai-pipeline phase1 --format json` 自動実行 +- [ ] `all_passed == false` → implementing に留まる +- [ ] `failure_kind` を tasks.json に記録 +- [ ] CLI に `miyabi gate quality-check ` 追加 + +## 4.2 proptest 拡張 (~100行) + +- [ ] gate.rs: ランダムタスク状態で GATE 一貫性検証 +- [ ] lock.rs: ランダムファイルセットで acquire/release 不変条件 +- [ ] store.rs: ランダムイベント列で snapshot rebuild 冪等性 + +## 4.3 cargo-mutants (~50行設定) + +- [ ] `cargo mutants` 実行 +- [ ] ミューテーションスコア 80% 以上 +- [ ] 殺せないミュータントにテスト追加 + +## 承認ゲート + +- [ ] mutation score 80%+ +- [ ] `git tag v1.3-quality-gates` diff --git a/skills/miyabi-gate-cli/SKILL.md b/skills/miyabi-gate-cli/SKILL.md new file mode 100644 index 0000000..5fbfff9 --- /dev/null +++ b/skills/miyabi-gate-cli/SKILL.md @@ -0,0 +1,160 @@ +# miyabi gate CLI — 確定的タスク実行スキル + +## 概要 + +Polaris (DTP) の CLI インターフェース。エージェントがタスクの登録・ロック・検証・完了を確定的に実行する。 + +## トリガー + +miyabi gate, polaris, dtp, タスク登録, ロック, GATE, 確定的, deterministic + +## 前提 + +- バイナリ: `cargo build --release` で `target/release/miyabi` を生成 +- ワークスペース: `/Users/shunsukehayashi/dev/platform/miyabi-cli-standalone` +- tasks.json: `project_memory/tasks.json`(デフォルト) + +## コマンド一覧 + +### タスク登録 + +```bash +miyabi gate register --issue 45 --title "認証移行" +miyabi gate register --issue 45 --title "認証移行" --format json +miyabi gate register --issue 45 --title "認証移行" --store-path /path/to/tasks.json +``` + +### タスク状態確認 + +```bash +miyabi gate status # 全タスク一覧 +miyabi gate status task-001 # 特定タスク +miyabi gate status --format json # JSON出力 +``` + +### 実行可能タスク + +```bash +miyabi gate dispatchable # DAG依存解決済みのタスク +miyabi gate dispatchable --format json +``` + +### DAG 可視化 + +```bash +miyabi gate dag # DAGレベル表示 +``` + +### impact 記録 + +```bash +miyabi gate impact task-001 --risk LOW --symbols 3 +miyabi gate impact task-001 --risk HIGH --symbols 12 # → 人間承認が必要 +miyabi gate impact task-001 --risk HIGH --symbols 12 --approve # 承認付き +``` + +### ロック獲得 + 実装開始 + +```bash +miyabi gate assign task-001 --agent codex --node macbook --files "src/auth.rs,src/middleware.rs" +``` + +### ブランチ記録 + +```bash +miyabi gate branch task-001 feature/issue-45-auth +``` + +### PR 記録 + +```bash +miyabi gate pr task-001 78 +``` + +### merge 検証 + 完了 + +```bash +miyabi gate merge task-001 a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2 +``` + +### ロック一覧 + +```bash +miyabi gate locks # 現在のロック一覧 +miyabi gate locks --format json +``` + +### escape hatch + +```bash +miyabi gate force-unlock task-001 --reason "agent crashed" --operator hayashi +miyabi gate manual-complete task-001 --reason "doc task, no PR" --operator hayashi +``` + +## exit code + +| コード | 意味 | エージェントの対処 | +|--------|------|------------------| +| 0 | 成功 | 次のステップへ進む | +| 1 | GATE 拒否 | 理由を確認して条件を満たしてからリトライ | +| 2 | 入力エラー | コマンドを修正して再実行 | + +## エージェントの使い方 + +### Claude Code から + +```bash +# タスク登録 +miyabi gate register --issue 45 --title "認証移行" --format json + +# 状態確認 +miyabi gate status task-001 --format json + +# ロック獲得 +miyabi gate assign task-001 --agent claude --node macbook --files "src/auth.rs" +``` + +### Codex から + +```bash +# Codex は --format json で結果をパースする +result=$(miyabi gate register --issue 45 --title "test" --format json) +exit_code=$? +if [ $exit_code -eq 0 ]; then + task_id=$(echo "$result" | jq -r '.task_id') + miyabi gate assign "$task_id" --agent codex --node macbook --files "src/test.rs" +fi +``` + +### OpenClaw から + +```bash +# OpenClaw main がディスパッチ +miyabi gate dispatchable --format json | jq -r '.[0].id' +# → サブエージェントに渡す +``` + +## GATE フロー + +``` +register (GATE 0: Issue必須) + → status: pending + → check_dependencies (GATE 2: 依存解決) + → status: ready + → impact (GATE 3: 分析記録 + HIGH承認) + → status: analyzing + → assign (GATE 4: ロック獲得) + → status: implementing + → branch (GATE 5: ブランチ名検証) + → pr (GATE 6: PR番号記録) + → status: reviewing + → merge (GATE 7: SHA検証) + → status: done ✅ +``` + +## 関連スキル + +- `polaris-ops` — 開発オペレーション全般 +- `rust-llm-pitfalls` — Rust 開発時の注意点 +- `context-and-impact` — コンテキスト収集パイプライン +- `gitnexus-impact-analysis` — GNI 影響分析 diff --git a/skills/self-improving-skills/skill-runs.jsonl b/skills/self-improving-skills/skill-runs.jsonl new file mode 100644 index 0000000..387e34d --- /dev/null +++ b/skills/self-improving-skills/skill-runs.jsonl @@ -0,0 +1,3 @@ +{"ts":"2026-04-09T16:35:38.725Z","agent":"codex","skill":"context-and-impact","task":"DTP Phase A: miyabi-core に gate/lock/store/protocol を追加し cargo test とコミットまで完了","result":"success","score":0.95,"notes":""} +{"ts":"2026-04-09T21:17:09.658Z","agent":"codex","skill":"context-and-impact","task":"DTP Phase B: miyabi gate CLI サブコマンド追加、protocol API 拡張、cargo test とコミット完了","result":"success","score":0.96,"notes":""} +{"ts":"2026-04-09T21:27:55.420Z","agent":"codex","skill":"context-and-impact","task":"miyabi-core の clippy 7件を解消し clippy/test を通過確認。ただし HEAD 差分ゼロのため指定コミットは未作成","result":"partial","score":0.78,"notes":""}