Skip to content

ficilcom/otame4-work-skills / skills/research/scout-message-triage

scout-message-triage

Verified

Sort incoming scout messages and agent-forwarded openings by what they actually disclose: whether the employer is named at all, which of pay, location, employment type, and duties are stated, whether the message refers to the applicant's own history or reads as a mass send, whether a stated salary is an offer or a "up to" figure, and whether the same employer has arrived through more than one route. Use when a user has a backlog of scout messages and wants to know which ones can be researched, what to ask before replying, and what to settle before handing over a resume; do not use to rate how promising an opening is, to judge an employer or an agent, or to reply on the user's behalf.

FileKindSize
SKILL.mdskill md5.5 KB
references/report-format.mdmarkdown1.6 KB
references/triage-criteria.mdmarkdown5.9 KB
scripts/_common.pyscript9.9 KB
scripts/triage_scouts.pyscript9.4 KB

scripts/triage_scouts.py

View on GitHub
#!/usr/bin/env python3
"""Sort incoming scout messages by what they actually disclose.

受け取ったスカウトやエージェント経由の求人について、企業名の明示、条件の記載、
個別化の有無、返信期限、同一企業の重複を機械的に確認し、次に何をする段階かに
振り分ける。求人の良し悪しは判定しない。書かれていない条件を推測しない。
"""

from __future__ import annotations

from datetime import date
from typing import Any

from _common import (
    flag_collector,
    optional_choice,
    optional_date,
    optional_text,
    require_list,
    require_object,
    require_text,
    run_cli,
    strip_whitespace,
)


SENDERS = ("company", "agent", "platform", "unknown")
PAY_CLAIM_TYPES = ("range", "maximum", "possible", "none")
INTEREST_LEVELS = ("yes", "maybe", "no", "unknown")
# 条件として最低限そろっていないと、求人票の読み解きに渡せない項目。
CONDITION_FIELDS = ("pay", "location", "employment_type", "duties")
# 返信期限までがこれ以下なら、判断の時間が取れないものとして注記する。
DEADLINE_SOON_DAYS = 3


def parse_scout(raw: object, index: int) -> dict[str, Any]:
    path = f"scouts[{index}]"
    item = require_object(raw, path)

    sender = optional_choice(item.get("from"), f"{path}.from", SENDERS, "unknown")
    pay_claim = optional_choice(item.get("pay_claim_type"), f"{path}.pay_claim_type", PAY_CLAIM_TYPES, "none")
    interest = optional_choice(item.get("user_interest"), f"{path}.user_interest", INTEREST_LEVELS, "unknown")

    conditions_raw = require_object(item.get("conditions", {}), f"{path}.conditions")
    conditions = {}
    for field in CONDITION_FIELDS:
        value = conditions_raw.get(field)
        if value is not None and not isinstance(value, bool):
            raise ValueError(f"{path}.conditions.{field} must be a boolean or null")
        conditions[field] = bool(value)
    for key in conditions_raw:
        if key not in CONDITION_FIELDS:
            raise ValueError(f"{path}.conditions has an unknown field: {key!r}")

    personalized = [
        require_text(reason, f"{path}.personalized[{position}]")
        for position, reason in enumerate(
            require_list(item.get("personalized", []), f"{path}.personalized")
        )
    ]

    return {
        "id": require_text(item.get("id"), f"{path}.id"),
        "from": sender,
        "company": optional_text(item.get("company"), f"{path}.company"),
        "role": optional_text(item.get("role"), f"{path}.role"),
        "received": optional_date(item.get("received"), f"{path}.received"),
        "reply_deadline": optional_date(item.get("reply_deadline"), f"{path}.reply_deadline"),
        "conditions": conditions,
        "personalized": personalized,
        "pay_claim_type": pay_claim,
        "requires_registration": bool(item.get("requires_registration", False)),
        "user_interest": interest,
    }


def route(scout: dict[str, Any], missing: list[str]) -> str:
    """次に何をする段階かを、記載の状態から機械的に決める。良し悪しの判定ではない。"""
    if scout["user_interest"] == "no":
        return "declined"
    if scout["company"] is None:
        return "needs_company_name"
    if missing:
        return "needs_conditions"
    if scout["user_interest"] == "yes":
        return "ready_for_posting_analysis"
    return "user_decision_pending"


def describe(scout: dict[str, Any]) -> dict[str, Any]:
    missing = [field for field in CONDITION_FIELDS if not scout["conditions"][field]]
    return {
        "id": scout["id"],
        "from": scout["from"],
        "company": scout["company"],
        "role": scout["role"],
        "company_named": scout["company"] is not None,
        "missing_conditions": missing,
        "personalized": bool(scout["personalized"]),
        "personalization_reasons": scout["personalized"],
        "pay_claim_type": scout["pay_claim_type"],
        "requires_registration": scout["requires_registration"],
        "user_interest": scout["user_interest"],
        "routing": route(scout, missing),
    }


def collect_flags(
    scouts: list[dict[str, Any]], described: list[dict[str, Any]], as_of: date | None
) -> list[dict[str, Any]]:
    flags, add = flag_collector()

    if not scouts:
        add("scouts_not_captured", "スカウトが取り込まれていない")
        return flags

    template = [entry["id"] for entry in described if not entry["personalized"]]
    if template:
        add(
            "no_personalization",
            "経歴に触れた記述がないスカウトがある。一斉送信の可能性を前提に、条件の記載だけで判断する",
            template,
        )

    unnamed = [entry["id"] for entry in described if not entry["company_named"]]
    if unnamed:
        add(
            "company_not_named",
            "企業名が明かされていないスカウトがある。企業研究も求人票の読み解きもできない",
            unnamed,
        )

    incomplete = [entry["id"] for entry in described if entry["missing_conditions"]]
    if incomplete:
        add(
            "conditions_incomplete",
            "給与・勤務地・雇用形態・業務内容のいずれかが書かれていないスカウトがある",
            incomplete,
        )

    soft_pay = [
        entry["id"] for entry in described if entry["pay_claim_type"] in ("maximum", "possible")
    ]
    if soft_pay:
        add(
            "pay_claim_not_an_offer",
            "「最大」「可能」といった書き方の年収が示されているスカウトがある。提示された条件ではない",
            soft_pay,
        )

    registration = [entry["id"] for entry in described if entry["requires_registration"]]
    if registration:
        add(
            "registration_required_before_details",
            "詳細を見るのに登録や面談が必要なスカウトがある。経歴を渡す前に、渡す範囲を決める",
            registration,
        )

    seen: dict[str, list[str]] = {}
    for scout in scouts:
        if scout["company"] is None:
            continue
        seen.setdefault(strip_whitespace(scout["company"]), []).append(scout["id"])
    duplicates = [ids for ids in seen.values() if len(ids) > 1]
    if duplicates:
        add(
            "same_company_multiple_routes",
            "同じ企業のスカウトを複数の経路から受けている。経路が重なると応募が重複しうるため、"
            "どの経路で進めるかを先に決める",
            [scout_id for ids in duplicates for scout_id in ids],
        )

    if as_of is not None:
        passed = [
            scout["id"]
            for scout in scouts
            if scout["reply_deadline"] is not None and scout["reply_deadline"] < as_of
        ]
        if passed:
            add("reply_deadline_passed", "返信期限を過ぎたスカウトがある", passed)
        soon = [
            scout["id"]
            for scout in scouts
            if scout["reply_deadline"] is not None
            and 0 <= (scout["reply_deadline"] - as_of).days <= DEADLINE_SOON_DAYS
        ]
        if soon:
            add(
                "reply_deadline_soon",
                f"返信期限まで{DEADLINE_SOON_DAYS}日以内のスカウトがある。急がされること自体は条件の良さではない",
                soon,
            )

    undecided = [entry["id"] for entry in described if entry["user_interest"] == "unknown"]
    if undecided:
        add("interest_unknown", "関心の有無を確認していないスカウトがある", undecided)

    return flags


def triage(payload: object) -> dict[str, Any]:
    data = require_object(payload, "input")
    as_of = optional_date(data.get("as_of"), "as_of")

    raw_scouts = require_list(data.get("scouts", []), "scouts")
    scouts = []
    seen: set[str] = set()
    for index, raw in enumerate(raw_scouts):
        scout = parse_scout(raw, index)
        if scout["id"] in seen:
            raise ValueError(f"scouts[{index}].id is duplicated: {scout['id']!r}")
        seen.add(scout["id"])
        scouts.append(scout)

    described = [describe(scout) for scout in scouts]
    routing: dict[str, list[str]] = {}
    for entry in described:
        routing.setdefault(entry["routing"], []).append(entry["id"])

    return {
        "as_of": data.get("as_of"),
        "summary": {
            "scouts": len(described),
            "company_named": sum(1 for entry in described if entry["company_named"]),
            "personalized": sum(1 for entry in described if entry["personalized"]),
            "conditions_complete": sum(
                1 for entry in described if not entry["missing_conditions"]
            ),
            "routing": {key: len(value) for key, value in sorted(routing.items())},
        },
        "scouts": described,
        "routing": routing,
        "flags": collect_flags(scouts, described, as_of),
        "notes": [
            "この出力は記載の有無と重複を数えたものであり、求人や企業の評価ではない",
            "routing は次に何をする段階かであって、応募すべきかどうかではない",
            "企業名が分かったものだけが company-research と job-posting-analysis に渡せる",
        ],
    }


def main(argv: list[str] | None = None) -> int:
    return run_cli(triage, __doc__, argv)


if __name__ == "__main__":
    raise SystemExit(main())
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: 472kUpdated Claude CodeCodexVerifiedInstall
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: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
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 availableStars: 322kUpdated Claude CodeCodexVerifiedInstall