E0-1: Agent Reference Bundle and Phase 2 baseline
- docs/agent/bundle.txt: minimal AIR reference by file and section (grammar, instructions, types, traps, verifier rules, resources, effects, capabilities, intrinsics, heap/regions, unsafe, runtime contract, diagnostics and registries); syntax-example.air verifies and runs - zig build agent-reference: deterministic bundle and report (files, sections, bytes, lines, words); section extraction ignores fenced code - tools/agent_bundle_tokens.py: cl100k_base, o200k_base and Qwen2.5 BPE counts; growth warnings >10 % and review >20 % against history.json - baseline after Phase 2: 104 250 bytes, 16 197 words, ~27.3k tokens - CI builds the bundle and counts tokens (non-blocking) - evaluation protocol 0.2: benchmark families, Aji/AIR and Aji/source conditions, 36-run engineering smoke test, order of work - RFC template and AGENTS.md: report bundle growth
This commit is contained in:
1 parent
72192c2331
commit
6eceb4405b
13 files changed
+470
-11
No files matched your search
@@ -0,0 +1,47 @@
|
||||
# Agent Reference Bundle
|
||||
|
||||
Non-normative tooling for spec 14 §3.7. The bundle is the minimal material a model must receive to write correct AIR without access to the rest of the repository. Its size is a language complexity metric.
|
||||
|
||||
| File | Purpose |
|
||||
|---|---|
|
||||
| [bundle.txt](bundle.txt) | manifest: files and sections in bundle order |
|
||||
| [syntax-example.air](syntax-example.air) | the one example in the bundle: a minimal syntax reference that verifies and runs |
|
||||
| [history.json](history.json) | recorded measurements, one entry per milestone |
|
||||
|
||||
## Contents
|
||||
|
||||
Included: AIR text grammar and format rules, instruction set, type and integer semantics, traps, verifier rules (limits, borrows, facts, initialization, stage order), resources, effects, capabilities, intrinsics, heap and regions, unsafe boundaries, the deterministic runtime contract, the diagnostic format and all registries (codes, features, effects, capabilities, intrinsics).
|
||||
|
||||
Excluded: RFC rationale, plans and roadmap, design history, README prose, benchmark descriptions, examples other than the syntax reference.
|
||||
|
||||
A section enters the bundle through `bundle.txt` only. When a semantic RFC adds normative text an agent needs, the RFC adds the corresponding entry.
|
||||
|
||||
## Measuring
|
||||
|
||||
```sh
|
||||
zig build agent-reference # zig-out/agent/reference-bundle.md, report.json
|
||||
uv run --with tiktoken --with tokenizers tools/agent_bundle_tokens.py
|
||||
uv run --with tiktoken --with tokenizers tools/agent_bundle_tokens.py --record "<milestone>"
|
||||
```
|
||||
|
||||
Counted: files, sections, bytes, lines, words, and tokens with OpenAI `cl100k_base` and `o200k_base` and the independent byte-level BPE of Qwen2.5. The trend matters more than any single tokenizer.
|
||||
|
||||
## Growth policy
|
||||
|
||||
Compared with the last recorded milestone:
|
||||
|
||||
| Growth per semantic RFC | Consequence |
|
||||
|---|---|
|
||||
| ≤ 10 % | none |
|
||||
| > 10 % | CI warning |
|
||||
| > 20 % | review required: the RFC explains the growth in its *Agent complexity impact* section |
|
||||
|
||||
Growth never blocks a merge automatically; a complex feature can be justified, but not silently.
|
||||
|
||||
## Milestones
|
||||
|
||||
| Milestone | Files | Sections | Bytes | Words | cl100k | o200k | Qwen2.5 |
|
||||
|---|---:|---:|---:|---:|---:|---:|---:|
|
||||
| Phase 2 baseline (AIR format 0) | 18 | 29 | 104 250 | 16 197 | 27 347 | 27 445 | 28 230 |
|
||||
|
||||
Next measurement: after Phase 3 (structured concurrency).
|
||||
@@ -0,0 +1,63 @@
|
||||
# Agent Reference Bundle manifest (spec 14 §3.7).
|
||||
#
|
||||
# The minimal material a model must receive to write correct AIR without the
|
||||
# rest of the repository. One entry per line:
|
||||
# <path> the whole file
|
||||
# <path> :: <heading prefix> one section: the heading that starts with the
|
||||
# prefix and everything up to the next heading
|
||||
# of the same or a higher level
|
||||
# Order is the order of the bundle. Rationale (RFCs), plans, design history,
|
||||
# README prose and benchmark descriptions are deliberately absent.
|
||||
|
||||
# Minimal syntax reference
|
||||
docs/agent/syntax-example.air
|
||||
|
||||
# AIR text grammar and format rules
|
||||
docs/reference/air-text.ebnf
|
||||
docs/spec/07-air.md :: ## 8. Text AIR
|
||||
|
||||
# Instruction set, run results, canonical record
|
||||
docs/spec/07a-air-instructions.md
|
||||
|
||||
# Types and integer semantics
|
||||
docs/spec/02-types-and-values.md :: ## 2. Integer semantics
|
||||
|
||||
# Traps
|
||||
docs/spec/01-language-overview.md :: ## 6. Trap
|
||||
|
||||
# Verifier: limits and accounted sizes, borrows, facts, initialization, stage order
|
||||
docs/spec/08-verifier.md :: ## 7. Bounded analysis
|
||||
docs/spec/08-verifier.md :: ## 11. Borrow verification
|
||||
docs/spec/08-verifier.md :: ## 12. Bounds facts
|
||||
docs/spec/08-verifier.md :: ## 13. Initialization
|
||||
docs/spec/08-verifier.md :: ## 14. Stage order
|
||||
|
||||
# Effects, capabilities, intrinsics
|
||||
docs/spec/05-effects-and-capabilities.md :: ## 9. Effects in AIR
|
||||
docs/spec/05-effects-and-capabilities.md :: ## 10. Capabilities in AIR
|
||||
docs/spec/05-effects-and-capabilities.md :: ## 11. Intrinsic calls
|
||||
docs/spec/05-effects-and-capabilities.md :: ## 12. Runtime
|
||||
|
||||
# Resources and I/O errors
|
||||
docs/spec/06-resources-and-errors.md :: ## 6. Resources in AIR
|
||||
docs/spec/06-resources-and-errors.md :: ## 7. I/O errors
|
||||
|
||||
# Heap, regions, budgets
|
||||
docs/spec/03-memory-model.md :: ## 18. Allocation authority in AIR
|
||||
docs/spec/03-memory-model.md :: ## 19. Heap in AIR
|
||||
docs/spec/03-memory-model.md :: ## 20. Regions in AIR
|
||||
|
||||
# Unsafe boundaries
|
||||
docs/spec/13-contracts-and-unsafe.md :: ## 6. Unsafe code in AIR
|
||||
|
||||
# Deterministic runtime contract: fuel, profiles, PRNG
|
||||
docs/spec/11-determinism-and-replay.md :: ## 7. Execution limits
|
||||
docs/spec/11-determinism-and-replay.md :: ## 8. Execution profiles
|
||||
|
||||
# Diagnostics format and registries
|
||||
docs/spec/10-diagnostics-and-agent-protocol.md :: ## 2. Stable codes
|
||||
docs/reference/error-codes.md
|
||||
docs/reference/air-features.md
|
||||
docs/reference/effects.md
|
||||
docs/reference/capabilities.md
|
||||
docs/reference/intrinsics.md
|
||||
@@ -0,0 +1,18 @@
|
||||
[
|
||||
{
|
||||
"label": "phase-2 baseline (AIR format 0)",
|
||||
"language": "aji",
|
||||
"air": 0,
|
||||
"phase": 2,
|
||||
"files": 18,
|
||||
"sections": 29,
|
||||
"bytes": 104250,
|
||||
"lines": 1630,
|
||||
"words": 16197,
|
||||
"tokens": {
|
||||
"cl100k_base": 27347,
|
||||
"o200k_base": 27445,
|
||||
"qwen2.5": 28230
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,38 @@
|
||||
; Minimal syntax reference for text AIR format 0 (part of the Agent Reference Bundle).
|
||||
; Run: aji run --grant out=io.write --grant heap=mem.alloc:64 docs/agent/syntax-example.air
|
||||
module example.syntax
|
||||
air 0
|
||||
lang 0.1
|
||||
features [arrays, capabilities, effects, heap, ownership, resources]
|
||||
|
||||
type @Pair = struct { a: u8, b: u8 }
|
||||
|
||||
; Entry point: capabilities arrive as named parameters.
|
||||
fn @main(%out: cap<io.write>, %heap: cap<mem.alloc>) -> u8
|
||||
effects [io.write, mem.alloc]
|
||||
entry:
|
||||
%msg = local.alloc array<u8, 3> ; frame storage, only in entry
|
||||
%c = const.u8 104 ; 'h'
|
||||
%arr = array.splat array<u8, 3> %c
|
||||
local.store %msg, %arr ; initializes the local
|
||||
%r = borrow.ref %msg ; second-class borrow
|
||||
%s = slice.make %r
|
||||
intrinsic io.stdout_write(%out, %s), ok -> @written, err -> @io_failed
|
||||
written:
|
||||
borrow.end %s ; every borrow ends on every path
|
||||
borrow.end %r
|
||||
%one = const.u8 1
|
||||
%two = const.u8 2
|
||||
%p = struct.make @Pair(%one, %two)
|
||||
own.new %p, %heap, ok -> @owned, err -> @no_memory
|
||||
owned(%o: own<@Pair>): ; results arrive as block parameters
|
||||
%v = own.take %o ; linear owner consumed
|
||||
%b = struct.get @Pair.b, %v
|
||||
%sum = add.checked.u8 %b, %one ; traps T0003 on overflow
|
||||
br @done(%sum)
|
||||
done(%result: u8):
|
||||
ret %result
|
||||
io_failed(%e: io_error):
|
||||
trap
|
||||
no_memory(%a: alloc_error):
|
||||
trap
|
||||
Reference in new issue
Block a user