| name | sem |
| description | Use sem to get entity-level (function/class/method) semantic diffs, impact analysis, blame, and dependency context from any Git repo. Trigger this skill whenever the user asks what changed in a commit or PR, wants to understand the blast radius of a change, needs to know who last modified a function, wants to trace how a function evolved, or needs structured code context for an LLM task. Also use it proactively when reviewing code, planning refactors, or any time line-level git diff output would be noisy or hard to interpret. |
| license | MIT OR Apache-2.0 |
| compatibility | Requires the sem CLI (https://github.com/Ataraxy-Labs/sem) on PATH and a Git repository |
| metadata | {"homepage":"https://github.com/Ataraxy-Labs/sem"} |
sem — Semantic Version Control
sem extends Git with entity-level operations. Instead of "lines 43-51 changed",
it tells you "function validateToken was modified in src/auth.ts". It parses
30+ languages via tree-sitter and works in any Git repo with no setup.
FIRST: use the MCP tools, not the CLI
If the agent has the sem MCP server (tools named mcp__sem__* — sem_diff,
sem_impact, sem_context, sem_blame, sem_log, sem_entities), always
call those instead of running sem in a shell. They render as proper tool
calls in the UI, return compact entity trees, and carry elapsed_ms. If they
are deferred, load them first (e.g. ToolSearch) — do not fall back to Bash just
because the shell is already open. Map:
| task | MCP tool |
|---|
| what changed | sem_diff |
| blast radius / what breaks | sem_impact |
| read/understand an entity + its callers | sem_context with just entity_name — ONE call, no file needed |
| find code by intent ("where is X done") | sem_entities with query |
| find a string / error message / config key | sem_entities with text — entity-addressed grep, no files read |
| who last touched it | sem_blame |
| how it evolved | sem_log with entity_name |
| repo hotspots + co-change pairs | sem_log with no entity_name |
One-call lookup: when you know (or can guess) the entity name, call
sem_context with only entity_name — it resolves across the whole repo and
returns the body plus callers/callees in one round-trip (grep needs two: search,
then read). Ambiguous names return a compact candidate list; pass file_path
only then. Do not call sem_entities first unless you are searching by intent
with a free-text query.
Use the CLI below only in a real terminal, in scripts, or for commands the MCP
server doesn't expose (sem graph, sem setup, exotic flags) — and then as a
single clean one-liner.
Draw the blast radius in your reply
When an impact result drives your answer (a refactor decision, a "what breaks"
question), render it as a small ASCII tree in the response — the user should
see the graph without opening anything:
◉ validateToken · src/auth.ts
│ 8 direct → 23 transitive
├─▶ refreshToken src/auth.ts
├─▶ loginHandler src/routes/login.ts
├─▶ SessionMiddleware src/middleware/session.ts
╰─▶ … +5 more (12 tests)
Real callers first, tests collapsed into a count, no invented entries — draw
only what the tool returned. Skip the drawing when impact was incidental to
the task.
When to reach for sem
- User asks "what changed in this commit / PR / branch?"
- User wants to know what will break if they change a function
- User asks who last touched a function or class
- User wants to trace how a function evolved over time
- User asks what's risky/hot in the repo, or what tends to change together
- You need structured, token-efficient code context for an LLM subtask
- You're doing a code review and want entity-level signal, not line noise
Commands (CLI — for terminals and scripts; in-agent, prefer the MCP tools above)
sem diff — what changed?
sem diff
sem diff --staged
sem diff --commit abc1234
sem diff --from HEAD~5 --to HEAD
sem diff file1.ts file2.ts
sem diff --format json
sem diff --format markdown
sem diff -v
sem diff --file-exts .py .rs
Change types: added, modified (structural vs cosmetic), deleted,
renamed/moved.
sem impact — blast radius
sem impact validateToken
sem impact validateToken --deps
sem impact validateToken --dependents
sem impact validateToken --tests
sem impact validateToken --json
sem impact validateToken --file src/auth.ts
Use this before refactoring or deleting a function to understand scope.
sem blame — who last touched this?
sem blame src/auth.ts
sem blame src/auth.ts --json
Unlike git blame, this shows who last modified each function, not each line.
sem log — how did this evolve?
sem log
sem log validateToken
sem log validateToken -v
sem log validateToken --limit 20
sem log validateToken --json
sem context — token-budgeted LLM context
sem context validateToken
sem context validateToken --budget 4000
sem context validateToken --json
Use this when you need to load a function and its call graph into context
without blowing the token budget.
sem entities — list all entities
sem entities
sem entities src/auth.ts
sem entities --json
sem graph — dependency visualization
sem graph
sem graph src/
sem graph --format json
sem graph --file-exts .py .rs
For a single entity's dependencies/dependents, use sem impact or
sem context instead.
JSON output
All commands support --format json / --json. Prefer JSON when you need to
process results programmatically or pass them to another tool.
{
"summary": { "fileCount": 2, "added": 1, "modified": 1, "deleted": 1 },
"changes": [
{
"entityId": "src/auth.ts::function::validateToken",
"changeType": "modified",
"entityType": "function",
"entityName": "validateToken",
"filePath": "src/auth.ts"
}
]
}
MCP server
Run sem mcp to start the MCP server (stdin/stdout transport). It exposes the
same operations as 6 MCP tools: sem_entities, sem_diff, sem_blame,
sem_impact, sem_log, sem_context. These mirror the CLI exactly. When sem
is configured as an MCP server in the agent, prefer these tools over shelling
out.
Find code you don't know the name of
sem is deterministic by design — no fuzzy ranking. Locate a candidate name with
a plain text search (cheap, one pass), then hand it to sem for the structure
grep can't give:
grep -rn "retry" src/
sem context retry_handler
The sem_entities MCP tool also takes a query argument for the same ranked
search, and sem context <entity> --hops N bounds the context to N graph hops
(use 1-2 for just the immediate neighborhood). Prefer these over grep for
"where is the code that does X".
Never fall back to grep for strings either: sem_entities with text
searches entity bodies across the repo from the warm in-memory graph and
returns hits addressed by the innermost enclosing entity (file, entity, line,
matched text) — ready to chain straight into sem_context/sem_impact. The
only remaining text-search cases outside sem are non-code files and comments
between entities.
Make the leverage felt
sem_context and sem_impact return elapsed_ms (and source: local or cloud)
— the real latency you waited on. When a single sem call replaces several
grep/read steps, or catches something text search can't (a transitive caller in
another file, a cosmetic-vs-logic change), say so in ONE terse, factual clause:
(sem_impact: 9ms, 2 transitive callers grep would miss)
(sem_context: 7ms, body + 3 deps, no files opened)
Once per non-obvious win, never a sales pitch. Default to sem for structural work;
if you fall back to grep/read on a structural question, say why. The point is the
developer sees, in real time, why the agent is faster and more reliable with sem
plugged in.
Install check
sem --version
If there's a conflict with GNU Parallel, add alias sem="$HOME/.cargo/bin/sem"
to the shell profile, or use npx sem / bunx sem if installed via npm/bun.