anrlc — the compiler
a single rust binary. six pipeline stages. compile any supported format to an anrl graph — one file or an entire project directory.
anrlc compile
converts a source file or an entire project directory into anrl. when the input is a directory, it enters project mode — walking the tree, resolving cross-file imports, and writing a mirror tree with a manifest.
# single file $ anrlc compile input.json # single file to stdout $ anrlc compile input.json --stdout # project mode — entire directory $ anrlc compile ./src/ --semantic off # with semantic enrichment and snapshot $ anrlc compile data.json --semantic on --snapshot pre-refactor
flags
| flag | default | description |
|---|---|---|
-o, --output <PATH> | auto / <dir>-anrl/ | destination file (single-file) or directory (project mode) |
--stdout | false | print result to terminal — single-file only |
-f, --format <text|bin> | text | output format. bin uses messagepack — 1.2–2.7× larger than text in practice |
--optimize <low|high> | high | high enables full semantic pipeline and graph-opt |
--min-confidence <f32> | 0.3 | prune nodes below this epistemic threshold [0.0–1.0] |
--input-format <fmt> | auto | override format detection (json, yaml, md, txt, anrl, py, rs, ...) |
--semantic <off|auto|on> | auto | fastembed enrichment mode. auto triggers on island detection + prose entropy |
--semantic-alpha <f32> | 0.75 | precision threshold for --implies--> similarity links [0.0–1.0] |
--exclude <GLOB> | — | exclude paths matching this glob (repeatable, project mode) |
--anchor-top <N> | 5 | number of north star anchors duplicated per file (project mode) |
--no-anchors | false | skip anchor duplication (project mode) |
--no-manifest | false | skip writing project.manifest.json (project mode) |
--snapshot [LABEL] | — | capture a snapshot under <source>.anrl-state/ after compile |
multi-file compilation
when the input is a directory, anrl walks the tree and runs a seven-stage pipeline — resolving cross-file imports, linking shared entities, and writing a graph-native manifest you can query programmatically.
seven-stage pipeline
output layout
project-anrl/
├── project.manifest.json
├── project.anchors.anrl
├── src/
│ ├── main.anrl
│ └── utils.anrl
└── config/
└── settings.anrl$ anrlc compile examples/project/ ✓ 12 files compiled, 847 entities, 634 links ✓ wrote examples/project-anrl/
parse, stats, and inspection
utility commands for inspecting existing anrl files and auditing source files before compilation.
anrl parse
pretty-prints an existing .anrl file for human inspection. useful for verifying compiler output before injecting into llm context.
$ anrlc parse output.anrlanrl stats
diagnostic audit of a source file — shows size, estimated tokens, anrl token count, and savings percentage. good for deciding whether to use semantic enrichment.
$ anrlc stats data.yaml source: 575 tokens anrl: 984 tokens savings: −71.1% (helm values — deep nesting)
snapshot, diff, and stream
anrl graphs evolve over time. three subcommands capture, compare, and aggregate that evolution — enabling graph-native change tracking and rolling event aggregation.
saves the current graph for a source file under <source>.anrl-state/<timestamp>-<label>.anrlb and updates a sidecar manifest.json. snapshots can also be triggered automatically as part of a compile (--snapshot flag).
anrlc snapshot save examples/code/api.py --label v1 anrlc snapshot list examples/code/api.py anrlc snapshot show examples/code/api.py --label v1 anrlc compile src/ --snapshot pre-refactor
computes a graph delta and renders it as a transition graph using ~recent (added), ~expired (removed), and => (modified) markers. either side can be a source file, directory, .anrl, .anrlb, or a snapshot reference of the form <path>@<label>. apply(invert(d), b) == a is a hard invariant.
anrlc diff examples/temporal/before examples/temporal/after anrlc diff before/ after/ -o changes.anrldiff anrlc diff src/@v1 src/@v2 # snapshot refs anrlc diff after/ before/ --invert # reversible
aggregates a jsonl event log (or raw anrl lines, auto-detected per line) into a rolling graph. temporal decay: events older than --window seconds receive ~expired. reads stdin if input == '-'. supported event kinds: entity, edge, causal, primitive, expire. lines starting with @ are parsed as raw anrl.
anrlc stream examples/stream/events.jsonl anrlc stream events.jsonl --window 60 anrlc stream events.jsonl --every 50 tail -F log.jsonl | anrlc stream - --every 50