Files
noema/cmd/noemactl/ask.go
T
Andy Dixon 777e8f50b5 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.
2026-06-25 19:19:24 +01:00

53 lines
1.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package main
import (
"flag"
"fmt"
"os"
"strings"
)
func init() {
extraCommands = append(extraCommands, command{"ask", "<mind> <text...> [-wait 30] – talk to a mind and wait for its reply", cmdAsk})
}
func cmdAsk(args []string) int {
if len(args) < 2 {
fmt.Fprintln(os.Stderr, "usage: noemactl ask <mind> <text...> [-wait seconds]")
return exitUsage
}
wait := 30
var words []string
for i := 1; i < len(args); i++ {
if args[i] == "-wait" && i+1 < len(args) {
fmt.Sscan(args[i+1], &wait) //nolint:errcheck
i++
continue
}
words = append(words, args[i])
}
_ = flag.CommandLine
var out struct {
Reply *struct {
Content string `json:"content"`
EventID string `json:"event_id"`
LLMCallID string `json:"llm_call_id"`
} `json:"reply"`
Note string `json:"note"`
}
if code, err := apiRequest("POST", "/api/v1/minds/"+args[0]+"/ask", map[string]any{"text": strings.Join(words, " "), "wait_seconds": wait}, &out); err != nil {
return exitFor(code, err)
}
if out.Reply == nil {
fmt.Println("(no reply)", out.Note)
return exitFail
}
fmt.Println(out.Reply.Content)
how := "state"
if out.Reply.LLMCallID != "" {
how = "model"
}
fmt.Fprintf(os.Stderr, "\n[%s · event %s]\n", how, out.Reply.EventID)
return exitOK
}