Drift asked magpieValue up to three times a field: once to find the
field on magpie's models, then for magpie's record and the value now.
Each ask made the field's options anew, and Claude Code's (its own
models and claudeViaMagpie) are long. fieldOptions keeps each field's
options, by key, for one Drift; magpieValue is unchanged for the other
callers.
Run on mote at this tree:
- gofmt clean; go vet ./internal/agent ok on darwin, GOOS=windows and
GOOS=linux.
- TestDriftMakesAFieldsOptionsOnce ok 3 of 3 alone. Broken by hand
(opts left nil in Drift): "one Drift made the field's options 3
times, want once".
- go test ./internal/agent: ok (324.6s).
Real accounts (sandbox copy of the owner's config, network blocked,
40 rounds of /api/drift, /api/state, /api/providers), v0.1.2488 tree
against this one:
- Drift 54.3 -> 45.3 MB, magpieValue 47.1 -> 42.6 MB, claudeIn.func57
39.7 -> 33.8 MB; total 613 -> 587 MB (totals move +-25 MB between
runs).
- /api/state and /api/drift byte for byte the same.
- footprint peak 138 MB, RSS 180 MB: unchanged.
Not run: the gui suite (gui is not touched).
Run at 573b21f4b; picked onto 3f2faef62 after it (11 commits, in
internal/agent only dsh.go and a Responses test), not run again there.