Hooks for Enforcement

Hooks enforce the "log before you code" rule by checking for decision graph activity before allowing commits.

The decision graph works best when it is populated in real time—before and during implementation, not after. Hooks turn this best practice into a hard requirement by integrating with git's pre-commit mechanism.

Configuration

Hooks are configured in .deciduous/config.toml. The hooks section defines what checks run before a commit is allowed:

.deciduous/config.toml
[hooks] # Require at least one active goal before committing require_active_goal = true # Require a recent deciduous command (within last 30 minutes) require_recent_activity = true recent_activity_minutes = 30 # Require an action node linked to HEAD commit require_commit_link = false # Branches where hooks are enforced (empty = all branches) enforced_branches = [] # Branches where hooks are skipped skip_branches = ["main", "master"]

The most common configuration requires an active goal and recent deciduous activity. This catches the case where a developer starts coding without first creating a goal node. The skip_branches setting exempts main/master, where merge commits should not be blocked.

Installing Hooks

The deciduous hooks install command generates git hook scripts and places them in .git/hooks/:

Installing hooks
deciduous hooks install Installed pre-commit hook: .git/hooks/pre-commit - Check: require active goal node - Check: require recent deciduous activity (30 min) Hook is executable and ready.

The generated hook script calls deciduous to check the configured conditions. If any check fails, the commit is blocked with a message explaining what is needed.

What a Blocked Commit Looks Like

When you try to commit without meeting the hook requirements:

Blocked commit
git commit -m "feat: add CI workflow" deciduous pre-commit check failed: No recent deciduous activity found. Last command was 2 hours ago. Before committing, log what you're about to do: deciduous add goal "Add CI workflow" -c 90 deciduous add action "Implementing CI workflow" -c 85 To skip this check (not recommended): git commit --no-verify

The error message is actionable—it tells you exactly what commands to run. After creating the goal and action nodes, the commit will succeed:

After logging the decision
deciduous add goal "Add CI pipelines for snowflex" -c 90 Created node #57: goal "Add CI pipelines for snowflex" deciduous add action "Implement unit test CI workflow" -c 85 Created node #60: action "Implement unit test CI workflow" git commit -m "feat: add CI workflow" [ci-pipelines abc1234] feat: add CI workflow 2 files changed, 45 insertions(+)

Checking Hook Status

See what hooks are currently installed and their configuration:

deciduous hooks status
deciduous hooks status Hooks status: Installed: yes (.git/hooks/pre-commit) Configuration: .deciduous/config.toml Active checks: require_active_goal: yes require_recent_activity: yes (30 min window) require_commit_link: no Skip branches: main, master Current branch: ci-pipelines (enforced)

Uninstalling Hooks

Remove the deciduous hooks without affecting other git hooks:

Uninstalling hooks
deciduous hooks uninstall Removed pre-commit hook: .git/hooks/pre-commit

When to Use Hooks

Situation Recommendation
Solo developer, AI assistant handles logging Hooks are optional—the assistant follows CLAUDE.md rules
Team where some members forget to log Enable require_active_goal
Strict traceability requirements Enable all checks including require_commit_link
Quick prototyping or spike work Disable hooks or use skip_branches for spike branches
Hooks are local

Git hooks are not committed to the repository (they live in .git/hooks/, which is not tracked). Each developer must run deciduous hooks install on their own machine. The configuration in .deciduous/config.toml is committed, so the hook behavior is consistent once installed.