Configuration

Configure Codehabits analysis parameters, exclusions, and behavior through the config file, dashboard settings, or environment variables.

Configuration file

When you run codehabits enable, a configuration file is created at .codehabits/config.json. This file is committed to your repository and controls how analysis behaves.

.codehabits/config.json
{
  "version": "1.0.0",
  "analysis": {
    "lookback_months": 12,
    "min_prs_for_pattern": 10,
    "min_confidence": 0.7,
    "include_closed_prs": true
  },
  "ignore": {
    "files": [],
    "authors": ["dependabot[bot]", "renovate[bot]"],
    "labels": ["wip", "draft"]
  },
  "sync": {
    "auto_commit": false
  },
  "custom_rules": []
}

Analysis settings

SettingTypeDefaultDescription
lookback_monthsnumber12How many months of PR history to analyze. Longer lookback means more data but slower analysis.
min_prs_for_patternnumber10Minimum number of PRs required before a convention is reported. Prevents premature pattern detection.
min_confidencenumber0.7Minimum confidence score (0.0–1.0) for a convention to be included. Lower values include more uncertain patterns.
include_closed_prsbooleantrueWhether to analyze closed (not merged) PRs. Useful for anti-pattern detection from rejected PRs.

ℹDashboard vs config file

Settings can be modified in both the .codehabits/config.json file and the web dashboard settings page. The dashboard settings are stored server-side and used when the cloud pipeline runs. The local config file is used by CLI commands like codehabits check.

Exclusions

File patterns

Specify file patterns to exclude from analysis. These files won't be scanned and won't affect convention detection.

Default ignored patterns
node_modules/
dist/
.next/
coverage/
*.min.js

In the dashboard settings, enter one pattern per line. In the config file, use the ignore.files array.

Ignored authors

PR comments from these authors are excluded from analysis. This prevents bot-generated content from affecting pattern detection.

Default ignored authors
dependabot[bot]
renovate[bot]

Ignored labels

PRs with these labels are excluded from analysis. Useful for filtering out work-in-progress or draft PRs.

Default ignored labels
wip
draft

Dashboard settings

The web dashboard provides a settings page for each repository at /repo/[id]/settings. These settings are persisted server-side and used during cloud analysis.

SettingDefaultDescription
Auto-sync on PR mergeOffEnable automatic intelligence updates via GitHub Action
Include closed PRsOnAnalyze closed (not merged) PRs for anti-pattern detection
Lookback period12 monthsPR history lookback window
Minimum confidence70%Convention filtering threshold
Min PRs for pattern10Minimum evidence before reporting
Domain knowledge extractionOnBuild knowledge graph from PR discussions
Reviewer expertise trackingOnMap reviewers to expertise areas
Ignored file patternsnode_modules/, dist/, ...Files excluded from codebase scanning
Ignored authorsdependabot[bot], renovate[bot]Authors excluded from PR analysis

Environment variables

VariableDescription
CODEHABITS_TOKENAPI token for CI/CD authentication. Takes precedence over stored CLI credentials.
GITHUB_TOKENGitHub personal access token for PR fetching. Required in CI for private repos.
CODEHABITS_API_URLOverride the codehabits API base URL. Default: https://codehabits.dev. Useful for self-hosted or development.
CODEHABITS_TELEMETRY_DISABLEDSet to 1 to disable CLI and MCP usage telemetry.
DO_NOT_TRACKStandard opt-out for telemetry. Set to 1 to disable.
CODEHABITS_POSTHOG_KEYOptional PostHog write-key override. A public project key is used by default.

Telemetry

codehabits collects usage telemetry via PostHog to understand how the CLI and MCP server are used and improve the product. No source code or intelligence content is ever collected. When you are logged in, events use the same user id as the dashboard. Telemetry events include:

  • CLI command usage (which commands are run)
  • Success/failure counts
  • Convention and PR counts (numeric only)
  • MCP tool name, duration, and error state (not arguments or results)
  • Platform, OS, and Node.js version

The MCP server makes a network call for telemetry only. To opt out of both CLI and MCP telemetry, set CODEHABITS_TELEMETRY_DISABLED=1 or DO_NOT_TRACK=1 in your environment.

Plans and limits

FeatureFreeTeam
Public repositoriesUnlimitedUnlimited
Private repositories1Unlimited
PR lookback100 PRsUnlimited
AI modelDeepSeek V4 FlashDeepSeek V4 Flash
Team management-Included
Usage analyticsBasicFull