superlocalmemory 3.8.13 → 4.0.0
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.
- package/ATTRIBUTION.md +4 -4
- package/CHANGELOG.md +113 -121
- package/README.md +65 -63
- package/docs/pi-dev-integration.md +1 -1
- package/package.json +6 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/CLAUDE.md +3 -3
- package/plugin/agents/slm-governance-advisor.md +1 -1
- package/plugin/agents/slm-loop-runner.md +1 -1
- package/plugin/agents/slm-memory-advisor.md +1 -1
- package/plugin/agents/slm-optimize-advisor.md +1 -1
- package/plugin/requirements.txt +1 -1
- package/plugin/skills/slm-cache/SKILL.md +1 -1
- package/plugin/skills/slm-compress/SKILL.md +1 -1
- package/plugin/skills/slm-governance/SKILL.md +1 -1
- package/plugin/skills/slm-graph/SKILL.md +1 -1
- package/plugin/skills/slm-loop/SKILL.md +1 -1
- package/plugin/skills/slm-mesh/SKILL.md +1 -1
- package/plugin/skills/slm-profile/SKILL.md +1 -1
- package/plugin/skills/slm-recall/SKILL.md +1 -1
- package/plugin/skills/slm-remember/SKILL.md +1 -1
- package/plugin/skills/slm-scope/SKILL.md +1 -1
- package/plugin/skills/slm-session/SKILL.md +1 -1
- package/plugin/skills/slm-status/SKILL.md +1 -1
- package/plugin-src/rules/AGENTS.md +1 -1
- package/plugin-src/skills/slm-cache/SKILL.md +1 -1
- package/plugin-src/skills/slm-compress/SKILL.md +1 -1
- package/plugin-src/skills/slm-governance/SKILL.md +248 -0
- package/plugin-src/skills/slm-graph/SKILL.md +1 -1
- package/plugin-src/skills/slm-loop/SKILL.md +99 -0
- package/plugin-src/skills/slm-mesh/SKILL.md +282 -0
- package/plugin-src/skills/slm-profile/SKILL.md +148 -0
- package/plugin-src/skills/slm-recall/SKILL.md +1 -1
- package/plugin-src/skills/slm-remember/SKILL.md +1 -1
- package/plugin-src/skills/slm-scope/SKILL.md +176 -0
- package/plugin-src/skills/slm-session/SKILL.md +1 -1
- package/plugin-src/skills/slm-status/SKILL.md +1 -1
- package/pyproject.toml +11 -4
- package/src/superlocalmemory/__init__.py +1 -1
- package/src/superlocalmemory/cli/commands.py +125 -11
- package/src/superlocalmemory/cli/daemon.py +5 -1
- package/src/superlocalmemory/cli/main.py +35 -2
- package/src/superlocalmemory/cli/ops_cmd.py +281 -0
- package/src/superlocalmemory/cli/setup_wizard.py +1 -1
- package/src/superlocalmemory/compliance/audit.py +65 -0
- package/src/superlocalmemory/compliance/eu_ai_act.py +27 -57
- package/src/superlocalmemory/compliance/gdpr.py +416 -20
- package/src/superlocalmemory/compliance/retention.py +74 -22
- package/src/superlocalmemory/compliance/scheduler.py +78 -9
- package/src/superlocalmemory/core/actor_context.py +166 -0
- package/src/superlocalmemory/core/admission.py +549 -0
- package/src/superlocalmemory/core/backend_orchestrator.py +23 -10
- package/src/superlocalmemory/core/config.py +202 -24
- package/src/superlocalmemory/core/consolidation_engine.py +13 -13
- package/src/superlocalmemory/core/context_cache.py +28 -0
- package/src/superlocalmemory/core/embeddings.py +64 -2
- package/src/superlocalmemory/core/engine.py +7 -2
- package/src/superlocalmemory/core/engine_ingestion.py +65 -3
- package/src/superlocalmemory/core/engine_wiring.py +36 -9
- package/src/superlocalmemory/core/ingest_policy.py +38 -0
- package/src/superlocalmemory/core/maintenance.py +255 -0
- package/src/superlocalmemory/core/modes.py +40 -13
- package/src/superlocalmemory/core/mutations.py +437 -44
- package/src/superlocalmemory/core/operation_policy.py +92 -0
- package/src/superlocalmemory/core/operation_policy_registry.py +542 -0
- package/src/superlocalmemory/core/operation_request.py +127 -0
- package/src/superlocalmemory/core/ops_remediation.py +542 -0
- package/src/superlocalmemory/core/recall_pipeline.py +7 -0
- package/src/superlocalmemory/core/remember_runtime.py +202 -4
- package/src/superlocalmemory/core/remote_mode.py +20 -5
- package/src/superlocalmemory/core/store_pipeline.py +150 -0
- package/src/superlocalmemory/core/topic_signature.py +19 -4
- package/src/superlocalmemory/core/transactions/__init__.py +78 -0
- package/src/superlocalmemory/core/transactions/concrete_owners.py +597 -0
- package/src/superlocalmemory/core/transactions/erasure.py +825 -0
- package/src/superlocalmemory/core/transactions/manifest.py +255 -0
- package/src/superlocalmemory/core/transactions/manifest_key.py +155 -0
- package/src/superlocalmemory/core/transactions/obligations.py +272 -0
- package/src/superlocalmemory/core/transactions/owners.py +114 -0
- package/src/superlocalmemory/core/transactions/reconciler.py +285 -0
- package/src/superlocalmemory/core/transactions/service.py +330 -0
- package/src/superlocalmemory/core/worker_pool.py +33 -5
- package/src/superlocalmemory/encoding/cognitive_consolidator.py +70 -28
- package/src/superlocalmemory/encoding/emotional.py +75 -14
- package/src/superlocalmemory/encoding/scene_builder.py +115 -13
- package/src/superlocalmemory/encoding/temporal_parser.py +4 -0
- package/src/superlocalmemory/evolution/blind_verifier.py +11 -4
- package/src/superlocalmemory/evolution/evolution_store.py +244 -4
- package/src/superlocalmemory/evolution/llm_dispatch.py +40 -0
- package/src/superlocalmemory/evolution/model_selection.py +18 -3
- package/src/superlocalmemory/evolution/mutation_generator.py +3 -0
- package/src/superlocalmemory/evolution/skill_activator.py +270 -0
- package/src/superlocalmemory/evolution/skill_evolver.py +281 -59
- package/src/superlocalmemory/evolution/types.py +30 -8
- package/src/superlocalmemory/graph/cozo_backend.py +17 -9
- package/src/superlocalmemory/hooks/auto_invoker.py +2 -1
- package/src/superlocalmemory/hooks/auto_recall.py +64 -30
- package/src/superlocalmemory/hooks/codex_assets.py +14 -1
- package/src/superlocalmemory/infra/backup.py +434 -7
- package/src/superlocalmemory/infra/process_reaper.py +18 -0
- package/src/superlocalmemory/infra/self_heal.py +401 -0
- package/src/superlocalmemory/learning/feedback.py +52 -9
- package/src/superlocalmemory/loops/engine.py +10 -0
- package/src/superlocalmemory/mcp/_daemon_proxy.py +3 -0
- package/src/superlocalmemory/mcp/http_transport.py +30 -331
- package/src/superlocalmemory/mcp/profiles.py +5 -0
- package/src/superlocalmemory/mcp/resources.py +8 -0
- package/src/superlocalmemory/mcp/server.py +51 -4
- package/src/superlocalmemory/mcp/shared.py +19 -0
- package/src/superlocalmemory/mcp/tools_active.py +25 -4
- package/src/superlocalmemory/mcp/tools_code_graph.py +26 -18
- package/src/superlocalmemory/mcp/tools_context.py +50 -8
- package/src/superlocalmemory/mcp/tools_core.py +69 -21
- package/src/superlocalmemory/mcp/tools_evolution.py +9 -2
- package/src/superlocalmemory/mcp/tools_learning.py +21 -10
- package/src/superlocalmemory/mcp/tools_loops.py +29 -18
- package/src/superlocalmemory/mcp/tools_mesh.py +8 -0
- package/src/superlocalmemory/mcp/tools_ops.py +115 -0
- package/src/superlocalmemory/mcp/tools_optimize.py +4 -0
- package/src/superlocalmemory/mcp/tools_v28.py +10 -3
- package/src/superlocalmemory/mcp/tools_v3.py +34 -14
- package/src/superlocalmemory/mcp/tools_v33.py +18 -33
- package/src/superlocalmemory/mesh/broker.py +124 -46
- package/src/superlocalmemory/mesh/broker_security.py +470 -0
- package/src/superlocalmemory/mesh/discovery.py +365 -0
- package/src/superlocalmemory/mesh/lock_protocol.py +313 -0
- package/src/superlocalmemory/mesh/node_identity.py +97 -0
- package/src/superlocalmemory/mesh/outbox_remote.py +429 -0
- package/src/superlocalmemory/mesh/remote_sync.py +511 -28
- package/src/superlocalmemory/mesh/state_sync.py +286 -0
- package/src/superlocalmemory/optimize/config/store.py +45 -0
- package/src/superlocalmemory/parameterization/cross_project.py +12 -0
- package/src/superlocalmemory/parameterization/prompt_injector.py +13 -11
- package/src/superlocalmemory/parameterization/prompt_lifecycle.py +8 -2
- package/src/superlocalmemory/parameterization/workflow_miner.py +17 -0
- package/src/superlocalmemory/retrieval/ann_index.py +5 -0
- package/src/superlocalmemory/retrieval/bm25_channel.py +49 -2
- package/src/superlocalmemory/retrieval/engine.py +19 -4
- package/src/superlocalmemory/retrieval/fusion.py +4 -1
- package/src/superlocalmemory/retrieval/hopfield_channel.py +9 -3
- package/src/superlocalmemory/retrieval/remote_reranker.py +47 -22
- package/src/superlocalmemory/retrieval/reranker.py +32 -1
- package/src/superlocalmemory/retrieval/temporal_channel.py +16 -3
- package/src/superlocalmemory/retrieval/temporal_utils.py +107 -0
- package/src/superlocalmemory/retrieval/temporal_validity_filter.py +155 -42
- package/src/superlocalmemory/retrieval/vector_store.py +214 -8
- package/src/superlocalmemory/server/api.py +5 -5
- package/src/superlocalmemory/server/egress_policy.py +258 -0
- package/src/superlocalmemory/server/rbac_enforce.py +32 -0
- package/src/superlocalmemory/server/route_mutations.py +20 -0
- package/src/superlocalmemory/server/routes/compliance.py +153 -7
- package/src/superlocalmemory/server/routes/data_io.py +43 -2
- package/src/superlocalmemory/server/routes/events.py +15 -0
- package/src/superlocalmemory/server/routes/memories.py +56 -3
- package/src/superlocalmemory/server/routes/mesh.py +82 -1
- package/src/superlocalmemory/server/routes/mesh_lock.py +54 -0
- package/src/superlocalmemory/server/routes/mesh_state.py +63 -0
- package/src/superlocalmemory/server/routes/v3_api.py +50 -27
- package/src/superlocalmemory/server/routes/ws.py +86 -0
- package/src/superlocalmemory/server/ui.py +6 -6
- package/src/superlocalmemory/server/unified_daemon.py +942 -119
- package/src/superlocalmemory/storage/_migration_internals.py +568 -0
- package/src/superlocalmemory/storage/_schema_version.py +110 -0
- package/src/superlocalmemory/storage/database.py +329 -24
- package/src/superlocalmemory/storage/embedding_migrator.py +246 -51
- package/src/superlocalmemory/storage/erasure_fence.py +45 -0
- package/src/superlocalmemory/storage/generation_fence.py +63 -0
- package/src/superlocalmemory/storage/migration_runner.py +140 -417
- package/src/superlocalmemory/storage/migrations/M009_model_lineage.py +40 -0
- package/src/superlocalmemory/storage/migrations/M033_projection_transactions.py +148 -0
- package/src/superlocalmemory/storage/migrations/M034_obligation_integrity.py +58 -0
- package/src/superlocalmemory/storage/migrations/M035_erasure_receipts.py +113 -0
- package/src/superlocalmemory/storage/migrations/M036_vector_row_map.py +107 -0
- package/src/superlocalmemory/storage/migrations/M037_manifest_hmac_version.py +162 -0
- package/src/superlocalmemory/storage/migrations/{M033_learning_feedback_channel.py → M038_learning_feedback_channel.py} +3 -3
- package/src/superlocalmemory/storage/migrations/M039_scene_fact_members.py +137 -0
- package/src/superlocalmemory/storage/migrations/__init__.py +4 -2
- package/src/superlocalmemory/storage/schema.py +67 -0
- package/src/superlocalmemory/storage/write_coordinator.py +125 -0
- package/src/superlocalmemory/trust/scorer.py +28 -4
- package/src/superlocalmemory/ui/index.html +14 -3
- package/src/superlocalmemory/ui/js/auto-settings.js +12 -1
- package/src/superlocalmemory/ui/js/brain.js +6 -4
- package/src/superlocalmemory/ui/js/compliance.js +66 -12
- package/src/superlocalmemory/ui/js/dashboard.js +13 -3
- package/src/superlocalmemory/ui/js/feedback.js +8 -2
- package/src/superlocalmemory/ui/js/lifecycle.js +7 -1
- package/src/superlocalmemory/ui/js/modal.js +272 -5
- package/src/superlocalmemory/ui/js/od-backup.js +9 -2
- package/src/superlocalmemory/ui/js/od-compliance-ext.js +301 -0
- package/src/superlocalmemory/ui/js/od-operations.js +154 -23
- package/src/superlocalmemory/ui/js/od-ops-health.js +417 -0
- package/src/superlocalmemory/ui/js/od-optimize.js +35 -21
- package/src/superlocalmemory/ui/js/od-team.js +9 -2
- package/src/superlocalmemory/ui/js/optimize.js +13 -16
- package/src/superlocalmemory/ui/js/profiles.js +7 -3
- package/src/superlocalmemory/ui/js/settings.js +7 -1
- package/src/superlocalmemory/vector/lancedb_backend.py +19 -9
- package/src/superlocalmemory/attribution/mathematical_dna.py +0 -235
- package/src/superlocalmemory/cli/post_install.py +0 -114
- package/src/superlocalmemory/core/clock_monitor.py +0 -45
- package/src/superlocalmemory/core/db_pool.py +0 -80
- package/src/superlocalmemory/core/error_catalog.py +0 -113
- package/src/superlocalmemory/core/loop_watchdog.py +0 -56
- package/src/superlocalmemory/core/priority_queue.py +0 -61
- package/src/superlocalmemory/core/pruning_engine.py +0 -216
- package/src/superlocalmemory/core/queue_dispatcher.py +0 -73
- package/src/superlocalmemory/core/slmignore.py +0 -125
- package/src/superlocalmemory/infra/heartbeat_monitor.py +0 -140
- package/src/superlocalmemory/infra/webhook_dispatcher.py +0 -247
- package/src/superlocalmemory/learning/quantization_scheduler.py +0 -320
- package/src/superlocalmemory/storage/access_control.py +0 -182
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
|
|
2
|
-
# Licensed under AGPL-3.0-or-later - see LICENSE file
|
|
3
|
-
# Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
|
|
4
|
-
|
|
5
|
-
"""SuperLocalMemory V3 — Attribute-Based Access Control (ABAC).
|
|
6
|
-
|
|
7
|
-
Profile-scoped access control. Ensures memory operations
|
|
8
|
-
respect profile boundaries and permission rules.
|
|
9
|
-
Ported from V2.8 with enhancements.
|
|
10
|
-
|
|
11
|
-
Part of Qualixar | Author: Varun Pratap Bhardwaj
|
|
12
|
-
"""
|
|
13
|
-
|
|
14
|
-
from __future__ import annotations
|
|
15
|
-
|
|
16
|
-
import logging
|
|
17
|
-
from dataclasses import dataclass, field
|
|
18
|
-
from enum import Enum
|
|
19
|
-
|
|
20
|
-
logger = logging.getLogger(__name__)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class Permission(str, Enum):
|
|
24
|
-
"""Memory operation permissions."""
|
|
25
|
-
|
|
26
|
-
READ = "read"
|
|
27
|
-
WRITE = "write"
|
|
28
|
-
DELETE = "delete"
|
|
29
|
-
EXPORT = "export"
|
|
30
|
-
ADMIN = "admin" # Can manage profiles, access control
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
class AccessLevel(str, Enum):
|
|
34
|
-
"""Access level tiers."""
|
|
35
|
-
|
|
36
|
-
OWNER = "owner" # Full access to profile
|
|
37
|
-
AGENT = "agent" # Read + write, no delete/export
|
|
38
|
-
READONLY = "readonly" # Read only
|
|
39
|
-
NONE = "none" # No access
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
# Permission matrix per access level
|
|
43
|
-
_PERMISSIONS: dict[AccessLevel, frozenset[Permission]] = {
|
|
44
|
-
AccessLevel.OWNER: frozenset(Permission),
|
|
45
|
-
AccessLevel.AGENT: frozenset({Permission.READ, Permission.WRITE}),
|
|
46
|
-
AccessLevel.READONLY: frozenset({Permission.READ}),
|
|
47
|
-
AccessLevel.NONE: frozenset(),
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
@dataclass(frozen=True)
|
|
52
|
-
class AccessGrant:
|
|
53
|
-
"""Grant of access to a profile for an agent/user."""
|
|
54
|
-
|
|
55
|
-
subject_id: str # Agent ID or user ID
|
|
56
|
-
profile_id: str # Which profile
|
|
57
|
-
access_level: AccessLevel
|
|
58
|
-
granted_by: str = ""
|
|
59
|
-
granted_at: str = ""
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
@dataclass
|
|
63
|
-
class AccessController:
|
|
64
|
-
"""Attribute-based access control for memory operations.
|
|
65
|
-
|
|
66
|
-
Enforces profile isolation:
|
|
67
|
-
- Each agent/user has an access level per profile
|
|
68
|
-
- Operations check permissions before execution
|
|
69
|
-
- Default: profile creator = OWNER, others = NONE
|
|
70
|
-
"""
|
|
71
|
-
|
|
72
|
-
# In-memory grant store (persisted via profiles.json or DB)
|
|
73
|
-
_grants: dict[tuple[str, str], AccessGrant] = field(default_factory=dict)
|
|
74
|
-
|
|
75
|
-
def grant_access(
|
|
76
|
-
self,
|
|
77
|
-
subject_id: str,
|
|
78
|
-
profile_id: str,
|
|
79
|
-
access_level: AccessLevel,
|
|
80
|
-
granted_by: str = "system",
|
|
81
|
-
) -> AccessGrant:
|
|
82
|
-
"""Grant access to a profile for a subject."""
|
|
83
|
-
from datetime import UTC, datetime
|
|
84
|
-
|
|
85
|
-
grant = AccessGrant(
|
|
86
|
-
subject_id=subject_id,
|
|
87
|
-
profile_id=profile_id,
|
|
88
|
-
access_level=access_level,
|
|
89
|
-
granted_by=granted_by,
|
|
90
|
-
granted_at=datetime.now(UTC).isoformat(),
|
|
91
|
-
)
|
|
92
|
-
self._grants[(subject_id, profile_id)] = grant
|
|
93
|
-
logger.info(
|
|
94
|
-
"Granted %s access to profile '%s' for '%s'",
|
|
95
|
-
access_level.value,
|
|
96
|
-
profile_id,
|
|
97
|
-
subject_id,
|
|
98
|
-
)
|
|
99
|
-
return grant
|
|
100
|
-
|
|
101
|
-
def revoke_access(self, subject_id: str, profile_id: str) -> None:
|
|
102
|
-
"""Revoke access to a profile."""
|
|
103
|
-
key = (subject_id, profile_id)
|
|
104
|
-
if key in self._grants:
|
|
105
|
-
del self._grants[key]
|
|
106
|
-
logger.info(
|
|
107
|
-
"Revoked access to profile '%s' for '%s'",
|
|
108
|
-
profile_id,
|
|
109
|
-
subject_id,
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
def check_permission(
|
|
113
|
-
self,
|
|
114
|
-
subject_id: str,
|
|
115
|
-
profile_id: str,
|
|
116
|
-
permission: Permission,
|
|
117
|
-
) -> bool:
|
|
118
|
-
"""Check if subject has permission on profile.
|
|
119
|
-
|
|
120
|
-
Default behavior: if no grant exists, deny access.
|
|
121
|
-
Exception: "default" profile allows READ for all subjects.
|
|
122
|
-
"""
|
|
123
|
-
grant = self._grants.get((subject_id, profile_id))
|
|
124
|
-
|
|
125
|
-
if grant is None:
|
|
126
|
-
# Default profile allows read for everyone
|
|
127
|
-
if profile_id == "default" and permission == Permission.READ:
|
|
128
|
-
return True
|
|
129
|
-
return False
|
|
130
|
-
|
|
131
|
-
allowed = _PERMISSIONS.get(grant.access_level, frozenset())
|
|
132
|
-
return permission in allowed
|
|
133
|
-
|
|
134
|
-
def require_permission(
|
|
135
|
-
self,
|
|
136
|
-
subject_id: str,
|
|
137
|
-
profile_id: str,
|
|
138
|
-
permission: Permission,
|
|
139
|
-
) -> None:
|
|
140
|
-
"""Raise if subject lacks permission. Use as a guard."""
|
|
141
|
-
if not self.check_permission(subject_id, profile_id, permission):
|
|
142
|
-
raise PermissionError(
|
|
143
|
-
f"Subject '{subject_id}' lacks {permission.value} "
|
|
144
|
-
f"permission on profile '{profile_id}'"
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
def get_access_level(
|
|
148
|
-
self, subject_id: str, profile_id: str
|
|
149
|
-
) -> AccessLevel:
|
|
150
|
-
"""Get the access level for a subject on a profile."""
|
|
151
|
-
grant = self._grants.get((subject_id, profile_id))
|
|
152
|
-
return grant.access_level if grant else AccessLevel.NONE
|
|
153
|
-
|
|
154
|
-
def list_grants(self, profile_id: str | None = None) -> list[AccessGrant]:
|
|
155
|
-
"""List all grants, optionally filtered by profile."""
|
|
156
|
-
grants = list(self._grants.values())
|
|
157
|
-
if profile_id is not None:
|
|
158
|
-
grants = [g for g in grants if g.profile_id == profile_id]
|
|
159
|
-
return grants
|
|
160
|
-
|
|
161
|
-
def export_grants(self) -> list[dict]:
|
|
162
|
-
"""Export all grants as dicts for persistence."""
|
|
163
|
-
return [
|
|
164
|
-
{
|
|
165
|
-
"subject_id": g.subject_id,
|
|
166
|
-
"profile_id": g.profile_id,
|
|
167
|
-
"access_level": g.access_level.value,
|
|
168
|
-
"granted_by": g.granted_by,
|
|
169
|
-
"granted_at": g.granted_at,
|
|
170
|
-
}
|
|
171
|
-
for g in self._grants.values()
|
|
172
|
-
]
|
|
173
|
-
|
|
174
|
-
def import_grants(self, data: list[dict]) -> None:
|
|
175
|
-
"""Import grants from persisted data."""
|
|
176
|
-
for item in data:
|
|
177
|
-
self.grant_access(
|
|
178
|
-
subject_id=item["subject_id"],
|
|
179
|
-
profile_id=item["profile_id"],
|
|
180
|
-
access_level=AccessLevel(item["access_level"]),
|
|
181
|
-
granted_by=item.get("granted_by", "import"),
|
|
182
|
-
)
|