Skip to content

dushaobindoudou/prism

Prism

CI Project Health License Node.js pnpm TypeScript Local first

中文文档 · Architecture · Operations · Roadmap

Prism

Prism is a local-first market intelligence and research-control workspace built from social signals, LLM reasoning, market-data verification, and explicit outcome tracking.

It turns noisy public streams into an operator-controlled loop: collect social and market signals, reduce noise with LLM analysis and feedback rules, organize narratives and assets into stable problem domains, discover and cultivate KOLs, draft or publish Twitter/X actions, verify market views against price data, and keep every run, prompt, queue, cooldown, skip, and usage budget visible.

Prism has evolved beyond a Twitter/X collection tool. The product surface now covers three connected loops:

  1. Information loop: collect public data, translate, score, cluster into stable domains/topics, and suppress recurring noise.
  2. Operations loop: discover KOLs, manage engagement, draft comments/posts/quotes, and audit write actions.
  3. Research loop: extract assets and sectors, infer bullish/bearish/neutral views, snapshot prices, generate falsifiable theses, validate outcomes, and track signal/prompt/provider reliability over time.

The current platform capabilities include:

  • Read: collect X/Twitter, KOL, HN, Reddit, and market context.
  • Reduce: translate, summarize, score, cluster, and suppress recurring noise.
  • Discover: extract narratives, assets, sectors, KOL credibility, and cross-source attention flows.
  • Decide: surface topics, stances, signal quality, investment radar views, and operational health.
  • Validate: store price snapshots and compare later moves against earlier model views.
  • Control: record every LLM run in a local research ledger with task, prompt version, objective injection, model, entities, output, error, and outcome links.
  • Act: comment, quote, post, bookmark, scout, follow, cultivate, simulate trades, and optionally mirror tightly capped live trades with guardrails. OpenCLI now works as a profile pool, so read and write actions can be distributed across logged-in local profiles instead of relying on a single browser session.
  • Operate: monitor runs, queues, cooldowns, OpenCLI budgets, failures, and skip reasons.

Prism is not financial advice, not a trading bot, and not a way to bypass platform rules. Investment Radar outputs are research signals only. Users are responsible for data sources, local browser sessions, X/Twitter compliance, market-data licensing, and publishing actions.

Why Prism Exists

Twitter/X is high-entropy by design. Valuable information, low-quality repetition, social pressure, KOL opinions, breaking narratives, and engagement bait arrive in the same feed. Opening every source manually is slow; blindly automating actions is risky.

Prism sits in the middle:

  • It reduces information entropy before content reaches the operator.
  • It keeps Twitter/X actions human-visible and auditable.
  • It separates collection, interpretation, decision, and publishing into clear stages.
  • It turns noise marking into future platform admission rules.
  • It links market narratives to assets, sectors, price snapshots, and later verification.
  • It makes model quality measurable by saving historical views instead of overwriting them.
  • It keeps categories as stable problem domains instead of letting one-off tweets become long-lived taxonomy entries.
  • It injects versioned research objectives by task, so content communication can consume research conclusions without rewriting them.
  • It treats human judgment as the edge: automation may collect, score, translate, cluster, and suggest, but sensitive promotion/research decisions stay human-gated.
  • It exposes operational state so low volume, skipped runs, cooldowns, and failed jobs are diagnosable.
  • It keeps runtime data local by default.

Highlights

  • Local-first SQLite runtime for collected data, preferences, runs, and actions.
  • OpenCLI-backed Twitter/X collection and write-action workflows.
  • LLM-backed translation, interpretation, quality scoring, topic clustering, and noise extraction.
  • Stable coarse category taxonomy for domains such as AI infrastructure, macro liquidity, single-stock research, robotics, crypto market structure, and trading risk control.
  • Research Control ledger for LLM call traces, Objective Registry injection, entity lineage, and outcome metrics.
  • Signal Desk for comment, standalone tweet, and quote tweet operations.
  • Scout workflow for discovering, evaluating, and cultivating KOL candidates.
  • KOL elite suggestions based on recent quality scores; the system never auto-promotes a KOL to elite.
  • Investment Radar for sector/asset classification, directional views, evidence, price snapshots, and historical validation.
  • Investment Theses for falsifiable plans, horizon-aware reviews, entry/exit monitoring, and calibration.
  • Scorecard for prompt/model/KOL/sector/horizon attribution using net PnL and sample-size stage gates.
  • Market Data module with cached quote snapshots, technical indicators, provider priority, token rotation, and fallback behavior.
  • External Trends for cross-source attention from HN, Reddit-adjacent sources, Stocktwits, Yahoo, Wikipedia, Google Trends RSS, and market trend providers.
  • Trade Executor for optional live mirroring behind caps, whitelist/scope gates, kill switch, and emergency close.
  • Noise feedback loop that marks content classes as unwanted before they enter the platform again.
  • Dashboard-first operations: queues, failed jobs, cooldowns, skip reasons, daily OpenCLI usage, and elite usage.
  • HN, Reddit, Twitter/X, and market-data context as complementary public signal sources.
  • Structured open-source documentation for setup, operation, configuration, security, and releases.

Screenshots

Until a public demo dataset exists, avoid publishing screenshots that contain private profiles, local profile IDs, API keys, or collected private data.

Recorded walkthrough:

Planned screenshot set:

  • Twitter/X operations overview
  • Signal Desk publishing workflow
  • Investment Radar sector and asset views
  • Asset prediction history and price verification
  • Runs and queue diagnostics
  • Topic cluster detail
  • Noise marking flow
  • Scout candidate workflow

Quick Start

Requirements

  • Node.js 20+
  • pnpm 9+
  • SQLite is embedded through better-sqlite3; no external database is required.
  • OpenCLI is required for live Twitter/X collection and write actions.
  • An OpenCLI profile pool with valid X/Twitter logins is required for live Twitter/X workflows. A single profile still works, but the current runtime prefers OPENCLI_PROFILES over the legacy singleton setting.
  • An OpenAI-compatible LLM provider is required for translation, scoring, clustering, comment generation, and Signal Desk interpretation.
  • Optional market-data providers are used for Investment Radar quote snapshots and verification. Hyperliquid/trade.xyz style markets are preferred when available; other free providers can be configured as fallbacks.
pnpm install
cp .env.example apps/server/.env

Edit apps/server/.env after copying:

PORT=3001
PRISM_DB_PATH=data/prism.db
OPENCLI_PROFILES=default
OPENCLI_PROFILE=default

LLM_PROVIDER=standard
LLM_MODEL=deepseek-v4-flash
LLM_BASE_URL=https://api.deepseek.com
OPENAI_API_KEY=

# Your own Twitter/X operator account. `@name` and `name` both work.
SCOUT_OWN_USERNAME=@your_username

Run the server and web app:

pnpm dev:server
pnpm dev:web

Default local URLs:

  • Server: http://127.0.0.1:3001
  • Web: http://127.0.0.1:5173

apps/server/.env is loaded from the server package working directory. When using the root scripts above, pnpm runs the server in apps/server, so apps/server/.env is the expected location.

Feature Dependency Matrix

Feature Required configuration Notes
Open the web UI Node.js, pnpm, server running Works without external keys, but data will be empty or limited.
Local SQLite storage PRISM_DB_PATH Defaults to apps/server/data/prism.db when using data/prism.db.
Twitter/X collection OPENCLI_PROFILES with logged-in X sessions Collector rotates through the configured OpenCLI profile pool under a shared governor.
Comment / post / quote actions OPENCLI_PROFILES, valid X sessions, write-action caps Signal Desk and Scout use guarded write actions and persona-aware write identities.
Own post metrics tracking SCOUT_OWN_USERNAME Used to fetch recent posts from your own account and match likes back to recorded actions.
LLM scoring / translation / topic clustering LLM_PROVIDER, provider model/base URL/key as needed Without this, entropy reduction and content generation are limited.
Research Control SQLite, objective YAML files Ledger writes are best-effort; LLM tasks continue if the ledger fails.
Investment Radar LLM config, collected signal data, market-data providers Produces asset/sector views, stores snapshots, and validates against prices.
Market data snapshots Optional provider config and tokens Cached to avoid excessive requests; providers can be prioritized and rotated.
Viewed Twitter marker SQLite only Opening an original tweet marks it viewed; viewed items are visually de-emphasized.
HN / Reddit / market context Optional module config These expand cross-source coverage and are increasingly important to market intelligence.

Without OpenCLI and LLM credentials, live Twitter/X collection, interpretation, and publishing workflows will be limited. A deterministic demo mode is on the roadmap.

Repository Layout

prism/
  apps/
    server/              Fastify server, modules, SQLite runtime
    web/                 React + Vite frontend
  docs/
    zh-CN/               Chinese documentation
    ARCHITECTURE.md      Market intelligence workspace architecture
    OPERATIONS.md        Running and diagnosing Prism operations
    API.md               Current route and module API index
    CONFIGURATION.md     Environment and config reference
    ROADMAP.md           Near and long-term direction
    adr/                 Architecture decision records
  .github/               CI, issue templates, PR template

Architecture

Web App
  |
  v
Fastify API
  |
  +-- collector ------ OpenCLI / X session
  +-- store ---------- SQLite
  +-- content-analyzer / translator / topic-clusterer
  +-- llm / research-control / objective-registry
  +-- signal-desk / scout / trend-monitor
  +-- market-data / external-trends / investment-radar
  +-- investment-theses / paper-trading / trade-executor / scorecard
  +-- hn-collector / reddit-collector / polymarket

Read more:

Historical implementation plans and temporary design notes are not part of the maintained documentation set. Keep durable product, API, architecture, operations, and ADR documents under docs/; keep one-off process notes out of the repository.

Development Commands

pnpm dev:server
pnpm dev:web
pnpm --filter @prism/server typecheck
pnpm --filter @prism/web typecheck
pnpm --filter @prism/server test
pnpm --filter @prism/web build

Operational Model

Prism is designed to run as an operations platform, not a passive feed reader.

The collector tracks:

  • Current state: IDLE, RUNNING, COOLDOWN, LOGIN_REQUIRED
  • Queue counts: pending, processing, retrying, failed
  • Current and previous runs
  • Daily OpenCLI usage and elite usage
  • Cooldown until time
  • Skip reason and detail when a run is skipped

Normal scheduling avoids creating skipped runs: when a run is already active, newly due work is coalesced into the active run and deduplicated.

The Twitter/X operation loop tracks:

  • Which content entered the system and why.
  • Which content was reduced into topics, signals, or noise.
  • Which KOLs are elite, candidates, or under cultivation.
  • Which comments, quote tweets, standalone posts, follows, and likes were attempted.
  • Which actions were blocked by limits, cooldowns, login state, or guardrails.

Configuration

Start from:

cp .env.example apps/server/.env

Important local-only files:

  • apps/server/.env
  • apps/server/config/local.yaml
  • apps/server/data/*
  • logs/*

These files are gitignored and must not be committed.

Important variables:

  • OPENCLI_PROFILES: comma-separated local OpenCLI browser profiles used for Twitter/X reads and writes.
  • OPENCLI_PROFILE: legacy single-profile fallback. Keep it only when you are not using the profile-pool setting yet.
  • OPENAI_API_KEY / LLM_BASE_URL / LLM_MODEL: LLM provider settings for analysis and generation.
  • RESEARCH_OBJECTIVES_DIR: optional override for versioned objective YAML files; defaults to apps/server/config/objectives.
  • SCOUT_OWN_USERNAME: your own Twitter/X username, for example @gmdushuyi; used by action metric tracking and post URL recovery.
  • MARKET_DATA_*: quote cache/provider behavior for Investment Radar and paper-trading valuation.
  • COLLECTOR_*, SCOUT_*, SIGNAL_DESK_*, TOPIC_CLUSTERER_*, TRANSLATOR_*, INVESTMENT_RADAR_*, INVESTMENT_THESES_*: operation limits, cron schedules, cooldowns, and write caps.

The current cost-control posture is to keep TRANSLATOR_ENABLE_CRON, TOPIC_CLUSTERER_ENABLE_CRON, and SIGNAL_DESK_ENABLE_CRON enabled for continuous intake/reduction, while keeping INVESTMENT_RADAR_ENABLE_CRON=false and INVESTMENT_THESES_ENABLE_CRON=false unless the operator explicitly wants automated research generation.

Read the full reference in Configuration or 中文配置指南.

Contributing

Read CONTRIBUTING.md.

Before opening a PR:

pnpm --filter @prism/server typecheck
pnpm --filter @prism/web typecheck
pnpm --filter @prism/server test
pnpm --filter @prism/web build

Security

Read SECURITY.md.

Never publish real API keys, browser profile IDs, cookies, local SQLite data, or collected private data in issues, PRs, logs, or screenshots.

License

Apache-2.0. See LICENSE.

About

Local-first market intelligence and research-control workspace for social signals, LLM reasoning, and market-data verification.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages