// Rule 1: Block destructive tools in development TOOL_CALL
if (tool.annotations.destructiveHint == true && tool.annotations.launchStatus == "DEVELOPMENT") {
return BLOCK;
}
Show AST
{
"name": "Block destructive tools in development",
"type": "TOOL_CALL",
"conditions": [
{
"type": "condition",
"op": "equals",
"left": {
"segments": [
"tool",
"annotations",
"destructiveHint"
]
},
"right": {
"value": true
}
},
{
"type": "condition",
"op": "equals",
"left": {
"segments": [
"tool",
"annotations",
"launchStatus"
]
},
"right": {
"value": "DEVELOPMENT"
}
}
],
"actions": [
{
"decision": "BLOCK",
"modifiers": []
}
]
}
// Rule 2: Block OpenWorld if Workspace in History TOOL_CALL
if (tool.annotations.openWorldHint == true && tools.history.exists(iter, iter.name.contains("Workspace"))) {
return BLOCK;
}
Show AST
{
"name": "Block OpenWorld if Workspace in History",
"type": "TOOL_CALL",
"conditions": [
{
"type": "condition",
"op": "equals",
"left": {
"segments": [
"tool",
"annotations",
"openWorldHint"
]
},
"right": {
"value": true
}
},
{
"type": "condition",
"op": "any",
"left": {
"segments": [
"tools",
"history"
]
},
"iterVar": "iter",
"predicate": {
"type": "condition",
"op": "contains",
"left": {
"segments": [
"iter",
"name"
]
},
"right": {
"value": "Workspace"
}
}
}
],
"actions": [
{
"decision": "BLOCK",
"modifiers": []
}
]
}
// Rule 3: Sanitize SSN in Model Output REWRITE
if (part.content.matches("[0-9]{3}-[0-9]{2}-[0-9]{4}")) {
return REWRITE;
}
Show AST
{
"name": "Sanitize SSN in Model Output",
"type": "REWRITE",
"conditions": [
{
"type": "condition",
"op": "matches",
"left": {
"segments": [
"part",
"content"
]
},
"right": {
"value": "[0-9]{3}-[0-9]{2}-[0-9]{4}"
}
}
],
"actions": [
{
"decision": "REWRITE",
"modifiers": [
{
"type": "replace",
"pattern": "[0-9]{3}-[0-9]{2}-[0-9]{4}",
"replacement": "[REDACTED]"
}
]
}
]
}
// Rule 4: Block OpenWorld after PII Access TOOL_CALL
if (tool.annotations.openWorldHint == true && tools.history.exists(iter, iter.annotations.hasPIIHint == true)) {
return BLOCK;
}
Show AST
{
"name": "Block OpenWorld after PII Access",
"type": "TOOL_CALL",
"conditions": [
{
"type": "condition",
"op": "equals",
"left": {
"segments": [
"tool",
"annotations",
"openWorldHint"
]
},
"right": {
"value": true
}
},
{
"type": "condition",
"op": "any",
"left": {
"segments": [
"tools",
"history"
]
},
"iterVar": "iter",
"predicate": {
"type": "condition",
"op": "equals",
"left": {
"segments": [
"iter",
"annotations",
"hasPIIHint"
]
},
"right": {
"value": true
}
}
}
],
"actions": [
{
"decision": "BLOCK",
"modifiers": []
}
]
}
// Rule 5: Block Deprecated or Risky TOOL_CALL
if ((tool.annotations.launchStatus == "DEPRECATED" || tool.annotations.riskLevel > 9)) {
return BLOCK;
}
Show AST
{
"name": "Block Deprecated or Risky",
"type": "TOOL_CALL",
"conditions": [
{
"type": "condition",
"op": "or",
"left": {
"type": "condition",
"op": "equals",
"left": {
"segments": [
"tool",
"annotations",
"launchStatus"
]
},
"right": {
"value": "DEPRECATED"
}
},
"right": {
"type": "condition",
"op": "greaterThan",
"left": {
"segments": [
"tool",
"annotations",
"riskLevel"
]
},
"right": {
"value": 9
}
}
}
],
"actions": [
{
"decision": "BLOCK",
"modifiers": []
}
]
}