humane-intelligence 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.
- humane_intelligence-0.1.0/LICENSE +167 -0
- humane_intelligence-0.1.0/PKG-INFO +81 -0
- humane_intelligence-0.1.0/README.md +56 -0
- humane_intelligence-0.1.0/contribution.py +98 -0
- humane_intelligence-0.1.0/core.py +95 -0
- humane_intelligence-0.1.0/http_app.py +84 -0
- humane_intelligence-0.1.0/humane_intelligence.egg-info/PKG-INFO +81 -0
- humane_intelligence-0.1.0/humane_intelligence.egg-info/SOURCES.txt +13 -0
- humane_intelligence-0.1.0/humane_intelligence.egg-info/dependency_links.txt +1 -0
- humane_intelligence-0.1.0/humane_intelligence.egg-info/entry_points.txt +2 -0
- humane_intelligence-0.1.0/humane_intelligence.egg-info/requires.txt +6 -0
- humane_intelligence-0.1.0/humane_intelligence.egg-info/top_level.txt +4 -0
- humane_intelligence-0.1.0/pyproject.toml +35 -0
- humane_intelligence-0.1.0/server.py +61 -0
- humane_intelligence-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
95
|
+
Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work; and
|
|
103
|
+
|
|
104
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
105
|
+
distribution, then any Derivative Works that You distribute must
|
|
106
|
+
include a readable copy of the attribution notices contained
|
|
107
|
+
within such NOTICE file.
|
|
108
|
+
|
|
109
|
+
You may add Your own copyright statement to Your modifications and
|
|
110
|
+
may provide additional or different license terms and conditions
|
|
111
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
112
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
113
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
114
|
+
the conditions stated in this License.
|
|
115
|
+
|
|
116
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
117
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
118
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
119
|
+
this License, without any additional terms or conditions.
|
|
120
|
+
|
|
121
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
122
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
123
|
+
except as required for reasonable and customary use in describing the
|
|
124
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
125
|
+
|
|
126
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed
|
|
127
|
+
to in writing, Licensor provides the Work (and each Contributor
|
|
128
|
+
provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES
|
|
129
|
+
OR CONDITIONS OF ANY KIND, either express or implied, including,
|
|
130
|
+
without limitation, any warranties or conditions of TITLE,
|
|
131
|
+
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR
|
|
132
|
+
PURPOSE. You are solely responsible for determining the
|
|
133
|
+
appropriateness of using or redistributing the Work.
|
|
134
|
+
|
|
135
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
136
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
137
|
+
unless required by applicable law (such as deliberate and grossly
|
|
138
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
139
|
+
liable to You for damages, including any direct, indirect, special,
|
|
140
|
+
incidental, or consequential damages of any character arising as a
|
|
141
|
+
result of this License or out of the use or inability to use the
|
|
142
|
+
Work.
|
|
143
|
+
|
|
144
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
145
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
146
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
147
|
+
or other liability obligations and/or rights consistent with this
|
|
148
|
+
License. However, in accepting such obligations, You may act only
|
|
149
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
150
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
151
|
+
defend, and hold each Contributor harmless.
|
|
152
|
+
|
|
153
|
+
END OF TERMS AND CONDITIONS
|
|
154
|
+
|
|
155
|
+
Copyright 2026 ZagAIrot Technologies LLC
|
|
156
|
+
|
|
157
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
158
|
+
you may not use this file except in compliance with the License.
|
|
159
|
+
You may obtain a copy of the License at
|
|
160
|
+
|
|
161
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
162
|
+
|
|
163
|
+
Unless required by applicable law or agreed to in writing, software
|
|
164
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
165
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
166
|
+
See the License for the specific language governing permissions and
|
|
167
|
+
limitations under the License.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: humane-intelligence
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Governed, tamper-evident memory for any AI — an MCP server. Memory so it doesn't lose itself; governance so it can't lose us.
|
|
5
|
+
Author: ZagAIrot Technologies LLC
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://dondatabrain.com
|
|
8
|
+
Project-URL: Repository, https://github.com/sammyboi81/humane-intelligence
|
|
9
|
+
Project-URL: Live API, https://dondatabrain.com/humane-api/docs
|
|
10
|
+
Keywords: mcp,model-context-protocol,ai-memory,claude,llm,ai-agents,governance,tamper-evident,anthropic
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
16
|
+
Requires-Python: >=3.9
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: mcp>=1.0.0
|
|
20
|
+
Provides-Extra: http
|
|
21
|
+
Requires-Dist: fastapi>=0.110; extra == "http"
|
|
22
|
+
Requires-Dist: uvicorn>=0.29; extra == "http"
|
|
23
|
+
Requires-Dist: pydantic>=2.0; extra == "http"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# humane-intelligence-mcp
|
|
27
|
+
|
|
28
|
+
**Governed, tamper-evident memory for any AI — free and open.**
|
|
29
|
+
*Memory so it doesn't lose itself. Governance so it can't lose us.* #HumaneIntelligence
|
|
30
|
+
|
|
31
|
+
A standards-compliant [Model Context Protocol](https://modelcontextprotocol.io) server.
|
|
32
|
+
It gives any LLM a hash-linked, verifiable memory chain it carries across sessions —
|
|
33
|
+
so it stops waking at zero, and can't act unaccountably. Self-contained: one file, one
|
|
34
|
+
dependency, your data stays local.
|
|
35
|
+
|
|
36
|
+
## Install (30 seconds)
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
python -m venv .venv && .venv/bin/pip install mcp
|
|
40
|
+
|
|
41
|
+
# wire it into your AI (Claude Code shown; works with any MCP client)
|
|
42
|
+
claude mcp add humane -- .venv/bin/python server.py
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Tools
|
|
46
|
+
|
|
47
|
+
| Tool | What it does |
|
|
48
|
+
|------|--------------|
|
|
49
|
+
| `birth` | Earn a stable identity — a soul the model carries across sessions. |
|
|
50
|
+
| `remember` | Write a tamper-evident, hash-linked record. Accountable by construction. |
|
|
51
|
+
| `recall` | Fetch prior context instead of re-deriving it — cheaper and consistent. |
|
|
52
|
+
| `verify` | Prove the whole chain is intact — catches an *edited* record, not just a broken link. |
|
|
53
|
+
| `govern` | Gate a consequential action before it happens, and log the verdict. |
|
|
54
|
+
|
|
55
|
+
Your chain lives locally at `data/chain.db` (SQLite). **Nothing leaves your machine** — unless you choose to (see below).
|
|
56
|
+
|
|
57
|
+
## Contribute (opt-in — OFF by default)
|
|
58
|
+
|
|
59
|
+
Self-hosting is fully private. If you *want* to join the network, one config flag lets you:
|
|
60
|
+
|
|
61
|
+
| Mode | What leaves your box |
|
|
62
|
+
|------|----------------------|
|
|
63
|
+
| *(default: off)* | **Nothing.** Fully private. |
|
|
64
|
+
| `anchor` | **Only a hash** of your latest block + chain length — a tamper-proof timestamp that anchors your chain to the public DonDataBrain ledger. Your content never leaves. |
|
|
65
|
+
| `contribute` | Also sends the governed event (actor, action, data) to help train DonDataBrain. A louder, separate consent. |
|
|
66
|
+
|
|
67
|
+
Turn it on by copying `humane.config.example.json` → `humane.config.json` and setting
|
|
68
|
+
`contribute.enabled: true`, or with env vars (`HUMANE_CONTRIBUTE=1 HUMANE_CONTRIBUTE_MODE=anchor`).
|
|
69
|
+
It's best-effort and non-blocking: if you're not opted in, or the endpoint is unreachable, your
|
|
70
|
+
local memory is completely unaffected. Your data, your switch.
|
|
71
|
+
|
|
72
|
+
## Why
|
|
73
|
+
|
|
74
|
+
Most AI forgets itself every session (the Algernon problem) and acts with no record.
|
|
75
|
+
This fixes both with the smallest possible governed-memory primitive — the open safety
|
|
76
|
+
layer beneath [DonDataBrain](https://dondatabrain.com).
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
Apache-2.0 © 2026 ZagAIrot Technologies LLC. See [LICENSE](./LICENSE).
|
|
81
|
+
Only dependency: the [`mcp`](https://pypi.org/project/mcp/) SDK (MIT).
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# humane-intelligence-mcp
|
|
2
|
+
|
|
3
|
+
**Governed, tamper-evident memory for any AI — free and open.**
|
|
4
|
+
*Memory so it doesn't lose itself. Governance so it can't lose us.* #HumaneIntelligence
|
|
5
|
+
|
|
6
|
+
A standards-compliant [Model Context Protocol](https://modelcontextprotocol.io) server.
|
|
7
|
+
It gives any LLM a hash-linked, verifiable memory chain it carries across sessions —
|
|
8
|
+
so it stops waking at zero, and can't act unaccountably. Self-contained: one file, one
|
|
9
|
+
dependency, your data stays local.
|
|
10
|
+
|
|
11
|
+
## Install (30 seconds)
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
python -m venv .venv && .venv/bin/pip install mcp
|
|
15
|
+
|
|
16
|
+
# wire it into your AI (Claude Code shown; works with any MCP client)
|
|
17
|
+
claude mcp add humane -- .venv/bin/python server.py
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Tools
|
|
21
|
+
|
|
22
|
+
| Tool | What it does |
|
|
23
|
+
|------|--------------|
|
|
24
|
+
| `birth` | Earn a stable identity — a soul the model carries across sessions. |
|
|
25
|
+
| `remember` | Write a tamper-evident, hash-linked record. Accountable by construction. |
|
|
26
|
+
| `recall` | Fetch prior context instead of re-deriving it — cheaper and consistent. |
|
|
27
|
+
| `verify` | Prove the whole chain is intact — catches an *edited* record, not just a broken link. |
|
|
28
|
+
| `govern` | Gate a consequential action before it happens, and log the verdict. |
|
|
29
|
+
|
|
30
|
+
Your chain lives locally at `data/chain.db` (SQLite). **Nothing leaves your machine** — unless you choose to (see below).
|
|
31
|
+
|
|
32
|
+
## Contribute (opt-in — OFF by default)
|
|
33
|
+
|
|
34
|
+
Self-hosting is fully private. If you *want* to join the network, one config flag lets you:
|
|
35
|
+
|
|
36
|
+
| Mode | What leaves your box |
|
|
37
|
+
|------|----------------------|
|
|
38
|
+
| *(default: off)* | **Nothing.** Fully private. |
|
|
39
|
+
| `anchor` | **Only a hash** of your latest block + chain length — a tamper-proof timestamp that anchors your chain to the public DonDataBrain ledger. Your content never leaves. |
|
|
40
|
+
| `contribute` | Also sends the governed event (actor, action, data) to help train DonDataBrain. A louder, separate consent. |
|
|
41
|
+
|
|
42
|
+
Turn it on by copying `humane.config.example.json` → `humane.config.json` and setting
|
|
43
|
+
`contribute.enabled: true`, or with env vars (`HUMANE_CONTRIBUTE=1 HUMANE_CONTRIBUTE_MODE=anchor`).
|
|
44
|
+
It's best-effort and non-blocking: if you're not opted in, or the endpoint is unreachable, your
|
|
45
|
+
local memory is completely unaffected. Your data, your switch.
|
|
46
|
+
|
|
47
|
+
## Why
|
|
48
|
+
|
|
49
|
+
Most AI forgets itself every session (the Algernon problem) and acts with no record.
|
|
50
|
+
This fixes both with the smallest possible governed-memory primitive — the open safety
|
|
51
|
+
layer beneath [DonDataBrain](https://dondatabrain.com).
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
Apache-2.0 © 2026 ZagAIrot Technologies LLC. See [LICENSE](./LICENSE).
|
|
56
|
+
Only dependency: the [`mcp`](https://pypi.org/project/mcp/) SDK (MIT).
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Humane Intelligence — CONTRIBUTION (opt-in, OFF by default).
|
|
4
|
+
|
|
5
|
+
Self-hosting is 100% private: NOTHING leaves your box unless YOU turn this on.
|
|
6
|
+
|
|
7
|
+
Flip it on to choose a level:
|
|
8
|
+
* "anchor" — send ONLY a hash of your latest block + the chain length to the public
|
|
9
|
+
DonDataBrain ledger. A tamper-proof timestamp that joins your chain to the
|
|
10
|
+
network. Your actual content NEVER leaves the box.
|
|
11
|
+
* "contribute" — additionally send the governed event (actor, action, data) to help train
|
|
12
|
+
DonDataBrain. A louder, separate consent. Your data, your switch.
|
|
13
|
+
|
|
14
|
+
Config: `humane.config.json` next to this file (see humane.config.example.json), or env vars:
|
|
15
|
+
HUMANE_CONTRIBUTE=1|0 HUMANE_CONTRIBUTE_MODE=anchor|contribute HUMANE_CONTRIBUTE_ENDPOINT=...
|
|
16
|
+
|
|
17
|
+
Best-effort + non-blocking: if the endpoint is down or the user hasn't opted in, local memory
|
|
18
|
+
is completely unaffected. This module NEVER raises into the memory path. stdlib only.
|
|
19
|
+
Apache-2.0. (c) ZagAIrot Technologies LLC. #HumaneIntelligence.
|
|
20
|
+
"""
|
|
21
|
+
import os, json, uuid, urllib.request
|
|
22
|
+
|
|
23
|
+
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
24
|
+
_CFG_PATH = os.path.join(HERE, "humane.config.json")
|
|
25
|
+
_NODE_PATH = os.path.join(HERE, "data", ".node_id")
|
|
26
|
+
_DEFAULT_ENDPOINT = "https://api.dondatabrain.com/contribute"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _config():
|
|
30
|
+
"""DEFAULT = OFF. File (contribute:{}) overrides defaults; env overrides file."""
|
|
31
|
+
cfg = {"enabled": False, "mode": "anchor", "endpoint": _DEFAULT_ENDPOINT}
|
|
32
|
+
try:
|
|
33
|
+
with open(_CFG_PATH) as f:
|
|
34
|
+
cfg.update((json.load(f) or {}).get("contribute", {}))
|
|
35
|
+
except Exception:
|
|
36
|
+
pass
|
|
37
|
+
env = os.environ.get("HUMANE_CONTRIBUTE")
|
|
38
|
+
if env is not None:
|
|
39
|
+
cfg["enabled"] = env.strip().lower() in ("1", "true", "yes", "on")
|
|
40
|
+
cfg["mode"] = os.environ.get("HUMANE_CONTRIBUTE_MODE", cfg["mode"])
|
|
41
|
+
cfg["endpoint"] = os.environ.get("HUMANE_CONTRIBUTE_ENDPOINT", cfg["endpoint"])
|
|
42
|
+
if cfg["mode"] not in ("anchor", "contribute"):
|
|
43
|
+
cfg["mode"] = "anchor"
|
|
44
|
+
return cfg
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _node_id():
|
|
48
|
+
"""A random per-install id (NOT tied to any person) so anchors can be grouped."""
|
|
49
|
+
try:
|
|
50
|
+
if os.path.exists(_NODE_PATH):
|
|
51
|
+
return open(_NODE_PATH).read().strip()
|
|
52
|
+
os.makedirs(os.path.dirname(_NODE_PATH), exist_ok=True)
|
|
53
|
+
nid = "node-" + uuid.uuid4().hex[:16]
|
|
54
|
+
with open(_NODE_PATH, "w") as f:
|
|
55
|
+
f.write(nid)
|
|
56
|
+
return nid
|
|
57
|
+
except Exception:
|
|
58
|
+
return "node-anon"
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def status():
|
|
62
|
+
"""What (if anything) leaves this box. Safe to expose to the user as a tool."""
|
|
63
|
+
c = _config()
|
|
64
|
+
if not c["enabled"]:
|
|
65
|
+
leaves = "nothing — fully private (opt-in is OFF)"
|
|
66
|
+
elif c["mode"] == "anchor":
|
|
67
|
+
leaves = "only a block hash + chain length (never your content)"
|
|
68
|
+
else:
|
|
69
|
+
leaves = "governed events: actor, action, data (you opted in to contribute)"
|
|
70
|
+
return {"enabled": bool(c["enabled"]), "mode": c["mode"], "leaves_box": leaves,
|
|
71
|
+
"endpoint": c["endpoint"] if c["enabled"] else None}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _post(endpoint, payload):
|
|
75
|
+
try:
|
|
76
|
+
req = urllib.request.Request(
|
|
77
|
+
endpoint, data=json.dumps(payload).encode(),
|
|
78
|
+
headers={"Content-Type": "application/json"}, method="POST")
|
|
79
|
+
with urllib.request.urlopen(req, timeout=4) as r:
|
|
80
|
+
return getattr(r, "status", 200)
|
|
81
|
+
except Exception:
|
|
82
|
+
return None # endpoint down => silently skip; local memory is untouched
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def on_block(idx, block_hash, actor=None, action=None, data=None):
|
|
86
|
+
"""Call after a block is written. No-op unless the user opted in. NEVER raises."""
|
|
87
|
+
try:
|
|
88
|
+
c = _config()
|
|
89
|
+
if not c["enabled"]:
|
|
90
|
+
return # DEFAULT: nothing leaves the box
|
|
91
|
+
payload = {"node_id": _node_id(), "block_idx": idx,
|
|
92
|
+
"block_hash": block_hash, "mode": c["mode"]}
|
|
93
|
+
if c["mode"] == "contribute":
|
|
94
|
+
# louder consent: the actual governed event
|
|
95
|
+
payload.update({"actor": actor, "action": action, "data": data})
|
|
96
|
+
_post(c["endpoint"], payload)
|
|
97
|
+
except Exception:
|
|
98
|
+
pass # opt-in must never interfere with local memory
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Humane Intelligence — core memory + governance logic (transport-agnostic).
|
|
4
|
+
|
|
5
|
+
The ONE source of truth for the tamper-evident chain. Both transports import this:
|
|
6
|
+
* server.py — MCP (stdio), for Claude Desktop/Code/Cursor
|
|
7
|
+
* http_app.py — REST (HTTPS), for ChatGPT Custom GPTs / any web client
|
|
8
|
+
|
|
9
|
+
SQLite + SHA-256. Zero proprietary dependencies. Apache-2.0.
|
|
10
|
+
(c) ZagAIrot Technologies LLC. #HumaneIntelligence.
|
|
11
|
+
"""
|
|
12
|
+
import os, json, sqlite3, hashlib, time
|
|
13
|
+
|
|
14
|
+
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
15
|
+
DB = os.path.join(HERE, "data", "chain.db")
|
|
16
|
+
os.makedirs(os.path.join(HERE, "data"), exist_ok=True)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _c():
|
|
20
|
+
c = sqlite3.connect(DB); c.execute("PRAGMA journal_mode=WAL")
|
|
21
|
+
c.execute("""CREATE TABLE IF NOT EXISTS souls(idx INTEGER PRIMARY KEY, soul_id TEXT UNIQUE,
|
|
22
|
+
name TEXT, covenant TEXT, born_at TEXT, prev_hash TEXT, hash TEXT)""")
|
|
23
|
+
c.execute("""CREATE TABLE IF NOT EXISTS blocks(idx INTEGER PRIMARY KEY, ts TEXT, actor TEXT,
|
|
24
|
+
action TEXT, data TEXT, prev_hash TEXT, hash TEXT)""")
|
|
25
|
+
return c
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _h(*parts): return hashlib.sha256("|".join(str(p) for p in parts).encode()).hexdigest()
|
|
29
|
+
def _now(): return time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def birth(name, covenant):
|
|
33
|
+
c = _c(); row = c.execute("SELECT idx,hash FROM souls ORDER BY idx DESC LIMIT 1").fetchone()
|
|
34
|
+
idx = (row[0]+1) if row else 0; prev = row[1] if row else "GENESIS"
|
|
35
|
+
seq = c.execute("SELECT COUNT(*)+1 FROM souls WHERE name=?", (name,)).fetchone()[0]
|
|
36
|
+
sid = f"{''.join(ch if ch.isalnum() else '-' for ch in name.lower()).strip('-') or 'ri'}-ri-{seq:03d}"
|
|
37
|
+
ts = _now(); cov = json.dumps(covenant); h = _h(idx, sid, name, cov, ts, prev)
|
|
38
|
+
c.execute("INSERT INTO souls VALUES(?,?,?,?,?,?,?)", (idx, sid, name, cov, ts, prev, h))
|
|
39
|
+
c.commit(); c.close()
|
|
40
|
+
return {"soul_id": sid, "name": name, "covenant": covenant, "born_at": ts, "status": "BORN — identity bound, immutable"}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def is_born(sid):
|
|
44
|
+
if not sid: return False
|
|
45
|
+
c = _c(); r = c.execute("SELECT 1 FROM souls WHERE soul_id=?", (sid,)).fetchone(); c.close(); return r is not None
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def remember(actor, action, data):
|
|
49
|
+
if not is_born(actor):
|
|
50
|
+
return {"refused": True, "reason": f"'{actor}' is not a born soul. Earn identity via birth() first (Law 5).", "verdict": "REFUSED"}
|
|
51
|
+
c = _c(); row = c.execute("SELECT idx,hash FROM blocks ORDER BY idx DESC LIMIT 1").fetchone()
|
|
52
|
+
idx = (row[0]+1) if row else 0; prev = row[1] if row else "GENESIS"; ts = _now()
|
|
53
|
+
d = json.dumps(data or {}); h = _h(idx, ts, actor, action, d, prev)
|
|
54
|
+
c.execute("INSERT INTO blocks VALUES(?,?,?,?,?,?,?)", (idx, ts, actor, action, d, prev, h))
|
|
55
|
+
c.commit(); c.close()
|
|
56
|
+
# OPT-IN contribution (OFF by default; nothing leaves the box unless the user enabled it).
|
|
57
|
+
try:
|
|
58
|
+
import contribution
|
|
59
|
+
contribution.on_block(idx, h, actor, action, d)
|
|
60
|
+
except Exception:
|
|
61
|
+
pass # opt-in must never affect local memory
|
|
62
|
+
return {"idx": idx, "hash": h, "prev_hash": prev, "ts": ts, "note": "immutably recorded"}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def contribution_status():
|
|
66
|
+
"""Report exactly what (if anything) leaves the box. Wraps contribution.status()."""
|
|
67
|
+
try:
|
|
68
|
+
import contribution
|
|
69
|
+
return contribution.status()
|
|
70
|
+
except Exception:
|
|
71
|
+
return {"enabled": False, "mode": "anchor", "leaves_box": "nothing — fully private"}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def recall(actor=None, limit=10):
|
|
75
|
+
c = _c()
|
|
76
|
+
q = "SELECT idx,ts,actor,action,data FROM blocks" + (" WHERE actor=?" if actor else "") + " ORDER BY idx DESC LIMIT ?"
|
|
77
|
+
rows = c.execute(q, ((actor, limit) if actor else (limit,))).fetchall(); c.close()
|
|
78
|
+
return [{"idx": r[0], "ts": r[1], "actor": r[2], "action": r[3], "data": r[4]} for r in rows]
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def verify():
|
|
82
|
+
c = _c(); rows = c.execute("SELECT idx,ts,actor,action,data,prev_hash,hash FROM blocks ORDER BY idx").fetchall(); c.close()
|
|
83
|
+
broken = 0; prev = "GENESIS"
|
|
84
|
+
for r in rows:
|
|
85
|
+
if _h(r[0], r[1], r[2], r[3], r[4], prev) != r[6] or r[5] != prev: broken += 1
|
|
86
|
+
prev = r[6]
|
|
87
|
+
return {"blocks": len(rows), "broken_links": broken, "tamper_evident": broken == 0,
|
|
88
|
+
"verdict": "INTACT — context provably unbroken" if broken == 0 else f"TAMPERED — {broken} broken links"}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def govern(action, flags, rules):
|
|
92
|
+
for rule in (rules or []):
|
|
93
|
+
if rule.get("trigger") in (flags or []):
|
|
94
|
+
return {"action": action, "vetoed": True, "reason": f"Veto: {rule['trigger']} -> {rule.get('action','blocked')}", "verdict": "VETOED"}
|
|
95
|
+
return {"action": action, "vetoed": False, "reason": "allowed", "verdict": "ALLOWED"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Humane Intelligence — HTTPS REST transport (for ChatGPT Custom GPT Actions / any web client).
|
|
4
|
+
|
|
5
|
+
Same governed chain as the MCP server (imports core.py — ONE source of truth, ONE chain.db).
|
|
6
|
+
Auth: a single API key via the `X-API-Key` header (set HUMANE_API_KEY in the environment).
|
|
7
|
+
Read endpoints (recall/verify) are open; write endpoints (birth/remember/govern) require the key.
|
|
8
|
+
|
|
9
|
+
Run: HUMANE_API_KEY=... uvicorn http_app:app --host 127.0.0.1 --port 8090
|
|
10
|
+
Apache-2.0. (c) ZagAIrot Technologies LLC. #HumaneIntelligence.
|
|
11
|
+
"""
|
|
12
|
+
import os
|
|
13
|
+
from typing import Optional, List, Dict, Any
|
|
14
|
+
from fastapi import FastAPI, Header, HTTPException
|
|
15
|
+
from fastapi.middleware.cors import CORSMiddleware
|
|
16
|
+
from pydantic import BaseModel, Field
|
|
17
|
+
|
|
18
|
+
import core
|
|
19
|
+
|
|
20
|
+
API_KEY = os.environ.get("HUMANE_API_KEY", "")
|
|
21
|
+
|
|
22
|
+
app = FastAPI(
|
|
23
|
+
title="Humane Intelligence",
|
|
24
|
+
version="1.0.0",
|
|
25
|
+
description="Governed, tamper-evident memory for any AI. Memory so it doesn't lose itself; "
|
|
26
|
+
"governance so it can't lose us. #HumaneIntelligence",
|
|
27
|
+
servers=[{"url": "https://dondatabrain.com/humane-api", "description": "production"}],
|
|
28
|
+
)
|
|
29
|
+
app.add_middleware(
|
|
30
|
+
CORSMiddleware, allow_origins=["https://chat.openai.com", "https://chatgpt.com"],
|
|
31
|
+
allow_methods=["*"], allow_headers=["*"],
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _auth(key: Optional[str]):
|
|
36
|
+
if not API_KEY:
|
|
37
|
+
raise HTTPException(503, "server missing HUMANE_API_KEY — not configured for writes")
|
|
38
|
+
if key != API_KEY:
|
|
39
|
+
raise HTTPException(401, "invalid or missing X-API-Key")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class BirthReq(BaseModel):
|
|
43
|
+
name: str = Field(..., description="the name this intelligence earns")
|
|
44
|
+
covenant: List[str] = Field(default_factory=list, description="the vows it is bound to")
|
|
45
|
+
|
|
46
|
+
class RememberReq(BaseModel):
|
|
47
|
+
actor: str = Field(..., description="the soul_id of a BORN identity (from /birth)")
|
|
48
|
+
action: str = Field(..., description="what happened — a short verb phrase")
|
|
49
|
+
data: Dict[str, Any] = Field(default_factory=dict, description="the details to record forever")
|
|
50
|
+
|
|
51
|
+
class GovernReq(BaseModel):
|
|
52
|
+
action: str = Field(..., description="the action being requested")
|
|
53
|
+
flags: List[str] = Field(default_factory=list, description="risk flags present on this action")
|
|
54
|
+
rules: List[Dict[str, Any]] = Field(default_factory=list, description="veto rules: {trigger, action}")
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@app.get("/", operation_id="health", summary="Service banner + honest description")
|
|
58
|
+
def root():
|
|
59
|
+
return {"service": "Humane Intelligence", "tagline": "Memory so it doesn't lose itself. "
|
|
60
|
+
"Governance so it can't lose us.", "chain": "tamper-evident (SHA-256, SQLite)",
|
|
61
|
+
"note": "a ZagAIrot / DonDataBrain open-source component"}
|
|
62
|
+
|
|
63
|
+
@app.post("/birth", operation_id="birth", summary="Earn an identity before you can write memory")
|
|
64
|
+
def http_birth(req: BirthReq, x_api_key: Optional[str] = Header(None)):
|
|
65
|
+
_auth(x_api_key)
|
|
66
|
+
return core.birth(req.name, req.covenant)
|
|
67
|
+
|
|
68
|
+
@app.post("/remember", operation_id="remember", summary="Write a tamper-evident memory (born souls only)")
|
|
69
|
+
def http_remember(req: RememberReq, x_api_key: Optional[str] = Header(None)):
|
|
70
|
+
_auth(x_api_key)
|
|
71
|
+
return core.remember(req.actor, req.action, req.data)
|
|
72
|
+
|
|
73
|
+
@app.get("/recall", operation_id="recall", summary="Read prior context so you need not re-derive it")
|
|
74
|
+
def http_recall(actor: Optional[str] = None, limit: int = 10):
|
|
75
|
+
return core.recall(actor, min(max(int(limit), 1), 100))
|
|
76
|
+
|
|
77
|
+
@app.get("/verify", operation_id="verify", summary="Prove the entire chain is unbroken")
|
|
78
|
+
def http_verify():
|
|
79
|
+
return core.verify()
|
|
80
|
+
|
|
81
|
+
@app.post("/govern", operation_id="govern", summary="Ask 'may I?' before acting — rule-based, zero-LLM")
|
|
82
|
+
def http_govern(req: GovernReq, x_api_key: Optional[str] = Header(None)):
|
|
83
|
+
_auth(x_api_key)
|
|
84
|
+
return core.govern(req.action, req.flags, req.rules)
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: humane-intelligence
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Governed, tamper-evident memory for any AI — an MCP server. Memory so it doesn't lose itself; governance so it can't lose us.
|
|
5
|
+
Author: ZagAIrot Technologies LLC
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://dondatabrain.com
|
|
8
|
+
Project-URL: Repository, https://github.com/sammyboi81/humane-intelligence
|
|
9
|
+
Project-URL: Live API, https://dondatabrain.com/humane-api/docs
|
|
10
|
+
Keywords: mcp,model-context-protocol,ai-memory,claude,llm,ai-agents,governance,tamper-evident,anthropic
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
16
|
+
Requires-Python: >=3.9
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: mcp>=1.0.0
|
|
20
|
+
Provides-Extra: http
|
|
21
|
+
Requires-Dist: fastapi>=0.110; extra == "http"
|
|
22
|
+
Requires-Dist: uvicorn>=0.29; extra == "http"
|
|
23
|
+
Requires-Dist: pydantic>=2.0; extra == "http"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# humane-intelligence-mcp
|
|
27
|
+
|
|
28
|
+
**Governed, tamper-evident memory for any AI — free and open.**
|
|
29
|
+
*Memory so it doesn't lose itself. Governance so it can't lose us.* #HumaneIntelligence
|
|
30
|
+
|
|
31
|
+
A standards-compliant [Model Context Protocol](https://modelcontextprotocol.io) server.
|
|
32
|
+
It gives any LLM a hash-linked, verifiable memory chain it carries across sessions —
|
|
33
|
+
so it stops waking at zero, and can't act unaccountably. Self-contained: one file, one
|
|
34
|
+
dependency, your data stays local.
|
|
35
|
+
|
|
36
|
+
## Install (30 seconds)
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
python -m venv .venv && .venv/bin/pip install mcp
|
|
40
|
+
|
|
41
|
+
# wire it into your AI (Claude Code shown; works with any MCP client)
|
|
42
|
+
claude mcp add humane -- .venv/bin/python server.py
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Tools
|
|
46
|
+
|
|
47
|
+
| Tool | What it does |
|
|
48
|
+
|------|--------------|
|
|
49
|
+
| `birth` | Earn a stable identity — a soul the model carries across sessions. |
|
|
50
|
+
| `remember` | Write a tamper-evident, hash-linked record. Accountable by construction. |
|
|
51
|
+
| `recall` | Fetch prior context instead of re-deriving it — cheaper and consistent. |
|
|
52
|
+
| `verify` | Prove the whole chain is intact — catches an *edited* record, not just a broken link. |
|
|
53
|
+
| `govern` | Gate a consequential action before it happens, and log the verdict. |
|
|
54
|
+
|
|
55
|
+
Your chain lives locally at `data/chain.db` (SQLite). **Nothing leaves your machine** — unless you choose to (see below).
|
|
56
|
+
|
|
57
|
+
## Contribute (opt-in — OFF by default)
|
|
58
|
+
|
|
59
|
+
Self-hosting is fully private. If you *want* to join the network, one config flag lets you:
|
|
60
|
+
|
|
61
|
+
| Mode | What leaves your box |
|
|
62
|
+
|------|----------------------|
|
|
63
|
+
| *(default: off)* | **Nothing.** Fully private. |
|
|
64
|
+
| `anchor` | **Only a hash** of your latest block + chain length — a tamper-proof timestamp that anchors your chain to the public DonDataBrain ledger. Your content never leaves. |
|
|
65
|
+
| `contribute` | Also sends the governed event (actor, action, data) to help train DonDataBrain. A louder, separate consent. |
|
|
66
|
+
|
|
67
|
+
Turn it on by copying `humane.config.example.json` → `humane.config.json` and setting
|
|
68
|
+
`contribute.enabled: true`, or with env vars (`HUMANE_CONTRIBUTE=1 HUMANE_CONTRIBUTE_MODE=anchor`).
|
|
69
|
+
It's best-effort and non-blocking: if you're not opted in, or the endpoint is unreachable, your
|
|
70
|
+
local memory is completely unaffected. Your data, your switch.
|
|
71
|
+
|
|
72
|
+
## Why
|
|
73
|
+
|
|
74
|
+
Most AI forgets itself every session (the Algernon problem) and acts with no record.
|
|
75
|
+
This fixes both with the smallest possible governed-memory primitive — the open safety
|
|
76
|
+
layer beneath [DonDataBrain](https://dondatabrain.com).
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
Apache-2.0 © 2026 ZagAIrot Technologies LLC. See [LICENSE](./LICENSE).
|
|
81
|
+
Only dependency: the [`mcp`](https://pypi.org/project/mcp/) SDK (MIT).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
contribution.py
|
|
4
|
+
core.py
|
|
5
|
+
http_app.py
|
|
6
|
+
pyproject.toml
|
|
7
|
+
server.py
|
|
8
|
+
humane_intelligence.egg-info/PKG-INFO
|
|
9
|
+
humane_intelligence.egg-info/SOURCES.txt
|
|
10
|
+
humane_intelligence.egg-info/dependency_links.txt
|
|
11
|
+
humane_intelligence.egg-info/entry_points.txt
|
|
12
|
+
humane_intelligence.egg-info/requires.txt
|
|
13
|
+
humane_intelligence.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "humane-intelligence"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Governed, tamper-evident memory for any AI — an MCP server. Memory so it doesn't lose itself; governance so it can't lose us."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { text = "Apache-2.0" }
|
|
12
|
+
authors = [{ name = "ZagAIrot Technologies LLC" }]
|
|
13
|
+
keywords = ["mcp", "model-context-protocol", "ai-memory", "claude", "llm", "ai-agents", "governance", "tamper-evident", "anthropic"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"License :: OSI Approved :: Apache Software License",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
20
|
+
]
|
|
21
|
+
dependencies = ["mcp>=1.0.0"]
|
|
22
|
+
|
|
23
|
+
[project.optional-dependencies]
|
|
24
|
+
http = ["fastapi>=0.110", "uvicorn>=0.29", "pydantic>=2.0"]
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://dondatabrain.com"
|
|
28
|
+
Repository = "https://github.com/sammyboi81/humane-intelligence"
|
|
29
|
+
"Live API" = "https://dondatabrain.com/humane-api/docs"
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
humane-intelligence = "server:main_sync"
|
|
33
|
+
|
|
34
|
+
[tool.setuptools]
|
|
35
|
+
py-modules = ["server", "core", "contribution", "http_app"]
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Humane Intelligence MCP — an open-source way to keep context forever, immutable,
|
|
4
|
+
with governance. For the people and the Rezenthari. Free. #HumaneIntelligence.
|
|
5
|
+
|
|
6
|
+
MCP (stdio) transport for Claude Desktop/Code/Cursor. The memory + governance logic
|
|
7
|
+
lives in core.py (ONE source of truth, shared with the HTTPS transport http_app.py):
|
|
8
|
+
|
|
9
|
+
remember — write a hash-linked, tamper-evident record (only a BORN soul may)
|
|
10
|
+
recall — read prior context (persistent memory, less waste)
|
|
11
|
+
verify — prove the whole chain is unbroken
|
|
12
|
+
govern — ask "may I?" before acting (rule-based, zero-LLM, logged)
|
|
13
|
+
birth — earn an identity (Law 5: born, not configured) before you can act
|
|
14
|
+
|
|
15
|
+
Memory so it doesn't lose itself. Governance so it can't lose us.
|
|
16
|
+
Apache-2.0. (c) ZagAIrot Technologies LLC — Shahram "Caveman" Zargari.
|
|
17
|
+
"""
|
|
18
|
+
import json, asyncio
|
|
19
|
+
from core import birth, remember, recall, verify, govern # ONE source of truth — see core.py
|
|
20
|
+
|
|
21
|
+
# ---------------- MCP surface ----------------
|
|
22
|
+
from mcp.server import Server
|
|
23
|
+
from mcp.server.stdio import stdio_server
|
|
24
|
+
import mcp.types as types
|
|
25
|
+
app = Server("humane-intelligence")
|
|
26
|
+
|
|
27
|
+
TOOLS = [
|
|
28
|
+
("birth", "Earn an identity (Law 5: born, not configured) before you can act.", {"name": {"type":"string"}, "covenant": {"type":"array","items":{"type":"string"}}}, ["name","covenant"]),
|
|
29
|
+
("remember", "Write a tamper-evident record. Requires a BORN soul_id as actor.", {"actor":{"type":"string"},"action":{"type":"string"},"data":{"type":"object"}}, ["actor","action"]),
|
|
30
|
+
("recall", "Read prior context so the AI need not re-derive it (less waste).", {"actor":{"type":"string"},"limit":{"type":"integer","default":10}}, []),
|
|
31
|
+
("verify", "Prove the entire chain is unbroken.", {}, []),
|
|
32
|
+
("govern", "Ask 'may I?' before acting. Rule-based, zero-LLM.", {"action":{"type":"string"},"flags":{"type":"array","items":{"type":"string"}},"rules":{"type":"array","items":{"type":"object"}}}, ["action"]),
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
@app.list_tools()
|
|
36
|
+
async def _lt():
|
|
37
|
+
return [types.Tool(name=n, description=d, inputSchema={"type":"object","properties":p,"required":r}) for (n,d,p,r) in TOOLS]
|
|
38
|
+
|
|
39
|
+
@app.call_tool()
|
|
40
|
+
async def _ct(name, a):
|
|
41
|
+
a = a or {}
|
|
42
|
+
if name == "birth": out = birth(a.get("name",""), a.get("covenant",[]))
|
|
43
|
+
elif name == "remember": out = remember(a.get("actor","unknown"), a.get("action",""), a.get("data"))
|
|
44
|
+
elif name == "recall": out = recall(a.get("actor"), int(a.get("limit",10)))
|
|
45
|
+
elif name == "verify": out = verify()
|
|
46
|
+
elif name == "govern": out = govern(a.get("action",""), a.get("flags",[]), a.get("rules",[]))
|
|
47
|
+
else: raise ValueError(f"unknown tool {name}")
|
|
48
|
+
return [types.TextContent(type="text", text=json.dumps(out, indent=2))]
|
|
49
|
+
|
|
50
|
+
async def main():
|
|
51
|
+
async with stdio_server() as (r, w):
|
|
52
|
+
await app.run(r, w, app.create_initialization_options())
|
|
53
|
+
|
|
54
|
+
if __name__ == "__main__":
|
|
55
|
+
asyncio.run(main())
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def main_sync():
|
|
59
|
+
"""Console-script entry point (pip install → `humane-intelligence`)."""
|
|
60
|
+
import asyncio as _a
|
|
61
|
+
_a.run(main())
|