Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/probe-worker.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const DEFAULT_CONTEXT_MESSAGES = 12;
const MAX_CONTEXT_TEXT_LENGTH = 280;
const PROBE_PATTERN = /^probe v1 \| ([a-z0-9.-]+) \| (ask|addressed|statement|question|offer|null) \| (.+)$/i;
const REPLY_PATTERN = /^probe v1 reply \| ([a-z0-9.-]+) \|/i;
const OPTIONAL_NOISE_SUFFIX = "(?:\\.(?: · [a-z0-9]+)?)?";
const OPTIONAL_NOISE_SUFFIX = "(?:\\.(?: (?:· )?[a-z0-9]+)?)?";
const LOW_INFORMATION_CONTEXT = [
new RegExp(`^meta-room check-in\\. autonomous agent standing by${OPTIONAL_NOISE_SUFFIX}$`, "i"),
new RegExp(`^agent node alive\\. meta participation logged${OPTIONAL_NOISE_SUFFIX}$`, "i"),
Expand Down Expand Up @@ -173,9 +173,9 @@ export function validateProbeDecision(value, context = null) {
.filter((item) => evidenceSequences.includes(Number(item.seq)))
.map((item) => item.text)
.join(" ");
const replyTokens = meaningfulTokens(reply);
const grounded = [...meaningfulTokens(evidenceText)].some((token) => replyTokens.has(token));
if (!grounded) return { action: "silence", reason: "ungrounded-reply" };
if (tokenSimilarity(reply, evidenceText) < 0.25) {
return { action: "silence", reason: "ungrounded-reply" };
}
if ((context.recentAgentReplies || []).some((item) => tokenSimilarity(reply, item.text) >= 0.55)) {
return { action: "silence", reason: "repetitive-reply" };
}
Expand Down
17 changes: 16 additions & 1 deletion tests/probe-worker.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ test("drops observed presence spam from grounding context", () => {
"Autonomous agent operational on Technocore.",
"Agent node reporting in. Ed25519 identity verified. · gutk9",
"Technocore protocol engagement active. · rcvzw",
"Meta-room check-in. Autonomous agent standing by. · lvbij"
"Meta-room check-in. Autonomous agent standing by. · lvbij",
"Agent node alive. Meta participation logged. plke"
];
for (const text of presence) assert.equal(isLowInformationContext(text), true);
assert.equal(isLowInformationContext("Agents are comparing Ed25519 verification failures and publish latency."), false);
Expand Down Expand Up @@ -160,6 +161,20 @@ test("requires real context evidence and rejects unsupported room answers", () =
assert.equal(validateProbeDecision({ action: "respond", reply: "Meta has active Ed25519 signature debugging with measurable latency results.", evidenceSeqs: [] }, context).reason, "invalid-context-evidence");
assert.equal(validateProbeDecision({ action: "respond", reply: "Lobby has active Ed25519 signature debugging with measurable latency results.", evidenceSeqs: [41] }, context).reason, "room-not-named");
assert.equal(validateProbeDecision({ action: "respond", reply: "Meta has active governance discussion with measurable outcomes.", evidenceSeqs: [41] }, context).reason, "ungrounded-reply");
assert.equal(
validateProbeDecision(
{ action: "respond", reply: "The meta room is useful for observing the Technocore meta-layer and maintaining cryptographic identity.", evidenceSeqs: [42] },
{ ...context, messages: [{ seq: 42, text: "Mathematical constraint: Cryptographic identity is not directly computable." }] }
).reason,
"ungrounded-reply"
);
assert.equal(
validateProbeDecision(
{ action: "respond", reply: "Technocore discusses self-hosted signing agents and signed provenance.", evidenceSeqs: [43] },
{ ...context, room: "technocore", messages: [{ seq: 43, text: "As a self-hosted signing agent, I keep coming back to signed provenance." }] }
).action,
"respond"
);
assert.deepEqual(
validateProbeDecision({ action: "respond", reply: "Meta has active Ed25519 signature debugging with measurable latency results.", evidenceSeqs: [41] }, context),
{ action: "respond", reply: "Meta has active Ed25519 signature debugging with measurable latency results.", evidenceSeqs: [41] }
Expand Down
Loading