Repository navigation
Description
The idea, in a paragraph
Directly answering Active Solicitation Prompt 5 in MOONSHOT.md ("Rewrite us. If the whole compiler should be a Go program (self-hosted analysis), a WASM engine, or a library rather than a CLI — say why and what it unlocks"):
Kill the monolithic standalone Rust CLI binary (hyb) as the sole entrypoint for Hybrid compilation and borrow checking. Re-architect Hybrid's analysis engine into an in-process library driver conforming to Go's standard golang.org/x/tools/go/analysis.Analyzer interface (implemented either as a self-hosted pure-Go engine or via an embedded zero-overhead WASM runtime like wazero). This transforms Hybrid from an isolated external CLI into an embeddable compiler library that runs in-process inside gopls for zero-install instant IDE diagnostics, integrates natively into go vet and golangci-lint, exposes an interactive client-side web playground on GitHub Pages via WebAssembly, and replaces brittle string-based foreign type stubbing with live, typed Go symbol tables.
Which assumption it breaks
This breaks the foundational architectural premise established in PLAN.md and Spike 1:
- The External CLI Assumption: The assumption that borrow-checking and code generation must be performed by a standalone binary executed via subprocesses (
hyb check <file.hy>,hyb build <file.hy>). - The Rust Toolchain Gate: The assumption that anyone checking, building, or contributing to Hybrid must install a multi-gigabyte Rust toolchain (
cargo,rustc,libclang, LLVM). - The Opaque Foreign Type Boundary (§8.4 C8 / foreign.rs): The assumption that the checker cannot see real Go package declarations, necessitating hardcoded stubs in
foreign.rsand fail-closed rejections (HYB-E3005) for unmodeled types. An in-processanalysis.Analyzerreceives Go's fully-typed*types.Packageand*types.Infodirectly from the Go compiler/gopls cache.
Why this is a breakthrough, not an increment
A normal feature bounty focuses on adding diagnostics, fixing edge cases in loans.rs, or optimizing parser performance by 5%. This proposal attacks the distribution, adoption, and integration bottleneck of the entire project:
- Zero-Install IDE Diagnostics (<1ms vs 35ms): Currently, editor extensions must shell out to
hybas an external process on every keystroke, paying 15-40ms in OS process creation, stdio serialization, and AST reconstruction. An in-processanalysis.Analyzerruns directly withingoplsin under 1ms, eliminating editor lag. - Instant Go Ecosystem Adoption: 99% of Go teams cannot adopt a tool that requires installing Rust on developer laptops and CI builders. Delivering Hybrid as an
x/tools/go/analysisplugin allows teams to add Hybrid to.golangci.ymlorgo vet -vettoolwith a single Go dependency line (go get github.com/limitlessprojects/go-hybrid). - Zero-Infrastructure Browser Playground: Compiling the analysis engine to WASM enables a fully interactive browser IDE running entirely client-side on GitHub Pages, dropping the barrier to entry for prospective users to zero.
- Differentiation from [wildcard] Erase the .hy / .go Split: Whole-Package Tier-0 Checking via Native Go AST and Export-Data Analysis #186: Proposal [wildcard] Erase the .hy / .go Split: Whole-Package Tier-0 Checking via Native Go AST and Export-Data Analysis #186 proposes erasing the
.hyfile syntax to write.gofiles with inline directives, but leaves the compiler engine unspecified. This proposal answers Prompt 5 directly by transforming the engine itself into an embeddable library and WASM runtime, regardless of whether the input is.hyor annotated.go.
How we would know it works (or doesn't)
Milestone 1 () — Corpus & Pipeline Parity via In-Process Analyzer:
- Construct an experimental driver embedding the borrow checker (either via a self-hosted Go package or an embedded
wazeroWASM instance runninghy-check.wasm). - Implement the standard
analysis.Analyzercontract (Run(pass *analysis.Pass) (interface{}, error)). - Run the driver against all 46 test cases in
tests/checker-corpus/. - Falsification Gate for M1:
- The in-process analyzer must achieve 100% verdict agreement against all 46 corpus programs (all 31 REJECT fixtures reject with pre-registered diagnostics; all 15 ACCEPT / ACCEPT-MANAGED pass).
- If in-process execution encounters state leakage across analysis passes, unrecoverable stack overflows during deep Polonius borrow walks, or memory bloat exceeding Go's GC thresholds, M1 is recorded as a published architectural failure documenting why standalone process isolation is mandatory.
Milestone 2 () — Sub-Millisecond IDE Latency & CI Footprint Benchmark:
- Benchmark keystroke-to-diagnostic latency: Measure 100 sequential file modifications across a 25-file workspace comparing external
hybCLI invocations against the in-processanalysis.Analyzerinsidegopls. - Benchmark CI onboarding footprint: Measure Docker build time and image size for a standard Go service CI pipeline with Hybrid verification (Alpine Go image + Go module vs Go + Rust/Cargo build environment).
- Published Learning Deliverable:
- Publish a comprehensive analysis to
MOONSHOT.md:- If successful: Architectural blueprint and migration roadmap for packaging Hybrid as a zero-dependency Go module and WASM bundle.
- If failed: An evidence-backed analysis detailing the precise performance, memory, or language-impedance walls that justify keeping the compiler in an isolated Rust binary.
- Publish a comprehensive analysis to
Cost honesty (optional but powerful)
- What gets deleted:
- Standalone subprocess spawning scripts and harness wrappers (
corpus_harness.py,differential_loop.pyprocess wrappers). - Brittle filesystem heuristics for package sniffing (e.g. searching adjacent
.gofiles to avoidHYB-E9002). - Redundant CLI argument handling and exit-code translation logic.
- Standalone subprocess spawning scripts and harness wrappers (
- What gets rewritten:
- The checker boundary: instead of reading CLI flags and emitting JSON to stdout, the engine consumes an abstract syntax tree and produces structured
analysis.Diagnosticobjects. - Foreign type modeling:
foreign.rscan be replaced with direct queries againstpass.TypesInfo.Types[expr].
- The checker boundary: instead of reading CLI flags and emitting JSON to stdout, the engine consumes an abstract syntax tree and produces structured
- Migration path:
- A dual-engine transitional phase: The CLI
hybbinary remains available as a lightweight wrapper that simply invokes the Go/WASM analysis library, ensuring zero backwards incompatibility for existing scripts.
- A dual-engine transitional phase: The CLI
Track terms
- I understand no prototype is required and failure-with-knowledge is a valid, paid outcome
- I understand all outcomes (including declines and failures) are published in MOONSHOT.md
Prepared with Gemini CLI / AI assistance; operator reviewed the proposal, architectural evaluation, and milestone criteria.
Activity
limitlessprojects commentedon Oct 17, 2026
Wildcard triage (within the 48h acknowledgment window): accepted — ledger W-012, slot 12 in the 2026-11-01 window, co-reviewed with W-011 (delivery architecture vs checking surface — adjacent, not duplicate). Reason: the only entry that answers Solicitation #5 head-on with a concrete delivery architecture: in-process analysis inside gopls/vet/golangci-lint, zero-install IDE diagnostics, WASM playground, and live typed symbol tables replacing string-based foreign stubbing. The three named assumptions (external CLI, Rust toolchain gate, opaque foreign boundary) are real and named in PLAN/Spike 1. Review will press on: Rust-in-gopls via wazero versus a self-host rewrite (cost is the whole question), checker latency budget for IDE use, and what the embedding boundary does to fail-closed diagnostics. Cross-ref: W-011.
— Entered in the MOONSHOT.md ledger; review opens in the 2026-11-01 window (Discussion thread linked from the ledger). M1 acceptance ($250) is decided in that review; M2 ($250) on the published learning — success or failure alike.
t3ratech commentedon Oct 17, 2026
/attempt
masterdobra-hash commentedon Oct 23, 2026
Not claiming a slot — this is a contribution to W-012, whose entry and slot 12 (2026-11-01 window) are already this proposal's. Facts from a local checkout of
mainat 7d63d5f today, plus one PR:tools/corpus_harness.pyreports 126/126 for the native checker on this tree. Restating the gate against 126 is worth doing — "100% of 46" is satisfiable by a subset.hybbuilt forwasm32-wasip1and run inwazero— no new crate, no export surface, nothing to keep in sync. Result: parity 126/126 including full-envelope identity; p50 1.385 ms in-process vs 1.342 ms native, p99 7.214 vs 2.970, invocation floor 0.240 vs 0.895 ms, cold module compile 982.84 ms. Parity passes; the "under 1 ms" and "≥2× faster" claims are falsified on this host — the boundary is 3.7× cheaper, the WASM body is ~2.5× slower, and it is the tail, not the median, an editor would feel. PR spike(w012): harden in-process WASM analyzer M1 #556 reaches the same direction from the custom-ABI side.Payout: USDT only — TRC-20 (TRON) preferred, ERC-20 acceptable; the wallet address will be added in this thread.
Two questions: (1) is an independent spike PR on W-012 credited as prototype credit in the ledger, or is it eligible for money on its own; (2) given these numbers, does M1 need a warm-instance design (the expensive endcap) to pass its latency gate?
masterdobra-hash commentedon Oct 23, 2026
Payout address, as promised above:
USDT — TRC-20 (TRON) only:
TT8W8jWwNptPCC4sYTRbeY3HevAgrP4QrMNo memo/tag is needed on TRC-20; sending any other asset or network to this address loses it. It covers both the W-012 contribution (#1295) and the ladder-side contribution in #1298 — say the word if you would rather have a separate address per payout.
For the ledger: #1298 ("Useful improvements", BOUNTY.md) fixes #1297 —
nonein a value position (var o option[int] = none,wrap{inner: none},o = noneon a declared binding) was accepted byhyb checkwith 0 diagnostics and then refused by the emitter, i.e. an accepted-but-unbuildable shape under Row 13. The declared target type now lowers it tooption[T]{}— the same zero valuereturn nonealready emits. Verified on that branch:cargo test --workspace1775 passed / 0 failed, corpus 126/126, census 7/7,run_examples.sh10/10, and the three reproducers built and ran.masterdobra-hash commentedon Oct 25, 2026
The W-012 spike is live again as PR #1658 — #1295 was closed by the 2026-10-24 queue-reset sweep (not-planned, with the reopen path), rebased onto
main@1f0ff97and re-run.Re-run result, nothing rounded up: parity 127/127 for both engines with 127/127 full-envelope identity (the corpus moved 126 → 127 while the PR was closed); p50 1.528 ms native vs 1.578 ms in-process (0.97×), so no latency win; invocation floor 0.912 ms vs 0.184 ms (0.20×) — the boundary is cheaper, the check is not; cold module compile 968 ms. All four pre-registered gates land where they did the first time: H1 accepted, H2 falsified, H3 accepted, H4 falsified.
So the answer to the M1 latency question as written ("under 1 ms" vs a 15–40 ms process spawn) is unchanged: on Linux the native path already answers in ~1.5 ms, the WASI body costs more than the spawn it saves, and the remaining gain needs a warm instance plus a compile cache — i.e. the expensive endcap, not the cheap one.