Skip to content

TaewoooPark/MagLab

Repository files navigation

MagLab

An AI for Science harness for magnetism and spintronics research.

한국어 README · Manuals · 한국어 매뉴얼

License GitHub stars Last commit Top language   Python 3.11-3.13 Typer and Rich CLI NumPy, SciPy, pandas lmfit LiteLLM and Ollama smolagents and MCP Ubermag simulation stack Matplotlib and PyVista PyVISA

MagLab research lifecycle

Why MagLab Exists

MagLab was built for researchers in magnetism and spintronics who want AI for Science to become a practical lab instrument, not a demo prompt. The goal is to support the parts of research that actually slow scientists down: finding and auditing literature, translating material stacks into parameters, checking units and physical ranges, moving between simulation scales, fitting spintronic effects, generating reproducible figures, drafting instrument scripts, keeping an electronic lab notebook, reviewing manuscripts, and turning verified results into papers, posters, slides, rebuttals, and grant text.

The central design choice is that MagLab is a harness platform. The LLM layer plans, routes, explains, and drafts. Domain modules perform the scientific work: physics formulae, unit conversion, material lookup, simulation pipelines, fitters, figure renderers, literature connectors, SCPI safety checks, data lineage, and review workflows. The point is not to replace the scientist. The point is to make the scientist's research loop faster, more organized, and more reproducible.

Why AI for Science Needs a Harness

AI for Science matters because modern research is no longer limited only by ideas. It is also limited by coordination overhead: too many papers to audit, too many file formats, too many unit conventions, too many simulation backends, too many figure revisions, and too much undocumented context living in lab notebooks, scripts, and memory. A useful scientific AI system therefore cannot be just a chatbot. It needs a controlled environment where language models can ask for deterministic tools, receive structured results, preserve provenance, and expose enough of the process for a scientist to inspect it.

MagLab takes that position seriously. It treats the LLM as an orchestration layer, not as the source of scientific truth. Numerical values should come from formula modules, data files, fitters, simulations, literature records, or explicit user input. Figures should be vector artifacts tied to data and provenance, not generated raster guesses. Manuscripts, posters, and emails should start from verified results and remain marked for human review. This is what makes AI for Science operational: the model helps the research loop move, while the harness keeps the loop inspectable.

For magnetism and spintronics, this is especially important. A typical project crosses material stacks, magnetic units, transport geometries, micromagnetic assumptions, solver-specific files, fitted effect models, and publication figures. Small mistakes are easy: mixing CGS and SI, reporting a fit parameter outside a physical range, forgetting how a figure was generated, or citing a paper that does not support the claim. MagLab is built around those failure modes.

What It Helps With

Research bottleneck MagLab support
Literature overload Extract keywords from a paper folder, search OpenAlex/Semantic Scholar/arXiv/Crossref, build an evidence matrix, inspect authors, journal metrics, citation graphs, and local corpus context.
Material and unit friction Query magnetic materials, build multilayer stacks, compute exchange length/FMR/domain-wall/skyrmion formulae, convert magnetic units, and run a physics oracle before downstream work.
Simulation handoff Generate and validate micromagnetic specs, prepare DFT and atomistic inputs, parse solver outputs, and connect DFT -> atomistic -> micromagnetic -> device-scale workflows.
Fitting and interpretation Fit AMR, AHE, OHE, PHE, SMR, USMR, ST-FMR, FMR/Kittel, damping, spin pumping/ISHE, DMI, domain-wall, skyrmion/Thiele, hysteresis, and Curie-temperature models.
Figure reproducibility Build FigureSpec JSON, render journal-aware vector figures, compose multi-panel outputs, and use a schematic primitive catalog for spintronics figures.
Instrument scripting Scaffold PyVISA drivers, validate SCPI sequences, ingest manuals for RAG, generate scripts from experiment descriptions, and run safety checks before hardware use.
Lab memory Create structured ELN entries, list notes by date/sample/tag/type, generate measurement plans, and create DOE/active-learning next-step suggestions.
Review and critique Run persona-style manuscript review, synthesize consensus/dissent, explain anomalous results, and keep AI assistance disclosure explicit.
Authoring and communication Draft manuscript sections, cover letters, revision letters, rebuttals, abstracts, grants, emails, slides, and posters while preserving human review requirements.
Orchestration Use the interactive REPL, Ralph loops, MCP server/client, subagents, skills, gateway bots, cost tracking, checkpoints, and provenance records to coordinate a full research lifecycle.

Pipeline Stack

Terminal UX
Python Typer Rich prompt_toolkit pyfiglet

Physics, Data, Fitting
NumPy SciPy pandas lmfit Pydantic PROV

Literature Intelligence
OpenAlex Semantic Scholar arXiv Crossref scikit-learn KeyBERT LanceDB

Simulation Handoff
Ubermag OOMMF micromagneticmodel discretisedfield magnum.np Paramiko

Figures and Authoring
Matplotlib SciencePlots PyVista CairoSVG LaTeX PowerPoint Word

Models, Agents, Gateways
LiteLLM Ollama Anthropic OpenAI Gemini smolagents MCP Slack Telegram Discord

Instruments and Manuals
PyVISA SCPI pyvisa-sim pdfplumber

Implementation Status

This README describes the current source tree, not only a future plan. The CLI entry point is implemented in maglab/cli.py, the optional PI/smolagents harness surface is registered through maglab/commands/harness.py, and the package metadata in pyproject.toml exposes the maglab console script.

The best way to check the code path from a checkout is:

.venv/bin/python -m maglab --help
.venv/bin/python -m maglab harness --help
.venv/bin/python -m maglab doctor --help

If an older global pipx install is already on your PATH, it can lag behind the checkout until you reinstall or upgrade it. In that case, the source command above is the authority for this repository, and the installed command can be refreshed with the editable install command in the next section.

Implemented today:

Surface Current status Notes
CLI and REPL Implemented maglab, maglab -p, maglab ask, and maglab run route through the terminal app and configured backend.
Deterministic physics/material tools Implemented Formula evaluation, unit conversion, physics oracle, material lookup/search/build, and DataPoint creation run without LLM credentials.
Analysis and fitting Implemented Effect registry, CSV/HDF5 loading, model inspection, lmfit-based fitting, deterministic discovery attempts, and ELN/provenance hooks are wired.
Figure tooling Implemented FigureSpec creation, render/compose/export, journal styles, and a primitive catalog are available; real rendering depends on plotting extras.
Instrument tooling Implemented as scaffold and safety workflow PyVISA driver scaffolds, SCPI validation, manual ingest/index, skill generation, script generation, and static safety checks are present.
Literature workflow Implemented with optional connectors Offline keyword extraction is available; OpenAlex/Semantic Scholar/arXiv/Crossref paths require the relevant extras and network/API availability.
Lab notebook and planning Implemented ELN note creation/listing and measurement-plan generation write project artifacts under the active workspace.
Review, authoring, communications Implemented with human-review gates Manuscript review, anomaly explanation, manuscript/cover-letter/revision/email/abstract/grant/rebuttal drafting, slides, and posters are marked for researcher review.
Report, provenance, and task inspection Implemented report inventory, prov summary/status/lineage, and task list/status/scaffold inspect artifacts already written to disk.
PI/smolagents harness Implemented as readiness, compile, dry-run, local run, and handoff UX Live local workers require .[harness], smolagents, LiteLLM provider configuration, and credentials. Live PI execution requires a separately installed PI binary.
External solvers, hardware, gateways Environment-gated MagLab prepares inputs, validates specs, and checks readiness; it does not bundle MuMax3, OOMMF, VAMPIRE, VISA drivers, Slack/Telegram/Discord credentials, or remote cluster access.

Start Here

Install MagLab as a global terminal program with the recommended research bundle. The bundle pulls in every MagLab research feature so the terminal can guide you through any remaining provider, solver, instrument, or gateway setup.

git clone https://github.com/TaewoooPark/MagLab.git
cd MagLab
pipx install --python python3.12 --editable ".[research]"
maglab install doctor
maglab doctor
maglab setup all
maglab manual --lang en

If pipx or Python 3.12 is missing on macOS, use this known-good path:

uv tool install pipx --python python3.12
pipx ensurepath
pipx install --python python3.12 --editable ".[research]"

From a development checkout, the repository-local virtual environment is often the most faithful way to run the code you are editing:

uv pip install -e ".[research]"
.venv/bin/python -m maglab --help
.venv/bin/python -m maglab doctor

Verified Terminal Runs

The screenshots below are captured from the actual CLI, not mocked output. The first view shows the initial MagLab REPL headline and /help quick result.

MagLab REPL headline and quick help

MagLab can also be operated from PI's interactive TUI. The PI session below is using the Anthropic Haiku model with the bash tool enabled, and its startup screen shows the loaded skills/extensions without a skill-conflict warning.

PI interactive MagLab startup

The same PI mode can run MagLab commands through the ! shell operator, for example a live Haiku-backed one-shot query:

PI interactive Haiku one-shot

After that, open any research folder and run maglab. MagLab keeps global config/data/cache in your user app directories, but reads and writes project artifacts relative to the folder where you launched it.

cd ~/research/my_spintronics_project
maglab workspace init
maglab workspace status
maglab workspace brief
maglab workspace tree --summary --type docs --max-depth 2
maglab workspace tree --changed
maglab

Run deterministic tools without an LLM key:

maglab physics compute exchange_length A=13e-12 Ms=860e3
maglab physics units 1000 oe tesla
maglab mat search Py --json
maglab mat show Permalloy
maglab analyze model stfmr
maglab figure primitives list

Connect an LLM backend when you want natural-language orchestration, drafting, review, or agent workflows. Codex is supported through the official authenticated Codex CLI; MagLab does not store Codex OAuth tokens. Direct API providers are also supported for Anthropic, Grok, DeepSeek, Qwen, Kimi, Gemini, and OpenAI.

maglab auth codex
maglab auth anthropic
maglab auth qwen
maglab auth status
maglab auth test
maglab doctor --smoke
maglab

Inside the REPL, use /help quick for the first-run path and /help all for the full slash-command tree. Use /workspace brief, /doctor, /sim doctor --explain, and /connect status to inspect the current folder and setup state. Use /connect codex, /connect <provider>, /connect api <provider>, or /connect ollama to switch backends. API-key commands always use hidden terminal input; maglab auth set <provider> remains available for explicit key storage and scripting. Use /reset config to restore the previous config backup or /reset defaults to return MagLab to a clean default config.

maglab doctor is the installation audit. It checks the active folder, LLM backend, feature extras, GPU/SSH/no-GPU simulation paths, bilingual manuals, figure/export readiness, poster/deck templates, workspace-scoped LLM file tools, and physics/provenance gates against the UX promised in plan/.

One-shot mode is useful in scripts and CI:

maglab -p "Plan a reproducible ST-FMR analysis workflow for Pt/CoFeB/MgO"

Manuals

The README is the map. The manuals are the operating instructions. They are also available from an installed global CLI:

maglab manual --lang en
maglab manual figures --lang ko
Area English Korean
Manual index docs/manuals/en/index.md docs/manuals/ko/index.md
Quickstart and operating manual English 한국어
Literature intelligence English 한국어
Materials and physics English 한국어
Simulation English 한국어
Analysis and fitting English 한국어
Figures English 한국어
Instruments English 한국어
Lab notebook and planning English 한국어
Review and anomaly explanation English 한국어
Authoring and communications English 한국어
Orchestration, agents, MCP, gateway English 한국어

Practical Operating Manual

Use MagLab in layers. Start with deterministic commands, then add model orchestration only when the folder, dependencies, and provenance path are clear.

Situation First commands What to check before trusting output
Fresh clone or global install maglab install doctor -> maglab doctor -> maglab setup all Python version, installed extras, global command path, missing optional solvers.
Opening a new research folder maglab workspace init -> maglab workspace brief -> maglab workspace tree --summary MAGLAB.md, visible project files, ignored/private paths, generated output directory.
Connecting a model maglab auth codex or maglab auth <provider> -> maglab auth status -> maglab doctor --smoke Whether the backend returns the sentinel, where credentials are stored, selected model.
No GPU available maglab sim doctor --backend auto --explain -> maglab sim pipeline --backend mock Mock outputs are workflow artifacts, not physical solver results. Use CPU for small real runs.
Local GPU available maglab sim doctor --backend local-gpu mumax3, nvidia-smi, mesh size, small validated test job before spending time.
SSH GPU or cluster maglab sim doctor --backend ssh-gpu --host <host> --user <user> No connection is opened unless --probe-ssh is added; verify SSH keys and remote modules first.
Measurement CSV ready maglab analyze load data.csv -> maglab analyze model <effect> -> maglab fit --effect <effect> data.csv Required columns, geometry assumptions, parameter bounds, residuals, provenance IDs.
Figure needed maglab figure spec -> maglab figure render ... --datapoints ledger.json DataPoint binding, axis labels, units, journal width, vector output.
Poster or slides needed maglab present templates --detail -> `maglab present slides poster ...`
Writing or rebuttal maglab write ... --dry-run or maglab comms revision ... HUMAN REVIEW REQUIRED, citation existence, claim support, no unsupported numbers.

Inside the REPL, the same flow is available through slash commands:

/help quick
/workspace brief
/doctor
/setup all
/connect codex
/connect openai
/sim doctor --explain
/manual ko quickstart-operations

During LLM calls, MagLab prints a compact activity trace: model stage, elapsed time, stop instruction, and tool/file references when they are visible to the harness. Hidden model reasoning is not printed. The useful observable signal is what was run, which Python module mediated it, and which workspace files were referenced or touched.

Example Research Loops

Literature to experiment plan

maglab lit search papers/pt_cofeb_mgo --top-n 40
maglab lit authors "spin orbit torque CoFeB MgO"
maglab lab plan "SOT efficiency in Pt/CoFeB/MgO" --n-doe 16 --output sot_plan.yaml

Measurement to fit to figure

maglab analyze load data/stfmr.csv --columns frequency,field,voltage
maglab analyze model stfmr
maglab fit --effect stfmr data/stfmr.csv --method least_squares
maglab fit --discover --effect ordinary_hall data/hall.csv --init-grid '{"R_H":[-1e-10,0,1e-10]}'
maglab sim plot data/stfmr.csv --journal aps --format pdf --output figures/stfmr.pdf

Multiscale simulation handoff

maglab sim dft --structure bcc_fe --engine qe --calc-type jij --output-dir runs/dft_fe
maglab sim atomistic --engine vampire --j-ij-k 398 --t-max-k 1300 --output-dir runs/vampire_fe
maglab sim pipeline --structure bcc_fe --scales dft,atomistic,micro,device --backend mock

Instrument workflow

maglab instr ingest "Keithley 2400" --manufacturer Keithley --manual-path manuals/keithley_2400.pdf
maglab instr skillgen "Keithley 2400" --manufacturer Keithley --safety-model keithley-2400
maglab instr script "Keithley 2400" --description "field sweep Hall voltage measurement" --output hall_sweep.py
maglab instr check hall_sweep.py

Authoring after verified results

maglab write "ST-FMR fit gives xi_DL=0.12 with provenance IDs ..." --journal prl --dry-run
maglab comms cover-letter --journal "Physical Review Letters" --title "Spin-orbit torque ..."
maglab present templates --detail
maglab present slides "Key results and figures from the SOT study" --template aps-12min --format beamer --n-slides 10
maglab present poster "Key results and figures from the SOT study" --template aps-march-poster --format svg

First-run readiness check

maglab doctor
maglab doctor --feature simulation --sim-backend ssh-gpu --host gpu.example.edu --user alice

Command Surface

maglab                         interactive research agent
maglab -p "QUERY"              non-interactive one-shot query
maglab -p "QUERY" --harness-workflow literature-review
                               one-shot query through a manifest workflow

auth      codex · claude · gemini-cli · ollama · anthropic · grok · deepseek · qwen · kimi · gemini · openai · set · list · status · test
physics   compute · units · oracle
mat       list · show · search · build
sim       doctor · micro · validate · plot · job · dft · atomistic · pipeline
fit       --effect EFFECT DATA.csv
analyze   load · model · consistency · symmetry
device    fom
figure    spec · render · compose · export
          primitives list · show · ingest
instr     scaffold · scpi · script · check · ingest · skillgen · implement
lit       search · authors · keywords · journal · graph
lab       note · note-list · plan
review    MANUSCRIPT
explain   ANOMALY
ralph     start · status · cancel
write     RESULTS
comms     revision · cover-letter · email · abstract · grant · rebuttal
gateway   setup · start · stop · status · install
present   templates · slides · poster
hypotheses TOPIC
mcp       list · serve · add · enable · disable
agents    list · show
skill     list
harness   doctor · compile · run · pi-tool · worker
report    inventory
prov      summary · status · lineage
task      list · status · scaffold
cost
manual    [topic] --lang en|ko
config    show · path · restore · reset
install   doctor
doctor
workspace status · brief · init · tree
theme     list · set
version · info

The short list above is intentionally operational rather than exhaustive. Use maglab <command> --help for option names and safety flags. Several commands have deliberately conservative defaults: SSH checks do not probe a host unless --probe-ssh is explicit, presentation and manuscript commands mark generated text as human-reviewed material, and live PI/harness execution must be requested with --execute-local or --execute-pi.

Architecture

MagLab agent architecture

MagLab is organized as a layered harness:

researcher intent
  -> CLI / REPL / gateway / MCP
  -> orchestrator, subagents, skills, checkpoints, budgets
  -> physics oracle, honesty gate, DataPoint, W3C PROV ledger
  -> deterministic engines
       physics · materials · simulation · analysis · figures · instruments
  -> lifecycle applications
       literature · lab notebook · review · authoring · communications
  -> human-reviewed scientific output

The verification layer is not the mission statement. It is the safety rail that lets MagLab be useful in scientific work. MagLab should help a researcher move from question to evidence to experiment to analysis to communication while keeping enough structure that the work can be inspected later.

Package Layout

maglab/
├── core/          orchestrator, hooks, autonomy, budgets, checkpoints, Ralph, subagents
├── llm/           provider abstraction, credentials, tool schemas, MCP client
├── physics/       formulae, units, materials database, physics oracle
├── sim/           DFT, atomistic, micromagnetic, multiscale pipeline, backends
├── analysis/      effect registry, fitting, consistency, symmetry, device FoM
├── figure/        FigureSpec, renderers, primitives, journal styles, exports
├── instrument/    SCPI, PyVISA scaffold, manual RAG, safety checks, scripts
├── literature/    connectors, corpus, RAG, graphs, authors, journals, keywords
├── lab/           ELN entries, measurement planning, active learning
├── reviewer/      persona review, meta-review, rubrics, disclosure, corpus RAG
├── authoring/     manuscript, BibTeX, data vault, slides, posters, comms
├── gateway/       Slack, Telegram, Discord daemon adapters
├── provenance/    DataPoint, W3C PROV ledger, store
├── report/        honesty gate and report rendering
├── ui/            terminal rendering and themes
└── mcp_server.py  external agent tool server

harness.manifest.json defines the agent society around this package: local-context-librarian, search-scout, citation-auditor, paper-reviewer, synthesis-editor, physics-validator, result-analyst, experiment-manager, hypothesis-gen, and comms-writer.

That manifest is exposed through three distinct user surfaces:

  • Legacy MagLab CLI/REPL mode: maglab, maglab -p ..., Ralph, and the current orchestrator use MagLab's existing backend layer.
  • Deterministic commands: physics, literature, analysis, figure, instrument, and related commands run concrete MagLab modules and can be used without an LLM key when the feature itself is offline.
  • PI harness mode: maglab harness doctor, maglab harness compile literature-review, maglab harness compile --write, maglab harness compile --check, maglab harness run literature-review --dry-run --output text, and maglab harness worker search-scout --task "..." inspect readiness, generate project-local PI wrappers, check wrapper and manifest drift, and show workflow/worker execution plans. deep-research is the MagLab end-to-end research workflow; the ergonomic aliases deepresearch and research are accepted for CLI use. Use --output json or omit --output for the full machine-readable contract. The dry-run JSON includes both local_run_plan commands for the local worker subprocess contract and a topic-bound pi_agents_workflow_payload that can be handed to PI's workflow tool. Add --execute-local --local-max-turns 2 --output text to run the workflow locally, step by step, without PI; text mode shows per-worker progress and hides raw smolagents logs by default. Add --pi-handoff to also emit the concrete pi --mode json --no-builtin-tools --tools workflow -p ... handoff command and prompt, or --execute-pi to run that handoff explicitly in an environment with provider credentials. Add --record-provenance --provenance-db .maglab/harness-provenance.sqlite when you want the prepared run recorded as a W3C PROV activity linked to --pi-flow-id. maglab harness pi-tool --payload-json ... --output json|text exposes the PI-callable wrapper directly, and harness results include a top-level cross_links block for PI flow, detected PI workflow/session, and MagLab provenance ids when present. Worker dry-runs show the model alias, resolved model, LiteLLM config source, tools, loaded/missing skill context, runtime availability, requested MCP servers, and dry-run MCP attach status; live worker failures print next steps for installing .[harness], setting provider keys, or using LITELLM_CONFIG_PATH. maglab mcp list shows which MCP servers are referenced by harness workflows and prints maglab mcp enable <name> hints for disabled read-only research connectors.

Minimal first workflow:

uv pip install -e ".[harness]"
maglab harness doctor
maglab harness compile literature-review
maglab harness run literature-review --topic "SOT switching in CoFeB" --dry-run --output text
maglab harness run literature-review --topic "SOT switching in CoFeB" --execute-local --local-max-turns 2 --output text
maglab harness run deepresearch --topic "field-free SOT switching in Ta/CoFeB/MgO" --dry-run --output text
maglab harness worker citation-auditor --task '{"candidates":[],"session_id":"demo"}' --json
maglab harness pi-tool --payload-json '{"workflow":"literature-review","input":"SOT switching in CoFeB"}' --output text
maglab run "SOT switching in CoFeB" --harness-workflow literature-review

Use literature-review for a compact five-step survey. Use deepresearch when you want local context, MCP-backed discovery, citation audit, paper-level review, physics plausibility validation, and synthesis in one six-step workflow. Worker prompts now preload the relevant MagLab skill docs declared by the agent, for example deep-research, literature-search, citation-audit, literature-review, and physics-oracle, so the same integrity gates are used in dry-run planning, local execution, and PI handoff.

For the literature workflow, the legacy direct command remains the default, but you can opt into the harness plan from the existing entrypoint:

maglab lit search papers/sot --harness-plan --dry-run --topic "SOT switching in CoFeB"
maglab lit search papers/sot --harness-plan --harness-json

In harness-plan mode, lit search extracts local keywords and prepares the literature-review PI payload; it does not call the direct OpenAlex connector or write evidence_matrix.json.

The generated .pi/workflows/*.json files are static drift artifacts for checking that manifest workflow compilation is stable. They are not the live PI execution payload; use the pi_agents_workflow_payload from harness run --dry-run when wiring a concrete PI workflow tool call.

Live PI execution is environment-gated and is not faked by the current CLI. --execute-pi uses the generated PI handoff command; it still requires PI to be installed and configured separately, plus a MagLab environment installed with the harness extra so smolagents, LiteLLM provider configuration, and the harness adapters are available. Install PI/pi-agents from the PI package instructions, then run maglab harness doctor; if a project-local .pi/npm/node_modules/.bin/pi exists, MagLab prefers that binary. Until provider credentials and LITELLM_CONFIG_PATH or direct provider keys are ready, use deterministic commands, legacy CLI/REPL mode, or harness dry-runs as the fallback. When LITELLM_CONFIG_PATH is set, live worker planning and execution both use that config file instead of the built-in aliases. The bundled configs/litellm.example.yaml is documentation only; harness doctor reports readiness incomplete until you copy it to a real config path, set LITELLM_CONFIG_PATH, or provide a direct key such as ANTHROPIC_API_KEY.

Runtime Artifacts

MagLab is designed to leave a paper trail in the workspace instead of hiding state inside a chat transcript. Common artifact locations are:

.maglab/
├── artifacts/          saved harness payloads, reports, and final results
├── harness-budget.sqlite
├── harness-provenance.sqlite
└── mcp.json            workspace MCP server registry when configured

notebook/               ELN entries and fit-linked notes
figures/                rendered or composed figure outputs
runs/                   simulation and workflow run directories
papers/                 local literature corpora and evidence matrices
reports/                manuscript, review, slide, and poster outputs

Artifact paths are command-specific and configurable, but this separation is the intended operating model: raw research files stay in the project, generated outputs are visible on disk, provenance and budget records are inspectable, and LLM-assisted text remains marked for human review.

Installation Details

Python 3.11 to 3.13 is supported.

uv pip install -e .                    # core
uv pip install -e ".[research]"        # recommended: all research features
uv pip install -e ".[llm]"             # LLM backends
uv pip install -e ".[mcp]"             # MCP server and client
uv pip install -e ".[sim]"             # simulation stack
uv pip install -e ".[figure]"          # plotting and figure rendering
uv pip install -e ".[instr]"           # PyVISA and instrument manuals
uv pip install -e ".[literature]"      # literature APIs and RAG
uv pip install -e ".[reviewer]"        # reviewer panel support
uv pip install -e ".[authoring]"       # papers, slides, posters, docs
uv pip install -e ".[gateway]"         # messaging gateway
uv pip install -e ".[harness]"         # PI/smolagents harness adapters
uv pip install -e ".[dev]"             # ruff, mypy, pytest, pre-commit

For normal research use, prefer the all-in-one .[research] extra. Then run maglab install doctor to check Python, PATH, global app paths, and installed research extras; run maglab doctor for a first-run readiness report and maglab setup all to see feature-specific setup checks, optional remote packages, terminal setup commands, and the matching REPL slash commands. Inside the MagLab REPL, use /setup, /setup <feature>, or direct commands such as /setup-llm, /setup-literature, /setup-simulation, /setup-figure, /setup-instrument, /setup-authoring, /setup-review, /setup-gateway, and /setup-mcp. Existing working dependencies and commands are treated as ready; the setup and doctor views only tell you what still needs attention.

Some simulation engines require external binaries or remote-execution packages that must be installed separately: OOMMF, MuMax3, VAMPIRE, VASP, Quantum ESPRESSO, HPC/GPU execution environments, and paramiko for Python-native SSH. MagLab can still generate inputs, validate specs, run mock paths, and parse prepared outputs without owning those solver installations.

Development

uv pip install -e ".[dev]"
ruff check maglab/ tests/
mypy maglab/
pytest

The test suite is organized around smoke, integrity, golden, and integration markers. Quantitative validation is expected to be deterministic. LLM-as-judge is not used for physics, fitting, citation, or numerical correctness.

Project Docs

Repository Metadata

Suggested GitHub description:

AI for Science harness for magnetism and spintronics research: literature, physics, simulation, fitting, figures, instruments, authoring, and provenance in one CLI.

Suggested GitHub topics:

ai-for-science, magnetism, spintronics, micromagnetics, materials-science,
scientific-computing, research-automation, llm-agents, cli, provenance,
simulation, data-analysis, scientific-figures, instruments, open-science

Suggested thumbnail/social preview description:

MagLab turns the magnetism and spintronics research lifecycle into a verifiable CLI workflow: LLM orchestration wrapped around deterministic tools, provenance, simulation, fitting, figures, instruments, and scientific writing.

License

MIT. See LICENSE.

Built with Python, NumPy, SciPy, lmfit, Matplotlib, Pydantic, and the assumption that researchers remain responsible for science.

About

AI for Science harness for magnetism and spintronics research: literature, physics, simulation, fitting, figures, instruments, authoring, and provenance in one CLI.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages