* feat(timesfm): GPU/device optimization + ruvector-timesfm integration crate
timesfm:
- cuda/metal features now imply candle (so `--features cuda` alone compiles
the numeric path); add timesfm::select_device() (TIMESFM_DEVICE=cpu|cuda|metal)
and use it in the bench instead of hardcoding Device::Cpu.
- Validated real-weight decode on RTX 5080: 45.2 ms (CPU) -> 3.97 ms (cuda) =
~11.4x, parity preserved (max-abs 8.58e-6). Note: decode at h<=128 is a single
forward pass (horizon_len=128), so KV-cache is a no-op there; GPU/f16 are the
real levers. Derive serde on PruneDecision for the MCP boundary.
ruvector-timesfm (new crate): RuVector-facing integration.
- Forecaster: load-once, forecast(series, horizon) -> point + calibrated p10..p90
quantile bands.
- anomaly: forecast-band detection (flag observed points outside their p10/p90).
- sweep::EarlyStopper: ADR-191 TimesFM-driven early-stopping for ruflo/Darwin
sweeps (wraps prune::decide_prune with min_history + confidence gate).
- ruvector-timesfm-forecast: JSON-in/out CLI = the time_series_forecast MCP tool
entry point.
- telemetry_anomaly example (flags injected spikes on real weights), integration
tests (5 candle + 3 pure-logic, all green; gated/skip without 814MB weights).
clippy --all-targets -D warnings clean (both feature states); fmt clean.
Co-Authored-By: claude-flow <ruv@ruv.net>
* feat(harness): add generated timesfm metaharness bundle (ADR-041)
Authentic output of the agent-harness-generator (create-agent-harness v0.2.7,
kernel 0.1.2) synthesizing an engineering-pod harness for the TimesFM
forecasting crates. Template vertical:coding (the generator's recommended
rust-crate-harness archetype); host claude-code.
- score: scaffoldReady, 6/6 hard constraints, toolSafety 100, compileConfidence 90
- genome: repo_type rust, topology maintainer/tester/security, risk 0.37,
mcp_surface local_default_deny
- witness: .harness/manifest.sha256 over .harness/manifest.json, verified valid
(7c45ab91…). PROVENANCE.md records the repro command, score, genome, witness,
and the link to the time_series_forecast MCP tool (ruvector-timesfm-forecast).
Co-Authored-By: claude-flow <ruv@ruv.net>
* feat(ruvector-timesfm): batched forecasting (throughput path)
Forecaster::forecast_batch forecasts B equal-length series in one model call.
Measured on real weights (B=32, ctx=256, h=64):
- CPU: 27 -> 166 forecasts/s (6.16x), bit-exact vs per-series
- cuda: 244 -> 2078 forecasts/s (8.45x), rel diff 1.7e-4 (GPU reduction order)
Adds the throughput example (sequential vs batched + correctness check with a
relative tolerance for GPU) and a real-model batch-parity integration test.
Co-Authored-By: claude-flow <ruv@ruv.net>
* feat(harness): Darwin evolve via OpenRouter, key sourced from GCP Secret Manager
Adds scripts/evolve-openrouter.{sh,mjs} to optimize the timesfm-harness with
Darwin Mode's OpenRouter LLM mutator (library-only; not CLI-exposed). The
OpenRouter API key is fetched from GCP Secret Manager at runtime
(gcloud secrets versions access OPENROUTER_API_KEY, project cognitum-20260110)
and exported only into the run's process — never stored in the repo/dotfile/logs.
Driver resolves @metaharness/darwin (devDependency) or DARWIN_DIST for local
monorepo runs. Validated: real-sandbox evolve (1 gen x 2 children,
google/gemini-2.5-flash) scored baseline 0.985 with safety 1.0 and zero
secret-exposure flags; ~$0.003. Mutations pass the validateGeneratedCode gate
and only promote on measured improvement. PROVENANCE.md documents usage.
Co-Authored-By: claude-flow <ruv@ruv.net>
* feat(timesfm): int8/int4 weight quantization (QLinear + load_quantized)
Adds QLinear (full-precision or ggml-quantized weight via QMatMul) threaded
through the decoder; PatchedTimeSeriesDecoder::load_quantized(cfg, vb, dtype)
quantizes the 2 ResidualBlocks + 20 transformer layers (embeddings/norms/scaling
stay f32). Exposed as Forecaster::load_quantized(.., Quant::Q8_0|Q4_0).
Measured on real weights (CPU, ctx=512/h=128) — quant is a MEMORY win, not a
CPU-speed win (dequant overhead dominates the small 16-patch matmuls):
f32 : 46 ms 814 MB
Q8_0 : 242 ms ~212 MB (4x smaller) rel err 3.5e-3 (recommended)
Q4_0 : 246 ms ~112 MB (7x smaller) rel err 3.1e-2
All outputs finite. f32 path unchanged (QLinear::Full == prior Linear; parity
still 8.58e-6). quant_bench example + Q8_0 integration test added.
Co-Authored-By: claude-flow <ruv@ruv.net>
* feat(ruvector-timesfm): forecast-driven HNSW rebuild scheduler (vector-db hook)
rebuild module: forecast an index's recall-drift curve with TimesFM and advise
WHEN to rebuild — schedule the rebuild to land just before the conservative
(p10) recall forecast crosses a floor, instead of fixed-schedule or
after-the-fact. Forecaster::advise_rebuild(recall_history, floor, horizon,
lead_steps) -> RebuildAdvice{rebuild_now, steps_until_floor, ...}. Ties into the
ruvector-diskann recall-trigger work. Pure-logic + real-model tests.
Co-Authored-By: claude-flow <ruv@ruv.net>
* feat(timesfm): f16-on-load path (Forecaster::load_f16) + GPU bench
Run the forward in f16 (f16 weights/activations). Three localized dtype fixes
make the path f16-clean (attention mask coerce, decode padding dtype, RevIN
scalar-extraction slices); the f32 path is untouched (parity still 8.583e-6).
Forecaster gains a dtype field + load_f16; forecast/forecast_batch build inputs
in the load dtype and surface f32 to callers.
Measured RTX 5080 (B=32, ctx=256, h=64): batched f32 2082 -> f16 3261
forecasts/s (1.57x), sequential 238 -> 303/s. f16 forecasts within rel 2e-2 of
f32. (CPU f16 is slower, like quant — GPU is where f16 pays off.) f16 + Q8
remain the two precision knobs: f16 for GPU latency, Q8_0 for edge memory.
Co-Authored-By: claude-flow <ruv@ruv.net>
---------
Co-authored-by: ruvnet <ruvnet@gmail.com>