Skip to content

PythonLuvr/x-preflight

Repository files navigation

X Pre-flight logo

X Pre-flight

Score X (Twitter) drafts against the documented X algorithm signal weights before you hit Post.

No third-party API key. The extension talks to a local daemon on your own machine, which shells out to the Gemini CLI under your OAuth subscription. Your drafts never touch a server we control.

What it does

Click the Pre-flight button in the X compose toolbar. A side panel opens with:

  • A 0-100 score
  • Ten algorithm dimensions, each with a 0-10 bar and a one-line rationale
  • Three suggested rewrites you can drop into the compose box with one click

Scoring dimensions (weights set in src/lib/scoring.ts, easy to tune):

Dimension Weight What it measures
Reply hook 3.0 Does the post invite a real reply (replies are weighted ~27x a like)
Quote-tweet bait 2.0 Is there a clear stance someone would quote to agree or disagree
Bookmark potential 2.0 Lists, frameworks, how-to material worth saving
Profile-click trigger 2.0 Does it pull a cold reader to your profile (24x weight)
Dwell time 1.5 Substantive enough to read all the way through
Specificity 1.5 Concrete numbers, names, dates over vague claims
Hot-take strength 1.5 Defensible stance vs fence-sitting
Identity pull 1.5 Will readers self-identify and reply or share
Compression 1.0 Every line earns its place
Block risk -3.0 Penalty: does it bait a tribe that will block (block is weighted -150)

Local agent contract

The extension expects a daemon listening on a configurable URL (default http://127.0.0.1:7321) that accepts:

POST /gemini
Authorization: Bearer <your-token>
Content-Type: application/json

{ "prompt": "<scoring prompt>", "model": "flash" | "pro", "timeout_ms": 60000 }

And responds with:

{ "ok": true, "text": "<gemini stdout>", "rateLimited": false, "durationMs": 1234 }

The reference implementation is ej-brain-pc-agent. Any local daemon that satisfies the above contract works. Write your own if you prefer.

Requirements

  • Chrome or Edge (Chromium 116+)
  • Node 20+ (for building from source)
  • A local daemon implementing the POST /gemini contract above
  • The Gemini CLI installed and OAuth-authed under the user the daemon runs as: npm i -g @google/gemini-cli && gemini (run once interactively to sign in)

Install (from source)

git clone https://github.com/PythonLuvr/x-preflight
cd x-preflight
npm install
npm run build

Then in Chrome or Edge:

  1. Open chrome://extensions
  2. Toggle Developer mode on
  3. Click Load unpacked, point at the dist/ folder
  4. Click the extension icon to open settings, paste your daemon URL and bearer token, hit Test connection

Usage

  1. Open X.com, click into the compose box
  2. Type a draft (at least 20 characters)
  3. Trigger Pre-flight by any of:
    • Clicking the extension icon in your browser toolbar
    • Pressing Ctrl+Shift+P (or Cmd+Shift+P on Mac)
    • Clicking the Pre-flight pill in the compose toolbar, if X's current DOM exposes one
  4. Read the breakdown, click Use this on a suggestion, or Re-score after editing
  5. Post

When you're not on x.com, clicking the extension icon opens settings instead.

Privacy

  • Bearer token and settings live in chrome.storage.sync only.
  • Each Pre-flight call is one POST /gemini to your local daemon. No third-party server we control.
  • The extension declares one host_permissions entry: http://127.0.0.1:7321/*. It cannot reach anywhere else on the internet.
  • The repo is MIT. Audit the network calls yourself in src/lib/bridge.ts.

License

MIT. See LICENSE.

About

Score X (Twitter) drafts against the documented X algorithm signal weights before posting. No API key required; routes through a local CLI bridge.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors