why

why is a skill for Claude Code from nicknisi/sessions. It costs 105 tokens per session (797 once invoked), scanned A, original, MIT.

A read-only tool workflow that explains why code exists by linking files, lines, commits, or topics to the AI coding sessions that produced them.

In plain words
What is it for?
It is for investigating implementation choices, identifying who changed code and why, and checking for abandoned attempts.
Why use it?
It helps recover the reasoning behind code when the commit message or surrounding code does not explain the decision.

Skill for Claude Code

Written for Claude Code: argument-hint in frontmatter.

Part of the sessions plugin — 8 skills, 1 MCP server shipped together

Good fit It is for investigating implementation choices, identifying who changed code and why, and checking for abandoned attempts.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/nicknisi/sessions/why
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 nicknisi/sessions --skill why
Clone the repo
git clone --depth 1 https://github.com/nicknisi/sessions

Made for: Claude Code.

Or install sessions, the plugin that ships this one along with the rest of its 8 skills, 1 MCP server.

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 why

README.md
[![agentmods](https://agentmods.dev/badge/skills/nicknisi/sessions/why/github.svg)](https://agentmods.dev/skills/nicknisi/sessions/why)
Your own site
<a href="https://agentmods.dev/skills/nicknisi/sessions/why"><img src="https://agentmods.dev/badge/skills/nicknisi/sessions/why/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 why

Your own site · 80×15
<a href="https://agentmods.dev/skills/nicknisi/sessions/why"><img src="https://agentmods.dev/badge/skills/nicknisi/sessions/why.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 105 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 797 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00105 $0.00797
Opus 5.5 $0.00042 $0.00319
Sonnet 5.5 $0.00021 $0.00159
Haiku 4.5 $0.00011 $0.00080

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

Security

Grade A, and why

why 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 3mo 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.

plugin/skills/why/SKILL.md · 59 lines

How it starts

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

Explain why code exists by finding the session that produced it.

Steps

  1. Call why_did_this_change with the user's target as target:

    • A file → src/cache.ts
    • A specific line → src/cache.ts:142 (pins the commit via git blame)
    • A commit → a sha, tag, or HEAD~2
    • A topic → free text (searches sessions in this repo, no git)

    The tool is read-only: it never writes to the repository.

  2. Read the evidence. The result carries the resolved commit (subject, author time, files, trailers; null for the free-text form) and ranked sessions. Trust confidence: files+time (the session edited the committed files inside its window) is stronger than time-only (same repo and window, no file overlap). Two flags change how you read the commit: commit.merge: true means this is the merge that landed the change, not the commit that wrote it — the reasoning lives in the sessions, not the merge subject. A non-empty unlandedAttempts (file form only) means sessions touched this file but no commit ever landed from them — a possible abandoned attempt.

  3. Synthesize a short answer from each session's excerpts and headline. Explain the reasoning and any abandoned approaches — the part git does not record. Do not invent rationale the excerpts do not support.

  4. Cite each session you used: its tool, date (startedAt), and headline. Distinguish files+time matches from time-only matches so the user can weigh them.

  5. Check closed PRs before concluding "fixed". When the question is "was this fixed" or "does this bug still exist", git history alone is not proof: a fix may have been tried and rejected without leaving a commit. If the repo has a GitHub remote and gh is available, run gh search prs --state closed -- <terms> (or gh pr list --search "<file>" --state closed) and report a closed-unmerged attempt alongside any merged fix. Skip silently when gh or a GitHub remote is absent.

  6. Offer a deep-dive. If the user wants more, call get_session_messages with a session's filePath (use an excerpts[].msgIndex as the offset) to read the full exchange.

Read the full file on GitHub · 59 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. 3mo ago First seen · 59 lines · 105 tokens per session scan A 640383b6e911

Subscribe to this mod's changes

why is a skill published in the GitHub repository nicknisi/sessions (54 stars, last pushed 14d ago), licensed MIT. It adds 105 tokens to every session and 797 once invoked, about $0.0004 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-08-30.

Related

why compared with skills from other repositories

why next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
whynicknisi/sessionsSkill5414d agoMITA105Claude Code
code_explorergoogle-gemini/gemini-cliSkill109ktodayApache-2.0A28Gemini CLI
test-failure-explorerQwenLM/qwen-codeSkill31ktodayApache-2.0A32Claude Code, Codex
session-investigatorevalstate/fast-agentSkill4.0kyesterdayApache-2.0A68Claude Code, Codex
smiles-validationsynthetic-sciences/openscienceSkill4.5kyesterdayApache-2.0A24Claude Code, Codex
pr-autofixAtomicBot-ai/atomic-agentSkill3.6kyesterdayMITA45Claude Code, Codex
oversight-teammvschwarz/openrigSkill9.0ktodayApache-2.0A117Claude Code, Codex