Skip to main content

A scientific-method harness for AI-driven ML training: experiment ledger, hypothesis gates, diagnostics, and data-verdict reports over MCP.

Project description

MLLoop

A scientific-method harness for AI-driven machine learning.

Coding agents (Claude Code, opencode, ...) can already write training code and run ten variants overnight. What they don't do by themselves is science: diagnose why a model underperforms, form falsifiable hypotheses, run discriminating experiments, and — when the data itself is the problem — produce evidence strong enough to convince stakeholders.

MLLoop is an MCP server that sits between the agent and your training code and enforces that loop at the tool layer, not via prompts:

  • Experiment ledger — every run, hypothesis, and decision recorded in SQLite plus an append-only JSONL event log, all under .mlloop/ in your project.
  • Hypothesis gaterun_start refuses any experiment that doesn't test a registered, falsifiable hypothesis. No hypothesis, no run.
  • Artifact contract — each run writes standardized predictions.parquet + meta.json; diagnostics never read your training code, so any framework works.
  • Diagnostics battery — after every run: error slices, bootstrap noise floor ("what delta counts as evidence"), confusion/residuals, calibration, the operating curve (overkill vs catch rate, with degenerate-prediction detection), a SHAP explanation of missed positives (are they feature-limited or learnable?), and the overfit gap. Diagnosing the previous run is itself a gate: no diagnosis, no next experiment.
  • Data Verdict Report — when runs stagnate, forensics_run interrogates the dataset with independent probes (shuffled-label signal check, confident-learning label-noise estimation, conflicting-duplicate bound, learning curve, per-feature signal) and report_generate renders a stakeholder-readable HTML verdict: is the ceiling set by the data or by the modeling? Demo: inject 20% label noise into a clean dataset — the report catches it, quantifies it, and lists the suspect rows.
  • Domain contextcontext_register records what columns MEAN in domain terms (learned from dataset docs, domain MCP servers/skills, or the user); error slices and reports become domain-readable, and every report ships a data dictionary.
  • FE-opportunity probefe_probe prices feature engineering before you spend runs on it: screens arithmetic combinations and stacked-model features for incremental signal with a paired, multiple-testing-adjusted significance bar. The probe generates hypotheses; the ledger tests them.
  • Dashboardmlloop dashboard serves a local read-only UI: the iteration tree (nodes colored by improvement vs parent, edges labeled with the driving hypothesis), hypothesis board, metric timeline, per-run diagnosis details, and the verdict viewer — built for the morning-after review of an overnight autonomous session. Auto-refreshes while the agent works.

Status: Phase 2 — ledger, gates, diagnostics, forensics, reports, and dashboard. Full design: DESIGN.md. Agent setup (Claude Code / opencode / Codex): docs/integrations.md.

Quickstart

pip install -e .
cd your-ml-project
mlloop init --agent claude    # or opencode / codex / all — writes the MCP config

Then tell your agent to train a model. The enforced workflow:

Step Tool Gate
1 goal_define Locks dataset, target column, primary metric. Required first.
2 run_start(kind='baseline') First run must be a simple baseline.
3 diagnose_run Every finished run must be diagnosed before the next experiment.
4 hypothesis_register Falsifiable claim about what limits performance, from the diagnosis.
5 run_start(hypothesis_id=...) Refused without a registered hypothesis.
6 run_finish Validates the artifact contract before accepting results.
7 hypothesis_resolve / decision_record Evidence-backed resolution, recorded decisions.
8 forensics_runreport_generate When stagnating: interrogate the data, render the verdict.

status shows the current state and allowed actions at any time; ledger_query restores full context after an agent restart or context compaction.

Contributing

Issues, design feedback, and pull requests are welcome — see CONTRIBUTING.md. Please note the Code of Conduct.

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mlloop-0.0.2.tar.gz (71.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mlloop-0.0.2-py3-none-any.whl (57.6 kB view details)

Uploaded Python 3

File details

Details for the file mlloop-0.0.2.tar.gz.

File metadata

  • Download URL: mlloop-0.0.2.tar.gz
  • Upload date:
  • Size: 71.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mlloop-0.0.2.tar.gz
Algorithm Hash digest
SHA256 b21fdb7f196142faa646df8c29d6600a5d729c5a4ab298d81f7d8fcb83363d6e
MD5 efe335ab26f1334950a9e3dd020723e0
BLAKE2b-256 95f0d32ae4443abd437336aa2ed0249035aacbeaff4231f3c39c4468f75053aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for mlloop-0.0.2.tar.gz:

Publisher: publish.yml on Sin991114/mlloop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mlloop-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: mlloop-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 57.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mlloop-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 65210b7667797607fd06c744b275adafc0caaf514c0b0da35d1c29ff28030306
MD5 550f0b6ec4b3dc3ab0f5b58624e252e6
BLAKE2b-256 9e7c29024df766fc57c45709b1ebe214d83f3be2fad1d0eb671e35f0bdea728a

See more details on using hashes here.

Provenance

The following attestation bundles were made for mlloop-0.0.2-py3-none-any.whl:

Publisher: publish.yml on Sin991114/mlloop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page