Repository navigation
feat(kb): consume the Encyclopedia Machine KB (machine-kb-v0.1.0) - #10
Merged
Merged
Conversation
Add search_knowledge, get_knowledge_record, get_knowledge_status and the kb://manifest resource, backed by the OpenWebNet Encyclopedia Machine KB. Loading follows knowledge/CONSUMING.md: manifest first, schema compatibility check, SHA-256 verification of every data artifact, then BM25 over retrieval chunks and claims with all records keyed by stable ID. Every result keeps epistemic status, confidence, applicability (including version expression), namespace context, provenance, and hydrated cautions and open questions. Claim statements hit by Encyclopedia#37 are truncated cleanly and point to their intact source chunk. The KB is found via OPENWEBNET_KB_PATH, a sibling Encyclopedia checkout, or a cache filled by `python -m openwebnet_mcp.kb_fetch`, which verifies hashes before writing. Without a KB the new tools return an error and the rest of the server is unaffected. rescan_documentation reloads it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ontainment)
- Retry KB load on every call until it succeeds (a miss was sticky), and
ship an openwebnet-mcp-kb-fetch console script for uvx users
- Honour id-registry.json aliases, deprecations and retirements
- Load artifacts from manifest paths instead of a hardcoded layout
- Build the index off to the side and swap it in (no empty window on rescan)
- Prefer the hash-verified cache over a sibling checkout
- Validate fetch tag and manifest paths (no writes outside knowledge/)
- Also truncate the JSON-style {"text": leak; mention KB tools in prompt_boost
- Lock the real DALI known-gap hash in a test
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
Author
Follow-up improvements to #10 (eb7cefb)Pushed a second commit that hardens the Machine KB integration. Summary of what changed and why: Easier to adopt
More faithful to
|
…kb_fetch test - search: "WHO n" / "WHAT n" / "DIMENSION n" (also "dim n") in a query now earns a flat bonus on records that contain the same reference (WHO also from who-N- source paths), so "WHO 1 WHAT 17" no longer loses to any document that merely contains a 17 - who_catalog.json WHO 1: WHAT 11-15 are timed ON (1-5 min), not dim up/down, toggle, timed, blink; add 16, 17 (unresolved), 18, 20 blink (20..29) and 30/31 level steps, as documented in the Machine KB - opt-in live test of kb_fetch against machine-kb-v0.1.0 (OPENWEBNET_LIVE_TESTS=1, marker "network") Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Summary
Adds a consumer for the OpenWebNet Encyclopedia Machine KB (
machine-kb-v0.1.0), as offered in OpenWebNet-Encyclopedia discussion #36.New tools
search_knowledge(query, kind, area, epistemic_status, limit): BM25 over the 1,173 retrieval chunks and 7,449 claims.get_knowledge_record(record_id): resolves anyownkb:stable ID, with cautions and open questions filled in.get_knowledge_status(): shows the snapshot (location, generator and schema versions, whether the hashes verified, counts).New resource:
kb://manifest.rescan_documentationnow reloads the KB.Flow
How it follows
knowledge/CONSUMING.mdschema_compatibility_version.OPENWEBNET_KB_STRICT=1refuses to load instead.unresolved,inferred,rejectedandsupersededrecords are labelled as not established. Rank is labelled as lexical relevance, not evidence strength.Finding the KB
The KB is looked up in this order:
OPENWEBNET_KB_PATH, then the hash-verified download cache (newest release), then a siblingOpenWebNet-Encyclopedia/knowledgecheckout (an unverified working tree). The defaultuvxinstall ships without the corpus: runopenwebnet-mcp-kb-fetch [TAG](orpython -m openwebnet_mcp.kb_fetch [TAG]) to fill the cache; it writes nothing unless every hash verifies, validates the tag and manifest paths, and the tools pick it up on the next call. A failed load is retried on every call. Without a KB, the three tools return an error and nothing else changes.Contract details
knowledge/are rejected), not a hardcoded layout.id-registry.jsonis honoured: aliases resolve, deprecated and retired IDs are annotated, retired IDs show their replacement.WHO n/WHAT n/DIMENSION nreferences in a query earn a flat ranking bonus.prompt_boostpoints agents at the KB tools.Known 0.1.0 limits (shown, not hidden)
Also fixed here
who_catalog.jsonWHO 1 WHAT 11-15 were wrong; they are timed ON for 1-5 minutes. Added 16, 17 (unresolved), 18, 20-29 blink and 30/31 level steps, as documented in the KB.Testing
tests/test_kb.pybuilds a synthetic KB with real hashes. It covers loading, search filters and the exact-reference boost, hash mismatch and strict mode, version rejection, a missing KB and retry after a miss, id-registry aliases and lifecycle, manifest-path containment, the #37 truncation,kb_fetchverification and path/tag validation, cache release ordering and every server tool.OPENWEBNET_LIVE_TESTS=1 pytest -m network) fetches the realmachine-kb-v0.1.0, verifies every hash, loads in strict mode and searches. It passes.🤖 Generated with Claude Code