Swmm Anywhereのロゴ

Swmm Anywhere

コミュニティ
Zhonghao1995
swmm-anywhere

Synthesize a plausible SWMM drainage network from public data (OSM streets + DEM) when NO real pipe-network data exists — input is just a bbox. Use ONLY when the user has no pipe shapefile/CAD/GIS data, or to establish a baseline before real data arrives; if real pipe data exists, route to swmm-network or swmm-gis instead.

概要

公開者Zhonghao1995
リポジトリagentic-swmm-workflow
スキル名swmm-anywhere
スター
33
フォーク
15
同梱ファイル
2
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 2個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    Zhonghao1995がGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Swmm Anywhere」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/Zhonghao1995/agentic-swmm-workflow/tree/main/skills/swmm-anywhere
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Zhonghao1995/agentic-swmm-workflow.git /tmp/agentic-swmm-workflow
mkdir -p .claude/skills
cp -r /tmp/agentic-swmm-workflow/skills/swmm-anywhere .claude/skills/swmm-anywhere
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでSwmm Anywhereを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にSwmm Anywhereを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Swmm Anywhereは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

swmm-anywhere

Synthesize a plausible SWMM drainage network from public data (OSM streets + DEM) when no real pipe-network data exists.

Use ONLY when the user explicitly does not have pipe shapefile / CAD / GIS data, or when establishing a baseline before real data arrives. Do NOT use if swmm-gis or swmm-network can run on the user's actual data — the synthesized network is an inferred plausibility, not measured infrastructure.

For bbox-only inputs without real pipe data: this is the right skill. For inputs that include a .shp, .csv, or network.json of real pipes: route to swmm-network or swmm-gis instead.

What this skill does

Given a bounding box (and optional region name), this skill:

  1. Downloads public source data via SWMManywhere: OpenStreetMap streets, a DEM tile (Planetary Computer by default), building footprints, river lines.
  2. Snapshots the raw inputs under runs/<date>/<id>/00_raw/ with a SHA-256 manifest that is verified after capture (the result lands in synth_provenance.json under raw_snapshot_verified), so the exact OSM/DEM inputs that produced this run are pinned and audited (OSM/DEM otherwise drift continuously upstream).
  3. Runs SWMManywhere's 24-step graph pipeline to infer subcatchment polygons, manhole nodes, pipe topology, pipe diameters, and outfall locations.
  4. Writes a SWMM 5.2 .inp under runs/<date>/<id>/10_upstream/swmmanywhere/synth.inp (the canonical upstream box, ADR-0004), post-processed so the aiswmm swmm5 binary can run it directly (external storm.dat is copied next to the INP and its path is rewritten as relative, dodging the macOS path-with-spaces parsing bug).
  5. Returns the INP path, raw-snapshot manifest path, and a structured provenance record (which graphfcns ran, parameter overrides used, upstream tool versions).

The synthesized INP is immediately runnable through swmm-runner and immediately auditable through swmm-experiment-audit.

Required inputs

  • --bbox: four floats min_lon min_lat max_lon max_lat (WGS84). 1×1 km is a comfortable test size; smaller is faster and uses less RAM, larger needs more.
  • --run-dir: target audit-pipeline directory; defaults to runs/<today>/<HHMMSS>_swmm_anywhere/.

Optional inputs

  • --refresh-raw: reserved flag for a future cache-aware path. Today every call re-downloads OSM/DEM via SWMManywhere's own prepare_data; aiswmm does not yet replay a run from the 00_raw/ snapshot, so this flag has no effect at the aiswmm layer yet.
  • --project-name: human-readable label embedded in the manifest.
  • --config-overrides: JSON object of per-call SWMManywhere parameter overrides to adjust the synthesis (cure orphan nodes, tune pipe density). See Adjusting the synthesis below. The synth_swmm_from_bbox agent tool exposes the same as a config_overrides argument.

Defaults — tuned for fewer, more useful outfalls

The skill ships with outfall_derivation parameters tuned in spike 04 (A/B'd against SWMManywhere defaults on the same 1×1 km London Greenwich bbox):

ParameterSWMManywhere defaultThis skillEffect
outfall_derivation.methodseparatewithtopoOutfall ids decided jointly with topology derivation rather than via independent MST. ~34 % fewer outfalls in the spike test.
outfall_derivation.river_buffer_distance150 m300 mMore street nodes can pair with the same river segment, so sub-networks merge.
outfall_derivation.outfall_length40200Stronger penalty against selecting additional outfalls.

On the spike bbox these defaults dropped outfalls from 50 to 33 (-34 %), grew pipes from 500 to 517 (+3.4 %), and shortened end-to-end runtime from 40 s to 32 s. The defaults can be overridden per call.

Adjusting the synthesis — orphan nodes, too many / too few pipes

When the structural QA step (network_qa.py --inp ..., step 1 of What to do next) flags isolated_node / no_outfall_path nodes, or the pipe count looks off, tune SWMManywhere's parameters and re-synthesise. Pass overrides per call — CLI --config-overrides '<json>', or the synth_swmm_from_bbox tool's config_overrides argument — shape {group: {param: value}}. The runner merges them onto the resolved config and re-runs the pipeline.

SymptomKnob (group.field)DefaultTurn it
Orphan / no_outfall_path nodesoutfall_derivation.outfall_length200Lower toward the upstream 40 → more outfalls, fewer orphans. This skill's tuned 200 suppresses outfalls (see Defaults above), so it is the first suspect for orphan nodes.
Orphan nodesoutfall_derivation.river_buffer_distance300Raise (≤ 500) → streets pair with a river segment more easily.
Orphan nodes (quick reset)all three outfall defaults—Pass upstream_defaults: true (tool) / --upstream-defaults (CLI) to drop aiswmm's tuned overrides and use SWMManywhere's separate / 150 / 40 in one switch.
Too many pipessubcatchment_derivation.node_merge_distance10Raise (≤ 39.9, must stay < max_street_length) → merges nearby nodes → fewer pipes.
Too many pipessubcatchment_derivation.max_street_length60Raise (≤ 100) → fewer street segments → fewer pipes.
Too few pipesthe two above—Lower them; or add a type to topology_derivation.allowable_networks (default [walk, drive]).

Example — more outfalls (cure orphans) and fewer pipes:

bash
python3 skills/swmm-anywhere/scripts/synth_from_bbox.py --bbox <min_lon> <min_lat> <max_lon> <max_lat> \
  --config-overrides '{"outfall_derivation": {"outfall_length": 60}, "subcatchment_derivation": {"node_merge_distance": 25}}'

SWMManywhere is nonlinear, so expect 1–2 iterations to hit a target, and keep each value inside its valid range (synthesis errors on out-of-bounds, e.g. node_merge_distance ≥ max_street_length). Re-run the structural QA after each re-synthesis to confirm the fix.

Skill artifacts produced

runs/<date>/<id>/
├── 00_raw/                       # raw OSM/DEM/buildings snapshot
│   ├── street.json
│   ├── elevation.tif
│   ├── building.geoparquet
│   ├── river.json
│   └── raw_manifest.json         # SHA-256 of every file + source URLs
├── 10_upstream/
│   └── swmmanywhere/              # canonical upstream box (ADR-0004)
│       ├── synth.inp                 # the runnable SWMM 5.2 model
│       ├── storm.dat                 # copied alongside (path-with-spaces fix)
│       ├── nodes.geoparquet          # for visualization
│       ├── edges.geoparquet          # for visualization (color by outfall_id)
│       ├── subcatchments.geoparquet  # for visualization
│       └── synth_provenance.json     # parameters, tool versions, timings

Example invocation

Minimum: just give a bbox.

bash
# Default — uses tuned outfall_derivation defaults (33 outfalls on the spike bbox)
python skills/swmm-anywhere/scripts/synth_from_bbox.py \
    --bbox 0.04020 51.55759 0.05450 51.56660 \
    --run-dir runs/2026-05-28/100000_my_first_synth

To reproduce SWMManywhere upstream extended_demo behaviour (separate-mode outfalls):

bash
python skills/swmm-anywhere/scripts/synth_from_bbox.py \
    --bbox 0.04020 51.55759 0.05450 51.56660 \
    --upstream-defaults \
    --run-dir runs/2026-05-28/100000_upstream_replica

To use your own rainfall instead of the bundled 15-min demo storm:

bash
python skills/swmm-anywhere/scripts/synth_from_bbox.py \
    --bbox 0.04020 51.55759 0.05450 51.56660 \
    --rain-file /path/to/your/storm.dat \
    --run-dir runs/2026-05-28/100000_custom_rain

What to do next

The skill produces a runnable SWMM .inp under <run-dir>/10_upstream/swmmanywhere/synth.inp. Chain it through aiswmm's standard audit pipeline:

bash
# 1. Structural QA of the synthesized network (NO SWMM run needed) — flags
#    orphan/isolated nodes, junctions with no downstream path to an outfall,
#    and pipe/outfall counts straight off the synthesized INP. This is the
#    signal for whether to adjust SWMManywhere parameter overrides and
#    re-synthesize before spending a SWMM run on a structurally broken network.
python3 skills/swmm-network/scripts/network_qa.py --inp <run-dir>/10_upstream/swmmanywhere/synth.inp

# 2. Run SWMM (aiswmm's own swmm5 binary, NOT pyswmm)
aiswmm run --inp <run-dir>/10_upstream/swmmanywhere/synth.inp --run-dir <run-dir>/swmm_run

# 3. Audit the run
aiswmm audit --run-dir <run-dir>/swmm_run

# 4. Plausibility-review the synthesized model (NO observed data needed).
#    Reference-free: scores velocity / capacity / slope / roughness / diameter
#    against physical-plausibility bands → <run-dir>/swmm_run/11_review/.
#    Every finding is a WARN (flag-for-review); continuity stays the postflight gate's job.
aiswmm review --run-dir <run-dir>/swmm_run \
  --rules skills/swmm-design-review/rulebooks/synth_plausibility.yaml

# 5. Plot rain/runoff
aiswmm plot --run-dir <run-dir>/swmm_run

# 6. Plot a specific node or conduit (requires --link support; see swmm-plot SKILL.md)
aiswmm plot --run-dir <run-dir>/swmm_run --node <node_id> --node-attr Total_inflow

# 7. Pick a peak-flow conduit from the RPT Link Flow Summary and plot it
aiswmm plot --run-dir <run-dir>/swmm_run --link <conduit_id>

Constraints and known limits

  • Apple Silicon (macOS arm64): SWMManywhere's pyswmm dependency triggers a SIGKILL on import because its bundled swmm.toolkit._solver.abi3.so ships its own libomp.dylib that collides with the OS OpenMP runtime. The runner module stubs pyswmm before any SWMManywhere import; aiswmm runs the resulting INP through its own swmm5 binary, so the stub is fully safe.
  • OSM is mutable: the same bbox tomorrow can produce a different street graph. The 00_raw/ snapshot pins and SHA-256-verifies the exact inputs each run used, so a run stays auditable against upstream drift. (Replaying a new run from an existing snapshot — true byte-identical re-synthesis — is reserved future work; today each call re-downloads, so two runs of the same bbox can differ if OSM changed between them.)
  • Plausible ≠ real: the synthesized network reflects what a sewer system might look like under these streets and this DEM. It is a starting point for calibration / sensitivity analysis, not a substitute for surveyed infrastructure data.
  • Memory profile: end-to-end requires ~1–2 GB free RAM at peak (raster ops + numba JIT). On a constrained machine, close other apps before running large bboxes (> 2×2 km).

Installing — and credit where it's due

This skill leans on SWMManywhere, a project from the Imperial College London team that figures out a plausible urban drainage network from OSM streets and a DEM. The clever part — graph cleanup, subcatchment delineation, pipe topology, pipe sizing — is all their work, released under BSD-3-Clause. What this skill adds is the agent-loop plumbing around it: a typed tool the LLM can call, a SKILL.md contract for context priming, a Python runner that smooths over a few macOS arm64 quirks, and the standard runs/<date>/<id>/ audit layout for the resulting INP.

To install:

pip install aiswmm[anywhere]

That brings in swmmanywhere from PyPI along with the geospatial stack it needs (geopandas, osmnx, rasterio, pyflwdir, pywbt, and ~22 others). The default pip install aiswmm stays light — the geo stack only shows up when you opt in to this extra.

If you're publishing work that uses or builds on this skill, please cite SWMManywhere and check the upstream repository at https://github.com/ImperialCollegeLondon/SWMManywhere for their citation guidance and the BSD-3-Clause license text. The synthesised network is upstream's intellectual contribution; this skill is just the agent-side adapter.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Swmm Anywhere」では何ができますか?

Synthesize a plausible SWMM drainage network from public data (OSM streets + DEM) when NO real pipe-network data exists — input is just a bbox. Use ONLY when the user has no pipe shapefile/CAD/GIS data, or to establish a baseline before real data arrives; if real pipe data exists, route to swmm-network or swmm-gis instead.

TypingMindでSwmm Anywhereを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Swmm Anywhereはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにSwmm Anywhereをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/Zhonghao1995/agentic-swmm-workflow/tree/main/skills/swmm-anywhereを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Swmm Anywhereを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Swmm Anywhereで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもSwmm Anywhereを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Swmm Anywhere」は無料ですか?

はい。Zhonghao1995がMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇