Files
aji/docs/design/review-2026-10-07.md
T

13 KiB
Raw Blame History

Design review — 2026-10-07

Non-normative. An external review of the spec, the plan and the evaluation results, written for another agent to check and evaluate. It changes nothing; every proposal still needs an RFC, a DD-NNN entry or a plan task before it has any effect.

Scope and limits

Read in full: spec 01, spec 14, spec 15 §1, §6, §9–§11, §13–§15 (parts), spec 10 §1–§6, docs/agent/quick-reference.md, docs/agent/README.md, docs/plan/README.md, docs/design/decisions.md, docs/design/open-questions.md (index), docs/evaluation/results/2026-10-05-native-smoke.md.

Skimmed by headings only: spec 03, 04, 05, 07, 07a, 08, 13, 16. Claims that touch these are marked unverified.

Not read: the RFCs (except their titles), src/, the conformance corpus, docs/evaluation/protocol.md, the P6A-9 and P5-0 results.

Every claim below has an evidence line. The reviewing agent should check it and mark the claim confirmed, wrong or partly.

How to evaluate this document

For each item, answer:

  1. Is the observation true? Check the evidence.
  2. Does the repository already address it somewhere this review did not read?
  3. If true, is the proposal consistent with AGENTS.md? In particular: no inferred effects in public contracts, no compiler flags that change semantics, no features tuned to benchmark tasks (spec 14 §12).
  4. Does it improve at least one of the mission properties in AGENTS.md (explicitness, verifier strength, determinism, repairability, safety, simplicity, auditability)?
  5. Is it cheaper than its expected gain? Use the same cost categories as spec 14 §5.

Part A — What is right (keep)

ID Observation Evidence
A1 The central hypothesis is stated as falsifiable and is tested with a held-out benchmark, an anti-overfitting rule and published negative results. spec 14 §4, §12; native-smoke results "No compression signal at this difficulty"
A2 "Agent proposes, verifier decides" is carried through: stable codes, JSON Lines diagnostics, suggested_effects, deterministic runs bounded by fuel. spec 10 §2; DD-009, DD-013; quick reference §1
A3 The source/AIR boundary rule is sharp and checkable: source may hide mechanics (SSA, CFG, borrow.end, frame storage, feature header) and must not hide semantics (authority, allocation, move, consumption, sync, effects, tasks, cancellation, failure). spec 15 §1
A4 Exhaustive enum match without _ makes adding a variant a compile error everywhere it matters. spec 15 §6 "Enums"
A5 Bringing Phase 6A forward was decided from data: the measured cost of Aji/AIR was hand-written IR, not the safety semantics. Strong agents hit no ownership, borrow, resource or concurrency diagnostics. native-smoke "Diagnostics" and "Reading" §2
A6 The frontend is outside the TCB, and malformed lowered AIR is reported as a compiler bug (E7900), not as a program error. spec 15 §1, §10

Part B — Concerns

Severity: high means a risk to the project hypothesis; medium means measurable agent cost; low means quality or clarity.

B1 — Language and std grow faster than the evidence that growth pays (high)

  • Bundle growth: 27.3k tokens (Phase 2 baseline) → 42.3k tokens (Phase 5), about +55 %. Every phase adds about 10 %, and growth only produces a CI warning.
  • The native smoke measured a fixed documentation read of about 33k tokens per Aji run. Rust runs read none.
  • No result shows a compression signal yet. E-A, E-1 and B1 are not done.
  • Spec 14 §3.2 says a feature should not be added when existing primitives suffice. Spec 14 §8 says nearly identical APIs should be avoided unless benchmarks show a benefit.

Evidence: docs/agent/README.md milestone table; tools/agent_bundle_tokens.py output ("+11.8 % since Phase 5"); native-smoke "Cost" table; docs/plan/README.md evaluation table.

Question for the reviewer: does the Source Reference Bundle (/docs front door plus selective reading) actually stay small? This review did not get token counts for it: the tokenizers were not installed.

B2 — Standard library scope before measurement (high)

  • RFC 0016–0035 add a large std: deque, numeric map, general key map, set, binary heap, buffered files, lexical paths, hashing, text encodings, integer formatting. Spec 16 is about 9.2k words, almost as large as spec 15 (9.6k).
  • Each collection is a set of operations and outcomes an agent must learn, and is part of what an agent may read.
  • The plan already moved std into a separate track and recorded the merge as an owner request (2026-10-06/07).

Evidence: docs/rfcs/ listing; wc -w docs/spec/*.md; docs/plan/README.md "Standard library track".

Question for the reviewer: which std modules does the Quick Reference expose, and were any of them used in P6A-9 or the M/C regression runs?

B3 — Deterministic repairs still cost a round-trip (medium)

  • E3101 already computes the full effect list (suggested_effects). The agent copies it back by hand.
  • Spec 10 §3 defines repair_candidates as kind names only ({"kind": "move_reset_after_use"}), with the rule "Suggestions never modify semantics automatically".
  • Several source diagnostics have exactly one mechanical fix:
    • E3101: replace the effects [...] list;
    • E7003: insert move;
    • E7006 for move on a copyable value: delete move;
    • E7004: add the missing arms.

Evidence: spec 10 §3; spec 15 §9 "Effects", §10 code table; quick reference §1, §4.

B4 — Lexical borrow scopes push structural edits onto the agent (medium)

  • A named borrow lives until the end of its block. To end it earlier, the agent adds an inner { … } block.
  • This is simple to state and simple to verify. The cost is that E2101/E2104 repairs are structural edits whose correct location the agent must find itself.
  • Not a proposal to adopt non-lexical lifetimes. Those would add inference, which conflicts with spec 14 §3.4.

Evidence: spec 15 §9 "Borrow scopes"; quick reference §4, §6 (region example).

Question for the reviewer: do E2101/E2104 diagnostics already carry the span of the conflicting earlier borrow? (spec 08 not read in full.)

B5 — Open determinism gaps (medium)

  • Q-016 (floating-point determinism) and Q-017 (replay file format) are open.
  • f32/f64 appear in spec 02. Unverified: whether they are reserved or usable.
  • Spec 14 §3.6 promises "same program, same input, same grants, same seed … same observable result".

Evidence: docs/design/open-questions.md index; grep f32 docs/spec/02-types-and-values.md (line 20).

B6 — No source contracts; the verifier covers memory, not logic (medium)

  • Spec 13 defines requires/ensures. P6-6 (contracts in source) is todo.
  • The smoke showed that strong agents make almost no memory or resource errors. If the remaining errors are logical, the verifier currently cannot help with them.

Evidence: spec 13 lines 9–21; docs/plan/phase-6-source-language.md line 14; native-smoke "Diagnostics".

Unverified: the current status of spec 13 contracts in AIR.

B7 — No behavioral abstraction pushes variants into std (medium)

  • There are no user traits, closures or function values (spec 15 §15: "No user traits, overloads, type inference …"). Only qualified named functions may be passed to task.spawn, and static function parameters exist (RFC 0029).
  • Anything parameterized by behavior (comparator, hash, visitor) needs either a static function parameter or a separate built-in. That may partly explain the size of B2.

Evidence: spec 15 §14 (line 511), §15 (line 523), §18; RFC 0029 title.

Question for the reviewer: are static function parameters (spec 15 §18) enough for comparator/hash use? If so, can some std variants be expressed as one generic module?

B8 — The normative source-language text is hard for an agent to read (low)

  • Several spec 15 sections are dense single paragraphs with many rules, e.g. §13 (name mangling) and §17 (dynamic buffers).
  • The Quick Reference compensates, but when an agent is unsure it is directed to the normative text.

Evidence: spec 15 lines 481, 558.

B9 — Tests are not a language-level construct (low)

  • Tests live in the conformance infrastructure (expect/phase/spec headers, DD-010). An agent writing an application has no in-language way to state and run its own deterministic tests, including under N schedules.

Evidence: DD-010; quick reference sections 1–8 (no test construct).

Unverified: whether spec 12 (packages and build) defines a test entry point.

Part C — Proposals

Ordered by estimated benefit per cost. Each states the concern it answers and how to measure it.

C1 — Exact text edits in diagnostics (answers B3; cheap)

Add an optional field to diagnostics whose fix is unique and mechanical:

{"code": "E3101", "edits": [{"file": "main.aji", "range": [12, 1, 12, 14], "replacement": "effects [io.read, io.write]"}]}
  • The compiler never applies the edits. The agent applies them explicitly, so spec 10 §3 ("never modify semantics automatically") holds.
  • Initial set: E3101, E7003, E7006 (move on a copyable value), E7004 (missing arms, each => { trap; }).
  • Not for borrow conflicts. There, more than one fix is correct.
  • Effects stay declared in the public signature. This is not effect inference (AGENTS.md).

Measure: repair iterations per accepted solution on the M/C regression corpus, before and after. Per AGENTS.md, M/C may show that nothing broke, but they never decide the question.

C2 — Per-code diagnostic statistics across all runs (answers B1; cheap, evaluation tooling only)

  • Record in the harness, for every run, the count of each diagnostic code before acceptance.
  • Use it as the input that ranks language work. If most iterations are E3101 and E2101, those are the roadmap.
  • Today this breakdown exists for one smoke run only.

Measure: none needed; this is the measurement.

C3 — Freeze std growth until B1 is analyzed (answers B1, B2; free)

  • No new std modules until the B1 held-out analysis.
  • Fixes and spec integration of already accepted RFCs continue.

C4 — Hard budget for the Quick Reference (answers B1; cheap)

  • Cap, for example, the Quick Reference at 8k tokens as a CI failure, not a warning.
  • A feature that needs room must shrink or move something else to the selective-reading layer.

Risk: pressure to make the reference terse to the point of ambiguity. Mitigation: the budget covers the front door only; the full spec is unchanged.

C5 — Both spans in borrow-conflict diagnostics (answers B4; medium cost)

  • E2101, E2104, E4302: report the span of the earlier borrow, the span of the conflicting use, and the innermost block in which the earlier borrow could be enclosed.
  • Facts only, not edits: there is more than one valid fix.

First check B4's question: this may already exist.

C6 — Decidable source contracts as the next major semantic feature (answers B6; high cost)

  • A small decidable fragment: linear integer arithmetic over indices, lengths and counts in requires/ensures.
  • Anything not proved becomes an explicit runtime check, listed in aji report (spec 10 §6.1 already reports runtime vs proven checks).
  • Prioritize this over new std modules.

Needs a full RFC with the Agent complexity impact section and the memory/concurrency checklist where it applies.

C7 — test fn in source (answers B9; medium cost)

  • Deterministic in-language tests with fuel and --schedules N, run by aji test.
  • Grants are declared per test, with the same main-parameter rule.
  • Reuses the existing run record. No new runtime semantics.

C8 — Close Q-016 before any task needs floating point (answers B5)

The simplest deterministic option is to keep f32/f64 reserved in .aji 0.1 and say so in the Quick Reference.

C9 — Prioritize B1 over P6-11 and further std work (answers B1; free)

  • H4 is expected only on medium tasks, where a weaker model understands the task but fails on resources, cancellation or concurrency (docs/plan/README.md roadmap item 5).
  • Until such tasks are measured, language changes are optimized without signal.

Part D — Suggested next steps for the reviewing agent

  1. Verify every unverified item and every reviewer question above. List the outcome per ID.
  2. Count how many C proposals survive the evaluation questions at the top.
  3. For surviving proposals, pick the destination:
    • C1, C5, C6, C7: RFC;
    • C3, C4, C9: owner decision or DD-NNN;
    • C2: plan task in the evaluation track;
    • C8: resolution of Q-016.
  4. Do not start implementation from this document alone.