
Sem Integration
- 80 installs
- 325 repo stars
- Updated August 2, 2026
- athola/claude-night-market
sem-integration is an agent skill that detects or installs the sem CLI so code review can use entity-level semantic diffs instead of line-level git diffs.
About
sem-integration is a small agent skill slice for Claude Night Market / Leyline that ensures the sem semantic diff CLI is available before your agent relies on it. Detection checks a session cache file, then falls back to `command -v sem`. If sem is missing, the agent offers prioritized install options: `cargo install --locked sem-cli` on any Rust toolchain, optional Homebrew on macOS when a formula exists, or a curl-based Linux binary into `~/.local/bin`. Users can decline and continue with ordinary git diffs. Solo builders who review large refactors install it to reduce diff noise—renames and moves read as semantic changes rather than delete/add line storms. It is an integration helper, not sem itself; you still need Rust or curl access for first-time setup.
- 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
Sem Integration by the numbers
- 80 all-time installs (skills.sh)
- Ranked #251 of 733 Git & Pull Requests skills by installs in the Skillselion catalog
- Security screen: HIGH risk (skills.sh audit)
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/athola/claude-night-market --skill sem-integrationAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 80 |
|---|---|
| repo stars | ★ 325 |
| Security audit | 1 / 3 scanners passed |
| Last updated | August 2, 2026 |
| Repository | athola/claude-night-market ↗ |
What it does
Detect or install the sem semantic-diff CLI on first use so reviews get entity-level diffs instead of noisy line-level git output.
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 you get
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
By the numbers
- Session cache path: `$CLAUDE_CODE_TMPDIR/sem-available`
- Estimated_tokens: 250 in skill frontmatter
Files
sem Integration
Foundation patterns for using sem semantic diffs in night-market skills.
When To Use
Consult this skill when building or modifying skills that consume git diff output. It provides the detection, installation, and fallback patterns.
When NOT To Use
- Direct sem CLI usage (just run
sem diffyourself) - Skills that don't consume diff output
Detection Pattern
Check sem availability once per session:
# Detection (cache per session)
_sem_check() {
local cache="${CLAUDE_CODE_TMPDIR:-/tmp}/sem-available"
if [ -f "$cache" ]; then
cat "$cache"
return
fi
if command -v sem &>/dev/null; then
echo "1" | tee "$cache"
else
echo "0" | tee "$cache"
fi
}When _sem_check returns 0, offer installation. See modules/detection.md for install-on-first-use logic and platform-specific commands.
Semantic Diff Pattern
Primary path (sem available):
sem diff --format json <baseline>Fallback path (sem unavailable):
git diff --name-only --diff-filter=A <baseline>
git diff --name-only --diff-filter=M <baseline>
git diff --name-only --diff-filter=D <baseline>
git diff --name-only --diff-filter=R <baseline>See modules/fallback.md for output normalization that produces the same entity schema from both paths.
Impact Analysis Pattern
Primary path (sem available):
sem impact --json <file-or-entity>Fallback path (sem unavailable): use rg/grep to trace callers by filename. See modules/fallback.md.
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):
cargo install --locked sem-climacOS (Homebrew, if formula exists):
brew search sem-cli && brew install sem-cliNote: the Homebrew formula may not exist. If brew search returns no results, fall back to cargo install above.
Linux (binary download):
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/semPrompt 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.
Fallback Output Normalization
When sem is unavailable, produce entity-like output from standard git commands.
Entity Schema
sem produces raw output with these fields:
{
"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:
{
"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
# 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:
# 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:
# 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 -uRelated skills
How it compares
Integration wrapper for sem-cli—not a replacement for git diff or full static-analysis review suites.
FAQ
Who is sem-integration for?
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.