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.svg" alt="Measured on agentmods" 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.06132 | $0.06132 |
| Opus 5 | $0.03066 | $0.03066 |
| Sonnet 5 | $0.01226 | $0.01226 |
| Haiku 4.5 | $0.00613 | $0.00613 |
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 yesterday.
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 — 355 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
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, all tool handlers, CLI bootstrap
├── config.ts # Loads ~/.chiasmus/config.json
├── solvers/
│ ├── types.ts # SolverType, SolverResult (discriminated union), Solver, SolverInput
│ ├── session.ts # SolverSession — factory for Z3/Prolog solver instances
│ ├── 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
│ └── 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
│ ├── learner.ts # SkillLearner — LLM-driven template extraction from solutions
│ └── 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, forEachUndirectedEdge, undirectedDegree
│ ├── community.ts # Louvain community detection + cohesion score
│ ├── insights.ts # detectHubs, detectBridges, 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)
│ ├── 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.
- yesterday Changed · +15 lines · +569 tokens per session 90a933cf906c
- 6d 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 (210 stars, last pushed yesterday), licensed Apache-2.0. It adds 6,132 tokens to every session, about $0.0307 per session on Opus 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.
Other instructions, from other repositories
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
spec-kit AGENTS.md
AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.