How andresd1az/molly-lang works
Molly is a small policy-enforcing language for AI-agent plans: trusted application code fixes the context and available tools, then the engine checks a plan before permitting any effects. The main workflow is plan submission, lexical and syntax analysis, labeled execution and authorization, then a dry-run result or an allowed delivery. The CLI and MCP server expose that workflow; a synthetic demo illustrates it. The engine is a single file, so several distinct language stages share its path. Relationships are limited to calls shown in excerpts or capabilities explicitly documented in the README.
Main entry points: molly.py Execution engine · molly_cli.py CLI and policy · molly_mcp.py MCP server · demo.py Synthetic demo
Components 13
Language engine
- DFA lexer
molly.py - LL(1) parser
molly.py - Static checks
molly.py - Labeled values
molly.py - Execution engine
molly.py
User interfaces
- CLI and policy
molly_cli.py - MCP server
molly_mcp.py - Run result
Trusted integrations
- Trusted adapters
Demonstration
- Synthetic demo
demo.py - Fake adapters
demo.py
Other components
- Plan author
- AI agent
Connections 16
- Plan author → CLI and policy: submits plan
README.md - CLI and policy → DFA lexer: checks input
molly_cli.py - DFA lexer → LL(1) parser: provides tokens
README.md - LL(1) parser → Static checks: builds syntax tree
README.md - Static checks → Execution engine: validates plan
README.md - Execution engine → Labeled values: tracks permissions
README.md - Execution engine → Trusted adapters: invokes allowed tools
README.md - Execution engine → Run result: returns trace
molly.py - CLI and policy → Execution engine: runs plan
molly_cli.py - CLI and policy → Run result: formats dry run
molly_cli.py - AI agent → MCP server: calls tools
README.md - MCP server → CLI and policy: delegates checks
molly_mcp.py - MCP server → Run result: returns redacted result
molly_mcp.py - Synthetic demo → Execution engine: executes cases
demo.py - Synthetic demo → Fake adapters: registers adapters
demo.py - Execution engine → Fake adapters: calls fake tools
demo.py