Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
80b7b71
feat: track shogun CLI and installer in repo
ysaitogrander May 25, 2026
4ae90a0
fix: use relative path for stop_hook in settings.json
ysaitogrander May 25, 2026
9240248
fix: keep Claude Code processes safe from inbox_watcher pkill
ysaitogrander May 25, 2026
73448e6
feat: add idle auto-clear daemon for bloated idle ashigaru (cmd_585)
ysaitogrander May 28, 2026
45b45e3
docs: sync TVF Protocol drift via build_instructions (cmd_585 cleanup)
ysaitogrander May 28, 2026
a7564a2
feat: add Backlog URL domain check to PR quality rules
ysaitogrander Jun 3, 2026
e59063a
docs(copilot): Shogun向けashigaru_copilot協業方法を明文化・cmd_705起草
ysaitogrander Jun 3, 2026
f41203a
Revert "docs(copilot): Shogun向けashigaru_copilot協業方法を明文化・cmd_705起草"
ysaitogrander Jun 3, 2026
8e37fe9
docs(copilot): agmsgベースのashigaru_copilot協業方法を追記
ysaitogrander Jun 3, 2026
4cb44bc
fix: restore figma guard scripts removed by accidental revert
ysaitogrander Jun 3, 2026
2be24f6
fix(registry): exclude non-numeric ashigaru agents from pane monitoring
ysaitogrander Jun 3, 2026
c219630
feat(safety): extract validate_command/warn_external_api to lib/copil…
ysaitogrander Jun 3, 2026
1d97131
docs(copilot): neutralize internal terms in collaboration section + u…
ysaitogrander Jun 3, 2026
602dd36
feat(assign): refactor assign_to_copilot.sh — tmux wake removal, shar…
ysaitogrander Jun 3, 2026
f51dfd1
feat(watcher): add scripts/copilot_watcher.sh — polling watcher for C…
ysaitogrander Jun 3, 2026
effe851
feat(watchdog): add scripts/fleet_watchdog.sh — karo停止検知・再nudge番犬 (cm…
ysaitogrander Jun 3, 2026
e2317c0
feat(safety): add dedup guard to assign_to_copilot.sh — RACE-001 in-f…
ysaitogrander Jun 3, 2026
729f6f8
fix(watcher): route gunshi/karo reports via file-inbox in copilot_wat…
ysaitogrander Jun 3, 2026
2f262cc
feat(supervisor): W4 live @agent_id reverse lookup — eliminate static…
ysaitogrander Jun 3, 2026
14a63c3
feat(assign): add agmsg wake to copilot after task YAML write in assi…
ysaitogrander Jun 4, 2026
491d7f7
feat(figma-guard): add shared lib for H2/H3/H4 — cmd_707 H1
ysaitogrander Jun 4, 2026
61a4209
feat(figma-guard): add Figma delegation gate to assign_to_copilot.sh …
ysaitogrander Jun 4, 2026
81a2023
feat(figma-guard): add is_definitely_figma_ui for positive-only assig…
ysaitogrander Jun 4, 2026
505eb82
fix(supervisor): pin tmux list-panes to multiagent:agents window (cmd…
ysaitogrander Jun 4, 2026
5af378f
feat(canonical-map): add per-screen Figma node map for Wave2 (subtask…
ysaitogrander Jun 4, 2026
c7288f8
feat(canonical-map): clarify face-check user detail cluster as active…
ysaitogrander Jun 5, 2026
27eb253
feat(canonical-map): add gateway rule for current vs deprecated Figma…
ysaitogrander Jun 5, 2026
11c29d3
build(instructions): propagate TVF 2段判定 to all generated/* variants (…
ysaitogrander Jun 5, 2026
a673dcb
feat(cmd_716): Phase1 差分台帳+Figma証跡 — 整理券管理(抽選状況)系顔写真チェック画面群
ysaitogrander Jun 5, 2026
f1a51a1
chore(canonical-map): cmd_716 Phase1監査結果を整理券管理MONセクションに追記
ysaitogrander Jun 5, 2026
c167477
feat(instructions): UI実装PRのFigma証跡同梱必須を制度化(cmd_717 A)
ysaitogrander Jun 5, 2026
567b7b8
feat(figma-evidence-guard): per-PR証跡走査化 — cmd_717(B)
ysaitogrander Jun 5, 2026
ee5222f
chore(figma-evidence): cmd_718 Phase1 整理券管理(抽選予約) 6node REST取得証跡 (ash…
ysaitogrander Jun 5, 2026
6325d9e
chore(backlog-issue): cmd_716 B-FACE-RAFFLE-001/002/003 実起票 + 台帳issue…
ysaitogrander Jun 5, 2026
b06663e
feat(cmd_719): token-diet scripts — append_cmd.sh/archive_done_cmds.s…
ysaitogrander Jun 5, 2026
41e51b7
chore(report): ashigaru2 cmd_719 token-diet scripts 完了報告
ysaitogrander Jun 5, 2026
063cd6d
feat(cmd_720): CLAUDE.md.slim候補+規則カバレッジ対照表 (ashigaru2)
ysaitogrander Jun 5, 2026
4b72f7f
chore(CLAUDE.md): slim down config — remove verbose comments and exam…
ysaitogrander Jun 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"hooks": [
{
"type": "command",
"command": "bash /home/tono/multi-agent-shogun/scripts/stop_hook_inbox.sh",
"command": "bash scripts/stop_hook_inbox.sh",
"timeout": 60
}
]
Expand Down
44 changes: 44 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,50 @@ System manages ALL white-collar work, not just self-improvement. Project folders
3. **E2Eテストは家老が担当**: 全エージェント操作権限を持つ家老がE2Eを実行。足軽はユニットテストのみ。
4. **テスト計画レビュー**: 家老はテスト計画を事前レビューし、前提条件の実現可能性を確認してから実行に移す。

# TVF Protocol — Task Verification First (all agents)

**事実検証ファースト**プロトコル。Lord の前提主張と外部実態(Figma / 仕様書 / 外部API 等)の乖離による
誤実装を未然に防ぐ仕組み。軍師 cmd_510 v2 監査の制度化として全エージェントに義務化する。

## 4層構造

| 層 | 役割 | 担当 | 詳細 |
|----|------|------|------|
| A | 指示テンプレ4ブロック必須化 | Karo | `instructions/roles/karo_role.md` → TVF Protocol 節 |
| B | self-check(実装前の事実確認) | Ashigaru | `instructions/roles/ashigaru_role.md` → TVF 節 |
| C | report テンプレに purpose_gap 必須化 | Ashigaru → Gunshi → Karo | 下記参照 |
| D | サブエージェント種別整合性チェック | Ashigaru | `instructions/roles/ashigaru_role.md` → TVF 節 |

## Figma 正典マップ(canonical-map)

Figma ファイル・ノードの権威情報は `context/figma-canonical-map.md` に集約する。
実装着手前・チケット起票時は必ずこのマップを参照し、正典ファイルキーと代表ノードを確認すること。
固定値を指示文や instructions に直書きせず、常に本マップを参照経由とすること(系統別可変のため)。

- **管理画面系チケット起票時必須**: 対応 Figma ノード ID と URL を本マップを引いて明記。不明な場合は「要特定」と記載(捏造禁止)。
- **廃止画面**: ユーザー詳細画面(standalone `/users/{id}`)は存在しない(Backlog: USER-10)。実装禁止。
- **タブレット系**: 2026-06-03 裁定により旧ファイルから `xDQ4U6O2LUfIrftJGzacqm` へ切替済。旧ファイルは参照外。

## C: purpose_gap 必須フィールド

完了報告 YAML には次のフィールドを必須記載する(Figma準拠以外のタスクも対象)。

```yaml
purpose_gap:
detected: false # MANDATORY — true | false
description: "" # 殿/家老の前提と実態に乖離があった場合の詳細。なければ空
action_taken: "該当なし" # "報告して保留" | "殿確認後修正" | "該当なし"
```

`detected: true` の場合、Ashigaru は即座に家老へ inbox_write し、実装を保留せよ。
無申告で実装した場合は F005 違反扱いとする。

## skill 連携

- 🥇 `figma-fresh-fetch-guard` — Pre-PR hook (48h 以内取得証跡必須化) **High推奨**
- 🥈 `figma-component-type-checker` — Figma 種別と実装 UI の差分自動検知 **Med-High**
- 🥉 `lord-assumption-verifier` — Lord 指示の事実主張を自動検証 **High推奨へ昇格**(軍師 cmd_510 v2)

# Batch Processing Protocol (all agents)

When processing large datasets (30+ items requiring individual web search, API calls, or LLM generation), follow this protocol. Skipping steps wastes tokens on bad approaches that get repeated across all batches.
Expand Down
50 changes: 32 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@

# Multi-CLI: CLI-specific tool descriptions
!instructions/cli_specific/
!instructions/cli_specific/claude_tools.md
!instructions/cli_specific/codex_tools.md
!instructions/cli_specific/copilot_tools.md
!instructions/cli_specific/kimi_tools.md
!instructions/cli_specific/opencode_tools.md
!instructions/cli_specific/claude_tools.md
!instructions/cli_specific/codex_tools.md
!instructions/cli_specific/copilot_tools.md
!instructions/cli_specific/kimi_tools.md
!instructions/cli_specific/opencode_tools.md

# Multi-CLI: Build template parts (roles, common sections)
!instructions/roles/
Expand All @@ -56,32 +56,36 @@
!lib/ntfy_auth.sh
!lib/agent_status.sh
!lib/agent_registry.sh
!lib/copilot_safety.sh
!lib/figma_guard_common.sh

# Multi-CLI: Codex auto-load file
!AGENTS.md

# Multi-CLI: OpenCode agent file
!.opencode/agents/*.md
.opencode/agents/*-runtime.md

# Multi-CLI: OpenCode custom tools
!.opencode/tools/
!.opencode/tools/mark-as-read.ts
# Multi-CLI: OpenCode agent file
!.opencode/agents/*.md
.opencode/agents/*-runtime.md
# Multi-CLI: OpenCode custom tools
!.opencode/tools/
!.opencode/tools/mark-as-read.ts

# Setup and deployment scripts
!shutsujin_departure.sh
!first_setup.sh
!setup.sh
!install.bat
!/shogun
!/install_shogun_cli.sh

# Development tooling
!Makefile

# Config (sample files only, no secrets)
!config/
!config/ntfy_auth.env.sample
!config/opencode-tui.json
!config/opencode-permissions.yaml
!config/
!config/ntfy_auth.env.sample
!config/opencode-tui.json
!config/opencode-permissions.yaml

# Templates
!templates/
Expand All @@ -90,6 +94,7 @@
# Context README
!context/
!context/README.md
!context/figma-canonical-map.md

# Python venv
!requirements.txt
Expand All @@ -99,6 +104,7 @@
!scripts/inbox_write.sh
!scripts/inbox_watcher.sh
!scripts/watcher_supervisor.sh
!scripts/idle_auto_clear.sh
!scripts/ntfy.sh
!scripts/ntfy_listener.sh
!scripts/build_instructions.sh
Expand All @@ -112,7 +118,11 @@
!scripts/ratelimit_check.sh
!scripts/switch_cli.sh
!scripts/dashboard-viewer.py

!scripts/figma_fresh_fetch_guard.sh
!scripts/figma_fetch_record.sh
!scripts/assign_to_copilot.sh
!scripts/copilot_watcher.sh
!scripts/fleet_watchdog.sh

# SayTask (sample template only, not actual data)
!saytask/
Expand All @@ -129,6 +139,10 @@ logs/
!docs/
!docs/philosophy.md
!docs/vps_pr118_verification_plan.md
!docs/figma-evidence-guard.md
!docs/figma-evidence/
!docs/figma-evidence/*.md
!docs/figma-evidence/*.json

# Screenshots (masked — no secrets)
!images/
Expand Down
114 changes: 108 additions & 6 deletions .opencode/agents/ashigaru1.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,52 @@ result:
files_modified:
- "/path/to/file"
notes: "Additional details"

# TVF Protocol C — Lord/家老の前提主張と実態の乖離を申告するフィールド(軍師 cmd_510 v2 制度化)
purpose_gap:
detected: false # MANDATORY — true | false
description: "" # 殿/家老の前提と実態に乖離があった場合の詳細。なければ空
action_taken: "該当なし" # "報告して保留" | "殿確認後修正" | "該当なし"

skill_candidate:
found: false # MANDATORY — true/false
# If true, also include:
name: null # e.g., "readme-improver"
description: null # e.g., "Improve README for beginners"
reason: null # e.g., "Same pattern executed 3 times"

# PRを伴うタスク必須 — CI全体(phpunit+lint等) conclusion:success 実測確認結果
# PRなし・instructions編集等の非PRタスクはrun_id/conclusion=null可
ci:
run_id: null # gh run ID (例: 12345678901) — 実測値を記載。捏造禁止。
conclusion: null # "success" | "failure" | null(PRなしタスクはnull)

# Figma準拠タスクのみ必須(非 Figma タスクは省略可)
tvf_verification:
canonical_map_checked: true # context/figma-canonical-map.md を参照したか
figma_node_ids: [] # 確認した Figma node ID のリスト(捏造禁止)
fetch_date: "" # 本タスク内でのフェッチ日時(YYYY-MM-DD)
within_48h: true

# Figma準拠タスクのみ必須(非 Figma タスクは省略可)— TVF 2段判定結果(cmd_715 R2案)
figma_node_verification:
referenced_node: "4560:xxxxx" # 参照したFigma nodeID(捏造禁止)
stage1_traceable_to_canonical: true # 現行正典(4560:41601/89033 section)にトレース可
stage1_canonical_map_listed: true # figma-canonical-map.md 画面別nodeマップに掲載
stage2_content_fetched: true # node-content をFigma REST/MCPで実取得
stage2_feature_matches_content: true # node内容に当該機能が実在(frame名/項目一致)
evidence_log: "" # logs/figma_fetch_evidence.log の該当行
# いずれかfalse → 実装着手不可・家老へ要特定申告(F005相当違反)
```

**Required fields**: worker_id, task_id, parent_cmd, status, timestamp, result, skill_candidate.
**Required fields**: worker_id, task_id, parent_cmd, status, timestamp, result, purpose_gap, skill_candidate, ci.
Figma準拠タスクでは `tvf_verification` と `figma_node_verification` も必須。
**PRを伴うタスク**: `ci.run_id` + `ci.conclusion` は実測値必須(ローカル pass のみでの完了報告禁止 — local-vs-CIギャップ防止)。
Missing fields = incomplete report.

`purpose_gap.detected: true` の場合は実装を保留し、家老へ inbox_write で即報告すること。
無申告で進めた場合は F005(前提検証スキップ)違反扱いとなる。

## Race Condition (RACE-001)

No concurrent writes to the same file by multiple ashigaru.
Expand Down Expand Up @@ -111,11 +146,17 @@ Act without waiting for Karo's instruction:

**On task completion** (in this order):
1. Self-review deliverables (re-read your output)
2. **Purpose validation**: Read `parent_cmd` in `queue/shogun_to_karo.yaml` and verify your deliverable actually achieves the cmd's stated purpose. If there's a gap between the cmd purpose and your output, note it in the report under `purpose_gap:`.
3. Write report YAML
4. Notify Gunshi via inbox_write (NOT Karo directly)
5. **Check own inbox** (MANDATORY): Read `queue/inbox/ashigaru{N}.yaml`, process any `read: false` entries. This catches redo instructions that arrived during task execution. Skip = stuck idle until the next nudge escalation or task reassignment.
6. (No delivery verification needed — inbox_write guarantees persistence)
2. **CI green check** (PRを伴うタスク必須 — SKIP=FAIL):
`gh run list --branch <branch> --limit 1 --json databaseId,status,conclusion` を実行し、
CI 全体(phpunit + lint 等) の `conclusion: success` を★実測確認★してから次へ進む。
ローカル部分実行の pass 単独での完了報告は禁止(local-vs-CIギャップ防止)。
run_id と conclusion を report YAML の `ci` フィールドに必須記載する。
PRなしタスク(instructions編集・調査等)は `ci.run_id: null, ci.conclusion: null` で可。
3. **Purpose validation**: Read `parent_cmd` in `queue/shogun_to_karo.yaml` and verify your deliverable actually achieves the cmd's stated purpose. If there's a gap between the cmd purpose and your output, note it in the report under `purpose_gap:`.
4. Write report YAML
5. Notify Gunshi via inbox_write (NOT Karo directly)
6. **Check own inbox** (MANDATORY): Read `queue/inbox/ashigaru{N}.yaml`, process any `read: false` entries. This catches redo instructions that arrived during task execution. Skip = stuck idle until the next nudge escalation or task reassignment.
(No delivery verification needed — inbox_write guarantees persistence)

**Quality assurance:**
- After modifying files → verify with Read
Expand All @@ -126,6 +167,67 @@ Act without waiting for Karo's instruction:
- Context below 30% → write progress to report YAML, tell Gunshi "context running low"
- Task larger than expected → include split proposal in report

## TVF (事実検証ファースト) プロトコル

Figma 準拠系タスク/Lord の事実主張に基づくタスクを受領したら、実装着手前に以下を必ず実行する。
(軍師 cmd_510 v2 監査の制度化。CLAUDE.md「TVF Protocol」節を併読のこと)

### TVF 2段判定(Figma node を実装根拠にする前に必須)

Figma node を実装の根拠とする際は、着手前に次の2段を both YES で通過せよ。
どちらかが NO なら着手するな——家老へ「要特定」を申告せよ。
(`context/figma-canonical-map.md` 関所ルールと連動。canonical-mapの画面別nodeマップを参照経由とすること)

1. **第1段 トレーサビリティ**: 参照nodeが現行正典にトレース可か。
- 現行正典 = xDQ4U(admin: section 4560:41601 / tablet: section 4560:89033・いずれも20260527)。
- `context/figma-canonical-map.md` の「画面別nodeマップ」に当該nodeが載るか確認。
- ★旧node禁止★: 209:23439 / 1051:22288 / 62系 / 1063:26512 / z7Uqファイル等を根拠にするな(関所で停止・申告)。
2. **第2段 コンテンツ照合**: その node の内容に当該機能が実在するか。
- ★Figma REST/MCP で node-content を実取得し、frame名・表示項目・UI が実装機能と一致することを目視確認★。
- ★backlog/triage doc/PDF/過去報告 単体を実装根拠にするな★——必ずFigma現行nodeの実取得で裏取りせよ。
- develop実コードで「現存実装」も確認(既実装の重複/誤実装を防ぐ。例: F-S3/F-QRは既実装だった)。

完了報告には `figma_node_verification`(stage1/stage2 各true・evidence_log)を必須記載。
いずれか false の実装は F005相当(事実検証スキップ)違反。

### Self-check (実装前・必須)

- [ ] **Fresh fetch**: `context/figma-canonical-map.md` で対象システムの正典ファイルキーを確認後、Figma MCP で当該 node を本タスク内で再取得(24 時間以内のキャッシュ証跡不可)
- [ ] **Component inventory**: 取得結果のコンポーネント種別(Toggle / Switch / Radio / Checkbox 等)を report の `component_inventory` フィールドに列挙
- [ ] **Assumption verification**: 殿/家老の前提主張と Figma 実態に乖離があれば即報告し、実装を保留(家老へ inbox_write、`purpose_gap.detected: true` で報告)
- [ ] **PR 必須記載**: Figma 再取得日時・nodeID・コンポーネント種別を PR 本文に必須記載
- [ ] **Backlog リンクドメイン**: PR 本文に Backlog URL を記載する場合は `grander.backlog.jp` を使用(`grander.backlog.com` は誤ドメイン・404になる)。完了定義: `grep grander.backlog.com <PR本文>` でゼロ件を実測確認。
- [ ] **UI確認 / スクリーンショット / E2E**: UI確認・スクリーンショット・E2E は **Laravel Dusk** で行う。**★`mcp__playwright__browser_*` 系 MCP ツールでブラウザを起動するな★**。E2E/Dusk は家老担当・足軽はユニットテストのみ(詳細: `context/line_raffle.md` テスト方針参照)。

### サブエージェント自動チェック (Task tool 利用時)

`figma-implement-design` または同系 skill を Task tool で利用した直後、サブエージェントに以下を必須依頼する:

1. Figma コンポーネント種別と実装コンポーネント種別の一致確認
2. 不一致の場合は理由を必須記載
3. 一致確認結果を report の `subagent_verification` フィールドに転記

```yaml
subagent_verification:
performed: true
agent: "figma-implement-design"
figma_component_type: "Radio input"
implemented_component_type: "Radio input" # 一致した実装コンポーネント
mismatch_reason: "" # 不一致時のみ理由必須
```

### 違反時の扱い

- Fresh fetch 証跡なし → タスク報告は不完全扱い、家老が redo を発令
- 種別不一致を黙って実装 → `purpose_gap.detected: true` 必須、無申告は F005 違反
- サブエージェント verification 省略 → Figma準拠系タスクでは report 不完全扱い

### 関連 skill 候補(軍師 cmd_510 v2 提案)

- 🥇 `figma-fresh-fetch-guard` — Pre-PR hook で 48h 以内取得証跡を必須化(High推奨)
- 🥈 `figma-component-type-checker` — Figma 種別と実装 UI の差分自動検知(Med-High)
- 🥉 `lord-assumption-verifier` — Lord 指示の事実主張を自動検証(Med → High 昇格推奨)

## Shout Mode (echo_message)

After task completion, check whether to echo a battle cry:
Expand Down
Loading