Skip to main content
The longer a codebase grows without deliberate refactoring, the more expensive each new feature becomes. kode daemon addresses this by running silently in the background, polling your git history for code health signals — blast radius growth, circular dependencies, repeated anti-patterns — and creating speculative fixes on Ghost Branches before the debt becomes structural. You decide whether to merge the fix; the daemon handles the detection and generation.

How the daemon works

Starting the daemon

The daemon runs in the foreground and prints a brief header showing the detected repository, branch, and active configuration:
Keep the daemon running in a persistent terminal session (tmux, screen, or a background process manager) during active development.

All flags

Single-shot CI mode

Pass --once to run exactly one analysis cycle and exit. This mode does not require an API key — it performs the analysis phase only, without generating Ghost Branch fixes. It is designed to be used as a code-health gate in CI pipelines.
Kode writes a JSON analysis report to stdout and exits with code 0 if the codebase is clean or code 1 if issues were found:

Typical workflows

Development: persistent background watcher

Run the daemon alongside your normal development workflow in a dedicated terminal pane:
Increase --lag on repos with a high commit frequency to avoid analysis running on every trivial fix.

CI: code health gate

Add a kode daemon --once step to your pipeline to fail the build when blast radius growth exceeds your threshold:
The daemon works best on repositories with a consistent, incremental commit cadence — several small commits per day. If your team uses very large infrequent merge commits, increase --lag (e.g. --lag 1) so the daemon analyses each merge as soon as it lands rather than waiting for additional commits that may not come for days.
The full daemon (without --once) requires a valid KODE_LLM_API_KEY to generate Ghost Branch fixes. The --once analysis-only mode does not make any LLM calls and works without an API key.

Tuning the threshold

The --threshold flag controls how sensitive the daemon is. A lower value means more findings; a higher value means only severe growth is flagged.

Next steps

Loop Mode

Trigger the full pipeline manually for a specific task, with Ghost Branch exploration and automatic rollback.

MCP Integration

Expose Kode’s engine to Claude Desktop and other agents via the Model Context Protocol.