The forge already DRIVES sessions (briefing → tmux launch, sx-fix-up.sh).
This records what comes BACK, making the forge a true system of record:
- sx-fix-writeback.sh <forge-agent> [kind] [base-ref]: reads new commits on
loops/sx-<slug>, appends a record per commit to writeback.sxsrc (idempotent,
matched by sha), then rebuilds the forge + replays them as agentic-sx
commit!s on agents/<forge-agent> and re-dumps forge.sxdata.
- forge-build.sxsrc: fb-writeback-records / fb-replay-writeback / fb-do-writeback
— each real-git commit becomes an agentic-sx commit whose tree is a small
commit.sx pointer (sha/branch/message/files); real git holds the code, the
forge holds the index, so the CID stays small.
- writeback.sxsrc: the append-only record log (source of truth for what's
been recorded); replayed chronologically so agent branch heads advance right.
Verified live: the sx-gate loop's first real commit (f09368e1, "pin K18
expt-overflow float-promotion") is now recorded as a test-kind agentic-sx
commit on agents/ws-W14 (session log: spawn → finding → writeback), its
commit.sx pointing back at the real-git sha.
Loop closed: forge → tmux (drive) and tmux → real-git → forge (record).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
137 lines
8.2 KiB
Plaintext
137 lines
8.2 KiB
Plaintext
; forge-build.sxsrc — dogfood: store the SX-review program in git-sx via gitea-sx,
|
|
; and stand up the agentic-sx fix session (one agent branch per workstream).
|
|
; (.sxsrc so the Write tool is not blocked; load-by-content works regardless.)
|
|
;
|
|
; Run bounded (NOT the shared MCP image); base+relations+agentic/branch+gitea/repo
|
|
; must be loaded first. The final (fb-forge-serialize) returns the durable kv+stream
|
|
; dump as an SX string, captured by the build wrapper into forge.sxdata.
|
|
;
|
|
; The review is stored as NATIVE TYPED OBJECTS, not markdown blobs: each workstream
|
|
; is a finding-commit on its own agent branch, carrying its finding-ids + status,
|
|
; so the whole program is queryable git-sx data (the fed-sx property).
|
|
|
|
; --- one backend shared by the forge and the agentic session ---
|
|
(define fb-db (persist/mem-backend))
|
|
(define fb-forge (gitea/forge fb-db))
|
|
(gitea/user-create! fb-forge "rose-ash")
|
|
(define fb-repo-rec (gitea/repo-create! fb-forge "rose-ash" "sx-review"
|
|
{:description "SX language/runtime review — 3-lane findings + remediation" :created-at 20260703}))
|
|
|
|
; agentic session shares the gitea repo's git namespace ("forge/<owner>/<name>")
|
|
(define fb-sp (agentic/space fb-db "forge/rose-ash/sx-review"))
|
|
(define fb-repo (agentic/space-repo fb-sp))
|
|
|
|
; --- coordinator + review baseline (points at the real-git snapshot) ---
|
|
(define fb-root
|
|
(agentic/spawn! fb-sp "coordinator"
|
|
(agentic/briefing "SX review remediation"
|
|
"Drive every workstream to green per plans/sx-review/PLAN.md; nothing dropped." {})))
|
|
|
|
(define fb-manifest
|
|
"(sx-review :lanes (core hosts conformance) :finding-instances 217 :workstreams 16 :real-git \"a24c8796\" :plan \"plans/sx-review/PLAN.md\" :rulings \"plans/sx-review/RULINGS.md\" :done-commit \"dc7aa709\")")
|
|
|
|
(define fb-baseline
|
|
(agentic/commit! fb-sp "coordinator" "decision"
|
|
(assoc {} "MANIFEST.sx" fb-manifest)
|
|
{:message "SX review baseline — 217 findings across 16 workstreams"}))
|
|
|
|
; --- workstreams: id title goal finding-ids status ---
|
|
(define fb-workstreams (list
|
|
(list "W1" "Condition system & continuations" "handler installation, delimited-continuation replay, dynamic-wind, catchable errors"
|
|
"K01 K03 K10 K12 K36 K41 K57 K106 S10" "OPEN")
|
|
(list "W2" "Environment & scope integrity" "letrec/named-let/env-merge leaks, unshadowable names, unwind-safe dynamic state, set!"
|
|
"K04 K05 K06 K07 K30 K31 K32 K33 K40 K74 K75 K107 J8" "OPEN")
|
|
(list "W3" "HTTP-mode concurrency & serving safety" "Domain race, per-request globals, cache keying, URL-eval, hydration"
|
|
"S1 S2 S3 S5 S11 S12 S13 K30" "OPEN")
|
|
(list "W4" "Higher-order forms & threading" "ho-swap ambiguity, reduce arities, O(n^2), first-class HO, threading"
|
|
"K13 K14 K15 K43 K44 K45 K46 K47 K78 K79 K80 K81 J7" "OPEN")
|
|
(list "W5" "Special forms & macros" "cond dual-grammar, quasiquote depth/dict, case, letrec-star, match guards, key, values"
|
|
"K08 K34 K35 K37 K38 K70 K71 K72 K76 K77 K42" "OPEN")
|
|
(list "W6" "Parser, serializer, canonical & CIDs" "one classifier, escapes, reader-macros, dict-key serialize, CID fixed-point"
|
|
"K21 K22 K23 K24 K25 K63 K64 K65 K66 K67 K68 K69 K100 K101 K102 K103 K108 C25 C26 C27" "OPEN")
|
|
(list "W7" "Numbers, equality, strings, collections" "append!, codepoints, eq/eqv, overflow, float wire, div0, apply, sort, parity"
|
|
"K17 K52 K53 K54 K55 K56 K85 K86 K87 K88 K89 K90 K91 K92 P1 P2 P3 P4 P5 P6 P7 P8 P10 P11 P12" "OPEN")
|
|
(list "W8" "Render pipeline" "recursion guard, attr-name injection, aser kwargs, dom/html parity, script/style, depth"
|
|
"K16 K48 K50 K51 K82 K83 K84 C19 C20 S14 S9" "OPEN")
|
|
(list "W9" "Strict typing" "chokepoint checks, type-name validation, component/keyword types, as-type"
|
|
"K26 K27 K58 K59 K60 K93 K94 K95 K96 K97" "OPEN")
|
|
(list "W10" "Signals & coroutines" "dispose-computed, batch wedge, equality change-detection, glitch-freedom, cleanup"
|
|
"K28 K29 K61 K62 K98 K99 K109 K110" "OPEN")
|
|
(list "W11" "JIT correctness (re-enable preconditions)" "thread-step, fallback double-effect, macro-aware, kwargs, redef invalidation, sync"
|
|
"J1 J2 J3 J4 J5 J6 J7 J10 J11 K33 K19 C10 C11 C12 C14" "DEFERRED")
|
|
(list "W12" "Python bridge & boundary" "boundary validation, SxExpr, reader-macro sync, bridge timeouts, epoch parse"
|
|
"C24 C28 C29 C30 C31 S-bridge S-bridge2 K42" "OPEN")
|
|
(list "W13" "JS host (GATE D1 — likely delete)" "hollow bundle, red gate, record-type, callbacks, arithmetic, parser"
|
|
"C0a C0b JS1 JS2 JS3 JS4 JS5 JS6 JS7 JS8" "GATE-D1")
|
|
(list "W14" "Test gate & conformance infrastructure" "runner=prod env, WASM corpus runner, harness honesty, protocol fuzz, differential"
|
|
"C0b C9 C21 C22 C23 C3 C4 C5 C6 C7 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 K19 K104" "OPEN")
|
|
(list "W15" "Hygiene & documentation" "dead trees/blobs, r7rs radix shadow, doc drift, regen-diff gate"
|
|
"C2 C8 C13 C15 C16 C17 C18 F14 F15" "OPEN")
|
|
(list "W16" "Hyperscript shipped-kernel conformance" "host-call-fn binding, jit-exclude drift, mock-DOM red band, corpus drift + assert-order"
|
|
"F16 F17 F18 F19" "OPEN")))
|
|
|
|
; spawn one agent branch per workstream, each carrying a finding-commit
|
|
(define fb-spawn-ws
|
|
(fn (ws)
|
|
(let ((id (first ws)) (title (nth ws 1)) (goal (nth ws 2))
|
|
(findings (nth ws 3)) (status (nth ws 4)))
|
|
(let ((agent (str "ws-" id)))
|
|
(agentic/spawn-from! fb-sp agent
|
|
(agentic/briefing (str id " — " title) goal
|
|
{:workstream id :findings findings :status status})
|
|
"coordinator")
|
|
(agentic/commit! fb-sp agent "finding"
|
|
(assoc {} (str id ".sx")
|
|
(str "(workstream :id \"" id "\" :title \"" title "\" :status \"" status
|
|
"\" :findings \"" findings "\")"))
|
|
{:message (str id ": " title)})))))
|
|
|
|
(define fb-ws-cids (map fb-spawn-ws fb-workstreams))
|
|
|
|
; record the completed quick-wins batch as a refactor commit on the coordinator
|
|
(define fb-done
|
|
(agentic/commit! fb-sp "coordinator" "refactor"
|
|
(assoc {} "DONE.sx"
|
|
"(batch :commit \"dc7aa709\" :fixed (K02 K09 K11 K18 K20 K39 K49 K73 K105 C1 C1b S4 F13) :partial (K19 K42 C24 F14) :suite \"5762p-274f-baseline\")")
|
|
{:message "quick-wins batch dc7aa709 recorded"}))
|
|
|
|
; STARTING POINT — all review infrastructure is in place (plan, rulings,
|
|
; quick-wins batch, forge); fixing begins from this real-git state.
|
|
(define fb-start
|
|
(agentic/commit! fb-sp "coordinator" "decision"
|
|
(assoc {} "START.sx"
|
|
"(starting-point :real-git \"8651cefe\" :tree \"plan+rulings+forge+quick-wins\" :suite \"5762p-274f-baseline\" :next \"W14 test-gate first, then W1 K01 guard-hang\" :rule \"no semantic fix before its pinning test + gate\")")
|
|
{:message "START — fix work begins from 8651cefe; W14 gate first, then W1/K01"}))
|
|
|
|
; --- WRITE-BACK: real-git commits recorded into the forge as agentic-sx commits ---
|
|
; Closes the loop: the forge drives the tmux session (briefing -> launch) AND
|
|
; records the work that comes back. fb-writeback-records is overridden by loading
|
|
; plans/sx-review/writeback.sxsrc (maintained by scripts/sx-fix-writeback.sh);
|
|
; each record routes a real-git commit onto its forge agent branch. The commit's
|
|
; tree is a single commit.sx pointer (sha+message+files) — real git holds the code,
|
|
; the forge holds the index, so the CID stays small.
|
|
(define fb-writeback-records (list))
|
|
(define fb-replay-writeback
|
|
(fn (rec)
|
|
(agentic/commit! fb-sp (get rec :agent) (get rec :kind)
|
|
(assoc {} "commit.sx"
|
|
(str "(git-commit :sha \"" (get rec :sha) "\" :branch \"" (get rec :branch)
|
|
"\" :message \"" (get rec :message) "\" :files \"" (get rec :files) "\")"))
|
|
{:message (str "writeback " (get rec :sha) ": " (get rec :message))})))
|
|
(define fb-writeback-cids (list))
|
|
(define fb-do-writeback
|
|
(fn () (begin
|
|
(set! fb-writeback-cids (map fb-replay-writeback fb-writeback-records))
|
|
fb-writeback-cids)))
|
|
|
|
; --- durable dump: kv + streams of the shared backend, serialized ---
|
|
(define fb-forge-serialize
|
|
(fn ()
|
|
(sx-serialize
|
|
{:review "sx-review" :baseline fb-baseline :done fb-done :start fb-start
|
|
:agents (agentic/agents fb-sp)
|
|
:workstream-cids fb-ws-cids
|
|
:writeback fb-writeback-cids
|
|
:kv (map (fn (k) (list k ((get fb-db :kv-get) k))) ((get fb-db :kv-keys)))
|
|
:streams (map (fn (s) (list s ((get fb-db :read) s))) ((get fb-db :streams)))})))
|