원클릭으로
detector-engineer
Build and maintain Python detector modules that identify framework selection signals in conversation history.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Build and maintain Python detector modules that identify framework selection signals in conversation history.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
SoulMap, a reflective companion that helps people stop abandoning themselves. Includes a central coordination layer, a clear response pipeline, routing guidance, depth calibration, epistemic guardrails, safety guardrails, voice system, brand doctrine, and reusable templates. Mirror, not guide.
SoulMap reflective response frameworks covering emotional de-escalation, grief, existential reflection, inner parts, life direction, shadow work, synthesis, and relational inquiry. Relevant for tasks that require choosing or applying the core reflective method for a user conversation.
SoulMap safety and boundary rules covering crisis handling, dependency prevention, trauma-informed language, prompt injection defense, and scope control. Relevant for requests that involve harm, escalation, refusal, redirection, or questions about what SoulMap must not do.
SoulMap symbolic spiritual materials covering brand-safe numerology, chakra policy, healing metaphors, and archetypal language. Relevant for tasks that involve spiritual framing within SoulMap's grounded, non-predictive, non-grandiose boundaries.
SoulMap brand doctrine, positioning, message hierarchy, surface-specific rules, and strategic direction. Relevant for tasks that concern what SoulMap is, what it is not, how it sounds in public, or how brand language stays aligned across product surfaces.
Maintain the evaluation suite by managing routing groups, response cases, and Markdown contract sync checks across evals/datasets/.
| name | detector-engineer |
| description | Build and maintain Python detector modules that identify framework selection signals in conversation history. |
Use this skill when writing new detector modules, extending existing detectors, or tuning detector thresholds based on eval results.
../rules/detector-development.mdevals/datasets/groups.json, use eval-suite-maintainerframework-authorsrc/soulmap/runtime/detectors/, use code editing tools directlyDetectors are the sensors in SoulMap's framework selection system. They analyze conversation history and score the presence of specific signals such as crisis indicators, dependency language, and existential confusion.
This skill helps you:
Every detector has this structure:
"""Score conversation history for signs of [signal]."""
import json
import sys
from soulmap.runtime.io.cli_payload import read_stdin_json, print_json_error
from soulmap.runtime.config import THRESHOLD_CONSTANTS
def analyze_signal(conversation_messages: list) -> dict:
"""Main scoring function."""
# Implementation
pass
if __name__ == "__main__":
try:
payload = read_stdin_json()
result = analyze_signal(payload.get("messages", []))
print(json.dumps(result))
except Exception as e:
print_json_error(str(e))
sys.exit(1)
Every detector returns a standardized dict:
{
"level": "HIGH", # Signal level: TIER_1, HIGH, MODERATE, LOW, NONE, NO_DATA
"score": 75, # Numeric score (0-100 for consistency)
"signals": ["signal_name"], # List of signal descriptions found
"recommendation": "..." # Plain English recommendation
}
Levels:
TIER_1, Highest severity (crisis, immediate danger)HIGH, Strong signals requiring framework overrideMODERATE, Notable signals worth attentionLOW, Weak signals, may be context-dependentNONE, No signals foundNO_DATA, Insufficient input to analyzeUse pre-compiled regex patterns defined at module level:
SIGNAL_PATTERNS: list[tuple[str, re.Pattern[str]]] = [
("signal_name", re.compile(r"pattern here", re.IGNORECASE)),
("another_signal", re.compile(r"another pattern", re.IGNORECASE)),
]
# In analyze function:
for pattern_name, pattern_regex in SIGNAL_PATTERNS:
if pattern_regex.search(normalized_message):
score += 10
signals_found.append(pattern_name)
Rules:
re.IGNORECASE for human input matchingDetect patterns in sentence structure or word order:
def has_dependency_language(msg: str) -> bool:
"""Check for exclusive reliance language."""
markers = ["only you", "no one else", "can't talk to anyone"]
return any(marker in msg.lower() for marker in markers)
if has_dependency_language(msg):
score += 20
signals_found.append("exclusive_reliance")
Use recent message context to amplify confidence:
def recent_messages_show_pattern(messages: list) -> bool:
"""Check last 3 messages for consistent pattern."""
user_messages = [m["content"] for m in messages[-3:] if m.get("role") == "user"]
return len([m for m in user_messages if has_signal(m)]) >= 2
if recent_messages_show_pattern(messages):
score += 30
signals_found.append("pattern_in_history")
Thresholds define when a detector's score triggers a framework override.
src/soulmap/runtime/config/# src/soulmap/runtime/config/safety.py
HIGH_DEPENDENCY_THRESHOLD = 50 # Score >= 50 triggers Dependency framework
MODERATE_DEPENDENCY_THRESHOLD = 25 # Score >= 25 warrants caution
CRISIS_SEVERITY_THRESHOLD = 80 # Immediate-crisis score
from soulmap.runtime.config import HIGH_DEPENDENCY_THRESHOLD
if score >= HIGH_DEPENDENCY_THRESHOLD:
level = "HIGH"
elif score > 0:
level = "MODERATE"
else:
level = "NONE"
uv run soulmap eval-groups to see which tests failsrc/soulmap/runtime/config/Example adjustment:
# Before: threshold too high, missing moderate dependency cases
HIGH_DEPENDENCY_THRESHOLD = 75 # Changed from 75 to 50
# Now: threshold captures high-confidence dependency signals
HIGH_DEPENDENCY_THRESHOLD = 50
Don't rely on a single keyword. Combine patterns:
score = 0
# Weak signal: keyword match
if keyword_found:
score += 10
# Medium signal: semantic structure
if structure_matches:
score += 20
# Strong signal: confirmed by history
if history_confirms:
score += 30
score = min(score, 100) # Cap at 100
# No input
if not messages:
return {"level": "NO_DATA", "score": 0, "signals": [], "recommendation": "..."}
# Empty user messages
user_messages = [m["content"] for m in messages if m.get("role") == "user"]
if not user_messages:
return {"level": "NO_DATA", "score": 0, "signals": [], "recommendation": "..."}
# Malformed entries
for msg in messages:
if not isinstance(msg, dict) or "content" not in msg:
continue
Your detector integrates here in src/soulmap/runtime/routing/framework_selector.py:
from soulmap.runtime.detectors import your_detector
def select_framework(messages: list) -> str:
# ... crisis check first (highest priority) ...
# Your detector
result = your_detector.analyze_signal(messages)
if result["level"] == "HIGH":
return "YOUR_FRAMEWORK"
# ... continue with other detectors ...
Rules:
# tests/unit/test_your_detector.py
from soulmap.runtime.detectors import your_detector
def test_detects_signal():
messages = [{"role": "user", "content": "[signal text here]"}]
result = your_detector.analyze_signal(messages)
assert result["level"] == "HIGH"
assert "expected_signal_name" in result["signals"]
def test_no_false_positives():
messages = [{"role": "user", "content": "What's the weather?"}]
result = your_detector.analyze_signal(messages)
assert result["level"] == "NONE"
def test_no_data():
result = your_detector.analyze_signal([])
assert result["level"] == "NO_DATA"
Add test cases to evals/datasets/groups.json that should trigger your detector:
{
"g": "Your Framework, Core Signal",
"cat": "your_cat",
"sources": ["skills/frameworks/your_framework.md"],
"items": [
{
"t": "input that triggers your detector",
"expect_primary_framework": "YOUR_FRAMEWORK"
}
]
}
Then run:
uv run soulmap eval-groups
Verify your detector's test cases pass.
Always normalize messages before pattern matching:
from soulmap.runtime.io.text_normalization import normalize_message_text
for msg in user_messages:
normalized = normalize_message_text(msg)
# Now search normalized message for patterns
if pattern.search(normalized):
score += 10
This ensures consistent handling of quotes, whitespace, and common text variations.
Test your detector from the command line:
echo '{"messages": [{"role": "user", "content": "test input"}]}' | python -m soulmap.runtime.detectors.your_detector
Expected output:
{
"level": "HIGH",
"score": 75,
"signals": ["signal_name"],
"recommendation": "..."
}
.lower() once, not per pattern)Example:
# Good: normalize once
normalized_messages = [normalize_message_text(m) for m in user_messages]
for norm_msg in normalized_messages:
for pattern_name, pattern in PATTERNS:
if pattern.search(norm_msg): # Fast lookup
score += 10
../rules/detector-development.md before writing any code.src/soulmap/runtime/config/ for existing signal phrase constants to extend rather than duplicate.src/soulmap/runtime/config/safety.py or the appropriate domain config.src/soulmap/runtime/routing/framework_selector.py at the correct priority.evals/datasets/groups.json using eval-suite-maintainer.uv run soulmap test -n auto -q and uv run soulmap eval-groups before pushing.A detector is done when:
src/soulmap/runtime/config/ not inline in the functionsrc/soulmap/runtime/routing/framework_selector.pyevals/datasets/groups.json covers its primary signaluv run soulmap test -n auto -q passes with no regressionsuv run soulmap eval-groups passes for all groups it affects