Help us shape the future of Go! Take the 2026 Go Developer Survey

knowledge

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package knowledge exposes the workspace-wide shared-knowledge gollem tools available to agents. Read tools (search / get / list_tags) are always offered; write tools (create_tag / update_tag / delete_tag / create_knowledge / update_knowledge) are wired only when the agent is permitted to mutate shared knowledge (i.e. not while processing a private case). Every operation routes through the use-case surface (Accessor / Mutator) so embedding, validation, and tag-existence checks match the WebUI path.

Tags are first-class entities identified by an immutable id. A knowledge entry references tags ONLY by id and must carry at least one. A tag cannot be created inline while writing knowledge — it must be created first via create_tag (which returns its id).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(deps Deps) []gollem.Tool

New builds the full knowledge tool set (read + tag/knowledge writes). Use this when the agent is allowed to write shared knowledge.

func NewReadOnly

func NewReadOnly(deps Deps) []gollem.Tool

NewReadOnly builds the read-only subset (search / get / list_tags). Used when the agent may consult shared knowledge but must not mutate it — e.g. while processing a private case, whose contents must not leak into the shared base.

Types

type Deps

type Deps struct {
	WorkspaceID string
	Accessor    KnowledgeAccessor
	Mutator     KnowledgeMutator
}

Deps groups the dependencies the knowledge tools need. WorkspaceID is pinned at construction. Accessor is required (read tools). Mutator is required only for the write tools (New); it is nil for NewReadOnly.

type KnowledgeAccessor

type KnowledgeAccessor interface {
	SearchKnowledge(ctx context.Context, workspaceID, query string, tagIDs []model.TagID, limit int) ([]*model.Knowledge, error)
	GetKnowledge(ctx context.Context, workspaceID string, id model.KnowledgeID) (*model.Knowledge, error)
	ListTags(ctx context.Context, workspaceID string) ([]*model.Tag, error)
}

KnowledgeAccessor is the read surface the knowledge tools depend on. Defined here so the package does not import pkg/usecase (which would create a cycle).

type KnowledgeMutator

type KnowledgeMutator interface {
	CreateTag(ctx context.Context, workspaceID, name string) (*model.Tag, error)
	UpdateTag(ctx context.Context, workspaceID string, id model.TagID, name string) (*model.Tag, error)
	DeleteTag(ctx context.Context, workspaceID string, id model.TagID) error
	CreateKnowledge(ctx context.Context, workspaceID, title, claim string, tagIDs []model.TagID) (*model.Knowledge, error)
	UpdateKnowledge(ctx context.Context, workspaceID string, id model.KnowledgeID, title, claim *string, tagIDs *[]model.TagID) (*model.Knowledge, error)
}

KnowledgeMutator is the write surface the knowledge tools depend on.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL