Skip to content

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:

RuleConditionDepth
Empty mergenum_parents > 1 and no files changedshallow
CI/CD onlyAll files in .github/, .circleci/, or .gitlab-ci.ymlshallow
Docs onlyAll files are .md and commit type is docs or choreshallow
SecurityCommit message contains "security", "vulnerability", or "cve"deep
DefaultEverything elsestandard

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:

  1. 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.

  2. Compress diff — Intelligently compress the commit diff to fit within the context window while preserving the most informative parts.

  3. 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.

  4. 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:

ToolPurpose
read_fileRead any file in the repository
search_codebaseSearch for patterns across the codebase
list_directoryExplore directory structure
get_file_at_commitRead 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

FieldTypeDescription
commit_typeenumfeat, fix, refactor, test, docs, chore, style, perf
summarystringHuman-readable summary of what the commit does
areas_affectedlistDomains/areas of the codebase touched
complexity1–5How complex is the change itself?
impact1–5How much does this change affect the system?
confidencefloatLLM's confidence in its own assessment

Quality Signals

Boolean indicators that the commit demonstrates good engineering practices:

  • has_tests — Commit includes test coverage
  • good_error_handling — Proper error handling patterns
  • clean_patterns — Code follows clean architecture principles
  • reduces_tech_debt — Actively reduces technical debt
  • good_documentation — Includes meaningful documentation

Risk Signals

Boolean indicators that the commit touches sensitive areas:

  • touches_auth — Changes authentication or authorization code
  • touches_payments — Changes payment processing logic
  • modifies_data_model — Alters database schema or data structures
  • cross_module_change — Spans multiple modules or bounded contexts
  • production_hotfix — Deployed as an emergency fix

Additional Indicators

IndicatorDescription
files_changedCount of files modified
lines_added / lines_removedLines of code changed
new_modules_createdCount of new files added
touches_core_systemWhether core system areas are affected
introduces_new_patternWhether a new architectural pattern is introduced
has_migrationWhether database migrations are included
dependencies_changedWhether project dependencies were modified
domain_criticalityCriticality 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 module

Supported 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:

DepthModelTypical Cost% of Commits
ShallowNone$0.000~20–30%
StandardHaiku$0.001–0.003~65–75%
DeepSonnet (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.

Built with intelligence, not surveillance.