context-mode

context-mode is a skill for Claude Code from cnfeat/top-pm-skills. It costs 85 tokens per session (1,835 once invoked), scanned A, original, MIT.

A session-management tool for Claude Code that filters noisy command output, records a session log, and resumes work after a reset.

In plain words
What is it for?
Use it during extended coding tasks to keep useful summaries, maintain a record of activity, and continue from the saved session state.
Why use it?
Long coding sessions can fill the context with command output, while resets can make the agent lose track of previous work.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions CLAUDE.md; mentions Claude Code.

Part of the pm-engineering plugin — 37 skills shipped together

Good fit Use it during extended coding tasks to keep useful summaries, maintain a record of activity, and continue from the saved session state.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cnfeat/top-pm-skills/context-mode
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add cnfeat/top-pm-skills --skill context-mode
Clone the repo
git clone --depth 1 https://github.com/cnfeat/top-pm-skills

Made for: Claude Code.

Or install pm-engineering, the plugin that ships this one along with the rest of its 37 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for context-mode

README.md
[![agentmods](https://agentmods.dev/badge/skills/cnfeat/top-pm-skills/context-mode/github.svg)](https://agentmods.dev/skills/cnfeat/top-pm-skills/context-mode)
Your own site
<a href="https://agentmods.dev/skills/cnfeat/top-pm-skills/context-mode"><img src="https://agentmods.dev/badge/skills/cnfeat/top-pm-skills/context-mode/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for context-mode

Your own site · 80×15
<a href="https://agentmods.dev/skills/cnfeat/top-pm-skills/context-mode"><img src="https://agentmods.dev/badge/skills/cnfeat/top-pm-skills/context-mode.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 85 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,835 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00085 $0.01835
Opus 5.5 $0.00034 $0.00734
Sonnet 5.5 $0.00017 $0.00367
Haiku 4.5 $0.00009 $0.00184

Measured 1mo ago against content hash 27a6970c3508, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

context-mode scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

参考skill/pm-claude-skills-main/pm-claude-skills-main/plugins/pm-engineering/skills/context-mode/SKILL.md · 249 lines

How it starts

The opening of the file, as written. The whole thing — 249 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Context Mode Skill

Fix the two session killers that end most Claude Code sessions in under 30 minutes: context bloat from raw command output, and memory loss after a reset.

Context Mode runs three systems simultaneously to keep sessions alive:

  • Output Filtering — strips verbose command output before it enters context
  • Session Log — writes a running log of everything that happened
  • Auto-Resume — reads the log on reset and picks up exactly where you left off

Credit: Inspired by a skill from Nate Herk's YouTube channel — adapted and extended for this library.


Required Inputs

No inputs required. Context Mode activates on command.

Optional: user can specify a custom log file path if they don't want session.log in the project root.


How Context Mode Works

Part 1 — Output Filtering

The problem: every time Claude Code runs a command, the full raw output enters the context window. A single npm install can dump hundreds of lines. A test suite run? Thousands. Within 30 minutes, the context is full of noise and Claude resets.

The fix: before any command output enters context, filter it to the useful summary only.

What gets kept:

  • Last 10 lines of stdout
  • Every line containing error, warn, fail, exception, traceback, or fatal (case-insensitive)
  • The exit code
  • A one-line summary of what the command did and whether it succeeded

What gets discarded:

  • Middle section of long stdout (replaced with [... N lines of output truncated ...])
  • Progress bars, download indicators, verbose install logs
  • Repeated identical lines (deduplicated)

Filtering summary format:

COMMAND: [command run]
STATUS:  [exit code — success / failed]
SUMMARY: [one sentence: what happened]
ERRORS:  [any error/warn lines — or "none"]
TAIL:    [last 10 lines of stdout]

Part 2 — Session Log

Claude maintains a running log file at [project root]/session.log. This file is written after every significant action and is the source of truth for resuming after a reset.

Read the full file on GitHub · 249 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 249 lines · 85 tokens per session scan A 27a6970c3508

Subscribe to this mod's changes

context-mode is a skill published in the GitHub repository cnfeat/top-pm-skills (55 stars, last pushed 4mo ago), licensed MIT. It adds 85 tokens to every session and 1,835 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

Migrate

Intakes external content (notes, CLAUDE.md, Cursor rules, Obsidian/Notion/Apple Notes exports), classifies chunks against the LifeOS taxonomy, and commits with provenance after confidence-tiered approval. USE WHEN /migrate, migrate content, import from other LifeOS, bring in old notes, import Cursor rules, import…

danielmiessler/LifeOS · 104 tokens

Cortex

LifeOS memory, prior-session recall, and learning capture. USE WHEN capture this learning, document this learning, what did we learn recently, recent learnings, cortex, knowledge, knowledge base, search knowledge, what do we know about, archive, harvest, knowledge status, develop note, add to knowledge, add a people…

danielmiessler/LifeOS · 184 tokens

wiki-dashboard

Create dynamic, queryable Obsidian dashboard views using Bases or Dataview. Use for auto-updating tables, indexes, or structured views of vault content; not for ordinary question answering.

Ar9av/obsidian-wiki · 42 tokens

relevance-coarse-filter

Cheap, high-recall first-pass filter that removes obvious junk from a detector candidate pool before expensive story-origin research and PR judgment. Decides keep, monitoronly, or reject — never ranks, writes angles, verifies dates, or decides whether to pitch.

elvisun/newsjack · 57 tokens

session-compact

AI DevKit · Compact a historical AI coding session with Jev when context is long, work is handed off or resumed, or durable continuation facts and memory candidates need extraction.

codeaholicguy/ai-devkit · 39 tokens

daily-briefing

Proactive daily briefing that fires on a recurring schedule, pulls recent memory and workspace context, composes a structured summary (action items, progress, radar, next steps), and delivers it to all active channels. Enable with a time like "set up my daily briefing at 9am". Disable, reschedule, or check status at…

vellum-ai/vellum-assistant · 75 tokens