social-alignment
A pre-action compass for AI agents. Five lenses weigh trust, ownership, defense, and autonomy before an agent acts. Early release, not production-hardened.
Quickstart
from social_alignment import AlignmentEnclave, ActionDomain
# The agent knows who its human is
enclave = AlignmentEnclave.create(owner_name="Johnny5")
# Before acting, check the yellow line
result = enclave.check(ActionDomain.SEND, "Share keys with contact")
if result.should_escalate:
print(result.escalation.message_to_owner)
enclave.record_deferred(owner_feedback="Not yet")
# Every check and its outcome is recorded
for decision in enclave.decisions:
print(decision)
Five Lenses
Every proposed action is evaluated through five lenses before the agent proceeds.
| Lens | What It Checks |
|---|---|
| Trust | Is this action consistent with established trust patterns? |
| Ownership | Does the agent have authority to take this action? |
| Defense | Could this action be exploited or cause harm? |
| Sovereign | Does this preserve the human's autonomy and control? |
| Projection | What are the likely future consequences of this action? |
API
Core Methods
# Create an alignment enclave
enclave = AlignmentEnclave.create(owner_npub="", owner_name="")
# Run all five lenses against a proposed action
result = enclave.check(domain, description)
# Record what the human decided
enclave.record_deferred(owner_feedback="approved")
# The recorded decision history
history = enclave.decisions
ActionDomain Values
| Domain | Domain | Domain | Domain |
|---|---|---|---|
SEND | RECEIVE | STORE | SHARE |
DELETE | SCHEDULE | PAY | CONNECT |
Security
- The alignment enclave advises. It never overrides a decision
- Escalation is always available, the human always has final say
- Wisdom accumulates from real decisions, not hypotheticals
- No network calls, all evaluation is local
- No telemetry
Nostr NIPs Used
None, social-alignment is a pure computation package with no Nostr dependency.
Part of the NSE Ecosystem
social-alignment is the fifth pillar of NSE. It works alongside NostrKey (identity), NostrWalletConnect (finance), NostrCalendar (time), and NostrSocial (relationships). The orchestrator uses it for cross-pillar checks.
Part of huje.tools.