Commit Analysis
Commit analysis is the heart of ShipLens. Each commit is understood in the context of your project — not just counted or measured by lines of code.
The Three-Tier System
Every commit goes through deterministic triage first, then gets analyzed at the appropriate depth.
Triage Rules
Triage is pure logic — no LLM calls, no cost. It examines the commit metadata and assigns a depth level:
| Rule | Condition | Depth |
|---|---|---|
| Empty merge | num_parents > 1 and no files changed | shallow |
| CI/CD only | All files in .github/, .circleci/, or .gitlab-ci.yml | shallow |
| Docs only | All files are .md and commit type is docs or chore | shallow |
| Security | Commit message contains "security", "vulnerability", or "cve" | deep |
| Default | Everything else | standard |
Rules are evaluated in order. The first match wins.
Shallow Analysis
Cost: $0.00 — No LLM call.
Shallow commits get a triage-level report directly from the metadata. This covers merge commits, CI configuration changes, and documentation updates — commits where LLM analysis would add little value.
Standard Analysis
Cost: ~$0.001–0.003 — Uses Claude Haiku.
The standard analysis path:
Build context — Gather project context from the vector store (capped at 2,000 characters) to ground the LLM in your project's architecture and conventions.
Compress diff — Intelligently compress the commit diff to fit within the context window while preserving the most informative parts.
Structured prompt — Send a prompt requesting a JSON response with specific fields: commit type, summary, areas affected, complexity, impact, quality signals, risk signals, and slop dimensions.
Parse response — Extract the structured analysis report from the LLM response.
Deep Analysis
Cost: ~$0.01–0.50 — Uses Claude Sonnet with agentic tools.
Deep analysis is reserved for commits that warrant thorough investigation (security changes, or manually flagged commits). The LLM gets access to four codebase tools:
| Tool | Purpose |
|---|---|
read_file | Read any file in the repository |
search_codebase | Search for patterns across the codebase |
list_directory | Explore directory structure |
get_file_at_commit | Read a file as it was before the commit |
The LLM can make up to 10 tool calls in an agentic loop, with a cost cap of $0.50 per commit. This allows it to:
- Read files before and after the commit
- Search for related code patterns
- Understand the broader impact of changes
- Trace dependencies and side effects
What Gets Extracted
Every commit analysis produces a Commit Report with these fields:
Core Fields
| Field | Type | Description |
|---|---|---|
commit_type | enum | feat, fix, refactor, test, docs, chore, style, perf |
summary | string | Human-readable summary of what the commit does |
areas_affected | list | Domains/areas of the codebase touched |
complexity | 1–5 | How complex is the change itself? |
impact | 1–5 | How much does this change affect the system? |
confidence | float | LLM's confidence in its own assessment |
Quality Signals
Boolean indicators that the commit demonstrates good engineering practices:
has_tests— Commit includes test coveragegood_error_handling— Proper error handling patternsclean_patterns— Code follows clean architecture principlesreduces_tech_debt— Actively reduces technical debtgood_documentation— Includes meaningful documentation
Risk Signals
Boolean indicators that the commit touches sensitive areas:
touches_auth— Changes authentication or authorization codetouches_payments— Changes payment processing logicmodifies_data_model— Alters database schema or data structurescross_module_change— Spans multiple modules or bounded contextsproduction_hotfix— Deployed as an emergency fix
Additional Indicators
| Indicator | Description |
|---|---|
files_changed | Count of files modified |
lines_added / lines_removed | Lines of code changed |
new_modules_created | Count of new files added |
touches_core_system | Whether core system areas are affected |
introduces_new_pattern | Whether a new architectural pattern is introduced |
has_migration | Whether database migrations are included |
dependencies_changed | Whether project dependencies were modified |
domain_criticality | Criticality level of affected domains |
Commit Type Detection
Commit types are detected from the commit message using conventional commit format:
feat: add user authentication
fix: resolve null pointer in payment flow
refactor: extract validation logic into moduleSupported prefixes: feat, fix, refactor, test, docs, style, perf, chore.
If no conventional commit prefix is found, the type defaults to chore.
Cost Efficiency
The triage-first approach significantly reduces analysis costs:
| Depth | Model | Typical Cost | % of Commits |
|---|---|---|---|
| Shallow | None | $0.000 | ~20–30% |
| Standard | Haiku | $0.001–0.003 | ~65–75% |
| Deep | Sonnet (agentic) | $0.01–0.50 | ~1–5% |
For a team of 10 engineers producing ~500 commits/week, the typical weekly analysis cost is $0.50–2.00.
