Conference Presentation, Product Demonstration
Trustworthy Human-AI Collaboration in a Live Type-Theoretic Computational Commons
Core Problem: The "Gap Problem" in Traditional Programming
- Current programming environments suffer from delayed, onerous, and fragmented feedback loops compared to physical tools like pianos or paintbrushes.
- Syntax and type errors create "gaps" where editor services (e.g., "go to definition") are unavailable until the entire file is corrected.
- Compilation and re-execution times often span minutes, preventing immediate feedback on specific code changes.
- Large, unstructured textual logs are difficult for human sensory organs to parse quickly during debugging.
Hazel: A Live Programming Environment
- Hazel is a web-based, co-designed programming language and environment focused on rapid, actionable feedback.
- Error Recovery & Holes: Uses a "hole" mechanism (visualized as hexagons) to recover from syntax errors, allowing the parser to continue analyzing incomplete code rather than halting.
- Live Probing: Allows users to insert "probes" into expressions to view runtime values, data flow, and intermediate variables instantly as they edit.
- Pure by Design: Enforces purity to ensure live execution on every keystroke; side effects (I/O, network) are handled via monadic structures requiring explicit "run" actions.
- Incremental Execution: Employs "shortcut memoization" and fine-grained data flow analysis to avoid re-executing unchanged AST nodes or computations when edits occur.
- Graphical Notation: Supports direct manipulation of data representations (e.g., sorting tables via UI, visualizing music composition with sliders and knobs).
AI Agent Collaboration & Future Vision
- Agent Tool Loops: AI agents face similar feedback delays as humans; live incremental IDEs are required to prevent token waste and context switching.
- Semantic Actions: Hazel's AI assistant operates on a semantic model (types, live data, holes) rather than a text shell, enabling more precise edits and reduced token usage.
- Swarm Coordination: Current Git-based version control struggles with thousands of simultaneous agents; proposed solutions include:
- Tree-based CRDTs: Commutative graph CRDTs for collaborative tree editing that handle code relocations as first-class primitives.
- Content-Addressed Versioning: Integration with concepts from the Unison project where code is never deleted, and references use content hashes to allow parallel development and explicit refactoring.
- Narrativized Change Tours: A proposed GitHub PR system where code hunks are structured into a narrative with an exhaustiveness checker to improve human review speed.
Trustworthiness & Security
- Object Capabilities: Recommends using object-capability systems to grant AI agents fine-grained, attenuated permissions (e.g., "append only" vs. "root access") in sensitive environments.
- Information Flow Control: Proposes using type systems to mathematically prove that sensitive data (e.g., medical records) never leaks to unauthorized channels.
Strategic & Philosophical Directions
- Computational Commons: Envisions a global network of live, executing programs (like a "live Wikipedia") where humans and AIs collaborate on a shared, incrementally recomputing state.
- Deployment & Evolution: Balances "live" development (crucial for climate modeling with real-time data) with stability via content-addressed versioning (Unison model) to prevent breaking existing code.
- Adoption Strategy: Leverages reduced adoption costs (LLMs can port libraries quickly) to build "translation by jealousy," where high-quality, provably correct tools inspire broader community adoption.
- Formal Verification: Plans to integrate theory prover capabilities (Isabelle-style) to allow AI agents to generate and verify invariants alongside code.
Implementation Details & Trade-offs
- Performance: Instrumented interpreters support live feedback but are heavier; the system intends to JIT-compile to efficient runners for large-scale execution.
- UI Constraints: Handling recursive call stacks in live views remains a challenge; current solutions include pinning call frames and multi-view modes to visualize parent/child relationships.
- Data Scale: Proposes a "Foreign Data Interface" (JIT-to-Spark) to handle planetary-scale datasets without loading them entirely into the IDE memory.