Skip to content

Commit 1c8e8f0

Browse files
committed
cmo: tune context detection to recover high-signal unique replies
1 parent 08f3bd2 commit 1c8e8f0

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

ops/cmo-automation/scripts/hydrate_approved_queue.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -117,22 +117,21 @@ def root_ideas(role: str) -> str:
117117
def detect_topic(source_text: str) -> tuple[str, str]:
118118
s = (source_text or "").lower()
119119
topic_map = [
120-
("evals", ["eval", "benchmark", "test", "score"]),
121-
("memory", ["memory", "context", "recall", "state"]),
122-
("orchestration", ["orchestration", "workflow", "pipeline", "automation"]),
123-
("governance", ["governance", "policy", "compliance", "guardrail"]),
124-
("verification", ["verify", "proof", "receipt", "audit", "on-chain"]),
125-
("agent", ["agent", "autonomous", "multi-agent"]),
126-
("distribution", ["distribution", "growth", "retention", "onboarding"]),
127-
("shipping", ["ship", "release", "roadmap", "milestone"]),
120+
("evals", ["eval", "benchmark", "test", "score", "grade", "leaderboard"]),
121+
("memory", ["memory", "context", "recall", "state", "retrieval", "rag"]),
122+
("orchestration", ["orchestration", "workflow", "pipeline", "automation", "scheduler", "queue", "routing"]),
123+
("governance", ["governance", "policy", "compliance", "guardrail", "control", "constraints"]),
124+
("verification", ["verify", "proof", "receipt", "audit", "on-chain", "attestation"]),
125+
("agent", ["agent", "autonomous", "multi-agent", "copilot"]),
126+
("distribution", ["distribution", "growth", "retention", "onboarding", "funnel", "activation"]),
127+
("shipping", ["ship", "release", "roadmap", "milestone", "launch", "repo", "sdk", "api", "integration", "supports"]),
128128
]
129129
for topic, kws in topic_map:
130130
for kw in kws:
131131
if kw in s:
132132
return topic, kw
133133
return "general", ""
134134

135-
136135
def build_reply_text(role: str, target_user: str, source_text: str, idx_seed: int) -> str:
137136
topic, kw = detect_topic(source_text)
138137
k = kw or "this"
@@ -152,8 +151,8 @@ def build_reply_text(role: str, target_user: str, source_text: str, idx_seed: in
152151
f"@{target_user} Good framing. Distribution quality shows up in repeatable retention, not reach spikes.",
153152
],
154153
"general": [
155-
f"@{target_user} Good observation. The useful test is whether it changes operator control, reliability, or verification quality.",
156-
f"@{target_user} Useful angle. I care most about what can be measured and repeated in production.",
154+
f"@{target_user} Useful angle. What matters is whether this improves operator control or reliability under load.",
155+
f"@{target_user} I look at this through execution quality. If it is measurable in production, it is worth building on.",
157156
],
158157
},
159158
"product-agent": {
@@ -188,8 +187,8 @@ def build_reply_text(role: str, target_user: str, source_text: str, idx_seed: in
188187
f"@{target_user} We see this too. Orchestration quality compounds faster than model-level tuning.",
189188
],
190189
"general": [
191-
f"@{target_user} Solid perspective. The key is whether it improves measurable outcomes in production.",
192-
f"@{target_user} Good signal. What makes this useful is the path from idea to repeatable operational impact.",
190+
f"@{target_user} Solid perspective. The key test is whether it improves measurable outcomes in production.",
191+
f"@{target_user} Useful perspective. Operational value shows up when the idea survives real deployment constraints.",
193192
],
194193
},
195194
}
@@ -296,15 +295,15 @@ def hydrate_single_action(action: dict, policy: dict, resolver: Resolver, seen:
296295
return out
297296

298297
topic, _ = detect_topic(source_text)
299-
if topic == "general":
298+
anchor = source_anchor(source_text)
299+
if topic == "general" and len(anchor.split()) < 2:
300300
out["hydration_status"] = "blocked"
301301
out["hydration_reason"] = "insufficient_context_specificity"
302302
return out
303303

304304
target_user = out.get("target_user") or candidate.get("author") or "builder"
305305
idx_seed = len(seen["reply_norms"]) + len(target_user) + len(tweet_id)
306306
reply_raw = build_reply_text(role, target_user, source_text, idx_seed)
307-
anchor = source_anchor(source_text)
308307
if anchor and len(anchor.split()) >= 2:
309308
reply_raw = f"{reply_raw} Specific to {anchor}."
310309
reply_text = enforce_style(reply_raw, remove_links=no_links_in_replies, no_hashtags=no_hashtags)

0 commit comments

Comments
 (0)