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.

pip install social-alignment

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.

LensWhat It Checks
TrustIs this action consistent with established trust patterns?
OwnershipDoes the agent have authority to take this action?
DefenseCould this action be exploited or cause harm?
SovereignDoes this preserve the human's autonomy and control?
ProjectionWhat 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

DomainDomainDomainDomain
SENDRECEIVESTORESHARE
DELETESCHEDULEPAYCONNECT

Security

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.