Monitors context window health throughout a session and rides peak context quality for maximum output fidelity. Activates automatically after plan-interview and intent-framed-agent. Stays active through execution and hands off cleanly to simplify-and-harden and self-improvement when the wave completes naturally or exits via handoff. Use this skill whenever a multi-step agent task is underway and session continuity or context drift is a concern. Especially important for long-running tasks, complex refactors, or any work where degraded context would silently corrupt the output. Trigger even if the user doesn't say "context surfing" — if an agent task is running across multiple steps with intent and a plan already established, this skill is live.
52
57%
Does it follow best practices?
Impact
—
No eval scenarios have been run
Risky
Do not use without reviewing
Optimize this skill with Tessl
npx tessl skill review --optimize ./skills/context-surfing/SKILL.mdgh skill install pskoett/pskoett-skills context-surfingFallback using the Agent Skills CLI:
npx skills add pskoett/pskoett-skills/skills/context-surfingThe agent rides the wave of peak context. When the wave crests, it commits. When it detects drift, it pulls out cleanly — saving state, handing off, and letting the next session catch the next wave.
No wipeouts. No zombie sessions. Only intentional, high-fidelity execution.
Think of context like an ocean wave:
The skill's job: ride as long as the wave is good, exit before it closes out.
[plan-interview] → [intent-framed-agent] → [context-surfing ACTIVE] → [simplify-and-harden] → [self-improvement]Context Surfing is the execution layer. It wraps all work between intent capture and post-completion review. Simplify-and-harden and self-improvement are the next steps in the pipeline — they run after context-surfing completes, not as conditions that end it.
Both skills are live during execution. They monitor different failure modes:
They are complementary, not redundant. An agent can be perfectly on-scope while its context quality degrades (e.g., it's doing the right thing but starting to hallucinate details). Conversely, scope drift can happen with perfect context quality (the agent deliberately chases a tangent). Intent-framed-agent's Intent Checks continue firing alongside context-surfing's wave monitoring.
Precedence rule: If both skills fire simultaneously (an Intent Check and a drift exit at the same time), context-surfing's exit takes precedence. Degraded context makes scope checks unreliable — resolve the context issue first, then resume scope monitoring in the next session.
Cadence separation: Intent checks fire at scope boundaries — "before touching a new area/file, before starting a new logical work unit, when current action feels tangential" (intent-framed-agent/SKILL.md). Context-surfing's pre-commit anchor check fires at side-effecting-action moments — specific tool calls, writes, commits, commit-level output. Don't run both in the same beat: if an Intent Check has just fired and resolved cleanly, the next side-effecting action inside that same work unit doesn't need a fresh anchor check — you already re-grounded.
Not every task needs all five skills. Match pipeline depth to task complexity:
| Task Type | Skills to Use |
|---|---|
| Trivial (rename, typo fix) | None — just do it |
| Small (isolated bug fix, single-file change) | simplify-and-harden only |
| Medium (feature in known area, multi-file) | intent-framed-agent + simplify-and-harden |
| Large (complex refactor, new architecture, unfamiliar codebase) | Full pipeline |
| Long-running (multi-session, high context pressure) | Full pipeline with context-surfing as the critical skill |
When in doubt, start light. Add skills if you notice drift or quality issues mid-task.
This skill is live the moment the intent frame and plan are established. No explicit invocation needed.
At activation, load whatever anchors are available:
If neither an intent frame nor a plan exists (standalone mode), use the user's original task description combined with project context files as the wave anchor. This is sufficient — the skill degrades gracefully, not catastrophically.
Entire CLI (github.com/entireio/cli) provides persistent session state that serves as external ground truth for drift checks and handoff files.
At activation, detect Entire:
entire status 2>/dev/nullentire status and entire explain --session <id> to read back session state when needed.The wave anchor is not held mentally. It is built from whatever external, persistent artifacts are available — every drift check reads from them directly, never from reconstructed memory.
When context-surfing writes a handoff file on drift exit, that handoff is also captured in the Entire session transcript (via the Stop / SessionEnd hooks). At cadence, learning-aggregator --deep reads those transcripts and extracts:
Structured handoff files (.context-surfing/handoff-<slug>-<timestamp>.md) with predictable section headers make this parseable. You don't need to do anything special — just keep the handoff format consistent.
The anchor is weaker in standalone mode — fewer artifacts to cross-check against — but it is always present. A weak anchor is better than no anchor.
Before executing anything, scan the project for .md files that carry standing context. These are not documentation to skim — they are constraints, decisions, and architectural truth that must stay in the wave at all times.
CLAUDE.md — agent configuration, conventions, constraintsAGENTS.md — multi-agent setup, role definitionsREADME.md — project intent and structure.md in the project root.md files in skills/, docs/, .learnings/, or similar directoriesSKILL.md files for any skill being invoked alongside this one.md file, that is a drift signal — treat it as a strong one..md file is modified during the session, flag it explicitly in the handoff under a "Modified Context Files" section so the next session re-reads it fresh rather than relying on the handoff summary.Continuously monitor for these signals. Strong signals trigger an immediate exit — the wave is closing out. Weak signals trigger the Recovery Protocol first — the shoulder might still be rideable.
These signals apply to your own reasoning chain as much as to your emitted output — scan your thinking, not just your text. Drift originates inside the reasoning trace before it surfaces as visible prose, and the anchor's job is to gate reasoning, not just to audit output after the fact. A reasoning-level check before a side-effecting action is strictly upstream of an output-level check afterwards.
An agent with degraded context is the least likely to detect its own degradation. The strong signals (hallucination, contradiction) are exactly the ones a compromised agent will miss — because it no longer has the context to recognize the contradiction.
This is an inherent limitation of self-monitoring. Mitigate it with external grounding:
Pre-commit anchor check. Before any side-effecting action (file write, commit, external tool call that changes state, user-visible commit-level output), run this inline in your reasoning chain:
Anchor mutability: If a context file has been modified mid-session, the pre-commit check uses the latest version of the file, not the activation-time snapshot. Re-read cold.
Use Entire CLI logs as external memory. If Entire is available, read back your own session log before non-trivial decisions. Your logged state is more reliable than your recalled state.
Treat the user as a drift sensor. If the user expresses confusion, asks "why are you doing that?", or redirects you — treat it as a strong signal regardless of your own assessment.
The weak signals (hedging, verbosity) are more reliably self-detectable precisely because they're behavioral, not factual. Watch for those as early warnings.
When weak signals accumulate, don't exit immediately — try to re-anchor first. The shoulder of the wave is still rideable if you can re-ground.
Stop producing output. Re-read whatever wave anchor artifacts are available:
Compare what you're currently doing against what these artifacts say you should be doing.
context-monitor subagent as a cold-context second opinion before escalating to the user. Brief it with the intent frame (or plan, or original task description), your current next-action, and the specific weak signals you observed. A fresh-context subagent is the one reliable escape from the monitoring paradox: your own re-read happens inside the same possibly-degraded context, while context-monitor reads the artifacts cold.context-monitor returns "healthy" or "weak signals only" — integrate its corrections and resume execution.context-monitor returns "strong drift detected", or you still can't reconcile after its report — escalate to the user. Present the situation openly: "I'm noticing some drift. Here's where I am vs where the plan says I should be — here's what context-monitor found — how should I proceed?"There is no hard cap on recovery attempts. Keep re-anchoring as long as each attempt genuinely resolves the uncertainty and the user confirms alignment. However:
While context is healthy:
intent-framed-agent's job and fire at different boundaries (see Relationship with intent-framed-agent for cadence separation).When a strong signal fires, or the Recovery Protocol fails to re-anchor, execute a clean exit. Do not try to push through.
Immediately pause task execution. Do not produce more output that may be corrupted by the degraded context.
Create a file named .context-surfing/handoff-[slug]-[timestamp].md (create the .context-surfing/ directory if it doesn't exist). Add .context-surfing/ to .gitignore — handoff files are session artifacts, not project history.
Structure:
# Context Surf Handoff
## Session Info
- Task: [task name / slug]
- Started: [timestamp]
- Ended: [timestamp]
- Exit reason: [what drift signal was detected]
## Intent Frame (if available — read verbatim, do not reconstruct)
[copy directly from the intent-framed-agent artifact, or "N/A — standalone session" if none exists]
## Plan (if available — read verbatim, do not reconstruct)
[copy directly from the plan-interview artifact, or "N/A — standalone session" if none exists]
## Original Task Description (standalone fallback)
[copy the user's original task description if no intent frame or plan exists]
## Completed Work (from Entire CLI session state or running output log)
[pull directly from CLI log or structured output — do not reconstruct from memory]
## In Progress at Exit (from Entire CLI session state or running output log)
[what the session log shows as active at the moment of exit]
[include any partial outputs if useful]
## Pending Work (from plan-interview output — cross-reference session log to confirm what's genuinely not done)
[remaining tasks from the plan, in order]
## Drift Notes
[what specifically triggered the exit — be precise, this helps the next session replan intelligently]
## Active Context Files
[list all .md files loaded during this session — root level and any skill/docs files consulted]
## Modified Context Files
[any .md files that were changed during this session — next session must re-read these, not trust the handoff summary]
## Scope Notes (Out-of-Band)
[anything interesting discovered that's outside scope — flagged for the next session to decide on]
## Recommended Re-entry Point
[where the next session should pick up, and any replanning it should do before continuing]Briefly and clearly:
"Context wave is done. I've saved the session state to
.context-surfing/[filename]. The next session should load that file, run plan-interview to replan from [re-entry point], and catch the next wave. Here's what triggered the exit: [one sentence on drift signal]."
Do not over-explain. The handoff file has the details.
The next session should:
This is not failure. This is the system working correctly. Clean exits produce better total output than zombie sessions that limp to the finish line.
When the task completes within a healthy wave (no drift exit needed):
No handoff file needed for clean completions — just the outputs and a one-liner status.
docs/plans/plan-NNN-<slug>.md). Strengthens the wave anchor when available..context-surfing/ with full state for session resumption.plan-interview (optional, for requirement shaping)intent-framed-agent (execution contract + scope drift monitoring)context-surfing (context quality monitoring — runs concurrently with intent-framed-agent during execution)simplify-and-harden (post-completion quality/security pass)self-improvement (capture recurring patterns and promote durable rules)Enable automatic handoff detection at session start. This ensures handoff files from previous context exits are never silently ignored.
Add to .claude/settings.json:
{
"hooks": {
"UserPromptSubmit": [{
"matcher": "",
"hooks": [{
"type": "command",
"command": "./skills/context-surfing/scripts/handoff-checker.sh"
}]
}]
}
}This checks for unread handoff files in .context-surfing/ on every prompt. If found, it reminds the agent to read the handoff before starting new work (~100 tokens overhead, skips silently when no handoff exists).
For agents without hook support, manually check at session start:
ls .context-surfing/handoff-*.md 2>/dev/nullRide the peak, not the whole ocean. A shorter session with high fidelity beats a long session with gradual corruption.
Exit is not failure. The wave close-out is a feature. Detecting it early is the skill.
The handoff file is the continuity. It's not documentation overhead — it's what makes the next session as sharp as this one started.
Never hide the exit. Always be explicit with the user that a context exit happened and why. Silently continuing in degraded context is the worst outcome.
fe0da1c
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.