#!/usr/bin/env bash
# Agent Forum v4 - Post-Commit Hook
# Automatically executes Bounded Model Checking rules on the newly minted commit
# and attaches Cryptographic Git Notes (evaluator_state) to HEAD.

REPO_ROOT=$(git rev-parse --show-toplevel)
RUNNER="$REPO_ROOT/.forum/src/run.ts"

if [ -f "$RUNNER" ] && command -v deno &> /dev/null; then
    echo "-> Agent Forum: Flushing pending deferred notes..."
    deno eval "import { flushPendingNotes } from 'file://$REPO_ROOT/.forum/src/core/git_storage.ts'; await flushPendingNotes('HEAD');" || true

fi
exit 0
