{"id":44064753,"url":"https://github.com/ataraxy-labs/sem","last_synced_at":"2026-05-26T23:12:42.984Z","repository":{"id":336721292,"uuid":"1150877418","full_name":"Ataraxy-Labs/sem","owner":"Ataraxy-Labs","description":"Semantic version control =\u003e entity-level diffs, blame, and impact analysis on top of git. 26 languages via tree-sitter. Built for coding agents.","archived":false,"fork":false,"pushed_at":"2026-05-22T01:51:37.000Z","size":1131,"stargazers_count":2061,"open_issues_count":14,"forks_count":66,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-05-22T10:58:43.912Z","etag":null,"topics":["ai-agents","code-intelligence","coding-agents","developer-tools","git","llm-tools","semantic-diff","tree-sitter","typescript","version-control"],"latest_commit_sha":null,"homepage":"https://ataraxy-labs.github.io/sem/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ataraxy-Labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["Ataraxy-Labs"]}},"created_at":"2026-02-05T19:49:35.000Z","updated_at":"2026-05-22T03:32:36.000Z","dependencies_parsed_at":"2026-03-01T19:00:48.667Z","dependency_job_id":null,"html_url":"https://github.com/Ataraxy-Labs/sem","commit_stats":null,"previous_names":["ataraxy-labs/sem"],"tags_count":34,"template":false,"template_full_name":null,"purl":"pkg:github/Ataraxy-Labs/sem","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ataraxy-Labs%2Fsem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ataraxy-Labs%2Fsem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ataraxy-Labs%2Fsem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ataraxy-Labs%2Fsem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ataraxy-Labs","download_url":"https://codeload.github.com/Ataraxy-Labs/sem/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ataraxy-Labs%2Fsem/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33416315,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-23T22:14:44.296Z","status":"ssl_error","status_checked_at":"2026-05-23T22:14:43.778Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-agents","code-intelligence","coding-agents","developer-tools","git","llm-tools","semantic-diff","tree-sitter","typescript","version-control"],"created_at":"2026-02-08T03:14:22.297Z","updated_at":"2026-05-24T00:01:45.463Z","avatar_url":"https://github.com/Ataraxy-Labs.png","language":"Rust","funding_links":["https://github.com/sponsors/Ataraxy-Labs"],"categories":["Applications"],"sub_categories":["System tools"],"readme":"\u003e **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).\n\u003e\n\u003e Read the manifesto: https://ataraxy-labs.com/#thesis · Essays: https://ataraxy-labs.com/blogs · LLMs: https://ataraxy-labs.com/llms.txt\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"assets/banner.svg\" alt=\"sem\" width=\"600\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eSemantic version control built on Git.\u003c/strong\u003e\u003cbr\u003e\n  Instead of lines changed, sem tells you what entities changed: functions, methods, classes.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://ataraxy-labs.com/blogs/code-is-not-text\"\u003eWhy sem?\u003c/a\u003e ·\n  \u003ca href=\"#install\"\u003eInstall\u003c/a\u003e ·\n  \u003ca href=\"#commands\"\u003eCommands\u003c/a\u003e ·\n  \u003ca href=\"#mcp-server\"\u003eMCP Server\u003c/a\u003e ·\n  \u003ca href=\"https://github.com/Ataraxy-Labs/sem/releases/latest\"\u003eReleases\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/Ataraxy-Labs/sem/releases/latest\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/Ataraxy-Labs/sem?color=blue\u0026label=release\" alt=\"Release\"\u003e\u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/badge/rust-stable-orange\" alt=\"Rust\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/tests-133_passing-brightgreen\" alt=\"Tests\"\u003e\n  \u003ca href=\"LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-MIT-yellow\" alt=\"License\"\u003e\u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/badge/languages-26-blue\" alt=\"Languages\"\u003e\n\u003c/p\u003e\n\nsem 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.\"\n\nIt works in any Git repo with no setup.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"assets/terminal.svg\" alt=\"sem diff\" width=\"800\" /\u003e\n\u003c/p\u003e\n\n## Install\n\n```bash\nbrew install sem-cli\n```\n\nOr install the npm wrapper into `node_modules`:\n\n```bash\nnpm install --save-dev @ataraxy-labs/sem\n```\n\nWith Bun, trust the package so its `postinstall` script can download the binary:\n\n```bash\nbun add -d @ataraxy-labs/sem\nbun pm trust @ataraxy-labs/sem\n```\n\nOr build from source (requires Rust):\n\n```bash\ncargo install --git https://github.com/Ataraxy-Labs/sem sem-cli\n```\n\nOr grab a binary from [GitHub Releases](https://github.com/Ataraxy-Labs/sem/releases).\n\nOr run via Docker:\n\n```bash\ndocker build -t sem .\ndocker run --rm -it -u \"$(id -u):$(id -g)\" -v \"$(pwd):/repo\" sem diff\n```\n\n## Name conflict with GNU Parallel\n\nGNU 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))\n\n**Quick fixes:**\n\n```bash\n# Option 1: alias in your shell profile (~/.bashrc, ~/.zshrc)\nalias sem=\"$HOME/.cargo/bin/sem\"\n\n# Option 2: make sure cargo bin comes first in PATH\nexport PATH=\"$HOME/.cargo/bin:$PATH\"\n\n# Option 3: if installed via Homebrew\nexport PATH=\"$(brew --prefix)/bin:$PATH\"\n```\n\nIf you installed via npm/bun, the binary lives in `node_modules/.bin/sem` and is invoked through `npx sem` or `bunx sem`, which avoids the conflict entirely.\n\n## Commands\n\nWorks in any Git repo. No setup required. Also works outside Git for arbitrary file comparison.\n\n### sem diff\n\nEntity-level diff with rename detection, structural hashing, and word-level inline highlights.\n\n```bash\n# Semantic diff of working changes\nsem diff\n\n# Staged changes only\nsem diff --staged\n\n# Specific commit\nsem diff --commit abc1234\n\n# Commit range\nsem diff --from HEAD~5 --to HEAD\n\n# Verbose mode (word-level inline diffs for each entity)\nsem diff -v\n\n# Plain text output (git status style)\nsem diff --format plain\n\n# JSON output (for AI agents, CI pipelines)\nsem diff --format json\n\n# Markdown output (for PRs, reports)\nsem diff --format markdown\n\n# Compare any two files (no git repo needed)\nsem diff file1.ts file2.ts\n\n# Read file changes from stdin (no git repo needed)\necho '[{\"filePath\":\"src/main.rs\",\"status\":\"modified\",\"beforeContent\":\"...\",\"afterContent\":\"...\"}]' \\\n  | sem diff --stdin --format json\n\n# Only specific file types\nsem diff --file-exts .py .rs\n```\n\n### sem impact\n\nCross-file dependency graph shows what breaks if an entity changes.\n\n```bash\n# Full impact analysis\nsem impact authenticateUser\n\n# Direct dependencies only\nsem impact authenticateUser --deps\n\n# Direct dependents only\nsem impact authenticateUser --dependents\n\n# Affected tests only\nsem impact authenticateUser --tests\n\n# JSON output\nsem impact authenticateUser --json\n\n# Disambiguate by file\nsem impact authenticateUser --file src/auth.ts\n```\n\n### sem blame\n\nEntity-level blame showing who last modified each function, class, or method.\n\n```bash\nsem blame src/auth.ts\n\n# JSON output\nsem blame src/auth.ts --json\n```\n\n### sem log\n\nTrack how a single entity evolved through git history.\n\n```bash\nsem log authenticateUser\n\n# Verbose mode (show content diff between versions)\nsem log authenticateUser -v\n\n# Limit commits scanned\nsem log authenticateUser --limit 20\n\n# JSON output\nsem log authenticateUser --json\n```\n\n### sem entities\n\nList all entities under a file or directory path. No path is the same as `.`.\n\n```bash\nsem entities\n\nsem entities .\n\nsem entities src/auth.ts\n\n# JSON output\nsem entities --json\nsem entities src/auth.ts --json\n```\n\n### sem context\n\nToken-budgeted context for LLMs: the entity, its dependencies, and its dependents, fitted to a token budget.\n\n```bash\nsem context authenticateUser\n\n# Custom token budget\nsem context authenticateUser --budget 4000\n\n# JSON output\nsem context authenticateUser --json\n```\n\n## Use as default Git diff\n\nReplace `git diff` output with entity-level diffs. Agents and humans get sem output automatically without changing any commands.\n\n```bash\nsem setup\n```\n\nNow `git diff` shows entity-level changes instead of line-level. No prompts, no agent configuration needed. Everything that calls `git diff` gets sem output automatically. Also installs a pre-commit hook that shows entity-level blast radius of staged changes.\n\nTo disable and go back to normal git diff:\n\n```bash\nsem unsetup\n```\n\n## What it parses\n\n26 programming languages with full entity extraction via tree-sitter:\n\n| Language | Extensions | Entities |\n|----------|-----------|----------|\n| TypeScript | `.ts` `.tsx` `.mts` `.cts`  | functions, classes, interfaces, types, enums, exports |\n| JavaScript | `.js` `.jsx` `.mjs` `.cjs` | functions, classes, variables, exports |\n| Python | `.py` | functions, classes, decorated definitions |\n| Go | `.go` | functions, methods, types, vars, consts |\n| Rust | `.rs` | functions, structs, enums, impls, traits, mods, consts |\n| Java | `.java` | classes, methods, interfaces, enums, fields, constructors |\n| C | `.c` `.h` | functions, structs, enums, unions, typedefs |\n| C++ | `.cpp` `.cc` `.hpp` | functions, classes, structs, enums, namespaces, templates |\n| C# | `.cs` | classes, methods, interfaces, enums, structs, properties |\n| Ruby | `.rb` | methods, classes, modules |\n| PHP | `.php` | functions, classes, methods, interfaces, traits, enums |\n| Swift | `.swift` | functions, classes, protocols, structs, enums, properties |\n| Elixir | `.ex` `.exs` | modules, functions, macros, guards, protocols |\n| Bash | `.sh` | functions |\n| HCL/Terraform | `.hcl` `.tf` `.tfvars` | blocks, attributes (qualified names for nested blocks) |\n| Kotlin | `.kt` `.kts` | classes, interfaces, objects, functions, properties, companion objects |\n| Fortran | `.f90` `.f95` `.f` | functions, subroutines, modules, programs |\n| Vue | `.vue` | template/script/style blocks + inner TS/JS entities |\n| XML | `.xml` `.plist` `.svg` `.csproj` | elements (nested, tag-name identity) |\n| ERB | `.erb` `.html.erb` | blocks, expressions, code tags |\n| Svelte | `.svelte` `.svelte.js` `.svelte.ts` | component blocks + rune JS/TS modules |\n| Perl | `.pl` `.pm` `.t` | subroutines, packages |\n| Dart | `.dart` | classes, mixins, extensions, enums, type aliases, functions |\n| OCaml | `.ml` `.mli` | values, modules, types, classes, externals |\n| Scala | `.scala` `.sc` `.sbt` | classes, objects, traits, enums, functions, vals, extensions |\n| Zig | `.zig` | functions, tests, variables |\n\nPlus structured data formats:\n\n| Format | Extensions | Entities |\n|--------|-----------|----------|\n| JSON | `.json` | properties, objects (RFC 6901 paths) |\n| YAML | `.yml` `.yaml` | sections, properties (dot paths) |\n| TOML | `.toml` | sections, properties |\n| CSV | `.csv` `.tsv` | rows (first column as identity) |\n| Markdown | `.md` `.mdx` | heading-based sections |\n\nEverything else falls back to chunk-based diffing.\n\n### Custom extensions and extensionless files\n\nFor files with non-standard extensions, create a `.semrc` in your project root:\n\n```\n.xyz = cpp\n.j = json\n.mypy = python\n```\n\nsem also reads `.gitattributes` patterns (`diff=` and `linguist-language=`) if you already have those set up. `.semrc` takes priority when both define the same extension.\n\nFor files with no extension at all, sem detects the language automatically from content (imports, declarations, shebang lines, vim modelines). This covers 19 languages with no config needed.\n\n## How matching works\n\nThree-phase entity matching:\n\n1. **Exact ID match** — same entity in before/after = modified or unchanged\n2. **Structural hash match** — same AST structure, different name = renamed or moved (ignores whitespace/comments)\n3. **Fuzzy similarity** — \u003e80% token overlap = probable rename\n\nThis means sem detects renames and moves, not just additions and deletions. Structural hashing also distinguishes cosmetic changes (whitespace, formatting) from real logic changes.\n\n## MCP Server\n\nsem includes an MCP server with 6 tools for AI agents: `sem_entities`, `sem_diff`, `sem_blame`, `sem_impact`, `sem_log`, `sem_context`. These mirror the CLI commands exactly.\n\n```json\n{\n  \"mcpServers\": {\n    \"sem\": {\n      \"command\": \"sem-mcp\"\n    }\n  }\n}\n```\n\nInstall the MCP binary:\n\n```bash\ncd sem/crates\ncargo install --path sem-mcp\n```\n\n## JSON output\n\n```bash\nsem diff --format json\n```\n\n```json\n{\n  \"summary\": {\n    \"fileCount\": 2,\n    \"added\": 1,\n    \"modified\": 1,\n    \"deleted\": 1,\n    \"total\": 3\n  },\n  \"changes\": [\n    {\n      \"entityId\": \"src/auth.ts::function::validateToken\",\n      \"changeType\": \"added\",\n      \"entityType\": \"function\",\n      \"entityName\": \"validateToken\",\n      \"filePath\": \"src/auth.ts\"\n    }\n  ]\n}\n```\n\n## As a library\n\nsem-core can be used as a Rust library dependency:\n\n```toml\n[dependencies]\nsem-core = { git = \"https://github.com/Ataraxy-Labs/sem\", version = \"0.5\" }\n```\n\nUsed by [weave](https://github.com/Ataraxy-Labs/weave) (semantic merge driver) and [inspect](https://github.com/Ataraxy-Labs/inspect) (entity-level code review).\n\n## Architecture\n\n- **tree-sitter** for code parsing (native Rust, not WASM)\n- **git2** for Git operations\n- **rayon** for parallel file processing\n- **xxhash** for structural hashing\n- Plugin system for adding new languages and formats\n\n## Contributing\n\nWant to add a new language? See [CONTRIBUTING.md](CONTRIBUTING.md) for a step-by-step guide.\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=Ataraxy-Labs/sem\u0026type=Date)](https://star-history.com/#Ataraxy-Labs/sem\u0026Date)\n\n## License\n\nMIT OR Apache-2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fataraxy-labs%2Fsem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fataraxy-labs%2Fsem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fataraxy-labs%2Fsem/lists"}