Predictive debugging
While the debugger is paused, Axiom shows what the next statements of the paused function will do: values assigned, which way a condition goes, which branch cannot run, what the function returns and where it will fail. It works this out from the source and the values the debugger already shows. Nothing runs: no evaluation, no call, no step, no network, and no AI.
It is on by default and works with AI turned off. Turn it off in the Debug panel (Predict next steps), for one language there, or in settings.toml:
[prediction]
enabled = true
languages = { rust = false } # per-language override
What you see
| Display | Meaning |
|---|---|
predicted: c = 16 at the end of a line | the value the statement will assign |
predicted: condition true | the condition's outcome |
| Muted, struck-through lines | a branch that will not run |
› in the gutter | the next statement to run |
× in the gutter and predicted failure: … | a statement that will panic or throw |
predicted return: 5 | the value the function will return |
prediction stops: calls are not followed | where the analysis gives up, and why |
Every note says "predicted" so it is never mistaken for an observed value, and none relies on colour alone. Hovering a note shows the evidence (the observed values used, and that the source matched what was running) and the assumptions. The Debug panel shows the same summary as text. Everything disappears the moment the program resumes, the frame changes, the file is edited or prediction is turned off.
How it works
- Context. Session, suspend generation, thread, frame, line, file, document revision, provider and the observed locals. A result is shown only while its context is current, and cached (8 entries) by the whole context.
- One worker at a time. A new context cancels the running prediction and waits in a single slot; it never queues more.
- Source match. The worker reads the file and checks it against the content hash taken at launch and, for a compiled program, the build time. A file with unsaved edits, changed on disk or not part of the program is reported instead of predicted.
- Typed values only. The language's provider turns each local the debugger reported into an exact value only when the adapter's type name is one it renders exactly (
int,bool, …) and the text parses exactly. Everything else (strings, objects, floats,u8shown as a character) is opaque, and using it stops the prediction. - Inspection without side effects. The debugger lists a frame's locals only when asked. The core asks itself only when the language's debug provider says listing locals runs no program code (lldb-dap reads memory and debug information). debugpy shows values with
repr()and netcoredbg may call property getters, so for Python and C# prediction waits until you open Locals. - Limits. Source size (1 MiB), syntax nodes (20,000), nesting (48), conditions (32), statements (64), integer size (120 bits for Python), annotations (64), value length (48 characters) and time (250 ms). Reaching one ends the prediction and says so.
What each language models
Each language has its own interpreter over its Tree-sitter syntax, starting at the paused statement and staying in the current function. It follows straight-line code, assignments, if/else and return; it stops at calls, loops (including the end of a loop body), fields, indexing, casts and anything else it does not model. An unknown condition stops it: no branch is guessed.
| Rust | C# | Python | |
|---|---|---|---|
| Values | i16…i128, u16…u128, isize/usize, bool | sbyte…ulong, bool, null | exact int, bool, None |
| Integers | width and sign from the debugger's type; unsuffixed literals need a typed operand | binary numeric promotion (byte + byte is int) | arbitrary precision, bounded |
| Overflow | panics or wraps per overflow-checks; unknown when that is not known | throws in checked, wraps in unchecked; outside both, unknown unless CheckForOverflowUnderflow is known | none |
| Division | truncates; / 0, % 0, MIN / -1 panic | truncates; / 0 throws; MIN / -1 throws when checked, unknown otherwise (implementation-defined) | // floors, % takes the divisor's sign; / proves only ZeroDivisionError |
| Short circuit | &&, ` | ` | |
| Null | none (Option is not modelled) | null string receiver proves NullReferenceException for a few System.String instance members | None in arithmetic or ordering proves TypeError; a non-dunder attribute proves AttributeError |
| Not modelled | macros, match, references, shifts, as, floats | char, floats, decimal, nullable value types, shifts, casts | floats, str, **, shifts, is between integers |
Build settings are not read yet, so Rust overflow and C# overflow outside an explicit context are reported as unknown. usize is taken to be the width of the computer running Axiom. A Python value whose type debugpy names int is taken to be the built-in int.
Testing
- Truth tables per language in
ide-languages(negative division, overflow by build mode, zero,MIN / -1, short circuit around an unknown call, early return,null/None, unsupported calls, shadowed locals, limits and cancellation). ide-coretests/prediction.rswith the fake adapter: no request other than inspection reaches the adapter, resume hides at once, the guarantee for listing locals, unsaved edits, changed sources, settings, tiny limits, and a slow provider whose superseded result is cancelled and never shown.tests/debug_real.rs(opt-in): with lldb-dap, debugpy and netcoredbg, a call is unknown, assignment, branch and return are predicted and then the real steps follow the predicted lines, and a predicted failure is then observed in the program's output.
See debugging for the debugger itself and ADR 0023 for the decision.