threadsense 0.1.0a0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. threadsense-0.1.0a0/.gitignore +220 -0
  2. threadsense-0.1.0a0/LICENSE +21 -0
  3. threadsense-0.1.0a0/PKG-INFO +258 -0
  4. threadsense-0.1.0a0/README.md +228 -0
  5. threadsense-0.1.0a0/docs/batch-api-runtime.md +97 -0
  6. threadsense-0.1.0a0/docs/local-runtime-contract.md +103 -0
  7. threadsense-0.1.0a0/docs/overview.md +377 -0
  8. threadsense-0.1.0a0/docs/pitch.md +135 -0
  9. threadsense-0.1.0a0/docs/system-design.md +629 -0
  10. threadsense-0.1.0a0/docs/usage.md +294 -0
  11. threadsense-0.1.0a0/pyproject.toml +50 -0
  12. threadsense-0.1.0a0/scripts/validate.sh +7 -0
  13. threadsense-0.1.0a0/src/threadsense/__init__.py +5 -0
  14. threadsense-0.1.0a0/src/threadsense/__main__.py +6 -0
  15. threadsense-0.1.0a0/src/threadsense/api_server.py +246 -0
  16. threadsense-0.1.0a0/src/threadsense/batching.py +306 -0
  17. threadsense-0.1.0a0/src/threadsense/cli.py +718 -0
  18. threadsense-0.1.0a0/src/threadsense/cli_display.py +91 -0
  19. threadsense-0.1.0a0/src/threadsense/config.py +580 -0
  20. threadsense-0.1.0a0/src/threadsense/connectors/__init__.py +1 -0
  21. threadsense-0.1.0a0/src/threadsense/connectors/reddit.py +426 -0
  22. threadsense-0.1.0a0/src/threadsense/errors.py +80 -0
  23. threadsense-0.1.0a0/src/threadsense/inference/__init__.py +20 -0
  24. threadsense-0.1.0a0/src/threadsense/inference/contracts.py +151 -0
  25. threadsense-0.1.0a0/src/threadsense/inference/local_runtime.py +282 -0
  26. threadsense-0.1.0a0/src/threadsense/inference/prompts.py +153 -0
  27. threadsense-0.1.0a0/src/threadsense/inference/router.py +115 -0
  28. threadsense-0.1.0a0/src/threadsense/logging_config.py +34 -0
  29. threadsense-0.1.0a0/src/threadsense/models/__init__.py +59 -0
  30. threadsense-0.1.0a0/src/threadsense/models/analysis.py +229 -0
  31. threadsense-0.1.0a0/src/threadsense/models/canonical.py +217 -0
  32. threadsense-0.1.0a0/src/threadsense/models/report.py +211 -0
  33. threadsense-0.1.0a0/src/threadsense/observability.py +180 -0
  34. threadsense-0.1.0a0/src/threadsense/pipeline/__init__.py +33 -0
  35. threadsense-0.1.0a0/src/threadsense/pipeline/analyze.py +369 -0
  36. threadsense-0.1.0a0/src/threadsense/pipeline/normalize.py +177 -0
  37. threadsense-0.1.0a0/src/threadsense/pipeline/storage.py +107 -0
  38. threadsense-0.1.0a0/src/threadsense/reporting/__init__.py +12 -0
  39. threadsense-0.1.0a0/src/threadsense/reporting/build.py +123 -0
  40. threadsense-0.1.0a0/src/threadsense/reporting/quality.py +91 -0
  41. threadsense-0.1.0a0/src/threadsense/reporting/render.py +58 -0
  42. threadsense-0.1.0a0/src/threadsense/workflows.py +352 -0
  43. threadsense-0.1.0a0/tests/fixtures/README.md +9 -0
  44. threadsense-0.1.0a0/tests/fixtures/analysis/canonical_feedback_thread.json +129 -0
  45. threadsense-0.1.0a0/tests/fixtures/batch/reddit_manifest.json +27 -0
  46. threadsense-0.1.0a0/tests/fixtures/inference/analysis_summary_invalid_response.json +21 -0
  47. threadsense-0.1.0a0/tests/fixtures/inference/analysis_summary_response.json +21 -0
  48. threadsense-0.1.0a0/tests/fixtures/inference/chat_completion_request.json +15 -0
  49. threadsense-0.1.0a0/tests/fixtures/inference/chat_completion_response.json +21 -0
  50. threadsense-0.1.0a0/tests/fixtures/normalized/.gitkeep +1 -0
  51. threadsense-0.1.0a0/tests/fixtures/reddit/raw/.gitkeep +1 -0
  52. threadsense-0.1.0a0/tests/fixtures/reddit/raw/deleted_thread.json +51 -0
  53. threadsense-0.1.0a0/tests/fixtures/reddit/raw/large_thread.json +44 -0
  54. threadsense-0.1.0a0/tests/fixtures/reddit/raw/morechildren_response.json +34 -0
  55. threadsense-0.1.0a0/tests/fixtures/reddit/raw/normal_thread.json +69 -0
  56. threadsense-0.1.0a0/tests/fixtures/reddit/raw/removed_thread.json +51 -0
  57. threadsense-0.1.0a0/tests/integration/test_batch_api.py +219 -0
  58. threadsense-0.1.0a0/tests/integration/test_bootstrap.py +10 -0
  59. threadsense-0.1.0a0/tests/integration/test_canonical_persistence.py +203 -0
  60. threadsense-0.1.0a0/tests/integration/test_local_inference.py +149 -0
  61. threadsense-0.1.0a0/tests/integration/test_preflight.py +79 -0
  62. threadsense-0.1.0a0/tests/integration/test_reddit_fetch.py +128 -0
  63. threadsense-0.1.0a0/tests/integration/test_reporting.py +295 -0
  64. threadsense-0.1.0a0/tests/unit/test_analysis_pipeline.py +123 -0
  65. threadsense-0.1.0a0/tests/unit/test_api_server.py +44 -0
  66. threadsense-0.1.0a0/tests/unit/test_batching.py +68 -0
  67. threadsense-0.1.0a0/tests/unit/test_canonical_models.py +86 -0
  68. threadsense-0.1.0a0/tests/unit/test_cli.py +117 -0
  69. threadsense-0.1.0a0/tests/unit/test_config.py +137 -0
  70. threadsense-0.1.0a0/tests/unit/test_errors.py +15 -0
  71. threadsense-0.1.0a0/tests/unit/test_inference_router.py +99 -0
  72. threadsense-0.1.0a0/tests/unit/test_local_runtime.py +135 -0
  73. threadsense-0.1.0a0/tests/unit/test_normalize_pipeline.py +65 -0
  74. threadsense-0.1.0a0/tests/unit/test_observability.py +35 -0
  75. threadsense-0.1.0a0/tests/unit/test_reddit_connector.py +155 -0
  76. threadsense-0.1.0a0/tests/unit/test_report_rendering.py +84 -0
  77. threadsense-0.1.0a0/threadsense.toml +43 -0
  78. threadsense-0.1.0a0/uv.lock +298 -0
@@ -0,0 +1,220 @@
1
+ # macOS
2
+ .DS_Store
3
+
4
+ # Byte-compiled / optimized / DLL files
5
+ __pycache__/
6
+ *.py[codz]
7
+ *$py.class
8
+
9
+ # C extensions
10
+ *.so
11
+
12
+ # Distribution / packaging
13
+ .Python
14
+ build/
15
+ develop-eggs/
16
+ dist/
17
+ downloads/
18
+ eggs/
19
+ .eggs/
20
+ lib/
21
+ lib64/
22
+ parts/
23
+ sdist/
24
+ var/
25
+ wheels/
26
+ share/python-wheels/
27
+ *.egg-info/
28
+ .installed.cfg
29
+ *.egg
30
+ MANIFEST
31
+
32
+ # PyInstaller
33
+ # Usually these files are written by a python script from a template
34
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
35
+ *.manifest
36
+ *.spec
37
+
38
+ # Installer logs
39
+ pip-log.txt
40
+ pip-delete-this-directory.txt
41
+
42
+ # Unit test / coverage reports
43
+ htmlcov/
44
+ .tox/
45
+ .nox/
46
+ .coverage
47
+ .coverage.*
48
+ .cache
49
+ nosetests.xml
50
+ coverage.xml
51
+ *.cover
52
+ *.py.cover
53
+ .hypothesis/
54
+ .pytest_cache/
55
+ cover/
56
+
57
+ # Translations
58
+ *.mo
59
+ *.pot
60
+
61
+ # Django stuff:
62
+ *.log
63
+ local_settings.py
64
+ db.sqlite3
65
+ db.sqlite3-journal
66
+
67
+ # Flask stuff:
68
+ instance/
69
+ .webassets-cache
70
+
71
+ # Scrapy stuff:
72
+ .scrapy
73
+
74
+ # Sphinx documentation
75
+ docs/_build/
76
+
77
+ # PyBuilder
78
+ .pybuilder/
79
+ target/
80
+
81
+ # Jupyter Notebook
82
+ .ipynb_checkpoints
83
+
84
+ # IPython
85
+ profile_default/
86
+ ipython_config.py
87
+
88
+ # pyenv
89
+ # For a library or package, you might want to ignore these files since the code is
90
+ # intended to run in multiple environments; otherwise, check them in:
91
+ # .python-version
92
+
93
+ # pipenv
94
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
95
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
96
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
97
+ # install all needed dependencies.
98
+ #Pipfile.lock
99
+
100
+ # UV
101
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
102
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
103
+ # commonly ignored for libraries.
104
+ #uv.lock
105
+
106
+ # poetry
107
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
108
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
109
+ # commonly ignored for libraries.
110
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
111
+ #poetry.lock
112
+ #poetry.toml
113
+
114
+ # pdm
115
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
116
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
117
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
118
+ #pdm.lock
119
+ #pdm.toml
120
+ .pdm-python
121
+ .pdm-build/
122
+
123
+ # pixi
124
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
125
+ #pixi.lock
126
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
127
+ # in the .venv directory. It is recommended not to include this directory in version control.
128
+ .pixi
129
+
130
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
131
+ __pypackages__/
132
+
133
+ # Celery stuff
134
+ celerybeat-schedule
135
+ celerybeat.pid
136
+
137
+ # SageMath parsed files
138
+ *.sage.py
139
+
140
+ # Environments
141
+ .env
142
+ .envrc
143
+ .venv
144
+ env/
145
+ venv/
146
+ ENV/
147
+ env.bak/
148
+ venv.bak/
149
+
150
+ # Spyder project settings
151
+ .spyderproject
152
+ .spyproject
153
+
154
+ # Rope project settings
155
+ .ropeproject
156
+
157
+ # mkdocs documentation
158
+ /site
159
+
160
+ # mypy
161
+ .mypy_cache/
162
+ .dmypy.json
163
+ dmypy.json
164
+
165
+ # Pyre type checker
166
+ .pyre/
167
+
168
+ # pytype static type analyzer
169
+ .pytype/
170
+
171
+ # Cython debug symbols
172
+ cython_debug/
173
+
174
+ # PyCharm
175
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
176
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
177
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
178
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
179
+ #.idea/
180
+
181
+ # Abstra
182
+ # Abstra is an AI-powered process automation framework.
183
+ # Ignore directories containing user credentials, local state, and settings.
184
+ # Learn more at https://abstra.io/docs
185
+ .abstra/
186
+
187
+ # Visual Studio Code
188
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
189
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
190
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
191
+ # you could uncomment the following to ignore the entire vscode folder
192
+ # .vscode/
193
+
194
+ # Ruff stuff:
195
+ .ruff_cache/
196
+
197
+ # PyPI configuration file
198
+ .pypirc
199
+
200
+ # Cursor
201
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
202
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
203
+ # refer to https://docs.cursor.com/context/ignore-files
204
+ .cursorignore
205
+ .cursorindexingignore
206
+
207
+ # Marimo
208
+ marimo/_static/
209
+ marimo/_lsp/
210
+ __marimo__/
211
+
212
+ # Agentic Systems
213
+ .agent
214
+ .claude/
215
+ .gemini
216
+ .opencode/
217
+
218
+ # Developer workspace
219
+ .docs/
220
+ .threadsense/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tom Mathews
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,258 @@
1
+ Metadata-Version: 2.4
2
+ Name: threadsense
3
+ Version: 0.1.0a0
4
+ Summary: Evidence-first discussion intelligence tooling.
5
+ License: MIT License
6
+
7
+ Copyright (c) 2026 Tom Mathews
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+ License-File: LICENSE
27
+ Requires-Python: >=3.11
28
+ Requires-Dist: rich>=14.3.3
29
+ Description-Content-Type: text/markdown
30
+
31
+ # ThreadSense
32
+
33
+ ThreadSense is an evidence-first discussion intelligence pipeline for turning long community threads into structured, inspectable product intelligence.
34
+
35
+ The current implementation supports:
36
+
37
+ - Reddit thread ingestion through the public JSON API
38
+ - canonical normalization and persisted artifacts
39
+ - deterministic analysis with evidence-linked findings
40
+ - optional local-model summary generation through an OpenAI-compatible runtime
41
+ - JSON and Markdown report generation
42
+ - reproducible batch runs
43
+ - a local HTTP API surface
44
+
45
+ ThreadSense is local-first. It is optimized for operator workflows, replayability, and evidence traceability rather than cloud-first convenience.
46
+
47
+ ## Happy Path
48
+
49
+ Run the full single-thread workflow with one command:
50
+
51
+ ```bash
52
+ uv run threadsense run reddit <reddit-url> \
53
+ [--with-summary] \
54
+ [--summary-required] \
55
+ [--format markdown|json]
56
+ ```
57
+
58
+ Example:
59
+
60
+ ```bash
61
+ uv run threadsense run reddit \
62
+ "https://www.reddit.com/r/ClaudeCode/comments/1ro0qbl/anyone_actually_built_a_second_brain_that_isnt/" \
63
+ --format markdown \
64
+ --with-summary \
65
+ --summary-required
66
+ ```
67
+
68
+ ## What It Does
69
+
70
+ ThreadSense runs a staged pipeline:
71
+
72
+ 1. fetch a Reddit thread
73
+ 2. persist the raw artifact
74
+ 3. normalize it into a canonical thread model
75
+ 4. run deterministic analysis
76
+ 5. optionally run local inference for summary synthesis
77
+ 6. persist a JSON or Markdown report
78
+
79
+ Artifacts remain separate at each stage so the pipeline is inspectable and rerunnable.
80
+
81
+ ## Architecture
82
+
83
+ Core modules:
84
+
85
+ - [src/threadsense/connectors/reddit.py](/Users/druk/WorkSpace/AetherForge/ThreadSense/src/threadsense/connectors/reddit.py): Reddit ingestion, retries, response validation, `morechildren` expansion
86
+ - [src/threadsense/models/canonical.py](/Users/druk/WorkSpace/AetherForge/ThreadSense/src/threadsense/models/canonical.py): canonical thread schema
87
+ - [src/threadsense/pipeline/normalize.py](/Users/druk/WorkSpace/AetherForge/ThreadSense/src/threadsense/pipeline/normalize.py): Reddit-to-canonical normalization
88
+ - [src/threadsense/pipeline/analyze.py](/Users/druk/WorkSpace/AetherForge/ThreadSense/src/threadsense/pipeline/analyze.py): deterministic analysis baseline
89
+ - [src/threadsense/inference](/Users/druk/WorkSpace/AetherForge/ThreadSense/src/threadsense/inference): local inference contracts, prompts, runtime adapter, and routing
90
+ - [src/threadsense/reporting](/Users/druk/WorkSpace/AetherForge/ThreadSense/src/threadsense/reporting): report assembly, rendering, and quality checks
91
+ - [src/threadsense/workflows.py](/Users/druk/WorkSpace/AetherForge/ThreadSense/src/threadsense/workflows.py): shared fetch, normalize, analyze, infer, and report execution
92
+ - [src/threadsense/batching.py](/Users/druk/WorkSpace/AetherForge/ThreadSense/src/threadsense/batching.py): batch manifests and bounded parallel runs
93
+ - [src/threadsense/api_server.py](/Users/druk/WorkSpace/AetherForge/ThreadSense/src/threadsense/api_server.py): local HTTP surface
94
+
95
+ Supporting docs:
96
+
97
+ - [docs/overview.md](/Users/druk/WorkSpace/AetherForge/ThreadSense/docs/overview.md)
98
+ - [docs/system-design.md](/Users/druk/WorkSpace/AetherForge/ThreadSense/docs/system-design.md)
99
+ - [docs/local-runtime-contract.md](/Users/druk/WorkSpace/AetherForge/ThreadSense/docs/local-runtime-contract.md)
100
+ - [docs/batch-api-runtime.md](/Users/druk/WorkSpace/AetherForge/ThreadSense/docs/batch-api-runtime.md)
101
+ - [.docs/2026-04-04-system-enhancement-analysis.md](/Users/druk/WorkSpace/AetherForge/ThreadSense/.docs/2026-04-04-system-enhancement-analysis.md)
102
+
103
+ ## Requirements
104
+
105
+ - Python `>=3.11`
106
+ - `uv`
107
+ - optional local OpenAI-compatible runtime at `http://127.0.0.1:8080/v1/chat/completions`
108
+
109
+ ## Installation
110
+
111
+ ```bash
112
+ uv sync
113
+ ```
114
+
115
+ Run the CLI through `uv`:
116
+
117
+ ```bash
118
+ uv run threadsense --help
119
+ ```
120
+
121
+ ## Quickstart
122
+
123
+ ### 1. Validate local setup
124
+
125
+ ```bash
126
+ uv run threadsense preflight
127
+ ```
128
+
129
+ Skip runtime probing if you only want config validation:
130
+
131
+ ```bash
132
+ uv run threadsense preflight --skip-runtime
133
+ ```
134
+
135
+ ### 2. Run the full workflow
136
+
137
+ ```bash
138
+ uv run threadsense run reddit \
139
+ "https://www.reddit.com/r/ClaudeCode/comments/1ro0qbl/anyone_actually_built_a_second_brain_that_isnt/" \
140
+ --format markdown
141
+ ```
142
+
143
+ The command prints one JSON payload containing the stage outputs and final artifact paths.
144
+
145
+ Use `--with-summary --summary-required` if you want the final report to require a live local-model summary.
146
+
147
+ ## Usage Reference
148
+
149
+ For the detailed command-by-command reference, including:
150
+
151
+ - `preflight`
152
+ - `fetch`
153
+ - `normalize`
154
+ - `analyze`
155
+ - `infer`
156
+ - `report`
157
+ - `inspect`
158
+ - `batch run`
159
+ - `serve`
160
+ - `run reddit`
161
+
162
+ see [docs/usage.md](/Users/druk/WorkSpace/AetherForge/ThreadSense/docs/usage.md).
163
+
164
+ ## Configuration
165
+
166
+ Default config file:
167
+
168
+ - [threadsense.toml](/Users/druk/WorkSpace/AetherForge/ThreadSense/threadsense.toml)
169
+
170
+ Important sections:
171
+
172
+ - `[runtime]`: local inference backend URL, path, model, timeout, repair retries
173
+ - `[reddit]`: user agent, timeout, retries, backoff, request delay, listing limit
174
+ - `[storage]`: raw, normalized, analysis, report, and batch directories
175
+ - `[batch]`: worker count, max jobs, fail-fast behavior
176
+ - `[api]`: host, port, request size limit
177
+ - `[limits]`: runtime concurrency guard
178
+
179
+ Common environment overrides:
180
+
181
+ - `THREADSENSE_RUNTIME_ENABLED`
182
+ - `THREADSENSE_RUNTIME_BASE_URL`
183
+ - `THREADSENSE_RUNTIME_CHAT_PATH`
184
+ - `THREADSENSE_RUNTIME_MODEL`
185
+ - `THREADSENSE_REDDIT_TIMEOUT`
186
+ - `THREADSENSE_REDDIT_REQUEST_DELAY`
187
+ - `THREADSENSE_STORAGE_ROOT`
188
+ - `THREADSENSE_BATCH_MAX_WORKERS`
189
+ - `THREADSENSE_BATCH_MAX_JOBS`
190
+ - `THREADSENSE_API_PORT`
191
+ - `THREADSENSE_RUNTIME_CONCURRENCY`
192
+
193
+ ## Artifact Layout
194
+
195
+ Default storage root:
196
+
197
+ - `.threadsense`
198
+
199
+ Default structure:
200
+
201
+ - `.threadsense/raw/reddit/<thread-id>.json`
202
+ - `.threadsense/normalized/reddit/<thread-id>.json`
203
+ - `.threadsense/analysis/reddit/<thread-id>.json`
204
+ - `.threadsense/reports/reddit/<thread-id>.json`
205
+ - `.threadsense/reports/reddit/<thread-id>.md`
206
+ - `.threadsense/batches/<run-name>.json`
207
+
208
+ ## Local Runtime Contract
209
+
210
+ ThreadSense expects a local OpenAI-compatible chat completion endpoint.
211
+
212
+ Default target:
213
+
214
+ - base URL: `http://127.0.0.1:8080`
215
+ - chat path: `/v1/chat/completions`
216
+ - resolved endpoint: `http://127.0.0.1:8080/v1/chat/completions`
217
+
218
+ The local runtime contract is documented in [docs/local-runtime-contract.md](/Users/druk/WorkSpace/AetherForge/ThreadSense/docs/local-runtime-contract.md).
219
+
220
+ ## Validation
221
+
222
+ Run the full local validation stack:
223
+
224
+ ```bash
225
+ uv run ruff check
226
+ uv run ruff format --check .
227
+ uv run mypy --strict src tests
228
+ uv run pytest
229
+ ./scripts/validate.sh
230
+ ```
231
+
232
+ ## Tests
233
+
234
+ The repo includes:
235
+
236
+ - unit tests for config, connectors, normalization, analysis, inference, reporting, observability, batching, and API validation
237
+ - integration tests for fetch, normalization, inference, reporting, batch runs, and API workflows
238
+ - fixture-backed Reddit payloads and replay manifests under [tests/fixtures](/Users/druk/WorkSpace/AetherForge/ThreadSense/tests/fixtures)
239
+
240
+ ## Current Limits
241
+
242
+ The current system is intentionally constrained:
243
+
244
+ - only Reddit is implemented as a source
245
+ - analysis is still a deterministic heuristic baseline
246
+ - the main product unit is still a single thread or local batch run
247
+ - the API is local-first and not hardened for untrusted callers
248
+ - report presentation is Markdown and JSON, not yet an interactive HTML review surface
249
+
250
+ ## Roadmap Direction
251
+
252
+ The completed phased plan established the system backbone. The next high-value areas are:
253
+
254
+ - claim-level evidence attribution
255
+ - evaluation and replay benchmarking
256
+ - corpus-level analysis across threads
257
+ - better decision-oriented report presentation
258
+ - stronger onboarding and developer ergonomics