一键导入
snapshot-manager
Creates and manages stable context snapshots for parallel agent work, ensuring consistent starting points and preventing race conditions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Creates and manages stable context snapshots for parallel agent work, ensuring consistent starting points and preventing race conditions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Communicate efficiently without sacrificing clarity - natural, concise, actionable. Global skill loaded for every command and agent.
Use when reviewing or building UI components - ensures keyboard, screen-reader, and visual accessibility (WCAG 2.1 AA) so a11y is built in, not retrofitted.
You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.
Manages context caching to optimize token usage and cost by creating, incrementally updating, and invalidating caches while verifying integrity before reuse.
Clean code and engineering discipline: modularity, readability, sizing, naming, duplication, separation of concerns, plus the four behavioral principles - think before coding, simplicity first, surgical changes, and goal-driven execution. Global skill applied to all coding work.
Detects and resolves drift between code, documentation, and contextual knowledge, classifying each drift and recommending concrete sync actions to keep artifacts consistent.
| name | snapshot-manager |
| description | Creates and manages stable context snapshots for parallel agent work, ensuring consistent starting points and preventing race conditions. |
Create stable, consistent snapshots of project state to enable safe parallel agent execution.
Snapshot state and metadata live only under .ai/runtime/snapshots/ (never a
top-level .ai/snapshots/). Each snapshot is identified by a snapshot_id of the
form snapshot-<timestamp> (e.g. snapshot-20240115-143022). That same
snapshot_id is the field session configs carry in
SESSION_TEMPLATE.json — the
snapshot_id written here MUST match the snapshot_id each dispatched session
references, so agents and the snapshot registry always agree on the baseline.
Provide stable context for parallel work by:
This skill is automatically selected by the orchestrator when:
Create stable reference point:
Provide snapshots to agents:
Manage snapshot updates:
Manage snapshot lifecycle:
Complete codebase state at specific point in time:
Use when:
Focused subset of codebase:
Use when:
Package and dependency state:
Use when:
Snapshot Created:
📸 Snapshot: parallel-work-2024-01-15-a3f9c2
Type: Full repository
Git Ref: main@a3f9c2e
Created: 2024-01-15 10:30:00
Purpose: Parallel feature development
Contents:
✓ Source code: src/ (234 files)
✓ Tests: tests/ (89 files)
✓ Types: src/types/ (12 files)
✓ Config: package.json, tsconfig.json, etc.
✓ Dependencies: node_modules (locked)
Metadata:
- Session ID: session-123
- Orchestrator context: feature-user-dashboard
- Expiration: 24 hours
Snapshot Assignment:
📋 Agent Snapshot Assignments:
Agent 1 (Frontend):
Snapshot: parallel-work-2024-01-15-a3f9c2
Scope: src/components/*, src/hooks/*
Lock acquired: ✓
Agent 2 (Backend):
Snapshot: parallel-work-2024-01-15-a3f9c2
Scope: src/api/*, prisma/*
Lock acquired: ✓
Agent 3 (Tests):
Snapshot: parallel-work-2024-01-15-a3f9c2
Scope: tests/*
Lock acquired: ✓
Dependencies: [Agent 1, Agent 2] must complete first
Snapshot Status:
🔍 Active Snapshots:
parallel-work-2024-01-15-a3f9c2
├─ Used by: 3 agents
├─ Status: Active
├─ Age: 2 hours
└─ Cleanup: On agent completion
feature-auth-2024-01-14-b7e4a1
├─ Used by: 1 agent
├─ Status: Stale (>24h)
├─ Age: 28 hours
└─ Cleanup: Scheduled
Snapshot Update:
🔄 Snapshot Update Required
Reason: Agent 2 (Backend) completed work and merged
Old snapshot: parallel-work-2024-01-15-a3f9c2 (main@a3f9c2e)
New snapshot: parallel-work-2024-01-15-d8f3b5 (main@d8f3b5a)
Changes:
+ src/api/users/route.ts (new API endpoint)
+ prisma/schema.prisma (user model updated)
+ prisma/migrations/20240115_add_user_fields/
Affected agents:
→ Agent 3 (Tests): Update to new snapshot before testing
Action: Agent 3 will pull latest changes and rebase on new snapshot
Stable Baseline:
Isolation:
Coordination:
Lifecycle Management:
Use git references as snapshots:
# Create snapshot branch
git branch snapshot/parallel-work-a3f9c2 main
# Agents work from snapshot
git checkout snapshot/parallel-work-a3f9c2
# Cleanup after integration
git branch -d snapshot/parallel-work-a3f9c2
Pros: Simple, uses existing tooling, efficient Cons: Requires git discipline, branch management overhead
Capture relevant context without full checkout:
{
"snapshot_id": "parallel-work-a3f9c2",
"git_ref": "main@a3f9c2e",
"files": {
"src/api/users.ts": "hash-abc123",
"src/types/user.ts": "hash-def456"
},
"dependencies": {
"package.json": "hash-ghi789",
"node_modules_hash": "hash-jkl012"
}
}
Pros: Lightweight, fast, selective Cons: Custom implementation, needs tracking system
Use git worktrees for isolation:
# Create separate working directory
git worktree add ../parallel-agent-1 main
# Agent works in isolated directory
cd ../parallel-agent-1
# Cleanup
git worktree remove ../parallel-agent-1
Pros: Complete isolation, no branch pollution Cons: Disk space usage, complexity
State: Fresh work, no dependencies
Action: Create snapshot, assign to all agents
Result: All agents work from same baseline
Update: Merge agents sequentially, update snapshot after each
State: Agent 2 depends on Agent 1 output
Action: Create initial snapshot for Agent 1
Result: Agent 1 completes, merges, creates new snapshot
Update: Agent 2 starts from new snapshot including Agent 1 changes
State: Parallel work takes multiple days, main branch evolving
Action: Create initial snapshot, agents work isolated
Decision point: Do agents need main branch updates?
- Yes: Periodically update snapshot, agents rebase
- No: Stay isolated, deal with conflicts at final merge
Track essential information:
{
"snapshot_id": "parallel-work-2024-01-15-a3f9c2",
"created_at": "2024-01-15T10:30:00Z",
"created_by": "orchestrator-session-123",
"git_ref": "main@a3f9c2e",
"purpose": "Feature: User Dashboard",
"scope": "full-repository",
"agents": [
{
"agent_role": "frontend",
"scope": "src/components/*, src/hooks/*",
"status": "active"
},
{
"agent_role": "backend",
"scope": "src/api/*, prisma/*",
"status": "completed"
}
],
"expiration": "2024-01-16T10:30:00Z",
"cleanup_policy": "on-agent-completion"
}
Effective snapshots provide:
Phase 1: Create Snapshot
Orchestrator: Starting parallel work on user dashboard
→ snapshot-manager: Create snapshot of current main branch
← Snapshot created: parallel-work-a3f9c2 (main@a3f9c2e)
Phase 2: Assign Snapshot
→ Agent 1 (Frontend): Use snapshot parallel-work-a3f9c2
→ Agent 2 (Backend): Use snapshot parallel-work-a3f9c2
→ Agent 3 (Tests): Use snapshot parallel-work-a3f9c2
Phase 3: Agent Completes
Agent 2 (Backend): Work complete, ready to merge
→ Merge Agent 2 changes to main
→ snapshot-manager: Create new snapshot parallel-work-d8f3b5
← Snapshot created: parallel-work-d8f3b5 (main@d8f3b5a)
Phase 4: Update Dependent Agents
→ Agent 3 (Tests): Update to snapshot parallel-work-d8f3b5
(includes Agent 2 backend changes for testing)
Phase 5: Cleanup
All agents complete
→ snapshot-manager: Clean up snapshots
← Removed: parallel-work-a3f9c2, parallel-work-d8f3b5