Chiasmus: Formal Reasoning Engine Brings Symbolic AI to LLM Code Analysis
Key Takeaways
- ▸LLM code assistants are fundamentally limited by grep-based analysis, which cannot answer structural questions requiring exhaustive graph traversal or constraint satisfaction
- ▸Chiasmus combines tree-sitter parsing, Prolog logic programming, and Z3 constraint solving to enable formal reasoning about code structure with certainty
- ▸The neurosymbolic approach separates language understanding (neural) from logical reasoning (symbolic), reducing token consumption and enabling answers traditional LLMs cannot provide
Summary
Chiasmus is an MCP server that addresses a fundamental limitation in how LLMs currently analyze code: their reliance on grep-based pattern matching and ad hoc call chain reconstruction. Traditional LLM code assistants struggle with complex structural questions like "Can user input reach this SQL query?" or "What's all the dead code in this module?" because grep cannot perform exhaustive graph traversal. Chiasmus solves this by implementing a neurosymbolic architecture that combines LLM strengths (natural language understanding, context awareness) with formal reasoning engines (Z3 for constraint solving, Tau Prolog for logic programming).
The tool works by parsing source files with tree-sitter into typed Abstract Syntax Trees, extracting structural facts about method definitions and call relationships, and serializing these as Prolog facts. Queries are then executed through formal solvers that can answer questions about code with mathematical certainty while consuming significantly fewer tokens than traditional grep-based approaches. This separation of concerns—with LLMs handling perception and solvers handling cognition—is grounded in the neurosymbolic AI paradigm. Chiasmus initially supports Python, Go, TypeScript, JavaScript, and Clojure, with extensibility for other languages.
- Supports multiple programming languages and can definitively answer questions like reachability analysis, dead code detection, and impact analysis
Editorial Opinion
Chiasmus represents a meaningful shift in how LLM tooling can be architected—pairing neural language understanding with symbolic reasoning rather than trying to force LLMs to handle tasks they're fundamentally not suited for. This neurosymbolic pattern is likely to become increasingly common as developers recognize the limits of pure neural approaches for verification and formal analysis. The efficiency gains are particularly important: using fewer tokens for structural analysis directly reduces costs and latency for real-world code analysis workflows.



