[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-1790":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":14,"stars7d":15,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":15,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":33,"readmeContent":34,"aiSummary":35,"trendingCount":16,"starSnapshotCount":16,"syncStatus":36,"lastSyncTime":37,"discoverSource":38},1790,"chiasmus","yogthos\u002Fchiasmus","yogthos","Chiasmus is an MCP server that gives language models access to formal verification","",null,"TypeScript",191,10,1,3,0,28,49.42,"Apache License 2.0",false,"main",true,[24,25,26,27,28,29,30,31,32],"ai-agents","ai-assistant","ai-tools","formalmethods","llm","mcp","mcp-server","prolog","z3-smt-solver","2026-06-12 04:00:11","# Chiasmus\n\nMCP server that gives LLMs access to formal verification via Z3 (SMT solver) and SWI-Prolog (via `prolog-wasm-full`, includes `library(clpfd)`), plus tree-sitter-based source code analysis. Translates natural language problems into formal logic using a template-based pipeline, verifies results with mathematical certainty, and analyzes call graphs for reachability, dead code, and impact analysis.\n\n### Example use cases\n\n- **\"Can our RBAC rules ever conflict?\"** → Z3 finds the exact role\u002Faction\u002Fresource triple where allow and deny both fire\n- **\"Find compatible package versions\"** → Z3 solves dependency constraints with incompatibility rules, returns a valid assignment or proves none exists\n- **\"Can user input reach the database?\"** → Prolog traces all paths through the call graph, flags taint flows to sensitive sinks\n- **\"Are our frontend and backend validations consistent?\"** → Z3 finds concrete inputs that pass one but fail the other (e.g. age=15 passes frontend min=13 but fails backend min=18)\n- **\"Does our workflow have dead-end or unreachable states?\"** → Prolog checks reachability from the initial state, identifies orphaned and terminal nodes\n- **\"What's the dead code in this module?\"** → tree-sitter parses source files, Prolog finds functions unreachable from any entry point\n- **\"What breaks if I change this function?\"** → call graph impact analysis shows all transitive callers\n- **\"Do a full code review of these files\"** → `chiasmus_review` returns a phased recipe of graph analyses + verification templates, and you execute it step-by-step\n\n## Setup\n\n```bash\nnpm install -g chiasmus\n```\n\n### Claude Code\n\n```bash\nclaude mcp add chiasmus -- npx -y chiasmus\n```\n\nOr add to `~\u002F.claude\u002Fsettings.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"chiasmus\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"chiasmus\"]\n    }\n  }\n}\n```\n\n### Crush\n\nAdd to `crush.json`:\n\n```json\n{\n  \"mcp\": {\n    \"chiasmus\": {\n      \"type\": \"stdio\",\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"chiasmus\"]\n    }\n  }\n}\n```\n\n### OpenCode\n\nAdd to `opencode.json`:\n\n```json\n{\n  \"mcp\": {\n    \"chiasmus\": {\n      \"type\": \"local\",\n      \"command\": [\"npx\", \"-y\", \"chiasmus\"]\n    }\n  }\n}\n```\n\n## Tools\n\n**`chiasmus_verify`** — Submit raw SMT-LIB or Prolog, get a verified result. Z3 UNSAT results include an `unsatCore` showing which assertions conflict. Prolog supports `explain=true` for derivation traces showing which rules fired.\n\n```\nchiasmus_verify solver=\"z3\" input=\"\n  (declare-const x Int)\n  (assert (! (> x 10) :named gt10))\n  (assert (! (\u003C x 5) :named lt5))\n\"\n→ { status: \"unsat\", unsatCore: [\"gt10\", \"lt5\"] }\n```\n\n```\nchiasmus_verify solver=\"prolog\"\n  input=\"parent(tom, bob). parent(bob, ann). ancestor(X,Y) :- parent(X,Y). ancestor(X,Y) :- parent(X,Z), ancestor(Z,Y).\"\n  query=\"ancestor(tom, Who).\"\n  explain=true\n→ { status: \"success\", answers: [...], trace: [\"ancestor(tom,bob)\", \"ancestor(bob,ann)\", \"ancestor(tom,ann)\"] }\n```\n\n**`chiasmus_verify`** also accepts `format=\"mermaid\"` with `solver=\"prolog\"` to parse Mermaid flowcharts and state diagrams directly into Prolog facts:\n\n```\nchiasmus_verify solver=\"prolog\" format=\"mermaid\"\n  input=\"graph TD\\n  UserInput --> Validator\\n  Validator --> DB\\n  Validator --> Logger\"\n  query=\"reaches(userinput, db).\"\n→ { status: \"success\", answers: [{}] }\n\nchiasmus_verify solver=\"prolog\" format=\"mermaid\"\n  input=\"stateDiagram-v2\\n  Idle --> Active : start\\n  Active --> Done : finish\"\n  query=\"can_reach(idle, done).\"\n→ { status: \"success\", answers: [{}] }\n```\n\n**`chiasmus_graph`** — Analyze source code call graphs via tree-sitter + Prolog. Parses source files, extracts cross-module call graphs, runs formal analyses.\n\nBuilt-in language support: **TypeScript**, **JavaScript**, **Python**, **Go**, **Clojure\u002FClojureScript**. Additional languages can be added via [custom adapters](#custom-language-adapters).\n\n```\nchiasmus_graph files=[\"src\u002Fserver.ts\", \"src\u002Fdb.ts\"] analysis=\"callers\" target=\"query\"\n→ { analysis: \"callers\", result: [\"handleRequest\"] }\n\nchiasmus_graph files=[\"src\u002F**\u002F*.ts\"] analysis=\"dead-code\"\n→ { analysis: \"dead-code\", result: [\"unusedHelper\", \"legacyParser\"] }\n\nchiasmus_graph files=[\"app.py\", \"db.py\"] analysis=\"reachability\" from=\"handle\" to=\"connect\"\n→ { analysis: \"reachability\", result: { reachable: true } }\n\nchiasmus_graph files=[\"main.go\", \"handler.go\"] analysis=\"impact\" target=\"Query\"\n→ { analysis: \"impact\", result: [\"Handle\", \"main\"] }\n```\n\nAnalyses: `summary`, `callers`, `callees`, `reachability`, `dead-code`, `cycles`, `path`, `impact`, `layer-violation`, `communities`, `hubs`, `bridges`, `surprises`, `diff`, `entry-points`, `facts`.\n\nReachability-heavy analyses (`cycles`, `reachability`, `path`, `impact`, `dead-code`, `callers`, `callees`) run on native O(V+E) graph algorithms and scale to codebases with thousands of functions. `communities` uses Louvain; `bridges` uses exact betweenness centrality. The `facts` analysis emits raw Prolog for use with `chiasmus_verify`, capped at 10 MB — above that limit the result is `{ error, size, limit }` rather than a program string, so narrow the file set or call a specific analysis directly. Opt in to `include_insights=true` on `facts` to also emit `community\u002F2`, `cohesion\u002F2`, `hub\u002F2`, `bridge\u002F2` predicates.\n\nTS\u002FJS calls also carry qualified-name hints when the receiver's class can be inferred (`CallsFact.calleeQN = \"Class.method\"`), and imports are resolved through `tsconfig.json` path aliases and the batch's file layout (`ImportsFact.resolved = \"\u003Crepo-relative path>\"`). Both surface as additive Prolog facts — `calls_qn\u002F3` and `imports_resolved\u002F3` — so back-compat queries over `calls\u002F2` and `imports\u002F3` keep working.\n\n### Persistent cache and PR diff\n\nPass `cache=true` on `chiasmus_graph` to enable a per-file content-hash cache — unchanged files skip re-parsing across calls. On a 42-file TypeScript repo, warm hits run at ~2.5ms vs ~170ms cold (60× speedup). Cache lives under `$CHIASMUS_CACHE_DIR` (default `~\u002F.cache\u002Fchiasmus`) with an LRU budget per repo.\n\n```\nchiasmus_graph files=[...] analysis=\"summary\" cache=true save_snapshot=\"main\"\n→ extracts + saves the current graph as the \"main\" baseline\n\n# After branch changes:\nchiasmus_graph files=[...] analysis=\"diff\" against=\"main\" cache=true\n→ { addedNodes, removedNodes, addedEdges, removedEdges, summary }\n```\n\n`chiasmus_review` accepts `delta_against=\"\u003Csnapshot>\"` — when set, a phase 0 diffs against the snapshot, impact-checks removed symbols, and scopes later phases to what the PR actually changed.\n\n**`chiasmus_map`** — Pre-built codebase map for agents to consult **before** bulk file reads. Reuses the same tree-sitter extraction + cache as `chiasmus_graph`; returns a compact outline so an LLM can answer \"what's in this repo\" \u002F \"what does this file expose\" \u002F \"where is X defined\" without opening source.\n\n```\nchiasmus_map files=[\"src\u002F**\u002F*.ts\"]\n→ markdown outline: per-file headlines, exports with signatures,\n  token estimates, leading doc comments\n\nchiasmus_map files=[...] mode=\"file\" path=\"src\u002Fserver.ts\" format=\"json\"\n→ { exports, imports grouped by source, all top-level symbols }\n\nchiasmus_map files=[...] mode=\"symbol\" name=\"handleRequest\"\n→ { defines: [{file, line, signature}], callers, callees }\n```\n\nModes: `overview` (default), `file`, `symbol`. Output: `markdown` (default) or `json`. `include` globs and `max_exports` (clamped to ≥0) scope the overview. `cache=true` reuses the shared per-file cache.\n\n**`chiasmus_skills`** — Search the template library. Ships with 8 starter templates covering authorization, configuration, dependency resolution, validation, rule inference, and graph reachability. By-name lookups include related template suggestions.\n\n**`chiasmus_formalize`** — Find the best template for a problem, get slot-filling instructions plus suggestions for related verification checks. Fill the slots using your context, then call `chiasmus_verify`.\n\n**`chiasmus_solve`** — End-to-end: selects template, fills slots via LLM, runs lint and correction loops with enriched feedback (unsat cores, structured error classification), returns a verified result. Optional — the same result is achieved by using `chiasmus_formalize` → fill slots → `chiasmus_verify`, which is the recommended workflow since the calling LLM has full conversation context.\n\n**`chiasmus_craft`** — Create a new template and add it to the skill library. The calling LLM designs the template — no API key needed. Describe a problem type, then submit a skeleton with `{{SLOT:name}}` markers, slot definitions, and normalization recipes. Validates slot\u002Fskeleton consistency and name uniqueness. Optionally tests the example through the solver.\n\n```\nchiasmus_craft name=\"api-rate-limit\" domain=\"configuration\" solver=\"z3\"\n  signature=\"Check if rate limit configs across services are consistent\"\n  skeleton=\"{{SLOT:declarations}}\\n(assert (not (= {{SLOT:limit_a}} {{SLOT:limit_b}})))\"\n  slots=[{name: \"declarations\", ...}, {name: \"limit_a\", ...}, {name: \"limit_b\", ...}]\n  normalizations=[{source: \"YAML config\", transform: \"Map rate limits to Int constants\"}]\n→ { created: true, template: \"api-rate-limit\", slots: 3 }\n```\n\nAfter creation, the template appears in `chiasmus_skills` searches and `chiasmus_formalize`.\n\n**`chiasmus_review`** — Returns a phased code-review recipe: which chiasmus tools and templates to run, in what order, and what to look for. No side effects — pure scaffolding. Execute phases sequentially using the named tools, then produce a final report per the `reporting` section.\n\n```\nchiasmus_review files=[\"src\u002Fhandler.ts\", \"src\u002Fdb.ts\"] focus=\"all\"\n→ {\n    phases: [\n      { phase: \"1. Structural overview\", actions: [{tool: \"chiasmus_graph\", args: {analysis: \"summary\"}, interpret: \"...\"}] },\n      { phase: \"2. Architecture health\", actions: [dead-code, cycles, layer-violation] },\n      { phase: \"3. Security — data flow and taint\", actions: [facts + chiasmus_formalize taint-propagation] },\n      { phase: \"4. Resource safety\", actions: [association-rule-check] },\n      { phase: \"5. Authorization\", actions: [policy-contradiction] },\n      { phase: \"6. Correctness — invariants, boundaries, state machines\", actions: [...] },\n      { phase: \"7. Impact analysis on flagged functions\", actions: [chiasmus_graph impact] },\n    ],\n    suggestedTemplates: [...],\n    reporting: { format: \"Numbered issue list with severity\", severityLevels: [\"CRITICAL\",\"HIGH\",\"MEDIUM\",\"LOW\",\"INFO\"] }\n  }\n```\n\nFocus modes subset the phases: `all` (default, 7 phases), `quick` (overview + architecture), `architecture` (structural defects + impact), `security` (taint + resource pairing + auth), `correctness` (invariants + boundaries + state machines).\n\nEach action carries an `interpret` field describing how to score the result. After all phases, emit a numbered issue list with severity labels and file:line references.\n\n**`chiasmus_search`** — Semantic code search over a set of files. Finds functions and methods whose *meaning* matches a natural-language query (e.g. \"where do we refresh OAuth tokens\", \"rate-limit logic\"). Uses embeddings + cosine similarity over callable defines; returns a ranked list with `{name, file, line, signature, leadingDoc, score}`.\n\n```\nchiasmus_search query=\"refresh OAuth tokens\" files=[\"src\u002F**\u002F*.ts\"] top_k=5\n→ { hits: [\n    { name: \"refreshAccessToken\", file: \"src\u002Fauth\u002Ftoken.ts\", line: 42, score: 0.78, ... },\n    { name: \"rotateSession\", file: \"src\u002Fauth\u002Fsession.ts\", line: 118, score: 0.71, ... },\n    ...\n  ] }\n```\n\nOpt-in: needs an embedding provider via env (`OPENAI_API_KEY`, `DEEPSEEK_API_KEY`, or `OPENROUTER_API_KEY`). Override the model with `CHIASMUS_EMBED_MODEL` (default `text-embedding-3-small`), base URL with `CHIASMUS_EMBED_URL`, and dimension with `CHIASMUS_EMBED_DIM`. Embeddings are cached by content SHA-256 under `$CHIASMUS_HOME\u002Fembeddings` — unchanged code is not re-embedded.\n\n**`chiasmus_learn`** — Extract a reusable template from a verified solution. Candidates get promoted after 3+ successful reuses.\n\n**`chiasmus_lint`** — Fast structural validation of specs without running the solver.\n\n## Recommended Workflow\n\nThe calling LLM (GLM, GPT, etc.) drives the process — no API key needed:\n\n1. `chiasmus_formalize problem=\"Can our RBAC rules ever conflict?\"` → get template + slot instructions\n2. Fill the template slots using your knowledge of the user's codebase\n3. `chiasmus_verify solver=\"z3\" input=\"(filled spec)\"` → get verified result\n4. If error → read the error, fix the spec, call `chiasmus_verify` again\n\n## When to Use\n\nUse a solver when the LLM alone can't guarantee correctness:\n\n- **\"Does this hold for ALL inputs?\"** — solvers prove universally, LLMs just check examples\n- **\"Do these rules ever conflict?\"** — contradiction detection over combinatorial spaces\n- **\"Can X reach Y through any path?\"** — transitive closure \u002F reachability\n- **Access control, configs, dependencies** — where correctness is non-negotiable\n\nUse `chiasmus_graph` when you need structural reasoning about code:\n\n- **\"What calls this function?\"** — impact analysis before refactoring\n- **\"What's dead code?\"** — find functions unreachable from entry points\n- **\"Can user input reach this SQL query?\"** — taint analysis via call graph reachability\n- **\"What breaks if I change X?\"** — blast radius via reverse reachability\n- **\"Are there circular dependencies?\"** — cycle detection in call graphs\n\n## Why `chiasmus_graph` over grep\n\nWhen an LLM needs to understand code structure, it typically greps for function names and manually traces call chains. This works for direct references but breaks down for transitive questions. Here's a real comparison using chiasmus's own codebase:\n\n**Question: \"What's the blast radius of changing `lintSpec`?\"**\n\nWith grep, this takes multiple rounds — first find direct callers, then callers of those callers, reconstructing the chain manually:\n\n```\ngrep lintSpec src\u002F**\u002F*.ts     → found in engine.ts (lintLoop) and mcp-server.ts (handleLint)\ngrep lintLoop src\u002F**\u002F*.ts     → called from solve() at lines 75 and 87\ngrep handleSolve src\u002F**\u002F*.ts  → called from createChiasmusServer switch...\n```\n\nThree rounds of grep, manual reasoning at each step, and you've still only traced part of the chain. With `chiasmus_graph`, one call gives the complete transitive answer:\n\n```\nchiasmus_graph analysis=\"impact\" target=\"lintSpec\"\n→ [\"lintLoop\", \"handleLint\", \"solve\", \"correctionLoop\",\n   \"handleVerify\", \"handleSolve\", \"handleGraph\",\n   \"createChiasmusServer\", \"runAnalysis\", \"runAnalysisFromGraph\"]\n```\n\n10 affected functions found in a single call — including paths through `correctionLoop` and `runAnalysis` that the grep approach missed entirely.\n\nThe same applies to other structural questions:\n\n| Question | Grep | chiasmus_graph |\n|----------|------|----------------|\n| Impact of changing X | Multiple greps + manual trace; misses transitive paths | 1 call, complete transitive chain |\n| Dead code detection | Grep every function name against all call sites — impractical | 1 call, definitive answer |\n| Can A reach B? | Manually reconstruct call chain across files | 1 call, true\u002Ffalse |\n| Call chain A→B | Multiple greps, mentally reconstruct path | 1 call, exact chain e.g. `[handleSolve,solve,lintLoop,lintSpec]` |\n\nThe key difference: grep finds string matches, `chiasmus_graph` answers structural questions. Transitive reachability, dead code, and impact analysis are formally impossible with grep alone.\n\n## Custom Language Adapters\n\nAdd tree-sitter support for any language by publishing an npm package named `chiasmus-adapter-\u003Clanguage>`. Chiasmus auto-discovers these at startup.\n\n```ts\n\u002F\u002F chiasmus-adapter-rust\u002Findex.ts\nimport type { LanguageAdapter } from \"chiasmus\u002Fgraph\";\n\nconst adapter: LanguageAdapter = {\n  language: \"rust\",\n  extensions: [\".rs\"],\n  grammar: { package: \"tree-sitter-rust\" },\n  extract(rootNode, filePath) {\n    const defines = [];\n    const calls = [];\n    \u002F\u002F Walk the tree-sitter AST and populate defines, calls, imports, etc.\n    \u002F\u002F ... your language-specific extraction logic ...\n    return { defines, calls, imports: [], exports: [], contains: [] };\n  },\n};\n\nexport default adapter;\n```\n\nInstall alongside chiasmus and enable adapter discovery in `~\u002F.chiasmus\u002Fconfig.json`:\n\n```bash\nnpm install chiasmus-adapter-rust\n```\n\n```json\n{\n  \"adapterDiscovery\": true\n}\n```\n\nAdapter discovery is **off by default** to keep startup fast. Enable it when you have custom adapters installed.\n\n### searchPaths\n\nAn adapter can export `searchPaths` to point to directories containing additional adapter modules (`.js`\u002F`.mjs` files). This is useful for loading adapters from non-standard locations:\n\n```ts\nexport default {\n  language: \"rust\",\n  extensions: [\".rs\"],\n  grammar: { package: \"tree-sitter-rust\" },\n  extract(rootNode, filePath) { \u002F* ... *\u002F },\n  searchPaths: [\"\u002Fshared\u002Fcompany-adapters\"],\n};\n```\n\n### Adapter interface\n\n| Field | Type | Description |\n|-------|------|-------------|\n| `language` | `string` | Language identifier (e.g., `\"rust\"`) |\n| `extensions` | `string[]` | File extensions (e.g., `[\".rs\"]`) |\n| `grammar` | `object` | Tree-sitter grammar: `{ package, moduleExport? }` for native or `{ package, wasmFile, wasm: true }` for WASM |\n| `extract` | `(rootNode, filePath) => CodeGraph` | Walks the AST and returns `{ defines, calls, imports, exports, contains }` |\n| `searchPaths` | `string[]` (optional) | Additional directories to scan for adapter modules |\n\nBuilt-in languages always take precedence over adapters with the same extensions.\n\n## Library Usage\n\nChiasmus can be used as a library in any Node.js project:\n\n```bash\nnpm install chiasmus\n```\n\n### Quick Start\n\n```ts\nimport { SolverSession, lintSpec, SkillLibrary, FormalizationEngine } from \"chiasmus\";\n```\n\nOr import from specific subpaths:\n\n```ts\nimport { createZ3Solver, createPrologSolver } from \"chiasmus\u002Fsolvers\";\nimport { extractGraph, runAnalysis } from \"chiasmus\u002Fgraph\";\nimport { lintSpec, FormalizationEngine } from \"chiasmus\u002Fformalize\";\nimport { SkillLibrary, SkillLearner } from \"chiasmus\u002Fskills\";\nimport { createLLMFromEnv } from \"chiasmus\u002Fllm\";\n```\n\n### Solvers\n\n```ts\nimport { SolverSession } from \"chiasmus\u002Fsolvers\";\n\nconst session = await SolverSession.create(\"z3\");\ntry {\n  const result = await session.solve({\n    type: \"z3\",\n    smtlib: `(declare-const x Int) (assert (> x 5))`,\n  });\n  if (result.status === \"sat\") {\n    console.log(\"Satisfiable:\", result.model);\n  }\n} finally {\n  session.dispose();\n}\n```\n\n### Graph Analysis\n\n```ts\nimport { extractGraph, runAnalysis } from \"chiasmus\u002Fgraph\";\n\nconst result = await runAnalysis(\n  [\"src\u002Fserver.ts\", \"src\u002Fdb.ts\"],\n  { analysis: \"dead-code\" }\n);\nconsole.log(result.result);\n```\n\n### Lint & Validation\n\n```ts\nimport { lintSpec } from \"chiasmus\u002Fformalize\";\n\nconst { spec, fixes, errors } = lintSpec(rawSpec, \"z3\");\nif (errors.length > 0) {\n  console.error(\"Lint errors:\", errors);\n}\n```\n\n### Skill Library\n\n```ts\nimport { SkillLibrary } from \"chiasmus\u002Fskills\";\nimport { join } from \"node:path\";\nimport { homedir } from \"node:os\";\n\nconst library = await SkillLibrary.create(join(homedir(), \".chiasmus\"));\nconst results = library.search(\"access control policy conflict\");\nconsole.log(results);\nlibrary.close();\n```\n\n### Exports\n\n| Subpath | Exports |\n|---------|---------|\n| `chiasmus` | All public APIs (barrel export) |\n| `chiasmus\u002Fsolvers` | `SolverSession`, `createZ3Solver`, `createPrologSolver`, `correctionLoop`, solver types |\n| `chiasmus\u002Fgraph` | `extractGraph`, `runAnalysis`, `runAnalysisFromGraph`, `buildFactsResult`, `graphToProlog`, `parseMermaid`, `detectCommunities`, `detectHubs`, `detectBridges`, `detectSurprisingConnections`, `detectEntryPoints`, `graphDiff`, `saveSnapshot`\u002F`loadSnapshot`\u002F`listSnapshots`, cache APIs, adapter registry, graph types |\n| `chiasmus\u002Fformalize` | `lintSpec`, `classifyFeedback`, `extractPrologQuery`, `FormalizationEngine`, result types |\n| `chiasmus\u002Fskills` | `SkillLibrary`, `SkillLearner`, `craftTemplate`, `validateTemplate`, skill types |\n| `chiasmus\u002Fllm` | `createLLMFromEnv`, `AnthropicAdapter`, `OpenAICompatibleAdapter`, LLM types |\n| `chiasmus\u002Fmcp` | `createChiasmusServer`, `getChiasmusHome` |\n\n## Configuration\n\n| Variable | Default | Purpose |\n|----------|---------|---------|\n| `CHIASMUS_HOME` | `~\u002F.chiasmus\u002F` | Database, skill storage, and config |\n| `CHIASMUS_CACHE_DIR` | `~\u002F.cache\u002Fchiasmus` | Per-file extraction cache + graph snapshots (when `cache=true`) |\n| `CHIASMUS_CACHE_MAX_PER_REPO` | `67108864` (64 MB) | Per-repo cache byte budget — LRU eviction above this |\n| `ANTHROPIC_API_KEY` | — | Optional: Anthropic provider for autonomous mode |\n| `DEEPSEEK_API_KEY` | — | Optional: DeepSeek provider for autonomous mode |\n| `OPENAI_API_KEY` | — | Optional: OpenAI provider for autonomous mode |\n| `CHIASMUS_API_URL` | per provider | Override API base URL (e.g. for local models via Ollama) |\n| `CHIASMUS_MODEL` | per provider | Override model name |\n\nProviders are checked in order: Anthropic → DeepSeek → OpenAI. Only one key is needed for autonomous mode (`chiasmus_solve`, `chiasmus_learn`). When used from Claude Code, Crush, or OpenCode, no API key is needed — the calling LLM handles template filling directly.\n\n### `~\u002F.chiasmus\u002Fconfig.json`\n\n| Key | Default | Purpose |\n|-----|---------|---------|\n| `adapterDiscovery` | `false` | Scan `node_modules` for `chiasmus-adapter-*` packages at startup |\n\n## License\n\nApache-2.0\n","Chiasmus 是一个MCP服务器，它为语言模型提供了形式化验证的能力。该项目利用Z3（SMT求解器）和SWI-Prolog（通过`prolog-wasm-full`支持`library(clpfd)`），结合基于tree-sitter的源代码分析技术，将自然语言问题转化为形式逻辑，并以数学上的确定性验证结果，同时提供调用图分析功能来检测可达性、死代码及影响分析等。适用于需要确保软件系统安全性、一致性和优化性的场景，如RBAC规则冲突检查、依赖包版本兼容性分析、用户输入数据流追踪、前后端验证一致性测试以及工作流程状态分析等。项目采用TypeScript编写，遵循Apache License 2.0开源许可协议。",2,"2026-06-11 02:46:02","CREATED_QUERY"]