Commit Graph
43 Commits
Author SHA1 Message Date
dev 6eceb4405b 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
2026-10-04 15:44:26 +03:00
dev 72192c2331 spec: agent efficiency objectives and evaluation protocol
- spec 14: Model Capability Compression, design objectives (correctness
  externalization, small semantic surface, explicit semantics, local
  reasoning, machine repairability, deterministic feedback, bounded
  context / Agent Reference Bundle), economic objective, design review
  requirement, hypotheses H1-H6, non-goals, anti-overfitting rule
- docs/evaluation/protocol.md: Agent Language Evaluation Protocol 0.1
  (tasks T01-T10, maintenance and seeded-bug benchmarks, metrics,
  statistics, stages A-E, success and falsification criteria)
- docs/evaluation/README.md: integrity rules, stage readiness
- RFC process: mandatory Agent complexity impact section
- AGENTS.md: overarching objective and anti-overfitting rule
- plan: evaluation track E0-1..E-1; P8-7 integrates ajid with the
  scaffold; conformance plan points to the protocol
2026-10-04 15:36:32 +03:00
dev 778d563182 Phase 2: manifest grants (P2-9) and exit review (P2-12)
- src/manifest.zig: strict aji.toml subset ([package], [capabilities],
  [metadata]); errors with line numbers
- aji run --manifest: entry relative to the manifest, manifest grants
  replaced per parameter by --grant; usage error on manifest problems
- examples/packages/hello as a runnable package, checked in CI
- implemented_phase = 2; Phase 2 exit review; README and AGENTS updated
2026-10-04 15:24:04 +03:00
dev 0948eb7347 spec: accept RFC 0010 and integrate manifest capability grants
spec 12 §1 manifest format with strict TOML subset, [package] entry,
[capabilities] by parameter name, [metadata]; aji run --manifest with
operator precedence of --grant; spec 05 §10.2 and capabilities.md
updated.
2026-10-04 15:22:30 +03:00
dev 27fa98f39d rfc: 0010 capability grants in aji.toml (Proposed)
Manifest [capabilities] uses the --grant model (parameter = kind[:scope]);
the manifest requests and the operator grants via aji run --manifest;
command-line grants replace manifest entries per parameter; strict TOML
subset.
2026-10-04 15:10:42 +03:00
dev b00bac5937 Phase 2: audit report (P2-10)
- spec 10 §6.1: schema of the format-0 audit report (canonical JSON)
- aji report FILE: entry capabilities, per-function effect graph with
  declared/used/unused effects (fixed point over calls, unsafe stopped
  at trusted callees), intrinsics, allocations, runtime and proven
  checks, unsafe operations; capability kinds; unsafe summary
- golden unit test; runs over the whole conformance corpus without a
  crash
2026-10-04 15:03:44 +03:00
dev 36e91be84c Phase 2: hosted profile (P2-8a)
- src/interp/host.zig: real console, files (scope checked before any
  host call, positional reads/writes, append from file size) and TCP
  through std.Io; monotonic clock and host CSPRNG; host errors mapped
  to the closed io_error set; open handles released at the end of the
  instance
- interpreter dispatches intrinsics to the host or the deterministic
  world; never reports blocked in the hosted profile
- CLI: --profile hosted; the program owns stdout/stderr, the run record
  goes to --result-file, otherwise a human summary on stderr
- spec 11 §8.0: host error mapping table
- tests/hosted/smoke.py (file copy, scope denial, stdin->stdout, TCP
  echo on a free port) runs in CI
- works around Zig 0.17 net.Stream.read not compiling by using
  readWithControl
2026-10-04 14:46:40 +03:00
dev 008654999e Phase 2: unsafe operations and trusted boundaries (RFC 0009)
- air: string literals (trusted line only), trusted obligation on
  functions, assume, borrow.index.unchecked
- verifier: unsafe stage (E6001 outside_boundary /
  trusted_declares_unsafe); effect stage leaves unsafe to it, so trusted
  functions discharge it; assume establishes bounds facts
- interp: T0009 for detected unsafe precondition violations
- aji check --report unsafe: trusted functions with obligations, unsafe
  functions, unsafe operations with their boundary
- feature unsafe published and supported; 10 conformance tests;
  3000 mutants without a crash
2026-10-04 14:41:30 +03:00
dev c510a37cf9 spec: accept RFC 0009 and integrate unsafe boundaries
- spec 13 §6-§8: unsafe operations (assume, borrow.index.unchecked),
  contagious unsafe effect, trusted boundary with obligation, E6001,
  unsafe report, profiles as policy
- spec 05 §9.3: trusted is the one discharging boundary; spec 07 §8.10
  trusted syntax; 07a, 08 stage order and assume facts
- T0009, E6001 reasons; feature unsafe published
2026-10-04 14:38:53 +03:00
dev 17ddb98597 rfc: 0009 unsafe operations and trusted boundaries (Proposed)
Feature unsafe: assume and borrow.index.unchecked as the first unsafe
operations, unsafe as a contagious flat effect, trusted functions with a
documented obligation as the only discharging boundary, E6001, T0009
detected precondition violations, unsafe report.
2026-10-04 14:30:59 +03:00
dev 7f4ce71d44 Phase 2: heap, regions and allocation budgets (RFC 0008)
- air: own<T>, own_array<T>, region, alloc_error; own.new/array/take/
  free, region.create/new/array/reset/destroy; mem.alloc budget form;
  linear contents of owners gated by linear_aggregates
- verifier: allocation types and capability kind (E1001, E3201),
  mem.alloc effect (E3101), ok/err counts; borrow-typed block params
  checked in the CFG stage with the region-allocation exception; linear
  owners and regions (E3002, E3001, E2001, E2002, E2101); region
  allocations as disjoint exclusive children of the shared region
  borrow; E2104 when reset/destroy would invalidate a live reference
- interp: live-byte budgets charged along the narrowing chain, shared by
  copies, mandatory in the deterministic profile; heap cells; regions
  return quota only on reset/destroy
- conformance: 25 heap/region tests including a 64 KiB region file copy;
  4000 mutants without a crash
2026-10-04 14:26:34 +03:00
dev b8d4ab4d4c spec: accept RFC 0008 and integrate heap, regions and budgets
- spec 03 §18-§21: allocation authority and live-byte budgets, heap
  (own.new/array/take/free), regions (create/new/array/reset/destroy,
  static generations, E2104 on live references)
- spec 05 §11.2, 07 §8.9, 07a summary, 08 §11.2 region allocation paths
  and the ok-parameter exception to borrow_joins
- registries: alloc_error, mem.alloc budget form, mandatory deterministic
  budget; heap and regions published
2026-10-04 14:20:40 +03:00
dev d4d641ad84 rfc: 0008 revision 2 per owner review
- own.take added (T -> own<T> -> T); no take for own_array
- no region-specific limit: one quota mechanism, cap.narrow.budget
- no hidden destruction: own/own_array/region contents must not contain
  linear values until linear_aggregates
- live allocation vs live reference: borrow.end never returns quota;
  reset/destroy return all bytes; E2104 means a live reference would be
  invalidated
- narrowing reserves nothing; children compete for the parent budget
2026-10-04 14:20:11 +03:00
dev 75dfaac1a6 rfc: 0008 heap allocation, regions and allocation budgets (Proposed)
own<T>/own_array<T> (heap), region with shared-borrow allocation and
static generations (E2104 on reset/destroy with live allocations),
cap<mem.alloc> budgets limiting live bytes and shared by copies,
hierarchical cap.narrow.budget, alloc_error, mandatory deterministic
budget.
2026-10-04 14:09:27 +03:00
dev 7a74be3cf7 spec: bit-exact PRNG, canonical run record, global quiescence
Owner review of the RFC 0007 implementation:
- spec 11 §8.1: xoshiro256** with SplitMix64 seeding specified bit for
  bit, fill consumes ceil(n/8) outputs LSB first; golden vector; own
  implementation replaces std.Random (whose seeding differs)
- spec 07a: canonical run record; stdout/stderr as UTF-8 strings or
  base64 objects, files always base64 objects
- spec 11 §8: blocked only at global quiescence (no runnable unit, no
  known future event, unfinished execution)
- reserved feature resource_joins; test names are permanent and
  rule-descriptive (renamed resource_*/borrow_* tests)
- plan: remaining Phase 2 order heap/regions -> unsafe -> hosted ->
  reports -> aji.toml
2026-10-04 14:07:54 +03:00
dev d405d4ea50 Phase 2: I/O intrinsics, linear resources, deterministic profile (RFC 0007)
- air: resource types file<read|write|append>, listener, stream; io_error;
  intrinsic registry (19 intrinsics) synced with reference/intrinsics.md;
  fallible intrinsics as ok/err terminators; fs prefix narrowing;
  linear_aggregates gating
- verifier: intrinsic form, operand, result and capability-kind checks
  (E1001, E3201, E5002); intrinsic effects (E3101); resource linearity
  in the borrow walker with per-edge moves: E3002 leaks and join
  mismatches, E3001, E2001, E2002, E2101 for close while borrowed;
  resources as borrow roots
- interp: deterministic world (captured console, VFS, loopback TCP,
  instruction clock, pinned xoshiro256 PRNG), blocked outcome, run
  record with stdout/stderr/files
- CLI: --stdin, --vfs, --seed, --result-file, --profile (hosted: exit 3),
  exit code 7; runner: stdin/vfs/seed/stdout/stderr/file/blocked headers
- conformance: hello, file copy and TCP echo exit programs; 37 new tests;
  4000 mutants without a crash
2026-10-04 14:02:17 +03:00
dev 571cc6e362 spec: accept RFC 0007 and integrate I/O and linear resources
- spec 06 §6-§7: feature resources, consumption and verifier rules,
  io_error
- spec 05 §11.1 fallible intrinsic form; spec 07 §8.7 frozen built-in
  enum variants, §8.9 resource types; spec 07a resources and run record
  fields; spec 11 §8 execution profiles, blocked outcome, result channel
- reference/intrinsics.md: formal catalogue; capabilities.md: io_error
  and fs prefix narrowing
- features: resources published, linear_aggregates reserved
2026-10-04 13:52:26 +03:00
dev c7bcea294e rfc: 0007 revision 2, remaining examples and diagnostics note 2026-10-04 13:51:32 +03:00
dev 67b228e547 rfc: 0007 revision 2 per owner review
- file<read|write|append>: mode in the type, wrong mode is E1001
- closing intrinsics consume on both edges; second close is E2002
- io_error.other carries no host errno; built-in enum variant sets are
  frozen once published (timed_out reserved for Phase 3 timers)
- no synthetic timed_out: deterministic quiescence ends the run with
  environment outcome blocked (exit 7)
- hosted run record goes to a separate result channel (--result-file);
  stderr summary is for humans only
2026-10-04 13:51:14 +03:00
dev c6acf42182 rfc: 0007 I/O intrinsics, I/O errors and linear resources (Proposed)
Feature resources (file, listener, stream: linear, borrowable, closed
explicitly); built-in io_error; fallible intrinsics as ok/err
terminators; catalogue for console, files, TCP, clock, random; fs
prefix narrowing; deterministic and hosted profiles.
2026-10-04 13:45:31 +03:00
dev 9c29a80b72 Phase 2: effects and capabilities (RFC 0006)
- air: cap<K> and built-in enums (cap_error) as types; enum.switch over
  built-in enums; cap.narrow terminator with ok/err targets; intrinsic
  syntax (registry still empty: E0004); registries for effects,
  capability kinds and built-in enums, synced with reference docs
- verifier: effect stage (E3101, flat, direct callees); cap.narrow form
  check (E3202) and ok/err parameter rules (E5002, E1001); capabilities
  are copyable, not zeroable, not comparable; sizes cap 8, built-in tag
- interp: host authority table; @main instantiation from grants by
  parameter name with not_instantiated reasons; capabilities render as
  opaque
- CLI: --grant P=KIND[:SCOPE], exit code 6; runner: grant: and
  not_instantiated: headers, pending only for unsupported features
- conformance: 18 Phase 2 tests; 4000 mutants without a crash
2026-10-04 13:42:35 +03:00
dev fb4338cea6 spec: accept RFC 0006 and integrate effects and capabilities
- spec 05 §9-§12: flat effects, checking rule, capability model,
  instantiation by parameter name, lifetime, fallible narrowing,
  intrinsic calls, runtime
- spec 07 §8.9, 07a (cap.narrow, intrinsic, run result), 08 stage
  order, 11 not_instantiated outcome
- new reference/effects.md and reference/capabilities.md (kinds,
  scopes, built-in cap_error)
- features effects and capabilities published
- Q-011, Q-012 resolved
2026-10-04 13:36:46 +03:00
dev 3fd1513c86 rfc: 0006 revision 2 per owner review
1. capabilities are unforgeable references to one shared authority
   object; authority-bearing types are transitively non-serializable
2. effect -> authority registry; not every effect needs a capability
3. flat effects kept; effect sets must be part of future fn pointer types
4. grants bound by @main parameter name; missing, mismatched, unknown
   and invalid grants are not_instantiated reasons (exit 6)
5. cap.narrow is a fallible terminator (ok -> cap<K>, err -> cap_error);
   no empty capabilities
6. cap.narrow is the only authority transformation; no combine
7. startup data deferred and separate from authority; environment via
   cap<process.env>
8. capabilities live for one execution instance
2026-10-04 13:35:55 +03:00
dev 56728a534c rfc: 0006 effects and capabilities (Proposed)
Resolves Q-011 (flat effects, no discharge in format 0) and Q-012
(opaque copyable capabilities, origin only as @main parameters granted
by the host, explicit narrowing without widening, not_instantiated
environment outcome, intrinsic call mechanism).
2026-10-04 13:31:32 +03:00
dev 2ddf424c14 verifier: max_value_size and checked size accounting (Q-020, DD-015)
- spec 08 §7.1: platform-independent accounted size table shared by
  max_value_size and max_local_frame; enum tag is the smallest of
  1/2/4/8 bytes; borrows 8, slices 16; checked arithmetic, overflow is
  E5101 with found = "overflow"
- every materializable type in a module must be at most 1 MiB,
  checked before functions are verified; each oversized type reported
  once
- E5101 fields no longer truncate huge sizes
- conformance: frame_too_large, value_too_large, size_overflow
- Q-020 resolved; Phase 1 closed
2026-10-04 13:29:54 +03:00
dev e3dc0fb7bb plan: Phase 1 exit review (P1-11)
- all Phase 1 tasks done, exit criterion met
- README and architecture reflect the implemented modules
- open question Q-020: size bound for SSA array values
2026-10-04 13:24:37 +03:00
dev 1ae6b485d8 Phase 1: frame storage, second-class borrows, arrays (P1-3..P1-10)
- air: types local/ref/mut/array/slice/slice_mut, from-returns,
  multi-result binding, 18 new instructions; feature gating reports
  E0006 feature_not_declared; borrow-typed block parameters gated by
  borrow_joins; printer and round-trip tests for all new forms
- verifier: second-class and zeroable type rules (E1001); local.alloc
  only in entry (E5002); frame size accounting (E5101); stages init
  (E1010), borrow (E2101, E2102, E2105-E2108) and bounds facts (E2103);
  value types shared between stages
- interp: frame cells, places, slices, deep copies between storage and
  SSA values, T0008 bounds traps
- features arrays and ownership supported; implemented_phase = 1
- conformance: 5 accept, 18 reject, 11 run tests for Phase 1, including
  the file-copy core exit program; 6000 mutants without a crash
2026-10-04 13:24:09 +03:00
dev be9dd0e1ed spec: spell the AIR array type array<T, N>
';' starts a comment in text AIR, so [T; N] cannot be parsed. Recorded
as an erratum in RFC 0005; source syntax may keep [T; N].
2026-10-04 13:11:07 +03:00
dev 48bb50724f spec: accept RFC 0005 and integrate Phase 1 memory model (P1-1, P1-2)
- RFC 0005 Accepted (revision 2)
- spec 07 §8.8 types and syntax; spec 07a contracts for features
  ownership and arrays; spec 08 §11-§14 borrows, facts, initialization,
  stage order; spec 03 frame storage, second-class borrows, static
  region generations
- grammar: from-returns, multi-result, new types and opcodes
- feature registry: ownership and arrays published; heap added and
  regions moved to Phase 2; borrow_joins reserved and unscheduled
- codes E2105-E2108, T0008
- Q-009, Q-010 resolved; Phase 1 and Phase 2 plans updated; Own test
  moved to phase 2
2026-10-04 13:10:08 +03:00
dev 2c84c0c7cf rfc: 0005 revision 2 per owner review
1. frame-derived borrows never escape (new E2108); aggregate escape
   impossible by the second-class rule
2. local.alloc only in the entry block (E5002); frame size limit with a
   normative accounting table (E5101)
3. path linearity of borrows; full borrow state compared at joins; only
   the accepted program set is normative
4. slice.sub takes (start, len) with overflow-free checks; slice.split
   ranges; slice.copy copies len(src) into the prefix of dst, no overlap
5. explicit fact table for borrow.index.proven
2026-10-04 13:07:32 +03:00
dev 210af812cf rfc: 0005 frame storage, second-class borrows and arrays (Proposed)
Phase 1 memory design for features ownership and arrays, recording the
owner's decisions on Q-009 (second-class borrows, `from` on returns),
Q-010 (static-only region generations) and phase order (no heap in
Phase 1; Own, heap and regions move to Phase 2).
2026-10-04 12:59:36 +03:00
dev 19dff5dd52 air: feature negotiation for AIR format 0 (DD-014)
- reference/air-features.md: normative feature registry (arrays,
  atomics, capabilities, channels, effects, islands, ownership, regions,
  sync, tasks; all reserved), dependency closures, reasons for E0006
- spec 07 §8.1/§8.5/§8.7: features are mandatory, validated before the
  body, full dependency closure declared, sorted canonically; every
  extension belongs to a feature; published feature semantics immutable
- spec 05 §8: features vs effects vs capabilities
- src/air/features.zig: registry, validation, sync test with the docs
- parser validates features first; E0006 carries `reason`
- `aji features` prints supported AIR format, language and features
- conformance: unknown, reserved and duplicate feature tests
- plan: feature publication tasks in phases 1-5
2026-10-04 12:49:29 +03:00
dev 03dda1245a spec: single normative source, accept RFC 0004, freeze AIR format 0, fuel
Owner decisions after the Phase 0 review:

- precedence: docs/spec/ is the single normative source; RFCs are
  decision records whose accepted rules are integrated into the spec in
  the same change (AGENTS.md, docs/README.md, rfcs/README.md, DD-011)
- RFC 0004 Accepted (scope: AIR format 0, language 0.1)
- AIR format 0 frozen as the semantic baseline; spec 07 §8.7 defines the
  only permitted additive changes, everything else needs `air 1` (DD-012)
- Q-019 resolved: deterministic instruction fuel (spec 11 §7). Outcome
  `limit_exceeded` is a runner outcome, not a trap; `aji run --fuel N`,
  exit code 5; conformance runs always use fuel (default 1 000 000,
  `fuel:` header); fuel/schedule budget/quantum kept separate for P3
  (DD-013)
2026-10-04 12:40:32 +03:00
dev dc36b5cfc0 plan: fix Phase 0 status rows 2026-10-04 12:33:32 +03:00
dev c7c5e4f521 plan: Phase 0 exit review (P0-13)
- all Phase 0 tasks done; exit criterion met (41 conformance tests,
  run records compared across two runs)
- RFC 0004 Amendment 1 documents format-0 additions; status stays
  Proposed pending owner acceptance
- open question Q-019: non-terminating programs in test tooling
- README/CONTRIBUTING: current state and `aji run`
2026-10-04 12:33:17 +03:00
dev 8ca93d0fa6 air: fix out-of-bounds on type line without a name
Found by mutation fuzzing of the conformance corpus through `aji check`
and `aji run` (6000 mutants, no remaining crashes). Adds a regression
test.
2026-10-04 12:32:24 +03:00
dev 1f5008bb37 interp: deterministic interpreter, aji run, run tests (P0-11, P0-12)
- src/interp/machine.zig: format-0 interpreter on the air64 target;
  checked/wrapping arithmetic, shifts, casts, aggregates, calls with a
  1024-frame limit, traps as records with T0xxx codes
- aji run: prints one JSON run record; exit code 4 on trap
- conformance runner: `expect: run` with `result:`/`trap:`, every run
  executed twice and compared byte-for-byte; header keys must be single
  lowercase words
- Phase 0 corpus: 3 accept, 19 reject, 15 run tests (41 total)
2026-10-04 12:28:27 +03:00
dev 50bf990355 verifier: resource limits, CFG, SSA dominance and types (P0-7..P0-10)
- verifier.zig: staged pipeline per spec 07 §8.6, deterministic order
- budget.zig: fixed limits from spec 08 §7 (E5101)
- cfg.zig: terminators, branch arity, switch/enum.switch shape (E5002)
- ssa.zig: Cooper-Harvey-Kennedy dominators, use dominance (E5001)
- types.zig: operand/result types, casts, calls, returns, recursive
  aggregates (E1001, E1002, E1003)
- check.zig runs parse -> verify; seed conformance tests get module
  headers; tests for unimplemented phases report PENDING
2026-10-04 12:24:41 +03:00
dev ef6a2c5475 air: data model, text parser and canonical serializer (P0-4, P0-5, P0-6)
- src/air/module.zig: types, values, instructions, blocks, functions
- src/air/parse.zig: lexer and parser for text AIR format 0 with name
  resolution; reports E0001-E0006, E5001 (undefined/double definition),
  E5002 (unknown block label)
- src/air/print.zig: canonical serializer (spec 07 §8.5) with a
  deterministic round-trip fuzz test
- diag registry: E0xxx, E1003, T0xxx
2026-10-04 12:19:38 +03:00
dev 41b764ccfd spec: Phase 0 spec gate (P0-1, P0-2, P0-3)
- text AIR format 0: grammar (reference/air-text.ebnf) and module,
  block, SSA, type and canonical-form rules (spec 07 §8)
- instruction contracts for format 0 (new spec 07a)
- traps: stable T0xxx codes and trap records (spec 01 §6)
- integer edge cases and explicit casts (spec 02 §2.1)
- fixed verifier resource limits (spec 08 §7)
- target description with pointer_bits (spec 09 §9)
- new codes E0001-E0006, E1003, T0001-T0007
- resolves Q-001, Q-003..Q-008, Q-018; Q-002 resolved for format 0
2026-10-04 12:14:25 +03:00
dev 11ce6cb38c plan: implementation plan with per-phase task breakdowns
- plan/README.md: sequencing principles, milestones M1-M5, phase table
  with exit criteria and blocking questions, dependency graph, error-code
  -> phase coverage, cross-cutting tracks, task conventions
- phase-0..phase-8 files: scope, invariants, task tables (P<N>-<k>) with
  dependencies, outputs and mechanical "done when" checks
2026-10-04 12:05:40 +03:00
dev 4e4d753090 docs: reorganize documentation layout
- docs/roadmap/ -> docs/plan/ (implementation-plan.md becomes plan/README.md)
- docs/reference/design-decisions.md -> docs/design/decisions.md (+ DD-008..010)
- SPEC.md and docs/spec/INDEX.md merged into docs/spec/README.md
- new docs/design/open-questions.md: spec gaps found so far (Q-001..Q-018)
- new docs/dev/architecture.md and docs/dev/testing.md
- docs/README.md: layout, precedence, where new documents go
- update links in README, AGENTS, CONTRIBUTING, sources and test docs
2026-10-04 12:01:33 +03:00
dev 17a55a7fef Initial import: Aji 0.1 draft spec and Zig scaffolding
Draft specification, RFCs, reference registries and examples, plus the
reference-implementation skeleton: build.zig, diagnostic envelope with
error-code registry synced to docs, aji CLI, conformance runner with seed
tests, CI and contributor docs.
2026-10-04 11:59:13 +03:00