Repository navigation
feat: optional Jev verb selection and log-only duplicate check - #51
Merged
Merged
Conversation
Two opt-in uses of TypeSafe's Jev model, both off by default: - JEV_VERB_SELECT=on: graph_relate (single and batch) asks Jev for a documented verb when an edge would be stored as RELATED_TO. The answer is enforced against RELATIONSHIP_TYPES, identity-level verbs are never chosen, and low confidence, a source-type mismatch, a timeout, an HTTP error or a spent cap all keep RELATED_TO. Relabelled edges record verb_selected_by / verb_selection_confidence / verb_requested. - JEV_DUPLICATE_CHECK=on: after a completed nightly API-runner dream, judge graph_merge_suggestions candidates and append verdicts to logs/jev-duplicates.jsonl. Nothing is merged. Also runs alone with --job duplicates. The key is read at run time from JEV_API_KEY_FILE (compose mounts JEV_API_KEY_HOST_FILE). Costs are capped per day for verb selection and per run for the duplicate check. Names and notes that look like personal identifiers are never sent. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
README: opt-in Jev features, TypeSafe key as an optional prerequisite, install pins and current release at v0.6.0, v0.6.0 Releases row. MCP_SERVER.md: graph_prune rule exemption in both modes. DREAM_PROCESS.md and .env.example: full Jev settings table. package.json 0.6.0. Co-Authored-By: Claude Opus 5.5 (1M context) <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.
Requested by Steve
Summary
Two opt-in uses of TypeSafe's Jev, which returns typed judgments rather than text ($0.042 per million input tokens, output free). Both are off by default. With the flags unset, behaviour is unchanged.
1. Verb selection (
JEV_VERB_SELECT=on)When
graph_relate(single or batch) is about to store an edge asRELATED_TO, because the writer asked for it or asked for a verb outside the vocabulary, Jev picks from the documented verbs. There is an explicit "keep RELATED_TO" option. The verb is used only when:RELATIONSHIP_TYPES, and isn'tALIAS_OF,CONTRADICTSorSUPERSEDESJEV_VERB_MIN_CONFIDENCE(0.55), and the separate "evidence names a specific relationship" Noul is ≥ 0.5Otherwise the edge stays
RELATED_TO, including on a timeout (8 s), an HTTP error or a spent cap ($0.05 a day per server process). A relabelled edge recordsverb_selected_by,verb_selection_confidenceandverb_requested. The tool result reports each decision. The work happens in thegraph_relatehandler, soneo4j-client.tsis untouched.2. Duplicate check (
JEV_DUPLICATE_CHECK=on)After a completed nightly API-runner dream, the runner judges
graph_merge_suggestionscandidates. It reads descriptions, aliases and relationships throughgraph_queryand appends each verdict tologs/jev-duplicates.jsonl. Log-only: nothing is merged or aliased. Failures are logged and never change the run's outcome. Capped at $0.02 per run. It also runs alone with--job duplicates.Shared
JEV_API_KEY_FILE. Compose mountsJEV_API_KEY_HOST_FILEread-only intograph-memory-mcpandgraph-dream. The key is never logged.src/shared/jev.ts(client, budget, settings),src/shared/verb-select.ts,src/dream-runner/duplicates.ts.docs/DREAM_PROCESS.md("Jev judgments"),docs/MCP_SERVER.md,.env.example.Testing
npm run buildpasses.jev.test.ts,verb-select.test.ts,duplicates.test.ts) pass. They use fictional fixtures and a fakefetch.vitest run: 156 passed, 89 skipped, 2 failed. The same 2 tests fail onmainwithout this change (the symlink-escape tests, on Windows).neo4j-client.test.tsneeds the test Neo4j fromnpm run test:localand wasn't run against one.DEPLOYED_TO(0.99) andPART_OF(0.72), and keptRELATED_TOfor two vague edges. About 1,900 input tokens per verb judgment.🤖 Generated with Claude Code