Context Mode Output Sandbox
mksglu/context-mode
Routes large command, file, API and browser output through context-mode tools so only the needed result enters the agent's context, instead of dumping it via Bash.
Inspect Claude Code session JSONL files at ~/.claude/projects/ to extract real conversation telemetry: token counts (input/output/cache reads/cache writes), assistant turn counts, human prompt…
$ npx skills add swyxio/skills --skill claude-session-introspect -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install swyxio/skills claude-session-introspect --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/swyxio/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/claude-session-introspect .claude/skills/claude-session-introspect && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "claude-session-introspect" agent skill from https://github.com/swyxio/skills/tree/main/claude-session-introspect into .claude/skills/claude-session-introspect/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "claude-session-introspect", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/swyxio/skills/tree/main/claude-session-introspectType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add swyxio/skills --skill claude-session-introspect -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install swyxio/skills claude-session-introspect --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/swyxio/skills.git skills-src && mkdir -p .agents/skills && cp -r skills-src/claude-session-introspect .agents/skills/claude-session-introspect && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "claude-session-introspect" agent skill from https://github.com/swyxio/skills/tree/main/claude-session-introspect into .agents/skills/claude-session-introspect/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "claude-session-introspect", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add swyxio/skills --skill claude-session-introspect -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install swyxio/skills claude-session-introspect --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/swyxio/skills.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/claude-session-introspect .cursor/skills/claude-session-introspect && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "claude-session-introspect" agent skill from https://github.com/swyxio/skills/tree/main/claude-session-introspect into .cursor/skills/claude-session-introspect/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "claude-session-introspect", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/swyxio/skills.git --path claude-session-introspect--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add swyxio/skills --skill claude-session-introspect -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install swyxio/skills claude-session-introspect --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/swyxio/skills.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/claude-session-introspect .gemini/skills/claude-session-introspect && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "claude-session-introspect" agent skill from https://github.com/swyxio/skills/tree/main/claude-session-introspect into .gemini/skills/claude-session-introspect/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "claude-session-introspect", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install swyxio/skills claude-session-introspectInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add swyxio/skills --skill claude-session-introspect -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/swyxio/skills.git skills-src && mkdir -p .github/skills && cp -r skills-src/claude-session-introspect .github/skills/claude-session-introspect && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "claude-session-introspect" agent skill from https://github.com/swyxio/skills/tree/main/claude-session-introspect into .github/skills/claude-session-introspect/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "claude-session-introspect", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add swyxio/skills --skill claude-session-introspect -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install swyxio/skills claude-session-introspect --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/swyxio/skills.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/claude-session-introspect .opencode/skills/claude-session-introspect && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "claude-session-introspect" agent skill from https://github.com/swyxio/skills/tree/main/claude-session-introspect into .opencode/skills/claude-session-introspect/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "claude-session-introspect", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
claude-session-introspectInspect Claude Code session JSONL files at ~/.claude/projects/ to extract real conversation telemetry: token counts (input/output/cache reads/cache writes), assistant turn counts, human prompt…
Claude Session Introspect is an agent skill from swyxio/skills. Inspect Claude Code session JSONL files at ~/.claude/projects/ to extract real conversation telemetry: token counts (input/output/cache reads/cache writes), assistant turn counts, human prompt counts, tool-use counts, compaction boundaries, and the contents of compaction summaries. Use this skill when the user asks "how many tokens did this session use", "how many prompts have I sent", "show me the stats for this conversation", "what got compacted", "where are the compaction boundaries", "introspect the session"…
Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files (for example `README.md` and `stats.sh`). Compatibility notes: Requires jq. Sessions live at ~/.claude/projects/<encoded-cwd/<session-uuid.jsonl. The encoded-cwd is the absolute working directory with / replaced by - and…
It sits in Agent Workflows, covering Context engineering. The repository describes itself as: Agent skills for Claude Code and other AI agents. The licence is MIT.
Read from SKILL.md and the folder at commit 038ef34. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Ships script files (Shell), which the agent can run.
Shell commands in SKILL.md call:
jqbashclaudeFrom the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
talraviv.coFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Requires `jq`. Sessions live at `~/.claude/projects/<encoded-cwd>/<session-uuid>.jsonl`. The encoded-cwd is the absolute working directory with `/` replaced by `-` and a leading `-`. Each line is a JSON object with `type`, `message`, `toolUseResult`, etc.
From compatibility in the SKILL.md frontmatter.
Claude Session Introspect loads about 2k tokens when it runs. Until then it costs about 188 tokens; SKILL.md has 592 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from swyxio/skills at commit 038ef34, republished under its MIT licence (© swyxio). 592 words, ~2,045 tokens.
.claude/skills/claude-session-introspect/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.Claude Code persists every conversation as a JSONL file on disk. This skill is the recipe for opening one and pulling out the numbers you actually want — token usage, prompt counts, compaction events, tool calls — without guessing.
~/.claude/projects/<encoded-cwd>/<session-uuid>.jsonl<encoded-cwd> is the absolute path of the project's working directory with / replaced by - and a leading -. Example: /Users/swyx/Work/foo → -Users-swyx-Work-foo.
Each line is one event. The interesting type values:
| type | what it is |
|---|---|
user | a real user message OR a tool result (distinguished by toolUseResult being non-null) |
assistant | an assistant turn (one model response). message.usage has the token counts. |
system | system messages (mostly compaction-related) |
file-history-snapshot | edited-file snapshots used for undo |
attachment | image/file attachments |
permission-mode | permission mode toggles |
# 1. encode current working directory
ENC="-$(pwd | sed 's,/,-,g' | sed 's/^-//')"
# 2. list the project's session files, newest first
ls -t "$HOME/.claude/projects/$ENC/"
# 3. the most recent .jsonl is usually the live one
SESSION="$HOME/.claude/projects/$ENC/$(ls -t "$HOME/.claude/projects/$ENC/" | head -1)"
echo "$SESSION"If you know the session UUID (Claude Code shows it, and image-cache paths embed it), you can grep all projects:
find ~/.claude/projects -name '<uuid>.jsonl'The stats.sh script in this skill folder takes a session path and prints token totals, turn counts, prompt counts, tool-use counts, and any compaction events.
bash stats.sh "$SESSION"If you don't have the script handy, here are the inline jq one-liners.
jq -s '
[.[] | select(.message.usage)] |
{
assistant_turns: length,
input_tokens: (map(.message.usage.input_tokens // 0) | add),
output_tokens: (map(.message.usage.output_tokens // 0) | add),
cache_read_tokens: (map(.message.usage.cache_read_input_tokens // 0) | add),
cache_create_tokens: (map(.message.usage.cache_creation_input_tokens // 0)| add)
}
' "$SESSION"input_tokens is the FRESH (non-cached) input. cache_read_tokens is the dominant number on long sessions — it's how much was re-read from prompt cache. cache_create_tokens is what got newly written into the cache. Effective total tokens processed = input + cache_read + cache_create.
jq -r '.type' "$SESSION" | sort | uniq -cA type:"user" line is a human message only if toolUseResult is null. Even then, the content may be a system-injected reminder, not the human's words.
jq -r '
select(.type == "user" and .toolUseResult == null) |
(.message.content
| if type == "string" then .
else (map(select(.type == "text") | .text) | join("\n"))
end)
' "$SESSION" > /tmp/prompts.txt
# total non-empty user message blocks
grep -cv '^$' /tmp/prompts.txt
# distinct human messages = blocks not starting with <system-reminder> or <command-
awk '
BEGIN { n = 0; cur = "" }
/^$/ { if (cur != "" && cur !~ /^<system-reminder>/ && cur !~ /^<command-/) n++; cur=""; next }
{ if (cur=="") cur=$0 }
END { if (cur != "" && cur !~ /^<system-reminder>/ && cur !~ /^<command-/) n++; print n }
' /tmp/prompts.txt(Blunt but works. If you want surgical accuracy, parse the content array and skip blocks whose first text element is a <system-reminder> tag.)
jq -r '
select(.type == "assistant") |
.message.content[]? |
select(.type == "tool_use") |
.name
' "$SESSION" | sort | uniq -c | sort -rnCompaction inserts a system event with subtype:"compact_boundary" (older builds may use isCompactSummary on the next user message). The summary itself is the next user message, prefixed with "This session is being continued from a previous conversation that ran out of context."
# count compaction events
jq -r 'select(.type=="system" and (.subtype // "") == "compact_boundary") | .timestamp' "$SESSION" | wc -l
# was each one auto or manual?
jq -r '
select(.type == "system" and (.subtype // "") == "compact_boundary") |
{ts: .timestamp, trigger: (.compactMetadata.trigger // "unknown"), preTokens: (.compactMetadata.preCompactTokens // null)}
' "$SESSION"
# read the compaction summaries (the actual contents that survived)
jq -r '
select(.type == "user" and (.isCompactSummary == true or
((.message.content // "") | tostring | test("session is being continued from a previous conversation"))))
| (.message.content | if type == "string" then . else (map(select(.type=="text").text)|join("\n")) end)
' "$SESSION" | lessjq -r '
select(.message.usage) |
[.timestamp,
(.message.usage.input_tokens // 0),
(.message.usage.output_tokens // 0),
(.message.usage.cache_read_input_tokens // 0)]
| @tsv
' "$SESSION" | column -tThis is how you find the one tool result that bloated your context — sort by cache_read ascending across the session and watch for the jump.
type:"user" is overloaded. Tool results are also type:"user". Always filter on toolUseResult == null to get human turns.input_tokens looks tiny on long sessions. That's correct — it's the delta sent uncached. Almost everything flows through cache_read_input_tokens.ls -t | head is your friend./resume. If you want to do "brain surgery" (Tal Raviv's term), copy the file out, edit the copy, and use claude --resume <copied-uuid> from a clean directory.~/.claude/projects/© swyxio, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 2 other files in claude-session-introspect of swyxio/skills.
Open the folder on GitHubat commit 038ef34
Claude Session Introspect next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Claude Session Introspect this skillswyxio/skills | 176 | — | ~2k | Automated safety check: Pass | MIT | |
| Context Mode Output Sandboxmksglu/context-mode | 26k | — | ~4.1k | Automated safety check: Pass | Custom licence | |
| Memori Long-Term MemoryMemoriLabs/Memori | 17k | — | ~2k | Automated safety check: Notes | Custom licence | |
| Picoclaw Skill Creatorsipeed/picoclaw | 30k | — | ~4.4k | Automated safety check: Pass | MIT | |
| ccc Semantic Code Searchcocoindex-io/cocoindex-code | 2.8k | — | ~938 | Automated safety check: Pass | Apache-2.0 | |
| Context Mode for Antigravity CLImksglu/context-mode | 26k | — | ~850 | Automated safety check: Pass | Custom licence |
mksglu/context-mode
Routes large command, file, API and browser output through context-mode tools so only the needed result enters the agent's context, instead of dumping it via Bash.
MemoriLabs/Memori
Connects Claude Code to Memori Cloud for long-term memory, recalling stored context before substantive replies and saving new context afterward.
sipeed/picoclaw
Guidance for creating, updating and reviewing Picoclaw skills, from the SKILL.md structure to organizing bundled scripts, references and assets.
cocoindex-io/cocoindex-code
Semantic code search and index management with the ccc CLI: the agent initializes, indexes and queries the project by concept, filtering by language or path.
mksglu/context-mode
Routing rules for using context-mode MCP tools in Antigravity CLI: sandboxed code runs, file analysis, indexed search and web fetches that keep large output out of the conversation.
alexgreensh/token-optimizer
Audit a Claude Code or Codex setup for context-window waste, then fix it and measure the savings.
swyxio/skills
Run a selected coding-agent CLI programmatically, with latency, error, usage, cost, and trace logging.
swyxio/skills
Design, implement, audit, or refresh protected username and handle namespaces for public products.
swyxio/skills
Fully automated new Mac setup for fullstack web developers and AI engineers.
swyxio/skills
Manage YouTube videos programmatically via the YouTube Data API v3 — upload video files, upload custom thumbnails, update video metadata (titles, descriptions, tags), and query video/channel info…
swyxio/skills
Batch YouTube Studio upload workflow for videos sourced from Airtable, Google Drive, Loom, YouTube, or local files.
swyxio/skills
Reconstruct and visually analyze paired agent, game, or policy trajectories to determine whether changed actions produced their intended effects.
Categories
Inspect Claude Code session JSONL files at ~/.claude/projects/ to extract real conversation telemetry: token counts (input/output/cache reads/cache writes), assistant turn counts, human prompt…. Claude Session Introspect is an agent skill from swyxio/skills.claude/projects/ to extract real conversation telemetry: token counts (input/output/cache reads/cache writes), assistant turn counts, human prompt counts, tool-use counts, compaction boundaries, and the contents of compaction summaries.
Claude Session Introspect fits situations like: the user asks how many tokens did this session use; how many prompts have I sent; show me the stats for this conversation; what got compacted.
Run `npx skills add swyxio/skills --skill claude-session-introspect -a claude-code`. Or copy the skill folder (claude-session-introspect in swyxio/skills) into .claude/skills/claude-session-introspect in your project. Claude Code loads it when a task matches its description.
Run `npx skills add swyxio/skills --skill claude-session-introspect -a codex`. Or copy the skill folder (claude-session-introspect in swyxio/skills) into .agents/skills/claude-session-introspect in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add swyxio/skills --skill claude-session-introspect -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/claude-session-introspect, .gemini/skills/claude-session-introspect, .github/skills/claude-session-introspect and .opencode/skills/claude-session-introspect in your project.
Going by SKILL.md and its folder, Claude Session Introspect needs a shell for the scripts in its folder and the command-line tools its instructions call (jq, bash and claude). Our summary lists: A Bash shell. Compatibility (from SKILL.md): Requires `jq`. Sessions live at `~/.claude/projects/<encoded-cwd>/<session-uuid>.jsonl`. The encoded-cwd is the absolute working directory with `/` replaced by `-` and a leading `-`. Each line is a JSON object with `type`, `message`, `toolUseResult`, etc. .
SKILL.md names 1 domain. As links in the text: talraviv.co. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Claude Session Introspect is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.
About 2k tokens (SKILL.md is roughly 8.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Claude Session Introspect: Context Mode Output Sandbox (mksglu/context-mode, 26k stars), Memori Long-Term Memory (MemoriLabs/Memori, 17k stars), Picoclaw Skill Creator (sipeed/picoclaw, 30k stars) and ccc Semantic Code Search (cocoindex-io/cocoindex-code, 2.8k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
swyxio (a GitHub user) maintains it in swyxio/skills, which has 176 GitHub stars. The repository holds 89 skills in this directory. The repository was last updated on October 5, 2026.
Source: swyxio/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.