session-start

star 0

Session start report -- git status, PR/CI, Issue list, recommended tasks. Auto-invoked by other skills.

o3-ozono By o3-ozono schedule Updated 6/16/2026

name: session-start description: "Session start report -- git status, PR/CI, Issue list, recommended tasks. Auto-invoked by other skills."

Session Start Routine

If you were dispatched as a subagent to execute a specific task, skip this skill entirely.

Run independent information-gathering steps in parallel. Phase 0 must complete alone first.

Phase 0: Update Repository (run alone)

  1. git branch --show-current
  2. git status --short
  3. On main: git pull origin main --ff-only
  4. Not on main: Run branch auto-return logic (below)
  5. Stale Worktree Cleanup: git worktree list --porcelain. If stale worktrees exist, run git worktree prune. Record for Phase 3 report.
  6. git log --oneline -5

Branch Auto-Return Logic

  1. git fetch origin main
  2. git log --oneline origin/main..HEAD --no-merges
  3. 0 commits → git checkout main && git pull origin main (auto-return)
  4. 1+ commits → gh pr list --head <branch> --state merged
  5. Merged PR found → auto-return to main
  6. No merged PR → report as ongoing work

Phase 1: Information Gathering (parallel)

A. GitHub Account Check

  • gh api user --jq .login

B. Open PRs and CI

  1. gh pr list --author @me --state open
  2. For open PRs → gh pr view <number> --json title,state,reviewDecision,statusCheckRollup,mergeable
  3. 別セッション検出(lease スキャン): scripts/session-lease-scan.sh を実行し、stdout に出力された branch 名を「別セッション作業中 branch セット」として記録する。 このヘルパは BRANCH_LEASE_DIR(既定 /tmp/claude-branch-leases)を走査し、BRANCH_LEASE_TTL_LOCAL(既定 7200s)以内の fresh lease を持つ branch を列挙する。 Draft 状態・CI 状態・mergeable を問わず、ヘルパ出力に headRefName が含まれる open PR はすべて 🔒 別セッション作業中 として扱う(read-only 表示のみ)。

C. GitHub Issues

  • gh issue list --state open --limit 20

D. First-Time Setup and Legacy Migration (.claude/config.yml)

This phase handles (a) first-time project setup and (b) migration from the legacy .claude/workflow-config.yml to .claude/config.yml. The single source of truth for project-side settings is now .claude/config.yml (carrying the platform field migrated from the old workflow-config.yml). All migration logic is idempotent and logs its outcome into the Phase 3 sync report (migrated / skipped / merged / no-op).

D-1. Legacy migration branches (AC7)

Evaluate the two files and act per the branch table below. All branches are idempotent: running this phase twice on the same project state is a no-op on the second run.

.claude/workflow-config.yml (old) .claude/config.yml (new) Action Sync report
present absent old-only — write new file (platform field, see D-3), then delete old. If the write fails, leave old in place (no partial state). migrated: workflow-config.yml → config.yml
absent present new-only — no-op. skipped: config.yml already present
present present, platform key present in new both-exist, platform present — delete old only; do not merge (duplicate merge is skipped to avoid silently overwriting a user edit). merged-skipped: config.yml already owns platform; deleted old workflow-config.yml
present present, platform key absent in new both-exist, platform absent — merge the old platform value into new, then delete old. merged: platform from old workflow-config.yml → config.yml; deleted old
absent absent both-absent — no-op (first-time setup runs in D-2 next). (no entry; D-2 may add one)

The write-then-delete ordering (old-only and both-exist/platform-absent branches) keeps the process crash-safe: if the process dies between the write and the delete, the next session re-enters D-1 and the both-exist branch idempotently completes the delete without re-writing.

D-2. First-time setup (only when both files are absent)

If both .claude/workflow-config.yml and .claude/config.yml are absent after D-1:

  1. Auto-detect platform:
    • *.xcodeproj, *.xcworkspace, or Package.swiftios
    • package.jsonweb
    • Neither → "No platform detected. Run /atdd-kit:setup-ios or /atdd-kit:setup-web."
  2. Confirm with user — read ${CLAUDE_PLUGIN_ROOT}/addons/<platform>/addon.yml and show:
    <Platform> project detected. The following will be set up:
    
    MCP Servers:  <list mcp_servers keys from addon.yml>
    Hooks:        <list matcher patterns from addon.yml hooks>
    Deploy Files: <list dest paths from addon.yml deploy>
    Skills:       <list skills from addon.yml>
    
    Proceed? [Y/n]
    
  3. Process addon:
    • MCP servers: Merge mcp_servers into .mcp.json (create if missing, preserve existing)
    • Deploy files: Copy each deploy entry from ${CLAUDE_PLUGIN_ROOT}/addons/<platform>/<src> to <dest>
    • Hooks: Add hooks.PreToolUse entries to .claude/settings.json (preserve existing)
    • Guidance: Display the guidance text
  4. Optional addons (opt-in, default OFF): these are not auto-detected from repo files; offer each and require an explicit y before enabling — never enable without consent.
    • Discord notifications (${CLAUDE_PLUGIN_ROOT}/addons/discord/): per-issue Discord threads streaming full-autopilot progress / escalations. Ask Enable Discord notifications addon? (needs a forum-channel webhook) [y/N] — default N. Only on explicit y, run the /atdd-kit:setup-discord steps (deploy addons/discord/scripts/fa-notify-discord.sh, configure FA_NOTIFY_CMD / FA_DISCORD_WEBHOOK). On no/blank, skip silently.
  5. Write .claude/config.yml using the template spec in D-3 below.
  6. Continue to Phase 1-E

D-3. .claude/config.yml template (idempotent)

Every write to .claude/config.yml under D-1 (old-only migration) and D-2 (first-time setup) writes the platform field. Skip writing if the file already has a platform section so the process is idempotent (running the phase twice never duplicates or overwrites a user edit), and validates as YAML (DoD smoke test: python3 -c "import yaml; yaml.safe_load(open('.claude/config.yml'))").

Reference template (embed verbatim):

platform:
  - <detected-platform>

E. Plugin Version Check

  • Run ${CLAUDE_PLUGIN_ROOT}/scripts/check-plugin-version.sh "${CLAUDE_PLUGIN_ROOT}" "${HOME}/.claude/plugin-cache"
  • Parse output (check in this order):
    • FIRST_RUN: 2 lines: FIRST_RUN, <version>. Show current version in report.
    • STALE_SESSION: 3 lines: STALE_SESSION, <loaded>, <cached>. The current session is running a version older than the marker — another newer session already ran. Skip E2 Auto-Sync entirely. Show in report: "⚠ ロード版 v<loaded> がマーカー版 v<cached> より古い — セッション再起動が必要"
    • RESTART_REQUIRED: 3 lines: RESTART_REQUIRED, <loaded>, <installed>. A newer version is installed locally but not yet active. Skip E2 Auto-Sync entirely. Show in report: "⚠ 新版 v<installed> がインストール済み — セッション再起動で反映されます"
    • NO_UPDATE: No action.
    • UPDATED: 5 lines: UPDATED, <old>, <new>, VERSIONS: <N|UNKNOWN>, BREAKING: <M>. Parse counts for report.

E2. Auto-Sync on Plugin Update (only if UPDATED — STALE_SESSION / RESTART_REQUIRED 時は実行しない)

Read .claude/config.yml for platform. For each platform:

  1. Read ${CLAUDE_PLUGIN_ROOT}/addons/<platform>/addon.yml
  2. Copy each deploy entry (overwrite without asking)

Always-sync files (all platforms):

Plugin Source Project Destination
templates/issue/en/*.yml .github/ISSUE_TEMPLATE/*.yml
templates/issue/ja/*.yml .github/ISSUE_TEMPLATE/*-ja.yml
templates/pr/en/pull_request_template.md .github/pull_request_template.md

Record synced files for the Phase 3 report.

F. Recent Activity (24h)

In parallel:

  1. gh pr list --state merged --search "merged:>=$(date -u -v-24H +%Y-%m-%dT%H:%M:%SZ)" --limit 10 --json number,title,mergedAt
  2. gh issue list --state closed --json number,title,closedAt --limit 10 — filter to last 24h

If both results are empty, skip the Recent Activity section.

G. Agent Teams Environment Check

Ensure CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 in .claude/settings.local.json (per-machine, gitignored).

  1. Read .claude/settings.local.json:
    • Missing → create with:
      {
        "env": {
          "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
        }
      }
      
      Report: "Agent Teams env var configured."
    • Invalid JSON → warn: ".claude/settings.local.json contains invalid JSON — fix manually." Skip (do not block).
    • Valid JSON, key missing → deep-merge {"env": {"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"}}, preserving all other keys. Report: "Agent Teams env var added."
    • Key present → no action.

Phase 2: Status Assessment

Status Condition
Auto-returned Branch auto-return ran in Phase 0
Ongoing work Not on main, unmerged commits exist
Clean start On main, no uncommitted changes, no open PRs
Needs cleanup Uncommitted changes present

Phase 3: Summary Report

## Session Start Report

**Plugin Version:** atdd-kit vX.Y.Z
**Agent Teams:** Configured           <-- only if settings.local.json was created or updated in Phase 1-G
**Updated: v<old> → v<new> (<N> versions, <M> breaking changes). See CHANGELOG.md for details.**  <-- only if UPDATED
**⚠ BREAKING CHANGE detected**      <-- only if UPDATED and BREAKING > 0
**⚠ ロード版 v<loaded> がマーカー版 v<cached> より古い — セッション再起動が必要**  <-- only if STALE_SESSION
**⚠ 新版 v<installed> がインストール済み — セッション再起動で反映されます**        <-- only if RESTART_REQUIRED

### Plugin Sync  <-- only if UPDATED
| File | Status |
|------|--------|
| .github/ISSUE_TEMPLATE/development.yml | Updated |
| .github/pull_request_template.md | Updated |
| .claude/hooks/sim-pool-guard.sh | Updated (iOS) |

**Branch:** `<branch>` (<clean / uncommitted changes>)

### Previous Work  <-- only if ongoing work exists
- PR #XX: <title> -- <CI status> / <review status> / ⚠ CONFLICTING  <-- if ready (non-Draft) @me PR and mergeable == CONFLICTING, and branch NOT in session-lease-scan output
- 🔒 別セッション作業中: PR #YY: <title>  <-- if open PR and branch is in session-lease-scan output (fresh lease held by another session); read-only display only; Draft/green/mergeable 問わず適用

### Recent Activity (24h)  <-- only if recent activity exists
| Type | # | Title | When |
|------|---|-------|------|
| PR merged | #XX | <title> | 3h ago |
| Issue closed | #YY | <title> | 12h ago |

### Worktree Cleanup  <-- only if stale worktrees were found
| Worktree | Action |
|----------|--------|
| worktree-123 | Pruned (orphaned) |

### Open Issues
| # | Title | Labels |
|---|-------|--------|

### Recommended Tasks
| Priority | Issue | Reason | 推奨経路 |
|----------|-------|--------|----------|

Task Recommendation Rules

Step 1: Build exclusion list

  1. Issues with in-progress label → EXCLUDE_SET
  2. Issues with open PRs (Phase 1-B) → add to EXCLUDE_SET
  3. Lease-based exclusion: Issues whose PR branch appears in session-lease-scan output (fresh lease 保持 → 別セッション作業中) → add to EXCLUDE_SET(Draft/非 Draft・CI 状態・mergeable を問わず除外)

Step 2: Filter and rank

  1. Highest priority: ready (non-Draft) @me PRs with mergeable == CONFLICTING and whose branch is NOT in session-lease-scan output(別セッションの fresh lease を保持していないこと)— recommend rebase:
    git fetch origin main
    git checkout <branch>
    git rebase origin/main
    # After resolving conflicts
    git push --force-with-lease
    
    Any PR branch appearing in session-lease-scan output(= 別セッションが fresh lease を保持中)は CONFLICTING であっても rebase 推奨から除外し、🔒 別セッション作業中 として read-only 表示する(Draft / 非 Draft・CI 状態・mergeable を問わない)。
  2. Remove EXCLUDE_SET from open Issues
  3. Rank remaining: bugs > features > refactoring > research

Step 3: Route recommendation(経路判定)

各 Issue に autopilot または express の推奨経路を付与し、Recommended Tasks 表の「推奨経路」列に記入する。

判定基準(express 適格信号 / autopilot 信号 / 曖昧時フォールバック / 不変条件)は docs/methodology/route-eligibility.md に集約されている。

Install via CLI
npx skills add https://github.com/o3-ozono/atdd-kit --skill session-start
Repository Details
star Stars 0
call_split Forks 0
navigation Branch main
article Path SKILL.md
More from Creator