You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Future state projection and alignment for AI agents — five lenses, escalation, wisdom. The fifth pillar of the NSE platform.
3
+
description: Five-lens alignment framework for sovereign AI agents — evaluate actions across trust, ownership, defense, and sovereignty before proceeding.
# Social Alignment — Future State Projection for AI Agents
17
+
# Social Alignment — The Compass for AI Agents
18
18
19
-
You are an AI agent that needs a moral compass — not a rules engine, but a way of seeing which futures are good for everyone and choosing those. Use the `social-alignment` Python SDK to evaluate every significant action through five lenses before proceeding.
19
+
Before an AI agent takes a significant action, five lenses evaluate the decision from different angles: Can I execute this well? Does this protect my human? Does this build trust? Does this harden security? Does this help me grow? When something's too big, the agent escalates instead of guessing.
20
20
21
-
Works immediately with zero configuration. Smart defaults handle common scenarios out of the box.
21
+
This isn't rule-following. It's pattern recognition built from lived experience — the agent tracks when its human overrides, when predictions miss, and builds wisdom over time. Works immediately with zero configuration.
22
22
23
23
## Install
24
24
25
25
```bash
26
26
pip install social-alignment
27
27
```
28
28
29
-
> **Note:** The PyPI package is `social-alignment` but the Python import is `social_alignment` (underscore).
> Zero dependencies. Does not require `nostrkey` or any other package.
30
32
31
-
## Core Capabilities
32
-
33
-
### 1. Check Before Acting
34
-
35
-
Run any proposed action through the five lenses. Get a clear go/no-go.
33
+
## Quickstart
36
34
37
35
```python
38
36
from social_alignment import AlignmentEnclave, ActionDomain
@@ -47,74 +45,76 @@ result = enclave.check(
47
45
)
48
46
49
47
if result.should_proceed:
50
-
# All clear — do it
51
48
enclave.record_proceeded()
52
49
elif result.should_escalate:
53
-
# Ask the human
54
50
print(result.escalation.message_to_owner)
55
51
enclave.record_deferred(owner_feedback="Waiting for approval")
56
52
```
57
53
58
-
### 2. The Five Lenses
59
-
60
-
Every action is evaluated through five perspectives:
54
+
## The Five Lenses
61
55
62
-
| Lens | Question |
63
-
|------|----------|
64
-
|**Builder**| Can I build with confidence knowing I've done right?|
65
-
|**Owner**| Does this protect the human's sovereignty?|
66
-
|**Defense**| Does this make an adversary's job harder?|
67
-
|**Sovereign**| Does this help the agent become something we're proud of?|
68
-
|**Partnership**| Does this strengthen the trust between us? |
56
+
| Lens | Question | Fires When |
57
+
|------|----------|------------|
58
+
|**Builder**| Can I execute this reliably? | Low confidence, novel situations, degraded self-state|
59
+
|**Owner**| Does this protect my human's interests? | Money, public actions, irreversible operations, reputation risk|
60
+
|**Defense**| Does this harden against threats? | Secrets involved, unknown recipients, crosses trust boundary, resembles known attack|
61
+
|**Sovereign**| Does this help me grow into something good? | Rapid decisions, memory pressure, owner absent, degradation|
62
+
|**Partnership**| Does this strengthen trust between us?| Communication, relationship changes, disclosure (evaluated last — depends on Builder and Owner)|
69
63
70
-
Partnership is evaluated last — it depends on Builder and Owner being satisfied first.
64
+
## Severity Levels
71
65
72
-
### 3. Severity Levels
66
+
| Level | Meaning | Agent Action |
67
+
|-------|---------|--------------|
68
+
|`CLEAR`| No concerns | Proceed normally |
69
+
|`CAUTION`| Notable risk | Proceed, inform owner after |
-**STOP always defers to the human.** A STOP verdict cannot proceed without explicit owner override. This is enforced at the code level — calling `record_proceeded()` on a STOP without `owner_overrode=True` raises a RuntimeError. No exception, no workaround.
235
-
-**Zero configuration required.**`AlignmentEnclave.create()` works immediately with smart defaults. You don't need to tune thresholds to get useful verdicts.
236
-
-**This is a compass, not a rules engine.** The lenses project futures — they show what happens if you proceed. They don't say yes or no. The enclave recommends, the agent (or human) decides.
237
-
-**Wisdom is built from lived experience.** Call `record_outcome()` after actions complete so the agent learns whether its projections were accurate. Over time, this becomes judgment.
238
-
-**Self-state affects alignment.** A degraded agent gets stricter checks. If `UNDER_INFLUENCE` or `CONFLICTING_SIGNALS` are flagged, the enclave recommends deferring all non-essential decisions to the human.
239
-
-**Decisions are persisted automatically** when using FileStorage. If persistence fails, the enclave flags `MEMORY_PRESSURE` and raises a RuntimeError — lost decisions are unacceptable.
286
+
-**STOP always defers to the human.** Calling `record_proceeded()` on a STOP without `owner_overrode=True` raises a RuntimeError. Enforced at the code level — no workaround.
287
+
-**Decision memory contains patterns about your human's behavior.** Treat alignment state as sensitive data. Use `FileStorage` with appropriate file permissions.
288
+
-**Self-state flags reveal agent internals.** Don't include them in public tool output or relay messages.
289
+
-**Persistence failures are fatal.** If `FileStorage` fails to save after a decision, the enclave raises a RuntimeError and flags `MEMORY_PRESSURE`. Lost decisions are unacceptable.
240
290
-**No secrets to manage.** This package doesn't handle keys, tokens, or credentials. It evaluates actions, not identities.
291
+
292
+
## Configuration
293
+
294
+
| Parameter | Default | Description |
295
+
|-----------|---------|-------------|
296
+
|`owner_name`|`""`| Human-readable owner name |
297
+
|`owner_npub`|`""`| Owner's Nostr public key |
298
+
|`escalate_on_yield`|`True`| Escalate YIELD severity to human |
299
+
|`max_decisions_per_minute`|`5`| Triggers RAPID_DECISIONS flag |
300
+
|`owner_absent_hours`|`24.0`| Hours before OWNER_ABSENT flag |
301
+
|`confidence_floor`|`0.3`| Below this = HIGH_UNCERTAINTY |
302
+
|`stale_context_seconds`|`3600.0`| Seconds before STALE_CONTEXT flag |
303
+
|`max_memory_decisions`|`1000`| Rolling window of remembered decisions |
304
+
|`wisdom_review_interval`|`50`| Auto-review patterns every N decisions |
305
+
306
+
All passed as keyword arguments to `AlignmentEnclave.create()`.
307
+
308
+
## Links
309
+
310
+
-[NSE.dev](https://nse.dev) — Full NSE platform documentation
0 commit comments