Linea Docs

Knowledge Bases

Workspace-scoped document stores with vector search.

Knowledge Bases

Knowledge Bases are workspace-scoped document collections. Unlike memories (which are created from agent interactions), knowledge bases hold static reference material: documentation, policy documents, product specs, etc.

Schema

knowledge_bases: {
  id: uuid PK
  workspaceId: uuid FKworkspaces (cascade delete)
  name: text
  description: text | null
  createdAt: timestamp
  updatedAt: timestamp
}
 
knowledge_entries: {
  id: uuid PK
  knowledgeBaseId: uuid FKknowledge_bases (cascade delete)
  content: text
  embedding: vector(1536)
  metadata: jsonb    // { source, page, author, ... }
  createdAt: timestamp
}

Difference from Memories

MemoriesKnowledge Entries
ScopeWorkspace + optional thread/workflow/userWorkspace (via knowledge base)
Created byAgent interactionsManual ingestion / import
DeduplicationSemantic supersedingNone (duplicates allowed)
ProfilingfactType groupingNot applicable
MutationSuperseded, not editedImmutable after insert

API Endpoints

MethodPathDescription
GET/workspaces/:wId/knowledgeList knowledge bases
POST/workspaces/:wId/knowledgeCreate knowledge base
GET/workspaces/:wId/knowledge/:idGet base with entry count
PATCH/workspaces/:wId/knowledge/:idUpdate name/description
DELETE/workspaces/:wId/knowledge/:idDelete base + all entries
GET/workspaces/:wId/knowledge/:id/entriesList entries
POST/workspaces/:wId/knowledge/:id/entriesAdd entry
DELETE/workspaces/:wId/knowledge/:id/entries/:eIdRemove entry
POST/workspaces/:wId/knowledge/:id/searchSearch entries

The search endpoint currently uses ilike keyword matching. It is designed to be upgraded to pgvector cosine search once embeddings are generated on entry insert: the embedding column is already present in the schema.

// Current implementation
.where(and(
  eq(knowledgeEntries.knowledgeBaseId, baseId),
  ilike(knowledgeEntries.content, `%${query}%`)
))

Frontend

The knowledge UI is at /knowledge. It lists all bases in the active workspace. Selecting a base opens an entry list with search. Knowledge bases span all spaces: they are workspace-wide shared resources.

On this page