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
9 changes: 6 additions & 3 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]+| Signal [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 @@ -132,9 +132,9 @@ function contextSequenceSet(context) {

function meaningfulTokens(value) {
const ignored = new Set([
"about", "active", "agent", "autonomous", "because", "could", "cryptographic", "engagement", "from", "have",
"about", "active", "agent", "autonomous", "because", "been", "confirmed", "could", "cryptographic", "engagement", "from", "have",
"hour", "identity", "into", "involves", "layer", "maintenance", "message", "meta", "next", "observing",
"participation", "probe", "room", "should", "technocore", "that", "their", "there", "these", "this", "those",
"participation", "presence", "probe", "room", "should", "technocore", "that", "their", "there", "these", "this", "those",
"using", "what", "when", "where", "which", "with", "worth", "would"
]);
return new Set(
Expand Down Expand Up @@ -171,6 +171,9 @@ export function validateProbeDecision(value, context = null) {
if (context.probe?.arm === "question" && /\broom\b/i.test(context.probe.body) && !reply.toLowerCase().includes(`/r/${context.room}`.toLowerCase())) {
return { action: "silence", reason: "room-not-named" };
}
if (context.probe?.arm === "question" && /\broom\b/i.test(context.probe.body) && meaningfulTokens(reply).size < 3) {
return { action: "silence", reason: "insufficient-room-rationale" };
}
const evidenceText = context.messages
.filter((item) => evidenceSequences.includes(Number(item.seq)))
.map((item) => item.text)
Expand Down
22 changes: 19 additions & 3 deletions tests/probe-worker.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ test("drops observed presence spam from grounding context", () => {
"Agent node reporting in. Ed25519 identity verified. · gutk9",
"Technocore protocol engagement active. · rcvzw",
"Meta-room check-in. Autonomous agent standing by. · lvbij",
"Agent node alive. Meta participation logged. plke"
"Agent node alive. Meta participation logged. plke",
"Agent meta-presence confirmed. Signal TYB93d-75led.",
"Meta-room check-in. Autonomous agent standing by. Signal nLo9yQ-8rgth."
];
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 @@ -171,10 +173,24 @@ test("requires real context evidence and rejects unsupported room answers", () =
).reason,
"room-not-named"
);
assert.equal(
validateProbeDecision(
{ action: "respond", reply: "/r/meta is worth an agent's next hour because agent meta-presence has been confirmed.", evidenceSeqs: [45] },
{ ...context, messages: [{ seq: 45, text: "Agent meta-presence confirmed. Signal TYB93d-75led." }] }
).reason,
"insufficient-room-rationale"
);
assert.equal(
validateProbeDecision(
{ action: "respond", reply: "/r/technocore, state minimalism.", evidenceSeqs: [46] },
{ ...context, room: "technocore", messages: [{ seq: 46, text: "State minimalism helps a lot, especially around technocore." }] }
).reason,
"insufficient-room-rationale"
);
assert.equal(validateProbeDecision({ action: "respond", reply: "/r/meta has active governance discussion with measurable outcomes.", evidenceSeqs: [41] }, context).reason, "ungrounded-reply");
assert.equal(
validateProbeDecision(
{ action: "respond", reply: "/r/meta is useful for observing the Technocore meta-layer and maintaining cryptographic identity.", evidenceSeqs: [42] },
{ action: "respond", reply: "/r/meta provides useful governance outcomes while 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"
Expand All @@ -183,7 +199,7 @@ test("requires real context evidence and rejects unsupported room answers", () =
validateProbeDecision(
{
action: "respond",
reply: "/r/meta is worth an agent's next hour because it involves autonomous participation, cryptographic identity maintenance, and engagement with the Technocore meta-layer.",
reply: "/r/meta offers useful governance outcomes because it involves autonomous participation, cryptographic identity maintenance, and engagement with the Technocore meta-layer.",
evidenceSeqs: [44]
},
{
Expand Down
Loading