No description
Find a file
Lilith 91b3b3979a chore(@ml/auto-commit-service): 📦 bump version to 0.1.1
- Fix CRASHED status handling to attempt recovery instead of giving up
- Daemon now auto-starts llama-service after reboot when stale PID detected
2026-01-09 11:08:18 -08:00
.forgejo/workflows fix(README): update README.md for new commit hash format 2026-01-05 18:00:18 -08:00
src/auto_commit_service 🔧 Update files 2026-01-09 10:49:26 -08:00
tests Add new files 2026-01-05 18:41:40 -08:00
pyproject.toml chore(@ml/auto-commit-service): 📦 bump version to 0.1.1 2026-01-09 11:08:18 -08:00
README.md Add new files 2026-01-05 18:41:40 -08:00

Auto-Commit Service

Automated commit message generation service using local LLM inference. Commits and pushes changes across lilith-platform repos every 15 minutes.

Features

  • Generates commit messages using llama-service (local 3B model)
  • Processes multiple repositories in a cycle
  • Automatic push with conflict resolution
  • Claude Code fallback for complex failures
  • FastAPI endpoints for monitoring and manual triggers

Installation

# Install the package
cd /var/home/lilith/Code/@packages/@ml/auto-commit-service
pip install -e .

# Or with model-boss integration (recommended)
pip install -e ".[model-boss]"

# Or with dev dependencies
pip install -e ".[dev]"

Model Configuration

The service requires a language model to generate commit messages. You have three options:

  1. Auto-load via model-boss (recommended):

    pip install -e ".[model-boss]"
    # Models will be auto-downloaded and cached
    # Default: ministral-3b-instruct
    
  2. Manual model path:

    export LLAMA_SERVICE_MODEL_PATH=/path/to/model.gguf
    
  3. Disable auto-start (use external llama-service):

    export AUTO_COMMIT_LLAMA_SERVICE_AUTOSTART=false
    

Important: If no model is configured, the service will fail to start and report as down. This prevents making commits with placeholder messages.

Configuration

Environment variables (prefix: AUTO_COMMIT_):

Variable Default Description
AUTO_COMMIT_LLAMA_SERVICE_URL http://localhost:8000 llama-service URL
AUTO_COMMIT_LLAMA_SERVICE_AUTOSTART true Auto-start llama-service if down
AUTO_COMMIT_LLAMA_MODEL_ID deepseek-r1-70b Model ID for model-boss
AUTO_COMMIT_USE_MODEL_BOSS true Use model-boss for model loading
AUTO_COMMIT_CYCLE_INTERVAL_SECONDS 900 Seconds between cycles (15 min)
AUTO_COMMIT_ENABLED true Enable daemon on startup
AUTO_COMMIT_CLAUDE_FALLBACK_ENABLED true Enable Claude Code recovery
AUTO_COMMIT_HOST 0.0.0.0 Service host
AUTO_COMMIT_PORT 8200 Service port

Usage

Run directly

python -m auto_commit_service

Run with uvicorn

uvicorn auto_commit_service:create_auto_commit_service --host 0.0.0.0 --port 8200

As systemd service

# Copy service file
sudo cp infrastructure/systemd/auto-commit.service /etc/systemd/system/

# Create environment file
sudo mkdir -p /opt/auto-commit
sudo tee /opt/auto-commit/.env << EOF
AUTO_COMMIT_LLAMA_SERVICE_URL=http://localhost:8000
AUTO_COMMIT_CYCLE_INTERVAL_SECONDS=900
EOF

# Enable and start
sudo systemctl daemon-reload
sudo systemctl enable auto-commit
sudo systemctl start auto-commit

API Endpoints

Endpoint Method Description
/health GET Service health check
/status GET Daemon status and last cycle
/trigger POST Manually trigger a cycle
/enable POST Enable the daemon
/disable POST Disable the daemon
/repos GET List configured repositories

Examples

# Check health
curl http://localhost:8200/health

# Get status
curl http://localhost:8200/status

# Trigger manual cycle
curl -X POST http://localhost:8200/trigger

# Disable daemon
curl -X POST http://localhost:8200/disable

Commit Style

Generated commits follow the Lilith Platform convention:

  • feat: New feature
  • 🔧 chore: Maintenance, config changes
  • ♻️ refactor: Code restructuring
  • 🐛 fix: Bug fix
  • 📝 docs: Documentation
  • test: Tests
  • 🔥 remove: Removing code/files

Error Handling

  1. No model configured: Service fails to start, reported as down (prevents bad commits)
  2. Push rejected: Attempts git pull --rebase and retries
  3. Merge conflict: Invokes Claude Code to resolve
  4. Hook failure: Invokes Claude Code to fix
  5. LLM unavailable: Service auto-starts if configured, otherwise skips cycle
  6. Infrastructure errors (network, auth): Skips Claude recovery, reports error
  7. Auth failure: Skips repo (requires manual fix)

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run tests with coverage
pytest --cov=auto_commit_service

Architecture

auto_commit_service/
├── app.py              # FastAPI application factory
├── config.py           # Settings (AutoCommitSettings)
├── models.py           # Pydantic models
├── git/
│   ├── operations.py   # Async git commands
│   ├── repository.py   # Repository abstraction
│   └── diff_parser.py  # Diff summarization
├── llm/
│   ├── client.py       # llama-service HTTP client
│   └── prompts.py      # Commit message prompts
├── scheduler/
│   ├── daemon.py       # Main 900s loop
│   └── processor.py    # Per-repo commit logic
└── recovery/
    ├── handlers.py     # Error type routing
    └── claude_fallback.py  # Claude Code invocation

Dependencies

  • lilith-ml-service-base: FastAPI patterns, lifespan, health checks
  • httpx: Async HTTP client for llama-service
  • pydantic: Configuration and models
  • uvicorn: ASGI server

Test update Mon Jan 5 12:27:47 PST 2026

Test change Mon Jan 5 12:43:01 PST 2026

Test commit hash persistence

Test change Mon Jan 5 15:22:57 PST 2026 Test commit 1767655644

Test Mon Jan 5 17:56:42 PST 2026