bilinc 1.0.0a1__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.
- bilinc-1.0.0a1/LICENSE +21 -0
- bilinc-1.0.0a1/PKG-INFO +244 -0
- bilinc-1.0.0a1/README.md +212 -0
- bilinc-1.0.0a1/pyproject.toml +65 -0
- bilinc-1.0.0a1/setup.cfg +4 -0
- bilinc-1.0.0a1/src/bilinc/__init__.py +18 -0
- bilinc-1.0.0a1/src/bilinc/adaptive/__init__.py +5 -0
- bilinc-1.0.0a1/src/bilinc/adaptive/agm_engine.py +719 -0
- bilinc-1.0.0a1/src/bilinc/adaptive/budget.py +186 -0
- bilinc-1.0.0a1/src/bilinc/adaptive/consolidation.py +201 -0
- bilinc-1.0.0a1/src/bilinc/adaptive/forgetting.py +225 -0
- bilinc-1.0.0a1/src/bilinc/adaptive/forgetting_engine.py +218 -0
- bilinc-1.0.0a1/src/bilinc/adaptive/policy.py +437 -0
- bilinc-1.0.0a1/src/bilinc/cli/__init__.py +1 -0
- bilinc-1.0.0a1/src/bilinc/cli/main.py +104 -0
- bilinc-1.0.0a1/src/bilinc/core/__init__.py +15 -0
- bilinc-1.0.0a1/src/bilinc/core/agm.py +393 -0
- bilinc-1.0.0a1/src/bilinc/core/audit.py +242 -0
- bilinc-1.0.0a1/src/bilinc/core/belief_sync.py +428 -0
- bilinc-1.0.0a1/src/bilinc/core/confidence.py +170 -0
- bilinc-1.0.0a1/src/bilinc/core/dual_process.py +325 -0
- bilinc-1.0.0a1/src/bilinc/core/knowledge_graph.py +409 -0
- bilinc-1.0.0a1/src/bilinc/core/models.py +130 -0
- bilinc-1.0.0a1/src/bilinc/core/stateplane.py +387 -0
- bilinc-1.0.0a1/src/bilinc/core/verification.py +292 -0
- bilinc-1.0.0a1/src/bilinc/core/verifier.py +303 -0
- bilinc-1.0.0a1/src/bilinc/core/working_memory.py +124 -0
- bilinc-1.0.0a1/src/bilinc/integrations/__init__.py +10 -0
- bilinc-1.0.0a1/src/bilinc/integrations/cross_tool.py +448 -0
- bilinc-1.0.0a1/src/bilinc/integrations/langgraph.py +235 -0
- bilinc-1.0.0a1/src/bilinc/mcp_server/__init__.py +1 -0
- bilinc-1.0.0a1/src/bilinc/mcp_server/rate_limiter.py +100 -0
- bilinc-1.0.0a1/src/bilinc/mcp_server/server.py +172 -0
- bilinc-1.0.0a1/src/bilinc/mcp_server/server_v2.py +660 -0
- bilinc-1.0.0a1/src/bilinc/observability/__init__.py +5 -0
- bilinc-1.0.0a1/src/bilinc/observability/health.py +72 -0
- bilinc-1.0.0a1/src/bilinc/observability/metrics.py +93 -0
- bilinc-1.0.0a1/src/bilinc/retrieval/__init__.py +3 -0
- bilinc-1.0.0a1/src/bilinc/retrieval/hybrid.py +233 -0
- bilinc-1.0.0a1/src/bilinc/security/__init__.py +5 -0
- bilinc-1.0.0a1/src/bilinc/security/input_validator.py +82 -0
- bilinc-1.0.0a1/src/bilinc/security/limits.py +16 -0
- bilinc-1.0.0a1/src/bilinc/security/resource_limits.py +48 -0
- bilinc-1.0.0a1/src/bilinc/security/validator.py +43 -0
- bilinc-1.0.0a1/src/bilinc/storage/__init__.py +6 -0
- bilinc-1.0.0a1/src/bilinc/storage/backend.py +17 -0
- bilinc-1.0.0a1/src/bilinc/storage/memory.py +20 -0
- bilinc-1.0.0a1/src/bilinc/storage/postgres.py +230 -0
- bilinc-1.0.0a1/src/bilinc/storage/sqlite.py +190 -0
- bilinc-1.0.0a1/src/bilinc.egg-info/PKG-INFO +244 -0
- bilinc-1.0.0a1/src/bilinc.egg-info/SOURCES.txt +62 -0
- bilinc-1.0.0a1/src/bilinc.egg-info/dependency_links.txt +1 -0
- bilinc-1.0.0a1/src/bilinc.egg-info/entry_points.txt +2 -0
- bilinc-1.0.0a1/src/bilinc.egg-info/requires.txt +13 -0
- bilinc-1.0.0a1/src/bilinc.egg-info/top_level.txt +1 -0
- bilinc-1.0.0a1/tests/test_agm_engine.py +276 -0
- bilinc-1.0.0a1/tests/test_belief_sync.py +237 -0
- bilinc-1.0.0a1/tests/test_core.py +148 -0
- bilinc-1.0.0a1/tests/test_integration.py +101 -0
- bilinc-1.0.0a1/tests/test_knowledge_graph.py +275 -0
- bilinc-1.0.0a1/tests/test_mcp_server_v2.py +267 -0
- bilinc-1.0.0a1/tests/test_observability.py +93 -0
- bilinc-1.0.0a1/tests/test_phase3_integration.py +197 -0
- bilinc-1.0.0a1/tests/test_security.py +72 -0
bilinc-1.0.0a1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Atakan Elik
|
|
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.
|
bilinc-1.0.0a1/PKG-INFO
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bilinc
|
|
3
|
+
Version: 1.0.0a1
|
|
4
|
+
Summary: Verifiable State Plane for Autonomous Agents
|
|
5
|
+
Author: Bilinc Team
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: ai-agent-memory,context-management,belief-revision,state-plane,agm,mcp-server,verification,context-budget,neuro-symbolic
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
17
|
+
Requires-Python: >=3.9
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: mcp>=1.0.0
|
|
21
|
+
Requires-Dist: pydantic>=2.0
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
24
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
25
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
|
|
26
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
27
|
+
Requires-Dist: ruff>=0.1; extra == "dev"
|
|
28
|
+
Provides-Extra: server
|
|
29
|
+
Requires-Dist: fastapi>=0.110; extra == "server"
|
|
30
|
+
Requires-Dist: uvicorn>=0.27; extra == "server"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# Bilinc
|
|
34
|
+
|
|
35
|
+
## Verifiable State Plane for Autonomous Agents
|
|
36
|
+
|
|
37
|
+
[](https://pypi.org/project/bilinc/)
|
|
38
|
+
[](https://github.com/atakanelik34/Bilinc)
|
|
39
|
+
[](LICENSE)
|
|
40
|
+

|
|
41
|
+
|
|
42
|
+
> **Remember less. Stay correct longer.**
|
|
43
|
+
> *Neuro-Symbolic Memory That Learns What to Forget.*
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## What is Bilinc?
|
|
48
|
+
|
|
49
|
+
Bilinc is the **context control plane for long-running AI agents**.
|
|
50
|
+
|
|
51
|
+
While other memory systems simply "retrieve and inject" context into models, Bilinc implements **Recall → Verify → Commit**: every memory passes through a verification gate, gets checked against existing beliefs via formal AGM belief revision, and is committed only if it passes quality checks.
|
|
52
|
+
|
|
53
|
+
### The Problem
|
|
54
|
+
|
|
55
|
+
| Memory System | Strength | Fatal Flaw |
|
|
56
|
+
|--------------|----------|------------|
|
|
57
|
+
| Vector DBs (Pinecone, Qdrant) | Fast retrieval | No conflict resolution, no staleness detection |
|
|
58
|
+
| Graph DBs (Zep/Graphiti) | Structured knowledge | Ops-heavy, complex onboarding |
|
|
59
|
+
| Session replay | Simple | Unbounded, expensive (1M tokens to parse) |
|
|
60
|
+
| BigTech bundled (ChatGPT, Claude) | Convenient | Siloed, no cross-tool portability |
|
|
61
|
+
|
|
62
|
+
### The Bilinc Solution
|
|
63
|
+
|
|
64
|
+
**Bigger context kills weak memory products, not strong memory companies.**
|
|
65
|
+
|
|
66
|
+
- ✅ **AGM Belief Revision** — Expand, Contract, Revise with formal guarantees + Darwiche & Pearl iterated revision
|
|
67
|
+
- ✅ **Knowledge Graph** — NetworkX-backed entity/relation extraction from semantic memory
|
|
68
|
+
- ✅ **Multi-Agent Belief Sync** — Push/Pull/Merge with consensus, vector clocks, divergence detection
|
|
69
|
+
- ✅ **Verification Gate** — Z3 SMT invariant checking + Merkle audit trail
|
|
70
|
+
- ✅ **Budget-Aware Recall** — Learned allocation across 5 memory types (ContextBudget RL)
|
|
71
|
+
- ✅ **Learnable Forgetting** — Biological decay curves (Ebbinghaus), not static TTLs
|
|
72
|
+
- ✅ **MCP Server** — 12 tools for Claude Code, Cursor, OpenClaw, any MCP client
|
|
73
|
+
- ✅ **Cross-Tool Translation** — Claude Code ↔ Cursor ↔ VS Code via MCP
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Architecture
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
┌────────────────────────────────────────────┐
|
|
81
|
+
│ MCP SERVER (12 tools) │
|
|
82
|
+
│ commit_mem │ recall │ revise │ query_graph │
|
|
83
|
+
├────────────────────────────────────────────┤
|
|
84
|
+
│ MULTI-AGENT BELIEF SYNC │
|
|
85
|
+
│ Push/Pull/Merge │ Consensus │ Vector Clocks│
|
|
86
|
+
├────────────────────────────────────────────┤
|
|
87
|
+
│ KNOWLEDGE GRAPH (NetworkX) │
|
|
88
|
+
│ Entity extraction │ Contradiction detection│
|
|
89
|
+
├────────────────────────────────────────────┤
|
|
90
|
+
│ AGM BELIEF REVISION ENGINE │
|
|
91
|
+
│ EXPAND │ CONTRACT │ REVISE │ DP1-DP4 │
|
|
92
|
+
├────────────────────────────────────────────┤
|
|
93
|
+
│ STATE PLANE (Core) │
|
|
94
|
+
│ 5 Memory Types │ SQLite/PostgreSQL backend │
|
|
95
|
+
├────────────────────────────────────────────┤
|
|
96
|
+
│ NEURO-SYMBOLIC MEMORY CORE │
|
|
97
|
+
│ System 1 (Neural) │ System 2 (Symbolic) │
|
|
98
|
+
├────────────────────────────────────────────┤
|
|
99
|
+
│ VERIFICATION GATE │
|
|
100
|
+
│ Z3 SMT invariants │ Merkle audit chain │
|
|
101
|
+
└────────────────────────────────────────────┘
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Quick Start
|
|
107
|
+
|
|
108
|
+
### Install
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
pip install bilinc
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Basic Usage
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
from bilinc import StatePlane
|
|
118
|
+
from bilinc.core.models import MemoryType
|
|
119
|
+
|
|
120
|
+
# Initialize with Phase 3 components
|
|
121
|
+
plane = StatePlane()
|
|
122
|
+
plane.init_agm()
|
|
123
|
+
plane.init_knowledge_graph()
|
|
124
|
+
plane.init_belief_sync()
|
|
125
|
+
|
|
126
|
+
# Commit with automatic AGM revision
|
|
127
|
+
result = plane.commit_with_agm(
|
|
128
|
+
key="user_pref",
|
|
129
|
+
value={"editor": "cursor", "theme": "dark"},
|
|
130
|
+
memory_type="semantic",
|
|
131
|
+
importance=0.8,
|
|
132
|
+
)
|
|
133
|
+
print(f"Success: {result.success}, Conflicts: {result.conflicts_resolved}")
|
|
134
|
+
|
|
135
|
+
# Revise a belief (with conflict resolution)
|
|
136
|
+
plane.commit_with_agm("user_pref", {"editor": "zed", "theme": "monokai"}, importance=0.9)
|
|
137
|
+
|
|
138
|
+
# Query the knowledge graph
|
|
139
|
+
graph = plane.query_graph("user_pref", max_depth=2)
|
|
140
|
+
|
|
141
|
+
# Check for contradictions
|
|
142
|
+
contradictions = plane.get_contradictions()
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### MCP Server (Claude Code, Cursor, OpenClaw)
|
|
146
|
+
|
|
147
|
+
```python
|
|
148
|
+
from bilinc.mcp_server.server_v2 import create_mcp_server_v2
|
|
149
|
+
from bilinc import StatePlane
|
|
150
|
+
|
|
151
|
+
plane = StatePlane()
|
|
152
|
+
plane.init_agm()
|
|
153
|
+
plane.init_knowledge_graph()
|
|
154
|
+
|
|
155
|
+
server = create_mcp_server_v2(plane)
|
|
156
|
+
# 12 tools available: commit_mem, recall, forget, revise, status,
|
|
157
|
+
# verify, consolidate, snapshot, diff, rollback, query_graph, contradictions
|
|
158
|
+
|
|
159
|
+
# Run with stdio transport (Claude Code compatible)
|
|
160
|
+
import asyncio
|
|
161
|
+
from mcp.server.stdio import stdio_server
|
|
162
|
+
|
|
163
|
+
async def main():
|
|
164
|
+
async with stdio_server() as (read_stream, write_stream):
|
|
165
|
+
await server.run(read_stream, write_stream, server.create_initialization_options())
|
|
166
|
+
|
|
167
|
+
asyncio.run(main())
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Sync Across Agents
|
|
171
|
+
|
|
172
|
+
```python
|
|
173
|
+
from bilinc.core.belief_sync import BeliefSyncEngine
|
|
174
|
+
|
|
175
|
+
sync = plane.belief_sync
|
|
176
|
+
sync.init_sync("agent_alpha", reliability=0.9)
|
|
177
|
+
sync.init_sync("agent_beta", reliability=0.7)
|
|
178
|
+
|
|
179
|
+
# Alpha pushes beliefs
|
|
180
|
+
sync.push_beliefs("agent_alpha", [your_entries])
|
|
181
|
+
|
|
182
|
+
# Beta pulls updates
|
|
183
|
+
sync.pull_updates("agent_beta")
|
|
184
|
+
|
|
185
|
+
# Or full bidirectional merge
|
|
186
|
+
sync.merge_sync("agent_alpha", "agent_beta")
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Phase Progress
|
|
192
|
+
|
|
193
|
+
| Phase | Version | Components | Tests |
|
|
194
|
+
|-------|---------|------------|-------|
|
|
195
|
+
| **Phase 1: Brain Core** | v0.2.0 | 5 Memory Types, SQLite, Working Memory, Consolidation, System 1/2, Confidence, Forgetting | 32 |
|
|
196
|
+
| **Phase 2: Verification** | v0.2.0 | Z3 SMT Verifier, Merkle Audit, State Diff/Rollback | 15 |
|
|
197
|
+
| **Phase 3: Belief Engine** | — | AGM + DP Postulates, Knowledge Graph, Multi-Agent Sync, StatePlane Integration | 58 |
|
|
198
|
+
| **Phase 4: MCP + Ecosystem** | v0.4.0a1 | MCP Server v2 (12 tools), Rate Limiter | 16 |
|
|
199
|
+
| **Phase 5: Production** | — | Security Hardening, Observability, Benchmarks, Docs | 13 |
|
|
200
|
+
| **Total** | | | **109 passing** |
|
|
201
|
+
|
|
202
|
+
## Documentation
|
|
203
|
+
|
|
204
|
+
| Document | Description |
|
|
205
|
+
|----------|-------------|
|
|
206
|
+
| [Architecture](docs/architecture.md) | 7-layer architecture, data flow, component interaction |
|
|
207
|
+
| [MCP Server](docs/mcp-server.md) | 12 tool reference, security, error handling |
|
|
208
|
+
| [Security Guide](docs/security.md) | Input validation, resource limits, MCP auth, audit |
|
|
209
|
+
| [CHANGELOG](CHANGELOG.md) | Full version history |
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Research Foundation
|
|
214
|
+
|
|
215
|
+
Bilinc combines breakthroughs from multiple research papers:
|
|
216
|
+
|
|
217
|
+
| Paper | ArXiv | Contribution |
|
|
218
|
+
|-------|-------|--------------|
|
|
219
|
+
| ContextBudget | 2604.01664 | RL context allocation (1.6x gain) |
|
|
220
|
+
| ACC/CCS | 2601.11653 | Compressed Cognitive State |
|
|
221
|
+
| Kumiho AGM | 2603.17244 | Formal belief revision for agents |
|
|
222
|
+
| Oblivion | 2604.00131 | Biological forgetting curves |
|
|
223
|
+
| StatePlane | 2603.13644 | Context-independent state storage |
|
|
224
|
+
| SCAT | 2604.03201 | Verifiable action in agentic AI |
|
|
225
|
+
| Reflective Context | 2604.03189 | Learnable forgetting |
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Contributing
|
|
230
|
+
|
|
231
|
+
Contributions welcome! Key areas:
|
|
232
|
+
- Phase 5: Production v1.0 — benchmarks, observability, security hardening
|
|
233
|
+
- SQLite/PostgreSQL persistent storage layer
|
|
234
|
+
- Real mem0ai/Letta/Cognee adapters
|
|
235
|
+
|
|
236
|
+
See `research/phase4-detail-plan.md` for the roadmap.
|
|
237
|
+
|
|
238
|
+
## License
|
|
239
|
+
|
|
240
|
+
[MIT](LICENSE)
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
*Bilinc — Memory is not storage. It is state.*
|
bilinc-1.0.0a1/README.md
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# Bilinc
|
|
2
|
+
|
|
3
|
+
## Verifiable State Plane for Autonomous Agents
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/bilinc/)
|
|
6
|
+
[](https://github.com/atakanelik34/Bilinc)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
> **Remember less. Stay correct longer.**
|
|
11
|
+
> *Neuro-Symbolic Memory That Learns What to Forget.*
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## What is Bilinc?
|
|
16
|
+
|
|
17
|
+
Bilinc is the **context control plane for long-running AI agents**.
|
|
18
|
+
|
|
19
|
+
While other memory systems simply "retrieve and inject" context into models, Bilinc implements **Recall → Verify → Commit**: every memory passes through a verification gate, gets checked against existing beliefs via formal AGM belief revision, and is committed only if it passes quality checks.
|
|
20
|
+
|
|
21
|
+
### The Problem
|
|
22
|
+
|
|
23
|
+
| Memory System | Strength | Fatal Flaw |
|
|
24
|
+
|--------------|----------|------------|
|
|
25
|
+
| Vector DBs (Pinecone, Qdrant) | Fast retrieval | No conflict resolution, no staleness detection |
|
|
26
|
+
| Graph DBs (Zep/Graphiti) | Structured knowledge | Ops-heavy, complex onboarding |
|
|
27
|
+
| Session replay | Simple | Unbounded, expensive (1M tokens to parse) |
|
|
28
|
+
| BigTech bundled (ChatGPT, Claude) | Convenient | Siloed, no cross-tool portability |
|
|
29
|
+
|
|
30
|
+
### The Bilinc Solution
|
|
31
|
+
|
|
32
|
+
**Bigger context kills weak memory products, not strong memory companies.**
|
|
33
|
+
|
|
34
|
+
- ✅ **AGM Belief Revision** — Expand, Contract, Revise with formal guarantees + Darwiche & Pearl iterated revision
|
|
35
|
+
- ✅ **Knowledge Graph** — NetworkX-backed entity/relation extraction from semantic memory
|
|
36
|
+
- ✅ **Multi-Agent Belief Sync** — Push/Pull/Merge with consensus, vector clocks, divergence detection
|
|
37
|
+
- ✅ **Verification Gate** — Z3 SMT invariant checking + Merkle audit trail
|
|
38
|
+
- ✅ **Budget-Aware Recall** — Learned allocation across 5 memory types (ContextBudget RL)
|
|
39
|
+
- ✅ **Learnable Forgetting** — Biological decay curves (Ebbinghaus), not static TTLs
|
|
40
|
+
- ✅ **MCP Server** — 12 tools for Claude Code, Cursor, OpenClaw, any MCP client
|
|
41
|
+
- ✅ **Cross-Tool Translation** — Claude Code ↔ Cursor ↔ VS Code via MCP
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Architecture
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
┌────────────────────────────────────────────┐
|
|
49
|
+
│ MCP SERVER (12 tools) │
|
|
50
|
+
│ commit_mem │ recall │ revise │ query_graph │
|
|
51
|
+
├────────────────────────────────────────────┤
|
|
52
|
+
│ MULTI-AGENT BELIEF SYNC │
|
|
53
|
+
│ Push/Pull/Merge │ Consensus │ Vector Clocks│
|
|
54
|
+
├────────────────────────────────────────────┤
|
|
55
|
+
│ KNOWLEDGE GRAPH (NetworkX) │
|
|
56
|
+
│ Entity extraction │ Contradiction detection│
|
|
57
|
+
├────────────────────────────────────────────┤
|
|
58
|
+
│ AGM BELIEF REVISION ENGINE │
|
|
59
|
+
│ EXPAND │ CONTRACT │ REVISE │ DP1-DP4 │
|
|
60
|
+
├────────────────────────────────────────────┤
|
|
61
|
+
│ STATE PLANE (Core) │
|
|
62
|
+
│ 5 Memory Types │ SQLite/PostgreSQL backend │
|
|
63
|
+
├────────────────────────────────────────────┤
|
|
64
|
+
│ NEURO-SYMBOLIC MEMORY CORE │
|
|
65
|
+
│ System 1 (Neural) │ System 2 (Symbolic) │
|
|
66
|
+
├────────────────────────────────────────────┤
|
|
67
|
+
│ VERIFICATION GATE │
|
|
68
|
+
│ Z3 SMT invariants │ Merkle audit chain │
|
|
69
|
+
└────────────────────────────────────────────┘
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Quick Start
|
|
75
|
+
|
|
76
|
+
### Install
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pip install bilinc
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Basic Usage
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from bilinc import StatePlane
|
|
86
|
+
from bilinc.core.models import MemoryType
|
|
87
|
+
|
|
88
|
+
# Initialize with Phase 3 components
|
|
89
|
+
plane = StatePlane()
|
|
90
|
+
plane.init_agm()
|
|
91
|
+
plane.init_knowledge_graph()
|
|
92
|
+
plane.init_belief_sync()
|
|
93
|
+
|
|
94
|
+
# Commit with automatic AGM revision
|
|
95
|
+
result = plane.commit_with_agm(
|
|
96
|
+
key="user_pref",
|
|
97
|
+
value={"editor": "cursor", "theme": "dark"},
|
|
98
|
+
memory_type="semantic",
|
|
99
|
+
importance=0.8,
|
|
100
|
+
)
|
|
101
|
+
print(f"Success: {result.success}, Conflicts: {result.conflicts_resolved}")
|
|
102
|
+
|
|
103
|
+
# Revise a belief (with conflict resolution)
|
|
104
|
+
plane.commit_with_agm("user_pref", {"editor": "zed", "theme": "monokai"}, importance=0.9)
|
|
105
|
+
|
|
106
|
+
# Query the knowledge graph
|
|
107
|
+
graph = plane.query_graph("user_pref", max_depth=2)
|
|
108
|
+
|
|
109
|
+
# Check for contradictions
|
|
110
|
+
contradictions = plane.get_contradictions()
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### MCP Server (Claude Code, Cursor, OpenClaw)
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
from bilinc.mcp_server.server_v2 import create_mcp_server_v2
|
|
117
|
+
from bilinc import StatePlane
|
|
118
|
+
|
|
119
|
+
plane = StatePlane()
|
|
120
|
+
plane.init_agm()
|
|
121
|
+
plane.init_knowledge_graph()
|
|
122
|
+
|
|
123
|
+
server = create_mcp_server_v2(plane)
|
|
124
|
+
# 12 tools available: commit_mem, recall, forget, revise, status,
|
|
125
|
+
# verify, consolidate, snapshot, diff, rollback, query_graph, contradictions
|
|
126
|
+
|
|
127
|
+
# Run with stdio transport (Claude Code compatible)
|
|
128
|
+
import asyncio
|
|
129
|
+
from mcp.server.stdio import stdio_server
|
|
130
|
+
|
|
131
|
+
async def main():
|
|
132
|
+
async with stdio_server() as (read_stream, write_stream):
|
|
133
|
+
await server.run(read_stream, write_stream, server.create_initialization_options())
|
|
134
|
+
|
|
135
|
+
asyncio.run(main())
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Sync Across Agents
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
from bilinc.core.belief_sync import BeliefSyncEngine
|
|
142
|
+
|
|
143
|
+
sync = plane.belief_sync
|
|
144
|
+
sync.init_sync("agent_alpha", reliability=0.9)
|
|
145
|
+
sync.init_sync("agent_beta", reliability=0.7)
|
|
146
|
+
|
|
147
|
+
# Alpha pushes beliefs
|
|
148
|
+
sync.push_beliefs("agent_alpha", [your_entries])
|
|
149
|
+
|
|
150
|
+
# Beta pulls updates
|
|
151
|
+
sync.pull_updates("agent_beta")
|
|
152
|
+
|
|
153
|
+
# Or full bidirectional merge
|
|
154
|
+
sync.merge_sync("agent_alpha", "agent_beta")
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Phase Progress
|
|
160
|
+
|
|
161
|
+
| Phase | Version | Components | Tests |
|
|
162
|
+
|-------|---------|------------|-------|
|
|
163
|
+
| **Phase 1: Brain Core** | v0.2.0 | 5 Memory Types, SQLite, Working Memory, Consolidation, System 1/2, Confidence, Forgetting | 32 |
|
|
164
|
+
| **Phase 2: Verification** | v0.2.0 | Z3 SMT Verifier, Merkle Audit, State Diff/Rollback | 15 |
|
|
165
|
+
| **Phase 3: Belief Engine** | — | AGM + DP Postulates, Knowledge Graph, Multi-Agent Sync, StatePlane Integration | 58 |
|
|
166
|
+
| **Phase 4: MCP + Ecosystem** | v0.4.0a1 | MCP Server v2 (12 tools), Rate Limiter | 16 |
|
|
167
|
+
| **Phase 5: Production** | — | Security Hardening, Observability, Benchmarks, Docs | 13 |
|
|
168
|
+
| **Total** | | | **109 passing** |
|
|
169
|
+
|
|
170
|
+
## Documentation
|
|
171
|
+
|
|
172
|
+
| Document | Description |
|
|
173
|
+
|----------|-------------|
|
|
174
|
+
| [Architecture](docs/architecture.md) | 7-layer architecture, data flow, component interaction |
|
|
175
|
+
| [MCP Server](docs/mcp-server.md) | 12 tool reference, security, error handling |
|
|
176
|
+
| [Security Guide](docs/security.md) | Input validation, resource limits, MCP auth, audit |
|
|
177
|
+
| [CHANGELOG](CHANGELOG.md) | Full version history |
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Research Foundation
|
|
182
|
+
|
|
183
|
+
Bilinc combines breakthroughs from multiple research papers:
|
|
184
|
+
|
|
185
|
+
| Paper | ArXiv | Contribution |
|
|
186
|
+
|-------|-------|--------------|
|
|
187
|
+
| ContextBudget | 2604.01664 | RL context allocation (1.6x gain) |
|
|
188
|
+
| ACC/CCS | 2601.11653 | Compressed Cognitive State |
|
|
189
|
+
| Kumiho AGM | 2603.17244 | Formal belief revision for agents |
|
|
190
|
+
| Oblivion | 2604.00131 | Biological forgetting curves |
|
|
191
|
+
| StatePlane | 2603.13644 | Context-independent state storage |
|
|
192
|
+
| SCAT | 2604.03201 | Verifiable action in agentic AI |
|
|
193
|
+
| Reflective Context | 2604.03189 | Learnable forgetting |
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Contributing
|
|
198
|
+
|
|
199
|
+
Contributions welcome! Key areas:
|
|
200
|
+
- Phase 5: Production v1.0 — benchmarks, observability, security hardening
|
|
201
|
+
- SQLite/PostgreSQL persistent storage layer
|
|
202
|
+
- Real mem0ai/Letta/Cognee adapters
|
|
203
|
+
|
|
204
|
+
See `research/phase4-detail-plan.md` for the roadmap.
|
|
205
|
+
|
|
206
|
+
## License
|
|
207
|
+
|
|
208
|
+
[MIT](LICENSE)
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
*Bilinc — Memory is not storage. It is state.*
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "bilinc"
|
|
7
|
+
version = "1.0.0a1"
|
|
8
|
+
description = "Verifiable State Plane for Autonomous Agents"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
authors = [{name = "Bilinc Team"}]
|
|
12
|
+
requires-python = ">=3.9"
|
|
13
|
+
keywords = [
|
|
14
|
+
"ai-agent-memory",
|
|
15
|
+
"context-management",
|
|
16
|
+
"belief-revision",
|
|
17
|
+
"state-plane",
|
|
18
|
+
"agm",
|
|
19
|
+
"mcp-server",
|
|
20
|
+
"verification",
|
|
21
|
+
"context-budget",
|
|
22
|
+
"neuro-symbolic",
|
|
23
|
+
]
|
|
24
|
+
classifiers = [
|
|
25
|
+
"Development Status :: 3 - Alpha",
|
|
26
|
+
"Intended Audience :: Developers",
|
|
27
|
+
"License :: OSI Approved :: MIT License",
|
|
28
|
+
"Programming Language :: Python :: 3",
|
|
29
|
+
"Programming Language :: Python :: 3.9",
|
|
30
|
+
"Programming Language :: Python :: 3.10",
|
|
31
|
+
"Programming Language :: Python :: 3.11",
|
|
32
|
+
"Programming Language :: Python :: 3.12",
|
|
33
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
dependencies = [
|
|
37
|
+
"mcp>=1.0.0",
|
|
38
|
+
"pydantic>=2.0",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.optional-dependencies]
|
|
42
|
+
dev = [
|
|
43
|
+
"pytest>=7.0",
|
|
44
|
+
"pytest-cov>=4.0",
|
|
45
|
+
"pytest-asyncio>=0.21",
|
|
46
|
+
"mypy>=1.0",
|
|
47
|
+
"ruff>=0.1",
|
|
48
|
+
]
|
|
49
|
+
server = [
|
|
50
|
+
"fastapi>=0.110",
|
|
51
|
+
"uvicorn>=0.27",
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
[project.scripts]
|
|
55
|
+
synaptic = "bilinc.cli.main:main"
|
|
56
|
+
|
|
57
|
+
[tool.setuptools.packages.find]
|
|
58
|
+
where = ["src"]
|
|
59
|
+
|
|
60
|
+
[tool.pytest.ini_options]
|
|
61
|
+
testpaths = ["tests"]
|
|
62
|
+
|
|
63
|
+
[tool.ruff]
|
|
64
|
+
target-version = "py39"
|
|
65
|
+
line-length = 100
|
bilinc-1.0.0a1/setup.cfg
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""Bilinc: Verifiable State Plane for Autonomous Agents — v0.4.0"""
|
|
2
|
+
from bilinc.core.stateplane import StatePlane
|
|
3
|
+
from bilinc.core.working_memory import WorkingMemory
|
|
4
|
+
from bilinc.core.audit import AuditTrail, OpType
|
|
5
|
+
from bilinc.core.verifier import StateVerifier, VerificationResult
|
|
6
|
+
from bilinc.core.dual_process import System1Engine, System2Engine, Arbiter
|
|
7
|
+
from bilinc.core.confidence import ConfidenceEstimator, ConfidenceScore
|
|
8
|
+
from bilinc.core.models import MemoryType, MemoryEntry, BeliefState, CCSDimension
|
|
9
|
+
from bilinc.core.knowledge_graph import KnowledgeGraph, NodeType, EdgeType
|
|
10
|
+
|
|
11
|
+
__version__ = "1.0.0a1"
|
|
12
|
+
__all__ = [
|
|
13
|
+
"StatePlane", "WorkingMemory", "AuditTrail", "OpType",
|
|
14
|
+
"StateVerifier", "VerificationResult", "System1Engine", "System2Engine",
|
|
15
|
+
"Arbiter", "ConfidenceEstimator", "ConfidenceScore",
|
|
16
|
+
"MemoryType", "MemoryEntry", "BeliefState", "CCSDimension",
|
|
17
|
+
"KnowledgeGraph", "NodeType", "EdgeType",
|
|
18
|
+
]
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"""Adaptive layer: Budget Optimization and Learnable Forgetting."""
|
|
2
|
+
from bilinc.adaptive.budget import ContextBudgetRL
|
|
3
|
+
from bilinc.adaptive.forgetting import LearnableForgetting
|
|
4
|
+
from bilinc.adaptive.agm_engine import AGMEngine, AGMOperation, AGMResult, ConflictStrategy
|
|
5
|
+
__all__ = ["ContextBudgetRL", "LearnableForgetting", "AGMEngine", "AGMOperation", "AGMResult", "ConflictStrategy"]
|