Evidence-first discussion intelligence tooling.
Project description
ThreadSense
ThreadSense is an evidence-first discussion intelligence pipeline for turning long community threads into structured, inspectable product intelligence.
The current implementation supports:
- Reddit thread ingestion through the public JSON API
- canonical normalization and persisted artifacts
- deterministic analysis with evidence-linked findings
- optional local-model summary generation through an OpenAI-compatible runtime
- JSON and Markdown report generation
- reproducible batch runs
- a local HTTP API surface
ThreadSense is local-first. It is optimized for operator workflows, replayability, and evidence traceability rather than cloud-first convenience.
Happy Path
Run the full single-thread workflow with one command:
uv run threadsense run reddit <reddit-url> \
[--with-summary] \
[--summary-required] \
[--format markdown|json]
Example:
uv run threadsense run reddit \
"https://www.reddit.com/r/ClaudeCode/comments/1ro0qbl/anyone_actually_built_a_second_brain_that_isnt/" \
--format markdown \
--with-summary \
--summary-required
What It Does
ThreadSense runs a staged pipeline:
- fetch a Reddit thread
- persist the raw artifact
- normalize it into a canonical thread model
- run deterministic analysis
- optionally run local inference for summary synthesis
- persist a JSON or Markdown report
Artifacts remain separate at each stage so the pipeline is inspectable and rerunnable.
Architecture
Core modules:
- src/threadsense/connectors/reddit.py: Reddit ingestion, retries, response validation,
morechildrenexpansion - src/threadsense/models/canonical.py: canonical thread schema
- src/threadsense/pipeline/normalize.py: Reddit-to-canonical normalization
- src/threadsense/pipeline/analyze.py: deterministic analysis baseline
- src/threadsense/inference: local inference contracts, prompts, runtime adapter, and routing
- src/threadsense/reporting: report assembly, rendering, and quality checks
- src/threadsense/workflows.py: shared fetch, normalize, analyze, infer, and report execution
- src/threadsense/batching.py: batch manifests and bounded parallel runs
- src/threadsense/api_server.py: local HTTP surface
Supporting docs:
- docs/overview.md
- docs/system-design.md
- docs/local-runtime-contract.md
- docs/batch-api-runtime.md
- .docs/2026-04-04-system-enhancement-analysis.md
Requirements
- Python
>=3.11 uv- optional local OpenAI-compatible runtime at
http://127.0.0.1:8080/v1/chat/completions
Installation
uv sync
Run the CLI through uv:
uv run threadsense --help
Quickstart
1. Validate local setup
uv run threadsense preflight
Skip runtime probing if you only want config validation:
uv run threadsense preflight --skip-runtime
2. Run the full workflow
uv run threadsense run reddit \
"https://www.reddit.com/r/ClaudeCode/comments/1ro0qbl/anyone_actually_built_a_second_brain_that_isnt/" \
--format markdown
The command prints one JSON payload containing the stage outputs and final artifact paths.
Use --with-summary --summary-required if you want the final report to require a live local-model summary.
Usage Reference
For the detailed command-by-command reference, including:
preflightfetchnormalizeanalyzeinferreportinspectbatch runserverun reddit
see docs/usage.md.
Configuration
Default config file:
Important sections:
[runtime]: local inference backend URL, path, model, timeout, repair retries[reddit]: user agent, timeout, retries, backoff, request delay, listing limit[storage]: raw, normalized, analysis, report, and batch directories[batch]: worker count, max jobs, fail-fast behavior[api]: host, port, request size limit[limits]: runtime concurrency guard
Common environment overrides:
THREADSENSE_RUNTIME_ENABLEDTHREADSENSE_RUNTIME_BASE_URLTHREADSENSE_RUNTIME_CHAT_PATHTHREADSENSE_RUNTIME_MODELTHREADSENSE_REDDIT_TIMEOUTTHREADSENSE_REDDIT_REQUEST_DELAYTHREADSENSE_STORAGE_ROOTTHREADSENSE_BATCH_MAX_WORKERSTHREADSENSE_BATCH_MAX_JOBSTHREADSENSE_API_PORTTHREADSENSE_RUNTIME_CONCURRENCY
Artifact Layout
Default storage root:
.threadsense
Default structure:
.threadsense/raw/reddit/<thread-id>.json.threadsense/normalized/reddit/<thread-id>.json.threadsense/analysis/reddit/<thread-id>.json.threadsense/reports/reddit/<thread-id>.json.threadsense/reports/reddit/<thread-id>.md.threadsense/batches/<run-name>.json
Local Runtime Contract
ThreadSense expects a local OpenAI-compatible chat completion endpoint.
Default target:
- base URL:
http://127.0.0.1:8080 - chat path:
/v1/chat/completions - resolved endpoint:
http://127.0.0.1:8080/v1/chat/completions
The local runtime contract is documented in docs/local-runtime-contract.md.
Validation
Run the full local validation stack:
uv run ruff check
uv run ruff format --check .
uv run mypy --strict src tests
uv run pytest
./scripts/validate.sh
Tests
The repo includes:
- unit tests for config, connectors, normalization, analysis, inference, reporting, observability, batching, and API validation
- integration tests for fetch, normalization, inference, reporting, batch runs, and API workflows
- fixture-backed Reddit payloads and replay manifests under tests/fixtures
Current Limits
The current system is intentionally constrained:
- only Reddit is implemented as a source
- analysis is still a deterministic heuristic baseline
- the main product unit is still a single thread or local batch run
- the API is local-first and not hardened for untrusted callers
- report presentation is Markdown and JSON, not yet an interactive HTML review surface
Roadmap Direction
The completed phased plan established the system backbone. The next high-value areas are:
- claim-level evidence attribution
- evaluation and replay benchmarking
- corpus-level analysis across threads
- better decision-oriented report presentation
- stronger onboarding and developer ergonomics
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file threadsense-0.1.0a0.tar.gz.
File metadata
- Download URL: threadsense-0.1.0a0.tar.gz
- Upload date:
- Size: 84.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dfb6ed54e3254a1d63687cf5f8a29689ffd96c01b68fc23f95463a47060f60ad
|
|
| MD5 |
2b1ad30c0b61dfea1d77054e5efad6b0
|
|
| BLAKE2b-256 |
f937a22219968cab5da6ab56ccafd48907be936191bff7b451878f7779805289
|
File details
Details for the file threadsense-0.1.0a0-py3-none-any.whl.
File metadata
- Download URL: threadsense-0.1.0a0-py3-none-any.whl
- Upload date:
- Size: 52.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26cea5bda5c4c2f4d2a67d28f83897d2c5445d4f158d732e313ffa37e2e72ca6
|
|
| MD5 |
562e9fb631ef96922f66503f8375e0c4
|
|
| BLAKE2b-256 |
5baa9ffe1467fb11ccdae096bf2c975523b6ba655e8c0495fa3756eeeb40f778
|