Metadata-Version: 2.5
Name: forecast-anything
Version: 0.2.0
Summary: Timestral, from your assistant: local time-series forecasts over MCP, with evidence you can check.
Project-URL: Homepage, https://github.com/francescogabrieli/forecast_anything
Project-URL: Documentation, https://github.com/francescogabrieli/forecast_anything/tree/main/docs
Project-URL: Changelog, https://github.com/francescogabrieli/forecast_anything/blob/main/CHANGELOG.md
Project-URL: Issues, https://github.com/francescogabrieli/forecast_anything/issues
License-Expression: Apache-2.0
License-File: LICENSE
License-File: NOTICE
Keywords: claude,forecasting,mcp,model-context-protocol,time-series,timestral
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Requires-Python: >=3.12
Requires-Dist: fastapi<1,>=0.115
Requires-Dist: numpy<3,>=2
Requires-Dist: pydantic<3,>=2
Requires-Dist: uvicorn<1,>=0.30
Provides-Extra: dev
Requires-Dist: coverage<8,>=7.10; extra == 'dev'
Requires-Dist: httpx<1,>=0.27; extra == 'dev'
Requires-Dist: hypothesis<7,>=6; extra == 'dev'
Requires-Dist: mypy<3,>=1.15; extra == 'dev'
Requires-Dist: pip-audit<3,>=2.9; extra == 'dev'
Requires-Dist: pytest<10,>=8; extra == 'dev'
Requires-Dist: ruff<0.18,>=0.17; extra == 'dev'
Provides-Extra: mcp
Requires-Dist: httpx<1,>=0.27; extra == 'mcp'
Requires-Dist: mcp<3,>=2; extra == 'mcp'
Provides-Extra: statistical
Requires-Dist: statsforecast==2.1.1; extra == 'statistical'
Provides-Extra: timestral
Requires-Dist: huggingface-hub>=0.23; extra == 'timestral'
Requires-Dist: safetensors>=0.4; extra == 'timestral'
Requires-Dist: torch>=2.4; extra == 'timestral'
Description-Content-Type: text/markdown

# Forecast Anything

**Timestral, from your assistant.** Connect a CSV, ask Claude (or another MCP client) for a forecast, and check later whether it was right.

Forecast Anything runs Mistral's [Timestral](docs/implementation/timestral.md) forecasting model locally and exposes it to your assistant over MCP. You talk in plain language; the assistant previews your file, asks what it cannot infer (when each value becomes known, its unit and cadence), and returns a forecast with its uncertainty band and a comparison against a simple baseline. Your data stays on your machine.

### How the code fits together

![Animated floorplan of this repository, stepping through the "Forecast a CSV from your assistant" flow](docs/media/floorplan-map.gif)

The map is generated with [Floorplan](https://github.com/haydenschmitty/floorplan), a Claude Code plugin that draws a codebase as an interactive, plain-English map. The animation follows one request: the assistant asks for a forecast, and it passes through the local API, the data layer, the models and the SQLite ledger.

### Why not just call Timestral from a script?

A script gives you numbers. This gives you numbers you can check:

- **No look-ahead.** Every observation records when it became available, and a forecast only sees what was known at its cutoff.
- **A record you can revisit.** Every forecast is stored immutably with its inputs, model revision and assumptions, so you can score it later against what actually happened.
- **An honest comparison.** Backtests replay past cutoffs and compare Timestral with a seasonal-naive baseline on the same cells, and the report says when there is not enough evidence.
- **No code.** The assistant assembles the requests; the core validates them and computes every number. Model prose is never used as evidence.

### Measured once, on data no decision had seen

On a [pre-registered, single-use holdout](benchmarks/v1-holdout-protocol.md) of four public domains (M5 retail, household electricity, M4 daily macro series and Wikipedia traffic), the automatic model choice was as accurate as the best single Timestral checkpoint: MASE within 0.1% and CRPS within 0.1% in every domain. On the same origins, Timestral 123M had a lower MASE than the seasonal-naive baseline in all four domains (relative MASE 0.57 to 0.81), and its 80% intervals covered 79–84% of outcomes. These numbers describe those frozen origins only. The full results, including where the classical models came close, are in [the results page](benchmarks/v1-holdout-results.md).

### Quick start

```sh
uv tool install "forecast_anything-0.2.0-py3-none-any.whl[mcp]"
forecast-anything setup --client claude-desktop --prepare-model
```

The package is not on PyPI yet, so the first command installs a wheel from a reviewed build (`uv build` in this checkout makes one). Restart Claude Desktop, put a CSV in the `sources` folder of the workspace that `setup` reports, and ask: *"Forecast the next two weeks of this file and tell me how much to trust it."* `--client` also accepts `claude-code`, `codex`, and `none` (prints a config snippet for any other MCP client). On macOS and Linux, `setup` runs the workspace as a login service. The [installation guide](docs/installation.md) covers checksums, updates, removal and running without a service. The [generated reference](docs/reference.md) lists every tool, provider and operator.

**See it on real data.** Replay a daily retail forecast from a public CSV, and reopen the saved question: [real-data demo and 30-second video](docs/real-data-demo.md).

## How it works

```
your assistant  ──MCP (stdio)──▶  local adapter  ──HTTP, loopback──▶  API + worker  ──▶  Timestral on CPU
                                  (computes nothing)                   (SQLite ledger)
```

1. **Preview and confirm a source.** The assistant reads a CSV from a folder you approved and proposes a mapping. You confirm what it cannot know, such as when each value became available. The data is frozen as an immutable snapshot.
2. **Forecast.** The worker runs Timestral and a seasonal-naive baseline on that snapshot. The result carries point forecasts, quantiles, the model revision and every assumption.
3. **Check it.** Replay past cutoffs with a backtest, or score the forecast later against the values that actually arrived. The assistant reports what the core computed, never its own estimate.

The [quickstart](docs/quickstart.md) walks through this journey. The [MCP guide](docs/implementation/mcp.md) covers other clients and the two tool profiles. The default **essential** profile has 13 tools; `--profile full` adds saved questions, recurring watches and raw evidence reads.

## What works today

| Area | Status | Limits |
| --- | --- | --- |
| Assistant over MCP | Claude Desktop, Claude Code and Codex registration; any stdio MCP client by snippet. Tested with the official Python MCP SDK against a real API and worker. | Rendering inside each host varies; see the [compatibility matrix](docs/capabilities.md#compatibility-and-acceptance-matrix). |
| Sources | Local CSV and bounded HTTP JSON, with explicit time, availability, unit, cadence and timezone. | No spreadsheets, databases or pagination yet: these are [good first issues](https://github.com/francescogabrieli/forecast_anything/labels/good%20first%20issue). |
| Forecasting | Timestral 28M (default) or 123M, pinned and local, with point forecasts and quantiles. ETS, Theta, AutoARIMA and seasonal naive as comparators. | CPU only. Weights have their own license (see below). |
| Evidence | Backtests over frozen past cutoffs, later scoring against observed values, immutable records. | Product backtests score MAE. Interval coverage was measured once, on the V1 holdout. |
| Setup | `setup` installs a login service on macOS (LaunchAgent) and Linux (systemd user unit). | Windows is not supported yet: process supervision is POSIX only. |
| Experimental | Joint sample paths for sums and threshold events across a horizon. | Not calibrated; no probability-accuracy claim. |

The [capability matrix](docs/capabilities.md) has the precise boundaries, and the [generated reference](docs/reference.md) lists every tool, provider and operator.

## Documentation

- [Quickstart](docs/quickstart.md) and [installation](docs/installation.md): first forecast, service, updates and removal.
- [MCP guide](docs/implementation/mcp.md): tools, profiles, errors and provider selection.
- [Connectors](docs/connectors.md): mapping a source, availability time and adding a connector.
- [Architecture](docs/implementation/core.md), [API](docs/implementation/api.md) and [operators](docs/implementation/operators.md).
- [Timestral](docs/implementation/timestral.md): pinned revisions, parity check and weights license.
- [Benchmarks](benchmarks/README.md): the development comparison, and the [V1 holdout](benchmarks/v1-holdout-results.md).
- [Roadmap](docs/roadmap.md).

## Contribute

Start with [CONTRIBUTING](CONTRIBUTING.md) and the issues labelled [`good first issue`](https://github.com/francescogabrieli/forecast_anything/labels/good%20first%20issue). `scripts/check.sh` runs every check CI runs. Routine tests need no model weights, network model calls or private data. Report vulnerabilities privately, as described in [SECURITY](SECURITY.md).

## License

Project code is under the [Apache License 2.0](LICENSE). Timestral's weights are licensed separately by Mistral AI under a modified MIT license, which requires a separate license above USD 20 million of global consolidated monthly revenue; `forecast-anything model status` shows the pinned license and its link. [NOTICE](NOTICE) lists the terms for dependencies, datasets and weights.
