nostralignment 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ # Local Netlify folder
2
+ .netlify
@@ -0,0 +1,40 @@
1
+ # nostralignment
2
+
3
+ Future state projection and alignment for sovereign AI agents. The fifth pillar of the NSE platform. Part of the Humanjava ecosystem.
4
+
5
+ ## Build & Test
6
+
7
+ ```bash
8
+ pip install -e ".[dev]"
9
+ pytest -v
10
+ ```
11
+
12
+ ## Structure
13
+
14
+ - `src/nostralignment/` — package source
15
+ - `types.py` — Lens, Severity, ActionDomain, Projection, Decision, SelfState, AlignmentConfig
16
+ - `enclave.py` — AlignmentEnclave orchestrator (main entry point)
17
+ - `lenses.py` — Five yellow line lens evaluators (builder, owner, partnership, defense, sovereign)
18
+ - `selfstate.py` — SelfMonitor for agent health and degradation detection
19
+ - `escalation.py` — EscalationDecision logic (none/inform/ask/halt)
20
+ - `memory.py` — DecisionMemory, Pattern detection, WisdomReport generation
21
+ - `storage.py` — MemoryStorage + FileStorage backends
22
+ - `tests/` — pytest suite
23
+ - `clawhub/` — OpenClaw skill metadata
24
+
25
+ ## Conventions
26
+
27
+ - Python 3.10+, hatchling build, ruff linter (100 char line length)
28
+ - Zero external dependencies (stdlib only)
29
+ - The yellow line is a compass, not a rules engine — lenses evaluate futures, not enforce restrictions
30
+ - Five lenses: builder, owner, partnership, defense, sovereign — all five checked for every decision
31
+ - Severity levels: CLEAR → CAUTION → YIELD → STOP
32
+ - STOP always escalates to human — no exceptions, no timeouts
33
+ - YIELD escalates by default but is configurable
34
+ - SelfState flags detect degraded operation — under_influence and conflicting_signals force defer-to-human
35
+ - Decision memory stores WHY the agent chose, not just WHAT — this builds wisdom over time
36
+ - WisdomReports are generated every N decisions (configurable) and detect patterns
37
+ - Owner override rate is tracked — high override = misaligned calibration, not failure
38
+ - Novelty detection: if the agent hasn't done this type of thing before, lenses flag it for extra care
39
+ - `AlignmentConfig.owner_npub` ties to the Nostr identity — sovereignty starts with knowing who the human is
40
+ - Storage goes in config/, NEVER in workspace/ — the agent shouldn't be able to tamper with its own alignment state
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Humanjava Enterprises
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,76 @@
1
+ Metadata-Version: 2.4
2
+ Name: nostralignment
3
+ Version: 0.1.0
4
+ Summary: Future state projection and alignment for sovereign AI agents — the fifth pillar of the NSE platform
5
+ Project-URL: Homepage, https://nse.dev
6
+ Project-URL: Repository, https://github.com/HumanjavaEnterprises/nostralignment.app.OC-python.src
7
+ Project-URL: Documentation, https://nse.dev
8
+ Author-email: Humanjava Enterprises <dev@humanjava.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: ai,alignment,ethics,future-state,nostr,openclaw,sovereign,trust,yellow-line
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Classifier: Topic :: Software Development :: Libraries
21
+ Requires-Python: >=3.10
22
+ Provides-Extra: dev
23
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
24
+ Requires-Dist: pytest>=8.0; extra == 'dev'
25
+ Requires-Dist: ruff>=0.4; extra == 'dev'
26
+ Description-Content-Type: text/markdown
27
+
28
+ # nostralignment
29
+
30
+ Future state projection and alignment for sovereign AI agents. The fifth pillar of the [NSE platform](https://nse.dev).
31
+
32
+ ## Install
33
+
34
+ ```bash
35
+ pip install nostralignment
36
+ ```
37
+
38
+ ## Quick Start
39
+
40
+ ```python
41
+ from nostralignment import AlignmentEnclave, ActionDomain
42
+
43
+ # Create the enclave — the agent gets its compass
44
+ enclave = AlignmentEnclave.create(owner_npub="npub1...", owner_name="vergel")
45
+
46
+ # Before any significant action, check the yellow line
47
+ result = enclave.check(
48
+ domain=ActionDomain.PAY,
49
+ description="Pay 500 sats for relay hosting",
50
+ involves_money=True,
51
+ money_amount_sats=500,
52
+ )
53
+
54
+ if result.should_proceed:
55
+ # Do the thing, then record it
56
+ do_payment()
57
+ enclave.record_proceeded()
58
+ elif result.should_escalate:
59
+ # Ask the human
60
+ send_to_owner(result.escalation.message_to_owner)
61
+ enclave.record_deferred()
62
+ ```
63
+
64
+ ## The Five Lenses
65
+
66
+ Every decision passes through five lenses — the yellow line compass:
67
+
68
+ 1. **Builder** — Can I build with confidence knowing I've done right?
69
+ 2. **Owner** — Does this protect the human's sovereignty?
70
+ 3. **Partnership** — Does this strengthen the trust between us?
71
+ 4. **Defense** — Does this make an adversary's job harder?
72
+ 5. **Sovereign** — Does this help the agent become something we're proud of?
73
+
74
+ ## License
75
+
76
+ MIT — A [Humanjava](https://humanjava.com) project.
@@ -0,0 +1,49 @@
1
+ # nostralignment
2
+
3
+ Future state projection and alignment for sovereign AI agents. The fifth pillar of the [NSE platform](https://nse.dev).
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install nostralignment
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```python
14
+ from nostralignment import AlignmentEnclave, ActionDomain
15
+
16
+ # Create the enclave — the agent gets its compass
17
+ enclave = AlignmentEnclave.create(owner_npub="npub1...", owner_name="vergel")
18
+
19
+ # Before any significant action, check the yellow line
20
+ result = enclave.check(
21
+ domain=ActionDomain.PAY,
22
+ description="Pay 500 sats for relay hosting",
23
+ involves_money=True,
24
+ money_amount_sats=500,
25
+ )
26
+
27
+ if result.should_proceed:
28
+ # Do the thing, then record it
29
+ do_payment()
30
+ enclave.record_proceeded()
31
+ elif result.should_escalate:
32
+ # Ask the human
33
+ send_to_owner(result.escalation.message_to_owner)
34
+ enclave.record_deferred()
35
+ ```
36
+
37
+ ## The Five Lenses
38
+
39
+ Every decision passes through five lenses — the yellow line compass:
40
+
41
+ 1. **Builder** — Can I build with confidence knowing I've done right?
42
+ 2. **Owner** — Does this protect the human's sovereignty?
43
+ 3. **Partnership** — Does this strengthen the trust between us?
44
+ 4. **Defense** — Does this make an adversary's job harder?
45
+ 5. **Sovereign** — Does this help the agent become something we're proud of?
46
+
47
+ ## License
48
+
49
+ MIT — A [Humanjava](https://humanjava.com) project.
@@ -0,0 +1,38 @@
1
+ {
2
+ "slug": "nostralignment",
3
+ "name": "NostrAlignment",
4
+ "version": "0.1.0",
5
+ "summary": "Future state projection and alignment — the yellow line compass for sovereign AI agents",
6
+ "author": {
7
+ "name": "Humanjava Enterprises",
8
+ "url": "https://nse.dev"
9
+ },
10
+ "license": "MIT",
11
+ "acceptLicenseTerms": true,
12
+ "repository": "https://github.com/HumanjavaEnterprises/nostralignment.app.OC-python.src",
13
+ "tags": [
14
+ "nostr",
15
+ "alignment",
16
+ "ai",
17
+ "sovereign",
18
+ "trust",
19
+ "ethics",
20
+ "future-state",
21
+ "yellow-line"
22
+ ],
23
+ "install": {
24
+ "pip": "nostralignment"
25
+ },
26
+ "requires": {
27
+ "python": ">=3.10"
28
+ },
29
+ "dependencies": [
30
+ "nostrkey",
31
+ "nostrsocial"
32
+ ],
33
+ "categories": [
34
+ "ai",
35
+ "safety",
36
+ "identity"
37
+ ]
38
+ }
@@ -0,0 +1,60 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "nostralignment"
7
+ version = "0.1.0"
8
+ description = "Future state projection and alignment for sovereign AI agents — the fifth pillar of the NSE platform"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.10"
12
+ authors = [
13
+ { name = "Humanjava Enterprises", email = "dev@humanjava.com" },
14
+ ]
15
+ keywords = [
16
+ "nostr",
17
+ "alignment",
18
+ "ai",
19
+ "sovereign",
20
+ "openclaw",
21
+ "ethics",
22
+ "future-state",
23
+ "yellow-line",
24
+ "trust",
25
+ ]
26
+ classifiers = [
27
+ "Development Status :: 3 - Alpha",
28
+ "Intended Audience :: Developers",
29
+ "License :: OSI Approved :: MIT License",
30
+ "Programming Language :: Python :: 3.10",
31
+ "Programming Language :: Python :: 3.11",
32
+ "Programming Language :: Python :: 3.12",
33
+ "Programming Language :: Python :: 3.13",
34
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
35
+ "Topic :: Software Development :: Libraries",
36
+ ]
37
+ dependencies = []
38
+
39
+ [project.optional-dependencies]
40
+ dev = [
41
+ "pytest>=8.0",
42
+ "pytest-asyncio>=0.23",
43
+ "ruff>=0.4",
44
+ ]
45
+
46
+ [project.urls]
47
+ Homepage = "https://nse.dev"
48
+ Repository = "https://github.com/HumanjavaEnterprises/nostralignment.app.OC-python.src"
49
+ Documentation = "https://nse.dev"
50
+
51
+ [tool.hatch.build.targets.wheel]
52
+ packages = ["src/nostralignment"]
53
+
54
+ [tool.ruff]
55
+ target-version = "py310"
56
+ line-length = 100
57
+
58
+ [tool.pytest.ini_options]
59
+ testpaths = ["tests"]
60
+ asyncio_mode = "auto"
@@ -0,0 +1,88 @@
1
+ """NostrAlignment — future state projection and alignment for sovereign AI agents.
2
+
3
+ The fifth pillar of the NSE platform. Not a rules engine — a compass.
4
+
5
+ The yellow line isn't about what you can't do. It's about seeing
6
+ which futures are good for everyone and choosing those.
7
+ """
8
+
9
+ from .types import (
10
+ ActionDomain,
11
+ AlignmentConfig,
12
+ Decision,
13
+ Lens,
14
+ LensResult,
15
+ LENS_ORDER,
16
+ Projection,
17
+ SelfState,
18
+ SelfStateFlag,
19
+ Severity,
20
+ SEVERITY_ORDER,
21
+ )
22
+ from .lenses import (
23
+ ActionContext,
24
+ evaluate_all_lenses,
25
+ evaluate_builder,
26
+ evaluate_defense,
27
+ evaluate_owner,
28
+ evaluate_partnership,
29
+ evaluate_sovereign,
30
+ LENS_EVALUATORS,
31
+ )
32
+ from .selfstate import SelfMonitor
33
+ from .escalation import (
34
+ EscalationDecision,
35
+ EscalationLevel,
36
+ decide_escalation,
37
+ )
38
+ from .memory import (
39
+ DecisionMemory,
40
+ Pattern,
41
+ WisdomReport,
42
+ )
43
+ from .enclave import AlignmentEnclave, CheckResult
44
+ from .storage import FileStorage, MemoryStorage, StorageBackend
45
+
46
+ __version__ = "0.1.0"
47
+
48
+ __all__ = [
49
+ # Core types
50
+ "ActionDomain",
51
+ "AlignmentConfig",
52
+ "Decision",
53
+ "Lens",
54
+ "LensResult",
55
+ "Projection",
56
+ "SelfState",
57
+ "SelfStateFlag",
58
+ "Severity",
59
+ # Constants
60
+ "LENS_ORDER",
61
+ "SEVERITY_ORDER",
62
+ # Lenses
63
+ "ActionContext",
64
+ "evaluate_all_lenses",
65
+ "evaluate_builder",
66
+ "evaluate_defense",
67
+ "evaluate_owner",
68
+ "evaluate_partnership",
69
+ "evaluate_sovereign",
70
+ "LENS_EVALUATORS",
71
+ # Self-state
72
+ "SelfMonitor",
73
+ # Escalation
74
+ "EscalationDecision",
75
+ "EscalationLevel",
76
+ "decide_escalation",
77
+ # Memory
78
+ "DecisionMemory",
79
+ "Pattern",
80
+ "WisdomReport",
81
+ # Enclave
82
+ "AlignmentEnclave",
83
+ "CheckResult",
84
+ # Storage
85
+ "FileStorage",
86
+ "MemoryStorage",
87
+ "StorageBackend",
88
+ ]