Configuration Reference

Complete guide to configuring LFG through .lfg/config.yml and environment variables.

Configuration File Location

LFG stores its configuration in .lfg/config.yml in your repository root. This file is automatically created when you run lfg --init.

your-project/
├── .lfg/
│ ├── config.yml # Main configuration
│ ├── .env # API keys (optional)
│ ├── decisions.json # User decisions cache
│ ├── reviewers.json # GitHub reviewers cache
│ ├── pre-run.sh # Pre-commit hook
│ └── post-run.sh # Post-commit hook
└── .gitignore # Should include .lfg/

Basic Configuration

base_branch

Default base branch for pull requests

string
Default: main

protected_branches

Branches that require confirmation before pushing

array
Default: ["main", "develop"]

AI Configuration

ai.provider

AI provider to use (claude, openai, gemini, system)

string
Default: claude

ai.method

How to call the AI (cli, api, system)

string
Default: cli

ai.model

Specific model to use (optional for some providers)

string
Default: ""

ai.timeout

Timeout in seconds for AI requests

integer
Default: 30

ai.max_prompt_chars

Maximum characters to send to AI

integer
Default: 90000

ai.chunk_size

Size of chunks when splitting large diffs

integer
Default: 28000

ai.validate_on_change

Validate AI responses for quality

boolean
Default: true

Commit Message Formatting

prompt.bullet_style

Style for bullet points in commit messages

string
Default: -

prompt.max_bullets

Maximum number of bullet points

integer
Default: 10

prompt.subject_limit

Character limit for commit subject line

integer
Default: 72

Behavior Settings

behavior.confirm_on_protected

Ask for confirmation when pushing to protected branches

boolean
Default: true

behavior.normalize_bullets

Normalize bullet point formatting

boolean
Default: true

behavior.normalize_newlines

Normalize newlines in commit messages

boolean
Default: true

behavior.require_signed_commits

Enforce signed commits

boolean
Default: true

behavior.require_dco

Enforce Developer Certificate of Origin

boolean
Default: true

Safety Guards

guards.large_file_bytes

Maximum file size in bytes (10MB default)

integer
Default: 10485760

guards.pr_size_warn_lines

Warn when PR exceeds this many lines

integer
Default: 800

guards.pr_size_label

Label to apply to large PRs

string
Default: needs-splitting

Example Configuration

.lfg/config.yml
# Basic settings
base_branch: main
protected_branches: [main, develop, production]

# Commit message formatting
prompt:
  bullet_style: "-"
  max_bullets: 8
  subject_limit: 72

# AI configuration
ai:
  provider: "claude"
  method: "api"
  model: "claude-3-sonnet-20240229"
  timeout: 45
  max_prompt_chars: 90000
  chunk_size: 28000
  validate_on_change: true
  fallbacks:
    minimal_diff: true
    stats_mode: true
  offline_template:
    subject: "Update changes"
    bullets: 
      - "Describe behavior change"
      - "Note tests/risks"
      - "Config/migrations if any"

# GitHub integration
gh:
  enabled: true
  interactive_reviewers: true
  draft_by_default: false
  default_assignee: "self"
  labels: ["needs-review"]
  team_reviewers: ["org/backend", "org/frontend"]

# Hooks
hooks:
  pre: .lfg/pre-run.sh
  post: .lfg/post-run.sh

# Behavior settings
behavior:
  confirm_on_protected: true
  normalize_bullets: true
  normalize_newlines: true
  require_signed_commits: true
  require_dco: true

# Safety guards
guards:
  large_file_bytes: 10485760  # 10MB
  pr_size_warn_lines: 800
  pr_size_label: "needs-splitting"

Environment Variables

Store sensitive information like API keys in .lfg/.env:

.lfg/.env
# Anthropic Claude
ANTHROPIC_API_KEY=your_claude_api_key_here

# OpenAI
OPENAI_API_KEY=your_openai_api_key_here

# Google Gemini
GEMINI_API_KEY=your_gemini_api_key_here

# GitHub (usually handled by gh CLI)
GITHUB_TOKEN=your_github_token_here

Security Note

The .lfg/.env file should be kept private and never committed to version control. Make sure .lfg/ is in your .gitignore file.

Configuration Tips

Team Configuration

Set up default reviewers and labels for consistent team workflows

gh.team_reviewers: ['org/backend'] and gh.labels: ['needs-review', 'backend']

AI Optimization

Adjust chunk_size and max_prompt_chars based on your typical diff sizes

Larger projects may need chunk_size: 35000 and max_prompt_chars: 120000

Security Settings

Enable signed commits and DCO for compliance requirements

behavior.require_signed_commits: true and behavior.require_dco: true

Branch Protection

Customize protected branches based on your Git flow

protected_branches: [main, develop, staging, production]

File Size Limits

Adjust large file detection based on your project needs

guards.large_file_bytes: 5242880 for 5MB limit