Problem
load_stdlib() eagerly loads ~46 stages into memory at CLI startup, regardless of whether the graph being run references any of them. This costs:
- Cold-start latency (agent-facing; every
noether run pays the full load).
- Memory footprint (in ephemeral containers, small but real).
- Embedding index construction time (semantic index must cover every stage loaded).
Proposed fix
- Parse the target graph first (
crates/noether-engine/src/lagrange/ast.rs) and collect the set of signature_ids it references (transitively through Let/Branch).
- Load only those stages from the store (local or remote). Stdlib becomes just another lazy-resolved registry.
- Keep a
--preload-stdlib flag on noether run for workflows that intentionally want the full catalogue in memory (introspection, bench).
- Measure: log cold-start p50 and memory before/after on a minimal 3-stage graph.
Acceptance criteria
Priority
Low — polish; real impact is ~10% cold-start improvement for ephemeral invocations. Worth picking up once higher-priority issues clear.
Problem
load_stdlib()eagerly loads ~46 stages into memory at CLI startup, regardless of whether the graph being run references any of them. This costs:noether runpays the full load).Proposed fix
crates/noether-engine/src/lagrange/ast.rs) and collect the set ofsignature_ids it references (transitively throughLet/Branch).--preload-stdlibflag onnoether runfor workflows that intentionally want the full catalogue in memory (introspection, bench).Acceptance criteria
noether run simple-graph.jsonloads only stages referenced (+ transitive deps).noether stage liststill shows the full stdlib (unaffected).docs/engineering/perf/showing cold-start improvement.Priority
Low — polish; real impact is ~10% cold-start improvement for ephemeral invocations. Worth picking up once higher-priority issues clear.