SPB Git

spb/modelmap Public License

Internal cartography of local LLMs on Apple Silicon — registered, gated, negative-first. Public atlas at modelmap.io.

Python 66.3% JavaScript 24.5% CSS 8.1% Shell 0.7%
3.1 KB · 104 lines python
Raw Blame History
1#!/usr/bin/env python32# =============================================================================3#  Project   : modelmap4#  File      : tools/new_map.py5#  Purpose   : Scaffold a compliant atlas entry with provenance + confidence6#  Author    : Simon-Pierre Boucher7#  Contact   : contact@spboucher.ai8#  Website   : https://modelmap.io9#  Created   : 2026-08-1210#  Modified  : 2026-08-1211#  Platform  : macOS / Apple Silicon (arm64)12#  License   : All rights reserved (research code)13# =============================================================================14"""Scaffold an atlas entry: atlas/<model_id>/<map_type>/<version>/.1516An entry cannot be published without a completed provenance.json and17confidence.md (charter §3). This tool creates both as explicit stubs that18tools/publish.py refuses to export until completed.1920Usage:21    python3 tools/new_map.py <model_id> <map_type> [version]22"""2324from __future__ import annotations2526import datetime27import json28import subprocess29import sys30from pathlib import Path3132ROOT = Path(__file__).resolve().parent.parent333435def git_commit() -> str:36    try:37        return subprocess.run(38            ["git", "rev-parse", "HEAD"], cwd=ROOT, capture_output=True, text=True, check=True39        ).stdout.strip()40    except subprocess.CalledProcessError:41        return "unknown"424344CONFIDENCE_TEMPLATE = """---45project: modelmap46document: {model_id}/{map_type}/{version} — confidence47author: Simon-Pierre Boucher48contact: contact@spboucher.ai49website: https://modelmap.io50created: {date}51status: draft52---5354# Confidence — {model_id} / {map_type} / {version}5556```text57Level      : (0 anecdotal | 1 correlational | 2 method-robust | 3 causal)58Seeds      : (n)59Prompt sets: (n)60Methods in agreement : (list)61Causal verification  : (none | patching | ablation | ...)62```6364**NOT PUBLISHABLE until this file states an evidence level with its support.**65"""666768def main() -> int:69    if len(sys.argv) < 3:70        print(__doc__)71        return 272    model_id, map_type = sys.argv[1], sys.argv[2]73    version = sys.argv[3] if len(sys.argv) > 3 else "v0"74    date = datetime.datetime.now(tz=datetime.UTC).date().isoformat()75    entry = ROOT / "atlas" / model_id / map_type / version76    if entry.exists():77        print(f"error: {entry.relative_to(ROOT)} already exists")78        return 179    entry.mkdir(parents=True)80    provenance = {81        "author": "Simon-Pierre Boucher",82        "contact": "contact@spboucher.ai",83        "website": "https://modelmap.io",84        "model_id": model_id,85        "map_type": map_type,86        "version": version,87        "commit": git_commit(),88        "model_hash": "PENDING",89        "config": "PENDING",90        "seed": None,91        "hardware_manifest": "PENDING",92        "created": date,93    }94    (entry / "provenance.json").write_text(json.dumps(provenance, indent=2) + "\n")95    (entry / "confidence.md").write_text(96        CONFIDENCE_TEMPLATE.format(model_id=model_id, map_type=map_type, version=version, date=date)97    )98    print(f"scaffolded atlas/{model_id}/{map_type}/{version}")99    return 0100101102if __name__ == "__main__":103    sys.exit(main())104