sem: A new code understanding primitive tool at a semantic granularity

Lobsters Hottest Tools

Summary

sem is a CLI tool that provides semantic understanding of code changes on top of Git, offering entity-level diffs, blame, impact analysis, and more across 26 languages. It aims to improve code review and AI-assisted development.

<p><a href="https://lobste.rs/s/j8kqth/sem_new_code_understanding_primitive">Comments</a></p>
Original Article
View Cached Full Text

Cached at: 07/03/26, 10:28 PM

# sem Source: [https://ataraxy-labs.github.io/sem/](https://ataraxy-labs.github.io/sem/) ## Know what changed\. Semantic understanding on top of Git\. Diff, blame, impact, log\. Functions, not lines\. copied$brew install sem\-cli ## Same commit\. Different lens\. Left: what git shows you\. Right: what actually happened\. git diff ``` diff --git a/src/auth/login.ts b/src/auth/login.ts index 4a2b1c0..8f3d2e1 100644 --- a/src/auth/login.ts +++ b/src/auth/login.ts @@ -12,6 +12,18 @@ +export function validateToken(token: string) { + const decoded = jwt.verify(token, SECRET); + if (!decoded.exp || decoded.exp < Date.now()) { + throw new TokenExpiredError(); + } + return decoded; +} + @@ -24,8 +36,10 @@ export async function authenticateUser( - const user = await db.findUser(email); - if (!user) return null; + const user = await db.findUser(email); + if (!user) throw new UserNotFoundError(); + await rateLimiter.check(email); @@ -45,12 +59,0 @@ -export function legacyAuth(user, pass) { - return db.query('SELECT * FROM users - WHERE email = ? AND password = ?', - [user, pass]); -} ``` sem diff ``` ┌─ src/auth/login.ts ──────────────── │ │ ⊕ function validateToken [added] │ ∆ function authenticateUser [modified] │ ⊖ function legacyAuth [deleted] │ └──────────────────────────────────── 3 entities changed across 1 file ``` AI agents are2\.3x more accuratewhen given sem output vs raw line diffs\.[See the benchmark\.](https://ataraxy-labs.github.io/sem/agents.html) ## Six commands\. One binary\. Everything works in any Git repo\. No config\. No plugins\. `sem diff` What changed? Entity\-level diffs with rename detection, structural hashing, and word\-level inline highlights\. ``` │ ⊕ function validateToken [added] │ ∆ function authenticateUser [modified] │ ⊖ function legacyAuth [deleted] ``` `sem blame` Who changed it? Per\-entity blame showing the last commit that touched each function, class, or method\. ``` │ ⊕ render_inline_diff a1a6fbf Rohan 04-03 │ ⊕ format_terminal a1a6fbf Rohan 04-03 ``` `sem impact` What breaks? Cross\-file dependency graph shows every entity that depends on a given function, plus affected tests\. ``` ⊕ function authenticateUser → depends on: db.findUser, rateLimiter ← used by: loginRoute, authMiddleware ! 42 entities transitively affected ``` `sem log` How did it evolve? Git history for a single entity\. See every commit that touched a specific function\. ``` │ ae576ab Rohan 02-05 added │ a105183 Rohan 02-08 modified (logic) │ a1a6fbf Rohan 04-03 modified (logic) ``` `sem entities` What's under a path? Lists every function, class, method, and type with line ranges\. ``` entities: src/auth/login.ts function validateToken (L12:24) function authenticateUser (L26:45) interface AuthConfig (L47:52) ``` `sem context` Smart context for AI\. Token\-budgeted context window: the entity, its dependencies, and dependents\. Fits in any LLM prompt\. ``` context for authenticateUser (budget: 8000) target: ~705 tokens dependencies: ~256 tokens dependents: ~812 tokens ``` All commands support`\-\-json`for machine\-readable output\.[Full reference\.](https://ataraxy-labs.github.io/sem/details.html) ## Your stack\. Covered\. 26 languages\. 5 data formats\. One binary\. TypeScript JavaScript Python Go Rust Java C C\+\+ C\# Ruby PHP Swift Kotlin Elixir Bash HCL Fortran Vue Svelte XML ERB Dart Perl OCaml Scala Zig JSON YAML TOML CSV Markdown 8mstypical diff 26languages 0config needed 4,000\+downloads ## Try it\. 10 seconds\. ``` $ brew install sem-cli $ sem setup ✓ Created wrapper script ✓ Set git config --global diff.external = sem ✓ Pre-commit hook installed Done! Running git diff in any repo will now use sem. To revert, run: sem unsetup ``` One command\. Every`git diff`becomes a`sem diff`\. No config files\. Also:cargo install \-\-git https://github\.com/Ataraxy\-Labs/sem sem\-cli

Similar Articles

@aigclink: An Agent-oriented code search tool: Semble. It uses natural language to search codebases and returns precise code snippets, saving 98% token consumption compared to grep+read. The method lets Agents use natural language to directly locate the most relevant lines of code, without guessing keywords or reading entire files. Speed: indexing a typical…

X AI KOLs Timeline

Semble is an Agent-oriented code search tool that supports natural language queries, accurately returns semantically complete code snippets, saves 98% token consumption compared to traditional grep+read methods, and features intelligent chunking, dual-path retrieval, and code-aware re-ranking.