Skip to content

getaero-io/gtm-eng-skills / engineering/warm-intro-scoring

warm-intro-scoring

Verified

FileKindSize
.gitignoreother121 B
GUIDE.mdmarkdown4.7 KB
LICENSEother1.1 KB
README.mdmarkdown8.0 KB
SKILL.mdskill md327 B
TESTING.mdmarkdown8.9 KB
UPSTREAM.mdmarkdown1.3 KB
assets/company-research.play.tsscript1021 B
assets/customer-db.sqlother2.7 KB
assets/evaluation-example.jsonconfig4.6 KB
assets/example.jsonconfig6.9 KB
assets/portfolio-focus.weights.jsonconfig32 B
assets/review.htmlother7.4 KB
assets/tuning-example.jsonconfig1.2 KB
assets/tuning.htmlother30.1 KB
check_all.pyscript1.4 KB
package-manifest.jsonconfig9.8 KB
plays/README.mdmarkdown18.2 KB
plays/check-report.pyscript1.8 KB
plays/check_all.pyscript1.6 KB
plays/check_parity.pyscript6.0 KB
plays/collect.play.tsscript4.0 KB
plays/collection.tsscript1.9 KB
plays/core.tsscript44.2 KB
plays/evaluation-contract.mdmarkdown3.4 KB
plays/evaluation.tsscript13.8 KB
plays/features.play.tsscript4.7 KB
plays/features.tsscript22.6 KB
plays/generatedtemplate.tsscript38.1 KB
plays/guardrails.tsscript948 B
plays/legacy.tsscript9.7 KB
plays/merge-payloads.pyscript8.6 KB
plays/parity-driver.tsscript995 B
plays/parity-evaluation.pyscript8.5 KB
plays/parity-reports.pyscript2.3 KB
plays/prepare-inputs.pyscript6.5 KB
plays/quality.tsscript3.8 KB
plays/read-sources.play.tsscript3.4 KB
plays/report-cli.tsscript590 B
plays/report.play.tsscript2.9 KB
plays/report.tsscript3.1 KB
plays/reports.tsscript5.7 KB
plays/research.play.tsscript1.6 KB
plays/review-uncertainty.play.tsscript5.5 KB
plays/score.play.tsscript2.3 KB
plays/snapshots.play.tsscript4.2 KB
plays/strict-json.tsscript1.8 KB
plays/sync-template.pyscript849 B
plays/uncertainty.tsscript4.9 KB
plays/validation.play.tsscript3.6 KB
references/adversarial-review.mdmarkdown7.0 KB
references/batch-collection.mdmarkdown5.1 KB
references/company-network.mdmarkdown5.8 KB
references/competitive-review.mdmarkdown8.8 KB
references/evaluation.mdmarkdown8.5 KB
references/evaluator-validation.mdmarkdown3.4 KB
references/evaluator.mdmarkdown7.9 KB
references/external-data.mdmarkdown4.0 KB
references/factor-test-matrix.mdmarkdown4.6 KB
references/factors.mdmarkdown6.1 KB
references/intro-drafts.mdmarkdown1.6 KB
references/pipeline.mdmarkdown7.6 KB
references/readable-output.mdmarkdown5.4 KB
references/research-brief.mdmarkdown2.4 KB
references/sources.mdmarkdown7.5 KB
references/tuning.mdmarkdown14.6 KB
scripts/audit_history.pyscript5.1 KB
scripts/check.pyscript5.1 KB
scripts/compare_versions.pyscript1.9 KB
scripts/evaluate.pyscript22.5 KB
scripts/package-skill.pyscript1.9 KB
scripts/portfolio.pyscript3.7 KB
scripts/quality.pyscript5.3 KB
scripts/recipe-demo.tsscript2.6 KB
scripts/render.pyscript1.6 KB
scripts/score.pyscript9.6 KB
scripts/temporal.pyscript2.2 KB
scripts/test_ask_handoff.pyscript2.1 KB
scripts/test_audit_history.pyscript2.7 KB
scripts/test_handoff_evaluate.pyscript9.1 KB
scripts/test_portfolio.pyscript3.6 KB
scripts/test_quality.pyscript3.1 KB
scripts/test_temporal.pyscript1.3 KB
scripts/test_tuning.pyscript14.1 KB
scripts/test_tuning_browser.cjsscript7.7 KB
scripts/test_version_parity.pyscript1.0 KB
scripts/tuning.pyscript10.9 KB
tests/adversarial.test.tsscript8.2 KB
tests/browser_e2e.cjsscript1.9 KB
tests/cloud_e2e.pyscript6.9 KB
tests/e2e-fixture.jsonconfig3.6 KB
tests/feature_parity.pyscript2.4 KB
tests/features.test.tsscript8.3 KB
tests/test_prepare_inputs.pyscript8.6 KB
tests/uncertainty.test.tsscript2.5 KB
vendor-manifest.jsonconfig748 B

scripts/tuning.py

View on GitHub
"""Validate normalized evidence features and render a private, offline weight tuner."""
import argparse
from datetime import date
import json
import math
import os
import re
from pathlib import Path

DEFAULT_WEIGHTS = dict(direct_intro=160, work_overlap=80, school_overlap=20,
                       relationship=15, role_industry=20, investor_portfolio=3,
                       appearance=20, board_overlap=30,
                       city_overlap=10, industry_match=10, community_match=2, investor_role=120)
TIMED = {'work_overlap', 'school_overlap', 'board_overlap', 'city_overlap', 'investor_role'}
TIMING = {'verified_overlap', 'non_overlap', 'unknown', 'not_applicable'}
MODEL = 'evidence-feature-heuristic-v4'
REVIEW_STATUSES = {'needs_confirmation', 'blocked_declined', 'ready_for_human_review'}


def number(value, label, maximum=None):
    if isinstance(value, bool) or not isinstance(value, (int, float)) or not math.isfinite(value) or value < 0 or (maximum is not None and value > maximum):
        raise ValueError(f'{label} must be finite and nonnegative' + (' and <= 1' if maximum == 1 else ''))
    return value


def weights(config=None):
    config = {} if config is None else config
    if not isinstance(config, dict) or set(config) - DEFAULT_WEIGHTS.keys():
        raise ValueError('Unknown weight keys or invalid configuration')
    return {key: number(config.get(key, default), key) for key, default in DEFAULT_WEIGHTS.items()}


def required_text(value, label):
    if not isinstance(value, str) or not value.strip():
        raise ValueError(f'{label} must be a nonempty string')
    return value


def exact_date(value, label):
    try:
        parsed = date.fromisoformat(value)
    except (ValueError, TypeError):
        raise ValueError(f'{label} must be a full YYYY-MM-DD date') from None
    if value != parsed.isoformat():
        raise ValueError(f'{label} must be a full YYYY-MM-DD date')
    return parsed


def work_overlap_value(company_size, same_function, same_location):
    """Use the same dated employer roles for both context flags. Unknown size is conservative."""
    if company_size is not None and (type(company_size) is not int or company_size <= 0):
        raise ValueError('company_size must be a positive employee count or null')
    if any(x is not None and type(x) is not bool for x in (same_function, same_location)):
        raise ValueError('Work context flags must be boolean or null')
    if company_size is not None and company_size < 1000:
        return 1.0
    if same_function and same_location:
        return 1.0
    return 0.625 if same_function else 0.5 if same_location else 0.25


def normalize(data):
    if not isinstance(data, dict) or not isinstance(data.get('paths'), list) or not data['paths']:
        raise ValueError('Input must contain a nonempty paths list')
    as_of = exact_date(data.get('as_of'), 'as_of')
    rows, seen, pairs = [], set(), set()
    for raw in data['paths']:
        if not isinstance(raw, dict):
            raise ValueError('Each path must be an object')
        row = {key: required_text(raw.get(key), key) for key in ('id','target_id','target_name','connector_id','connector_name','review_status')}
        if row['id'] in seen:
            raise ValueError('Duplicate path ID')
        seen.add(row['id'])
        pair = (row['connector_id'], row['target_id'])
        if pair[0] == pair[1]:
            raise ValueError('Connector and target must be different people')
        if pair in pairs:
            raise ValueError('Duplicate connector/target pair')
        pairs.add(pair)
        if row['review_status'] not in REVIEW_STATUSES:
            raise ValueError('Unsupported review status')
        for key in ('target_company', 'target_title', 'connector_company', 'connector_title', 'requester_name'):
            if key in raw:
                row[key] = required_text(raw[key], key)
        for key in ('target_linkedin_url', 'connector_linkedin_url'):
            if key in raw:
                url = required_text(raw[key], key)
                if not re.fullmatch(r'https://(?:www\.)?linkedin\.com/in/[^/?#\s]+/?', url):
                    raise ValueError('Invalid LinkedIn profile URL')
                row[key] = url
        row['baseline_score'] = number(raw.get('baseline_score'), 'baseline_score')
        supplied = raw.get('features', {})
        if not isinstance(supplied, dict) or set(supplied) - DEFAULT_WEIGHTS.keys():
            raise ValueError('Unsupported feature keys or invalid features')
        row['features'] = {}
        for key in DEFAULT_WEIGHTS:
            f = supplied.get(key)
            if f is None:
                f = dict(value=0, evidence_ids=[], explanation='Unknown: no evidence supplied', timing_status='unknown')
            if not isinstance(f, dict):
                raise ValueError('Feature must be an object')
            value = number(f.get('value'), key, 1)
            ids = f.get('evidence_ids', [])
            if not isinstance(ids, list) or any(not isinstance(x, str) or not x.strip() for x in ids) or (value > 0 and not ids):
                raise ValueError('Positive features require nonempty evidence IDs')
            explanation = required_text(f.get('explanation'), 'explanation')
            timing = f.get('timing_status', 'unknown')
            if timing not in TIMING:
                raise ValueError('Unsupported timing status')
            feature = dict(value=value, evidence_ids=list(ids), explanation=explanation, timing_status=timing)
            if key in TIMED and value > 0:
                if timing != 'verified_overlap':
                    raise ValueError(f'{key} requires verified dated overlap')
                start = exact_date(f.get('overlap_start'), 'overlap_start')
                end = exact_date(f.get('overlap_end'), 'overlap_end')
                if start > end or end > as_of:
                    raise ValueError('Overlap must have start <= end <= as_of')
                feature.update(overlap_start=start.isoformat(), overlap_end=end.isoformat())
            if key == 'work_overlap' and 'work_context' in f:
                context = f['work_context']
                if not isinstance(context, dict) or set(context) != {'company_size', 'same_function', 'same_location'}:
                    raise ValueError('work_context requires company_size, same_function and same_location')
                factor = work_overlap_value(**context)
                # Keep absent overlap at zero; context cannot create an employment match.
                feature['value'] = min(value, factor)
                feature['work_context'] = dict(context)
            row['features'][key] = feature
        rows.append(row)
    return rows


def rank(data, config=None):
    chosen = weights(config)
    rows = normalize(data)
    for row in rows:
        row['tuned_score'] = number(sum(row['features'][key]['value'] * w for key, w in chosen.items()), 'tuned_score')
        row['ready_for_human_review'] = row['review_status'] == 'ready_for_human_review'
    return sorted(rows, key=lambda r: (-r['tuned_score'], r['connector_name'].casefold(), r['id']))


def render(data, config=None):
    payload = dict(paths=rank(data, config), as_of=data['as_of'], weights=weights(config), defaults=DEFAULT_WEIGHTS, model=MODEL)
    for key in ('requester_name', 'profiles_checked_at', 'baseline_note'):
        if key in data:
            payload[key] = required_text(data[key], key)
    registry = data.get('evidence', [])
    if not isinstance(registry, list):
        raise ValueError('evidence must be a list')
    payload['evidence'] = []
    ids = set()
    for record in registry:
        if not isinstance(record, dict):
            raise ValueError('Each evidence record must be an object')
        clean = {key: required_text(record.get(key), key) for key in ('id', 'source', 'detail', 'observed_at')}
        if exact_date(clean['observed_at'], 'observed_at') > exact_date(data['as_of'], 'as_of'):
            raise ValueError('Evidence observation cannot be after as_of')
        if clean['id'] in ids:
            raise ValueError('Duplicate evidence ID')
        ids.add(clean['id'])
        payload['evidence'].append(clean)
    if 'evidence' in data:
        for row in payload['paths']:
            for feature in row['features'].values():
                if feature['value'] > 0 and any(identifier not in ids for identifier in feature['evidence_ids']):
                    raise ValueError('Positive feature references a missing evidence record')
    research = data.get('target_research', {})
    if not isinstance(research, dict):
        raise ValueError('target_research must be an object')
    payload['target_research'] = {}
    for target_id, records in research.items():
        required_text(target_id, 'target_id')
        if not isinstance(records, list):
            raise ValueError('Target research must be a list')
        cleaned = []
        for record in records:
            if not isinstance(record, dict):
                raise ValueError('Research record must be an object')
            clean = {key: required_text(record.get(key), key) for key in ('label', 'detail', 'source_url', 'observed_at', 'provider')}
            if exact_date(clean['observed_at'], 'observed_at') > exact_date(data['as_of'], 'as_of'):
                raise ValueError('Research observation cannot be after as_of')
            cleaned.append(clean)
        payload['target_research'][target_id] = cleaned
    # Full account lists repeat the same evidence across many candidate pairs.
    # Intern complete feature records without dropping candidates or citations.
    large = len(payload['paths']) > 5000
    if large:
        catalog, index = [], {}
        for row in payload['paths']:
            for key, feature in row['features'].items():
                signature = json.dumps(feature, sort_keys=True, allow_nan=False)
                if signature not in index:
                    index[signature] = len(catalog)
                    catalog.append(feature)
                row['features'][key] = index[signature]
        payload['feature_catalog'] = catalog
    encoded = json.dumps(payload, ensure_ascii=True, allow_nan=False,
                         separators=(',', ':') if large else None).replace('<', '\\u003c').replace('>', '\\u003e').replace('&', '\\u0026')
    return (Path(__file__).resolve().parents[1] / 'assets/tuning.html').read_text().replace('__TUNING_DATA__', encoded)


def main():
    p = argparse.ArgumentParser(description=__doc__)
    p.add_argument('input', type=Path)
    p.add_argument('--output', required=True, type=Path)
    p.add_argument('--weights', type=Path, help='JSON object mapping dimension names to weights')
    a = p.parse_args()
    output = render(json.loads(a.input.read_text()), json.loads(a.weights.read_text()) if a.weights else None)
    with os.fdopen(os.open(a.output, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600), 'w') as f:
        f.write(output)
    print(f'Private local artifact: {a.output.resolve()}')

if __name__ == '__main__':
    main()
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall