knowledge

package
v1.801.414 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Overview

Package knowledge is your team's wiki and your agents' memory, searchable by meaning.

Wiki pages, memories and connector-ingested documents are ONE framework document store at /v1/kb, indexed into the org's own vector namespace on every save and read back as semantic search, a link graph, or an imported vault.

The model is declared here as DocType fixtures on the framework engine (clients/framework), and index.go wires the ONE per-org vector path that turns every knowledge document into retrievable org memory. It is the FOURTH app lane after cms/erp/help and the one that makes "a Notion-like wiki + agent memory" just another module on Base — no new Base, no new database.

Like cms/erp/help, the content model is fixtures: a wiki page IS a framework document (module "kb"), a memory IS a framework document, an ingested doc from a connector IS a framework document. CRUD, permissions, tenant isolation, and install are the framework's generic, already-live surface (/v1/framework/*) and the SAME generic @hanzo/ui DocType renderer that draws CMS and ERP.

UNLIKE the pure-fixture lanes, kb attaches BEHAVIOR (hooks.go): on every save of a knowledge document the after_save hook upserts its text to the org's vector namespace, and on trash it removes it. Human wiki + AI memory therefore share ONE per-org knowledge store, indexed once. kb ALSO mounts a thin retrieval + ingestion control-plane subsystem (subsystem.go, /v1/kb/*): semantic search (the RAG entry point an agent/chat calls) and app connectors (Slack/GitHub/ Google) that ingest external docs INTO the same store. Connectors are just producers of framework documents — they never fork the vector-write path.

Names are slug-style with a "kb-" prefix so they never collide with the CMS (Author/Media/Page/…), ERP (erp-*), or Help (hd-*) lanes and never carry a space the console's /cloud path filter would reject.

Index

Constants

View Source
const (
	DTPage      = "kb-page"      // a Notion-like wiki page (nested via `parent`)
	DTMemory    = "kb-memory"    // a unit of agent/AI memory (note/fact/observation)
	DTSource    = "kb-source"    // a document ingested from an app connector or upload
	DTConnector = "kb-connector" // an app-connector connection (metadata only; token in KMS)
	DTLink      = "kb-link"      // a wikilink edge extracted from a kb-page body
)

DocType names (slug, kb- prefixed). Exported so the hooks (hooks.go) and the retrieval subsystem (subsystem.go) reference the SAME identifiers as the fixtures — one source of truth for the doctype set.

View Source
const Module = "kb"

Module is the framework module tag every KB DocType carries. The console's KB surface is the generic DocType renderer scoped to this module (a page-tree sidebar over kb-page.parent + the Lexical editor over kb-page.body).

View Source
const RoleKBEditor = "KB Editor"

RoleKBEditor is the authoring role the KB DocTypes grant read/write/create/ delete. The org owner (System Manager, seeded trust-on-first-use) assigns it via /v1/framework/roles; a role-less member stays denied (secure by default). The engine seeds a System-Manager-only grant when perms are empty, so naming this role is an explicit widening, never a loosening.

Variables

This section is empty.

Functions

func DocTypes

func DocTypes() []framework.DocType

DocTypes returns the canonical KB + memory model. Masters have no cross-lane Links (kb runs standalone); kb-page's `parent` is a SELF Link (the framework resolves Link targets at document write, so a child may reference a parent defined in any order, and a page tree is just parent chains).

func Mount

func Mount(app cloud.Router, deps cloud.Deps) error

Mount wires the KB control-plane onto app per HIP-0106. CRUD + fixtures are the framework's surface; this adds only retrieval + connectors.

func SemanticReady

func SemanticReady() bool

SemanticReady reports whether the vector leg is configured (an embedding client and a store endpoint). A deployment without one is DISABLED, which the surface reports distinctly from DEGRADED — "never provisioned" and "provisioned and broken" are different operational facts and must not share a status.

Types

type Hit

type Hit = hit

Hit is one semantic result. It is the retrieval hit shape verbatim (a type alias, not a copy) so the wire contract cannot drift between /v1/kb/search and /v1/search.

func Semantic

func Semantic(ctx context.Context, r SemanticReq) ([]Hit, error)

Semantic runs the org-scoped vector leg. It returns an error (never a silent empty) when the store or the embedding gateway is unreachable, so the caller can report WHICH backend failed and why: the fail-empty behaviour that hid a five-day vector outage belongs to the surface's degradation contract, not here.

type SemanticReq

type SemanticReq struct {
	Org      string
	Query    string
	Project  string
	DocTypes []string
	Limit    int
}

SemanticReq is an org-scoped vector query. Org is set by the CALLER from a validated principal — never from a client field — exactly as searchReq requires.

Directories

Path Synopsis
Package evernote normalizes an Evernote .enex export into vault.Page documents.
Package evernote normalizes an Evernote .enex export into vault.Page documents.
Package lexical builds a Lexical EditorState JSON string from block-structured content.
Package lexical builds a Lexical EditorState JSON string from block-structured content.
export.go normalizes a Notion workspace EXPORT (the "Markdown & CSV" or "HTML" zip a user downloads) into vault.Page documents — distinct from notion.go, which shapes records from the live Notion API connector.
export.go normalizes a Notion workspace EXPORT (the "Markdown & CSV" or "HTML" zip a user downloads) into vault.Page documents — distinct from notion.go, which shapes records from the live Notion API connector.
Package obsidian normalizes an Obsidian vault (a tree of markdown files) into vault.Page documents.
Package obsidian normalizes an Obsidian vault (a tree of markdown files) into vault.Page documents.
Package roam normalizes a Roam Research JSON export into vault.Page documents.
Package roam normalizes a Roam Research JSON export into vault.Page documents.
Package vault is the normalized model an importer produces: a set of pages with a parent tree and wikilinks preserved inline in the body.
Package vault is the normalized model an importer produces: a set of pages with a parent tree and wikilinks preserved inline in the body.

Jump to

Keyboard shortcuts

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