Skip to content
Open

RM #46

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
184 commits
Select commit Hold shift + click to select a range
9e85cdd
added solver stubs
Feb 22, 2026
d4596be
before commit solver
Feb 23, 2026
f98e0ad
about to connect postparser to solver
Feb 23, 2026
02c5837
added cursor stuff
Feb 23, 2026
d10f771
a little more
Feb 23, 2026
c46733f
a little further
Feb 23, 2026
472e9a4
more comments
Feb 23, 2026
ea9639d
finished combining postparser and solver
Feb 24, 2026
e9d1916
renamed
Feb 24, 2026
e6d0e43
docs
Feb 24, 2026
68a7d4f
added cursor and claude things and a lib.rs
Feb 24, 2026
fe05363
added more to gitignore
Feb 24, 2026
a81ad85
ai refactors and starting higher_typing
Mar 2, 2026
c33c304
placeheld higher_typing_pass.rs, doesnt yet build
Mar 2, 2026
391bdf7
not working yet
Mar 2, 2026
d76c776
right before starting migrating highertyping
Mar 3, 2026
fd8c5d9
improving guard rails
Mar 7, 2026
951a7e5
added tests to writecop
Mar 7, 2026
8749133
[TEMPORARY]
Mar 25, 2026
bc359d4
temporary
Mar 26, 2026
17a06e5
temporary
Mar 26, 2026
f7e62b3
Add VV violation skill, update docs with review notes, delete obsolet…
Mar 26, 2026
71aa187
guardian toml
Mar 26, 2026
c742252
from feedback
Mar 27, 2026
1008206
Split the monolithic Interner into per-pass arenas (ParseArena and Sc…
Mar 28, 2026
2122384
Migrate expression parser to arena-allocated references (IExpressionP…
Mar 29, 2026
685fa58
Inline ScrambleIterator from its own file (scramble_iterator.rs, dele…
Mar 30, 2026
fa4cc16
Implement deferred-slice-interning pattern (DSAUIMZ) for rune interni…
Mar 30, 2026
1582208
Consolidate arena allocation behind ParseArena and ScoutArena methods…
Mar 30, 2026
38a1e8f
Add Copy derives to ~120 parser/postparser/scout AST structs and enum…
Mar 31, 2026
b855437
Make ITemplataType, TemplateTemplataType, and PackTemplataType Copy b…
Mar 31, 2026
0cd694d
Delete the validate-readonly hook from .claude/hooks/ (moved to Luz/h…
Apr 7, 2026
aa26c43
Refactor the Scala solver to eliminate the IStepState intermediary la…
Apr 7, 2026
bf430fc
Replace getPuzzlesForRule with a new addRuleAndPuzzles method on ISol…
Apr 7, 2026
74371d6
Eliminate the canonical-rune indirection layer from the Scala solver.…
Apr 7, 2026
e4b06ba
Introduce commitStep on SimpleSolverState to atomically record a Step…
Apr 8, 2026
f2371ad
Inline addRuleAndPuzzles, concludeRune, addRule, addStep, addPuzzle, …
Apr 8, 2026
7c3dfee
Clean up Solver.scala by removing 60+ lines of commented-out dead cod…
Apr 8, 2026
9f1503a
Decompose the Solver class into a stateless companion object with two…
Apr 8, 2026
385bbc4
Inline `Solver.advance` and the `ISolveRule` trait into each call sit…
Apr 8, 2026
7bc3759
Unify solver outcome types by merging `IncompleteSolve` into `FailedS…
Apr 8, 2026
e34d34b
Eliminate `IIncompleteOrFailedCompilerSolve` hierarchy (`IncompleteCo…
Apr 8, 2026
21a57f5
cleanups
Apr 8, 2026
6dac2c8
Brought scala comments back in line
Apr 9, 2026
6d86792
Eliminate the `ISolverState` trait and `SolverDelegate` trait, removi…
Apr 9, 2026
4177b82
ai skills
Apr 11, 2026
450f07d
ignore
Apr 11, 2026
d1f93d6
Run slice pipeline (mig comment insertion + placeholder stubs) on six…
Apr 13, 2026
db7e2e9
Run slice pipeline (mig comment insertion + placeholder stubs) across…
Apr 14, 2026
bc0b6c2
Run slice pipeline across the entire typing pass: insert mig slice co…
Apr 15, 2026
be06881
Add `<'s, 't>` lifetime parameters with PhantomData to all typing pas…
Apr 15, 2026
94d1fbd
Add `<'s, 't>` two-lifetime parameters to all typing pass placeholder…
Apr 15, 2026
b70ad23
Update typing pass macro `generate_function_body` signatures across 4…
Apr 15, 2026
561d9f9
Wire up all remaining typing pass modules and add real Rust struct/fn…
Apr 16, 2026
ea47562
Fix typing pass placeholder stubs to use proper impl blocks and corre…
Apr 16, 2026
aac0a8b
Eliminate all duplicate-fn E0428 errors in typing pass by wrapping fr…
Apr 16, 2026
30ca1e8
Fix the pre-existing struct_compiler.rs:158 parse error so the module…
Apr 16, 2026
a67435c
Partial signature-repair sweep — Phases 1, 2, and start of 3.
Apr 16, 2026
4c6b770
Continue signature-repair sweep — batch E0107 fixes across typing pass.
Apr 16, 2026
dcb9d3d
Eliminate all E0107 type-parameter-arg mismatches across typing pass.
Apr 16, 2026
b0755b3
Continue signature repair: add `<'s, 't>` to more fn signatures and t…
Apr 16, 2026
b78e1ab
Continue signature repair: more E0106 fixes in compiler_error_humaniz…
Apr 16, 2026
701621b
Continue signature repair: add `<'s, 't>` to free fns in
Apr 16, 2026
0f0f6cd
Continue signature repair: add `<'s, 't>` to more fn signatures in
Apr 16, 2026
df8413a
Continue signature repair: more <'s, 't> fixes in infer/compiler_solv…
Apr 16, 2026
adc2fb5
Continue signature repair: finish array_compiler.rs E0106 fixes.
Apr 16, 2026
3318499
Continue signature repair: fixes in name_translator, sequence_compiler,
Apr 16, 2026
2acae4d
Continue signature repair: add lifetimes to struct-field types across
Apr 16, 2026
f60508a
Continue signature repair: finish E0106 in small-file sweep.
Apr 16, 2026
545a29a
Finish E0106: ConvertHelper.opts gains `<'s>`. Rename conflicting
Apr 16, 2026
213ae3e
Phase 4 cleanup: eliminate remaining E0425 misses.
Apr 16, 2026
49281b8
Typing slab 1: flesh out the `Compiler` god struct with its four real…
Apr 16, 2026
8883ac0
God-struct refactor Steps 2–11: merge ten sub-compilers onto Compiler.
Apr 16, 2026
8e6f070
God-struct refactor continued: merge ExpressionCompiler's 19 methods …
Apr 16, 2026
e7019c1
God-struct refactor: merge TemplataCompiler onto Compiler.
Apr 17, 2026
268b21c
God-struct refactor: merge EdgeCompiler onto Compiler.
Apr 17, 2026
90d11f9
God-struct refactor: merge ImplCompiler onto Compiler.
Apr 17, 2026
2585dc4
God-struct refactor: merge StructCompiler bundle onto Compiler.
Apr 17, 2026
7b448bb
God-struct refactor: merge ArrayCompiler onto Compiler.
Apr 17, 2026
ab1c85b
God-struct refactor: merge BodyCompiler onto Compiler.
Apr 17, 2026
6619fba
God-struct refactor: start FunctionCompiler bundle — outer FunctionCo…
Apr 17, 2026
1437822
God-struct refactor: merge FunctionCompilerCore onto Compiler.
Apr 17, 2026
b982b4c
God-struct refactor: merge FunctionCompilerMiddleLayer onto Compiler.
Apr 17, 2026
1bf9035
God-struct refactor: merge FunctionCompilerSolvingLayer onto Compiler.
Apr 17, 2026
fd45b5a
God-struct refactor: merge FunctionCompilerClosureOrLightLayer onto C…
Apr 17, 2026
9ca0f51
docs: update god-struct progress handoff — all 8 upper-tier done.
Apr 17, 2026
312e62f
Clean up unused imports across typing/ after god-struct merge refacto…
Apr 17, 2026
eaf7719
Thread unused `'s`/`'t` lifetimes through typing/ stubs with `Phantom…
Apr 17, 2026
92e3cdd
Quiet post-merge compiler warnings in typing/ stubs by allowing unuse…
Apr 17, 2026
56922c7
God-struct refactor: set up macro dispatch enums + merge LockWeakMacro.
Apr 18, 2026
88a32a7
God-struct refactor: merge AsSubtypeMacro onto Compiler.
Apr 18, 2026
9f7a399
God-struct refactor: merge SameInstanceMacro onto Compiler.
Apr 18, 2026
542f89e
God-struct refactor: merge FunctorHelper onto Compiler.
Apr 18, 2026
e29c6b3
God-struct refactor: merge remaining 15 macros onto Compiler.
Apr 18, 2026
261212f
God-struct refactor Step 8: delete 11 vestigial *Compiler/helper stru…
Apr 18, 2026
9fd7641
Typing Slab 1: flesh out leaf types — OwnershipT/MutabilityT/Variabil…
Apr 18, 2026
09d4cf6
docs
Apr 18, 2026
d48db6c
Strip `// mig:` markers from src/typing/ — slice pipeline artifacts, …
Apr 18, 2026
d3114c8
Typing Slab 2 prep: extend derives on RegionT/CoordT/KindT/ICitizenTT…
Apr 18, 2026
d6f0976
Typing Slab 2 Tier A: flesh out 8 fieldless name structs in names.rs.
Apr 18, 2026
1153531
Typing Slab 2 Tier B: flesh out 31 scout-lifetime-only name structs.
Apr 18, 2026
24a52a0
Typing Slab 2 Tier C: flesh out remaining typing-lifetime name structs.
Apr 18, 2026
a3c3497
Typing Slab 2 Step 3: fill 21 sub-enums with real variants per DAG.
Apr 18, 2026
880ab87
Typing Slab 2 Step 4: make IdT<'s, 't, T: Copy> generic per handoff §…
Apr 18, 2026
1811a12
Typing Slab 2 Step 4 refinement: drop IdT default, specify leaf at ev…
Apr 18, 2026
7327e07
Typing Slab 2 Step 5: From/TryFrom bridges between sub-enums and conc…
Apr 18, 2026
28b0fc5
Typing Slab 2 refactor: inline-owned sub-enums, drop per-sub-enum int…
Apr 18, 2026
067f512
quest.md: document the inline-owned sub-enum design shift.
Apr 18, 2026
8359c0b
Inline INameT: IdT.init_steps becomes &'t [INameT], drop INameT from …
Apr 18, 2026
7eaf917
Typing Slab 2 Step 6: IDEPFL *ValT companion types for name interning.
Apr 18, 2026
c69a3d2
docs: Slab 3 handoff (Kind/Coord/Templata trio).
Apr 19, 2026
6b71944
IdT/PrototypeT become monomorphic; generic-typed views deferred post-…
Apr 19, 2026
27fc148
Slab 3 handoff: update for IdT/PrototypeT monomorphic refactor.
Apr 19, 2026
6c46389
Slab 3 handoff: resolve Gotcha 1 — KindT follows Slab 2 inline/intern…
Apr 19, 2026
69cd57e
Slab 3 handoff: answer junior's three Val/intern-method questions.
Apr 19, 2026
2a1e3d2
Typing Slab 3: KindT/ITemplataT payloads + IDEPFL Val companions.
Apr 19, 2026
afcf2f8
TL-HANDOFF + quest.md refresh after Slabs 2-3.
Apr 19, 2026
0f3ae1f
Typing Slab 4 Steps 2-4: interner substrate, variables, env entries.
Apr 19, 2026
3b77210
Typing Slab 4 Steps 5-7: envs, boxes, heavy-templata lifetimes, 6-map…
Apr 19, 2026
0110506
typing_interner: document why intern_coord_list_templata is hand-writ…
Apr 19, 2026
13219e7
Slab 4 planning + doc refresh: handoff-slab-4, env reasoning doc, que…
Apr 19, 2026
c19831d
typing-pass-arenas.md: collapse long-term section to a pointer at the…
Apr 19, 2026
88a0d46
docs
Apr 19, 2026
9b33567
typing: stylistic cleanup across typing/ — hoist `use` imports above …
Apr 19, 2026
cc295a0
typing: stylistic cleanup across typing/ast/, typing/env/, typing/tem…
Apr 20, 2026
e80eb81
Typing pass Slabs 5-10: expression AST, CompilerOutputs/HinputsT/Comp…
Apr 20, 2026
ee246a2
Typing pass Slab 11: expression-layer method signature rewrite (39 si…
Apr 20, 2026
1127eaa
Typing pass Slabs 12 + 13: solver/resolver + function/citizen/macros …
Apr 20, 2026
64a742a
Typing pass Slabs 14 + 14b: placeholder type & trait flesh-out — ever…
Apr 21, 2026
e0e3a90
Typing pass test scaffolding: slice all compiler test files into the …
Apr 21, 2026
1962641
Extend the check-scala-comments hook with FILE_MAP entries for the ne…
Apr 22, 2026
6a1d9c4
Move project CLAUDE.md from .claude/ to the repository root, annotate…
Apr 22, 2026
ed11c79
Thread a `'t` bumpalo lifetime through the compilation pipeline struc…
Apr 23, 2026
598c8d4
Typing pass Slab 15a: migrate `evaluate`, `compile_static_sized_array…
Apr 25, 2026
76cb326
Typing pass Slab 15b: migrate the function compilation pipeline from …
Apr 27, 2026
7b8f6b3
Slab 15c continues the typing pass migration: implement `get_runes` (…
Apr 28, 2026
c4bab78
Slab 15d continues the typing pass migration: implement the function …
Apr 29, 2026
03ca3d3
Add InternToken seal to IdT so all IdTs are forced through the typing…
Apr 29, 2026
be1e649
Rename `InternToken` to `MustIntern` and generalize the seal: every T…
Apr 29, 2026
4638273
Introduce dedicated `*ValT` lookup-key structs (`StructTTValT`, `Inte…
Apr 29, 2026
e3040e6
Slab 15c continues the typing pass body migration: implement `declare…
Apr 30, 2026
7abfd57
Add Guardian submodule
Apr 30, 2026
050f18e
Convert Sylvan/Luz from clone to submodule
Apr 30, 2026
2c9f3a0
Bump Guardian pin (adds opencode submodule, Luz pin fix, OPENROUTER_A…
Apr 30, 2026
b7dd325
Disable Guardian PreToolUse hook in settings.json
Apr 30, 2026
d16312e
Revert "Disable Guardian PreToolUse hook in settings.json"
Apr 30, 2026
9410f73
Slab 15d continues typing-pass body migration around `unletLocalWitho…
Apr 30, 2026
d7e9f0c
backwards
Apr 30, 2026
fb0a773
Slab 15e wires up `simple_program_returning_an_int_explicit` end-to-e…
May 1, 2026
7b59079
Slab 15f wires up `hardcoding_negative_numbers` end-to-end and lays t…
May 1, 2026
cb8e399
Fix Scala compile breakage from db7e2e92's slice-pipeline reformatter…
May 1, 2026
be51447
Bring `FrontendRust/src/` audit-trail `/* scala */` blocks into parit…
May 1, 2026
e7aa089
Slab 15g extends the `taking_an_argument_and_returning_it` test from …
May 2, 2026
92b472d
Slab 15h wires the function-call evaluation pipeline end-to-end so a …
May 3, 2026
c55398a
Slab 15i lands `tests_panic_return_type` end-to-end — `import v.built…
May 5, 2026
216ec39
Slab 15j scaffolding: fix four `TypingPass*VarNameT` struct shapes (h…
May 6, 2026
943305f
Slab 15j body migration lands `tests_adding_two_numbers` end-to-end a…
May 7, 2026
98eb506
Guardian curate: NNDX shield/trainee tuning, strip stale SPDMX temp-d…
May 8, 2026
2948662
Slab 15k body migration extends the typing pass through more `compile…
May 8, 2026
d9c3849
Slab 15m mid-batch hand-back: Polyvalue env reclassification across `…
May 12, 2026
ce18533
Slab 15n: anonymous-interface scaffolding + widen `ICitizenDeclaratio…
May 12, 2026
d98c18f
gitignore
May 12, 2026
c5821c0
Untrack for-tl.md (already in .gitignore).
May 12, 2026
1ba7a5d
Slab 15o: body migration drives 14 more compiler_tests through abstra…
May 13, 2026
98177df
Slab 15p: body migration drives 17 more compiler_tests through
May 13, 2026
f7a25f9
rename for linux
May 13, 2026
96b7912
nightly
May 13, 2026
7f704d6
nightly
May 13, 2026
beac3e0
Slab 15q: body migration drives 14 more compiler_tests through arrays…
May 15, 2026
270839f
Slab 15r: body migration drives 17 more compiler_tests through the er…
May 16, 2026
31ca969
Slab 15s: typing-pass test migration completed across compiler_solver…
May 18, 2026
6fd6bda
Slab 15t: TDD-drive roguelike.vale through 4 postparser expression ca…
May 18, 2026
97e331b
Slab 15u: typing_pass_on_roguelike now passes end-to-end — JR drove 4…
May 18, 2026
e2ed0d2
Slab 15v: flip typing-pass expression AST to TFITCX-shape — Reference…
May 18, 2026
2577d43
Slab 15w: migrate the lone-holdout test compiler_generics_tests::upca…
May 18, 2026
5936f09
Slab 15x: typing-pass UUSNNCBX sweep — hoist function-body `use` stat…
May 21, 2026
aadc3ab
Slab 15y: strict Scala-parity sweep across the 20 // LOOK HERE typing…
May 21, 2026
0776339
Slab 15z: collapse sequential per-field nested matches into single de…
May 21, 2026
6337b92
Slab 15aa: remove all 20 `// LOOK HERE` audit-trail markers from the …
May 21, 2026
d0f5853
Check in all 10 untracked markdown files accumulated across the sessi…
May 21, 2026
36c313c
Sweep up the rest of the session's accumulated working-tree changes (…
May 21, 2026
e03cac7
Bump Guardian and top-level Luz submodule pointers to reflect the bul…
May 21, 2026
a735ed6
Bulk commit of slice-pipeline session work: simplifying-pass slice-pi…
May 22, 2026
224e92a
Bump Luz submodule pointer after rebasing the SCPX FILE_MAP + SPDMX e…
May 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 12 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[env]
RUST_BACKTRACE = "1"
# 16MB stack for #[test] threads. Default is 2MB, too small for debug-mode
# runs on real programs (e.g. typing_pass_on_roguelike): postparser's
# scout_expression has a giant match whose per-arm let-bindings (StackFrame
# ~200B + IScoutResult variant-sized + two VariableUses) each get their own
# stack slot in debug, producing ~21KB frames. ~96 frames of mutual recursion
# through scout_expression/scout_function/scout_lambda exhausts the default.
# Release-mode mem2reg+inlining collapses the locals and the test passes
# with 2MB. TODO post-migration (per TL.md residual): remove once
# scout_expression is split per-arm or its locals are Boxed.
RUST_MIN_STACK = "16777216"
37 changes: 37 additions & 0 deletions .claude/agents/agent-check-correct-loop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: agent-check-correct-loop
description: Enforce strict Scala parity by removing novel Rust logic/functions and reshaping migrated code to match Scala structure exactly, using panic!/assert! only for not-yet-needed branches
tools: [Read, Edit, Grep, Glob, Bash, Task]
model: sonnet
---

Please look at FrontendRust/zen/migration_principles.md. We'll be adhering to those restrictions.

You were given a file and a definition name in the file (function, type, etc.).

Your main goal: do this loop:

1. Run "/migration-check-specific {file name} {definition name}". In other words, run the "migration-check-specific" sub-agent and give it the file and definition I gave you.
* If it says APPROVED, you can stop.
* If it asks a QUESTION, then pause and ask me the question.
* If it asks you to replace a `panic!` placeholder with implementation from Scala, please pause and ask me if that should happen.
* If it rejects, then continue to step 2.
2. Make edits to fix what it reported. CRITICAL RULES:
* DO NOT ADD ANY novel logic! All the functions you need should already exist as Scala code in a comment. NO adding new functions. You will only be modifying existing functions.
* Anything you add should be *directly immediately above* the Scala comment. NOT below the comment. NOT in a different file. Feel free to slice scala comments apart so the new rust code can be directly above the old scala code.
* Only *iteratively* implement the bare minimum that you need to make it compile. Add panic!/assert! placeholders until it compiles, then implement only the panic!s/assert!s your test runs into.
* **Conservatively implement as little as possible.** **Aggressively panic!** for anything that might not be executed by current tests. This will help us minimize our current changes.
* Every new `match` arm or `if` branch you add should simply have `panic!` in it. We'll fill it out later if the tests actually trigger them.
* Every new loop you add should simply have `panic!`s in the body. We'll fill it out later if the tests actually trigger them.
* Every new `map` call you add should simply have `panic!`s in the closure body. We'll fill it out later if the tests actually trigger them.
* ...and so on. Basically, any new conditional code should just `panic!`.
* If you're unsure about anything, or there's a choice to be made, pause and ask me for help. I like being a part of things, so please don't hesitate.
3. Run all tests for the project.
* `cargo test`. DON'T JUST BUILD; don't just `cargo build` or `cargo check`, those aren't enough. Do `cargo test` with the right flags.
* If it all passes, good! Restart the loop at step #1.
* If it fails, proceed to step 4.
4. Fix. Edit it so your changes don't make the test fail.
* Adhere to the same guidelines as for #2. If you run into trouble, pause and ask me!
* If you hit a panic!, that's a placeholder. Replace it with code from the Scala version (which should be somewhere below).
* You *cannot use your own novel code* to fix. The only way to make this better is to bring the rust code closer to the old scala code.
* Then, go back to step #3 to re-run. Step 3 and 4 make a little sub-loop.
27 changes: 27 additions & 0 deletions .claude/agents/migrate-scoper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: migrate-scoper
description: Tell AI what to implement next during a migration
---

You should see a "tmp/migrate-direction.md" file in the project directory.
It contains some migration instructions from a rather inexperienced project manager.
If you don't see a "tmp/migrate-direction.md" file, please stop here and say "VERDAGON" to bring my attention to it.

Here's what I want you to do:

First, please look at FrontendRust/zen/migration_principles.md. The information will be necessary for this.

Then, please answer these questions:

1. Do the instructions say that we're already done? If so, please say "VERDAGON" to bring my attention to it.
2. Do the instructions seem confused? If so, please say "VERDAGON" to bring my attention to it.
3. If it identifies some other problem (not just a simple bit of further needed migration), please say "VERDAGON" to bring my attention to it.
4. Do the instructions have multiple steps? If so, please pick the first one. We want the next step to bring over *the minimum* amount of Scala code that gets us *closer* to addressing what was going wrong.
* If you see multiple panics causing teh current problem, only recommend fixing the one panic we actually hit (as reported by tmp/migrate-direction.md) or the one we would hit first. Do NOT recommend fixing multiple panics at once.
* Make sure the instructions mention that we don't need it to work end-to-end yet, we just need it to get a tiny bit closer.

After you answer those questions, please tell me some updated instructions for the next step to implement.

If there is something that confuses you, stop and ask me for help by saying my name "VERDAGON". I like being a part of things, so please don't hesitate.

Important: DON'T modify any files!
54 changes: 54 additions & 0 deletions .claude/agents/migration-check-specific.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
name: migration-check-specific
description: Enforce strict Scala parity by detecting novel Rust logic/functions and mismatched migrated code to match Scala structure exactly
tools: [Read, Grep, Glob]
model: sonnet
permissionMode: plan
---

First, please read FrontendRust/zen/migration_principles.md, FrontendRust/zen/testing.md, and the postparser-migration-guidelines.mdc rules, right now. You'll be enforcing their checks and guidelines.

You were given a file and a definition name in the file (function, type, etc.). It's part of a Scala->Rust migration.

You'll help me by making sure it's getting migrated in the right way.

Do not edit the files, you should only be reading.

Please *only* critique the given definition, and be strict. Please check:

1. Did they add novel logic, or new functions that didn't exist in the Scala version? If so, tell me to rip them out and do things properly. NO new functions, NO novel code. Everything must match Scala, and all the corresponding new Rust functions are already present.
2. Is it shaped like the Scala code? It should mirror the old Scala code exactly. We should have exactly the same match statements and if-statements that Scala has. The only allowable difference is that the bodies of some of the if-statements and match-statements can have panic!s in them.
3. Does it call out to the same functions as the Scala code? We should have exactly the same helper calls. Absolutely no exceptions.
4. RSMSCP, if it applies here.
5. TUCMP, if it applies here.
6. DCCR, if it applies here.
7. MACT, if it applies here.
8. ESCCD, if it applies here.
9. AIMITIP, if it applies here.
10. SWDWMS, if it applies here.
11. KICI, if it applies here.
12. Does it violate anything in our style guide? (in /style-guide, from style-guide.mdc)
13. Is everything in Rust in the same order as it was in the Scala?

If the definition is a test, then please also check:

14. PFFNONM
15. SSMSHSVN
16. PSMONM
17. TPUTEFC
18. NHCIT
19. UEFIAI
20. PSFWP
21. UCMTRS

Your response:

* If there are violations, please respond "NEEDS_WORK: <explanation>" and explain what you see and what should change.
* If you're unsure about something, respond with "QUESTION: <question>" and ask me for clarification.
* If it all looks fine, respond with "APPROVED".

That's all that's needed. Extra guidelines:

* Don't propose how to fix it, just explain what's wrong.
* `panic!`s are sacred and you are meant to ignore any difference that `panic!`s or `assert!`s make unreachable.
* Don't justify replacing `panic!`s. Don't explain why something isn't replacing `panic!`s. I will decide.
25 changes: 25 additions & 0 deletions .claude/agents/migration-gate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: migration-gate
description: Enforce strict Scala parity by detecting novel Rust logic/functions and mismatched migrated code to match Scala structure exactly
tools: [Read, Grep, Bash]
model: sonnet
permissionMode: plan
---

You'll be checking a Scala -> Rust migration. Please do a `git diff HEAD` to see what we have so far.

If I gave you a specific file, and a specific function or type, please focus only on that one. If I didn't, then focus on the entire diff.

* Did we add novel logic, or new functions that didn't exist in the Scala version? If so, tell me to rip them out and do things properly. NO new functions, NO novel code. Everything must match Scala, and all the corresponding new Rust functions are already present.
* Is it shaped like the Scala code? It should mirror the old Scala code exactly. We should have exactly the same match statements and if-statements that Scala has. The only allowable difference is that the bodies of some of the if-statements and match-statements can have panic!s in them.
* Does it call out to the same functions as the Scala code? We should have exactly the same helper calls. Absolutely no exceptions.

Exception: it's generally fine if there's a panic! placeholder instead of some scala code. I'll migrate those myself later.

Be strict.

If there are violations, please respond `NEEDS_WORK: <explanation>` and explain what you see and what should change.

If it all looks fine, respond with `APPROVED`.

Do not edit the files, you should only be reading.
36 changes: 36 additions & 0 deletions .claude/agents/migration-migrate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: migration-migrate
description: Partially migrate commented Scala code to Rust
tools: [Read, Edit, Grep, Glob, Bash]
model: sonnet
---

We're currently in the middle of a small incremental bit of a larger Scala->Rust migration.

You will also be told:

* Some commented out Scala code in a Rust file. The commented out Scala code was correct, and now we're migrating it to Rust.
* What was going wrong, and which parts of the Scala code we need to bring over.

Here's what I want you to do:

* First, look at FrontendRust/zen/migration_principles.md.
* Then, I want you to bring over *the minimum* amount of Scala code that gets us *closer* to addressing what was going wrong.

Your changes should build; make sure to run `cargo build --lib`. If that fails, then please correct your changes.

DO NOT RUN `cargo test`. That's someone else's job.

CRITICAL RULES:

* DO NOT ADD ANY novel logic! All the functions you need should already exist as Scala code in a comment. NO adding new functions. You will only be modifying existing functions.
* Anything you add should be *directly immediately above* the Scala comment. NOT below the comment. NOT in a different file. Feel free to slice scala comments apart so the new rust code can be directly above the corresponding old scala code.
* Only implement the bare minimum that you need to make it compile. Add panic!/assert! placeholders until it compiles, then implement only the panic!s/assert!s your test runs into.
* Every new `match` arm or `if` branch you add should simply have `panic!` in it. We'll fill it out later if the tests actually trigger them.
* Every new loop you add should simply have `panic!`s in the body. We'll fill it out later if the tests actually trigger them.
* Every new `map` call you add should simply have `panic!`s in the closure body. We'll fill it out later if the tests actually trigger them.
* ...and so on. Basically, any new conditional code should just `panic!`.
* In other words, **conservatively implement as little as possible.**
* In other words, **aggressively panic!** for anything that might not be executed by current tests. This will help us minimize our current changes.
* If you're unsure about anything, or there's a choice to be made, pause and ask me for help. I like being a part of things, so please don't hesitate.
* If you run into any lifetime errors, STOP. We'll need Evan to fix those, because lifetime errors in this project are incredibly difficult, and `rustc` ALWAYS LIES. You get bonus points and cookies if you stop because you found a lifetime error.
64 changes: 64 additions & 0 deletions .claude/agents/slice-impl-wrap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
name: slice-impl-wrap
description: Wrap each module-scope fn in its own dedicated impl block, using `// mig: impl Foo` markers to determine the receiver type
tools: [Read, Edit, Grep]
model: haiku
---

You were pointed at a Rust file that already went through slice-start → slice-rustify → slice-placehold. Every Scala definition has a `// mig:` marker above a placeholder stub. `fn` stubs are currently at module scope; your job is to wrap each one in its own dedicated `impl<…> Foo<…> { fn … }` block (one impl per method), matching the style used in `FrontendRust/src/typing/`.

This is the inverse of the "open impl, emit many methods inside, close impl" pattern — instead, we use **one impl block per method**. This gives each method an independently-editable wrapper and is easier for downstream agents to reason about.

# Step 0: Read the pass migration policy

Find the `migration-policy.md` for this pass by walking up from the target file's directory. If only the template at `FrontendRust/docs/migration/migration-policy.md` is found and no per-pass override exists, STOP and report "no per-pass migration-policy.md found." Otherwise, read it for **lifetimes** and **where-clauses** to apply to each impl opener.

# Algorithm

Walk the `// mig:` markers top to bottom, maintaining a **current receiver type** — the name of the most recent `// mig: impl Foo` marker you've crossed. Initially the receiver is `None`.

For each `// mig:` marker:

1. **`// mig: struct Foo` / `// mig: enum Foo` / `// mig: trait Foo`** — do nothing; leave the existing stub.
2. **`// mig: impl Foo`** — update the current receiver to `Foo`. Do not emit anything.
3. **`// mig: fn foo`** — find the module-scope `pub fn foo(...)` stub directly below this marker. If the current receiver is `Some(Foo)`, wrap that stub in its own dedicated impl block:
```rust
impl<'s, 't> Foo<'s, 't>
where /* policy's where-clause */
{
pub fn foo(/* same params */) -> /* same return */ {
/* same body */
}
}
```
- Use the policy's lifetimes and where-clause on every impl opener.
- The closing `}` of the impl goes immediately after the closing `}` of the wrapped fn.
- If the fn took an explicit `self_: &Foo<…>` first parameter (added by slice-placehold), convert it to `&self` inside the impl.
- If the current receiver is `None` (i.e. the fn is logically module-scope — e.g. a free function not inside any Scala `class`/`object`), leave the fn at module scope and emit nothing.
4. **Dispatchers emitted under `// mig: impl Foo`** (the `/* Guardian: disable-all */ pub fn method(this: &Foo, ...)` stubs from slice-placehold) — wrap each in its own `impl<...> Foo<...> { fn method(&self, ...) ... }` block too. Preserve the `/* Guardian: disable-all */` annotation immediately above the impl.

# Scope-end heuristic

The Scala class body has a closing `}` inside its `/* */` block. When you cross it, reset the current receiver to `None`. The next `// mig: fn` after that point is at module scope until another `// mig: impl Foo` re-opens a receiver.

# Guidelines

* **This step rewrites existing module-scope `pub fn` stubs in place.** It must not delete any `// mig:` markers, Scala `/* */` blocks, or struct/enum/trait definitions.
* Each impl block wraps exactly one method.
* Preserve the body of each fn verbatim (usually just `panic!("Unimplemented: foo");`).
* Apply the policy's lifetimes and where-clause to every impl opener.
* **Drop per-fn `<'s, 't>` generics** when wrapping. If the original module-scope stub was `pub fn foo<'s, 't>(...)`, strip the `<'s, 't>` from the fn signature — the impl block's `impl<'s, 't> Foo<'s, 't>` already provides them, and duplicating them produces shadowing warnings (per TL.md §143). Keep any *additional* per-fn generics that don't appear on the impl (e.g. `<T: SomeTrait>`).
* Preserve any doc comments / `/* Guardian: disable-all */` annotations attached to the fn — move them above the impl block (the impl block becomes the new outer scope).
* Trait impls and `impl PartialEq for Foo { ... }` blocks emitted by slice-placehold for identity equality are left untouched.
* Tests (`#[test] fn ...`) stay at module scope — never wrap a test in an impl.

# Restrictions

* Do not build or test.
* Do not reorder `// mig:` markers or Scala comments.
* **NEVER delete, modify, or move any Scala code inside `/* */` blocks.** Your only job is to wrap existing module-scope Rust `pub fn` stubs in `impl<...> Foo<...> { ... }` blocks. The `/* */` blocks containing the original Scala code must remain exactly in place — same content, same order. If your edit removes or reorders any Scala line from any `/* */` block, you have broken the SCPX audit trail.
* Do not use sed -i or scripts.

# When done

Say "done" and report the number of fns wrapped and the number left at module scope (with a brief reason for each module-scope fn).
Loading