One forward iteration; main never rewound.1ff7e81(the pre-9973546 commit) is the per-region byte oracle — every reverted source/test file is byte-identical to it; crates/ailang-check/src/lib.rs fully so. Root cause being corrected: the Iteration-discipline milestone was an over-escalation of fieldtest finding F1 (a [friction] item whose own minimal recommendation was a DESIGN.md note). Its totality dichotomy made the maximally-LLM-natural build(d:Int)=Node(1,build(d-1), build(d-1)) inexpressible (it.3 BLOCKED); the only in-thesis escape (A1/it.2b) conceded the language's first documented-unenforced totality precondition — a purity-pillar dilution the user rejected in favour of a full revert + rebuild. Removed: Term::Loop/Term::Recur/LoopBinder; the verify_structural_ recursion guardedness pass + term_contains_loop + Diverge-injection + the transitively-it.2 module_fns plumbing; the five Recur*/ NonStructuralRecursion CheckError variants (+ code() + the 3 dedicated ctx() arms); the it.1 codegen loop-header/phi/back-edge + parallel block_terminated setter; all Loop/Recur walker arms; 16 it.1/it.2 fixtures; 2 pin files; bench/it3-oracle/. Restored: 2 RC fixtures to1ff7e81content. Surgically kept (not in1ff7e81, landed with the milestone but independently sound): feature-acceptance clause 3 in DESIGN.md and skills/brainstorm/SKILL.md, with its worked example de-claimed from "shipped" to hypothetical-illustration form; the F3 P2 todo. bench/orchestrator-stats/2026-05-15-iter-it.{1,2,3}.json kept as historical record (like journals/plans). Sole net addition: an honest F1/F4 documented-idiom note in DESIGN.md (the tail-recursive accumulator fallback; examples/mut_counter.ail), guarded by a doc-presence test — "a documentation note is not a reshape", asserts nothing at the typecheck level. Roadmap: the Iteration-discipline block + blocking-fork section removed; the genuine total-Int-recursion ambition preserved as a deferred P2 milestone sequenced behind a future Nat/refinement-types milestone (not abandoned — correctly sequenced after the type machinery it needs). 2026-05-15-iteration-discipline.md carries a superseded header; it.1/it.2/it.3 journals + plans stay as history. Correctness gate PRISTINE: 164 surviving 1ff7e81-era fixtures ail check/ail run byte-identical to pre-milestone behaviour (verified against a1ff7e81worktree reference compiler, zero drift); cargo test --workspace 600/0; zero residual it.1/it.2 production surface. Spec docs/specs/2026-05-16-iteration-discipline-revert.md (b3853bf), plan docs/plans/2026-05-16-iter-revert.md (abf0013).
13 KiB
name, description
| name | description |
|---|---|
| brainstorm | Use when a new milestone is starting — gathers requirements, explores 2-3 approaches with trade-offs, presents a sectioned design with user approval, writes the spec to docs/specs/. Hard-gate before any plan or code work; applies even when the user says they have a clear vision. |
brainstorm — milestone spec generator
Violating the letter of these rules is violating the spirit.
Overview
The spec is where the orchestrator does the design work. It is the artefact that future iterations, the architect agent, and any future LLM read to understand WHAT the milestone delivers and WHY. Skipping the spec means shipping the user's intuition unfiltered, which is exactly the reactive-deference failure mode AILang's orchestrator discipline exists to prevent.
It produces specs at docs/specs/<milestone>.md.
When to Use / Skipping
Triggers:
- A new milestone is starting (e.g. user proposes a new feature area, a new subsystem, or a major refactor of an existing one).
- A milestone-scope spec is missing for an existing line of work and one is needed retroactively.
Skipping is permitted only for:
- A bug-fix iteration (use
debugdirectly). - A tidy iteration (use
auditdirectly). - A trivial mechanical edit (≤1 file, ≤30 LOC, no design judgement).
Skipping is not permitted for:
- A user request framed as "I have a clear vision, just plan it".
- A milestone described as "small, only two iterations".
- A milestone where you are confident you know what to build.
The first two cases above are the most common pressure to skip; both are explicitly resisted by this skill (see Common Rationalisations).
The Hard-Gate
NO IMPLEMENTATION, SCAFFOLDING, OR DOWNSTREAM SKILL INVOCATION
UNTIL A SPEC HAS BEEN PRESENTED AND THE USER HAS APPROVED IT.
The hard-gate applies regardless of perceived simplicity. The spec can be short for a small milestone (a few sections), but it MUST exist and be approved before any plan or code work begins.
The Process
Step 1 — Explore project context
Before asking any clarifying questions:
- Read the latest entries linked from
docs/journals/INDEX.md(most recent milestones, current state). - Skim
docs/DESIGN.mdfor the invariants the new milestone might touch. git log --oneline -20to see what just shipped.- Identify scope: is this one milestone, or does it need to be decomposed into sub-milestones first? If multi-subsystem, decompose.
Step 2 — Ask clarifying questions, one at a time
Multiple-choice when possible (easier to answer). One question per message — no batching. Focus on:
- Purpose: what problem does this solve?
- Constraints: what semantic / performance / compatibility invariants must hold?
- Success criteria: how do we know it shipped?
- Scope: what is OUT of scope?
Step 3 — Propose 2-3 approaches with trade-offs
Lead with your recommended option and explain why. Each approach gets:
- core idea (1-2 sentences)
- substantive trade-offs (semantic fit, schema impact, performance, composability)
- effort observation (NOT effort as rationale — see CLAUDE.md "Design rationale ≠ implementation effort")
Wait for user choice before proceeding.
Step 4 — Apply the feature-acceptance criterion
A feature ships only if all three hold:
- An LLM author (= future me) naturally produces code that uses it, AND
- The feature measurably improves correctness or removes redundancy, AND
- It reintroduces no bug class the core constraint exists to eliminate. Criterion 1 does not discriminate — an LLM reaches for every construct native to its imperative training distribution, so "the LLM reaches for it" is satisfied by exactly the constructs AILang most deliberately refuses. A documentation note is not a reshape: the gate is whether the wrong code fails to typecheck, not whether a guideline advises against it.
Aesthetic appeal does not count. Human ergonomics do not count. If
the answer to any of the three is "I'm not sure", the feature is
probably not ready. The full criterion (with the canonical worked
example — see the criterion text) lives in docs/DESIGN.md
("Feature-acceptance criterion"); this skill is the gate that
applies it during spec writing.
Step 5 — Present design in sections
Scale each section to its complexity (a few sentences if straightforward, up to 200-300 words if nuanced). Cover:
- Architecture
- Components
- Data flow
- Error handling
- Testing strategy
Ask after each section whether it looks right. Be ready to revisit earlier sections if a later one surfaces a contradiction.
Step 6 — Write the spec
Path: docs/specs/YYYY-MM-DD-<milestone>.md.
Structure:
# <Title> — Design Spec
**Date:** YYYY-MM-DD
**Status:** Draft — awaiting user spec review
**Authors:** Brummel (orchestrator) + Claude
## Goal
## Architecture
## Components
## Data flow
## Error handling
## Testing strategy
## Acceptance criteria
Step 7 — Self-review
Inline checklist (not a subagent dispatch):
- Placeholder scan: any "TBD", "TODO", incomplete sections, vague requirements? Fix.
- Internal consistency: sections must not contradict. Architecture must match component descriptions.
- Scope check: focused enough for one plan, or does it need sub-milestone decomposition?
- Ambiguity check: could any requirement be interpreted two ways? If so, pick one and make it explicit.
Fix issues inline. No need to re-review — fix and commit.
Step 7.5 — Grounding-Check Agent (hard-gate)
Dispatch the read-only ailang-grounding-check agent. The agent
reads the just-written spec with fresh context, extracts its
load-bearing assumptions about current compiler / checker / codegen
/ schema behaviour, and for each one searches the workspace for a
currently-green test that ratifies it.
Dispatch carrier:
| Field | Content |
|---|---|
spec_path |
path to the spec just written in Step 6 |
iteration_scope |
which sections cover the imminent first iteration (verbatim from the brainstorm session) |
The agent returns a PASS / BLOCK / INFRA_ERROR report. Boss
interpretation:
| Agent status | Boss action |
|---|---|
PASS |
Proceed to Step 8. The report goes into the brainstorm chat for the record. |
BLOCK |
Present the report to the user. User either: (a) accepts discard → execute the failure-mode procedure below; or (b) overrides in free chat ("Test <path>::<name> ratifies that") → log the override note in the brainstorm chat and proceed to Step 8. |
INFRA_ERROR |
Abort the brainstorm. The spec stays as-is on disk; debug the workspace out-of-band and re-dispatch the agent. |
Failure-mode procedure (no-override BLOCK):
-
Delete the just-written spec file from the working tree (
rm docs/specs/<spec_filename>.md— a Bash-level delete on the working tree, NOTgit rm; the file was never committed). -
Append a roadmap entry to
docs/roadmap.mdpointing forward to a future re-brainstorm, under the appropriate priority bucket:- [ ] **[<kind>]** <idea title> — <one-line description> - context: <why this is deferred> - depends on: <name of the unratified mechanism> -
Tell the user the spec was retired and which roadmap entry was added. The user / Boss commits the roadmap edit (suggested commit subject:
spec: retire <spec topic> — depends on <unratified mechanism>).
After the failure-mode procedure runs, the brainstorm session ENDS. There is no Step 8, no Step 9. The idea is parked until the dependency ships, at which point a fresh brainstorm session re-derives the spec from scratch.
Re-dispatch on any post-PASS edit. The grounding-check PASS
report is bound to the exact bytes of the spec at dispatch time.
Any subsequent edit to the spec file — Boss-side polish, a
user-requested change in free chat, a wording tighten, anything —
invalidates the PASS report and requires a fresh dispatch of
ailang-grounding-check before Step 8 commit. Step 7.5 is the
last step that touches the spec file; nothing slips between it
and the commit.
Step 8 — User-review gate
The spec sits in the working tree as an unstaged file. Tell the user:
Spec written to
<path>(uncommitted). Please review it and let me know if you want changes before we start the implementation plan. The Boss will commit it once you approve.
Wait for the user's response. If they request changes, edit the file in place (still uncommitted), re-run Step 7 AND re-dispatch Step 7.5 (the previous PASS report no longer covers the edited bytes), then return here. Only proceed to the next step after approval AND a fresh Step 7.5 PASS.
The Boss commits the approved spec after the user signs off
(suggested commit subject: spec: <milestone> <topic>). The
brainstorm skill does not perform the commit itself.
Step 9 — Hand off to planner
The terminal state of brainstorm is invoking planner. NO other
skill is invoked from brainstorm. NO direct jump to implement.
Hand off carries:
- path to
docs/specs/<milestone>.md - iteration scope ("the first iteration covers section X+Y of the spec")
Handoff Contract
| Direction | Carrier |
|---|---|
user → brainstorm |
new milestone request |
brainstorm → ailang-grounding-check (Step 7.5) |
spec_path + iteration_scope |
brainstorm → planner (Step 9, on PASS or overridden BLOCK) |
path to spec + iteration scope |
brainstorm → roadmap (Step 7.5, on no-override BLOCK) |
depends on: entry added to docs/roadmap.md in the working tree, spec file deleted from the working tree; Boss commits the roadmap edit |
Common Rationalisations
| Excuse | Reality |
|---|---|
| "User says 'clear vision, just plan it' — skip the spec" | "Clear vision" is a starting point, not a spec. The user's intuition hasn't priced in semantic commitments (RC, uniqueness, codegen, schema). Write the spec; frame it as "load-bearing decisions this idea forces on us". |
| "Milestone is small, two iterations, no spec needed" | Iteration count isn't the metric — feature surface is. A two-iter feature touching DESIGN.md invariants needs a spec; a CLI flag does not. Assess what the feature changes in invariants. |
| "Three approaches in, none feel right, ship the least bad" | Three unsatisfying approaches usually means the problem is mis-framed. Stop, write a JOURNAL entry capturing the three approaches and what fails about each, sleep on it. End-of-day pressure is the worst signal to resolve a design fork. |
| "User is busy, present my own design without Q&A" | Reactive deference disguised as decisiveness. The Q&A surfaces constraints the user hasn't articulated; skipping it means shipping the user's defaults, not their intent. |
| "Spec exists from previous milestone, append to it" | New milestone = new spec file. The architect agent reads spec files per milestone; mixing scopes makes drift review unreadable. |
| "Approaches A, B, C are all bad — proceed with A" | This is exactly the moment to surface "the problem is mis-framed" rather than ratify a known-bad shape into DESIGN.md. JOURNAL the impasse, escalate to user. |
| "Just polishing a wording after PASS, no need to re-dispatch" | The grounding-check report attests to specific bytes. A polish edit changes the bytes; the previous attestation no longer covers them. Re-dispatch is cheap; the alternative is a commit with an attestation that doesn't match the file. |
Red Flags — STOP
- "Skip the spec" thoughts (any flavour)
- "One paragraph is enough"
- "User said it's clear, who am I to push back"
- "The 2-3 approaches all suck, just pick one"
- Skipping Step 7 self-review because "I wrote it carefully"
- Editing the spec file after a Step 7.5 PASS without re-dispatching
- Jumping straight from spec to
implement(must go viaplanner) - Inventing a design rationale that's actually about effort, not semantics
Cross-references
- Project source:
docs/DESIGN.md"Feature-acceptance criterion" — gate this skill applies during spec writing. - Output target:
skills/planner/SKILL.md— only valid next skill. - Private agent:
skills/brainstorm/agents/ailang-grounding-check.md— dispatched in Step 7.5 as a hard-gate. The agent reads the spec with fresh context and reports PASS / BLOCK / INFRA_ERROR. Seedocs/specs/2026-05-11-brainstorm-grounding-check.mdfor the design rationale. - Ad-hoc dispatch. The Boss MAY also ad-hoc dispatch
skills/planner/agents/ailang-plan-recon.mdduring Step 1 when the milestone enters code territory the Boss has not recently read; this is opt-in and not part of the standard process. Rationale: brainstorm's recon phase is interwoven with the user Q&A — seedocs/specs/2026-05-11-plan-recon-subagent.mdfor the full reasoning.