refactor: extract social graph ranking core

This commit is contained in:
Affaan Mustafa
2026-04-02 02:51:24 -07:00
parent 31525854b5
commit bf3fd69d2c
10 changed files with 180 additions and 46 deletions

View File

@@ -42,6 +42,7 @@ If the user does not specify a mode, use `default`.
- `x-api` for X graph inspection and recent activity
- `lead-intelligence` for target discovery and warm-path ranking
- `social-graph-ranker` when the user wants bridge value scored independently of the broader lead workflow
- Exa / deep research for person and company enrichment
- `brand-voice` before drafting outbound
@@ -182,6 +183,7 @@ Drafts
## Related Skills
- `brand-voice` for the reusable voice profile
- `social-graph-ranker` for the standalone bridge-scoring and warm-path math
- `lead-intelligence` for weighted target and warm-path discovery
- `x-api` for X graph access, drafting, and optional apply flows
- `content-engine` when the user also wants public launch content around network moves

View File

@@ -89,11 +89,12 @@ x_search = search_recent_tweets(
For each scored target, analyze the user's social graph to find the warmest path.
### Algorithm
### Ranking Model
1. Pull user's X following list and LinkedIn connections
2. For each high-signal target, check for shared connections
3. Rank mutuals by:
3. Apply the `social-graph-ranker` model to score bridge value
4. Rank mutuals by:
| Factor | Weight |
|--------|--------|
@@ -103,47 +104,20 @@ For each scored target, analyze the user's social graph to find the warmest path
| Industry alignment | 15% — same vertical = natural intro |
| Mutual's X handle / LinkedIn | 10% — identifiability for outreach |
### Weighted Bridge Ranking
Canonical rule:
Treat this as the canonical network-ranking stage for lead intelligence. Do not run a separate graph skill when this stage is enough.
```text
Use social-graph-ranker when the user wants the graph math itself,
the bridge ranking as a standalone report, or explicit decay-model tuning.
```
Given:
- `T` = target leads
- `M` = your mutuals / existing connections
- `d(m, t)` = shortest hop distance from mutual `m` to target `t`
- `w(t)` = target weight from signal scoring
Compute the base bridge score for each mutual:
Inside this skill, use the same weighted bridge model:
```text
B(m) = Σ_{t ∈ T} w(t) · λ^(d(m,t) - 1)
```
Where:
- `λ` is the decay factor, usually `0.5`
- a direct connection contributes full value
- each extra hop halves the contribution
For second-order reach, expand one level into the mutual's own network:
```text
B_ext(m) = B(m) + α · Σ_{m' ∈ N(m) \\ M} Σ_{t ∈ T} w(t) · λ^(d(m',t))
```
Where:
- `N(m) \\ M` is the set of people the mutual knows that you do not
- `α` is the second-order discount, usually `0.3`
Then rank by response-adjusted bridge value:
```text
R(m) = B_ext(m) · (1 + β · engagement(m))
```
Where:
- `engagement(m)` is a normalized responsiveness score
- `β` is the engagement bonus, usually `0.2`
Interpretation:
- Tier 1: high `R(m)` and direct bridge paths -> warm intro asks
- Tier 2: medium `R(m)` and one-hop bridge paths -> conditional intro asks
@@ -152,6 +126,8 @@ Interpretation:
### Output Format
```
If the user explicitly wants the ranking engine broken out, the math visualized, or the network scored outside the full lead workflow, run `social-graph-ranker` as a standalone pass first and feed the result back into this pipeline.
MUTUAL RANKING REPORT
=====================

View File

@@ -0,0 +1,154 @@
---
name: social-graph-ranker
description: Weighted social-graph ranking for warm intro discovery, bridge scoring, and network gap analysis across X and LinkedIn. Use when the user wants the reusable graph-ranking engine itself, not the broader outreach or network-maintenance workflow layered on top of it.
origin: ECC
---
# Social Graph Ranker
Canonical weighted graph-ranking layer for network-aware outreach.
Use this when the user needs to:
- rank existing mutuals or connections by intro value
- map warm paths to a target list
- measure bridge value across first- and second-order connections
- decide which targets deserve warm intros versus direct cold outreach
- understand the graph math independently from `lead-intelligence` or `connections-optimizer`
## When To Use This Standalone
Choose this skill when the user primarily wants the ranking engine:
- "who in my network is best positioned to introduce me?"
- "rank my mutuals by who can get me to these people"
- "map my graph against this ICP"
- "show me the bridge math"
Do not use this by itself when the user really wants:
- full lead generation and outbound sequencing -> use `lead-intelligence`
- pruning, rebalancing, and growing the network -> use `connections-optimizer`
## Inputs
Collect or infer:
- target people, companies, or ICP definition
- the user's current graph on X, LinkedIn, or both
- weighting priorities such as role, industry, geography, and responsiveness
- traversal depth and decay tolerance
## Core Model
Given:
- `T` = weighted target set
- `M` = your current mutuals / direct connections
- `d(m, t)` = shortest hop distance from mutual `m` to target `t`
- `w(t)` = target weight from signal scoring
Base bridge score:
```text
B(m) = Σ_{t ∈ T} w(t) · λ^(d(m,t) - 1)
```
Where:
- `λ` is the decay factor, usually `0.5`
- a direct path contributes full value
- each extra hop halves the contribution
Second-order expansion:
```text
B_ext(m) = B(m) + α · Σ_{m' ∈ N(m) \\ M} Σ_{t ∈ T} w(t) · λ^(d(m',t))
```
Where:
- `N(m) \\ M` is the set of people the mutual knows that you do not
- `α` discounts second-order reach, usually `0.3`
Response-adjusted final ranking:
```text
R(m) = B_ext(m) · (1 + β · engagement(m))
```
Where:
- `engagement(m)` is normalized responsiveness or relationship strength
- `β` is the engagement bonus, usually `0.2`
Interpretation:
- Tier 1: high `R(m)` and direct bridge paths -> warm intro asks
- Tier 2: medium `R(m)` and one-hop bridge paths -> conditional intro asks
- Tier 3: low `R(m)` or no viable bridge -> direct outreach or follow-gap fill
## Scoring Signals
Weight targets before graph traversal with whatever matters for the current priority set:
- role or title alignment
- company or industry fit
- current activity and recency
- geographic relevance
- influence or reach
- likelihood of response
Weight mutuals after traversal with:
- number of weighted paths into the target set
- directness of those paths
- responsiveness or prior interaction history
- contextual fit for making the intro
## Workflow
1. Build the weighted target set.
2. Pull the user's graph from X, LinkedIn, or both.
3. Compute direct bridge scores.
4. Expand second-order candidates for the highest-value mutuals.
5. Rank by `R(m)`.
6. Return:
- best warm intro asks
- conditional bridge paths
- graph gaps where no warm path exists
## Output Shape
```text
SOCIAL GRAPH RANKING
====================
Priority Set:
Platforms:
Decay Model:
Top Bridges
- mutual / connection
base_score:
extended_score:
best_targets:
path_summary:
recommended_action:
Conditional Paths
- mutual / connection
reason:
extra hop cost:
No Warm Path
- target
recommendation: direct outreach / fill graph gap
```
## Related Skills
- `lead-intelligence` uses this ranking model inside the broader target-discovery and outreach pipeline
- `connections-optimizer` uses the same bridge logic when deciding who to keep, prune, or add
- `brand-voice` should run before drafting any intro request or direct outreach
- `x-api` provides X graph access and optional execution paths