Skip to main content
Glama
universal-social

universal-social

README.md
# universal-social

A social network with **no website**. Posts from any network are ranked by
the open-source **X algorithm**, every ranking change is in a public
changelog, you drive it through **Grok Bot** (MCP) or a CLI, and the only
public output is **X**, one approved post at a time.

```
 Bluesky ─┐                                   ┌─ why_this (every stage)
 Mastodon ┼─ read-only adapters ─► local DB ─► X-algorithm ranking ─┼─ algo_compare (old vs new weights)
 local ───┘                        (SQLite)    (pinned version)     └─ X queue ─► approve_post ─► X
```

- **X algorithm ranking.** Real weight defaults from
  [xai-org/x-algorithm](https://github.com/xai-org/x-algorithm), versioned per
  upstream commit, with the value model, mutual-follow boost, author diversity
  and out-of-network factor ported from upstream. See
  [docs/RANKING.md](docs/RANKING.md) for what is and is not X's algorithm.
- **Built-in algorithm changelog.** `algo_changelog` lists every ranking
  parameter change (13 versions, Aug 13 to Dec 2, 2026 in the bundled data),
  `pin_version` fixes the version you rank with, and `algo_compare` re-ranks
  your feed under old and new weights. Changelog entries can be queued as X
  posts, like @XAlgoChangelog.
- **Why you saw this.** `why_this` shows the source, every filter, every
  scoring head (prediction × weight = contribution), the multipliers, and the
  final rank.
- **Universal.** An adapter layer in the spirit of
  [universal-adapter](https://github.com/fitzyracing1/universal-adapter): live,
  keyless, read-only adapters for **Bluesky** (public AppView) and
  **Mastodon** (any instance's public API), plus native local posts. An X read
  adapter has its interface in place but is not implemented yet.
- **X is the only output.** `queue_for_x` / `queue_changelog` put text in a
  queue; nothing posts until `approve_post`. Dry-run is the default. Other
  people's posts go out as a short attributed quote with a link to the
  original, never as a copy.
- **No site, by design.** No HTTP server, no ports, no accounts to steal. See
  [SECURITY.md](SECURITY.md) for the threat model, including what remains.
- **Local-only, zero dependencies.** Node.js built-ins only (`node:sqlite`),
  one SQLite file, an append-only hash-chained action log.

## Run it

Needs Node.js 22.13 or newer. No `npm install` needed.

```sh
git clone https://github.com/fitzyracing1/universal-social && cd universal-social
npm run cli -- seed_demo                       # demo users and posts (local)
npm run cli -- ingest --adapter bluesky        # public Bluesky "what's hot"
npm run cli -- ingest --adapter mastodon --tag opensource
npm run cli -- rank_feed --limit 10
npm run cli -- why_this --post_id <id from the feed>
npm run cli -- algo_changelog
npm run cli -- algo_compare --from 47c1bcd
npm test
```

`npm start` runs the MCP server on stdio. To hook it into Grok Bot or another
MCP host, see [docs/GROK-BOT.md](docs/GROK-BOT.md). Data lives in
`~/.universal-social/social.db` (set `US_DATA_DIR` or `US_DB_PATH` to move it).

## MCP tools (also CLI commands)

| Tool | What it does |
|---|---|
| `status` | DB path, owner, pinned version, publisher mode, counts |
| `seed_demo` | Owner + 3 demo users, follows, sample posts |
| `create_user`, `list_users` | Local accounts (no sign-up, no passwords) |
| `list_adapters`, `ingest` | See adapters; pull public posts from Bluesky or Mastodon |
| `compose_post` | Native post or reply; optional `queue_for_x` |
| `follow`, `unfollow`, `mute`, `mute_word` | Social graph and filters (works on imported accounts too) |
| `like`, `repost`, `not_interested` | Local engagement signals |
| `thread` | A post and its replies |
| `rank_feed` | For You feed ranked with the X algorithm |
| `why_this` | Stage-by-stage breakdown for one post |
| `algo_versions`, `algo_changelog` | Known x-algorithm versions and every ranking change |
| `algo_compare` | Same feed under old vs new weights, with rank moves |
| `pin_version` | Choose the version the feed ranks with |
| `queue_for_x`, `queue_changelog` | Add to the X approval queue |
| `list_queue` | Queue by status |
| `approve_post` | Publish one approved item (dry-run unless live is configured) |
| `reject_post` | Reject an item permanently |
| `action_log` | Read and verify the append-only log |

## Posting to X

Publishing is off until **both** are true:

1. `US_X_PUBLISH=live`
2. `X_API_KEY`, `X_API_SECRET`, `X_ACCESS_TOKEN`, `X_ACCESS_TOKEN_SECRET`
   (OAuth 1.0a user context for the account that should post) are set in the
   environment.

Then `approve_post --id N --approved_by "<who>"` sends that one item to
`POST https://api.x.com/2/tweets`. Credentials are read from the environment
at call time and are never stored, logged, or returned.

## Limits

- The predictions the weights multiply are a local heuristic, not X's
  Phoenix model, so the order is "X's weights applied to simple signals", not
  "what X would show you".
- Reading from X is not implemented (it needs a paid API tier).
- Live posting to X is tested only against a fake X API; no real post has
  been made.
- Single machine, single owner. There is no sync between machines.
- Imported posts are snapshots; counts update when you ingest again.

## Credits and license

MIT, Copyright (c) 2026 Joshua Almeida. Ranking parameters and ported
value-model logic come from xai-org/x-algorithm under the Apache License 2.0;
see [NOTICE](NOTICE) and [LICENSES/Apache-2.0.txt](LICENSES/Apache-2.0.txt).
Not affiliated with X Corp. or xAI.

TDQS

B3.2/5.0

Scored across 27 tools

Disambiguation4/5

Most tools target a distinct resource+action: ranking (rank_feed, why_this, algo_compare), adapters (list_adapters, ingest), and the X queue (queue_for_x, approve_post, reject_post, list_queue) are cleanly separated. The main risk is compose_post vs queue_for_x vs repost vs queue_changelog, plus the mute/mute_word/not_interested cluster, but the descriptions explicitly disambiguate each of these.

Naming Consistency3/5

The dominant convention is verb_noun (create_user, list_users, rank_feed, pin_version, approve_post, reject_post, queue_for_x), with a coherent algo_* prefix family. However a substantial minority are bare nouns or unqualified verbs (status, thread, action_log, ingest, follow, mute, like, repost), and the list_ prefix is applied to only two of the four listing tools (list_users, list_adapters, list_queue yes, but algo_versions and status are not list_*).

Tool Count3/5

27 tools exceeds the comfortable range, though the server genuinely spans four sub-domains (local social graph, ingest adapters, X-algorithm ranking, X publishing queue). Several tools are narrow single-purpose probes (status, why_this, algo_versions, algo_changelog, action_log) that push the surface toward heavy without being obviously redundant.

Completeness3/5

The core lifecycle is covered—users, posts, follows, feed ranking, algorithm versioning, and a full queue lifecycle (queue, list, approve, reject)—but notable gaps remain. mute and mute_word have no unmute counterpart, and there is no delete/edit for users or posts, leaving several dead ends an agent cannot undo.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues