/cmf:cmf-instrumentfrom cmf
Adds CMF metadata tracking to Python ML pipelines. Covers Cmf() API methods and provides copy-paste templates for common pipeline stages.
Ships in cmf. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Add CMF tracking to the user's Python pipeline. Identify each stage and apply the five-step pattern below.
from cmflib.cmf import Cmf
metawriter = Cmf(filepath="mlmd", pipeline_name="my_pipeline") # 1. connect
metawriter.create_context(pipeline_stage="Train") # 2. stage type
metawriter.create_execution( # 3. this run
execution_type="Train",
custom_properties={"learning_rate": 0.01, "seed": 42} # ← hyperparameters go here
)
metawriter.log_dataset("data/train.csv", "input") # 4. log artifacts
metawriter.log_model("models/rf.pkl", event="output", #
model_framework="scikit-learn",
model_type="RandomForestClassifier",
model_name="RandomForestClassifier:v1"
)
metawriter.finalize() # 5. record git SHA
Rules:
pipeline_name in every stage of the pipelinepipeline_stage name stable across runs (don't add version suffixes)finalize() once per stage scriptmetawriter.log_dataset("data/raw.csv", "input")
metawriter.log_dataset("data/processed/train.pkl", "output",
custom_properties={"format": "pickle", "rows": 10000})
# With labels file
metawriter.log_dataset("data/raw.csv", "input",
label="data/labels.csv", label_properties={"annotator": "team-a"})
# Output (saving)
metawriter.log_model("models/rf.pkl", event="output",
model_framework="scikit-learn",
model_type="RandomForestClassifier",
model_name="RandomForestClassifier:v1")
# Input (loading)
metawriter.log_model("models/rf.pkl", event="input")
# Per-step metrics (inside training loop)
for epoch in range(num_epochs):
metawriter.log_metric("train_metrics", {"loss": loss, "epoch": epoch})
metawriter.commit_metrics("train_metrics") # ← must call to persist
# Final stage metrics
metawriter.log_execution_metrics("eval_metrics",
{"accuracy": 0.94, "roc_auc": 0.97})
def prepare(input_path, output_dir, params):
metawriter = Cmf(filepath="mlmd", pipeline_name="my_pipeline")
metawriter.create_context(pipeline_stage="Prepare")
metawriter.create_execution(execution_type="Prepare", custom_properties=params)
metawriter.log_dataset(input_path, "input")
# ... your processing logic ...
metawriter.log_dataset(f"{output_dir}/train.pkl", "output")
metawriter.log_dataset(f"{output_dir}/test.pkl", "output")
metawriter.finalize()
def train(train_path, model_path, params):
metawriter = Cmf(filepath="mlmd", pipeline_name="my_pipeline")
metawriter.create_context(pipeline_stage="Train")
metawriter.create_execution(execution_type="Train", custom_properties=params)
metawriter.log_dataset(train_path, "input")
model = fit_model(train_path, params)
for i, loss in enumerate(training_losses):
metawriter.log_metric("train_metrics", {"loss": loss, "step": i})
metawriter.commit_metrics("train_metrics")
save_model(model, model_path)
metawriter.log_model(model_path, event="output",
model_framework="scikit-learn",
model_type="RandomForestClassifier",
model_name="RandomForestClassifier:default")
metawriter.finalize()
def evaluate(model_path, test_path, params):
metawriter = Cmf(filepath="mlmd", pipeline_name="my_pipeline")
metawriter.create_context(pipeline_stage="Evaluate")
metawriter.create_execution(execution_type="Evaluate", custom_properties=params)
metawriter.log_model(model_path, event="input")
metawriter.log_dataset(test_path, "input")
accuracy, roc_auc = run_evaluation(model_path, test_path)
metawriter.log_execution_metrics("eval_metrics",
{"accuracy": accuracy, "roc_auc": roc_auc})
metawriter.finalize()
from cmflib.cmf import Cmf added at topCmf(filepath="mlmd", pipeline_name="<pipeline>") — same name every stagecreate_context(pipeline_stage="<StageName>") — stable namecreate_execution(...) — hyperparameters in custom_properties"input", every output with "output"commit_metrics() called after every log_metric() loopfinalize() at the endSee references/api-reference.md for the full method signature table and data slice API.
Docs: cmflib API · Cmf class reference · Getting Started tutorial
What SKILL.md sets; muted values are Claude Code's defaults
7 skills in this plugin
/cmfUse when working with the Common Metadata Framework (CMF) — initializing CMF in a project, instrumenting ML pipeline code, syncing metadata and artifacts with a CMF Server, querying lineage and artifacts, or setting up the CMF MCP server for AI assistant integration. Routes to the appropriate specialized skill based on the task.
/cmf-initUse when setting up CMF in a new or existing project. Covers creating a Python environment (conda, uv, or venv), installing cmflib (requires Python 3.9–3.11, recommended 3.10), running `cmf init` to configure a storage backend (local, S3, MinIO, SSH, or OSDF), and verifying the setup. Linux only — cmflib does not support macOS.
/cmf-mcpUse when setting up the CMF MCP server so an AI coding assistant can query CMF metadata using natural language, or when the CMF MCP server is already running and the user wants to use it from their coding agent. Covers Docker deployment, per-agent configuration (Claude Code, GitHub Copilot, Cursor, Codex), and example prompts.
npx claudepluginhub hewlettpackard/cmf --plugin cmfOther plugins' skills for the same job