Repository navigation
Per-group Ladybug files and library helpers - #5
Merged
Merged
Conversation
database.ladybug.layout: per-group keeps every configured group in a separate file named by its SHA-256, so no id can address a path outside the directory. Ingest, drain and restore write into the group's file; the MCP tools and kg reads open only the file of the group they address, and a token scoped to one group never opens another. single stays the default. Library helpers: a path-keyed embedder record, public BM25-only search configs, an extension check for the running Ladybug engine, and the contained per-group path. kg export on Ladybug now exports every record when a named group holds no edges.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
database.ladybug.layout: per-groupstores each configured group in its own Ladybug file insidedatabase.ladybug.directory, named by the SHA-256 of the group. No group or user id can address a path outside the directory.singleremains the default.kg ask,kg nodes,kg episodesandkg exportread one group per call and open only that group's file. A bearer token may be scoped to a subset of groups in this layout; a token scoped to one group never opens another group's file.kg status,kg edge,get_entity_edgeandget_statusvisit every group file the caller may read.kg_mcp.fingerprint.record_embedder,recorded_embedder,embedder_drift: the embedder record keyed by database path (<file>.embedder.json). Configured writes keep it too, and the configured drift check reads it.kg_mcp.retrieval.keyword_edge_search_config,keyword_node_search_config: the BM25-only search behindkg ask --keywordandkg-demo.kg_mcp.ladybug.extension_status: whether FTS and VECTOR are installed for the running engine version, with the install command.kg_mcp.ladybug.group_database_path: the contained per-group path.kg exporton Ladybug exports every record when a named group holds no edges.docs/reference.md: the layout and a library table. Changelog under0.5.0 (unreleased).Verification
uv run pytest -q: 117 passed (90 before). The 27 new tests run offline against real Ladybug files with a fake embedder: two users in two files, each holding only its own facts; a one-group token reads its own facts, is refused the other group, and never opens the other file;kg askreads the named group's file; ingest routes each domain to its own file and embedder record; export and restore between group files; 12 hostile ids (../, absolute paths, NUL, 5000 characters, a lone surrogate) stay inside the directory; single layout unchanged; the path-keyed embedder record; the keyword configs; the extension check.uv run ruff check .andscripts/release_audit.py . --allow-remote --identity-base origin/mainpass.uvx --from <checkout> kg-demoanswers the README question.