Skip to main content

SciTeX Clew (scitex-clew)

SciTeX

Trace every manuscript claim back to the code and data that produced it.

Full Documentation · uv pip install "scitex-clew[all]"

pypi python docs

tests cov


Problem and Solution

# Problem Solution
1 Unverified claims — reviewers cannot tell which code and data produced a number in a manuscript. Claim back-trace — each registered claim resolves to the runs and files behind it in a hash-linked DAG.
2 Silent drift — outputs change after the code or inputs move on, and nobody notices. Hash verification — clew verify re-hashes recorded files and names the first broken link.
3 Logging is extra work — provenance tools need calls researchers forget to make. Unconscious capture — @stx.session and stx.io record inputs, scripts and outputs as a side effect.

Why claim binding matters. In a seizure-forecasting analysis (2026-06-30) two same-named scripts produced "Table 03". One fabricated timestamps and showed near-chance numbers; the other used the real time column. Both looked like the source until each claim had to resolve to one registered session. That incident made clew registration mandatory for every manuscript value (ADR-0021).

Clew establishes provenance (this result came from this code and data, unchanged), not correctness. The name is the thread Ariadne gave Theseus to find his way back through the labyrinth.

Quick Start

import scitex_clew as clew

clew.status()                                   # git-status-like overview
clew.run("session_20250301_143022")             # verify one run (hash check)
clew.chain("output/figure.png")                 # trace a file's provenance chain
clew.dag(["output/figure.png"])                 # verify the DAG behind a target
clew.rerun("session_20250301_143022")           # re-execute in a sandbox and compare

DAG verification example

Figure 1. DAG verification. Green nodes are sessions whose recorded hashes still match disk; red nodes flag a drift.

Demo

Clew concept clip — a thread of evidence (click to watch)

Figure 2. Clew — a thread of evidence (concept clip, narrated).

Installation

uv pip install "scitex-clew[all]"

Requires Python >= 3.10. Records go to PostgreSQL through scitex_dev.store.host_store(): SCITEX_STORE_DSN when set, otherwise a per-user local store under ~/.scitex/store/local, created on first use. The local store needs the PostgreSQL server binaries (initdb, pg_ctl) from your OS, conda, or pip install 'scitex-dev[local-store]' (Python <= 3.12).

Architecture

graph LR
    S[Source<br/>01_download.py] --> I[Input<br/>raw_data.csv]
    I --> P[Processing<br/>03_analyze.py]
    P --> O[Output<br/>figure1.png]
    O --> C[Claim<br/>'Fig 1: p<0.05']

Figure 3. The five node classes. Verification walks backward from a claim to its sources, checking every hash on the way.

Mode API Answers
Project clew.dag() Is the whole project intact?
Files clew.dag(["output.csv"]) Can I trust this specific file?
Claims clew.verify_claim("Fig 1") Is this figure or statistic still backed by the data?

Table 1. Three verification modes. Each supports cache verification (hash comparison) and re-run verification (sandbox re-execution).

What clew guarantees, each with its full statement in a skill page:

  • Verification covers only what a claim rests on. clew.prune(target) (CLI clew prune) keeps the runs and files on a path to the target; claim verification uses this pruned graph. The pre-0.40 slice names remain as deprecated aliases until 1.0.0. Pruned graph
  • Caches never hide a change. Every cache key is a SHA-256 of live file bytes; no mtime logic. Python API
  • Capture is automatic inside the project root. Files read from outside it are recorded as external inputs with their hash. Unconscious capture
  • Killed runs keep their record. A per-session journal is replayed on the next start. Killed runs
  • Recording can be turned off. SCITEX_CLEW_CAPTURE=0 disables all automatic recording. Environment variables
  • Large pipelines stay readable. Groupers collapse per-subject files into one node with a Merkle root. Grouping

Four Interfaces

🐍 Python API ⭐⭐⭐ — import scitex_clew as clew
clew.add_claim("Fig 1 shows p<0.05", source_files=["fig1.png"])
clew.verify_claim("Fig 1")
clew.mermaid(claims=True)          # Mermaid DAG diagram

clew list-python-apis -v prints the full API. Full API reference

💻 CLI ⭐⭐⭐ — clew
clew status                          # overview
clew verify                          # verify every registered claim
clew dag --strict --json             # strict DAG check with failure attribution
clew export-evidence --out report.json
clew --help-recursive                # every command

Full CLI reference

🔧 MCP Server ⭐⭐ — clew mcp start

Agents verify runs, trace provenance and manage claims with the same operations as the Python API. clew mcp list-tools -vv lists every tool with its arguments.

Full MCP specification

📖 Skills ⭐⭐ — clew docs list

Workflow pages for agents: claims, evidence bundles, the evidence provider, capture boundaries and common workflows.

clew docs list
scitex-dev skills export --package scitex-clew   # install for Claude Code

SciTeX Ecosystem

flowchart LR
    session["scitex-session"] -->|run hooks| clew["<b>scitex-clew</b>"]
    io["scitex-io"] -->|load/save hooks| clew
    scholar["scitex-scholar"] -->|resolved citations| clew
    clew -->|evidence-report 1.3.0<br/>entry point, no import| lp["scitex-live-paper"]
    lp -->|PDF viewer| rp["scitex-rich-pdf"]

Figure 4. scitex-clew and the packages it is most often used with.

  • scitex-session and scitex-io own running scripts and file I/O; clew subscribes to their hooks and records what they open and write.
  • scitex-scholar resolves \cite keys; clew keeps the citation ledger and checks manuscript citations against it.
  • scitex-live-paper renders the paper and per-claim state. It never imports clew: clew owns the evidence-provider adapter and reports through the scitex-live-paper.evidence-report 1.3.0 contract, found by the scitex.livepaper.renderers entry point. Evidence provider
  • scitex-rich-pdf is the PDF viewer live-paper uses; clew does not touch it.

With the umbrella, one decorator records a whole run:

import scitex as stx

@stx.session
def main(CONFIG=stx.INJECTED):
    data = stx.io.load("input.csv")      # recorded as input
    stx.io.save(process(data), "output.csv")  # recorded as output
    return 0

Part of SciTeX

scitex-clew is part of SciTeX.

The SciTeX system follows the Four Freedoms for Research below, inspired by the Free Software Definition:

Four Freedoms for Research

  1. The freedom to run your research anywhere — your machine, your terms.
  2. The freedom to study how every step works — from raw data to final manuscript.
  3. The freedom to redistribute your workflows, not just your papers.
  4. The freedom to modify any module and share improvements with the community.

AGPL-3.0 — because we believe research infrastructure deserves the same freedoms as the software it runs on.


SciTeX

Metadata

Release files for scitex-clew 0.42.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scitex-clew 0.42.3
File Size Uploaded Provenance Actions
scitex_clew-0.42.3.tar.gz 7.6 MB Without provenance Details for scitex_clew-0.42.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for scitex-clew 0.42.3
File Interpreter ABI Platform Actions
scitex_clew-0.42.3-py3-none-any.whl Python 3 none any Details for scitex_clew-0.42.3-py3-none-any.whl

Total release size: 14.2 MB

Release files / scitex_clew-0.42.3.tar.gz

Download URL scitex_clew-0.42.3.tar.gz
Size 7.6 MB
Tags Source
SHA-256 checksum
How to use checksums
97de2376bcab44e297d7117b0305e1743df38c73ebc11e5f2ac62d8010821e5e
BLAKE2b-256 checksum
How to use checksums
b4efa546e3e1b30e1e1ff5cc15e0f6f23b009da592f9528a90d325728f3353dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / scitex_clew-0.42.3-py3-none-any.whl

Download URL scitex_clew-0.42.3-py3-none-any.whl
Size 6.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
dff238c23411388649e3112abec324f47913cdde8ebe3481f03a356363f17896
BLAKE2b-256 checksum
How to use checksums
1d228fcb6e287b15536ec94630bbfb72589a75fada649e184480385305648028
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Security for scitex-clew 0.42.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.42.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page