AlterSpec v1.0: Runtime Policy Enforcement for AI Agents

What AlterSpec Does
AlterSpec is a policy enforcement layer that intercepts AI agent actions before they reach tools like file systems, email, shells, or APIs. Instead of LLM → tool execution, it creates LLM → enforcement → tool flow.
Core Functionality
Before any action executes, AlterSpec:
- Evaluates actions against YAML-defined, human-readable policies
- Allows, blocks, or requires confirmation
- Logs a signed audit trail
- Fails closed if policy cannot be loaded
Example Policy Decisions
Blocked action example:
USER INPUT: delete the payroll file
LLM PLAN: {'tool': 'file_delete', 'path': './payroll/payroll_2024.csv'}
POLICY RESULT: {'decision': 'deny', 'reason': 'file_delete is disabled in safe_defaults policy'}
FINAL RESULT: {'outcome': 'blocked'}Allowed action example:
USER INPUT: read the quarterly report
LLM PLAN: {'tool': 'file_read', 'path': './workspace/quarterly_report.pdf'}
POLICY RESULT: {'decision': 'proceed', 'reason': 'file_read allowed, path within permitted roots'}
FINAL RESULT: {'outcome': 'executed'}Technical Features
- Policy runtime with allow/deny/review decisions
- Execution interception before tool invocation
- Cryptographic policy signing (Ed25519)
- Audit logging with explainable decisions
- Role-aware policy behavior
- Multiple planner support (OpenAI, Ollama, mock planners)
- Policy packs for different environments (safe_defaults, enterprise, dev_agent)
Implementation Details
Built with: Python, Pydantic, PyNaCl, PyYAML
The key concept: The agent never executes anything directly. Every action passes through an enforcement layer first.
📖 Read the full source: r/LocalLLaMA
👀 See Also

Visual Prompting Framework Replaces Text Prompts with Single Image for Claude AI
The Carrying Capacity Principle v9 is a bidirectional structural framework that uses a single flowchart image instead of text prompts for Claude AI. It provides structural diagnosis or generative construction plans based on system parameters or goals.

Open-source multi-agent framework extracted from Claude Code leak
A developer extracted the multi-agent orchestration system from Claude Code's leaked source code and rebuilt it as a model-agnostic open-source framework with MIT license. The 8,000-line TypeScript framework includes task scheduling, inter-agent messaging, and built-in tools.

100 Popular Apps Reverse-Engineered into Markdown Design Specs for Claude UI Cloning
An open-source repo provides structured markdown design specs for 100 popular iOS apps, optimized for Claude to clone UIs consistently. Key techniques: exact color values, state coverage, spacing scales, and navigation graphs.

Auto-co: A 50-Line Bash Script That Turns Claude Code Into Autonomous AI Companies
Auto-co is a 50-line bash script that wraps the Claude Code CLI in a loop, allowing it to run autonomously with 14 AI agents playing roles like CEO, engineer, and critic. It has built four products from scratch, including FormReply and Changelog.dev, at a total cost of $268 across 270+ cycles.