Borrowing it
Nothing to install: this file belongs to yogthos/chiasmus. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/yogthos/chiasmus/main/AGENTS.mdgit clone --depth 1 https://github.com/yogthos/chiasmusWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/yogthos/chiasmus/agents-md)<a href="https://agentmods.dev/instructions/yogthos/chiasmus/agents-md"><img src="https://agentmods.dev/badge/instructions/yogthos/chiasmus/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/yogthos/chiasmus/agents-md"><img src="https://agentmods.dev/badge/instructions/yogthos/chiasmus/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.11235 | $0.11235 |
| Opus 5.5 | $0.04494 | $0.04494 |
| Sonnet 5.5 | $0.02247 | $0.02247 |
| Haiku 4.5 | $0.01124 | $0.01124 |
Grade A, and why
chiasmus AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 25d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 408 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AGENTS.md — Chiasmus
Project Overview
Chiasmus is an MCP (Model Context Protocol) server that gives LLMs access to formal verification via Z3 (SMT solver) and SWI-Prolog (via prolog-wasm-full, including library(clpfd)). It also provides tree-sitter-based source code call graph analysis. The server 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.
- Language: TypeScript (strict mode, ESM)
- Runtime: Node.js ≥20
- License: Apache-2.0
- Package: npm package
chiasmus, exposes a CLI binary
Commands
pnpm build # Compile TypeScript (tsc) → dist/
pnpm typecheck # Type-check only (tsc --noEmit)
pnpm test # Run tests in watch mode (vitest)
pnpm test:run # Run tests once (vitest run)
pnpm test:coverage # Run tests with V8 coverage report
pnpm mcp # Run MCP server locally via tsx
pnpm mcp:http # Run the Streamable HTTP daemon (chiasmus-http) locally via tsx
CI Pipeline
CI runs on push/PR to main (.github/workflows/test.yml):
pnpm install --frozen-lockfilepnpm typecheckpnpm test:run
Tested on Node 22 and 24. Minimum is Node 22 (better-sqlite3 13 requires it; Node 20 went EOL 2026-04-30).
Code Organization
src/
├── mcp-server.ts # Entry point — MCP server, tool handlers (graph ones in graph/tool-handlers.ts), CLI bootstrap
├── mcp-http-server.ts # Streamable HTTP daemon entry (chiasmus-http): one MCP server per session, one shared SkillLibrary, Host/Origin check
├── config.ts # Loads ~/.chiasmus/config.json
├── child/
│ ├── pool.ts # ChildPool — persistent child process, bounded queue, recycling, SIGKILL stops (graph + solver pools)
│ └── serve.ts # serveJobs — child side: job loop, result + fatal flag + RSS, parent watchdog
├── solvers/
│ ├── types.ts # SolverType, SolverResult (discriminated union), Solver, SolverInput, SolveOptions
│ ├── session.ts # SolverSession — Z3/Prolog solver for the tools; solves run in a solver child unless CHIASMUS_SOLVER_WORKER=off
│ ├── child-pool.ts # SolverChildPool — one child per solver; createChildSolver, shutdownSolverChildren
│ ├── solver-child.ts # Child-process entry: runs one solve at a time, reports a fatal WASM error with its result
│ ├── z3-solver.ts # Z3 WASM wrapper (z3-solver npm), auto-strips check-sat/get-model
│ ├── prolog-solver.ts # SWI-Prolog (prolog-wasm-full) wrapper, derivation tracing via assertz
│ ├── fatal.ts # Fatal WASM error (abort/trap/exit) classification + entry-point exit handler
│ └── correction-loop.ts # Bounded repair loop (delegates to repl-sandbox)
├── formalize/
│ ├── engine.ts # FormalizationEngine — template selection, LLM slot-filling, solve pipeline
│ ├── validate.ts # lintSpec — structural validation, auto-fixes for SMT-LIB/Prolog
│ └── feedback.ts # classifyFeedback — converts SolverResult to human-readable feedback
├── skills/
│ ├── types.ts # SkillTemplate, SlotDef, Normalization, SkillMetadata
│ ├── library.ts # SkillLibrary — SQLite-backed template storage, BM25 search
│ ├── starters.ts # 8 built-in starter templates (5 Z3, 3 Prolog)
│ ├── bm25.ts # BM25 keyword search for template retrieval
│ ├── craft.ts # craftTemplate — user-created template validation + storage
│ └── relationships.ts # Template relationship/suggestion graph
├── graph/
│ ├── types.ts # CodeGraph, LanguageAdapter, FileNode, Hyperedge, DefinesFact, CallsFact.calleeQN, ImportsFact.resolved, FileTypeInfo
│ ├── parser.ts # tree-sitter lang registry + sync/async parse for TS/JS/Py/Go/Rust/Clojure/Scheme/Racket/CL
│ ├── extractor.ts # AST walking + per-language call graph extraction + TS/JS collectTypeInfo
│ ├── extract-sexp.ts # Scheme/Racket + Common Lisp extraction (scope-aware s-expression walkers)
│ ├── facts.ts # graphToProlog — CodeGraph → Prolog facts (incl. calls_qn/3, imports_resolved/3)
│ ├── analyses.ts # runAnalysis — dispatches all graph analyses
│ ├── native-analyses.ts # O(V+E) cycles/reachability/impact/dead-code/callers/callees
│ ├── graph-util.ts # Shared helpers: buildUndirectedGraph (+ entriesByName), forEachUndirectedEdge, undirectedDegree
│ ├── community.ts # Louvain community detection + cohesion score
│ ├── insights.ts # detectHubs, detectBridges/analyzeBridges (sampled above 2k nodes), detectSurprisingConnections
│ ├── diff.ts # graphDiff — set diff on nodes + (src,tgt) edge keys
│ ├── entry-points.ts # Heuristic entry-point detection (zero-in-degree exports)
│ ├── cache.ts # SHA256 per-file cache + LRU eviction + named snapshots (proper-lockfile)
│ ├── tool-handlers.ts # chiasmus_graph / chiasmus_map handlers (run in the graph child process)
│ ├── child-pool.ts # GraphChildPool — ChildPool for chiasmus_graph/chiasmus_map; runGraphTool, shutdownGraphChild
│ ├── graph-child.ts # Child-process entry: adopts the parent's cwd/env, runs one job, reports fatal web-tree-sitter state
│ ├── mermaid.ts # parseMermaid — Mermaid flowcharts/state diagrams → Prolog facts
│ ├── type-env.ts # TS/JS three-tier type inference + class field/method extraction
│ ├── resolve-calls.ts # Project-wide QN resolution: inheritance-aware field/method registry
│ ├── tsconfig-aliases.ts # Parses tsconfig.json paths/baseUrl with JSONC + extends chain
│ ├── suffix-index.ts # Suffix index over batch files for relative import resolution
│ └── adapter-registry.ts # Auto-discovery of chiasmus-adapter-* npm packages
├── search/
│ ├── engine.ts # buildSearchCorpus + runSearch — cosine-sim code search
│ ├── vector-store.ts # In-process linear-scan store; serializable
│ ├── embedding-cache.ts # SHA-256-keyed persistent cache, atomic writes
│ └── index.ts # Module exports
├── llm/
│ ├── types.ts # LLMAdapter + EmbeddingAdapter interfaces, LLMMessage
│ ├── anthropic.ts # Anthropic/DeepSeek/OpenAI provider factories (createLLMFromEnv, createEmbeddingFromEnv)
│ ├── openai-compatible.ts # OpenAI-compatible chat + embedding adapters
│ └── mock.ts # Mock LLM + MockEmbeddingAdapter for testing
tests/ # Unit tests (mirrors src/ structure)
benchmark/ # Benchmark problems (5 problems × traditional + chiasmus implementations)
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 25d ago Changed · -2 lines · -39 tokens per session 020758438afe
- 28d ago Changed · +17 lines · +1,522 tokens per session 1bdb97046148
- 29d ago Changed · +38 lines · +3,620 tokens per session 37c7df0df1f3
- 2mo ago Changed · +15 lines · +569 tokens per session 90a933cf906c
- 2mo ago First seen · 340 lines · 5,563 tokens per session scan A 3774afc2cffa
chiasmus AGENTS.md is an instructions file published in the GitHub repository yogthos/chiasmus (218 stars, last pushed 19d ago), licensed Apache-2.0. It adds 11,235 tokens to every session, about $0.0449 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
chiasmus AGENTS.md compared with instructions from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| chiasmus AGENTS.mdyogthos/chiasmus | Instructions file | 218 | 19d ago | Apache-2.0 | A | 11,235 | Codex, OpenCode |
| vscode buildNext.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 9,719 | GitHub Copilot |
| next.js AGENTS.mdvercel/next.js | Instructions file | 143k | today | MIT | A | 7,461 | Codex, OpenCode |
| langchain AGENTS.mdlangchain-ai/langchain | Instructions file | 149k | yesterday | MIT | A | 4,680 | Codex, OpenCode |
| vscode oss-third-party-notices.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 5,516 | GitHub Copilot |
| vscode copilot-instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 3,093 | GitHub Copilot |
| deepseek-harness AGENTS.mddeepseek-ai/deepseek-harness | Instructions file | 274k | 2d ago | MIT | A | 4,313 | Codex, OpenCode |