context-capture
Skill28 starsChanged 3 months agoApache-2.0View on GitHub
Use when finishing a task, at a periodic checkpoint, or when the user asks to "save context", "record decisions", or "hand off" — writes what was done, why, and how into a shared context/ directory that other AI agents (Claude Code, Antigravity CLI) can later load. Covers the session-record schema, secret redaction, tar.xz compression of old sessions, and rolling decisions up into an architecture log.
In this repository34 other files it gives its agents.
- bigquery-query-optimizationSkill
- build-and-ci-gatesSkill
- cdc-scd-patternsSkill
- code-implementerSkill
- code-smells-expertSkill
- commit-expertSkill
- compliance-verifierSkill
- context-restoreSkill
- database-migration-expertSkill
- design-spec-expertSkill
- documentation-expertSkill
- flutter-architecture-decisionsSkill
- flutter-performance-profilingSkill
- flutter-release-engineeringSkill
- flutter-review-checklistSkill
- flutter-senior-orchestrationSkill
- flutter-test-strategySkill
- flutter-upgrade-migrationSkill
- gcp-data-engineeringSkill
- guidelines-karpathySkill
- loop-engineeringSkill
- performance-scalabilitySkill
- product-analystSkill
- pull-request-expertSkill
- python-expertSkill
- qa-testerSkill
- refactoring-code-expertSkill
- repo-researchSkill
- security-auditSkill
- senior-architect-engineeringSkill
- senior-dev-orchestratorSkill
- sql-query-optimizationSkill
- test-driven-developmentSkill
- testing-expertSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
On session end or task completion: Always record context if meaningful code edits or architectural choices were made.
- Distinctive: line 14
Periodic checkpoints: When nudged by session hooks (e.g.
- Distinctive: line 18
Pure question-answering: Do not capture sessions that involved no repository modifications and zero architectural decisions.
- Distinctive: line 42
When closing the session or completing the task:
- Distinctive: line 75
Claude Code: Run the snapshot and rollup scripts directly in bash at session checkpoints.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Context Capture Skill
Overview
This skill preserves durable context, architectural decisions, execution flows, and long-term user preferences across AI sessions. It acts as a Cross-Agent Memory Coordinator, writing structured records to a shared context/ directory so that subsequent agents—whether running on Claude Code or Antigravity CLI—can seamlessly resume ongoing work without context amnesia.
When to Use
Trigger Scenarios
- On session end or task completion: Always record context if meaningful code edits or architectural choices were made.
- Periodic checkpoints: When nudged by session hooks (e.g. every 25 tool calls) or before embarking on a high-risk refactoring step.
- On explicit user request: "save context", "record this decision", "prepare handoff".
When NOT to Use
- Pure question-answering: Do not capture sessions that involved no repository modifications and zero architectural decisions.
- Temporary troubleshooting chatter: Discard intermediate dead ends unless their failure provides a crucial rationale against repeating them.
Process
Phase 1: Session Scaffolding
Initialize or refresh the active session's record using the automated snapshot tool:
python3 ./skills/context-capture/scripts/context_snapshot.py \
--task "<one line task summary>" --agent "<model-id>" --status in-progressThe script auto-detects the host, records git diff stats, and applies an automated secret redaction sweep («REDACTED:...»).
Phase 2: Relevant Artifact Authoring
Populate the generated markdown files under context/<date>/<session-id>/:
| File | What to Include | What to Skip |
summary.md | High-level outcome in plain language, current state, immediate next steps. | Detailed blow-by-blow narration. |
decisions.md | Architectural choices with real trade-offs that future agents must respect. | Trivial localized syntax choices. |
flows.md | The execution path taken, including dead ends and why they failed. | Obvious steps clear from the git diff. |
topics.md | Discussion topics, open questions, and pending TODOs. | Ephemeral conversational chatter. |
context/preferences.md | Explicit, durable, cross-session user preferences. | One-off prompt instructions. |
Phase 3: Rollup, Retention & Compression
When closing the session or completing the task:
# 1. Mark session as done
python3 ./skills/context-capture/scripts/context_snapshot.py --session <id> --status done
# 2. Roll up decisions into architecture.md and apply retention policies
python3 ./skills/context-capture/scripts/context_rollup.py
# 3. Compress older session details into detail.tar.xz (keeping newest loose)
python3 ./skills/context-capture/scripts/context_pack.py --autoUsage
Commands & Automation Scripts
# Start or update session record
python3 ./skills/context-capture/scripts/context_snapshot.py --task "Implement OAuth2 flow" --agent "gemini-3.8-flash" --status in-progress
# Finalize session and roll up decisions
python3 ./skills/context-capture/scripts/context_snapshot.py --session <session-id> --status done
python3 ./skills/context-capture/scripts/context_rollup.py
python3 ./skills/context-capture/scripts/context_pack.py --auto
# Unpack an archived historical session for inspection
python3 ./skills/context-capture/scripts/context_pack.py --unpack <session-id>Example Prompts
- "Save the context of this session so the next agent can resume from where we left off."
- "Record this decision to use JWT tokens with RSA-256 in the shared context architecture log."
- "Capture our current progress as a checkpoint before we start refactoring the database layer."
Host Execution Instructions
- Claude Code: Run the snapshot and rollup scripts directly in bash at session checkpoints.
- Antigravity: Launch
context-keepersubagent or execute capture scripts before ending complex runs.
Red Flags
- Disabling the automated secret redaction scanner (
--no-redact) without verification. - Recording verbose narrative logs instead of crisp, actionable outcomes and decisions.
- Overwriting
context/preferences.mdwith temporary, task-specific instructions. - Storing unredacted passwords, JWT tokens, or cloud credentials in context files.
Verification
- Session snapshot script executes without errors:
python3 ./skills/context-capture/scripts/context_snapshot.py --status done summary.mdanddecisions.mdpopulated with clear, concise content.- Decision rollup executed and appended to
context/architecture.md:python3 ./skills/context-capture/scripts/context_rollup.py - Older session details compressed cleanly via
context_pack.py --auto.
References
- Session-record schema & field guide
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

