long-agent について
long-agentは、ログ、チェックポイント、コンテキストメモを使って長時間のエージェントセッションを管理するスキルです。複数のセッションや日をまたぐ作業の進捗記録、コンテキストの復元、引き継ぎに役立ちます。
主な機能
- 01セッションログと進捗管理
- 02チェックポイントとマイルストーン一覧
- 03コンテキストの保存と復元
- 04状況確認と進捗サマリー
- 05セッション引き継ぎドキュメント
活用シーン
- 01長期のコーディング作業の再開
- 02複数セッションにまたがる節目の追跡
- 03継続中の作業を次のセッションへ引き継ぎ
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ johnlindquist/ claude --skill long-agentインストール後、Claude Code で/long-agentを入力して読み込まれたか確認します。
詳細
長時間のエージェントセッション
進捗を追跡し、コンテキストを管理して、長時間にわたるエージェントセッションを運用します。
セッション管理
セッションを初期化する
# Create session file
SESSION_ID=$(date +%Y%m%d-%H%M%S)
SESSION_FILE=~/.claude/sessions/$SESSION_ID.md
mkdir -p ~/.claude/sessions
cat > $SESSION_FILE << EOF
# Session: $SESSION_ID
Started: $(date)
Task: [Describe task]
## Progress
- [ ] Step 1
- [ ] Step 2
- [ ] Step 3
## Context
[Important context to remember]
## Notes
[Running notes]
EOF
echo "Session: $SESSION_FILE"
進捗を追跡する
# Update progress
echo "- [x] Completed: [description]" >> $SESSION_FILE
# Add note
echo "### $(date +%H:%M) - [title]" >> $SESSION_FILE
echo "[notes]" >> $SESSION_FILE
セッションを再開する
# List recent sessions
ls -lt ~/.claude/sessions/ | head -10
# View session
cat ~/.claude/sessions/SESSION_ID.md
# Continue from last checkpoint
tail -50 ~/.claude/sessions/SESSION_ID.md
進捗管理のパターン
チェックポイントシステム
#!/bin/bash
# checkpoint.sh SESSION_ID DESCRIPTION
SESSION_FILE=~/.claude/sessions/$1.md
CHECKPOINT=$2
echo "" >> $SESSION_FILE
echo "## Checkpoint: $(date +%H:%M)" >> $SESSION_FILE
echo "Status: $CHECKPOINT" >> $SESSION_FILE
echo "Can resume from here." >> $SESSION_FILE
マイルストーンの追跡
# Session Progress
## Milestones
- [x] M1: Environment setup
- [x] M2: Core implementation
- [ ] M3: Testing
- [ ] M4: Documentation
## Current: M3 - Testing
### Completed
- Unit tests for auth module
- Integration test setup
### In Progress
- API endpoint tests
### Blocked
- Need test fixtures for edge cases
コンテキスト管理
重要なコンテキストを保存する
#!/bin/bash
# save-context.sh SESSION_ID
SESSION_FILE=~/.claude/sessions/$1.md
cat >> $SESSION_FILE << 'CONTEXT'
## Critical Context (Don't Lose)
### File Locations
- Main entry: src/index.ts
- Config: src/config.ts
- Tests: tests/
### Key Decisions
- Using JWT for auth (not sessions)
- PostgreSQL for persistence
- Redis for caching
### Current State
- Auth module: complete
- API routes: 80% done
- Tests: 40% coverage
CONTEXT
コンテキストの復元
# Get context for resumption
CONTEXT=$(grep -A 50 "## Critical Context" ~/.claude/sessions/$SESSION_ID.md)
gemini -m pro -o text -e "" "I'm resuming a long coding session. Here's the context:
$CONTEXT
Help me remember:
1. Where was I?
2. What's the next step?
3. Any gotchas to remember?"
状況の確認
状況を把握する
#!/bin/bash
# bearings.sh - Where am I in this task?
echo "=== Current Session Status ==="
echo ""
# Git status
echo "### Git Status"
git status --short
echo ""
echo "### Recent Commits"
git log --oneline -5
echo ""
echo "### Modified Files"
git diff --stat HEAD~3
echo ""
echo "### TODO Items"
grep -r "TODO\|FIXME" src/ --include="*.ts" | head -10
進捗の概要
# Generate progress summary
gemini -m pro -o text -e "" "Summarize progress on this session:
Session log:
$(tail -100 ~/.claude/sessions/$SESSION_ID.md)
Git activity:
$(git log --oneline -10)
Provide:
1. What's been accomplished
2. Current status
3. Remaining work
4. Estimated completion"
長時間タスクのパターン
複数日にわたるタスク
# Multi-Day Task: [Name]
## Day 1 - [Date]
### Accomplished
- [items]
### Blocked
- [items]
### Tomorrow
- [items]
---
## Day 2 - [Date]
### Context from Yesterday
[summary]
### Accomplished
- [items]
引き継ぎドキュメント
別のセッションまたはエージェントに引き継ぐ場合:
# Task Handoff
## What This Is
[Brief description]
## Current State
- [Bullet points of where things stand]
## What's Working
- [Completed items]
## What's Not Working
- [Issues/blockers]
## Next Steps
1. [Specific step]
2. [Specific step]
## Key Files
- `src/main.ts` - Entry point
- `src/auth/` - Auth module (done)
- `src/api/` - API routes (in progress)
## Commands to Know
```bash
npm run dev # Start development
npm test # Run tests
npm run build # Build for production
注意点
- [つまずく可能性があること]
## Session Templates
### Feature Development
```bash
cat > ~/.claude/sessions/feature-template.md << 'EOF'
# Feature: [Name]
## Requirements
- [ ] Requirement 1
- [ ] Requirement 2
## Design
[Architecture notes]
## Implementation Progress
- [ ] Step 1
- [ ] Step 2
- [ ] Step 3
## Testing
- [ ] Unit tests
- [ ] Integration tests
- [ ] Manual testing
## Documentation
- [ ] Code comments
- [ ] README update
- [ ] API docs
EOF
バグ修正
cat > ~/.claude/sessions/bugfix-template.md << 'EOF'
# Bug Fix: [Issue ID/Description]
## Symptom
[What's happening]
## Expected
[What should happen]
## Investigation
- [ ] Reproduced locally
- [ ] Found root cause
- [ ] Identified fix
## Fix
[Description of fix]
## Verification
- [ ] Fix works
- [ ] No regressions
- [ ] Tests added
EOF
ベストプラクティス
- 頻繁に記録する - 進捗をこまめに更新します
- コンテキストを保存する - 再開時に必要な情報を残します
- チェックポイントを作成する - 安全に再開できる地点を記録します
- 休憩前に要約する - 現在の状況を記録します
- テンプレートを使う - 一貫した構成に役立ちます
- ブロッカーを追跡する - 待ちの状態にあるものを記録します
- 適切に引き継ぐ - 次回は新しいコンテキストから始まることを前提にします
コメント
Markdown 対応