Skip to content

feat: optional Jev verb selection and log-only duplicate check - #51

Merged
stevepridemore merged 3 commits into
mainfrom
feat/jev-verbs-and-duplicates
Oct 27, 2026
Merged

stevepridemore merged 3 commits into
mainfrom
feat/jev-verbs-and-duplicates

Conversation

@stevepridemore

Copy link
Copy Markdown
Owner

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 as RELATED_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:

  • it's in RELATIONSHIP_TYPES, and isn't ALIAS_OF, CONTRADICTS or SUPERSEDES
  • its Choice confidence is ≥ JEV_VERB_MIN_CONFIDENCE (0.55), and the separate "evidence names a specific relationship" Noul is ≥ 0.5
  • it's defined for the source node's type

Otherwise 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 records verb_selected_by, verb_selection_confidence and verb_requested. The tool result reports each decision. The work happens in the graph_relate handler, so neo4j-client.ts is untouched.

2. Duplicate check (JEV_DUPLICATE_CHECK=on)

After a completed nightly API-runner dream, the runner judges graph_merge_suggestions candidates. It reads descriptions, aliases and relationships through graph_query and appends each verdict to logs/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

  • The key is read at run time from JEV_API_KEY_FILE. Compose mounts JEV_API_KEY_HOST_FILE read-only into graph-memory-mcp and graph-dream. The key is never logged.
  • Names or notes that look like personal identifiers (email, SSN, date of birth, card number) are never sent.
  • New files: src/shared/jev.ts (client, budget, settings), src/shared/verb-select.ts, src/dream-runner/duplicates.ts.
  • Docs: docs/DREAM_PROCESS.md ("Jev judgments"), docs/MCP_SERVER.md, .env.example.

Testing

  • npm run build passes.
  • 27 new unit tests (jev.test.ts, verb-select.test.ts, duplicates.test.ts) pass. They use fictional fixtures and a fake fetch.
  • Full vitest run: 156 passed, 89 skipped, 2 failed. The same 2 tests fail on main without this change (the symlink-escape tests, on Windows). neo4j-client.test.ts needs the test Neo4j from npm run test:local and wasn't run against one.
  • A live call with a real key on fictional edges gave DEPLOYED_TO (0.99) and PART_OF (0.72), and kept RELATED_TO for two vague edges. About 1,900 input tokens per verb judgment.

🤖 Generated with Claude Code

stevepridemore and others added 3 commits October 27, 2026 16:26
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>
@stevepridemore
stevepridemore merged commit 4b658c7 into main Oct 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant