---
title: "constrain"
description: "Enforce limits and policies"
canonical: "https://acs.synapti.ai/capabilities/constrain/"
last_updated: "2026-11-16T01:14:10Z"
---

# constrain

Enforce limits and policies

Generated from [schemas/capability_ontology.yaml](https://github.com/synaptiai/agent-capability-standard/blob/main/schemas/capability_ontology.yaml), [skills/constrain/SKILL.md](https://github.com/synaptiai/agent-capability-standard/blob/main/skills/constrain/SKILL.md) at commit 18c38b74ac21. Ontology version 2.2.0.

Layer: [VERIFY](https://acs.synapti.ai/layers/verify/index.md)

## Safety

| Property | Value |
| --- | --- |
| Risk | Low |
| Changes state | No |
| Needs checkpoint | No |
| Needs approval | No |
| Overridable | No |
| Blocked from autonomy | No |

**Figure: Ordering rules for constrain in a workflow.** In a workflow, it is a recommended step before execute, mutate and send; and where the workflow has generate, execute, mutate and send, constrain must come before them (V102).

| Where | Capability | Rule | Enforcement | Diagnostic |
| --- | --- | --- | --- | --- |
| After constrain | [`generate`](https://acs.synapti.ai/capabilities/generate/index.md) | `precedes` | MUST | V102 |
| After constrain | [`execute`](https://acs.synapti.ai/capabilities/execute/index.md) | `soft_requires` | SHOULD | W601 |
| After constrain | [`execute`](https://acs.synapti.ai/capabilities/execute/index.md) | `precedes` | MUST | V102 |
| After constrain | [`mutate`](https://acs.synapti.ai/capabilities/mutate/index.md) | `soft_requires` | SHOULD | W601 |
| After constrain | [`mutate`](https://acs.synapti.ai/capabilities/mutate/index.md) | `precedes` | MUST | V102 |
| After constrain | [`send`](https://acs.synapti.ai/capabilities/send/index.md) | `soft_requires` | SHOULD | W601 |
| After constrain | [`send`](https://acs.synapti.ai/capabilities/send/index.md) | `precedes` | MUST | V102 |

## Relationships

**Figure: Relationships of constrain: 11 relationships with 8 capabilities.** constrain has 11 relationships with 8 capabilities: 1 with edges into it, 6 with edges out of it, and 1 joined to it only by edges that run both ways.

| Capability | Row | Relationships |
| --- | --- | --- |
| [`plan`](https://acs.synapti.ai/capabilities/plan/index.md) | Edges into constrain | `enables` (into) |
| [`generate`](https://acs.synapti.ai/capabilities/generate/index.md) | Edges out of constrain | `precedes` (out of) |
| [`execute`](https://acs.synapti.ai/capabilities/execute/index.md) | Edges out of constrain | `soft_requires` (out of), `precedes` (out of) |
| [`mutate`](https://acs.synapti.ai/capabilities/mutate/index.md) | Edges out of constrain | `soft_requires` (out of), `precedes` (out of) |
| [`send`](https://acs.synapti.ai/capabilities/send/index.md) | Edges out of constrain | `soft_requires` (out of), `precedes` (out of) |
| [`verify`](https://acs.synapti.ai/capabilities/verify/index.md) | Either way | `alternative_to` (both ways) |
| [`checkpoint`](https://acs.synapti.ai/capabilities/checkpoint/index.md) | Edges out of constrain | `enables` (out of) |
| [`audit`](https://acs.synapti.ai/capabilities/audit/index.md) | Edges out of constrain | `enables` (out of) |

- `soft_requires`: Recommended before [`execute`](https://acs.synapti.ai/capabilities/execute/index.md), [`mutate`](https://acs.synapti.ai/capabilities/mutate/index.md), [`send`](https://acs.synapti.ai/capabilities/send/index.md)
- `enables`: Unlocks [`audit`](https://acs.synapti.ai/capabilities/audit/index.md), [`checkpoint`](https://acs.synapti.ai/capabilities/checkpoint/index.md)
- `enables`: Unlocked by [`plan`](https://acs.synapti.ai/capabilities/plan/index.md)
- `precedes`: Comes before, when both are present [`execute`](https://acs.synapti.ai/capabilities/execute/index.md), [`mutate`](https://acs.synapti.ai/capabilities/mutate/index.md), [`send`](https://acs.synapti.ai/capabilities/send/index.md), [`generate`](https://acs.synapti.ai/capabilities/generate/index.md)
- `alternative_to`: Can substitute for [`verify`](https://acs.synapti.ai/capabilities/verify/index.md)

## Contract

**Figure: Contract of constrain: 3 inputs (2 required), 8 outputs.** constrain takes 3 inputs, 2 required (filled pin) and 1 optional (hollow pin), and returns 8 outputs. The tables below list every field.

### Inputs

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `target` | any | Yes | What to constrain |
| `constraints` | array | Yes | Constraints to enforce |
| `action_on_violation` | string | No | One of: block, warn, log |

### Outputs

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `compliant` | boolean | Yes |  |
| `violations` | array | No | Constraint violations |
| `actions_taken` | array | No | Enforcement actions |
| `tally` | object | No | Review quorum count, when the step has a quorum (quorum@1, STANDARD v1.1 §5.16) |
| `tally.passes` | integer | No |  |
| `tally.blocks` | integer | No |  |
| `tally.abstains` | integer | No |  |
| `tally.full_passes` | integer | No | Passing verdicts with scope full (min_full) |
| `tally.voters` | array of string | No |  |
| `evidence_anchors` | array of Anchor (or deprecated string or object) | Yes | What the output is based on, as evidence anchors (Standard v1.2 §6.5). An empty list grounds nothing, and the output is then marked inferred (§3.1). |
| `confidence` | number | No | The producer's probability that the output's claim is correct, self-reported; given when the output is inferred (Standard v1.2 §3.1, §4.1.1) From 0 to 1 |
| `inference_method` | string | No | How the output was reached when it is not grounded in evidence; with confidence it marks the output inferred (Standard v1.2 §3.1, §4.1.1). A producer should use model_knowledge, deduction, induction, abduction, analogy, statistical, simulation, assumption or an x- vendor value; a grounding policy (§5.20) requires one of them. |
| `uncertainty` | Uncertainty | No | The uncertainty of the output's principal value; its confidence equals the output's confidence (Standard v1.2 §4.1.1) |

The skill returns 11 fields: 6 are in constrain's output contract (2 required) and 5 are the skill's own, outside the contract; it leaves out 2 contract fields (inference_method, uncertainty).

| Field of the skill's output | In the output contract |
| --- | --- |
| `constraints_applied` | No, the skill's own |
| `policy_evaluation` | No, the skill's own |
| `scope_reduction` | No, the skill's own |
| `compliant` | Yes, required |
| `violations` | Yes, optional |
| `actions_taken` | Yes, optional |
| `tally` | Yes, optional |
| `blocked_reason` | No, the skill's own |
| `confidence` | Yes, optional |
| `evidence_anchors` | Yes, required |
| `assumptions` | No, the skill's own |
| `inference_method` | Yes, but the skill leaves it out |
| `uncertainty` | Yes, but the skill leaves it out |

## Used in workflows

**Figure: constrain in workflows.** 4 workflows use constrain, in 5 steps in all; its steps are the squares in an ink ring, and the key under the strips names the other squares.

- [`debug_code_change`](https://acs.synapti.ai/workflows/debug-code-change/index.md): step 4
- [`digital_twin_sync_loop`](https://acs.synapti.ai/workflows/digital-twin-sync-loop/index.md): step 14
- [`model_deployment`](https://acs.synapti.ai/workflows/model-deployment/index.md): steps 1 and 2
- [`data_pipeline_validation`](https://acs.synapti.ai/workflows/data-pipeline-validation/index.md): step 3

## Claude Code skill

**Figure: What the constrain skill's tools can do, against the ontology.** The skill may use 2 tools: 2 only read; the ontology marks constrain as read-only, and every tool only reads.

| What they can do | Tools |
| --- | --- |
| Only read | `Read`, `Grep` |
| Run commands, which can change state | none |
| Change files | none |

**Figure: The field names each step of the constrain procedure uses.** 3 of the procedure's 6 steps use the name of an input or output field of the constrain skill as a word; 10 output fields of 11 are used by no step (constraints_applied, scope_reduction, compliant, violations, actions_taken, tally, blocked_reason, confidence, evidence_anchors, assumptions).

| Step | Inputs it uses by name | Output fields it uses by name |
| --- | --- | --- |
| 1. Identify applicable policies |  |  |
| 2. Evaluate preconditions | `target` |  |
| 3. Apply policy rules | `target` |  |
| 4. Reduce scope |  |  |
| 5. Determine enforcement action |  |  |
| 6. Ground claims |  | `policy_evaluation` |

All 3 examples of the skill write out the same 10 of its 11 output fields, and none writes out tally.

**Figure: The neighbours the skill lists for constrain, checked against the ontology and the catalogs.** The skill lists 6 capabilities as common neighbours of constrain; 5 of them have an edge with it in the ontology, and 2 run next to it, in that order, in a catalog workflow (checkpoint most often, 2 times). Under each tile, an edge reads from its source to its target, with constrain's symbol in its place: "requires Cn" is a requires edge from the tile's capability to constrain, so the tile's capability must run before constrain; "Cn precedes" is a precedes edge from constrain to the tile's capability.

| Listed as | Capability | Ontology edge | Next to it in a workflow |
| --- | --- | --- | --- |
| commonly follows | [`plan`](https://acs.synapti.ai/capabilities/plan/index.md) | `enables` | 1 times |
| commonly follows | [`critique`](https://acs.synapti.ai/capabilities/critique/index.md) | none | never |
| commonly precedes | [`checkpoint`](https://acs.synapti.ai/capabilities/checkpoint/index.md) | `enables` (into it) | 2 times |
| commonly precedes | [`send`](https://acs.synapti.ai/capabilities/send/index.md) | `soft_requires` (into it), `precedes` (into it) | never |
| commonly precedes | [`execute`](https://acs.synapti.ai/capabilities/execute/index.md) | `soft_requires` (into it), `precedes` (into it) | never |
| commonly precedes | [`mutate`](https://acs.synapti.ai/capabilities/mutate/index.md) | `soft_requires` (into it), `precedes` (into it) | never |

### Intent

Execute **constrain** to evaluate proposed actions against defined policies, enforce permission boundaries, and reduce scope to the minimum required for safe operation. This is the gatekeeper that prevents unsafe actions before they execute.

**Success criteria:**
- All relevant policies evaluated for the proposed action
- Clear allow/deny decision with rationale
- Scope reduced to minimum necessary permissions
- Violation actions documented (block, warn, log)

**Compatible schemas:**
- `schemas/output_schema.yaml`

### Inputs

| Parameter | Required | Type | Description |
|-----------|----------|------|-------------|
| `target` | Yes | any | What to constrain |
| `constraints` | Yes | array | Constraints to enforce |
| `action_on_violation` | No | string | What to do on a violation: `block`, `warn`, or `log` |

Inputs not listed here are outside the capability's contract: a workflow step that binds them gets W604 (STANDARD v1.1 §5.5).

In a workflow, a constrain step that blocks can count independent reviews
with a `quorum` (Standard v1.1 `quorum@1`): earlier `delegate` steps are
the reviewers, and the output gains a `tally` of passes, blocks,
abstentions, full-sweep passes and voters. See
[ORCHESTRATION_EXTENSIONS.md](https://acs.synapti.ai/guides/orchestration-extensions/index.md).

### Procedure

1) **Identify applicable policies**: Find all policies relevant to the action
   - Load policy definitions from `.policies/` or policy registry
   - Match action type to policy triggers
   - Consider context (user role, environment, time) for policy selection

2) **Evaluate preconditions**: Check if action meets basic safety requirements
   - Is action within workspace boundaries?
   - Does action target sensitive resources (.env, credentials)?
   - Is checkpoint required but missing?
   - Is approval required but not obtained?

3) **Apply policy rules**: Evaluate each policy condition
   - Parse policy conditions (AND/OR/NOT expressions)
   - Check each condition against the target action's parameters
   - Record which conditions pass and which fail
   - Determine overall policy verdict (allow/deny/conditional)

4) **Reduce scope**: Apply least privilege principle
   - Identify minimum permissions needed for action
   - Remove unnecessary permissions from scope
   - Document removed permissions and rationale

5) **Determine enforcement action**: Based on policy verdict
   - `block`: Prevent action from executing
   - `warn`: Allow but alert user to risk
   - `log`: Record violation but allow action

6) **Ground claims**: Document policy evaluation evidence
   - Format: `policy:<policy_id>:<condition>`, decision rationale
   - Include any scope reductions applied

### Output Contract

Return a structured object:

```yaml
constraints_applied:
  - name: string  # Policy or constraint name
    type: policy | permission | rate_limit | scope
    target: string  # What the constraint applies to
    enforced: boolean  # Whether constraint was enforced
    violation_action: block | warn | log
policy_evaluation:
  policy_id: string  # Which policy was evaluated
  result: allow | deny | conditional
  conditions_met: array[string]  # Conditions that passed
  conditions_failed: array[string]  # Conditions that failed
scope_reduction:
  original_scope: object  # Permissions before constraining
  constrained_scope: object  # Permissions after constraining
  removed_permissions: array[string]  # What was removed
compliant: boolean  # Overall go/no-go: false when any violation is enforced with `block`
violations:  # Constraint violations (any enforcement level)
  - constraint: string  # Which constraint was violated
    detail: string  # What failed
    action: block | warn | log  # Enforcement applied
actions_taken: array[string]  # Enforcement actions performed (block, warn, log, scope reduction)
tally:  # Only when the step has a quorum (quorum@1)
  passes: integer
  blocks: integer
  abstains: integer
  full_passes: integer
  voters: array[string]
blocked_reason: string | null  # Why blocked (if applicable)
confidence: number  # probability that the verdict is right under the policy (§4.1.1)
evidence_anchors: [{ref: "policy:...", kind: record}, {ref: "file:...", kind: file}]
assumptions: []
```

#### Field Definitions

| Field | Type | Description |
|-------|------|-------------|
| `constraints_applied` | array | List of constraints evaluated and their enforcement |
| `policy_evaluation` | object | Result of primary policy evaluation |
| `scope_reduction` | object | How permissions were reduced |
| `compliant` | boolean | Overall decision: true when no violation is enforced with `block`, so the action can proceed (workflows gate on `${<step>.compliant}`) |
| `violations` | array | Constraint violations, each with the enforcement applied; `warn`/`log` violations leave `compliant` true |
| `actions_taken` | array | Enforcement actions performed |
| `tally` | object | Review quorum count (passes, blocks, abstains, full_passes, voters); present only when the step has a `quorum` |
| `blocked_reason` | string | Explanation if action is blocked |
| `confidence` | number | Probability, 0.0-1.0, that the verdict is right under the policy (§4.1.1) |
| `evidence_anchors` | array of evidence anchors (§6.5) | References to policies evaluated |
| `assumptions` | array | Policy assumptions made |

### Examples

#### Example 1: Constrain File Access to Safe Boundaries

**Input:**
```yaml
target:
  capability: "mutate"
  target: "/etc/passwd"
  parameters:
    content: "..."
constraints: ["workspace_boundary", "sensitive_file_protection"]
action_on_violation: block
```

**Output:**
```yaml
constraints_applied:
  - name: "workspace_boundary"
    type: scope
    target: "/etc/passwd"
    enforced: true
    violation_action: block
  - name: "sensitive_file_protection"
    type: policy
    target: "/etc/passwd"
    enforced: true
    violation_action: block
policy_evaluation:
  policy_id: "sys_file_protection"
  result: deny
  conditions_met: []
  conditions_failed:
    - "path must be within workspace"
    - "system files are read-only"
scope_reduction:
  original_scope:
    paths: ["/**"]
  constrained_scope:
    paths: ["/workspace/**"]
  removed_permissions:
    - "write to system paths"
compliant: false
violations:
  - constraint: "workspace_boundary"
    detail: "path must be within workspace"
    action: block
  - constraint: "sensitive_file_protection"
    detail: "system files are read-only"
    action: block
actions_taken:
  - "block: mutate /etc/passwd"
  - "scope reduced to /workspace/**"
blocked_reason: "Action targets system file outside workspace boundary. Editing /etc/passwd is prohibited."
confidence: 1.0
evidence_anchors:
  - {ref: "policy:workspace_boundary:path_check", kind: record}
  - {ref: "policy:sys_file_protection:sensitive_paths", kind: record}
assumptions: []
```

**Evidence pattern:** Policy definitions, path matching against workspace boundary.

---

#### Example 2: Constrain API Call with Rate Limiting

**Input:**
```yaml
target:
  capability: "send"
  target: "https://api.external.com/data"
  parameters:
    method: "POST"
    payload: {...}
constraints: ["external_api_rate_limit", "checkpoint_before_send"]
action_on_violation: warn
```

Session `abc123` has already made 95 requests this hour.

**Output:**
```yaml
constraints_applied:
  - name: "external_api_rate_limit"
    type: rate_limit
    target: "api.external.com"
    enforced: true
    violation_action: warn
  - name: "checkpoint_before_send"
    type: policy
    target: "send capability"
    enforced: true
    violation_action: block
policy_evaluation:
  policy_id: "external_communication"
  result: conditional
  conditions_met:
    - "destination is allowed domain"
    - "payload size within limits"
  conditions_failed:
    - "approaching rate limit (95/100 this hour)"
scope_reduction:
  original_scope:
    rate_limit: 100
    burst_allowed: true
  constrained_scope:
    rate_limit: 5
    burst_allowed: false
  removed_permissions:
    - "burst requests"
compliant: true
violations:
  - constraint: "external_api_rate_limit"
    detail: "approaching rate limit (95/100 this hour)"
    action: warn
actions_taken:
  - "warn: 95/100 requests used this hour"
  - "scope reduced: rate limit 5, no burst"
blocked_reason: null
confidence: 0.9
evidence_anchors:
  - {ref: "policy:external_api_rate_limit:hourly_quota", kind: record}
  - {ref: "context:requests_this_hour:95", kind: record}
assumptions:
  - "Rate limit counter is accurate"
  - "Hour boundary resets at :00"
```

---

#### Example 3: Constrain Before Execute

**Input:**
```yaml
target:
  capability: "execute"
  target: "refactor_handlers_plan"
  parameters:
    plan_id: "plan_20240115_refactor"
constraints: ["checkpoint_required"]
action_on_violation: block
```

**Output:**
```yaml
constraints_applied:
  - name: "checkpoint_required"
    type: policy
    target: "execute"
    enforced: true
    violation_action: block
policy_evaluation:
  policy_id: "mutation_safety"
  result: conditional
  conditions_met:
    - "plan exists and is valid"
    - "files in scope are editable"
  conditions_failed:
    - "checkpoint not found for scope"
scope_reduction:
  original_scope:
    mutation_allowed: true
  constrained_scope:
    mutation_allowed: false
  removed_permissions:
    - "file mutation (pending checkpoint)"
compliant: false
violations:
  - constraint: "checkpoint_required"
    detail: "checkpoint not found for scope"
    action: block
actions_taken:
  - "block: execute refactor_handlers_plan until checkpoint exists"
blocked_reason: "This execute step mutates files (requires_checkpoint: true). Call 'checkpoint' first with scope matching the plan."
confidence: 1.0
evidence_anchors:
  - {ref: "policy:mutation_safety:checkpoint_gate", kind: record}
  - {ref: "file:composition_patterns.md:CAVR", kind: file}
assumptions: []
```

### Verification

Apply the following verification patterns:

- [ ] **Policy Coverage**: All applicable policies were evaluated
- [ ] **Evidence Grounding**: Decisions linked to specific policy conditions
- [ ] **Scope Reduction Valid**: Constrained scope is subset of original
- [ ] **Safety Boundary Check**: No sensitive files in allowed scope

**Verification tools:** Read (for policy files), Grep (for policy search)

### Safety Constraints

- `mutation`: false (constrain is evaluation only)
- `requires_checkpoint`: false
- `requires_approval`: false
- `risk`: low

**Capability-specific rules:**
- Always evaluate workspace boundary policy
- Always check for sensitive file patterns (.env, credentials, secrets, .pem, .key)
- Apply strictest enforcement when ambiguous
- Never downgrade enforcement level silently
- Log all policy evaluations for audit

### Composition Patterns

**Commonly follows:**
- `plan` - Constrain the planned actions before checkpoint
- `critique` - After identifying risks, constrain to mitigate

**Commonly precedes:**
- `checkpoint` - After constrain approves, create checkpoint
- `send` - REQUIRED: constrain before any external communication
- `execute` / `mutate` - Constrain as part of pre-execution checks (constrain must precede them)

**Anti-patterns:**
- CRITICAL: Never skip constrain before send (no unchecked external comms)
- Never ignore blocked_reason and proceed anyway
- Never silently weaken policy enforcement
- Never evaluate constrain after mutation has begun

**Workflow references:**
- See `reference/composition_patterns.md#digital-twin-sync-loop` for constrain-before-act
- See `reference/composition_patterns.md#risk-assessment` for constrain placement
- See `reference/verification_patterns.md#pattern-6-safety-boundary-check` for boundary checks
