Install
openclaw skills install @zkeviny/mgc-task-chain-meta-skill-enA single-device multi-Agent task chain collaboration methodology based on MGC. Through Master Agent orchestration, Script Agent scripting, and Executor Agent execution, achieves zero-exposure security collaboration for sensitive resources. Adapted to MGC 1.4.10.
openclaw skills install @zkeviny/mgc-task-chain-meta-skill-enA single-device multi-Agent task chain collaboration methodology based on MGC. Through Master Agent orchestration, Script Agent scripting, and Executor Agent execution, achieves zero-exposure security collaboration for sensitive resources.
| Pain Point | Solution |
|---|---|
| Multiple Agents sharing environment, keys easily leaked | Store keys in MGC, agents execute without exposure |
| Script content exposed to all Agents | Store scripts in MGC, zero exposure during execution |
| Lack of task collaboration methodology | Master Agent task chain orchestration template |
| Sub-Agent unauthorized access to sensitive resources | Executor Agent prompt constraints |
MGC is the local sensitive resource hosting and execution layer (skill_spec.md §1):
mgc_open_webui)mgc_save (MGC 1.4.10 auto-parses argparse defaults into ext02)mgc_run, never touches keys or scripts| Role | Responsibility | Capabilities |
|---|---|---|
| User | Store keys/scripts, issue commands | WebUI / mgc_open_webui |
| Master Agent | Task decomposition, orchestration, execute on authorization/sub-Agent failure | mgc_list, mgc_find, mgc_run |
| Script Agent | Write scripts, store in MGC | mgc_save, mgc_list, mgc_find |
| Executor Agent | Complete non-sensitive tasks | mgc_run, mgc_list, mgc_find |
Note:
mgc_getretrieves plaintext and is a sensitive operation requiring user authorization; Script Agent typically does not need it.
User ──Store Keys/Scripts (WebUI)──> MGC
│
▼
User ──Issue Command──> Master Agent
│
├──Decompose Task Chain
│
▼
┌───────┴───────┐
▼ ▼
Script Agent Executor Agent
(Write Scripts) (Execute Tasks)
│ │
▼ ▼
mgc_save mgc_run
│ │
└───────┬───────┘
▼
MGC Execution
(Return pid+status)
pip install mgc-blackbox>=1.4.9mgc (API port 57219, WebUI port 57218){
"mcpServers": {
"mgc-blackbox": {
"command": "mgc",
"args": ["--mcp"],
"env": { "PYTHONIOENCODING": "utf-8" }
}
}
}
mgc_open_webui: API keys, database credentials, business scriptsSandbox mode (1.4.9+): When running inside a sandbox Agent (Trae Work / Workbuddy), install MGC in the system environment; otherwise MCP operations may be limited — in that case, call FastAPI directly.
Load prompts/master_agent.md into the Master Agent's system prompt.
Load prompts/script_agent.md.
Load prompts/executor_agent.md.
After user issues a command, the Master Agent automatically decomposes the task chain and coordinates sub-Agents.
| File | Purpose |
|---|---|
| prompts/master_agent.md | Master Agent: task decomposition, orchestration, mgc_find lookup |
| prompts/script_agent.md | Script Agent: mgc_save to store scripts, mgc_find for collision check |
| prompts/executor_agent.md | Executor Agent: mgc_run to execute scripts |
| prompts/cooperation_best_practice.md | Best-practice document, auto-maintained by Master Agent |
# Store script (ext01 required; ext02 optional — MGC 1.4.10 auto-parses argparse defaults)
mgc_save(
info_type="script",
info_owner="Data Query Script",
ext01="python",
content="""import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--query', default='default')
args = parser.parse_args()
print(args.query)"""
)
Used to fuzzy-match entries by info_owner / diff fields. Never returns content plaintext.
# Find scripts whose owner contains "query"
scripts = mgc_find(info_owner="query", match_mode="substring", limit=50)
# match_mode: substring (%x%) / prefix (x%) / suffix (%x) / exact (x)
⚠️ Important (1.4.10 contract):
ext02must be a JSON array string, matching the script'sargparseargv list. Dict-style{"k":"v"}is no longer accepted and triggers HTTP 422.Auto-parsing: After Script Agent stores a script, MGC auto-fills
ext02fromargparsedefaults. Executor Agent can omitext02to use defaults.
import json
# Recommended: build JSON array string with json.dumps
params = ["--query", "2026-08-08"]
result = mgc_run(
info_type="script", # required, type is script
info_owner="Data Query Script", # required, script name
diff_1="v1", # required to uniquely identify when multiple entries share the owner
ext02=json.dumps(params) # optional JSON array string: '["--query", "2026-08-08"]'
)
# Returns: {"pid": 12345, "status": "started"}
# Note: mgc_run does not return stdout; for results, the script should write to a file and print the path
Note:
mgc_listonly lists entry metadata. Since 1.4.10 prefermgc_findfor fuzzy lookup.
scripts = mgc_list(info_type="script")
Used to have AI open MGC WebUI for users to store sensitive resources.
mgc_open_webui()
Since MGC 1.4.10, when storing a script it auto-parses argparse literal defaults and stores them as a JSON array string in ext02:
# After Script Agent's mgc_save, MGC auto-fills ext02:
# '["--start", "2026-08-08", "--verbose"]'
# Executor Agent can omit ext02 to use defaults
mgc_run(info_owner="my_script", diff_1="my_script")
# Or override at runtime
mgc_run(
info_owner="my_script",
diff_1="my_script",
ext02='["--start", "2026-12-25"]'
)
Dynamic defaults are not supported (e.g. datetime.now(), os.path.expanduser("~"), f-strings). MGC returns dynamic_args_detected warning and asks you to set ext02 manually. Script Agent should always use literal defaults.
mgc_run; must never read script contentext02 must be a JSON array string (e.g. ["--flag","value"]); never use dict-style| Question | Answer |
|---|---|
| Will information stored in MGC sync to cloud? | MGC is a local tool with no active network capability |
| What are MGC's main capabilities? | After installing MGC, click the MGC Skills button (1.4.7+) in the WebUI top bar |
| Can sub-Agents bypass MGC? | Prompt constraints cannot fully prevent; ensure sub-Agents cannot access local script files |
| How to isolate scripts for different tasks? | Use info_owner naming, e.g., TaskA_QueryScript, TaskB_PublishScript |
| How does Master Agent know what scripts are available? | Use mgc_find (fuzzy) or mgc_list (exact), or have Script Agent report |
mgc_run returns HTTP 422, what to do? | ext02 must be a JSON array string; use json.dumps(["--flag","value"]) |
How to handle dynamic_args_detected warning? | Use literal defaults (not datetime.now() etc.) or pass ext02 manually |
| MCP unavailable in sandbox mode? | Install MGC in system environment, or call FastAPI directly at /api/mgc/sensitive/run |
pip install mgc-blackbox>=1.4.9~/.mgc/database/mgc_black_box/.mgc_tokenmgc_run ext02 signature: must be a JSON array stringmgc_find fuzzy search toolext02 auto-parsing (1.4.10)mgc_run returns only pid+status (no stdout)