From aa5fe94417213c406fc61179b2610b264d4238f8 Mon Sep 17 00:00:00 2001 From: Munawarx Date: Sun, 26 Jul 2026 15:59:02 +0530 Subject: [PATCH] fix(router): add deterministic current-state runtime tells (issue #10) Adds a precision-guarded 'runtime-current-state' tell family that catches natural phrasings of the core 'what is the current/recorded state?' question class missed in issue #10 (still/depend on/ingest today/custom component nouns), staying fully deterministic and local (no LLM in the hook loop). Before: 4 of 5 reported phrasings got no contract (1 of 5 routed). After: all 5 route (4 runtime + the existing historical case); custom-noun 'fleet-hub alive right now?' now routes to runtime. Router suite: 37/37 green (matcher/planner/decompose/satisfaction + new RED test). RED test added first, then the tells, both kept. Additive only: no schema/engine/ adapter/receipt changes. Co-Authored-By: Hermes Agent --- policy/tells.yaml | 10 +++++++ test/runtime-current-state.test.js | 43 ++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 test/runtime-current-state.test.js diff --git a/policy/tells.yaml b/policy/tells.yaml index a25c117..8789229 100644 --- a/policy/tells.yaml +++ b/policy/tells.yaml @@ -38,6 +38,16 @@ tells: terminal: true phrases: ["running now", "currently deployed", "is deployed", "is it live", "it is live", "which version is live", "what version is deployed", "health endpoint", "is * responding", "responding now", "alive now", "live right now", "port * open", "is the * up"] + # ---- runtime: current/recorded-state qualifier co-occurring with a system/component noun ---- + # Issue #10: natural phrasings of the core "what is the current/recorded state?" question + # class were missed (precision>recall inventory). These are high-precision: each phrase only + # fires on a live/recorded-state qualifier tied to a system/component/connector noun, so it is + # almost never another family. Deterministic, local; no LLM in the hook loop. + - id: runtime-current-state + family: runtime + terminal: true + phrases: ["still * from", "still read", "still ingest", "still file-based", "dependent on", "is our ingest still", "does * still ", "are we dependent", "how does * ingest", "ingest * today", "read * from * today", "still * today", "alive right now", "any more", "currently * any way", "in any way"] + # Clause-scoped exclusions. When a clause contains an exclude phrase, the named family # is suppressed FOR THAT CLAUSE only — not a global abstention. # e.g. "tell me what we decided, but don't check whether it's deployed" → historical only. diff --git a/test/runtime-current-state.test.js b/test/runtime-current-state.test.js new file mode 100644 index 0000000..1fc9036 --- /dev/null +++ b/test/runtime-current-state.test.js @@ -0,0 +1,43 @@ +'use strict'; + +// Regression tests for issue #10 (router misses natural phrasings of the +// core "what is the current/recorded state?" question class). +// These reproduce the reported misses before the deterministic current-state +// tell family was added. Keep this file green — it encodes the receipt. + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const path = require('node:path'); +const { loadPolicy, matchPrompt } = require('../src/matcher'); + +const policyPath = path.join(__dirname, '..', 'policy', 'tells.yaml'); + +function families(prompt) { + const policy = loadPolicy(policyPath); + return matchPrompt(prompt, policy).map((match) => match.family); +} + +test('routes "is still ing from ?" to runtime (issue #10 case 1)', () => { + const f = families('does the store still read sales from the vendor archive folder?'); + assert.ok(f.includes('runtime'), `expected runtime in ${JSON.stringify(f)}`); +}); + +test('routes "are we dependent on in any way?" to runtime (issue #10 case 2)', () => { + const f = families('are we dependent on the vendor in any way?'); + assert.ok(f.includes('runtime'), `expected runtime in ${JSON.stringify(f)}`); +}); + +test('routes "how does our connector ingest today?" to runtime (issue #10 case 3)', () => { + const f = families('how does our connector ingest sales data today?'); + assert.ok(f.includes('runtime'), `expected runtime in ${JSON.stringify(f)}`); +}); + +test('routes "is our ingest still file-based or register-direct?" to runtime (issue #10 case 4)', () => { + const f = families('is our ingest still file-based or register-direct?'); + assert.ok(f.includes('runtime'), `expected runtime in ${JSON.stringify(f)}`); +}); + +test('routes custom component noun "fleet-hub alive right now?" to runtime (issue #10 observation)', () => { + const f = families('is the fleet-hub alive right now?'); + assert.ok(f.includes('runtime'), `expected runtime in ${JSON.stringify(f)}`); +});