Commit Graph

292 Commits

Author SHA1 Message Date
Brummel e3b0dd20c5 iter rt.2: DESIGN.md anchor — Roundtrip Invariant lifted to top-level
New top-level section '## Roundtrip Invariant' between Decision 11
and '## Mangling scheme'. States both directions of the .ail.json
↔ .ailx bijection, names Float-bits-hex encoding as the in-
invariant mechanism (not an exception), lists the four enforcement
tests by path, and explains why the property is top-level
(load-bearing on language identity, not on Decision 6's surface-
design rationale).

Decision 6 Constraint 2 rewritten as upward cross-reference to the
new section; the substantive content now lives at the anchor.

Direct boss edit (no planner/implement dispatch): spec Architecture
#1 fully specified the content, no design judgement deferred to
execution. The iter is a deterministic projection of the spec
onto DESIGN.md prose.
2026-05-12 09:38:56 +02:00
Brummel b6046bb6eb WhatsNew: rt.1 — roundtrip safety net landed 2026-05-12 09:32:11 +02:00
Brummel 098fa7e9be iter rt.1: roundtrip-invariant audit tests — 3 new tests, all PASS first-shot
Three new reader-only tests pin the .ail.json / .ailx bijection
plus AST-variant coverage. All three passed first observation
across the current corpus — no roundtrip, schema-coverage, or
CLI-drift gaps surfaced.

- every_ailx_fixture_matches_its_json_counterpart (replaces the
  3-pair handwritten exhibits): 57 paired .ailx fixtures pass.
- every_ast_variant_is_observed_in_the_fixture_corpus (new): 34/34
  AST variants exercised across 136 fixtures; exhaustive matches
  without _ wildcard so AST drift fails the build.
- cli_render_then_parse_preserves_canonical_bytes_on_every_fixture
  (new): 136 fixtures round-trip through ail render → tempfile →
  ail parse with BLAKE3 identity on canonical bytes.

No production code, no DESIGN.md changes (those follow in later
iterations). Tests are pure readers of the repo per spec
acceptance #7 — tempfile crate added as workspace dep for the CLI
roundtrip's intermediate file outside the repo.
2026-05-12 09:31:38 +02:00
Brummel 10ccd1406c plan: rt.1 — three new tests (ailx pair cross-check dynamic + schema_coverage + CLI roundtrip via BLAKE3) 2026-05-12 09:24:50 +02:00
Brummel d71b5ca6c1 roadmap: brainstorm Step 7.5 — re-dispatch grounding-check on any post-PASS spec edit (P1 todo) 2026-05-12 09:24:24 +02:00
Brummel ea2c485459 spec: roundtrip invariant milestone — bidirectional .ail.json/.ailx bijection, schema-coverage, CLI roundtrip, hard-fail, dynamic fixture collection 2026-05-12 09:19:01 +02:00
Brummel daf9f4fdc9 roadmap: roundtrip-invariant milestone (P1) + cross-model authoring-form test (P2)
Surfaced while scoping an empirical test of Decision 6 (.ailx as the
AI authoring projection). The cross-model test depends on a structural
.ail.json <-> .ailx bijection being established and prominently anchored
in DESIGN.md first; otherwise measured form-preference is contaminated
by expressive-power gaps rather than authoring ergonomics. P2 entry
carries the smoke-test evidence and full IONOS-endpoint addressing
notes so the test can be picked up without redoing the connection work.
2026-05-12 08:53:47 +02:00
Brummel edccc087a4 WhatsNew: audit-23 — milestone closed, regression ratified 2026-05-12 00:57:36 +02:00
Brummel 94616240ec audit 23: ratify compile_check baseline + DESIGN.md stub-fix
Milestone-23 close audit. Architect clean on substance; one
pre-existing DESIGN.md grammar stub (line 1692, dangling 'The
original' from 2026-05-10 design-md-consolidation) caught and
fixed.

Bencher localised the compile_check.py regression to H2 (the 5 new
polymorphic prelude Def::Fns iter 23.5 added — each carries forall
+ class constraint + match/not body, all typechecked on every
workspace check). H1 (linearity workspace-visibility extension +
contains_rigid_var) is negligible at today's 2-module workspace.

The regression is the feature's measured cost. Ratified per audit
skill (--update-baseline + journal entry). 0/24 metrics regressed
post-update.

Milestone 23 (Eq/Ord prelude) is closed.
2026-05-12 00:57:12 +02:00
Brummel 3fed372d77 WhatsNew: iter 23.5 — Eq/Ord prelude milestone closed 2026-05-12 00:39:59 +02:00
Brummel 326c995c1d iter 23.5: INDEX append 2026-05-12 00:39:11 +02:00
Brummel 92e830e6c2 iter 23.5: prelude free fns + E2E — Eq/Ord milestone close
Five polymorphic prelude free fns (ne/lt/le/gt/ge) plus three E2E
fixtures: positive composition over Int/Bool/Str, user-ADT with
user-written Eq/Ord on IntBox, and Float-NoInstance with a
Float-aware diagnostic addendum cross-referencing DESIGN.md §"Float
semantics".

Two checker-side fixes were needed alongside the prelude additions,
both symmetric to the iter 23.4-prep visibility fix:
- linearity::check_module_with_visible — workspace-aware callee-mode
  resolution so a Borrow-mode user fn forwarding into a prelude poly
  fn (e.g. `at_most x y = not (gt x y)`) doesn't false-fire
  consume-while-borrowed.
- mono::collect_mono_targets — distinguish rigid forall vars from
  unbound metavars; rigid-bearing free-fn targets skip (they get
  re-collected with concrete subst when the enclosing fn itself
  monomorphises). Without this, a polymorphic body calling another
  polymorphic free fn produced a spurious __Unit specialisation
  whose body referenced compare at Unit.

Roadmap split: shipped Eq/Ord half checked, Show + print-rewire half
remains pending behind the heap-Str ABI prerequisite. DESIGN.md
§"Prelude classes" amended.

One pre-existing fixture (test_22b1_missing_method) renamed its
class method ne → tne to avoid collision with the new prelude `ne`.

Bench: check.py + cross_lang.py exit 0; compile_check.py exits 1
with one sub-ms check_ms.local_rec_capture at +26% (tolerance 25%) —
prelude-growth-related noise-band fluctuation, ratifiable per spec
§248-249 and journal Concerns.
2026-05-12 00:38:52 +02:00
Brummel 35c6eb5736 plan: iter 23.5 prelude free fns + E2E — 8 tasks 2026-05-12 00:16:23 +02:00
Brummel bff647eaa7 WhatsNew: iter 23.4 — eq/ord prelude work back on track 2026-05-12 00:00:46 +02:00
Brummel a1692a4859 iter 23.4: mono-pass unification — class methods + polymorphic free fns in one fixpoint
Restructure ailang-check/src/mono.rs::monomorphise_workspace into a
single specialiser over every Type::Forall-quantified Def::Fn, covering
both class-method residuals AND polymorphic free-fn call sites in one
fixpoint pass. Remove the codegen-time specialiser (lower_polymorphic_call,
module_polymorphic_fns, mono_queue, mono_emitted, emit_specialised_fn,
plus the now-dead helpers apply_subst_to_term, descriptor_for_subst,
type_descriptor) entirely. Codegen sees only monomorphic Def::Fns after
this iter — no polymorphic call sites, no codegen-time queue.

Architecture changes:
- MonoTarget: struct → enum with ClassMethod / FreeFn variants; dedup
  keys are guaranteed-disjoint via 'class'/'free' first component.
- collect_mono_targets: new FreeFnCall channel through synth (cleaner
  than the plan's separate-walker proposal — one less data flow,
  substitution tracking comes 'for free' via fresh metavars +
  post-synth subst.apply). Plan Step 4.4 (polymorphic_free_fns env
  field) consequently obsolete.
- synthesise_mono_fn_for_free_fn: new free-fn entry point; substitutes
  rigid vars in BOTH the type AND the body (body substitution required
  because free-fn bodies carry inner Lams whose param_tys reference
  outer Forall vars — adapted from plan's 'body unchanged' sketch).
- mono_symbol_n: N-ary extension of mono_symbol; bit-stable for the
  single-type-var case (hash-stability pin Task 1 fires zero times
  through all eight refactor tasks).
- rewrite_class_method_calls → rewrite_mono_calls; interleaved-slot
  collector preserves the positional-cursor invariant across both
  channels.
- workspace_has_typeclasses → workspace_has_specialisable_targets
  (principled correctness; old predicate happened to already be true
  for every user workspace because the prelude is auto-injected).

Codegen cleanup:
- Two call sites of lower_polymorphic_call deleted (codegen/src/lib.rs
  lines ~1939-1945, ~1965-1973).
- lower_polymorphic_call body, module_polymorphic_fns field +
  population + Emitter wiring, mono_queue / mono_emitted, drain loop,
  emit_specialised_fn — all removed.
- is_static_callee collapsed to module_user_fns-only.
- subst.rs apply_subst_to_term + descriptor_for_subst removed; synth.rs
  type_descriptor removed (all dead post-removal).
- ail emit-ir command pipeline gains lift_letrecs + monomorphise_workspace
  pre-passes (pre-iter-23.4 the codegen-time poly path was masking
  this dependency — emit-ir is now consistent with build).
- Net codegen reduction: -285 lines lib.rs, -93 lines subst.rs.

Tests:
- mono_hash_stability.rs (new): regression pin for six primitive Eq/Ord
  mono-symbol body hashes; stayed bit-stable through all eight refactor
  tasks.
- mono_unification.rs (new): six tests covering variant-key disjointness,
  free-fn target emission, free-fn synthesis with rigid substitution,
  rewrite walker on free fns, identity for poly-free-fn-only workspaces,
  end-to-end cmp_max_smoke runtime correctness.
- typeclass_22b3.rs: three test sites updated to MonoTarget::ClassMethod
  enum form.
- 73 e2e + 18 typeclass + 81 codegen tests all green workspace-wide.

DESIGN.md §'Monomorphisation (post-typecheck, pre-codegen)' amended:
two-arm fixpoint described, disjoint-keyed dedup, cursor-aligned
walker, removed codegen-time path.

Bench check (all exit 0, 112 metrics stable): bench/check.py +
compile_check.py + cross_lang.py.

Plan parent: docs/plans/2026-05-11-iter-23.4.md (fab1685).
Spec parent: docs/specs/2026-05-11-23-eq-ord-prelude.md (841d65d).
Per-iter journal documents two adapted deviations from the plan
(synth-channel vs separate walker; body substitution; emit-ir fix);
no spec defects.
2026-05-11 23:59:45 +02:00
Brummel fab1685336 plan: iter 23.4 mono-pass unification — 11 tasks, no per-task commits
Plan for the corrected iter 23.4: restructure mono.rs into a single
specialiser for every Type::Forall-quantified Def::Fn (class methods
+ polymorphic free fns) in one fixpoint pass, and remove the codegen-
time specialiser (lower_polymorphic_call + module_polymorphic_fns +
mono_queue) entirely.

11 tasks, 4-step TDD template per task (write-failing-test →
verify-fail → write-impl → verify-pass), no per-task commit step
under the new disc.1 discipline.

Parent spec: docs/specs/2026-05-11-23-eq-ord-prelude.md (re-grounded
2026-05-11 against main HEAD 51da9fa, PASS, 10 load-bearing
assumptions verified).

Open commitments resolved:
- N-ary mono-symbol naming: spec default <name>__<t1>__<t2>__...
- Target-collector: extension of existing collect_mono_targets
  (lockstep with collect_residuals_ordered)
- Original poly Def::Fn retention: kept parallel to Def::Class/
  Def::Instance

Float-NoInstance diagnostic wording remains deferred to iter 23.5.
2026-05-11 23:14:23 +02:00
Brummel 51da9fab53 iter disc.1: boss-only commits + main-as-quarantine (no branches in implement)
Two project-wide rules are now explicit across every skill:

1. Only the Boss commits. No skill agent (implementer,
   brainstormer, planner, debugger, fieldtester, docwriter,
   architect, bencher) runs `git commit`. Agents write their
   artefacts to the working tree as unstaged changes; the Boss
   inspects, decides commit shape, and commits.
2. main HEAD is sacrosanct. No actor runs `git reset` or
   `git revert` on main. Bad work stays in the working tree
   where it is still discardable via `git checkout -- <paths>`.

Implement loses the `iter/<iter_id>` branch mechanic entirely;
Phase 0 of the orchestrator-agent now does a clean-tree check
and refuses to start on a dirty tree. Per-task agent commits
are removed everywhere; reviewers operate against
`git diff HEAD` instead of `pre_task_sha..head_sha`.

Motivation: 2026-05-11 iter 23.4 stranded prep2/prep3 commits on
an iter-branch that never integrated to main, then a corrected
spec falsely claimed those commits had shipped. Branch-per-iter
+ manual-Boss-merge + iter-stacking made the strand structurally
possible. See docs/journals/2026-05-11-iter-disc.1.md for the
full per-task notes and motivation.
2026-05-11 22:44:43 +02:00
Brummel 841d65d88c spec: 23 — correct prep-commit reachability against main
Brainstorm assumed all four 23.4-prep commits had shipped to main.
Branch verification (post-iter/23.4 deletion) showed only prep1
(linearity + check bare-name) is on main; prep2 + prep3 were
attempted on the stranded iter/23.4 branch and never landed.

Spec corrections:
- Goal section: prep-commit status block reflects actual main state.
- Architecture: drop §2 (prep2/prep3 rollback) — no rollback exists
  on main; section count drops from four to three artefacts.
- Components table: prep2/prep3 row now reads 'abandoned 2026-05-11
  with iter/23.4 deletion', not 'shipped, rolled back in 23.4'.
- Acceptance criterion 1: drop the 'prep2 + prep3 are rolled back'
  clause.
- Load-bearing assumption 5: now states prep2/prep3 never reached
  main (fixes the silent-assumption pattern this spec exists to
  prevent — same failure mode the original Spec-23 had).
- Load-bearing assumption 6: cite the cherry-picked main SHAs
  (0caaced, 923dd8c) alongside the stranded-branch originals
  (8d39f13, aef4ab8).
- Known costs: drop the '23.4 rollback' line item.
2026-05-11 22:04:49 +02:00
Brummel f7ca26c5b4 iter 23.4-prep: INDEX entry 2026-05-11 22:02:19 +02:00
Brummel ab4463ff19 iter 23.4-prep: per-iter journal 2026-05-11 22:01:52 +02:00
Brummel c3e8044361 plan: iter 23.4-prep — checker prerequisites for prelude free fns 2026-05-11 22:01:52 +02:00
Brummel 4bbcb947a3 plan: drop 23.4 — design assumption broke at branch verification
The 23.4 mono-unification plan (ea0285b) assumed prep1 + prep2 +
prep3 were on main. They never were — they sit only on iter/23.4.
Spec component table was factually wrong. Plan Task 10 (revert prep
commits) was impossible on main. Discarding the plan; the spec is
next revised against the actual main state.
2026-05-11 22:01:31 +02:00
Brummel ea0285b85f plan: 23.4 — mono-pass unification + prep2/prep3 rollback
Eleven tasks plus final regression smoke. Tasks 1-6 build the
unified mono pass incrementally (MonoTarget shape, N-ary naming,
free-fn synth, target collection, call-site rewrite, fixpoint
dispatch). Task 7 verifies poly_id/poly_apply/poly_rec_capture
regress green. Task 8 pins mono-symbol hashes. Task 9 removes
codegen-time lower_polymorphic_call + module_polymorphic_fns +
mono_queue. Task 10 reverts prep2 (a06159d) + prep3 (c42a0f5).
Task 11 amends DESIGN.md §Resolution-and-monomorphisation to
cover all Type::Forall Defs.

Implementer open commitments deferred per spec: MonoTarget shape
(enum vs Option), collector mechanism (synth-residual extension
vs separate walker), polymorphic Def::Fn retention post-mono,
subst.rs dead-code handling. Plan calls each out with a default
and NEEDS_CONTEXT permission for alternatives.
2026-05-11 21:42:14 +02:00
Brummel 18b49e1d31 spec: 23 — fix fixture name (poly_box_proj → poly_rec_capture)
Plan-recon for iter 23.4 surfaced that poly_box_proj.ail.json does
not exist in examples/. The three load-bearing regression fixtures
are poly_id, poly_apply, and poly_rec_capture (the latter at
examples/poly_rec_capture.ail.json, driven by e2e.rs::poly_rec_capture_demo).
Three references in the spec corrected. Substantive intent (three
existing polymorphic fixtures regress unchanged under unified mono)
unchanged.
2026-05-11 21:38:16 +02:00
Brummel 408fef9239 journal: gc.1 — append cadence-flow notes 3+4 from first real grounding-check run
Note 3: agent output format leaked internal-thinking preamble before
the structured report block — Iron Law should forbid preamble.
Note 4: Boss-requested behaviour change for impending-BLOCK paths —
on miss, agent attempts to write missing GREEN test (test code only,
never src/) before falling to BLOCK; requires tool + Iron Law update.
Both notes are for the future skillsystem-postmortem entry; out of
gc.1 scope.
2026-05-11 21:32:38 +02:00
Brummel d3317358ce spec: 23 (revised) — Eq/Ord prelude on unified mono pass
Re-brainstorm of milestone 23 after the original spec retired in
iter gc.1. The original silently assumed polymorphic free fns are
mono-specialised parallel to class methods; iter 23.4 BLOCKED three
times on that seam. Revised spec corrects the architecture by
committing to a unified typecheck-time mono pass (B1) — one
specialiser for all Type::Forall Defs, codegen-time
lower_polymorphic_call retired in same iter. First real run of the
grounding-check agent (Step 7.5) shipped in gc.1: PASS, 15
assumptions ratified.
2026-05-11 21:27:31 +02:00
Brummel fc4df2bc7c WhatsNew: 2026-05-11 spec grounding-check 2026-05-11 19:51:19 +02:00
Brummel 6b55171ba8 iter gc.1: journal — append cadence-flow notes for skillsystem postmortem 2026-05-11 19:50:32 +02:00
Brummel 954d15c709 iter gc.1: append INDEX entry 2026-05-11 19:49:55 +02:00
Brummel 4a9673259c iter gc.1: per-iter journal 2026-05-11 19:48:31 +02:00
Brummel f6d4ba3c58 iter gc.1: retire Spec-23, roadmap forward-pointer to re-brainstorm 2026-05-11 19:47:37 +02:00
Brummel 606a2ebe6d plan: gc.1 — grounding-check agent + brainstorm Step 7.5 wiring 2026-05-11 19:42:39 +02:00
Brummel 86acc86e2e spec: remove brainstorm-grounding-check draft (superseded by final spec) 2026-05-11 19:35:53 +02:00
Brummel 640e06fc60 spec: brainstorm grounding-check agent — close spec-defect loophole 2026-05-11 19:34:32 +02:00
Brummel d96d8c5cc2 draft: brainstorm grounding-check agent — discussion input for fresh brainstorm
Discussion-draft, not an approved spec. Captures today's findings:
- Repeated BLOCKEDs on iter 23.4 family were a spec-defect signal,
  not a plan-defect signal.
- Today's spec-verification (brainstorm Step 7 + 8) is purely
  linguistic — no code-grounded check of load-bearing assumptions.
- Spec-23's 'work the same way as 22b.3' half-sentence was the
  exact load-bearing assumption that broke. Three preps spent
  patching what should have been caught pre-approval.

Proposes a new agent that, with fresh context between brainstorm
Step 6 and Step 7, extracts load-bearing assumptions from the spec
draft and searches for an existing green fixture ratifying each.
Default on miss: spec discarded, blocked idea moved to roadmap with
'depends on: <missing prerequisite>'.

Eight open design questions left for the next session's brainstorm
to answer.
2026-05-11 19:12:09 +02:00
Brummel 17b1d9957e iter cadence.5-fix: journal — commit-range + fix-count consistency 2026-05-11 14:13:39 +02:00
Brummel bd36751634 iter cadence.5: per-iter journal + INDEX 2026-05-11 14:10:48 +02:00
Brummel 7505af04a1 iter cadence.4-fix: address quality-review importants + German-loanword sweep (English-only in-tree) 2026-05-11 14:07:44 +02:00
Brummel 34238388a1 spec+plan: audit/fieldtest/docwriter cadence restructure 2026-05-11 13:52:41 +02:00
Brummel 0ee5af9ef1 spec: au.1 audit-orchestrator agent 2026-05-11 13:27:30 +02:00
Brummel 5c3bd9ab24 or.2: orchestrator-agent design correction — no nested subagent dispatch
Claude Code categorically forbids subagents from spawning other
subagents (code.claude.com/docs/en/sub-agents and the Agent SDK
subagents page). The `or.1` architecture (and `pr.1` that ran on
top of it) presumed a named-exception for `ailang-implement-
orchestrator` to dispatch implementer / spec-reviewer / quality-
reviewer / tester per task. That exception never existed at the
platform level; the `Agent` tool was silently dropped from the
orchestrator-agent's tool set at dispatch time.

Architecture revised, doc-only:

- Per-task phases (implementer → spec-compliance check → quality
  check) now run as sequential role-switches in the orchestrator-
  agent's own context, not as nested subagents.
- The four role-files (implementer / spec-reviewer / quality-
  reviewer / tester) become phase reference files the
  orchestrator-agent consults at role-switch boundaries.
- Boss-context offload preserved; fresh-per-phase context given
  up (the property that drove or.1's nested-dispatch design is
  not buildable in Claude Code).

Files touched:
- skills/implement/agents/ailang-implement-orchestrator.md
  (frontmatter, Iron Law, Phase 2/3 rewrite, rationalisations,
  red flags)
- skills/implement/SKILL.md (frontmatter, Iron Law, sub-status
  vocabulary note, cross-references)
- skills/README.md (Conventions: no more named exception; agent
  roster: role-files recast as phase references)
- docs/journals/INDEX.md (or.2 entry appended)
- docs/journals/2026-05-11-iter-or.2.md (new — full rationale)
- docs/roadmap.md (P1 tool-wiring item removed; resolved as
  categorically-not-fixable)
- docs/WhatsNew.md (user-facing correction entry appended)

No code changes; no bench impact; CLAUDE.md untouched (no stale
references to fix there).
2026-05-11 13:01:38 +02:00
Brummel bd801b979c whatsnew: 2026-05-11 plan-writing offload + first-run debrief 2026-05-11 12:45:15 +02:00
Brummel 88a5b1f336 roadmap: P1 — Agent tool wiring for orchestrator-agent (blocks or.1 design goal) 2026-05-11 12:44:39 +02:00
Brummel 908a15c3ce journal: pr.1 audit close (clean) — 0 bench regressions, architect clean 2026-05-11 12:42:37 +02:00
Brummel a33d76c67b iter pr.1: INDEX entry for plan-recon subagent 2026-05-11 12:40:03 +02:00
Brummel 5c17ef2efc iter pr.1: Boss-side known-debt addendum (iron law + agent-tool-wiring) 2026-05-11 12:40:03 +02:00
Brummel 11fcd0a20e iter pr.1: per-iter journal 2026-05-11 12:36:05 +02:00
Brummel 14ac4ae7c3 plan: pr.1 plan-recon subagent 2026-05-11 12:27:04 +02:00
Brummel 94d8016da1 fieldtest close: canonical-type-names — route findings + roadmap update
Per-iter journal entry for the fieldtest run plus INDEX pointer.
Roadmap absorbs four actionable findings as P2/P3 todos (split the
merged BadCrossModuleTypeRef diagnostic, workspace subdir search,
`ail check` on `.ailx` extension, `.ailx` counterpart for the
canonical happy-path JSON exhibit). The two carry-on items
(`(import prelude)` doc-gap, the working ones) stay as notes in the
fieldtest spec only. P0 Floats milestone removed — closed
2026-05-10 and no longer load-bearing context.

No bug findings, so no debug dispatch. canonical-type-names is fully
shipped.
2026-05-11 12:17:21 +02:00
Brummel 45dca692dd fieldtest: canonical-type-names — 5 examples, 9 findings 2026-05-11 12:14:15 +02:00