feat(brain): add brain_ingest, brain_search tools and extend search to wiki/
This commit is contained in:
@@ -9,7 +9,9 @@ import (
|
||||
|
||||
// Config holds brain skill configuration.
|
||||
type Config struct {
|
||||
IngestBaseURL string // base URL of the ingestion HTTP server, e.g. http://localhost:3300
|
||||
IngestBaseURL string // base URL of the ingestion HTTP server (brain_query, brain_write)
|
||||
IngestSvcURL string // base URL of the ingestion-svc HTTP server (brain_ingest)
|
||||
KBRetrievalURL string // base URL of the kb-retrieval server (brain_search)
|
||||
}
|
||||
|
||||
// Skill implements registry.Skill for brain_query and brain_write.
|
||||
@@ -32,10 +34,10 @@ func (s *Skill) Tools() []registry.ToolDef {
|
||||
str := map[string]any{"type": "string"}
|
||||
num := map[string]any{"type": "integer"}
|
||||
|
||||
return []registry.ToolDef{
|
||||
tools := []registry.ToolDef{
|
||||
{
|
||||
Name: "brain_query",
|
||||
Description: "Search the hyperguild brain wiki for relevant knowledge. Call this before starting any significant task.",
|
||||
Description: "BM25 full-text search across brain/knowledge/ and brain/wiki/ markdown files. Fast, no embeddings needed. Call before any significant task.",
|
||||
InputSchema: schema([]string{"query"}, map[string]any{
|
||||
"query": str,
|
||||
"limit": num,
|
||||
@@ -43,7 +45,7 @@ func (s *Skill) Tools() []registry.ToolDef {
|
||||
},
|
||||
{
|
||||
Name: "brain_write",
|
||||
Description: "Write a raw knowledge note to the brain for later ingestion into the wiki.",
|
||||
Description: "Write a raw knowledge note to brain/knowledge/ for later ingestion.",
|
||||
InputSchema: schema([]string{"content"}, map[string]any{
|
||||
"content": str,
|
||||
"type": str,
|
||||
@@ -52,4 +54,27 @@ func (s *Skill) Tools() []registry.ToolDef {
|
||||
}),
|
||||
},
|
||||
}
|
||||
if s.cfg.IngestSvcURL != "" {
|
||||
tools = append(tools, registry.ToolDef{
|
||||
Name: "brain_ingest",
|
||||
Description: "Ingest text content into the brain wiki (brain/wiki/). Calls an LLM to produce structured wiki pages. Use for substantial documents, articles, or knowledge worth structuring. Returns the list of wiki pages written.",
|
||||
InputSchema: schema([]string{"content", "source"}, map[string]any{
|
||||
"content": str,
|
||||
"source": map[string]any{"type": "string", "description": "human-readable name for the content, e.g. 'article-on-raft.md'"},
|
||||
"dry_run": map[string]any{"type": "boolean"},
|
||||
}),
|
||||
})
|
||||
}
|
||||
if s.cfg.KBRetrievalURL != "" {
|
||||
tools = append(tools, registry.ToolDef{
|
||||
Name: "brain_search",
|
||||
Description: "Semantic vector search across the brain wiki using embeddings. Use when brain_query returns no results or you need conceptually-related results rather than keyword matches.",
|
||||
InputSchema: schema([]string{"query"}, map[string]any{
|
||||
"query": str,
|
||||
"collection": str,
|
||||
"limit": num,
|
||||
}),
|
||||
})
|
||||
}
|
||||
return tools
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user