infer
AGENTS.md16k starsChanged 13 days agoMITView on GitHub
This file provides guidance to Open Code / Codex / Claude Code (claude.ai/code) when working with code in this repository. Infer is a multi-language static analysis tool developed by Meta. It detects bugs in Java, C, C++, Objective-C, Erlang, Hack, Python, Rust, Swift, and C# code. The primary implementation language is OCaml. All build commands run from the repository root. You must have run ./build-infer.sh and make devsetup initially. Direct test names follow the pattern {lang}{analyzer}, e.g., directjavapulsetest, directcpppulsetest, directcfrontendtest.…
We split this AGENTS.md into the rules it gives an agent
7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
All build commands run from the repository root.
- Distinctive: line 45
Test procedure naming conventions:
- Very specific: line 101
Polymorphic equality is disabled: Use type-specific equality (e.g., Int.equal, String.equal).
- Very specific: line 109
Printf debugging: Use Logging.debug_dev (triggers a warning to prevent accidental commits).
- Very specific: line 110
Use [@@deriving compare, equal] for comparison/equality derivations.
- Very specific: line 111
Use named arguments when purpose isn't obvious, especially for bool/int params and function-typed params (conventionally named f).
- Very specific: line 112
Avoid globally opening modules other than IStd and PolyVariantEqual.
≈ “Common” is an estimate: at least 1 in 5 of the 36,368 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
This file provides guidance to Open Code / Codex / Claude Code (claude.ai/code) when working with code in this repository.
What is Infer?
Infer is a multi-language static analysis tool developed by Meta. It detects bugs in Java, C, C++, Objective-C, Erlang, Hack, Python, Rust, Swift, and C# code. The primary implementation language is OCaml.
Build Commands
All build commands run from the repository root. You must have run ./build-infer.sh and make devsetup initially.
| Command | Purpose |
make -j | Full native build (default dev mode, warnings are fatal) |
make -j BUILD_MODE=dev-noerror | Build ignoring warnings |
make -j -C infer/src check | Type-check only (fastest iteration cycle, requires prior full build) |
make -j -C infer/src byte | Bytecode build (for testing changes quickly) |
make opt | Optimized build with flambda |
make fmt | Format changed OCaml files with ocamlformat |
make fmt_all | Format all OCaml files |
Testing
| Command | Purpose |
make -j 4 test | Run all tests (adjust parallelism to your cores) |
make -j test_build | Verify build has no warnings |
make test-replace | Update expected test outputs after intentional changes |
make direct_{lang}_{analyzer}_test | Run a single test suite (rebuilds infer first) |
make -C infer/tests/codetoanalyze/{lang}/{analyzer}/ test | Run a single test suite (assumes infer is up-to-date) |
make ocaml_unit_test | Run OCaml unit tests only |
make swift_tests | Run Swift tests (separate from main test target) |
Direct test names follow the pattern {lang}_{analyzer}, e.g., direct_java_pulse_test, direct_cpp_pulse_test, direct_c_frontend_test. These are defined in the DIRECT_TESTS variable in the root Makefile.
Test structure
Tests live in infer/tests/codetoanalyze/{language}/{analyzer}/. Each test directory has:
- Source files to analyze
issues.expwith expected output (one issue per line)Makefilethat runs infer and diffs output againstissues.exp
Test procedure naming conventions:
*Bad— should report an error*Ok— should not report an errorFP_*— false positive (known limitation, include explanatory comment)FN_*— false negative (known limitation, include explanatory comment)
Debugging analysis
infer --debug -- clang -c examples/hello.c
firefox infer-out/captured/hello.c.*.htmlArchitecture
Frontends (language → SIL translation)
Each supported language has a frontend that translates source code into SIL (Separation Logic Intermediate Language), defined in infer/src/IR/:
| Directory | Language | Mechanism |
clang/ | C/C++/Objective-C | Custom clang plugin (facebook-clang-plugins/) |
java/ | Java | javalib/Sawja bytecode parsing |
erlang/ | Erlang | Erlang compiler integration |
python/ | Python | PyML-based frontend |
rust/ | Rust | Charon IR translation |
llvm/ | LLVM bitcode | LLVM OCaml bindings (used by Swift) |
textual/ | Textual SIL | Text-based SIL representation (Hack, Python, LLVM) |
Intermediate Representation (infer/src/IR/)
Core types: Sil.ml (instructions), Procdesc.ml (procedure descriptors), Typ.ml (types), Procname.ml (procedure names), Tenv.ml (type environments).
Analysis engines
- Pulse (
pulse/, ~150+ files) — The main abstract domain. Handles memory safety, taint tracking, null safety, resource leaks via abductive reasoning. - Abstract interpretation framework (
absint/) —AbstractDomain.ml,AbstractInterpreter.mldefine the fixpoint computation infrastructure. - Buffer overrun (
bufferoverrun/) — Array bounds analysis. - Concurrency (
concurrency/) — Race condition detection (RacerD). - Cost (
cost/) — Computational cost analysis. - TOPL (
topl/) — Temporal property checking. - Checkers (
checkers/) — Miscellaneous checkers (liveness, purity, annotations, etc.).
Backend (infer/src/backend/)
Analysis scheduling (AnalysisDependencyGraph.ml), call graph construction (CallGraph.ml), checker registration (callbacks.ml), reporting.
Configuration (infer/src/base/Config.ml)
Very large file (~189KB) defining all command-line options. Uses CommandLineOption module (aliased CLOpt).
OCaml Coding Conventions
- 100-character line limit. Format with
ocamlformat. IStdis auto-opened in every file. Always writeopen! IStdexplicitly at the top.- Polymorphic equality is disabled. Use type-specific equality (e.g.,
Int.equal,String.equal). UsePolyVariantEqualonly for modules heavy on argument-free polymorphic variants. - Standard module aliases (use consistently, do not alias these names to other modules):
module CLOpt = CommandLineOption module F = Format module L = Logging module MF = MarkupFormatter - Printf debugging: Use
Logging.debug_dev(triggers a warning to prevent accidental commits). - Use
[@@deriving compare, equal]for comparison/equality derivations. - Use named arguments when purpose isn't obvious, especially for bool/int params and function-typed params (conventionally named
f). - Avoid globally opening modules other than
IStdandPolyVariantEqual. - OCaml debugger: Module
Mis reallyInferModules__M(orInferBase__M, etc.) when setting breakpoints inocamldebug.
Key Files
infer/src/base/Config.ml— All CLI optionsinfer/src/IR/Sil.ml— SIL instruction definitionsinfer/src/absint/AbstractInterpreter.ml— Fixpoint computationinfer/src/pulse/PulseAbductiveDomain.ml— Pulse's core abstract stateinfer/src/dune— Main dune build config (generated fromdune.common+dune.in)Makefile— Test targets and build orchestration
Trending
Less talk lately.about the whole repository
Who's talking about facebook/infer
- Meta Open Source“ELI5: Infer”YouTube · Feb 3, 2021 · 8.7k views
- Modern Learner“Infer - Getting Started / Hello World / Static Analysis for Java and Objective C”YouTube · Sep 28, 2020 · 616 views
- ODS AI Ru“Виктория Ханиева: Антидоклад. Нужно ли статическому анализу машинное обучение?”YouTube · Nov 9, 2020 · 582 views
- Stack Overflow“DivideByZeroException compiler check complexity: easier or harder in MSIL vs C# or no difference?”Stack Overflow · Jan 9, 2018 · 13 votes
- meta/infer“Docker image: facebook-clang-plugins/clang/src/download/llvm missing please run `src/prepare_clang_src.sh`”GitHub · Sep 30, 2020 · 7 reactions
The biggest 5 of 40 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 40
Talked about on GitHub, YouTube, Stack Overflow and Hacker News (40 times).
On GitHub · 32
- Sep 30, 2020Docker image: facebook-clang-plugins/clang/src/download/llvm missing please run `src/prepare_clang_src.sh` — meta/infer7 reactions · 3 comments
- Nov 19, 2019Add support for Meson build system — meta/infer4 reactions · 5 comments
- Jun 20, 2018how to use infer for cross compile — meta/infer3 reactions · 8 comments
- Aug 16, 2017Unexpected warning 60 (unused module declaration) on module declared but not used in the same source file — ocaml/merlin3 reactions · 1 comment
- Oct 25, 2022Unable to upload "infer-out/report.sarif" as it is not valid SARIF - startColumn/startLine must have a minimum value of 1 — microsoft/infersharpaction2 reactions · 5 comments
27 more on GitHub
- Jul 9, 2021Missing break between record pattern and attribute — ocaml-ppx/ocamlformat2 reactions
- Oct 1, 2024[engine] 로그 개수에 맞는 쓰레드 생성 — githru/githru-vscode-ext1 reaction · 1 comment
- Sep 15, 2024Provides a snippet that works correctly when installing from binaries. — meta/infer1 reaction · 2 comments
- May 17, 2023pulse NULLPTR_DEREFERENCE False negative when run the java example in checker-pulse doc — meta/infer1 reaction
- Sep 26, 2021Infer can't run on Xcode 13 with Big Sur — meta/infer1 reaction · 5 comments
- Feb 28, 2021Build your own Resource Leak analysis, outdated README — meta/infer1 reaction · 3 comments
- Dec 24, 2020Merge language-agnostic layer back to Infer — microsoft/infersharp1 reaction · 1 comment
- Sep 24, 2020Is it possible to add checkers for Java? — meta/infer1 reaction · 1 comment
- Jan 9, 2020Makefile.config:15: Makefile.autoconf: No such file or directory — meta/infer1 reaction · 4 comments
- Apr 26, 2019replace Assertation lib to AssertationError which already have — proyecto26/react-native-inappbrowser1 reaction · 2 comments
- Feb 8, 2019Infer installs infer.exe binary — meta/infer1 reaction · 4 comments
- Apr 16, 2018Feature Request: Support for tool `infer` / fbinfer.com — dense-analysis/ale1 reaction
- Aug 10, 2016Help with understanding do_analysis in Interproc.ml — meta/infer1 reaction · 1 comment
- Oct 19, 2026[ci] cache the Maven repository in the Build Infer job — meta/infer0 reactions
- Jul 9, 2026fix memory leak sample code in C — meta/infer0 reactions · 2 comments
- Jul 9, 2026Fix function declaration syntax for memory leak example — fu7mu4/infer0 reactions
- Jun 26, 2026[ci] fix the macOS build on the GitHub CI — meta/infer0 reactions
- May 4, 2026[infer][ci] add ARM macOS to the list of build targets — meta/infer0 reactions · 2 comments
- Mar 17, 2026[rust] recursive mk_tuple_type — meta/infer0 reactions · 2 comments
- Mar 17, 2026[rust] Global places — meta/infer0 reactions · 4 comments
- Feb 18, 2026Move ghost-field models to public wrappers and fix FreezeRef value propagation — sblackshear/sui-bytecode-analysis0 reactions
- Jan 30, 2026ci: add Infer static analysis workflow — dloebl/cgif0 reactions · 1 comment
- Dec 20, 2025Update declared license for maven:infer-annotation 0.11.0 — clearlydefined/curated-data0 reactions · 2 comments
- Dec 16, 2025[website] fix download link for infer binary on Linux — meta/infer0 reactions · 2 comments
- Oct 28, 2025MDBF-143: Add infer (container build) — MariaDB/buildbot0 reactions · 1 comment
- Aug 4, 2025com.facebook.infer.annotation:infer-annotation 0.11.0 — clearlydefined/curated-data0 reactions · 1 comment
- Jun 28, 2025Fix broken link to Eradicate in README.md — uber/NullAway0 reactions · 2 comments
On YouTube · 3
- Feb 3, 2021ELI5: Infer — Meta Open Source8.7k views · 3 comments
- Sep 28, 2020Infer - Getting Started / Hello World / Static Analysis for Java and Objective C — Modern Learner616 views
- Nov 9, 2020Виктория Ханиева: Антидоклад. Нужно ли статическому анализу машинное обучение? — ODS AI Ru582 views
On Stack Overflow · 3
- Jan 9, 2018DivideByZeroException compiler check complexity: easier or harder in MSIL vs C# or no difference?13 votes
- Sep 25, 2016`brew install infer` error while updating infer4 votes · 1 answer
- Nov 28, 2017What is FNFPlayer? It accesses UIApplication applicationState from background thread3 votes
On Hacker News · 2
- Mar 13, 2021Infer: A static analyzer for Java, C, C++, and Objective-C3 points
- May 24, 2018Infer 0.14.0 released with prototype of Rust-style borrow checker for C++2 points
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 28,693 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

