Add Context Manager client and log schema

- context_manager.py: Full stateless client for Anthropic API
  - Builds context from cto.blocks + cto.memory + log.messages
  - Logs all messages to immutable log.messages table
  - Interactive chat mode with CLI commands

- context_bridge.py: PostgreSQL bridge for context queries
  - Peer auth support for local connections
  - get_all_relevant_blocks() single query optimization
  - build_system_prompt() from blocks

- 04_log.sql: Immutable log schema
  - log.messages with hash chain integrity
  - Triggers preventing UPDATE/DELETE

- 07_initial_blocks.sql: Initial context blocks
  - tzzr_base, rules_base, r2_storage
  - server_architect, server_deck, server_corp

- cm: Launcher script with venv support
This commit is contained in:
ARCHITECT
2026-01-01 22:41:20 +00:00
parent 05d21976ca
commit d1b2c16bd0
5 changed files with 728 additions and 107 deletions

14
cm Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
# Context Manager CLI
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "CONTEXT MANAGER - TZZR"
echo "======================"
# Activar venv si existe
if [ -d "$SCRIPT_DIR/venv" ]; then
source "$SCRIPT_DIR/venv/bin/activate"
fi
# Ejecutar
exec python3 "$SCRIPT_DIR/context_manager.py" "$@"