Skip to content
Back to skills

Org Resume

ASecurity

中断された組織を再開する。.state/org-state.md が存在し Status: SUSPENDED のとき、 「再開」「続きから」「前回どこまでやった?」と言われたときに使う。 起動時の自動ブリーフィングにも対応。

  • 5 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added October 5, 2026
ai-agentspythonbashgitapi

Works with

  • api

Security analysis

A100/100

Scanned October 5, 2026

npx -y skills add suisya-systems/claude-org-ja --skill org-resume --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Org Resume?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Org Resume
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/suisya-systems-org-resume/badge)](https://www.skillsdirectory.com/skills/suisya-systems-org-resume)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: org-resume
description: >
  中断された組織を再開する。.state/org-state.md が存在し Status: SUSPENDED のとき、
  「再開」「続きから」「前回どこまでやった?」と言われたときに使う。
  起動時の自動ブリーフィングにも対応。
effort: low
allowed-tools:
  - Read
  - Bash(git status)
  - Bash(git log:*)
  - Bash(py -3 tools/state_migrate.py)
  - Bash(python3 tools/state_migrate.py)
  - Bash(py -3 tools/journal_append.py:*)
  - Bash(bash tools/journal_append.sh:*)
  - Bash(python -m tools.state_db.importer:*)
---

# org-resume: 組織の再開

中断された組織の状態を読み込み、人間にブリーフィングし、再開する。

> **state DB 前提 (Issue #267 / M4)**: `.state/state.db` が唯一の SoT。
> read 経路は DB のみ (markdown fallback は M4 で撤去)、構造化セクションの
> write 経路は `StateWriter.transaction()` 経由(post-commit hook が
> `.state/org-state.md` を DB から自動再生成、markdown 直接編集禁止 —
> drift_check が検出する)。free-form な学び / Pending Lead 等は
> `notes/` 配下に保存する。`.state/journal.jsonl` は M4 で廃止。
> DB が無い場合は `python -m tools.state_db.importer --db .state/state.db --rebuild --no-strict` で構築する。

## Phase 1: 状態読み込みとブリーフィング

0. **state schema migration を実行する**(Set C §4.4 契約)。`.state/` 配下の JSON 状態を最新スキーマへ揃えてから読み込みに入る:

   ```bash
   py -3 tools/state_migrate.py    # Windows
   python3 tools/state_migrate.py   # Mac/Linux
   ```

   exit 0 なら続行。exit 1(未対応 version 残存)/ exit 2(migration ループ異常)なら人間に報告して停止する。
1. **DB から前回状態を取得する**(Phase 1 は軽量 briefing API、Issue #412):
   - `.state/state.db` が存在 → DB をクエリ:
     ```bash
     python -c "from tools.state_db import connect; from tools.state_db.queries import get_resume_briefing_light; import json; \
       conn = connect('.state/state.db'); \
       print(json.dumps(get_resume_briefing_light(conn), ensure_ascii=False, indent=2, default=str))"
     ```
     `active_runs` / `reserved_runs` / `recent_events` / `last_suspend_summary` でブリーフィング素材を作る。
     `session` には Status / Current Objective / suspended_at / resumed_at / resume_summary が圧縮されて入る(raw `resume_instructions` 本文と raw event `payload_json` は含まれない)。
     `active_inventory_dirs` は `runs.status` から逆引きした worker_dir 集合(state-semantics-contract I7 — `worker_dirs.lifecycle='active'` ではない)。
     必要があれば(極稀ケース)`get_resume_briefing` で raw payload / 完全な resume_instructions を取得できるが、起動時 Phase 1 では使わない。
   - DB が無い → 人間に rebuild を促す:
     「state.db not found. Run: `python -m tools.state_db.importer --db .state/state.db --root . --rebuild`」
2. 人間に簡潔なサマリーを提示する:
   - 全体の目標 (briefing の `session.objective`)
   - 各作業アイテムの状態 (完了/進行中/保留/ブロック、briefing の `active_runs` / `reserved_runs`)
   - 中断時刻 (briefing の `last_suspend_summary.occurred_at`、reason / counts も同 dict)
3. `notes/` 配下にある自由記述 (学び / Pending Lead / セッションサマリー) を確認する

## Phase 2: 現実との照合

DB の active_runs を SoT として照合し、markdown は表示用補助とする。

1. DB から取得した active_runs(または markdown の Worker Directory Registry)を起点に、各 run の `worker_dir` を確認する
2. `.state/workers/` 内の各ワーカー状態ファイルも参照する(旧経路)
3. 各ワーカーの作業ディレクトリで以下を確認:
   - ディレクトリが存在するか
   - `git status` — 未コミットの変更があるか
   - `git log --oneline -5` — 最後のコミットは run の `commit_short` / 状態ファイルと一致するか
   - ブランチは run の `branch` / 状態ファイルの記述と一致するか
4. `knowledge/raw/` に未整理のファイルがあるか確認
5. 差異があれば人間に報告する(例: 「DB ではOAuth run が in_use ですが、ディレクトリが存在しません」)

## Phase 3: 再開計画の提案

状態に応じて提案を分ける:

- **COMPLETED**: 結果を報告するのみ
- **IN_PROGRESS(中断済み)**: 「未コミットの変更があります。ワーカーを派遣して続行しますか?」
- **PENDING**: ブロッカーの状態を確認し、実行可能か判断
- **BLOCKED**: ブロッカーの解消状況を確認

**重要: 人間の確認を待ってから行動すること。勝手にワーカーを派遣しない。**

## Phase 4: 組織の再構築

人間が承認した作業について:

1. `/org-delegate` スキルでワーカーを派遣
2. 新ワーカーには前回のワーカー状態ファイル(`.state/workers/worker-{id}.md`)の内容をコンテキストとして渡す
3. **DB に Status / Resumed を書く**(`StateWriter.transaction()` 経由。post-commit hook が `.state/org-state.md` の Status 行を `ACTIVE` に更新する。regen 失敗時も DB は確定済みで stderr 警告のみ):

   ```bash
   python -c "
   from datetime import datetime, timezone
   from pathlib import Path
   from tools.state_db import connect
   from tools.state_db.writer import StateWriter
   ts = datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%fZ')
   conn = connect('.state/state.db')
   with StateWriter(conn, claude_org_root=Path('.')).transaction() as w:
       w.update_session(status='ACTIVE', resumed_at=ts, updated_at=ts)
   "
   ```
4. JSON スナップショットを再生成する(dashboard 用。state-db cutover とは別経路):

   ```bash
   py -3 dashboard/org_state_converter.py    # Windows
   python3 dashboard/org_state_converter.py   # Mac/Linux
   ```

5. ディスパッチャー・キュレーターペインの起動は /org-start が担当するため、ここでは行わない
6. resume イベントを DB に追記 (`tools/journal_append.py` は M4 で DB-only ルーティング。`ts` は自動付与):
   ```bash
   py -3 tools/journal_append.py resume \
       --json '{"resumed_items": ["blog-redesign", "data-analysis"]}'
   ```
   event 名と payload key の規約は [`docs/journal-events.md`](../../../docs/journal-events.md) を参照。

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.