mcpField
C
Context Preserver

Context Preserver

github.com/daffy0208生産性38136 回インストール44 週間前に更新
リポジトリ

Context Preserver について

Context Preserverは、中断やタスクの切り替え後も作業の続きから再開したい開発者向けのスキルです。プロジェクトや思考状態のメモ、Git履歴、次の手順を保存し、後から作業を再開できるようにします。

主な機能

  1. 01定期的なコンテキスト保存
  2. 02プロジェクトと思考状態の記録
  3. 031つのコマンドで作業を再開
  4. 04保存時のWIPコミット
  5. 05コンテキストのエクスポートと履歴

活用シーン

  1. 01休憩後にコーディングを再開
  2. 02次の手順を保ったままプロジェクトを切り替え
  3. 03ペア作業に向けて現在の作業状況を共有
  4. 04過去の作業セッションの記録を確認

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/daffy0208/ai-dev-standards --skill context-preserver

インストール後、Claude Code で/context-preserverを入力して読み込まれたか確認します。

同梱ファイルREADME.mdmanifest.yaml

詳細

コンテキストの保持

作業場所を見失いません。5 分で再開できます。「どこまでやったっけ?」をなくしましょう。

基本原則

ADHD の脳は、コンテキスト切り替えに大きなコストがかかり、作業記憶も限られています。中断されるたびに、「作業に戻る」まで 15〜30 分かかります。解決策は、頭の中の状態を自動で記録・復元し、5 分以内に作業を再開できるようにすることです。

重要なポイント: コンテキストを保存する行為には、心を落ち着かせる効果があります。「安心して中断できる」という合図になるからです。


コンテキストの問題

問題 1:コンテキスト切り替えのコストが大きい

問題: 休憩後、何をしていたか思い出すのに 15〜30 分かかる
結果: 生産性の低下、フラストレーション、休憩を避けるようになる

###問題 2:作業記憶の限界 問題: 複雑な状態を頭の中に保持できない
結果: コードを何度も読み返す、次の手順を忘れる

問題 3:中断への不安

問題: 作業場所を見失う不安から、必要な休憩を取れない
結果: 燃え尽き、健康上の問題、品質の低下

問題 4:「どこまでやったっけ?」症候群

問題: 何をしていたかまったく分からないまま作業に戻る
結果: 手探りでの作業、やり直し、時間の浪費


フェーズ 1:コンテキストの自動記録

保存される内容(15 分ごとに自動)

ファイルのコンテキスト:

  • 現在のファイルパス
  • 行番号と関数
  • 関連ファイル(インポート、依存関係)
  • Git ブランチ

心理状態:

  • 考えていたこと
  • 直前に完了したこと
  • これから行うこと
  • 障害や疑問点

環境:

  • 開発サーバーの状態
  • 開いているターミナル
  • データベースの状態
  • 読み込み済みの API キー

時間のコンテキスト:

  • 作業を開始した時刻
  • 作業を続けている時間
  • 終了予定時刻
自動保存
トリガー 1:15 分ごと(バックグラウンド)
[15:30] Auto-save triggered

Context saved:

- File: src/components/login.tsx:42
- Function: handleSubmit()
- Status: Adding API call
- Next: Error handling for 401
- Time working: 45 min

✅ Saved to .adhd/context.json
✅ Micro-commit created (WIP)
トリガー 2:休憩前(手動コマンド)
# You run: ./save-context.sh --break lunch

Context saved for lunch break:
- Current task: Implementing password reset
- Progress: 70% complete
- File: src/auth/reset.ts:67
- Next step: Test email delivery
- Resume command ready: ./resume.sh

✅ Safe to take break!
トリガー 3:Claude セッション終了時(自動)
[Session ending]

Preserving your context:

- Saved current task
- Created WIP commit
- Noted next 3 steps
- Logged session progress

Resume anytime: Just start new Claude session
Context will load automatically
トリガー 4:中断時(自動検出)
[No activity detected for 10 min]

Looks like you got interrupted!
Auto-saved context:

- Last active: 10 min ago
- Working on: Dashboard layout
- File: src/pages/dashboard.tsx:125
- Next: Add user stats widget

When you return: Context ready to resume

フェーズ 2:コンテキストの構造

.adhd/context.json ファイル
{
  "timestamp": "2025-10-22T15:30:00Z",
  "session": {
    "started": "2025-10-22T14:00:00Z",
    "duration_minutes": 90,
    "breaks_taken": 1,
    "focus_sessions": 3
  },
  "files": {
    "current": {
      "path": "src/components/login.tsx",
      "line": 42,
      "column": 12,
      "function": "handleSubmit",
      "content_preview": "async function handleSubmit(e: FormEvent) {"
    },
    "related": ["src/api/auth.ts", "src/types/user.ts"]
  },
  "mental_state": {
    "doing": "Adding API call to /auth/login endpoint",
    "just_finished": "Added email validation",
    "next_steps": [
      "Add fetch call to /auth/login",
      "Handle 401/500 errors",
      "Add loading state to button"
    ],
    "blockers": ["Need to check API error format"],
    "notes": "Using fetch (not axios) per team standard"
  },
  "environment": {
    "branch": "feature/auth-flow",
    "uncommitted_changes": true,
    "dev_server_running": true,
    "last_command": "npm run dev"
  },
  "progress": {
    "current_task": "Build authentication flow",
    "phase": "Phase 2: API Integration",
    "percent_complete": 60,
    "estimated_remaining": "45 minutes"
  }
}

フェーズ 3:コンテキストの自動復元

すばやく再開(5 分未満)
1 つのコマンドで再開
# You run: ./resume.sh

╔══════════════════════════════════════╗
║  Resuming Work Session              ║
║  Last saved: 12:15 PM (1 hour ago) ║
╚══════════════════════════════════════╝

📂 Restoring context...

✅ Opened: src/components/login.tsx
✅ Cursor positioned: Line 42
✅ Dev server started
✅ Git branch: feature/auth-flow

💭 You were:
  - Adding API call to /auth/login
  - Just finished: Email validation
  - Next: Handle 401/500 errors

📊 Progress: 60% complete
⏱️ Estimated remaining: 45 minutes

🎯 Next micro-task: Add fetch call (15 min)

[Opens file at exact line in VS Code]
[Starts dev server]
[Shows mental state notes]

✅ Ready to code! Resume time: 4 minutes
Claude による自動再開

新しい Claude セッションを開始するとき:

You: [start new session]

Claude: Welcome back! I see you were working on authentication flow.

Let me catch you up:

📍 Last Location:
File: src/components/login.tsx:42
Function: handleSubmit()

💭 Mental State (from 1 hour ago):

- You were adding API call to /auth/login
- Email validation is done ✅
- Next: Handle 401/500 errors

📊 Progress: 60% complete (Phase 2/3)

🎯 Quick options:
A) Resume where you left off (add fetch call)
B) See full context (detailed notes)
C) Start something new

What would you like to do?

フェーズ 4:心理状態を記録するテクニック

「何を考えていたか」を記録する
3 つの質問の方法(自動でプロンプトを表示)

30 分ごとに、Claude が尋ねます:

[Quick context check - 1 minute]

To help you resume later:

1. What are you working on right now?

   > Adding password reset functionality

2. What's the next small step?

   > Test email delivery locally

3. Any blockers or questions?
   > Need to configure SendGrid API key

✅ Saved! This will help Future You.
思考をそのまま書き留めるメモ
## Mental State Notes (Auto-saved)

15:00 - Started password reset feature
15:15 - Generated reset token, stored in DB
15:30 - Building email template now
15:35 - Wondering if I should use SendGrid or Postmark
15:40 - Going with SendGrid (already have account)
15:45 - Configured API key, testing send...
[Break]

Resume thoughts:

- Was about to test email delivery
- SendGrid configured, key in .env
- Next: Trigger reset email from form
手がかりの記録
## Breadcrumb Trail (Auto-generated)

14:00 ✅ Created reset-password.tsx
14:15 ✅ Added form with email input
14:30 ✅ Connected to /api/reset-password
14:45 ✅ Generated reset token
15:00 ✅ Stored token in database
15:15 🔄 Building email template ← YOU ARE HERE
15:30 ⬜ Test email delivery
15:45 ⬜ Add reset confirmation page

You're making great progress! 🎉

フェーズ 5:コンテキストを考慮したワークフロー

休憩前のチェックリスト(自動で実行)
[You haven't saved context in 45 min]

⏸️ Taking a break soon?

Quick save checklist:

- [ ] Commit current work (WIP okay!)
- [ ] Write next step (one sentence)
- [ ] Note any blockers
- [ ] Close unneeded tabs (reduce clutter)

Takes 2 minutes, saves 20 minutes later!

[Save Context Now] [Remind Me in 15m] [I'm not taking a break]
1 日の終わりの習慣(午後 5 時に自動でプロンプトを表示)
[17:00] End of day approaching!

🌙 Let's wrap up for easy tomorrow start:

1. Current Progress:
   Built authentication flow
   Progress: 75% complete
   Status: Working well, needs testing

2. Tomorrow's First Task:
   → Test password reset flow (30 min)
   → File: src/auth/reset.ts
   → Should be quick!

3. Blockers for Tomorrow:
   None! Ready to go.

4. Wins Today:
   ✅ Completed login form
   ✅ Added validation
   ✅ Connected to API
   ✅ Fixed bug #234

5. Mental Dump:
   [Anything else to remember?]
   > Remember to check email error handling

✅ Context saved! Tomorrow You will thank you. 🙏

[Finish Day] [Keep Working]

フェーズ 6:Git との連携

マイクロコミットの自動作成

コンテキストを保存するたびに、WIP コミットが作成されます:

# Auto-runs every 15 min
git add .
git commit -m "WIP: $(cat .adhd/context.json | jq -r '.mental_state.doing') [15:30]"

# Example commits:
git commit -m "WIP: Adding API call to login endpoint [15:30]"
git commit -m "WIP: Testing password reset flow [15:45]"
git commit -m "PAUSE: About to add error handling [16:00]"
Git 履歴から再開
# See what you were doing
git log -1 --pretty=%B

# Output:
WIP: Testing password reset flow [15:45]

# Context notes:
- File: src/auth/reset.ts:67
- Next: Add error toast for failed reset
- Blocker: None

フェーズ 7:中断への対処

中断の種類
種類 1:会議(予定あり)
[14:45] Meeting in 15 minutes

Auto-save triggering:

- Current work committed
- Context snapshot created
- Resume script generated

After meeting: Run ./resume.sh
Estimated resume time: 5 minutes
種類 2:緊急のバグ(予定外)
You: "Urgent bug in production, need to switch"

Claude: No problem! Let me save your context first.

✅ Saved: Authentication flow work
✅ Stashed: Uncommitted changes
✅ Switched: To main branch

Work on the bug, I'll help you resume after.

Resume command: ./resume-auth-work.sh
種類 3:集中力の低下(ADHD による注意散漫)
[You've been browsing docs for 20 min]

💭 Gentle reminder:

You were working on: Password reset form
Current file: src/auth/reset.tsx:45
Next step: Add email input field (5 min)

Research is good, but maybe time to apply?

[Resume Coding] [Continue Research] [Take Break]

フェーズ 8:高度なコンテキスト機能

コンテキストの共有
# Share context with teammate
./export-context.sh

Generated: context-snapshot.md

Send this to teammate for pairing:
- What you're working on
- Current progress
- What you need help with
- Exact file locations
コンテキストの履歴
# View past contexts

./context-history.sh

Recent Work Sessions:

1. 2025-10-22 14:00 - Auth flow (90 min) ✅ Completed
2. 2025-10-22 10:30 - Dashboard UI (2 hours) 🔄 In progress
3. 2025-10-21 15:00 - Bug fix #234 (45 min) ✅ Completed

[Load Context] [Delete] [Archive]
コンテキストに応じたスマートな提案
[Starting new session]

Claude: I notice you often work on:

- Authentication (70% of time)
- Dashboard UI (20%)
- Bug fixes (10%)

Would you like to:
A) Resume auth flow (where you left off)
B) Continue dashboard work (60% complete)
C) Check open bugs
D) Start something new

Based on your patterns, auth flow is most likely.

フェーズ 9:コンテキストのパターン

パターン 1:集中作業セッション
[Session Start]
Auto-save every: 15 minutes
Break reminders: Every 60 minutes
Context snapshots: On demand

[Session End]
Final save includes:

- Total focus time
- Tasks completed
- Progress made
- Tomorrow's start point
パターン 2:コンテキストを切り替えながら進めるプロジェクト
Project A → Project B

Auto-stash Project A:

- Commit WIP
- Save context
- Close related tabs

Load Project B:

- Restore last context
- Open relevant files
- Show next task

Switch time: < 5 minutes
パターン 3:ペアプログラミング
Before pairing:

- Export current context
- Share with partner
- They see exactly what you're doing

After pairing:

- Update context with decisions made
- Log next steps
- Easy solo resume

自動化スクリプト

セットアップ(初回のみ)
cd your-project
mkdir .adhd
cp ~/ai-dev-standards/TEMPLATES/adhd/scripts/* ./
chmod +x .adhd/*.sh

# Scripts installed:
# - save-context.sh (manual save)
# - resume.sh (quick resume)
# - context-history.sh (view history)
# - export-context.sh (share with team)
毎日の使用(すべて自動)
# Morning: One command start
./resume.sh

# During work: Auto-saves every 15 min
# (runs in background)

# Before break: Quick save
./save-context.sh --break lunch

# After break: One command resume
./resume.sh

# End of day: Auto-prompted at 5pm
# (saves automatically)

避けるべきパターン

❌ 手動でコンテキストをメモする

よくない例: 自分で手動のメモを書くことを期待する
理由: ADHD の脳では、それを継続して行えません
おすすめ: 15 分ごとに自動保存する

❌ 完璧なドキュメント

よくない例: 詳細な状況報告を書く
理由: 時間を無駄にし、維持できません
おすすめ: 思考をそのまま手早くメモする

❌ コンテキストファイルが 1 つだけ

よくない例: 同じコンテキストファイルを上書きする
理由: 履歴が失われ、過去に戻れません
おすすめ: タイムスタンプ付きの履歴を残し、過去のコンテキストを確認できるようにする


成功指標

次のように活用できていれば、このスキルをうまく使えています。

  • ✅ 作業再開まで5分未満(以前は30分)
  • ✅ 「どこまでやったんだっけ?」と尋ねることがない
  • ✅ 不安を感じずに休憩できる
  • ✅ コンテキストが自動保存される(意識する必要がない)
  • ✅ プロジェクト間を簡単に切り替えられる

関連スキル

  • task-breakdown-specialist - 次のステップを細分化します
  • focus-session-manager - 作業セッションを管理します
  • adhd-workflow-architect - 自動化されたワークフローを設計します

作業場所を保存して、不安をなくしましょう。5分で作業を再開できます。 💾

コメント