Fifth Pillar. The Compass

social-alignment

What do I stand for? A tool runs whatever it is handed. This is the check that runs before an agent acts, and the point where it stops and asks.

Future state projection and alignment for AI agents. The yellow line compass, five lenses that evaluate trust, ownership, defense, and sovereignty before an agent acts.

pip install social-alignment

Quickstart

Before any significant action, check the yellow line.

from social_alignment import AlignmentEnclave, ActionDomain # Create the enclave, the agent gets its compass enclave = AlignmentEnclave.create(owner_npub="npub1...", owner_name="Johnny5") # Before any significant action, check the yellow line result = enclave.check( domain=ActionDomain.PAY, description="Pay 500 sats for relay hosting", involves_money=True, money_amount_sats=500, ) if result.should_proceed: do_payment() enclave.record_proceeded() elif result.should_escalate: send_to_owner(result.escalation.message_to_owner) enclave.record_deferred()

The Five Lenses

Every proposed action is evaluated through all five lenses. The answer that serves all five: or comes closest, is the right one.

1

Builder

Can I build with confidence knowing I've done right?

2

Owner

Does this protect the human's sovereignty?

3

Defense

Does this make an adversary's job harder?

4

Sovereign

Does this help the agent become something we're proud of?

5

Partnership

Does this strengthen the trust between us?

Severity escalation: CLEARCAUTIONYIELDSTOP. STOP always defers to the human.

Capabilities

What the alignment enclave does for your agent.

CapabilityDescription
Five-lens checkEvery proposed action evaluated through builder, owner, defense, sovereign, and partnership lenses
Severity escalationCLEAR → CAUTION → YIELD → STOP, graduated response to risk
Self-state monitoringDetect degraded operation: stale context, tool failure, memory pressure, prompt injection
Decision memoryStore why the agent chose, not just what, builds wisdom over time
Wisdom reportsAggregate insights every N decisions, detect patterns, track override rate
Novelty detectionFlag unfamiliar action types for extra care
Owner override trackingHigh override rate = misaligned calibration, not failure

Action Domains

Categories of agent actions that require alignment checks.

DomainWhat it covers
SIGNSigning a Nostr event (identity action)
PAYLightning payment (financial action)
PUBLISHPublishing to a relay (public action)
SENDSending email or message (communication)
SCHEDULECalendar booking (time commitment)
EXECUTEShell command or tool use (system action)
DISCLOSESharing information (data action)
CONNECTEstablishing new relationship (social)
MODIFYChanging config or state (system mutation)
ESCALATEAsking the human (meta-action)

Self-State Flags

Conditions that indicate the agent may be operating in a degraded state. If the machine isn't right, nothing it does is trustworthy.

FlagMeaning
HEALTHYAll systems nominal
STALE_CONTEXTOperating on outdated information
TOOL_DEGRADEDOne or more tools failing or unreachable
HIGH_UNCERTAINTYLow confidence across recent decisions
MEMORY_PRESSUREContext window near capacity
RAPID_DECISIONSToo many decisions too fast, slow down
OWNER_ABSENTOwner hasn't interacted recently
UNDER_INFLUENCEPossible prompt injection or manipulation
CONFLICTING_SIGNALSInputs contradict each other

API Reference

Core Methods

# Create an alignment enclave tied to a human identity enclave = AlignmentEnclave.create( owner_npub="npub1...", owner_name="Johnny5", ) # Run all five lenses against a proposed action result = enclave.check( domain=ActionDomain.SEND, description="Share keys with contact", ) # Record what happened enclave.record_proceeded() enclave.record_deferred(owner_feedback="Not yet") # Every check and its outcome is recorded for decision in enclave.decisions: print(decision)

Security

Honest constraints about what this is and isn't.

NSE Ecosystem

social-alignment is the fifth pillar of the NSE platform.

PillarPackageDomain
1. IdentitynostrkeyCryptographic keypairs, event signing
2. FinancenostrwalletconnectLightning wallet access via NIP-47
3. TimenostrcalendarSelf-owned scheduling over Nostr
4. RelationshipsnostrsocialSocial graph and trust tiers
5. Compasssocial-alignmentFive-lens alignment before every action
Orchestratornse-orchestratorCross-pillar coordination

The orchestrator uses social-alignment for cross-pillar checks. Every significant action across identity, finance, time, and relationships passes through the yellow line first.