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

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
/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 read from the environment and held in memory only. They are never written to disk, logged, printed, included in prompts, or sent to Claude.
  • 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.1.0.tar.gz (50.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.1.0-py3-none-any.whl (41.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xstream_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 50.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.1.0.tar.gz
Algorithm Hash digest
SHA256 9f408e21c411706fcc0f5074966ebf16e1f877ffd46a84b69fe70217d653e3cc
MD5 417fdf683884b176a8a162414506acb3
BLAKE2b-256 ed4b5cfc93b136d35943e8a060ccdb3c21ee2d30b690c26a3484bbd898890a4d

See more details on using hashes here.

Provenance

The following attestation bundles were made for xstream_cli-0.1.0.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.1.0-py3-none-any.whl.

File metadata

  • Download URL: xstream_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 41.0 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a4e50bee40228de903491341c5ee4d28b2601afbb5eea53c79f382658a47de7
MD5 00dded06130411f1c558a28d1d780107
BLAKE2b-256 2c03f3f221df94024bac4eb20e19097d355798d5af38c5780dfc2f36d4e875e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for xstream_cli-0.1.0-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