# Documentation Updates Required for Governance Service **Date**: 2025-11-06 **Status**: Specification for Implementation **Copyright 2025 John Stroh** Licensed under the Apache License, Version 2.0 --- ## 1. Tractatus README.md Updates ### New Section: "Current Capabilities & Limitations" **Location**: After "## π Core Components" (line 96) **Content to Add**: ```markdown --- ## βοΈ Current Capabilities & Limitations ### What Tractatus CAN Do Today β **Hook-Triggered Governance** (Production-Tested) - Validates every Edit/Write/Bash operation before execution - Blocks operations violating governance rules (31/39 rules automated) - Runs via Claude Code's PreToolUse/PostToolUse lifecycle hooks - Average overhead: 47ms per validation (imperceptible to developers) β **Historical Pattern Learning** (Filesystem + Agent Lightning) - Stores governance decisions in `.claude/observations/` directory - Semantic search over past decisions (via Agent Lightning port 5001) - Cross-session persistence (survives auto-compacts, session restarts) - Pattern detection: "3 previous edits to this file caused rollback" β **Proactive Warnings Before Tool Execution** - Analyzes risk based on historical patterns - Warns: "This operation previously failed under HIGH context pressure" - Recommends: PROCEED | PROCEED_WITH_CAUTION | REVIEW_REQUIRED - Injects context into Claude Code before governance validation runs β **Six Framework Services** (See Core Components above) - BoundaryEnforcer, CrossReferenceValidator, MetacognitiveVerifier - ContextPressureMonitor, InstructionPersistenceClassifier - PluralisticDeliberationOrchestrator ### What Tractatus CANNOT Do (Requires External Agent) β **Continuous Awareness Between Tool Calls** - Hooks only run when Claude Code calls Edit/Write/Bash - No observation during AI reasoning process (between tool uses) - Cannot detect "I'm planning a bad decision" before tool execution β **Catching Reasoning Errors in Conversation** - Hooks don't validate conversational responses (only tool calls) - Cannot detect wrong advice, incorrect explanations, fabricated claims - User must catch reasoning errors before they become actions β **True Autonomous Agent Monitoring From Outside** - Not a separate process watching Claude Code externally - Cannot observe Claude Code from outside its own execution context - Requires Claude Code to trigger hooks (not independent monitoring) ### Why External Agent Required for Full Coverage To catch mistakes **before they become tool calls**, you need: - External process monitoring Claude Code session logs - Real-time analysis of conversational responses (not just actions) - Continuous observation between AI responses (not hook-triggered) **Tractatus provides the interface** for external agents (observations API, semantic search, governance rules). **Partner opportunity**: Build external monitoring agent using Agent Lightning or similar framework. --- ``` **Implementation**: Insert this section after line 96 in README.md --- ## 2. Tractatus Implementer Page (implementer.html) Updates ### New Section: "Governance Service Architecture" **Location**: Between `
What This Is: A governance service triggered by Claude Code's hook system that learns from past decisions and provides proactive warnings before tool execution.
What This Is NOT: An autonomous agent that continuously monitors Claude Code from outside. It only runs when Edit/Write/Bash tools are called.
PreToolUse Hooks:
1. proactive-advisor-hook.js (NEW)
βββ SessionObserver.analyzeRisk(tool, params)
βββ Query Agent Lightning: Semantic search past decisions
βββ Detect patterns: "3 previous edits caused rollback"
βββ Inject warning if HIGH/CRITICAL risk
2. framework-audit-hook.js (EXISTING)
βββ BoundaryEnforcer (values decisions)
βββ CrossReferenceValidator (pattern override)
βββ MetacognitiveVerifier (confidence check)
βββ ContextPressureMonitor (session quality)
βββ InstructionPersistenceClassifier
βββ PluralisticDeliberationOrchestrator
Tool Executes (Edit/Write/Bash)
PostToolUse Hooks:
session-observer-hook.js (NEW)
βββ Record: [tool, decision, outcome, context]
βββ Store in .claude/observations/
βββ Index via Agent Lightning for semantic search
Stores and queries historical governance decisions
PreToolUse hook that warns before risky operations
PostToolUse hook that records outcomes
Full coverage requires an external agent that monitors Claude Code sessions from outside, analyzing conversational responses and reasoningβnot just tool executions.
This would complement Tractatus governance by catching mistakes before they become tool calls.
Technology Stack: Agent Lightning, session log monitoring, real-time response analysis