Entity-level code intelligence: semantic diff, impact analysis, blame, and context for AI agents
$git clone https://github.com/ataraxy-labs/semInstalls into the current project.
Install sem by running `git clone https://github.com/ataraxy-labs/sem`, then use it for the current task and follow its documentation at https://github.com/ataraxy-labs/sem.
| 1 | > **Part of the [Ataraxy Labs](https://ataraxy-labs.com) stack** — agent-native infrastructure for software development. See also: [weave](https://ataraxy-labs.com/weave) (entity-level git merge driver) · [inspect](https://github.com/Ataraxy-Labs/inspect) (semantic code review) · [opensessions](https://github.com/Ataraxy-Labs/opensessions) (tmux sidebar for coding agents). |
| 2 | > |
| 3 | > Read the manifesto: https://ataraxy-labs.com/#thesis · Essays: https://ataraxy-labs.com/blogs · LLMs: https://ataraxy-labs.com/llms.txt |
| 4 | |
| 5 | <p align="center"> |
| 6 | <img src="assets/banner.svg" alt="sem" width="600" /> |
| 7 | </p> |
| 8 | |
| 9 | <p align="center"> |
| 10 | <a href="https://trendshift.io/repositories/25348" target="_blank"><img src="https://trendshift.io/api/badge/repositories/25348" alt="Ataraxy-Labs%2Fsem | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a> |
| 11 | </p> |
| 12 | |
| 13 | <p align="center"> |
| 14 | <strong>Semantic version control built on Git.</strong><br> |
| 15 | Instead of lines changed, sem tells you what entities changed: functions, methods, classes. |
| 16 | </p> |
| 17 | |
| 18 | <p align="center"> |
| 19 | <a href="https://ataraxy-labs.com/blogs/code-is-not-text">Why sem?</a> · |
| 20 | <a href="#install">Install</a> · |
| 21 | <a href="#commands">Commands</a> · |
| 22 | <a href="#use-with-ai-agents-mcp">Agents (MCP)</a> · |
| 23 | <a href="docs/cloud-consent.html">Cloud consent</a> · |
| 24 | <a href="https://github.com/Ataraxy-Labs/sem/releases/latest">Releases</a> |
| 25 | </p> |
| 26 | |
| 27 | <p align="center"> |
| 28 | <a href="https://github.com/Ataraxy-Labs/sem/releases/latest"><img src="https://img.shields.io/github/v/release/Ataraxy-Labs/sem?color=blue&label=release" alt="Release"></a> |
| 29 | <img src="https://img.shields.io/badge/rust-stable-orange" alt="Rust"> |
| 30 | <img src="https://img.shields.io/badge/tests-133_passing-brightgreen" alt="Tests"> |
| 31 | <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-yellow" alt="License"></a> |
| 32 | <img src="https://img.shields.io/badge/languages-31-blue" alt="Languages"> |
| 33 | </p> |
| 34 | |
| 35 | sem is a semantic version control tool that works on top of Git. It parses your code with tree-sitter, extracts every function, class, and method as an entity, and diffs at the entity level instead of lines. This means you see "function `blahh` was modified" instead of "lines x-y changed." |
| 36 | |
| 37 | It works in any Git repo with no setup. |
| 38 | |
| 39 | Cloud-backed queries are opt-in per repo: logging in does not upload a repo or send a query. See the [cloud consent flow](docs/cloud-consent.html) for the public/private repo states, preview screen, local audit log, and forget controls. |
| 40 | |
| 41 | <p align="center"> |
| 42 | <img src="assets/terminal.svg" alt="sem diff" width="800" /> |
| 43 | </p> |
| 44 | |
| 45 | ## Install |
| 46 | |
| 47 | ```bash |
| 48 | curl -fsSL https://raw.githubusercontent.com/Ataraxy-Labs/sem/main/install.sh | sh |
| 49 | ``` |
| 50 | |
| 51 | Or via Homebrew: |
| 52 | |
| 53 | ```bash |
| 54 | brew install sem-cli |
| 55 | ``` |
| 56 | |
| 57 | Or via winget on Windows: |
| 58 | |
| 59 | ```powershell |
| 60 | winget install AtaraxyLabs.sem |
| 61 | ``` |
| 62 | |
| 63 | Or install the npm wrapper into `node_modules`: |
| 64 | |
| 65 | ```bash |
| 66 | npm install --save-dev @ataraxy-labs/sem |
| 67 | ``` |
| 68 | |
| 69 | With Bun, trust the package so its `postinstall` script can download the binary: |
| 70 | |
| 71 | ```bash |
| 72 | bun add -d @ataraxy-labs/sem |
| 73 | bun pm trust @ataraxy-labs/sem |
| 74 | ``` |
| 75 | |
| 76 | Once installed, update to the latest release any time: |
| 77 | |
| 78 | ```bash |
| 79 | sem update |
| 80 | ``` |
| 81 | |
| 82 | Or build from source (requires Rust): |
| 83 | |
| 84 | ```bash |
| 85 | cargo install --git https://github.com/Ataraxy-Labs/sem sem-cli |
| 86 | ``` |
| 87 | |
| 88 | Or grab a binary from [GitHub Releases](https://github.com/Ataraxy-Labs/sem/releases). |
| 89 | |
| 90 | Or run via Docker: |
| 91 | |
| 92 | ```bash |
| 93 | docker build -t sem . |
| 94 | docker run --rm -it -u "$(id -u):$(id -g)" -v "$(pwd):/repo" sem diff |
| 95 | ``` |
| 96 | |
| 97 | ## Name conflict with GNU Parallel |
| 98 | |
| 99 | GNU Parallel ships a `sem` binary (`/usr/bin/sem`) as a symlink to `parallel`. If you have both installed, they'll collide. Run `sem --version` to check which one you're using. ([#77](https://github.com/Ataraxy-Labs/sem/issues/77)) |
| 100 | |
| 101 | **Quick fixes:** |
| 102 | |
| 103 | ```bash |
| 104 | # Option 1: alias in your shell profile (~/.bashrc, ~/.zshrc) |
| 105 | alias sem="$HOME/.cargo/bin/sem" |
| 106 | |
| 107 | # Option 2: make sure cargo bin comes first in PATH |
| 108 | export PATH="$HOME/.cargo/bin:$PATH" |
| 109 | |
| 110 | # Option 3: if installe |