context-surfing
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.
NPX Install
npx skill4agent add pskoett/pskoett-ai-skills context-surfingTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Context Surfing
Install
npx skills add pskoett/pskoett-ai-skills/skills/context-surfingMental Model
- Paddling in = loading the intent frame, plan, and initial context. Energy is building.
- The peak = full context coherence. The agent knows exactly what it's doing and why. This is when to execute.
- The shoulder = context starting to flatten. Still rideable, but output density is dropping.
- The close-out = drift. Contradiction, hedging, second-guessing, or hallucinated details. Wipe-out territory.
Lifecycle Position
[plan-interview] → [intent-framed-agent] → [context-surfing ACTIVE] → [simplify-and-harden] → [self-improvement]Relationship with intent-framed-agent
- intent-framed-agent monitors scope drift — am I doing the right thing? It fires structured Intent Checks when work moves outside the stated outcome.
- context-surfing monitors context quality drift — am I still capable of doing it well? It fires when the agent's own coherence degrades (hallucination, contradiction, hedging).
When to Use the Full Pipeline
| Task Type | Skills to Use |
|---|---|
| Trivial (rename, typo fix) | None — just do it |
| Small (isolated bug fix, single-file change) | |
| Medium (feature in known area, multi-file) | |
| Large (complex refactor, new architecture, unfamiliar codebase) | Full pipeline |
| Long-running (multi-session, high context pressure) | Full pipeline with |
Activation
- The intent frame (from intent-framed-agent output)
- The plan (from plan-interview output)
- The current session state from the Entire CLI (if available)
- All project context files (see below)
Entire CLI Integration
entire status 2>/dev/null- If it succeeds, use Entire as the session state backend. Log completions, in-progress items, and scope notes to it as work progresses.
- If unavailable or failing, continue without it. Use the intent frame and plan file as the wave anchor instead. Track progress via structured comments in your output rather than Entire CLI commands. Do not block execution and do not nag about installation.
Project Context Files
.mdAlways load at activation
- — agent configuration, conventions, constraints
CLAUDE.md - — multi-agent setup, role definitions
AGENTS.md - — project intent and structure
README.md - Any in the project root
.md
Load on demand (when relevant to the current task)
- files in
.md,skills/,docs/, or similar directories.learnings/ - files for any skill being invoked alongside this one
SKILL.md
Rules for context files
- They are always part of the wave anchor. If output contradicts a project file, that is a drift signal — treat it as a strong one.
.md - Re-read them if the task changes domain or scope. Don't assume you remembered correctly 20 steps in.
- Include their key constraints in the handoff file. The next session needs to reload them too — note which files were active and whether any were updated during the session.
- If a 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.
.md
Drift Detection
Strong signals (exit immediately)
- The agent contradicts a decision it already made and committed to
- A detail appears in the output that was never in the original context (hallucination)
- The agent re-opens a scope question that was explicitly resolved in the plan
- Output starts re-explaining the task rather than executing it
Weak signals (watch closely)
- Responses are getting longer without getting more useful
- Hedging language increases: "it depends", "could be", "might want to consider"
- The agent switches approaches mid-task without explicit user direction
- References to the original intent become vague or paraphrased instead of precise
- The agent asks a clarifying question it should already know the answer to
Not drift
- Normal iteration and refinement within scope
- Asking about genuinely new information not in the original context
- Simplifying a previous output (that's the wave working, not breaking)
The Monitoring Paradox
- Re-read the intent frame verbatim before each major step. Don't rely on your memory of it. Open the artifact and read it. If what you're about to do doesn't match what you read, stop.
- Cross-check against the plan file. Before starting a new work unit, re-read the relevant plan section. Compare it to what you're actually doing.
- 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.
Riding the Wave
- Execute with commitment. No hedge, no re-litigating decisions already made. The plan is the plan.
- Check the wave anchor before non-trivial decisions. Re-read the intent-framed-agent output. If the decision aligns, proceed. If it doesn't, stop.
- Track completions. Log what's done, what's in progress, what's pending as work progresses — not at exit. If Entire CLI is available, use it as the session log. If not, maintain a running status in your output. This feeds the handoff if needed.
- Resist scope creep. If something interesting but out-of-scope appears, note it (in Entire CLI or in your output) — don't chase it.
Exit Protocol (Wave Close-Out)
Step 1: Stop executing
Step 2: Write the handoff file
.context-surfing/handoff-[slug]-[timestamp].md.context-surfing/.context-surfing/.gitignore# Context Surf Handoff
## Session Info
- Task: [task name / slug]
- Started: [timestamp]
- Ended: [timestamp]
- Exit reason: [what drift signal was detected]
## Intent Frame (from intent-framed-agent output — read verbatim, do not reconstruct)
[copy directly from the intent-framed-agent artifact]
## Plan (from plan-interview output — read verbatim, do not reconstruct)
[copy directly from the plan-interview artifact]
## 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]Step 3: Notify the user
"Context wave is done. I've saved the session state to. 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].".context-surfing/[filename]
Handoff to Next Session
- Read the handoff file completely before doing anything else
- Run plan-interview using the handoff as input context
- Re-establish the intent frame via intent-framed-agent
- Pick up context-surfing again from the recommended re-entry point
Session Close (Natural Completion)
- Confirm all plan items are done
- Note session end in a brief summary (optional, not a full handoff file)
- Signal readiness for simplify-and-harden — the next skill in the pipeline picks up from here
Interoperability with Other Skills
What this skill consumes
- From plan-interview: The plan file (). Used as part of the wave anchor and copied verbatim into handoff files.
docs/plans/plan-NNN-<slug>.md - From intent-framed-agent: The intent frame artifact. Used as part of the wave anchor and copied verbatim into handoff files.
- From Entire CLI (optional): Session state for progress tracking and external memory.
What this skill produces
- For simplify-and-harden: A "ready" signal on natural completion. Simplify-and-harden picks up from the completed work.
- For the next session (on drift exit): A handoff file in with full state for session resumption.
.context-surfing/ - For self-improvement: Drift patterns observed during the session can be logged as learnings if they recur.
Pipeline position
- (optional, for requirement shaping)
plan-interview - (execution contract + scope drift monitoring)
intent-framed-agent - (context quality monitoring — runs concurrently with intent-framed-agent during execution)
context-surfing - (post-completion quality/security pass)
simplify-and-harden - (capture recurring patterns and promote durable rules)
self-improvement
Hook Integration
Setup (Claude Code / Codex)
.claude/settings.json{
"hooks": {
"UserPromptSubmit": [{
"matcher": "",
"hooks": [{
"type": "command",
"command": "./skills/context-surfing/scripts/handoff-checker.sh"
}]
}]
}
}.context-surfing/Copilot / Chat Fallback
ls .context-surfing/handoff-*.md 2>/dev/null