feat(core): add deterministic ClaimGraph sections, logs, and query expansion#28
Merged
HiveForensicsAI merged 3 commits intomainfrom Mar 3, 2026
Merged
Conversation
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.
Motivation
ClaimGraphLog) with deterministic merge/apply semantics so multiple actors can share state without network services.Description
packages/core/src/graph/with the following modules:claim_graph.ts(types, normalization, stable id/hash helpers, indexing, validation),build_claim_graph.ts(deterministic extraction rules: markdown links, wiki links, headings→definitions, conservativeis/aresentences, evidence collection, bounded per-doc edges),log.ts(append-onlyClaimGraphLogtypes, deterministic merge/apply/serialize/deserialize), andquery_expand.ts(deterministic graph-based query expansion with predicate allowlist and caps).buildPack()to acceptgraphoptions, build the baseClaimGraph, append an optional trailing JSON graph section to pack bytes, and setmeta.claimGraphcounts.mountPackFromBuffer) andPacktypes to detect and parse optional trailing sections robustly (semantic + ClaimGraph), exposepack.claimGraph, and remain tolerant of unknown trailing bytes for backward compatibility.graphoptions toQueryOptionsand by expanding the query deterministically viaexpandQueryWithGraph()before lexical tokenization whengraph.expand=true.@knolo/core:ClaimGraph,ClaimNode,ClaimEdge,ClaimGraphLog,ClaimOp,buildClaimGraph,getClaimGraph,applyClaimGraphLog,mergeClaimGraphLogs,createGraphLog,appendOp,serializeClaimGraphLog,deserializeClaimGraphLog, andexpandQueryWithGraph.Testing
npm run buildsuccessfully across the monorepo and verified the runtime bundle contains no Node stdlib specifiers (build ✅).npm test --workspace @knolo/corewhich executed added graph tests (deterministic build, pack round-trip, unknown trailing bytes, log merge/tombstone, query expansion) and passed (core tests ✅).npm testwhich exercises other packages;@knolo/coretests passed but there are unrelated existing assertion expectations in@knolo/clitests causing the workspace-wide run to fail (workspace test statusCodex Task