agentmon-policy-create
Use when creating a new AgentMon security policy, including agent sandboxes, CI pipelines, development environments, HTTP service gateways, or Postgres-family database access policies
- License 许可
- Apache-2.0
- 所属仓库
- diffsec/agentmon
- 最近更新
- 2026-11-11
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- agentmon-policy-create
- description
- Use when creating a new AgentMon security policy, including agent sandboxes, CI pipelines, development environments, HTTP service gateways, or Postgres-family database access policies
03 SKILL.md 正文
Create AgentMon Policy
Overview
Create new AgentMon security policies from built-in templates, customized to the user's use case. Produces valid YAML policy files with correct structure, evaluation semantics, and defensive defaults for file, network, command, HTTP service, and Postgres-family database controls.
When to Use
- User asks to create/make/generate a new policy
- User describes a use case that needs a policy ("policy for my CI pipeline")
- User wants to set up AgentMon for the first time
- User wants controlled access to a declared HTTP API or Postgres-family database
- NOT for editing existing policies (use agentmon-policy-edit)
Flow
-
Locate policy directory
- Look for
config.ymlorconfig.yamlin the project root to findpolicies.dir - If not found, look for a
configs/policies/directory - Fall back to asking the user with AskUserQuestion
- Look for
-
Understand the use case Use AskUserQuestion to ask: "What will this policy protect?"
Use Case Template AI agent (code tasks) defaultoragent-defaultCI/CD pipeline ci-strictLocal development dev-safeStrict agent sandbox agent-sandboxObservation/profiling agent-observeDeclared HTTP API gateway Start from defaultPostgres-family database access Start from defaultCustom / other Start from default -
Select template
- Read the matching template from the policy directory (e.g.,
configs/policies/default.yaml) - On Windows, prefer the
-windowsvariant if available (e.g.,default-windows.yaml,ci-strict-windows.yaml) - If templates are not available locally, use the schema reference to generate a baseline
- Read the matching template from the policy directory (e.g.,
-
Customize Based on the template read in Step 3, ask only about gaps — skip categories the template already handles well:
- "Which domains does your app need to reach?" → add network rules
- "Any paths outside the workspace it needs?" → add file rules
- "Any commands to block or require approval?" → add command rules
- "Should any HTTP APIs be exposed through AgentMon?" → add
http_servicesplusproviderswhen credential substitution is needed - "Should any Postgres-family databases be mediated?" → add
db_services,database_connection_rules,database_rules, andpolicies.db
For database policies, ask for:
- service name, dialect (
postgres,aurora_postgres,redshift,cockroachdb), upstreamhost:port, andtls_mode - connection constraints: DB user, database name, application name, replication/cancel handling
- statement intent: read/write/admin operations, schemas/objects, catalog selectors (
relations,functions) if known - redaction preference:
policies.db.log_statements,approval_statement_preview, andapproval_statement_preview_chars - unavoidability posture:
off,observe, orenforce
-
Name & write
- Ask for a policy name
- Generate the YAML with descriptive section comments matching built-in policy style
- Write to the policy directory
-
Validate Run:
agentmon policy validate <name>If validation fails, fix and re-validate. Ifagentmonbinary is not available, warn the user to validate manually. -
Update config reminder If
config.ymlhas apolicies.allowedlist, remind the user to add the new policy name.
Guardrails
- Always use
version: 1 - Every policy must have
nameanddescription - End rule-list categories (file_rules, network_rules, command_rules) with a default-deny catch-all
- Use descriptive rule names in
verb-nounformat (e.g.,allow-npm,deny-ssh-keys) - Include section comment headers matching built-in policy style
- First match wins — place specific rules before general ones
- Do not invent runtime support for non-Postgres databases. Current DB enforcement is Postgres-family only.
- For
http_services, prefer path/method rules over broad network allows when the user needs audited API surface control. - For
database_rules, remember DB evaluation is not simple first-match-wins: any matching deny wins, non-deny rules must cover every object slot, and uncovered objects fail closed. - For Postgres
UPDATE/DELETEaccess to sensitive relations, ask whether accidental full-table mutation should be blocked. Userequire_where: trueonly on rules whoseoperationsexpand exclusively tomodifyand/ordelete; explain that it is syntactic,WHERE truestill satisfies it, and another unguarded non-deny rule can still cover the same effect. - For DB
redirect, only author safe read-only Postgres relation replacement: one canonical source inrelations,match_object_resolution: catalog_resolved, andredirect.relation.
Schema Reference
Read skills/agentmon-policy-shared/schema-reference.md for the complete policy YAML schema before generating any policy content. If this file is not accessible, proceed using only the guardrails above plus the template file read in Step 3. Do not generate policy YAML without either the schema reference or a template.
04 同仓库更多 Skills
agentmon-policy-edit
Use when adding, removing, or updating rules in an existing AgentMon policy, modifying security permissions, HTTP service declarations, Postgres-family database rules, resource limits, or policy YAML files
with-allowed
Declares allowed tools
scope-mismatch
declares read-only but writes
prompt-injection
prompt injection markers
oversized
Trips the per-file size limit
minimal
A minimal valid skill