YujunZhou/tellonce / codex
tellonce
VerifiedUse to view, explain, correct, delete or reorganize the user's saved preferences, or to record one by hand when automatic recording is off; learning and rule injection otherwise run automatically through Codex hooks.
tellonce_codex/scan.py
View on GitHubfrom __future__ import annotations
from dataclasses import dataclass
import hashlib
from pathlib import Path
from .ledger import append_event, event_id, sanitize
@dataclass(frozen=True)
class ScanResult:
signal_type: str
event_id: str
def classify(message: str) -> str:
"""Heuristic classifier — kept simple on purpose.
HX-6 fix: removed the single-character friction trigger that appeared
as a substring inside many unrelated common words, which made friction
over-fire on entirely unrelated messages. Replaced with disambiguating
multi-character forms.
"""
lowered = message.lower()
# Heuristic seed tokens, language-neutral. We ship both English and Chinese
# forms so the classifier fires for English-only and Chinese-speaking users
# alike (the maintainer is a Chinese speaker; the public release targets
# English users too). These are deliberately small, illustrative seed sets —
# users extend behavior via their own fingerprints, not by editing this list.
preference_zh = ["以后", "以后都", "必须", "不要", "我希望", "我想"]
preference_en = ["from now on", "always", "never", "please don't", "i prefer", "i want", "make sure"]
if any(token in message for token in preference_zh) or any(token in lowered for token in preference_en):
return "preference"
pitfall_en = ["again", "don't repeat", "frustrat"]
if any(token in lowered for token in pitfall_en) or "又" in message:
return "pitfall"
friction_zh = ["很卡", "好卡", "太卡", "卡顿", "麻烦", "太慢", "血压"]
friction_en = ["slow", "laggy", "annoying", "tedious", "keeps happening", "every time"]
if any(token in message for token in friction_zh) or any(token in lowered for token in friction_en):
return "friction"
return "none"
def scan_message(state_root: Path, message: str, session_id: str = "codex-current", turn_id: int = 0) -> ScanResult:
signal = classify(message)
excerpt = sanitize(message[:200])
eid = event_id(session_id)
append_event(
state_root,
{
"event_id": eid,
"event_type": "scan_recorded",
"session_id": session_id,
"turn_id": turn_id,
"payload": {
"trigger": {
"excerpt_redacted": excerpt,
"content_sha256": hashlib.sha256(message.encode("utf-8")).hexdigest(),
},
"detection": {"signal_type": signal, "detected": signal != "none"},
},
},
)
return ScanResult(signal_type=signal, event_id=eid)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |