Skip to content

Document the two-pass wired-graph codegen design (func! quotation) - #596

Merged
0-jake-0 merged 1 commit into
nextfrom
claude/wired-graph-code-generation-ycjfif
Jul 28, 2026
Merged

Document the two-pass wired-graph codegen design (func! quotation)#596
0-jake-0 merged 1 commit into
nextfrom
claude/wired-graph-code-generation-ycjfif

Conversation

@0-jake-0

Copy link
Copy Markdown
Contributor

What

Adds next/docs/wired-graph-codegen-decision.md, recording the design decision for generating compiled-graph code by running the wiring and traversing the wired graph, with a second compilation pass — and cross-links macro-extensibility-decision.md §2, whose flat "No" to this question now stands for the unassisted form only.

Docs-only; no code changes. Status recorded in the doc: accepted direction, not yet implemented — the build is gated on the sequencing plan (§8) and a named workload (§7).

The design in one paragraph

Naive post-wiring traversal fails on one precise point: closures are runtime values whose types are neither nameable nor inferable in generated code (the deleted classic wingfoil::codegen retrofit proved the walls). A func! quotation macro at the closure call site fixes both blockers — it preserves the closure's tokens for splicing (so the emitted literal roots type inference exactly as graph! does), and makes drift between the running value and the emitted text impossible by construction (same tokens play both roles). With capture rules (closed closures via fn-pointer coercion, or serde_closure-style explicit capture lists bounded by EmitLiteral), a generator can run dynamic wiring once and emit a plain wiring fn wrapped in graph! — so graph! stays the single emission backend, regular closures stay first-class (an OpFn unification trait; graph! itself never needs func!), and the route buys the one thing the macro structurally cannot express: dynamic topology at compiled speed.

Why write it down now

The reasoning chain (why traversal fails, why quotation fixes it, the capture-freezing fork, the graph!-as-backend decision, what the design reuses from the Op-pattern rearchitecture) is expensive to reconstruct later. The doc also fixes the gate for building anything: a workload where topology comes from data, the graph is hot, and config cadence ≤ deploy cadence.


🤖 Generated with Claude Code

https://claude.ai/code/session_01SunAG7Q5ErqhaZBVtK5qv8


Generated by Claude Code

Records the design decision for generating compiled-graph code by running
the wiring and traversing the wired graph, with a second compilation pass:

- why naive post-wiring traversal fails (erasure; closure types neither
  nameable nor inferable in generated code) and how the deleted classic
  wingfoil::codegen retrofit already proved those walls;
- the func! quotation primitive that makes the route sound for a defined
  subset (closed / explicit-capture closures, EmitLiteral configs), with
  drift between the running value and the emitted text impossible by
  construction;
- capture rules (fn-pointer coercion tier, serde_closure-style explicit
  captures, the freezing-vs-runtime-params fork);
- regular closures stay first-class via an OpFn unification trait; graph!
  never needs func! and remains the single emission backend (the
  generator's artifact is a plain wiring fn wrapped in graph!);
- what the design reuses from the Op-pattern rearchitecture, the
  three-condition gate for building the generator (dynamic topology, hot
  graph, config cadence <= deploy cadence), and the sequencing plan.

Cross-links macro-extensibility-decision.md section 2, whose "No" now
stands for the unassisted form only.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SunAG7Q5ErqhaZBVtK5qv8
@0-jake-0
0-jake-0 merged commit 136e82c into next Jul 28, 2026
4 checks passed
@0-jake-0
0-jake-0 deleted the claude/wired-graph-code-generation-ycjfif branch July 28, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants