Logo Simulation Orchestrator

Simulation Orchestrator

Cộng đồng
HeshamFS
simulation-orchestrator

Điều phối các chiến dịch gồm nhiều mô phỏng — tạo cấu hình quét tham số (lưới, linspace hoặc lấy mẫu Latin Hypercube), khởi chạy và theo dõi các chiến dịch tác vụ hàng loạt, giám sát trạng thái hoàn tất của tác vụ, rồi tổng hợp kết quả bằng các thống kê tóm tắt cho mọi lần chạy. Dùng khi khảo sát tham số với dt, kappa hoặc các đầu vào mô phỏng khác; quản lý hàng chục hoặc hàng trăm cấu hình mô phỏng; kết hợp đầu ra từ các lần chạy hàng loạt đã hoàn tất để tìm kết quả tốt nhất; hoặc tự động hóa quy trình tạo-chạy-thu thập cho các nghiên cứu có hệ thống — kể cả khi người dùng chỉ nói “Tôi cần thử nhiều tổ hợp tham số” hoặc “Làm sao để tổ chức một đợt quét tham số?”.

Add to TypingMind

Tổng quan

Nhà phát hànhHeshamFS
Kho mãmaterials-simulation-skills
Tên kỹ năngsimulation-orchestrator
Sao
83
Bản fork
6
Tệp đi kèm
24
Giấy phépApache-2.0
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 24 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được HeshamFS công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Simulation Orchestrator trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/HeshamFS/materials-simulation-skills/tree/main/skills/simulation-workflow/simulation-orchestrator
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/HeshamFS/materials-simulation-skills.git /tmp/materials-simulation-skills
mkdir -p .claude/skills
cp -r /tmp/materials-simulation-skills/skills/simulation-workflow/simulation-orchestrator .claude/skills/simulation-orchestrator
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Simulation Orchestrator trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Simulation Orchestrator ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Simulation Orchestrator với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Simulation Orchestrator

Goal

Provide tools to manage multi-simulation campaigns: generate parameter sweeps, track job execution status, and aggregate results from completed runs.

Requirements

  • Python 3.10+
  • No external dependencies (uses Python standard library only)
  • Works on Linux, macOS, and Windows

Inputs to Gather

Before running orchestration scripts, collect from the user:

InputDescriptionExample
Base configTemplate simulation configurationbase_config.json
Parameter rangesParameters to sweep with boundsdt:[1e-4,1e-2],kappa:[0.1,1.0]
Sweep methodHow to sample parameter spacegrid, lhs, linspace
Output directoryWhere to store campaign files./campaign_001
Simulation commandCommand to run each simulationpython sim.py --config {config}

Decision Guidance

Choosing a Sweep Method

Need every combination (full factorial)?
├── YES → Use grid (warning: exponential growth with parameters)
└── NO → Is space-filling coverage needed?
    ├── YES → Use lhs (Latin Hypercube Sampling)
    └── NO → Use linspace for uniform sampling per parameter
MethodBest ForSample Count
gridLow dimensions (1-3), need exact cornersn^d (exponential)
linspace1D sweeps, uniform spacingn per parameter
lhsHigh dimensions, space-fillinguser-specified budget

Campaign Size Guidelines

ParametersGrid Points EachTotal RunsRecommendation
11010Grid is fine
210100Grid acceptable
3101,000Consider LHS
4+1010,000+Use LHS or DOE

Script Outputs (JSON Fields)

ScriptOutput Fields
scripts/sweep_generator.pyconfigs, parameter_space, sweep_method, total_runs
scripts/campaign_manager.py --action initcampaign_id, total_jobs, config_dir, command_template
scripts/campaign_manager.py --action statuscampaign_id, status, jobs, progress, total_jobs, created_at
scripts/campaign_manager.py --action listjobs (array of job records)
scripts/job_tracker.pyjob_id, status, start_time, end_time, exit_code
scripts/result_aggregator.pysummary (incl. minimize), statistics, best_run, failed_runs

Note on swept parameter names: sweep_generator.py writes each swept value into the base config by key path. A bare name (e.g. kappa) overwrites a top-level key; a dot-notation name (e.g. parameters.kappa) targets a nested key. The swept key path must match where the solver reads the value — sweeping kappa against a config that nests parameters.kappa would add an unused top-level key and silently leave the base value in place. See references/sweep_strategies.md.

Workflow

Step 1: Generate Parameter Sweep

Create configurations for all parameter combinations:

bash
python3 scripts/sweep_generator.py \
    --base-config base_config.json \
    --params "dt:1e-4:1e-2:5,kappa:0.1:1.0:3" \
    --method linspace \
    --output-dir ./campaign_001 \
    --json

Step 2: Initialize Campaign

Create campaign tracking structure:

bash
python3 scripts/campaign_manager.py \
    --action init \
    --config-dir ./campaign_001 \
    --command "python sim.py --config {config}" \
    --json

Step 3: Track Job Status

Monitor running jobs:

bash
python3 scripts/job_tracker.py \
    --campaign-dir ./campaign_001 \
    --update \
    --json

Step 4: Aggregate Results

Combine results from completed runs:

bash
python3 scripts/result_aggregator.py \
    --campaign-dir ./campaign_001 \
    --metric final_energy \
    --json

result_aggregator.py minimizes by default: best_run is the run with the lowest metric value (and summary.minimize is true). If higher is better (e.g. yield, accuracy, throughput), pass --maximize so best_run becomes the highest value:

bash
# Higher is better -> select the maximum
python3 scripts/result_aggregator.py \
    --campaign-dir ./campaign_001 \
    --metric yield \
    --maximize \
    --json

Decision guidance: If higher is better (yield, accuracy, throughput), pass --maximize; otherwise the reported best_run is the minimum.

CLI Examples

bash
# Generate 5x3=15 runs varying dt (5 values) and kappa (3 values)
python3 scripts/sweep_generator.py \
    --base-config sim.json \
    --params "dt:1e-4:1e-2:5,kappa:0.1:1.0:3" \
    --method linspace \
    --output-dir ./sweep_001 \
    --json

# Generate LHS samples for 4 parameters with budget of 20 runs
python3 scripts/sweep_generator.py \
    --base-config sim.json \
    --params "dt:1e-4:1e-2,kappa:0.1:1.0,M:1e-6:1e-4,W:0.5:2.0" \
    --method lhs \
    --samples 20 \
    --output-dir ./lhs_001 \
    --json

# Check campaign status
python3 scripts/campaign_manager.py \
    --action status \
    --config-dir ./sweep_001 \
    --json

# List jobs (read-only), optionally filtered by status
python3 scripts/campaign_manager.py \
    --action list \
    --config-dir ./sweep_001 \
    --status-filter failed \
    --json

# Get summary statistics from completed runs (minimize: best = lowest)
python3 scripts/result_aggregator.py \
    --campaign-dir ./sweep_001 \
    --metric final_energy \
    --json

# Maximization metric: best = highest value (yield, accuracy, throughput)
python3 scripts/result_aggregator.py \
    --campaign-dir ./sweep_001 \
    --metric yield \
    --maximize \
    --json

Conversational Workflow Example

User: I want to run a parameter sweep on dt and kappa for my phase-field simulation. I want to try 5 values of dt between 1e-4 and 1e-2, and 4 values of kappa between 0.1 and 1.0.

Agent workflow:

  1. Calculate total runs: 5 x 4 = 20 runs
  2. Generate sweep configurations:
    bash
    python3 scripts/sweep_generator.py \
        --base-config simulation.json \
        --params "dt:1e-4:1e-2:5,kappa:0.1:1.0:4" \
        --method linspace \
        --output-dir ./dt_kappa_sweep \
        --json
  3. Initialize campaign:
    bash
    python3 scripts/campaign_manager.py \
        --action init \
        --config-dir ./dt_kappa_sweep \
        --command "python phase_field.py --config {config}" \
        --json
  4. After user runs simulations, aggregate results:
    bash
    python3 scripts/result_aggregator.py \
        --campaign-dir ./dt_kappa_sweep \
        --metric interface_width \
        --json

Error Handling

ErrorCauseResolution
Base config not foundInvalid file pathVerify base config file exists
Invalid parameter formatMalformed param stringUse format name:min:max:count or name:min:max
Output directory existsWould overwriteUse --force or choose new directory
No completed jobsNo results to aggregateWait for jobs to complete or check for failures
Metric not foundResult files missing fieldVerify metric name in result JSON

Integration with Other Skills

The simulation-orchestrator works with other simulation-workflow skills:

parameter-optimization          simulation-orchestrator
        │                              │
        │ DOE samples ────────────────>│ Generate configs
        │                              │
        │                              │ Run simulations
        │                              │
        │<──────────────────────────── │ Aggregate results
        │                              │
        │ Sensitivity analysis         │
        │ Optimizer selection          │

Typical Combined Workflow

  1. Use parameter-optimization/doe_generator.py to get sample points
  2. Use simulation-orchestrator/sweep_generator.py to create configs
  3. Run simulations (user's responsibility)
  4. Use simulation-orchestrator/result_aggregator.py to collect results
  5. Use parameter-optimization/sensitivity_summary.py to analyze

Verification checklist

Before trusting a campaign's best_run or summary statistics, record concrete evidence for each item:

  • Confirmed the swept key path actually changed the value the solver reads: opened at least one generated config_NNNN.json and verified the swept parameter (e.g. parameters.kappa) holds the expected value at the expected nesting level, not a duplicate unused top-level key (sweep_generator.py writes by key path).
  • Reconciled job accounting from result_aggregator.py --json: recorded summary.total_jobs, summary.completed, and summary.failed, and confirmed completed + failed == total_jobs. Any shortfall means runs were silently skipped (missing result file or extract_metric returned None) and must be investigated, not ignored.
  • Confirmed completed > 0 and that the recorded summary.metric matches the field the solver actually writes. A typo'd or absent metric makes extract_metric return None, yielding zero completed runs with no error.
  • Recorded summary.minimize and confirmed it matches the intended direction (default minimize; --maximize for yield/accuracy/throughput) before quoting best_run.
  • Did NOT treat job_tracker.py "completed" as physical success: it flags a job completed purely from a result-file's existence and stamps exit_code 0 — independently checked the run's real exit status / solver logs for non-zero codes or NaN/Inf output.
  • Applied an outlier/sanity check to the metric values (e.g. Tukey 1.5x IQR from references/aggregation_methods.md) and confirmed best_run.value is physically plausible, not a crashed run that emitted a spurious extremum.
  • For LHS sweeps, recorded the --seed used and saved manifest.json (parameter bounds, total_runs, parameter_space) so the sample set is reproducible.

Common pitfalls & rationalizations

Tempting shortcutWhy it's wrong / what to do
"The job tracker says completed, so the run succeeded."job_tracker.py marks "completed" whenever a result file exists and hard-codes exit_code 0 — it never reads the actual exit code. A crashed run that wrote a partial result file looks identical to a clean one. Check the solver's real exit status and output validity.
"completed is high, so I have all my results."Jobs with a missing result file or a metric that extract_metric can't read are silently skipped — neither counted as completed nor failed. Reconcile completed + failed against total_jobs; a gap means lost runs.
"Aggregation returned a best_run, so that's the optimum."By default the aggregator minimizes. If higher is better you must pass --maximize, or best_run is the worst point. Always record summary.minimize and confirm the direction.
"I swept kappa, so the runs vary."sweep_generator.py writes by key path. If the base config nests the value under parameters.kappa but you sweep the bare name kappa, every config keeps the original nested value and gains an unused top-level key — the sweep is scientifically meaningless. Sweep the exact dotted path the solver reads.
"The metric name is close enough."A misspelled or absent metric makes extract_metric return None for every run, so completed is 0 and statistics are empty — with no error raised. Verify the metric matches the solver's output field exactly.
"Grid covers everything, so use it for all my parameters."Grid is n^d — it explodes exponentially (4 params x 10 = 10,000 runs). For 4+ dimensions use lhs with a deliberate budget; reserve grid for 1-3 parameters.
"LHS is random, so I don't need to record anything."LHS is reproducible only with a fixed --seed. Without recording the seed (and manifest.json), the sample set cannot be regenerated or defended.

Security

Input Validation

  • Metric names (result_aggregator.py --metric) are validated against [a-zA-Z_][a-zA-Z0-9_.]* to prevent traversal or injection via crafted keys
  • Swept parameter names (sweep_generator.py --params) are validated against [a-zA-Z_][a-zA-Z0-9_]*(.[a-zA-Z_][a-zA-Z0-9_]*)* (dot notation for nested keys); invalid names are rejected
  • campaign_manager.py validates command templates to reject shell chaining operators (;, |, &, backticks, $)
  • --params format strings are parsed and validated (name:min:max:count with finite numeric bounds — NaN/Inf rejected — min < max, and positive integer counts capped at 100,000); at most 32 parameters per sweep
  • --method is validated against a fixed allowlist (grid, linspace, lhs)
  • --samples is validated as a positive integer with an upper bound (max 1,000,000)
  • --action is validated against a fixed allowlist (init, status, list); for the read-only list action, --status-filter is validated against pending, running, completed, failed

File Access

  • sweep_generator.py reads a single base config file (JSON) specified by --base-config and writes generated configs to --output-dir
  • result_aggregator.py enforces a 10 MB file-size limit per result file, maximum JSON nesting depth, and strict numeric type checking (rejects bool, NaN, Inf)
  • All string values from result files are sanitized (truncated, control characters stripped) before surfacing them
  • Config paths interpolated into shell commands are validated against a safe-character allowlist and escaped with shlex.quote()

Tool Restrictions

  • Read: Used to inspect script source, references, base configs, and campaign status files
  • Write: Used to save generated sweep configs, campaign manifests, and aggregated results; writes are scoped to the user's working directory
  • Grep/Glob: Used to locate campaign files, result files, and search references
  • The skill's allowed-tools excludes Bash to prevent the agent from executing arbitrary commands when processing untrusted simulation outputs

Safety Measures

  • No eval(), exec(), or dynamic code generation
  • All subprocess calls use explicit argument lists (no shell=True)
  • Reduced tool surface (no Bash) limits the agent to read/write operations only
  • Command templates are validated but never executed by the skill itself; execution is the user's responsibility

Limitations

  • Not a job scheduler: Does not submit jobs to SLURM/PBS; generates configs and tracks status
  • No parallel execution: User must run simulations externally (can use GNU parallel, SLURM, etc.)
  • File-based tracking: Status tracked via files; no database or real-time monitoring
  • Local filesystem: Assumes all files accessible from local machine

References

  • references/campaign_patterns.md - Common campaign structures
  • references/sweep_strategies.md - Parameter sweep design guidance
  • references/aggregation_methods.md - Result aggregation techniques

Version History

  • v1.1.4 (2026-10-19): Preserve failure evidence and unknown exit codes, reject corrupt outputs, and retain small physical statistics without rounding.

See CHANGELOG.md for the authoritative, dated history. Summary:

  • v1.1.3 (2026-06-24): Added a Verification checklist and a Common pitfalls & rationalizations section grounded in the scripts' real behavior (result-file-only "completed" detection, silent skip of unreadable metrics, minimize-by-default direction, key-path merge semantics)
  • v1.1.1 (2026-06-23): Dot-notation nested overrides in sweep_generator.py, input-validation hardening (--params name/finite/count caps, --samples bounds), documented --maximize and the list action, corrected Script Outputs table and worked-example numbers
  • v1.1.0 (2026-03-26): Standardized metadata, evaluation suite, security review, CHANGELOG
  • v1.0.0 (2026-02-25): Initial release with sweep, campaign, tracking, and aggregation

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Simulation Orchestrator làm được gì?

Điều phối các chiến dịch gồm nhiều mô phỏng — tạo cấu hình quét tham số (lưới, linspace hoặc lấy mẫu Latin Hypercube), khởi chạy và theo dõi các chiến dịch tác vụ hàng loạt, giám sát trạng thái hoàn tất của tác vụ, rồi tổng hợp kết quả bằng các thống kê tóm tắt cho mọi lần chạy. Dùng khi khảo sát tham số với dt, kappa hoặc các đầu vào mô phỏng khác; quản lý hàng chục hoặc hàng trăm cấu hình mô phỏng; kết hợp đầu ra từ các lần chạy hàng loạt đã hoàn tất để tìm kết quả tốt nhất; hoặc tự động hóa quy trình tạo-chạy-thu thập cho các nghiên cứu có hệ thống — kể cả khi người dùng chỉ nói “Tôi cần...

Vì sao nên dùng Simulation Orchestrator trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Simulation Orchestrator là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Simulation Orchestrator trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/HeshamFS/materials-simulation-skills/tree/main/skills/simulation-workflow/simulation-orchestrator. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Simulation Orchestrator?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Simulation Orchestrator với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Simulation Orchestrator với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Simulation Orchestrator có miễn phí không?

Có. Kỹ năng này được HeshamFS phát hành trên GitHub theo giấy phép Apache-2.0. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇