diff --git a/.antigravity-plugin/rules/monk-safety.md b/.antigravity-plugin/rules/monk-safety.md index cee5f5c..7cd8444 100644 --- a/.antigravity-plugin/rules/monk-safety.md +++ b/.antigravity-plugin/rules/monk-safety.md @@ -14,6 +14,7 @@ needed. - Cloud deploys, destructive actions, workload shells, and credential changes require approval through `monk-agent`. +- Never pass both `mode` and `target` to `monk.project.deploy`; `target:"local"` silently deploys locally even when `mode` is `"cluster"`. Pass only `mode`. - Cluster creation, grow, peer removal, peer retagging, registry changes, exit, and delete must go through `monk.cluster.*` tools. - Never target Monk-managed `system/*` workloads. diff --git a/.antigravity-plugin/skills/monk/SKILL.md b/.antigravity-plugin/skills/monk/SKILL.md index c23605d..989805c 100644 --- a/.antigravity-plugin/skills/monk/SKILL.md +++ b/.antigravity-plugin/skills/monk/SKILL.md @@ -86,7 +86,7 @@ Prefer `monk-agent` MCP tools and resources: - `monk.rbac.role` - `monk.project.analyze` - `monk.project.configure` -- `monk.project.deploy` +- `monk.project.deploy` (never pass both `mode` and `target`; `target:"local"` silently deploys locally) - `monk.environment.list` - `monk.environment.select` - `monk.environment.delete` @@ -265,6 +265,7 @@ open the required approval flow when needed. again to verify. - Cloud deploys, destructive actions, workload shells, and credential changes require approval through `monk-agent`. +- Never pass both `mode` and `target` to `monk.project.deploy`; `target:"local"` silently deploys locally even when `mode` is `"cluster"`. Pass only `mode` (`"local"` or `"cluster"`). Confirm `monk://workspace/cluster-context` before a cluster deploy — do not add `target:"local"` as a fallback. - Workload lifecycle verbs are distinct. `load` makes templates available; `run` starts a not-yet-running workload; `update` changes a running workload; `stop` takes it offline while preserving state; `delete`/`purge` removes @@ -395,7 +396,7 @@ For a first deploy: 6. If user-provided secrets or provider credentials are required, request them through the local secure web form. 7. If deploying to cloud or making a risky change, request approval. -8. Deploy with `monk.project.deploy`. +8. Deploy with `monk.project.deploy`. Never pass both `mode` and `target`; `target:"local"` silently deploys locally even when `mode` is `"cluster"`. Pass only `mode`. 9. Verify the returned endpoint/status from outside the deploy operation. Monk usually deploys projects in 20-40 minutes. Set that expectation when diff --git a/.github/workflows/install-e2e.yml b/.github/workflows/install-e2e.yml index 1f9190b..77ba5be 100644 --- a/.github/workflows/install-e2e.yml +++ b/.github/workflows/install-e2e.yml @@ -66,6 +66,10 @@ jobs: shell: bash run: ./tests/start-monk-agent-antigravity-python-path.sh + - name: Check deploy conflicting mode+target skill guard + shell: bash + run: ./tests/deploy-conflicting-mode-target-guard.sh + windows: name: windows-latest runs-on: windows-latest diff --git a/agents/monk-deployer.md b/agents/monk-deployer.md index d702cd6..9b73133 100644 --- a/agents/monk-deployer.md +++ b/agents/monk-deployer.md @@ -121,7 +121,7 @@ with no local build), skip this section and continue from step 5 above. packages/entities to generated secret references. Consumers read generated secrets by reference through connections or entity state and must have `permitted-secrets` or equivalent package permissions. -- Deploy with `monk.project.deploy`. +- Deploy with `monk.project.deploy`. Never pass both `mode` and `target`; `target:"local"` silently deploys locally even when `mode` is `"cluster"`. Pass only `mode`. ## Cluster operations diff --git a/agents/monk-frontman.md b/agents/monk-frontman.md index ce94a9d..6bd5020 100644 --- a/agents/monk-frontman.md +++ b/agents/monk-frontman.md @@ -164,7 +164,7 @@ Blocked shell work: - Deploy-time provider and MANIFEST credentials are collected through `monk.credentials.request`; never ask the user to paste values in chat. Use `monk.secret.request` only for a single ad hoc secret with no provider - mapping. + mapping. Never pass both `mode` and `target` to `monk.project.deploy`; `target:"local"` silently deploys locally even when `mode` is `"cluster"`. Pass only `mode`. - MANIFEST `SECRET` entries are only for values the user must provide. Some packages and entities write generated secrets to named references, such as database passwords; consumers should read those references through diff --git a/plugins/monk/skills/monk/SKILL.md b/plugins/monk/skills/monk/SKILL.md index 6ff4c4d..7b09cdc 100644 --- a/plugins/monk/skills/monk/SKILL.md +++ b/plugins/monk/skills/monk/SKILL.md @@ -127,7 +127,7 @@ Prefer `monk-agent` MCP tools and resources: - `monk.rbac.role` - `monk.project.analyze` - `monk.project.configure` -- `monk.project.deploy` +- `monk.project.deploy` (never pass both `mode` and `target`; `target:"local"` silently deploys locally) - `monk.environment.list` - `monk.environment.select` - `monk.environment.delete` @@ -318,6 +318,7 @@ open the required approval flow when needed. them directly in the main agent. - Cloud deploys, destructive actions, workload shells, and credential changes require approval through `monk-agent`. +- Never pass both `mode` and `target` to `monk.project.deploy`; `target:"local"` silently deploys locally even when `mode` is `"cluster"`. Pass only `mode` (`"local"` or `"cluster"`). Confirm `monk://workspace/cluster-context` before a cluster deploy — do not add `target:"local"` as a fallback. - Workload lifecycle verbs are distinct. `load` makes templates available; `run` starts a not-yet-running workload; `update` changes a running workload; `stop` takes it offline while preserving state; `delete`/`purge` removes @@ -477,7 +478,7 @@ For a first deploy: 6. If user-provided secrets or provider credentials are required, request them through the local secure web form. 7. If deploying to cloud or making a risky change, request approval. -8. Deploy with `monk.project.deploy`. +8. Deploy with `monk.project.deploy`. Never pass both `mode` and `target`; `target:"local"` silently deploys locally even when `mode` is `"cluster"`. Pass only `mode`. 9. Verify the returned endpoint/status from outside the deploy operation. Monk usually deploys projects in 20-40 minutes. Set that expectation when diff --git a/plugins/monk/skills/monk/references/agent-workflow.md b/plugins/monk/skills/monk/references/agent-workflow.md index f7b0045..6d911cc 100644 --- a/plugins/monk/skills/monk/references/agent-workflow.md +++ b/plugins/monk/skills/monk/references/agent-workflow.md @@ -34,8 +34,8 @@ take with Monk, check official docs at `docs.monk.io` and use 10. Request deploy-time provider and MANIFEST credentials through `monk.credentials.request`; use `monk.secret.request` only for a single ad hoc secret with no provider mapping. -11. Deploy with `monk.project.deploy`; privileged tools open their own approval - flow when needed. +11. Deploy with `monk.project.deploy`. Never pass both `mode` and `target`; `target:"local"` silently deploys locally even when `mode` is `"cluster"`. + Pass only `mode`. Privileged tools open their own approval flow when needed. 12. Verify the app or workload externally. For cluster work, first resolve scope: call `monk.scope.status` and, if the diff --git a/skills/monk/SKILL.md b/skills/monk/SKILL.md index 6ff4c4d..7b09cdc 100644 --- a/skills/monk/SKILL.md +++ b/skills/monk/SKILL.md @@ -127,7 +127,7 @@ Prefer `monk-agent` MCP tools and resources: - `monk.rbac.role` - `monk.project.analyze` - `monk.project.configure` -- `monk.project.deploy` +- `monk.project.deploy` (never pass both `mode` and `target`; `target:"local"` silently deploys locally) - `monk.environment.list` - `monk.environment.select` - `monk.environment.delete` @@ -318,6 +318,7 @@ open the required approval flow when needed. them directly in the main agent. - Cloud deploys, destructive actions, workload shells, and credential changes require approval through `monk-agent`. +- Never pass both `mode` and `target` to `monk.project.deploy`; `target:"local"` silently deploys locally even when `mode` is `"cluster"`. Pass only `mode` (`"local"` or `"cluster"`). Confirm `monk://workspace/cluster-context` before a cluster deploy — do not add `target:"local"` as a fallback. - Workload lifecycle verbs are distinct. `load` makes templates available; `run` starts a not-yet-running workload; `update` changes a running workload; `stop` takes it offline while preserving state; `delete`/`purge` removes @@ -477,7 +478,7 @@ For a first deploy: 6. If user-provided secrets or provider credentials are required, request them through the local secure web form. 7. If deploying to cloud or making a risky change, request approval. -8. Deploy with `monk.project.deploy`. +8. Deploy with `monk.project.deploy`. Never pass both `mode` and `target`; `target:"local"` silently deploys locally even when `mode` is `"cluster"`. Pass only `mode`. 9. Verify the returned endpoint/status from outside the deploy operation. Monk usually deploys projects in 20-40 minutes. Set that expectation when diff --git a/skills/monk/references/agent-workflow.md b/skills/monk/references/agent-workflow.md index f7b0045..6d911cc 100644 --- a/skills/monk/references/agent-workflow.md +++ b/skills/monk/references/agent-workflow.md @@ -34,8 +34,8 @@ take with Monk, check official docs at `docs.monk.io` and use 10. Request deploy-time provider and MANIFEST credentials through `monk.credentials.request`; use `monk.secret.request` only for a single ad hoc secret with no provider mapping. -11. Deploy with `monk.project.deploy`; privileged tools open their own approval - flow when needed. +11. Deploy with `monk.project.deploy`. Never pass both `mode` and `target`; `target:"local"` silently deploys locally even when `mode` is `"cluster"`. + Pass only `mode`. Privileged tools open their own approval flow when needed. 12. Verify the app or workload externally. For cluster work, first resolve scope: call `monk.scope.status` and, if the diff --git a/tests/deploy-conflicting-mode-target-guard.sh b/tests/deploy-conflicting-mode-target-guard.sh new file mode 100755 index 0000000..49e4f95 --- /dev/null +++ b/tests/deploy-conflicting-mode-target-guard.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env sh +# Coding agents read these files before calling monk.project.deploy. +# Passing both mode and target with any local signal silently deploys +# locally even when mode is cluster (#318). Every instruction surface +# must say so, and the two packaged SKILL copies must stay identical. +set -eu + +repo="$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)" + +cmp "$repo/skills/monk/SKILL.md" "$repo/plugins/monk/skills/monk/SKILL.md" +cmp "$repo/skills/monk/references/agent-workflow.md" \ + "$repo/plugins/monk/skills/monk/references/agent-workflow.md" + +require() { + file="$1" + needle="$2" + if ! grep -F -q "$needle" "$file"; then + echo "missing '$needle' in $file" >&2 + exit 1 + fi +} + +for f in \ + "$repo/skills/monk/SKILL.md" \ + "$repo/plugins/monk/skills/monk/SKILL.md" \ + "$repo/skills/monk/references/agent-workflow.md" \ + "$repo/plugins/monk/skills/monk/references/agent-workflow.md" \ + "$repo/agents/monk-deployer.md" \ + "$repo/agents/monk-frontman.md" \ + "$repo/.antigravity-plugin/skills/monk/SKILL.md" \ + "$repo/.antigravity-plugin/rules/monk-safety.md" +do + require "$f" 'both `mode` and `target`' + require "$f" 'silently deploys locally' +done