// Package knowledge is the Code Intelligence (RAG) bounded context: // chunking, embedding (via the knowledge service's vLLM-backed embed client) and // cosine-similarity search over workspace source files. System of // record for the pgvector-backed `documents` table (see // services/knowledge/migrations/0001_init.sql). // // Mirrors internal/rag/*.go. IndexDirectory (cmd/indexer) now walks the // workspace through the workspace service instead of the local // filesystem — see tools/indexer. syntax = "proto3"; package enkly.knowledge.v1; option go_package = "enkly/gen/knowledge/v1;knowledgev1"; service KnowledgeService { // IndexFile replaces rag.Store.IndexFile: chunks the given file // content, embeds each new/changed chunk, and upserts it. rpc IndexFile(IndexFileRequest) returns (IndexFileResponse); // PruneMissing replaces rag.Store.pruneMissing, called by the indexer // after a full directory walk to drop rows for files no longer // present. rpc PruneMissing(PruneMissingRequest) returns (PruneMissingResponse); // Search replaces rag.Store.Search — the search_codebase agent tool. rpc Search(SearchRequest) returns (SearchResponse); // ListIndexedFiles replaces db.ListIndexedFiles, used by the gateway's // sidebar "indexed files" panel (Handlers.renderConversation). rpc ListIndexedFiles(ListIndexedFilesRequest) returns (ListIndexedFilesResponse); } message CodeChunk { int64 id = 1; string file_path = 2; int32 chunk_index = 3; string content = 4; double distance = 5; // cosine distance; lower = more relevant } message IndexFileRequest { string file_path = 1; string content = 2; } message IndexFileResponse { int32 chunks_indexed = 1; int32 chunks_skipped = 2; // unchanged content_hash } message PruneMissingRequest { repeated string keep_file_paths = 1; } message PruneMissingResponse { int32 rows_deleted = 1; } message SearchRequest { string query = 1; int32 top_k = 2; } message SearchResponse { repeated CodeChunk chunks = 1; } message ListIndexedFilesRequest { int32 limit = 1; // 0 = default (200) } message ListIndexedFilesResponse { repeated string file_paths = 1; }