{% extends base_template|default:"global_base.html" %} {% load static %} {% block title %}Clew — SciTeX Documentation{% endblock %} {% block meta_description %} Clew: reproducibility verification via hash-based DAGs for scientific research. {% endblock %} {% block extra_css %} {% endblock %} {% block content %}

Clew

Stable

Reproducibility verification via hash-based DAGs

What is Clew?

Clew is a verification system that ensures scientific results are reproducible. It records file hashes during computation, building a directed acyclic graph (DAG) that connects source data to final outputs (figures, statistics, tables).

Every manuscript claim — "p < 0.001" or "Figure 3" — can be traced backward through the computational chain to the original data files. If any intermediate file has been modified, Clew detects the mismatch.

Forward: Track

Use @scitex.session and scitex.io in your scripts. Clew automatically records every input and output with SHA-256 hashes.

import scitex
@scitex.session
def main():
    # Inputs are tracked automatically
    data = scitex.io.load("raw_data.csv")

    # Processing...
    result = data.groupby("condition").mean()

    # Outputs are tracked with hashes
    scitex.io.save(result, "summary.csv")
    fig, ax = scitex.plt.subplots()
    ax.plot_line(result.index, result.values)
    scitex.io.save(fig, "figure_1.png")  # Saves .png + .csv

    return 0

if __name__ == "__main__":
    main()

Each run creates a session record in the Clew database (scitex/clew.db) with input/output file paths and their hashes.

Backward: Verify

Given any output artifact, trace its full dependency chain back to source data.

# Trace a single file
scitex clew chain figure_1.png

# Check all tracked files
scitex clew status

# List all recorded sessions
scitex clew list

The File mode in the Clew workspace tab lets you drag files from the file tree to visualize their dependency chains as interactive DAGs.

Claims

Claims link manuscript assertions to their computational source. Register a claim wherever your code produces a result that appears in the paper.

import scitex
@scitex.session
def main():
    data = scitex.io.load("experiment_results.csv")
    from scipy import stats
    t_stat, p_val = stats.ttest_ind(data["control"], data["treatment"])

    # Register claim: links this p-value to the manuscript
    scitex.clew.add_claim(
        claim_type="statistic",
        claim_value=f"p = {p_val:.4f}",
        file_path="manuscript.tex",
        line_number=142,
    )

    return 0

Claim types:

Type Use Example
statistic p-values, effect sizes, test statistics p = 0.003
figure Figures referenced in manuscript Figure 3a
table Tables referenced in manuscript Table 2
text Textual claims (e.g., "accuracy improved by 15%") accuracy = 0.95
value Specific numeric values N = 1024

The Claims mode in the workspace shows a DAG connecting manuscript claims to their source data, with verification status badges.

DAG Modes

The Clew workspace tab provides three visualization modes:

Mode Description When to Use
Project Full project-wide DAG showing all tracked sessions Overview of all computational dependencies
Claims Claims-based DAG linking manuscript to source data Verifying paper assertions
File Single-file or multi-file trace Debugging a specific output

In File mode, drag multiple files from the file tree to merge their dependency chains into a single DAG.

CLI Reference

Command Description
scitex clew list List all tracked sessions with timestamps and file counts
scitex clew status Show verification status of all tracked files
scitex clew chain <file> Trace dependency chain for a specific file
scitex clew run <script> Run a script with Clew tracking enabled
scitex clew mermaid Generate Mermaid DAG for the full project

Quick Start

  1. Add example scripts — Click Add Examples in the Clew tab header to get sample pipeline scripts.
  2. Run the pipeline — Open a terminal and run:
    cd examples/clew && bash 00_run_all.sh
  3. View the DAG — Switch to Project mode to see the full verification DAG.
  4. Trace a file — Switch to File mode and drag any output file from the file tree onto the DAG area.

For AI Agents

AI agents can interact with Clew via MCP tools:

MCP Tool Description
clew_list List tracked sessions
clew_status Check verification status
clew_run Run a script with tracking
clew_chain Trace file dependency chain
clew_mermaid Generate Mermaid DAG

When using @scitex.session in scripts, all file I/O via scitex.io is automatically tracked. No additional configuration needed.

{% endblock %}