tractatus/.claude/hooks
TheFlow 5bcdc96b5c fix(audit): ensure all hook denials are logged to audit database
CRITICAL BUG FIX: Framework audit hook was blocking actions but NOT
logging those denials to the audit database. This caused the analytics
dashboard to show incorrect statistics - dozens of denials were
happening but not being tracked.

Changes:
- Add logDenial() function to framework-audit-hook.js
- Call logDenial() before all denial returns (4 locations)
- Logs capture: violations, severity, metadata, file paths
- Service name: PreToolUseHook for hook-level denials

Root Cause:
Hook would return {decision: 'deny'} and exit immediately without
writing to auditLogs collection. Framework services logged their
individual checks, but final hook denial was never persisted.

Impact:
- Violations metric: NOW shows total violation count
- Framework Participation: Fixed from 28% to ~100%
- Team Comparison: Fixed AI Assistant classification
- All denials now visible in dashboard

Related fixes in this commit:
- audit.controller.js: Move avgBlockRate calc before use
- audit.controller.js: Count total violations not decision count
- audit.controller.js: Fix team comparison service list
- audit-analytics.js: Same client-side fixes

Tested:
- Manual test: Attempted to edit instruction-history.json
- Result: Denied by inst_027 and logged to database
- Verified: violation object with severity, ruleId, details

Database reset for clean baseline (old logs were incomplete).

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 11:27:53 +13:00
..
all-command-detector.js feat(governance): third wave enforcement - 22% improvement (46% → 56%) 2025-10-25 13:38:18 +13:00
behavioral-compliance-reminder.js feat(governance): wave 4 enforcement - 41% improvement (56% → 79%) 2025-10-25 13:48:43 +13:00
check-token-checkpoint.js feat(governance): implement comprehensive enforcement architecture 2025-10-25 13:15:06 +13:00
framework-audit-hook.js fix(audit): ensure all hook denials are logged to audit database 2025-10-28 11:27:53 +13:00
prompt-analyzer-hook.js feat(framework): implement Phase 3 bidirectional communication architecture 2025-10-27 19:45:24 +13:00
test-hook-input.json feat(blog): integrate Tractatus framework governance into blog publishing 2025-10-25 08:47:31 +13:00
TEST_HOOK_INVOCATION.txt feat(blog): integrate Tractatus framework governance into blog publishing 2025-10-25 08:47:31 +13:00
track-approval-patterns.js feat(governance): wave 5 enforcement - 100% coverage achieved (79% → 100%) 2025-10-25 14:10:23 +13:00
trigger-word-checker.js fix(governance): add architectural enforcement for "ff" and "ffs" trigger words 2025-10-25 12:32:52 +13:00