feat: add conversation with grounded replies, sample mind and M1 acceptance test
Phase 8, completing milestone M1. A user message is stored and appended as an observation event carrying trust, actor, channel and reference. The perceive process analyses it deterministically (intent, introspection kind, entities, claims, urgency) and, within the per-cycle model allowance, enriches it through the perceive prompt. Its handler writes a perception event, an episodic memory with participants, turns claims into beliefs whose evidence is the message, and builds a response intent from state: beliefs and memories for the topic, evidence rows for why-questions, the uncertain band, contested beliefs and their links, recent learning, status changes, and honest declines for subsystems that do not exist yet or for requests with no capabilities. The respond prompt phrases the intent when a model is assigned; otherwise the reply is a direct rendering of the intent. response_generated cites the message, the perception, every belief and memory used, the episode and the model call. API: conversations, messages with optional wait, one-shot ask; chat UI with live refresh and a per-reply intent view. Sample mind Dani as a strictly decoded seed document with an import endpoint and noemactl mind import. tests/m1 drives all fourteen milestone steps including restart.
This commit is contained in:
@@ -6,6 +6,7 @@ package brain
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/andydixon/noema/internal/attention"
|
||||
@@ -65,6 +66,21 @@ type State struct {
|
||||
NewEvents []events.Event // since the last cycle, ascending
|
||||
Workspace workspace.State // snapshot before this cycle
|
||||
Services Services
|
||||
llmCalls atomic.Int32 // model calls made in this cycle; processes and handlers share the cap
|
||||
}
|
||||
|
||||
// AllowLLM reserves one model call against the mind's per-cycle cap and
|
||||
// reports whether it was granted, so a chatty cycle cannot exceed the budget.
|
||||
func (s *State) AllowLLM() bool {
|
||||
cap := int32(s.Mind.Config.LLMCallsPerCycle)
|
||||
if cap <= 0 || s.Services.LLM == nil {
|
||||
return false
|
||||
}
|
||||
if s.llmCalls.Add(1) > cap {
|
||||
s.llmCalls.Add(-1)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Services are read handles processes may use. Extended per phase.
|
||||
|
||||
Reference in New Issue
Block a user