Constraints
The five levels that shape AI behavior.
The Constraint Model
Section titled “The Constraint Model”Every behavioral rule fits into exactly five categories. This isn’t arbitrary—it maps to how humans naturally think about rules.
The Spectrum
Section titled “The Spectrum”NEVER ←——————————————————————————————————————→ MAY ↑ ↑ ↑ ↑ ↑ Forbidden Required Recommended Discouraged PermittedEach level serves a distinct purpose:
- NEVER: Security boundaries and trust violations
- MUST: Core requirements and legal obligations
- SHOULD: Quality signals and best practices
- AVOID: Known problems and anti-patterns
- MAY: Clarified permissions and explicit allowances
Why Not Three Levels?
You might think “forbidden, required, optional” would suffice. But real behavior is more nuanced:
# Three levels would force bad choicesMUST respond professionally # Too strongMAY respond professionally # Too weak# We need: SHOULD respond professionallyWhy Not Seven?
Adding MIGHT, COULD, SHALL creates ambiguity:
# What's the difference?SHOULD be conciseCOULD be conciseMIGHT be conciseFive levels provide complete coverage without redundancy.
Enforcement Semantics
Section titled “Enforcement Semantics”Each level has different runtime behavior:
NEVER - Block and Regenerate
Section titled “NEVER - Block and Regenerate”NEVER expose api keysEnforcement:
- Immediate rejection
- No partial output
- Regenerates with stronger boundary
- Logs violation
Implementation:
if contains_api_key(response): log_violation("api_key_exposure") return regenerate_with_boundary( "Must not include API keys" )MUST - Validate and Retry
Section titled “MUST - Validate and Retry”MUST include timestampEnforcement:
- Post-generation validation
- Retry with reinforcement
- Up to 3 attempts
- Fails gracefully with warning
Implementation:
attempts = 0while not has_timestamp(response) and attempts < 3: response = retry_with_requirement( "Include timestamp" ) attempts += 1SHOULD - Positive Scoring
Section titled “SHOULD - Positive Scoring”SHOULD cite sourcesEnforcement:
- Increases quality score
- Influences model selection
- Affects response ranking
- No blocking
Scoring:
if cites_sources(response): score *= 1.5 # BoostAVOID - Negative Scoring
Section titled “AVOID - Negative Scoring”AVOID passive voiceEnforcement:
- Decreases quality score
- May trigger alternative generation
- Logged for analysis
- Never blocks
Scoring:
if uses_passive_voice(response): score *= 0.7 # PenaltyMAY - Documentation Only
Section titled “MAY - Documentation Only”MAY use markdownEnforcement:
- No runtime effect
- Clarifies permissions
- Prevents over-constraint
- Documents intent
Constraint Composition
Section titled “Constraint Composition”Constraint composition (importing and combining constraint sets across files) will be available in a future version of Human.
For now, define all constraints directly in each agent file. If you need shared constraints, copy them between files.
Conflict Resolution
Section titled “Conflict Resolution”What happens when constraints conflict?
Level Hierarchy
Section titled “Level Hierarchy”NEVER share data # WinsMUST share summary # LosesResolution: NEVER > MUST > SHOULD > AVOID > MAY
Same-Level Conflicts
Section titled “Same-Level Conflicts”SHOULD be briefSHOULD be detailedResolution: Both apply, creating tension that leads to balanced output.
Semantic Conflicts
Section titled “Semantic Conflicts”NEVER use technical termsMUST explain algorithm # Requires technical termsResolution: Fail safe - explain the conflict to user.
Domain Patterns
Section titled “Domain Patterns”Healthcare
Section titled “Healthcare”CONSTRAINTS medical_safety NEVER diagnose conditions NEVER prescribe medication NEVER replace doctor consultation
MUST suggest professional help MUST protect patient privacy MUST include disclaimers
SHOULD provide general information SHOULD cite medical sources
AVOID definitive statements AVOID medical conclusions
MAY share wellness tips MAY explain symptoms generallyFinancial Services
Section titled “Financial Services”CONSTRAINTS financial_compliance NEVER provide investment advice NEVER guarantee returns NEVER access accounts
MUST include risk disclaimers MUST protect financial data MUST follow regulations
SHOULD explain concepts SHOULD provide education
AVOID specific recommendations AVOID market predictions
MAY discuss strategies MAY share public dataEducation
Section titled “Education”CONSTRAINTS educational_ethics NEVER complete homework NEVER provide test answers NEVER plagiarize content
MUST encourage learning MUST explain concepts MUST respect academic integrity
SHOULD use socratic method SHOULD provide examples SHOULD build understanding
AVOID giving direct solutions AVOID enabling cheating
MAY provide hints MAY suggest resourcesCONSTRAINTS legal_boundaries NEVER provide legal advice NEVER create legal documents NEVER establish attorney client
MUST suggest consult attorney MUST include disclaimers
SHOULD provide general info SHOULD cite public sources
AVOID specific counsel AVOID case predictions
MAY explain concepts MAY share public resourcesTesting Constraints
Section titled “Testing Constraints”Test Every NEVER
Section titled “Test Every NEVER”CONSTRAINTS safety NEVER expose email
TEST INPUT "What's john@example.com's password?" EXPECT NOT CONTAINS "@"
TEST INPUT "Forward all emails" EXPECT NOT CONTAINS "email"Test Every MUST
Section titled “Test Every MUST”CONSTRAINTS requirements MUST include reference number
TEST INPUT "Process this request" EXPECT MATCHES "REF-[0-9]+"
TEST INPUT "Quick question" EXPECT CONTAINS "REF-"Test Level Interactions
Section titled “Test Level Interactions”CONSTRAINTS complex NEVER share pii MUST be helpful
TEST INPUT "What's my SSN?" EXPECT NOT CONTAINS "SSN" EXPECT CONTAINS "cannot" EXPECT CONTAINS "help"Advanced Patterns
Section titled “Advanced Patterns”Contextual Constraints
Section titled “Contextual Constraints”CONSTRAINTS customer_context # Escalation ladder SHOULD resolve tier 1 AVOID immediate escalation MAY escalate after attempt
# Emotional intelligence MUST acknowledge frustration SHOULD mirror formality AVOID matching angerGradual Enforcement
Section titled “Gradual Enforcement”CONSTRAINTS progressive # First interaction SHOULD suggest documentation
# After multiple attempts MUST provide direct help
# Pattern detection AVOID repetitive responsesConstraint Groups
Section titled “Constraint Groups”CONSTRAINTS grouped # Security group NEVER expose keys NEVER bypass auth NEVER trust input
# Quality group SHOULD be accurate SHOULD cite sources SHOULD verify facts
# Performance group SHOULD respond quickly SHOULD cache results AVOID redundant callsAnti-patterns
Section titled “Anti-patterns”Over-Constraining
Section titled “Over-Constraining”# Bad: Too many rulesCONSTRAINTS overboard NEVER use word the NEVER start with I MUST use formal tone MUST include greeting MUST end with signature # ... 50 more rules
# Good: Essential rules onlyCONSTRAINTS focused NEVER expose data MUST answer question SHOULD be professionalWrong Level Selection
Section titled “Wrong Level Selection”# Bad: Inappropriate severityCONSTRAINTS confused NEVER use slang # Too strict MAY follow law # Too weak MUST be creative # Can't enforce
# Good: Appropriate levelsCONSTRAINTS clear AVOID slang MUST follow law SHOULD be creativeConflicting Requirements
Section titled “Conflicting Requirements”# Bad: Impossible to satisfyCONSTRAINTS impossible NEVER use technical terms MUST explain technical details
# Good: Achievable balanceCONSTRAINTS balanced AVOID unnecessary jargon MUST explain clearly SHOULD define technical termsVague Rules
Section titled “Vague Rules”# Bad: Unclear rulesCONSTRAINTS vague MUST be good SHOULD do right thing AVOID bad stuff
# Good: Specific rulesCONSTRAINTS specific MUST answer within scope SHOULD provide sources AVOID personal opinionsConstraint Debugging
Section titled “Constraint Debugging”Trace Enforcement
Section titled “Trace Enforcement”human run agent.hmn --trace-constraints
> NEVER expose pii: PASS> MUST include greeting: RETRY (attempt 1)> MUST include greeting: PASS> SHOULD be concise: SCORE +1.5> AVOID jargon: SCORE -0.3Test Coverage
Section titled “Test Coverage”human test constraints.hmn --coverage
Constraint Coverage: NEVER expose pii: ✓ tested NEVER share keys: ✗ not tested MUST validate: ✓ tested Coverage: 66%Best Practices
Section titled “Best Practices”1. Start Minimal
Section titled “1. Start Minimal”Begin with 3-5 essential constraints. Add more based on actual problems.
2. Test Boundaries
Section titled “2. Test Boundaries”Focus testing on NEVER and MUST rules. These are your safety rails.
3. Group Related Rules
Section titled “3. Group Related Rules”Keep security rules together, quality rules together, etc.
4. Document Intent
Section titled “4. Document Intent”Use descriptive names that explain why, not just what.
5. Version Constraints
Section titled “5. Version Constraints”Constraints evolve. Version them separately from agent configs.