Repository navigation
Releases
µNorman 0.5.0
What's Changed
- types/ownership by @iliketocode2 in #3
- Type checker steps 5 and 6: reject ill-typed programs, warnings, soundness by @iliketocode2 in #5
- perf/prompt caching by @iliketocode2 in #6
- Plan for agents writing their own limits and diagnostics by @iliketocode2 in #7
Full Changelog: v0.4.0...v0.5.0
v0.4.0 - Checked before it runs
µNorman now checks every program before it runs, and caches prompts so agent loops pay much less for input.
The type checker is finished
- A program that doesn't type-check never runs. Types and effects are inferred, with no annotations, so a type mistake can't spend money.
norman --no-checkruns a program without the checker. ask,callandconsultare checked. Asking for a type that can't be asked for, calling an operation a grant doesn't declare, consulting something that isn't a person, a proposal of the wrong type, and passing a function to a tool are all type errors now.- Effects name what they touch, for example
(-> Text ! ask claude call py). - Concurrent steps can't share a stateful tool. Two
workfloworparsteps using one kernel or filesystem is a type error. Fork the kernel before the workflow. - Warnings for programs that are allowed but break a law's assumptions: a concurrent step that reads
(remaining), two concurrent steps that consult one person, and a consult whose answer is never used. - A
casethat misses a constructor is an error on an answer fromaskorconsult, and a warning otherwise. - Soundness is tested. 400 random programs check the claim that a program which type-checks never hits an error the checker rules out.
Prompt caching
(model [cache 5min])or[cache 1h]caches each ask's prompt. A repeated prefix is read back at a tenth of the input price, or at[cache-read p].- Use it where asks repeat: agent loops,
retry,repair. Writing the cache costs a quarter more than plain input, so a one-off ask costs more with caching, and a caching grant reserves input at that write price. - Prices accept decimals, for example
[in 0.1]. - Scripted runs simulate the cache, so a test's costs are what a live run would pay.
--traceshows how many tokens each ask read from the cache and wrote to it.
Other changes
- The docs site has search (press
/or Ctrl/Cmd+K) and an export as .md button, which gives the language reference as Markdown to paste into an agent's context. - New test form
check-type-error, which passes only when its expression is ill-typed.
Breaking changes
- Ill-typed programs no longer run, and an ill-typed unit test fails without running.
- A name is defined once. Redefining a name, including one from the prelude, is an error.
Anyis removed. Use a type parameter.(catch e x x)is ill-typed unlesseis aFailure. To check how something fails, write(check-expect e (fail φ)):check-expectnow passes when both sides fail with equal failures.- Scripted asks cost more. The scripted tokenizer now counts the answer type's schema, which is usually most of an ask's input. Scripted costs are now about the size of live ones instead of about a thirteenth, so tests with tight cost budgets may need new numbers.
v0.3.0
Typechecker!
Text, (Text n) | a string, at most n bytes when bounded
Num | an integer
Bool | true / false
Sym | a string
(List τ), (List τ n) | an array, at most n elements
a record R | an object with exactly R's fields
constructor K with fields | {"tag": "K", "f₁": …}; a nullary K is {"tag": "K"}
ty ::= Text | (Text numeral) ; optionally bounded, in bytes
| Num | Bool | Sym | Money | Dur
| (List ty) | (List ty numeral)
| Type | Record ; anything you defined
| (Type ty …) ; one with type parameters, applied
| Any ; a placeholder; never askable
A datatype or record can take type parameters, and is then given that many arguments wherever it’s used:
(datatype (Outcome e a) [Got (value a)] [Unsure (why e)])
(ask m (Outcome (Text 40) Num) ctx) ; a (Got 7), or an (Unsure "…")
A type variable may appear only inside the definition that declares it, and inside its own definition a type is applied to exactly its own parameters: (Tree a), never (Tree (List a)).
A type is askable when it is built only from Text, Num, Bool, Sym, List, and datatypes or records whose fields are all askable, at the arguments given: (Option Num) is askable and (Option Any) isn’t. Any, Money and Dur are not askable; JSON has no amounts of money or time.
That one rule is what keeps authority unforgeable: a capability is not an askable type, so no model answer can ever contain a tool. Authority comes only from the host.
A bound caps the answer's size, which caps the reservation. A Verdict with 400-byte reasons reserves far less than the same type with unbounded text, so it fits budgets the unbounded one is refused by.
The type is also sent with every ask, as a JSON schema, and billed as input. The project's first real API call spent 538 input tokens on a 175-character prompt, 478 of them on the schema. So bounding an answer shrinks the reservation, while adding a constructor or a field makes every ask dearer on input for as long as the program runs. No bound on the text inside those fields helps, because what is sent is the schema, not the answer.
How a type maps to JSON
µNorman JSON
Text, (Text n) a string, at most n bytes when bounded
Num an integer
Bool true / false
Sym a string
(List τ), (List τ n) an array, at most n elements
a record R an object with exactly R's fields
constructor K with fields {"tag": "K", "f₁": …}; a nullary K is {"tag": "K"}
v0.2.0 - CP-Agent
CP-Agent now solves problems against a real model and a real Python kernel. The Demo page has the traces.
New
show: writes any value as text that reads back, so a value can go into a prompt and come back out:validate (show v) τ = v. Plussubstring,string-truncateandstring-contains?.- Typed tool results. A grant declares what each operation answers with:
(grant py (kernel [exec (Text 4000)] [count Num])). Declaring anything closes the interface. Calling an operation it never named is an error. - Real tool hosts in live mode and a Python kernel to go in one.
Breaking
Every .nrm file from v0.1.0 still runs. Cap gained an ops field, HostSpec::Kernel and its siblings now carry one, and Prim::ALL is longer.
The Python kernel has no sandbox. It runs model-written code with your permissions.
v0.1.0 - A small language for AI agents
µNorman is a programming language for writing AI agents. It's designed in the style of Norman Ramsey's Programming
Languages: Build, Prove, and Compare: the meaning of every construct is written down before it is implemented, and the properties it promises are proved.
This is the first tagged release. It's a research prototype so there's still a lot to test out and issues to resolve!
Try it without installing anything
https://iliketocode2.github.io/Norman/
The interpreter is compiled to WebAssembly, so every example on the site runs.
What's in it
- Typed model calls.
asknames the type of the answer; the reply is validated against it or the ask fails. - Answers as choices. Sum types, so an agent loop is ordinary case analysis.
- Budgets that can't be overspent. Money and time
- Failures as values.
Invalid,ToolError,Refused,OverBudget,PastDeadline,Raised.
Evidence
- 52 Rust tests and 119 µNorman unit tests, plus 8 deliberately wrong tests that must fail
- 13 algebraic laws checked on 150 randomly generated scripts each, and 3 known-false laws
Not yet
- No static checking. Every guarantee above is enforced when the program runs.
- No real tools.
callis scripted. - A very small standard library. No number-to-string, no substring, no way to render a value back into a prompt.
- Performance is a hypothesis.
Licence
Dual-licensed MIT or Apache-2.0. The papers in theory/ are not covered by it
and remain the copyright of their authors.