Skip to main content

XStream

A conversational AI agent for understanding your X feed.

XStream is a terminal application that reads your X (formerly Twitter) home timeline, picks out the posts worth your attention, summarizes them with Claude, and then lets you talk about them.

$ x-stream

╭────────────────────────────────╮
│    XStream                     │
│    Your conversational X agent  │
╰────────────────────────────────╯

✓ Anthropic API configured
✓ X API configured (OAuth 1.0a user context)
✓ X account: @yourhandle

Model: claude-opus-5

Ask about your feed, or type /help for commands.

xstream>

It is a conversational agent first. Reading your feed is the tool it reaches for when the conversation calls for it — ask it what RAG is and it just answers.


Installation

pip install xstream-cli

Requires Python 3.10 or newer. The command it installs is x-stream.

Then run:

x-stream

Configuration

There are two ways to set XStream up. Either works; pick whichever you prefer.

Option 1 — from inside the app (easiest)

Just run it. XStream opens even with nothing configured:

$ x-stream

✗ Anthropic API key not configured
✗ X API credentials not configured

Run /connect to add your credentials, or /help for commands.

xstream> /connect

/connect walks you through each credential, hides your input as you type, verifies the keys against both APIs immediately, and offers to save them to ~/.config/xstream/.env (created with owner-only 600 permissions) so you only do this once. Decline the save and they last for the session only.

You can re-run /connect any time to rotate or add a credential — entering just one value leaves the others untouched.

Option 2 — environment variables

XStream reads its configuration from environment variables. It will also load a .env file if it finds one — first ./.env, then ~/.config/xstream/.env. Real environment variables always take precedence.

Copy .env.example to .env to get started.

Anthropic API key

ANTHROPIC_API_KEY="sk-ant-..."

Create one at https://console.anthropic.com/settings/keys.

X API credentials

XStream never asks for your X password and never sees your X login. It authenticates only with API credentials that you issue yourself in the X developer portal, and it only ever reads.

The default scheme is OAuth 1.0a user context, which needs four values:

X_API_KEY="..."
X_API_SECRET="..."
X_ACCESS_TOKEN="..."
X_ACCESS_TOKEN_SECRET="..."

To get them:

  1. Create a project and an app in the developer portal.
  2. Under User authentication settings, enable OAuth 1.0a with Read permission (Read is all XStream needs).
  3. On the Keys and tokens tab, copy the Consumer Keys into X_API_KEY and X_API_SECRET.
  4. Generate an Access Token and Secret and copy those into X_ACCESS_TOKEN and X_ACCESS_TOKEN_SECRET.

If you change your app's permissions, regenerate the access token — the old one keeps the old permission level.

Alternatively, if you already hold a user access token from the OAuth 2.0 Authorization Code with PKCE flow (scopes tweet.read users.read), you can use that instead of the four values above:

X_OAUTH2_ACCESS_TOKEN="..."

This must be a user token. An app-only bearer token cannot read a home timeline — the endpoint requires user context.

A note on X API access. Reading a home timeline is a paid capability. The free tier does not include timeline reads, so x-stream will report a permissions error from X until your project is on a plan that does. This is an X platform restriction, not an XStream one.

Model selection

XSTREAM_MODEL=claude-opus-5

Available models are listed by the /model command, and can be switched mid-session:

Model Id Notes
Claude Opus 5 claude-opus-5 Default. Best analysis of a busy feed.
Claude Sonnet 5 claude-sonnet-5 Strong quality, lower cost and latency.
Claude Opus 4.8 claude-opus-4-8 Previous-generation Opus.
Claude Haiku 4.5 claude-haiku-4-5 Fastest and cheapest. Terser summaries.

You can also pass --model <id> at launch. Reasoning effort is tunable with XSTREAM_EFFORT (low, medium, high; default medium).


Running

x-stream                      # start a session
x-stream --model claude-sonnet-5
x-stream --debug              # show API detail and stack traces on errors
x-stream --env-file ./prod.env

Commands

Command Description
/help Show available commands
/connect Add or update your Anthropic and X credentials
/feed Retrieve and summarize your feed now
/model Show or change the model (/model claude-sonnet-5)
/clear Clear the current conversation
/config Show configuration status (never shows secrets)
/exit Exit

Natural language is the primary interface — the commands are shortcuts, not the point.

Press Ctrl+C to interrupt a response, Ctrl+D to quit.


Example

xstream> summarize my feed

⠋ Reading your X feed…
✓ Retrieved 87 posts
⠋ Selecting posts…
✓ Selected 10 posts
⠋ Asking Claude…

## Your X Feed

### 1. @simonw

**Summary**
Walks through a failure mode he hit running an agent loop overnight: the
model kept re-reading the same three files because the harness was not
persisting tool results between turns.

**Why it matters**
A concrete, reproducible instance of a context-management bug that is easy to
introduce and hard to notice from the outside.

🔗 https://x.com/simonw/status/...

### 2. @karpathy
...

---

## Common Themes

1. Practical failures in long-running agent harnesses
2. Cost and latency tradeoffs in reasoning models
3. Two separate threads on evaluation being the bottleneck

xstream> What are the three biggest themes?

The strongest thread is agent-harness reliability — #1, #4 and #9 are all
describing variations of the same context-persistence problem...

xstream> Tell me more about #4.

#4 is @amanda's thread on eval design. Her claim is that...

xstream> Compare #2 and #7.

They reach opposite conclusions from similar evidence...

xstream> What is retrieval augmented generation?

Retrieval augmented generation is a pattern where...

xstream> summarize my feed again

⠋ Reading your X feed…

Numeric references (#4) always resolve against the most recent feed XStream retrieved, and follow-up questions are answered from the posts already loaded — no extra API calls.


Current MVP

This version does exactly four things, and tries to do them well:

  1. Reads your X home timeline.
  2. Selects the 10 most relevant posts (recency, engagement, and whether the post carries meaningful text of its own; reposts and duplicates are collapsed).
  3. Summarizes them with Claude.
  4. Lets you have a conversation about them for the rest of the session.

It does not post, like, repost, follow, send DMs, search X, manage bookmarks or lists, run in the background, or remember anything after you exit. Memory is per-session by design.


Security

  • XStream never asks for, stores, or transmits your X password.
  • Credentials are never logged, printed, included in prompts, or sent to Claude.
  • /connect hides input as you type, and keeps it out of your shell history and the in-app command history.
  • The only time credentials touch disk is when you explicitly agree to save them; the file is written atomically with owner-only (600) permissions.
  • Only the post data required for analysis is sent to the Anthropic API.
  • /config reports whether each credential is present, never its value.
  • Error messages are sanitized; --debug adds API detail but never secrets.
  • .env and friends are in .gitignore.

Development

git clone https://github.com/nikhil-kunapareddy/x-stream
cd x-stream
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest

The test suite mocks both the X API and the Anthropic API — running it makes no network calls and needs no credentials.

Layout:

src/xstream/
├── cli.py          # argument parsing, wiring, the session loop
├── config.py       # env loading + the model registry
├── models.py       # Post, PostMetrics, Media, FeedSummary
├── errors.py       # user-facing error types
├── agent/          # agent loop, conversation memory, tools, prompts
├── providers/      # LLMProvider interface + the Anthropic implementation
├── ranking/        # deterministic post selection
├── ui/             # everything the terminal shows
└── x/              # X API auth, client, feed retrieval

Roadmap

Ideas for later, none of them implemented today:

  • A persistent personal profile that learns what you actually find interesting
  • Continuous background monitoring, with proactive "you'll want to see this"
  • Topic and author following, and per-topic digests
  • Threads and quote-post context resolution
  • Delivery beyond the terminal (Slack, email, an API)
  • Additional model providers behind the existing provider interface

License

MIT — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xstream_cli-0.2.1.tar.gz (57.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xstream_cli-0.2.1-py3-none-any.whl (45.1 kB view details)

Uploaded Python 3

File details

Details for the file xstream_cli-0.2.1.tar.gz.

File metadata

  • Download URL: xstream_cli-0.2.1.tar.gz
  • Upload date:
  • Size: 57.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for xstream_cli-0.2.1.tar.gz
Algorithm Hash digest
SHA256 87cd73cd14de3ed1aace0f9316ab0058184dafb97fd498383e353a156d7887b7
MD5 0c2c4c28cf758cf7161fb12b43d18225
BLAKE2b-256 3273910092b72535718acce85a6d874e28a82e93081a7331c99a3dc8b3993943

See more details on using hashes here.

Provenance

The following attestation bundles were made for xstream_cli-0.2.1.tar.gz:

Publisher: release.yml on nikhil-kunapareddy/x-stream

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xstream_cli-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: xstream_cli-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 45.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for xstream_cli-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 82308f2597279d5f5d55f3a54f5831d3e7d9f13062c1493a0175fc5aaa18b8d3
MD5 7761509f85a0af8c5b3dbf0bdb2d3a81
BLAKE2b-256 ebe96ffb0a30683236e05e6e020cf6f6aa4454524680f82117025c035b19d1b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for xstream_cli-0.2.1-py3-none-any.whl:

Publisher: release.yml on nikhil-kunapareddy/x-stream

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page