context-mode
What it does
This skill guides an AI agent to process large command output and files through context-mode tools instead of reading them in full. It is for developers who work with long logs, big API responses and build output.
When to use it
- βWhen an agent is asked to analyze logs, summarize command output or parse a large JSON response.
- βWhen a build or dependency check may produce a long output that should be filtered.
- βWhen a page snapshot or browser structure is too large to read directly.
Skill link
https://github.com/mksglu/context-mode/blob/main/skills/context-mode/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βAnalyze these build logs and tell me only the errors, without showing me the full output.β
5 new skills a week. 1 minute to read.
How it works
The skill sets a default rule: use context-mode tools for anything that reads, queries, fetches, lists or builds, and keep plain shell commands for small, safe actions. The agent then shows only the parts that matter.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Context Mode: Default for All Large Output
MANDATORY RULE
<context_mode_logic> <mandatory_rule> Default to context-mode for ALL commands. Only use Bash for guaranteed-small-output operations. </mandatory_rule> </context_mode_logic>Bash whitelist (safe to run directly):
- File mutations:
mkdir,mv,cp,rm,touch,chmod - Git writes:
git add,git commit,git push,git checkout,git branch,git merge - Navigation:
cd,pwd,which - Process control:
kill,pkill - Package management:
npm install,npm publish,pip install - Simple output:
echo,printf
Everything else β ctx_execute or ctx_execute_file. Any command that reads, queries, fetches, lists, logs, tests, builds, diffs, inspects, or calls an external service. This includes ALL CLIs (gh, aws, kubectl, docker, terraform, wrangler, fly, heroku, gcloud, etc.) β there are thousands and we cannot list them all.
When uncertain, use context-mode. Every KB of unnecessary context reduces the quality and speed of the entire session.
Decision Tree
About to run a command / read a file / call an API?
β
βββ Command is on the Bash whitelist (file mutations, git writes, navigation, echo)?
β βββ Use Bash
β
βββ Output MIGHT be large or you're UNSURE?
β βββ Use context-mode ctx_execute or ctx_execute_file
β
βββ Fetching web documentation or HTML page?
β βββ Use ctx_fetch_and_index β ctx_search
β
βββ Using Playwright (navigate, snapshot, console, network)?
β βββ ALWAYS use filename parameter to save to file, then:
β browser_snapshot(filename) β ctx_index(path) or ctx_execute_file(path)
β browser_console_messages(filename) β ctx_execute_file(path)
β browser_network_requests(filename) β ctx_execute_file(path)
β β browser_navigate returns a snapshot automatically β ignore it,
β use browser_snapshot(filename) for any inspection.
β β Playwright MCP uses a SINGLE browser instance β NOT parallel-safe.
β For parallel browser ops, use agent-browser via execute instead.
β
βββ Using agent-browser (parallel-safe browser automation)?
β βββ Run via execute (shell) β each call gets its own subprocess:
β execute("agent-browser open example.com && agent-browser snapshot -i -c")
β β Supports sessions for isolated browser instances
β β Safe for parallel subagent execution
β β Lightweight accessibility tree with ref-based interaction
β
βββ Processing output from another MCP tool (Context7, GitHub API, etc.)?
β βββ Output already in context from a previous tool call?
β β βββ Use it directly. Do NOT re-index with ctx_index(content: ...).
β βββ Need to search the output multiple times?
β β βββ Save to file via ctx_execute, then ctx_index(path) β ctx_search
β βββ One-shot extraction?
β βββ Save to file via ctx_execute, then ctx_execute_file(path)
β
βββ Reading a file to analyze/summarize (not edit)?
βββ Use ctx_execute_file (file loads into FILE_CONTENT, not context)
When to Use Each Tool
| Situation | Tool | Example |
|---|---|---|
| Hit an API endpoint | ctx_execute |
fetch('http://localhost:3000/api/orders') |
| Run CLI that returns data | ctx_execute |
gh pr list, aws s3 ls, kubectl get pods |
| Run tests | ctx_execute |
npm test, pytest, go test ./... |
| Git operations | ctx_execute |
git log --oneline -50, git diff HEAD~5 |
| Docker/K8s inspection | ctx_execute |
docker stats --no-stream, kubectl describe pod |
| Read a log file | ctx_execute_file |
Parse access.log, error.log, build output |
| Read a data file | ctx_execute_file |
Analyze CSV, JSON, YAML, XML |
| Read source code to analyze | ctx_execute_file |
Count functions, find patterns, extract metrics |
| Fetch web docs | ctx_fetch_and_index |
Index React/Next.js/Zod docs, then search |
| Playwright snapshot | browser_snapshot(filename) β ctx_index(path) β ctx_search |
Save to file, index server-side, query |
| Playwright snapshot (one-shot) | browser_snapshot(filename) β ctx_execute_file(path) |
Save to file, extract in sandbox |
| Playwright console/network | browser_*(filename) β ctx_execute_file(path) |
Save to file, analyze in sandbox |
| MCP output (already in context) | Use directly | Don't re-index β it's already loaded |
| MCP output (need multi-query) | ctx_execute to save β ctx_index(path) β ctx_search |
Save to file first, index server-side |
FAQ
Which commands can still run directly?
Small, safe actions such as making folders, moving files, git writes, navigation and echo can still run in the shell.
What does it do with big output?
It processes the output in the sandbox and returns only the relevant results to the conversation.
Does it apply to every command?
It applies to most commands, and the rule is to use context-mode whenever the agent is unsure how large the output will be.
Details
Original description by the author
Use context-mode tools (ctx_execute, ctx_execute_file) instead of Bash/cat when processing large outputs. Triggers: "analyze logs", "summarize output", "process data", "parse JSON", "filter results", "extract errors", "check build output", "analyze dependencies", "process API response", "large file analysis", "page snapshot", "browser snapshot", "DOM structure", "inspect page", "accessibility tree", "Playwright snapshot", "run tests", "test output", "coverage report", "git log", "recent commits", "diff between branches", "list containers", "pod status", "disk usage", "fetch docs", "API referen
repo: mksglu/context-mode
Popularity
- GitHub stars
- 33k
- Ranking position
- #8510
- License
- β
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
context-mode
33kTeaches your agent to use context-mode tools for reading, searching and running data-heavy tasks, so large outputs stay out of the main conversation.
context-mode
33kTeaches your agent to run data-heavy work in a sandbox and print only the answer, so raw files and web pages do not flood the conversation.
ctx-doctor
33kRuns context-mode diagnostics that check runtimes, hooks, search storage, plugin setup and versions, then shows a clear pass or fail report.
ctx-index
33kLets your agent index a local project or folder into a searchable store, so later questions find the right snippets without rereading every file.
Similar skills
add-model-provider
394kLets your agent connect a new AI model provider to OpenClaw using safe setup commands, keep API keys out of plain text, and run a live test.
acp-router
394kHelps your agent send a task to a coding assistant such as Claude Code or Cursor through OpenClaw, so the work runs in that tool.
browser-automation
394kTeaches your agent to control web pages step by step, including logins, tabs, and recovery when a page stops responding.