codecontext incident

Analyze code changes around production incidents

The incident command helps you quickly identify code changes that might have caused production issues. It uses natural language time parsing and intelligent change analysis to pinpoint potential culprits.

Natural Time Parsing

"since 2 hours ago", "last Friday", "after 3pm yesterday"

Smart Analysis

Ranks changes by likelihood of causing the issue

Root Cause Fast

Find problematic changes in seconds, not hours

$ codecontext incident "login failures since 2 hours ago"

Interactive Demo

Terminal

Natural Language Time Parsing

CodeContext understands natural language time expressions. Here are some examples:

Relative Time

"since 2 hours ago"
"in the last 30 minutes"
"after yesterday 3pm"
"since last Friday"

Specific Dates

"after January 15th 2pm"
"between 9am and 11am today"
"since Monday morning"
"during the weekend"

Options

--files, -f

Filter to specific file patterns

$ codecontext incident "errors today" --files "*.js"

--author, -a

Filter by commit author

$ codecontext incident "since 3pm" --author "john"

--limit, -l

Limit number of changes shown (default: 10)

$ codecontext incident "last hour" --limit 5

How It Works

1

Parse Time Expression

Converts natural language like "since 2 hours ago" to timestamps

2

Analyze Git History

Finds all code changes in the specified time range

3

Rank by Impact

Uses AI to assess likelihood each change caused the issue

4

Provide Context

Shows what changed, who changed it, and why it might be the culprit

Common Incident Queries

Performance Degradation

codecontext incident "slow API responses since this morning"

Feature Broken

codecontext incident "payment processing errors after 2pm deploy"

Integration Issues

codecontext incident "webhook failures in the last hour" --files "src/webhooks/*"

Database Problems

codecontext incident "connection timeout errors since yesterday" --files "*.sql,**/db/*"

Pro Features

Advanced Incident Analysis

Pro users get enhanced incident analysis capabilities:

  • • Cross-repository incident correlation
  • • Deployment tracking integration
  • • Team notification when likely cause found
  • • Historical incident pattern detection
  • • Integration with monitoring tools

Best Practices

Be specific about timing

The more precise your time range, the better the results. "After 3:15pm" is better than "this afternoon".

Include error context

Mention specific errors or symptoms: "login 401 errors" helps identify auth-related changes.

Check deployment times

Correlate incident timing with deployment schedules for faster root cause identification.

See Also

);