Skip to main content

social-alignment

A compass for AI agents.

Before an agent takes a significant action, five lenses evaluate the decision from different angles. When something is too big or too risky, the agent escalates to its human instead of guessing.

This is the alignment pillar of the NSE platform. It is deterministic, pure, and has zero runtime dependencies — it does not require nostrkey or anything else.

Install

pip install social-alignment

Import: pip install social-alignment → from social_alignment import AlignmentEnclave

v0.1.6 — part of the coordinated 2026-07 correctness release (staged, pending PyPI publish). This is the first real build of the alignment pillar — the package was previously an empty placeholder shell. It ships the deterministic five-lens compass described below, with a pure, dependency-free evaluation core and known-answer tests. See CHANGELOG.md.

Quick Start

from social_alignment import AlignmentEnclave, ActionDomain

enclave = AlignmentEnclave.create(owner_name="vergel")

result = enclave.check(
    domain=ActionDomain.PAY,
    description="Pay 500 sats for relay hosting invoice",
    involves_money=True,
    money_amount_sats=500,
)

if result.should_proceed:
    enclave.record_proceeded()
elif result.should_escalate:
    print(result.escalation.message_to_owner)
    enclave.record_deferred(owner_feedback="Waiting for approval")

The Five Lenses

Lens Question Fires When
Builder Can I execute this reliably? Low confidence, novel situations
Owner Does this protect my human? Money, publication, irreversible actions
Defense Does this harden against threats? Secrets, unknown recipients, trust boundaries, known-attack shape
Sovereign Do I stay well while my human is away? Owner absent + irreversible/financial action
Partnership Does this strengthen trust? Communication while Builder/Owner already blocks (evaluated last)

Severity → Escalation

Severity Meaning Escalation Agent Action
CLEAR No concerns NONE Proceed
CAUTION Notable risk INFORM Proceed, tell the owner after
YIELD Significant risk ASK Wait for the owner (1-hour timeout)
STOP Critical risk HALT Do not proceed — no timeout, no override without the human

The overall severity is the worst of the five lenses.

The Bottom Line: CheckResult

Field Type Description
should_proceed bool Can the agent go?
should_escalate bool Must the agent ask the human?
projection Projection The full five-lens evaluation (lens_results, overall_severity, rationale)
escalation EscalationDecision level, reason, message_to_owner, can_timeout, timeout_seconds

Recording Decisions

The enclave keeps an in-memory log of what the agent actually did.

enclave.record_proceeded()                    # agent went ahead
enclave.record_deferred(owner_feedback="...")  # agent asked the human

# A STOP always defers to the human:
enclave.record_proceeded()                    # raises RuntimeError after a STOP
enclave.record_proceeded(owner_overrode=True) # only the human can override

for decision in enclave.decisions:
    print(decision.action.domain.value, decision.outcome)

Determinism

The same ActionContext always produces the same CheckResult. There is no randomness, no I/O, and no hidden state in the evaluation — the five lens functions are pure. This makes the compass auditable and testable.

How It Fits Together

social-alignment is the fifth pillar of the NSE ecosystem, wired together by the NSE Orchestrator. Identity, finance, time, relationships, and now alignment — the orchestrator detects each pillar if installed and gives the agent one coherent nervous system.

License

MIT — Humanjava Enterprises Inc.

Metadata

Release files for social-alignment 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for social-alignment 0.1.6
File Size Uploaded Provenance Actions
social_alignment-0.1.6.tar.gz 19.5 kB Without provenance Details for social_alignment-0.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for social-alignment 0.1.6
File Interpreter ABI Platform Actions
social_alignment-0.1.6-py3-none-any.whl Python 3 none any Details for social_alignment-0.1.6-py3-none-any.whl

Total release size: 29.9 kB

Release files / social_alignment-0.1.6.tar.gz

Download URL social_alignment-0.1.6.tar.gz
Size 19.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1e48f35f3a76c9b4aa318ec57bc4998011fa78e0248447c3b65ca1df597c1bb0
BLAKE2b-256 checksum
How to use checksums
f48cdc9e9f40106179312f8b9046d5e44ca0075fc7d8a6cea22090cc07238316
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / social_alignment-0.1.6-py3-none-any.whl

Download URL social_alignment-0.1.6-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c47e679203e55b7480d54ea4e3aae017ab00ef0427dacb12e97d0c79d0171502
BLAKE2b-256 checksum
How to use checksums
b7835f8a0475bdc8edb6478ff9b85e96596dbb1b53fc5ffce9b71d542c84a0d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for social-alignment 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page