
Sem Integration
Detect or install the sem semantic-diff CLI on first use so reviews get entity-level diffs instead of noisy line-level git output.
Overview
sem-integration is an agent skill for the Ship phase that detects or installs the sem CLI so code review can use entity-level semantic diffs instead of line-level git diffs.
Install
npx skills add https://github.com/athola/claude-night-market --skill sem-integrationWhat is this skill?
- Session cache at `$CLAUDE_CODE_TMPDIR/sem-available` to avoid repeated detection
- Install-on-first-use with cargo, Homebrew search fallback, and Linux binary download paths
- Prompt template when sem is missing so the user can install or skip to standard git diff
- Entity-level semantic diffs via sem-cli instead of line-level diffs
- Session cache path: `$CLAUDE_CODE_TMPDIR/sem-available`
- Estimated_tokens: 250 in skill frontmatter
Adoption & trust: 1 installs on skills.sh; 304 GitHub stars; 1/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
What problem does it solve?
Git line diffs hide structural changes and your agent keeps asking you to install sem manually mid-review.
Who is it for?
Agents doing PR review or refactor summaries on Rust-friendly machines where one-time sem install is acceptable.
Skip if: Environments that forbid shell installs or curl downloads during agent sessions.
When should I use this skill?
The agent needs sem for semantic diffs and sem may not be installed yet.
What do I get? / Deliverables
sem is detected or installed once per session with a clear skip path, enabling semantic diffs—or standard git diff if you opt out.
- sem CLI available on PATH or explicit user skip to git diff
- Prompted install choice with platform-specific commands
Recommended Skills
Journey fit
Canonical shelf is Ship → review because the skill exists to improve diff quality during code review and change understanding. sem-integration is about semantic diffs at review time, not general package wiring in Build integrations.
How it compares
Integration wrapper for sem-cli—not a replacement for git diff or full static-analysis review suites.
Common Questions / FAQ
Who is sem-integration for?
Solo developers using Claude Code-style agents who want semantic diffs during review without hand-maintaining sem in every project.
When should I use sem-integration?
During Ship review when comparing branches or summarizing changes and entity-level diffs would clarify refactors versus churn.
Is sem-integration safe to install?
It may run shell installs and download binaries from GitHub releases; review the Security Audits panel on this page and trust the sem-cli source before allowing network installs.
SKILL.md
READMESKILL.md - Sem Integration
# sem Detection and Installation ## Detection Logic 1. Check session cache at `$CLAUDE_CODE_TMPDIR/sem-available` 2. If cache exists, use cached value 3. If no cache, run `command -v sem` 4. Write result to cache ## Install-on-First-Use When sem is not detected, present installation options in priority order: **Rust toolchain (preferred, works on all platforms):** ```bash cargo install --locked sem-cli ``` **macOS (Homebrew, if formula exists):** ```bash brew search sem-cli && brew install sem-cli ``` Note: the Homebrew formula may not exist. If `brew search` returns no results, fall back to `cargo install` above. **Linux (binary download):** ```bash mkdir -p ~/.local/bin && curl -fsSL https://github.com/Ataraxy-Labs/sem/releases/latest/download/sem-x86_64-unknown-linux-gnu -o ~/.local/bin/sem && chmod +x ~/.local/bin/sem ``` ## Prompt Template When sem is missing, say: > sem (semantic diff tool) can provide entity-level diffs > instead of line-level diffs. Install it? > > - `cargo install --locked sem-cli` (any platform with Rust) > - `brew install sem-cli` (macOS, if formula available) > - Linux binary: `mkdir -p ~/.local/bin && curl -fsSL > https://github.com/Ataraxy-Labs/sem/releases/latest/download/sem-x86_64-unknown-linux-gnu > -o ~/.local/bin/sem && chmod +x ~/.local/bin/sem` > - Or skip to use standard git diff If the user declines, write `0` to the cache and proceed with fallback for the rest of the session. ## Cache Invalidation The cache file is in `$CLAUDE_CODE_TMPDIR` which is per-session. No explicit invalidation needed: each new Claude Code session starts fresh. --- name: fallback description: Output normalization for git diff fallback path parent_skill: leyline:sem-integration estimated_tokens: 250 --- # Fallback Output Normalization When sem is unavailable, produce entity-like output from standard git commands. ## Entity Schema sem produces raw output with these fields: ```json { "entityId": "module::Class.method", "entityType": "function|class|method", "entityName": "method", "changeType": "added|modified|deleted|renamed", "filePath": "path/to/file.py" } ``` The normalization layer maps these to a common schema used by consumer skills: ```json { "name": "entity_or_filename", "kind": "function|class|file", "change_type": "added|modified|deleted|renamed", "file": "path/to/file.py" } ``` Mapping: `entityName` to `name`, `entityType` to `kind`, `changeType` to `change_type`, `filePath` to `file`. Fallback uses `file` as the kind since git diff operates at file level. ## Fallback Commands ```bash # Collect changes by type added=$(git diff --name-only --diff-filter=A <baseline>) modified=$(git diff --name-only --diff-filter=M <baseline>) deleted=$(git diff --name-only --diff-filter=D <baseline>) renamed=$(git diff --name-only --diff-filter=R <baseline>) ``` ## Entity Extraction from Diff Hunks For richer fallback (optional), parse diff hunks for function/class definitions: ```bash # Extract added functions from diff (includes async def) git diff <baseline> | grep -E '^\+(async )?def |^\+class ' | \ sed 's/^+//' | sed 's/(.*//' ``` This gives function-level granularity without sem, though it misses renames, decorated definitions, and cross-file dependencies. ## Impact Fallback When `sem impact` is unavailable, trace callers with rg: ```bash # For each changed file, find importers git diff --name-only HEAD | while read f; do module=$(basename "$f" .py) if command -v rg &>/dev/null; then rg -l "import.*$module|from.*$module" --type py . else grep -rl "import.*$module\|from.*$module" \ --include="*.py" . fi done | sort -u ``` --- name: sem-integration description: Provides sem semantic-diff detection, install-on-first-use, and fallback patterns. Use when building skills that consume git diff out