Skip to main content

Experiment logbook pipeline: automatic per-run capture + on-demand reporting

Project description

multimodal-mllog

Python License: MIT

Experiment logbook pipeline for researchers training ML models with coding agents.

An external observer that automatically captures per-run facts (agent events, git state, optional MLflow info) as JSON records via a sensor/adapter/sink architecture, and on demand renders a markdown logbook from them.

coding agent  -->  mllog capture (automatic via hook)  -->  local JSON store
researcher    -->  /logbook (manual)                    -->  markdown logbook

Architecture

sensors (data producers) --> core (deterministic) --> sinks (optional side effects)

  Sensors:   agent (always), git, env, mlflow (optional)
  Adapters:  Claude Code JSONL --> AgentEvent normal form
  Core:      validate, store (fsync), query, project to markdown
  Sinks:     mlflow_attach (runs after write+fsync, failures warn)

Record envelope (./mllog/records/<YYYY-MM-DD>/<record_id>.json):

{
  "schema_version": "0.1",
  "record_id": "<ULID>",
  "activity_type": "train | eval | analysis | attempt_failed",
  "status": "ok | failed",
  "started_at": "<iso8601>",
  "ended_at": "<iso8601>",
  "comparison_safety": { "code_touched": [], "config_touched": [], "safe_for_delta": true },
  "sources": {
    "agent":  { "event_count": 12, "edit_ledger": {}, "config_deltas": [], "commands": [] },
    "git":    { "commit": "abc123", "dirty": false, "changed_files": [] },
    "mlflow": { "run_id": "...", "params": {}, "metrics": {} },  // present only if active
    "env":    { "python_version": "3.13", "platform": "..." }
  },
  "digest": null,           // optional, evidence-gated
  "transcript_ref": null    // pointer to session JSONL, never raw content
}

Installation

pip install multimodal-mllog              # core (capture, query, render)
pip install "multimodal-mllog[mlflow]"    # + optional MLflow sensor/sink

Quickstart

  1. Open your ML project in a coding agent (Claude Code, Codex, etc.).
  2. Run your experiment: train, evaluate, or analyze.
  3. The Stop hook captures the run automatically, or run /mllog manually.
  4. Run /logbook --from yesterday to generate a logbook from stored records.

CLI reference

# Capture a run (sensors gather git, agent events, optional MLflow automatically)
mllog capture --type {train|eval|analysis|attempt_failed} --status {ok|failed} \
              [--session-path <path>] [--mlflow-run-id <id>] [--auto]

# Query / render records
mllog get-logs --from <when> [--to <when>] [--json]
mllog get-logs --from <when> [--to <when>] --render [--out <path>]
# <when>: ISO date (2026-07-01), 'yesterday', 'today'

# Sensor / adapter / sink status
mllog doctor

# Checkpoint
mllog checkpoint [--show | --advance]

Storage

  • Records: ./mllog/records/<YYYY-MM-DD>/<record_id>.json (one per run, fsynced)
  • Checkpoint: ./mllog/checkpoint.json
  • Logbooks: ./mllog/logbooks/<from>_<to>.md
  • Override root with MLLOG_DIR env var.

Development

git clone https://github.com/jean-johnson-zwix/multimodal_mllogger
cd multimodal_mllogger
make install         # create venv + install deps
make test            # run pytest
make lint            # check core purity (no banned imports)

Module layout

src/mllog/
  cli.py                    # entrypoint
  core/
    schema.py               # Record, ComparisonSafety, Digest, TranscriptRef
    store.py                # date-partitioned JSON, fsync, time-window queries
    project.py              # Record[] -> markdown (pure, no I/O)
    events.py               # AgentEvent discriminated union
    extract/                # pure functions over list[AgentEvent]
      edits.py  config.py  commands.py  safety.py
  sensors/                  # data producers (entry points)
    agent.py  git.py  mlflow.py  env.py
  adapters/                 # vendor JSONL -> AgentEvent
    claude_code.py  codex.py
  sinks/                    # post-write side effects (entry points)
    mlflow_attach.py

Roadmap

  • v1.0: MLflow-centric pipeline with /mllog command.
  • v1.1: Local JSON store, automatic capture via hooks, /logbook reporting.
  • v1.2 (current): Sensor/adapter/sink architecture, AgentEvent normal form, deterministic extractors, comparison safety, evidence-gated digests, entry points.

License

MIT

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

multimodal_mllog-1.2.1.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

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

multimodal_mllog-1.2.1-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

Details for the file multimodal_mllog-1.2.1.tar.gz.

File metadata

  • Download URL: multimodal_mllog-1.2.1.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for multimodal_mllog-1.2.1.tar.gz
Algorithm Hash digest
SHA256 024cfbdce7b4007b42515d69c4c47fc34f849801b89f81d0807d301bfed367b4
MD5 453ab73547b57ff30e52595836066d8d
BLAKE2b-256 c9a82470adaf09bc4ab71ff500a68e8cea94077f17f85d4decab063e2d6111d7

See more details on using hashes here.

File details

Details for the file multimodal_mllog-1.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for multimodal_mllog-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 841f0e626181f2924f5e04b8fb8008b8b210f247eff58ec7a0d3c7f383441069
MD5 ecec17e0896476ca1ecfe435fb0a2488
BLAKE2b-256 22e937b9621280a8a5005420cb17432ce49d2e959597be023473831992ee13ec

See more details on using hashes here.

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