Commit d5cbf17
LLM discoverability: builtin metadata registry + introspection + did_you_mean
The discoverability layer that lets LLMs write OMC code without seeing
it in training data. Adds a structured BuiltinDoc registry in
omnimcode-core/src/docs.rs — currently 97 entries across 14 categories,
13 of them flagged unique_to_omc for the substrate-aware primitives
that have no Python equivalent.
New runtime introspection builtins:
omc_help(name) — dict of {name, category, signature,
description, example, unique_to_omc}.
On miss, returns {found:0, did_you_mean:[...]}.
omc_list_builtins(cat?) — all names, optionally filtered by category
omc_categories() — every distinct category
omc_did_you_mean(name, k?) — closest-name suggestions by edit distance
omc_unique_builtins() — only the OMC-only stuff (substrate, autograd,
lazy generators, harmonic ops)
Error messages: "Undefined function: arr_softmx" now becomes
"Undefined function: arr_softmx (did you mean: arr_softmax?)" — by
running the unknown name through the same Levenshtein suggester.
New CLI mode: `omc --gen-docs > OMC_REFERENCE.md` streams the full
registry as Markdown. The committed OMC_REFERENCE.md (1055 lines)
is the canonical prompt-injection material for LLM clients — a few
KB of structured signatures + descriptions + examples that an LLM
can read once and write idiomatic OMC.
Tests: 13 cases covering omc_help on known/unknown/substrate/standard
builtins, category filtering, did_you_mean close/no-match/limit
semantics, the unique-builtins surface, and that unknown-function
runtime errors carry the suggestion in their message.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 87f2acd commit d5cbf17
7 files changed
Lines changed: 2155 additions & 1 deletion
File tree
- examples/tests
- omnimcode-cli/src
- omnimcode-core/src
0 commit comments