# sem > Entity-level semantic diff on top of Git. Functions, classes, methods instead of lines. ## Overview sem extends Git with entity-level operations. Instead of tracking lines, sem tracks functions, classes, methods, and types. Uses tree-sitter for parsing and AST-normalized structural hashing to detect cosmetic vs structural changes. Git tracks lines. Developers think in functions. sem bridges the gap. ## Install ``` curl -fsSL https://raw.githubusercontent.com/Ataraxy-Labs/sem/main/install.sh | sh brew install sem-cli npm install --save-dev @ataraxy-labs/sem cargo install sem-cli ``` Update with `sem config update`. ## Commands Four questions, four verbs, plus diff, graph and history. Every verb takes `--json`, and `sem --help` shows each flag with an example. ### sem find: where is it? ``` sem find parseConfig # where parseConfig is defined sem find parseConfig loadEnv # several names in one call sem find parseConfig --callers # who calls it (exact, or marked incomplete) sem find parseConfig --refs # what it calls and references sem find parseConfig --context # its code plus callers and callees, in a token budget sem find --in src/config.ts # every entity in a file or directory ``` ### sem grep: where does this text appear? ``` sem grep 'retry budget' # rg-style file:line:text sem grep -i todo src/ # case-insensitive, under src/ sem grep -e foo -e bar --json # two patterns, hits kept apart ``` ### sem impact: what does my change touch? ``` sem impact parseConfig # dependents, dependencies and tests it reaches sem impact parseConfig --tests # only the tests to run sem impact --diff HEAD --tests # tests for the uncommitted change sem impact parseConfig --depth 0 # unlimited transitive depth (default 2) ``` ### sem check: is it correct? ``` sem check # every checker the project has sem check --base origin/main # against origin/main instead of HEAD sem check --json # one JSON object with a verification certificate ``` ### sem certify: what should a human review? ``` sem certify main..HEAD # the review certificate for a commit range sem certify main..HEAD --arch # the architecture view ``` ### sem diff: which functions and classes changed? Distinguishes cosmetic changes (whitespace, formatting, comments) from structural ones. ``` sem diff # working changes sem diff --staged # staged only sem diff main..HEAD --json # a range, as JSON sem diff file1.ts file2.ts # compare two files (no git needed) sem diff --format markdown -v # markdown tables with inline content diffs sem diff --no-cosmetics # hide formatting-only changes ``` ### sem graph: how is the code connected? ``` sem graph --json # entity dependency graph sem graph --modules blast-radius pkg # who breaks if pkg changes (JS/TS workspaces) sem graph --dataflow --json # per-function reads/writes and source-to-sink paths ``` ### sem history: how did this entity change? ``` sem history parseConfig # every version of parseConfig sem history --blame src/config.ts # who last changed each entity in the file sem history # hotspots and co-change pairs ``` ### sem mcp: the same verbs as MCP tools `sem mcp` serves sem_find, sem_grep, sem_impact, sem_check, sem_certify, sem_diff, sem_graph and sem_history over stdin/stdout. ## Defaults per command Flags an agent or CI repeats on every call can be set once in the environment, as `SEM__