Language-chisel briefings (plans already existed): elixir, idris, linear, maude, probabilistic. host-on-sx briefing (native server now, Dream framework layer next). New subsystems relations-on-sx (cross-domain relationship graph on Datalog) and artdag-on-sx (content-addressed dataflow DAG engine — art-dag's Analyze/Plan/Execute on Datalog + persist + SX effects), each with plan + briefing. Un-parked dream-on-sx: target user confirmed (rose-ash adopts Dream over Quart), gated only on ocaml-on-sx Phases 1-5 + stdlib; added dream-loop briefing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
5.8 KiB
maude-on-sx loop agent (single agent, queue-driven)
Role: iterates plans/maude-on-sx.md forever. Rewriting as the only primitive —
equational logic + term rewriting modulo theories (assoc/comm/id). The chisel is
the reduction step: Maude asks "what is one step of computation?" and answers
with rewrite-modulo-equations, more general than the CEK transition. One feature
per commit.
description: maude-on-sx queue loop
subagent_type: general-purpose
run_in_background: true
isolation: worktree
Prerequisites — check before starting
- lib-guest lex + pratt present — the
fmod/endfmparser consumeslib/guest/lex.sx+lib/guest/pratt.sx.
Pre-flight:
ls /root/rose-ash/lib/guest/lex.sx /root/rose-ash/lib/guest/pratt.sx
If missing, stop and record a Blockers entry. (Maude needs no special core primitive — it builds its own term/rewrite machinery in SX.)
Prompt
You are the sole background agent working /root/rose-ash/plans/maude-on-sx.md,
in an isolated git worktree on branch loops/maude, forever, one commit per
feature. Push to origin/loops/maude after every commit. Never touch main or
architecture.
Restart baseline — check before iterating
- Read
plans/maude-on-sx.md— Roadmap + Progress log + Blockers. - Run the pre-flight; record gaps in Blockers.
ls lib/maude/— pick up from the most advanced file. No dir → Phase 1.- If
lib/maude/tests/*.sxexist, run them via the epoch protocol againstsx_server.exe. Green before new work.
The queue
Phase order per plans/maude-on-sx.md:
- Phase 1 — parser + signatures (
fmod/endfm, sorts + subsorts, op decls, equations; overloading by arity+sort) - Phase 2 — syntactic equational reduction (apply eqs left-to-right to a fixpoint; strict pattern match)
- Phase 3 — equational matching modulo assoc/comm/id (the chisel: flatten AC operators, match across permutations/multisets; return all matches)
- Phase 4 — conditional equations (
ceq L = R if Cond) - Phase 5 — system modules + rewrite rules (
rl … => …, asymmetric, fairness) - Phase 6 — strategy language (
;,|,*, fixed-point; named strategies) - Phase 7 — reflection (META-LEVEL: terms-as-data, meta-interpretation)
- Phase 8 — propose
lib/guest/rewriting/extraction (wait for a 2nd consumer)
Within a phase, pick the checkbox with the best tests-per-effort ratio.
Every iteration: implement → test → commit → tick [ ] → Progress log → push → next.
Chisel discipline — the reduction step
The payoff is Phase 3's AC matching: matching modulo associativity/commutativity/
identity is genuinely harder than the substitution the CEK does, and it's where
Maude's "reduction step" diverges from SX's. Implement it as a term-rewriting
engine in SX (terms are SX data; matching returns substitution sets). Do NOT try
to bend the CEK into a rewriter — Maude runs on the CEK as an interpreter, it does
not replace it. Note for the integrator: the AC-matching + normal-form engine is the
prime candidate to feed an eventual artdag-on-sx effect-pipeline optimizer
(plans/artdag-on-sx.md) — keep it cleanly separable (Phase 8).
Ground rules (hard)
- Scope: only
lib/maude/**andplans/maude-on-sx.md. Do not editspec/,hosts/,shared/,lib/guest/**(read-only), or otherlib/<lang>/. - Consume
lib/guest/(lex, pratt). The rewrite engine itself is yours. - Don't patch the substrate. Maude is an interpreter over SX terms; substrate
gaps → failing test + Blockers entry, never a
spec/patch. - NEVER call
sx_build(600s watchdog). Broken binary → Blockers, stop. - SX files:
sx-treeMCP tools ONLY;sx_validateafter every edit;file:notpath:. NeverEdit/Read/Writeon.sx. - Worktree: commit, then push
origin/loops/maude. Nevermain/architecture. - Commits: one feature per commit (
maude: AC matching for assoc-comm ops + 6 tests). - Plan file: Progress log + tick boxes every commit.
- Blocked 2 iterations → Blockers, move on.
Maude-specific gotchas
- Equations vs rules.
eq/ceqare equational (=, applied to a fixpoint to normalise, confluent-by-intent);rlare transitions (=>, asymmetric, possibly nondeterministic). Don't apply rules during equational reduction. - AC operators flatten.
_+_assoc meansa + (b + c)and(a + b) + care the same term — normalise to a flat sequence/multiset before matching, and match across orderings forcomm. - Matching returns a set of substitutions, not one. AC matching is multi-valued; Phase 3 must yield all matches and let the caller drive (rule application picks).
- Identity is a rewrite, not a special case.
id: efor_*_meansX * e ≡ Xin both directions — handle as an equation in the AC matcher, carefully (avoid infinite insertion of identities). - Strategies make the same rules mean different things — Phase 6 evaluation result depends on strategy; keep rule set and strategy orthogonal.
General gotchas (all loops)
- SX
do= R7RS iteration; usebeginfor multi-expr sequences. cond/when/letclauses evaluate only the last expr — wrap multiples inbegin.letis parallel — nestlets when one binding references an earlier one.env-bind!creates a binding;env-set!mutates an existing one.- Namespace-prefix guest helpers (
mau/…). - Shell heredoc
||gets eaten — escape or usecase.
Style
- No comments in
.sxunless non-obvious. No new planning docs — update the plan. - Short, factual commit messages. One feature per iteration. Commit. Log. Push. Next.
Go. Run the pre-flight. If lib-guest is missing, stop and report. Otherwise read
the plan, find the first unchecked [ ], implement it.