limen-ai 2.0.0 → 3.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/CHANGELOG.md +72 -0
- package/README.md +310 -52
- package/dist/api/agents/trust_progression.d.ts +20 -0
- package/dist/api/agents/trust_progression.d.ts.map +1 -1
- package/dist/api/agents/trust_progression.js +30 -0
- package/dist/api/agents/trust_progression.js.map +1 -1
- package/dist/api/chat/chat_pipeline.js.map +1 -1
- package/dist/api/cognitive/cognitive_api.d.ts +2 -2
- package/dist/api/cognitive/cognitive_api.d.ts.map +1 -1
- package/dist/api/convenience/convenience_layer.d.ts +14 -2
- package/dist/api/convenience/convenience_layer.d.ts.map +1 -1
- package/dist/api/convenience/convenience_layer.js +44 -20
- package/dist/api/convenience/convenience_layer.js.map +1 -1
- package/dist/api/convenience/convenience_types.d.ts +2 -0
- package/dist/api/convenience/convenience_types.d.ts.map +1 -1
- package/dist/api/convenience/convenience_types.js.map +1 -1
- package/dist/api/data/data_api.d.ts +13 -0
- package/dist/api/data/data_api.d.ts.map +1 -1
- package/dist/api/data/data_api.js +174 -0
- package/dist/api/data/data_api.js.map +1 -1
- package/dist/api/defaults.d.ts +4 -1
- package/dist/api/defaults.d.ts.map +1 -1
- package/dist/api/defaults.js +4 -11
- package/dist/api/defaults.js.map +1 -1
- package/dist/api/enforcement/rbac_guard.d.ts +1 -1
- package/dist/api/enforcement/rbac_guard.d.ts.map +1 -1
- package/dist/api/enforcement/rbac_guard.js +4 -7
- package/dist/api/enforcement/rbac_guard.js.map +1 -1
- package/dist/api/errors/limen_error.d.ts +4 -13
- package/dist/api/errors/limen_error.d.ts.map +1 -1
- package/dist/api/errors/limen_error.js +36 -10
- package/dist/api/errors/limen_error.js.map +1 -1
- package/dist/api/facades/claim_api_impl.d.ts +8 -3
- package/dist/api/facades/claim_api_impl.d.ts.map +1 -1
- package/dist/api/facades/claim_api_impl.js +24 -7
- package/dist/api/facades/claim_api_impl.js.map +1 -1
- package/dist/api/facades/claim_facade.d.ts +8 -1
- package/dist/api/facades/claim_facade.d.ts.map +1 -1
- package/dist/api/facades/claim_facade.js +30 -13
- package/dist/api/facades/claim_facade.js.map +1 -1
- package/dist/api/facades/working_memory_api_impl.d.ts +1 -1
- package/dist/api/facades/working_memory_api_impl.js +1 -1
- package/dist/api/facades/working_memory_facade.d.ts +1 -1
- package/dist/api/facades/working_memory_facade.d.ts.map +1 -1
- package/dist/api/facades/working_memory_facade.js +6 -9
- package/dist/api/facades/working_memory_facade.js.map +1 -1
- package/dist/api/gateway/permission_gateway.d.ts +96 -0
- package/dist/api/gateway/permission_gateway.d.ts.map +1 -0
- package/dist/api/gateway/permission_gateway.js +352 -0
- package/dist/api/gateway/permission_gateway.js.map +1 -0
- package/dist/api/governance/governed_orchestration.d.ts.map +1 -1
- package/dist/api/governance/governed_orchestration.js +4 -3
- package/dist/api/governance/governed_orchestration.js.map +1 -1
- package/dist/api/index.d.ts +3 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +315 -31
- package/dist/api/index.js.map +1 -1
- package/dist/api/interfaces/api.d.ts +97 -10
- package/dist/api/interfaces/api.d.ts.map +1 -1
- package/dist/api/migration/037_fts5_retraction_guard.d.ts +21 -0
- package/dist/api/migration/037_fts5_retraction_guard.d.ts.map +1 -0
- package/dist/api/migration/037_fts5_retraction_guard.js +65 -0
- package/dist/api/migration/037_fts5_retraction_guard.js.map +1 -0
- package/dist/api/migration/037_sync_foundation.d.ts +25 -0
- package/dist/api/migration/037_sync_foundation.d.ts.map +1 -0
- package/dist/api/migration/037_sync_foundation.js +113 -0
- package/dist/api/migration/037_sync_foundation.js.map +1 -0
- package/dist/api/missions/mission_api.d.ts.map +1 -1
- package/dist/api/missions/mission_api.js +21 -6
- package/dist/api/missions/mission_api.js.map +1 -1
- package/dist/claims/interfaces/claim_types.d.ts +34 -6
- package/dist/claims/interfaces/claim_types.d.ts.map +1 -1
- package/dist/claims/interfaces/claim_types.js +2 -2
- package/dist/claims/interfaces/claim_types.js.map +1 -1
- package/dist/claims/store/claim_stores.d.ts +17 -2
- package/dist/claims/store/claim_stores.d.ts.map +1 -1
- package/dist/claims/store/claim_stores.js +177 -58
- package/dist/claims/store/claim_stores.js.map +1 -1
- package/dist/cognitive/access_tracker.d.ts +18 -1
- package/dist/cognitive/access_tracker.d.ts.map +1 -1
- package/dist/cognitive/access_tracker.js +19 -6
- package/dist/cognitive/access_tracker.js.map +1 -1
- package/dist/cognitive/auto_connection.d.ts +2 -2
- package/dist/cognitive/auto_connection.d.ts.map +1 -1
- package/dist/cognitive/auto_connection.js +7 -2
- package/dist/cognitive/auto_connection.js.map +1 -1
- package/dist/cognitive/cascade.d.ts +9 -3
- package/dist/cognitive/cascade.d.ts.map +1 -1
- package/dist/cognitive/cascade.js +20 -17
- package/dist/cognitive/cascade.js.map +1 -1
- package/dist/cognitive/conflict.d.ts +2 -2
- package/dist/cognitive/conflict.d.ts.map +1 -1
- package/dist/cognitive/conflict.js +10 -3
- package/dist/cognitive/conflict.js.map +1 -1
- package/dist/cognitive/consolidation.d.ts +2 -2
- package/dist/cognitive/consolidation.d.ts.map +1 -1
- package/dist/cognitive/consolidation.js +50 -37
- package/dist/cognitive/consolidation.js.map +1 -1
- package/dist/cognitive/importance.d.ts +3 -3
- package/dist/cognitive/importance.d.ts.map +1 -1
- package/dist/cognitive/importance.js +8 -8
- package/dist/cognitive/importance.js.map +1 -1
- package/dist/cognitive/narrative.d.ts.map +1 -1
- package/dist/cognitive/narrative.js +29 -12
- package/dist/cognitive/narrative.js.map +1 -1
- package/dist/cognitive/self_healing.d.ts +2 -2
- package/dist/cognitive/self_healing.d.ts.map +1 -1
- package/dist/cognitive/self_healing.js +23 -14
- package/dist/cognitive/self_healing.js.map +1 -1
- package/dist/context/harness/cgp_harness.d.ts +4 -1
- package/dist/context/harness/cgp_harness.d.ts.map +1 -1
- package/dist/context/harness/cgp_harness.js +2 -2
- package/dist/context/harness/cgp_harness.js.map +1 -1
- package/dist/exchange/exchange_types.d.ts +5 -0
- package/dist/exchange/exchange_types.d.ts.map +1 -1
- package/dist/exchange/exchange_types.js +5 -0
- package/dist/exchange/exchange_types.js.map +1 -1
- package/dist/exchange/export.d.ts +2 -2
- package/dist/exchange/export.d.ts.map +1 -1
- package/dist/exchange/export.js +11 -11
- package/dist/exchange/export.js.map +1 -1
- package/dist/exchange/import.d.ts +7 -0
- package/dist/exchange/import.d.ts.map +1 -1
- package/dist/exchange/import.js +119 -103
- package/dist/exchange/import.js.map +1 -1
- package/dist/execution/stores/egp_stores.js +2 -2
- package/dist/execution/stores/egp_stores.js.map +1 -1
- package/dist/governance/compliance/erasure_engine.d.ts.map +1 -1
- package/dist/governance/compliance/erasure_engine.js +88 -43
- package/dist/governance/compliance/erasure_engine.js.map +1 -1
- package/dist/governance/harness/governance_harness.d.ts +7 -0
- package/dist/governance/harness/governance_harness.d.ts.map +1 -1
- package/dist/governance/harness/governance_harness.js +18 -10
- package/dist/governance/harness/governance_harness.js.map +1 -1
- package/dist/governance/stores/governance_stores.d.ts +14 -11
- package/dist/governance/stores/governance_stores.d.ts.map +1 -1
- package/dist/governance/stores/governance_stores.js +63 -40
- package/dist/governance/stores/governance_stores.js.map +1 -1
- package/dist/kernel/audit/audit_trail.d.ts +7 -1
- package/dist/kernel/audit/audit_trail.d.ts.map +1 -1
- package/dist/kernel/audit/audit_trail.js +57 -46
- package/dist/kernel/audit/audit_trail.js.map +1 -1
- package/dist/kernel/crypto/key_rotation.d.ts +54 -0
- package/dist/kernel/crypto/key_rotation.d.ts.map +1 -0
- package/dist/kernel/crypto/key_rotation.js +159 -0
- package/dist/kernel/crypto/key_rotation.js.map +1 -0
- package/dist/kernel/database/database_lifecycle.d.ts.map +1 -1
- package/dist/kernel/database/database_lifecycle.js +3 -4
- package/dist/kernel/database/database_lifecycle.js.map +1 -1
- package/dist/kernel/events/event_bus.d.ts.map +1 -1
- package/dist/kernel/events/event_bus.js +28 -21
- package/dist/kernel/events/event_bus.js.map +1 -1
- package/dist/kernel/index.js +1 -1
- package/dist/kernel/index.js.map +1 -1
- package/dist/kernel/interfaces/common.d.ts +11 -1
- package/dist/kernel/interfaces/common.d.ts.map +1 -1
- package/dist/kernel/interfaces/index.d.ts +3 -0
- package/dist/kernel/interfaces/index.d.ts.map +1 -1
- package/dist/kernel/interfaces/index.js +3 -1
- package/dist/kernel/interfaces/index.js.map +1 -1
- package/dist/kernel/interfaces/instance_context.d.ts +71 -0
- package/dist/kernel/interfaces/instance_context.d.ts.map +1 -0
- package/dist/kernel/interfaces/instance_context.js +37 -0
- package/dist/kernel/interfaces/instance_context.js.map +1 -0
- package/dist/kernel/interfaces/kernel.d.ts +5 -0
- package/dist/kernel/interfaces/kernel.d.ts.map +1 -1
- package/dist/kernel/interfaces/result_utils.d.ts +19 -0
- package/dist/kernel/interfaces/result_utils.d.ts.map +1 -0
- package/dist/kernel/interfaces/result_utils.js +22 -0
- package/dist/kernel/interfaces/result_utils.js.map +1 -0
- package/dist/kernel/rate_limiter/rate_limiter.d.ts +6 -1
- package/dist/kernel/rate_limiter/rate_limiter.d.ts.map +1 -1
- package/dist/kernel/rate_limiter/rate_limiter.js +11 -3
- package/dist/kernel/rate_limiter/rate_limiter.js.map +1 -1
- package/dist/kernel/retention/retention_scheduler.d.ts.map +1 -1
- package/dist/kernel/retention/retention_scheduler.js +89 -77
- package/dist/kernel/retention/retention_scheduler.js.map +1 -1
- package/dist/kernel/sql_utils.d.ts +15 -0
- package/dist/kernel/sql_utils.d.ts.map +1 -0
- package/dist/kernel/sql_utils.js +17 -0
- package/dist/kernel/sql_utils.js.map +1 -0
- package/dist/kernel/tenant/tenant_scope.d.ts.map +1 -1
- package/dist/kernel/tenant/tenant_scope.js +2 -0
- package/dist/kernel/tenant/tenant_scope.js.map +1 -1
- package/dist/orchestration/budget/budget_governance.d.ts.map +1 -1
- package/dist/orchestration/budget/budget_governance.js +19 -2
- package/dist/orchestration/budget/budget_governance.js.map +1 -1
- package/dist/orchestration/index.d.ts +1 -1
- package/dist/orchestration/index.d.ts.map +1 -1
- package/dist/orchestration/index.js +2 -2
- package/dist/orchestration/index.js.map +1 -1
- package/dist/orchestration/transitions/transition_service.d.ts +2 -1
- package/dist/orchestration/transitions/transition_service.d.ts.map +1 -1
- package/dist/orchestration/transitions/transition_service.js +22 -1
- package/dist/orchestration/transitions/transition_service.js.map +1 -1
- package/dist/security/security_types.d.ts +12 -1
- package/dist/security/security_types.d.ts.map +1 -1
- package/dist/security/security_types.js +3 -0
- package/dist/security/security_types.js.map +1 -1
- package/dist/substrate/transport/adapters/anthropic_adapter.d.ts.map +1 -1
- package/dist/substrate/transport/adapters/anthropic_adapter.js +32 -8
- package/dist/substrate/transport/adapters/anthropic_adapter.js.map +1 -1
- package/dist/substrate/transport/adapters/gemini_adapter.d.ts.map +1 -1
- package/dist/substrate/transport/adapters/gemini_adapter.js +26 -4
- package/dist/substrate/transport/adapters/gemini_adapter.js.map +1 -1
- package/dist/substrate/transport/stream_parser.d.ts.map +1 -1
- package/dist/substrate/transport/stream_parser.js +5 -3
- package/dist/substrate/transport/stream_parser.js.map +1 -1
- package/dist/substrate/transport/transport_engine.js +3 -3
- package/dist/substrate/transport/transport_engine.js.map +1 -1
- package/dist/sync/hlc/hybrid_logical_clock.d.ts +33 -0
- package/dist/sync/hlc/hybrid_logical_clock.d.ts.map +1 -0
- package/dist/sync/hlc/hybrid_logical_clock.js +140 -0
- package/dist/sync/hlc/hybrid_logical_clock.js.map +1 -0
- package/dist/sync/index.d.ts +14 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +13 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/interfaces/sync_types.d.ts +106 -0
- package/dist/sync/interfaces/sync_types.d.ts.map +1 -0
- package/dist/sync/interfaces/sync_types.js +32 -0
- package/dist/sync/interfaces/sync_types.js.map +1 -0
- package/dist/sync/stores/sync_event_store.d.ts +44 -0
- package/dist/sync/stores/sync_event_store.d.ts.map +1 -0
- package/dist/sync/stores/sync_event_store.js +241 -0
- package/dist/sync/stores/sync_event_store.js.map +1 -0
- package/dist/vector/vector_store.d.ts +2 -1
- package/dist/vector/vector_store.d.ts.map +1 -1
- package/dist/vector/vector_store.js +8 -2
- package/dist/vector/vector_store.js.map +1 -1
- package/dist/working-memory/harness/wmp_harness.d.ts +24 -4
- package/dist/working-memory/harness/wmp_harness.d.ts.map +1 -1
- package/dist/working-memory/harness/wmp_harness.js +39 -11
- package/dist/working-memory/harness/wmp_harness.js.map +1 -1
- package/dist/working-memory/stores/wmp_stores.d.ts +22 -7
- package/dist/working-memory/stores/wmp_stores.d.ts.map +1 -1
- package/dist/working-memory/stores/wmp_stores.js +78 -41
- package/dist/working-memory/stores/wmp_stores.js.map +1 -1
- package/examples/README.md +50 -0
- package/examples/{07-knowledge.ts → advanced/07-knowledge.ts} +2 -2
- package/examples/{08-governance-visible.ts → advanced/08-governance-visible.ts} +2 -2
- package/examples/{01-remember-recall.ts → knowledge/01-remember-recall.ts} +2 -2
- package/examples/{02-search-and-decay.ts → knowledge/02-search-and-decay.ts} +2 -2
- package/examples/{03-governance.ts → knowledge/03-governance.ts} +2 -2
- package/examples/{01-hello.ts → llm-gateway/01-hello.ts} +1 -1
- package/examples/{02-streaming.ts → llm-gateway/02-streaming.ts} +1 -1
- package/examples/{03-structured-output.ts → llm-gateway/03-structured-output.ts} +1 -1
- package/examples/{04-multi-provider.ts → llm-gateway/04-multi-provider.ts} +1 -1
- package/examples/{05-sessions.ts → llm-gateway/05-sessions.ts} +1 -1
- package/examples/{06-missions.ts → llm-gateway/06-missions.ts} +1 -1
- package/package.json +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,78 @@ All notable changes to Limen are documented in this file.
|
|
|
5
5
|
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
6
|
Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [3.0.0] - 2026-04-28 (WIRE)
|
|
9
|
+
|
|
10
|
+
### Summary
|
|
11
|
+
Complete wiring remediation and production readiness release. Every spec promise verified end-to-end. Every "auto" feature runs automatically. Every security feature enforces.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- **Phase 1: Core Wiring** — Decay computation in convenience `recall()` (effectiveConfidence at query time). Automated retention scheduler (background timer, configurable interval). Replay engine integration (mission state snapshots on lifecycle transitions). Auto-connection suggestions (debounced, fires on claim assertion).
|
|
15
|
+
- **Phase 2: Security Enforcement** — Consent enforcement on claim assertion (fail-closed, configurable). Classification-filtered retrieval on query AND search paths (trust-level mapped clearance). Key rotation (atomic re-encryption of vault entries).
|
|
16
|
+
- **Phase 3: MCP Tool Completion** — 11 new MCP tools: `limen_consolidate`, `limen_importance`, `limen_narrative`, `limen_verify`, `limen_suggest_connections`, `limen_replay_verify`, `limen_governance_erasure`, `limen_governance_audit_export`, `limen_consent_register`, `limen_consent_check`, `limen_maintenance_retention`. 11 matching CLI commands. Total: 36 MCP tools.
|
|
17
|
+
- **Phase 4: DX/UX** — README overhaul (Node>=22 banner, ESM note, CLI section, MCP for Claude section, What's New in v3). Examples README with runner instructions.
|
|
18
|
+
- **Phase 5: Proof Pack** — Security model expanded from 8 to 11 mechanisms. Readiness doc refreshed for v3.0.0.
|
|
19
|
+
- **Phase 6: OAT** — 8 operational acceptance scenarios verifying every spec promise end-to-end.
|
|
20
|
+
- `limen.maintenance.runRetention()`, `getRetentionPolicies()`, `updateRetentionPolicy()` — manual retention API
|
|
21
|
+
- `limen.replay.verify(missionId)`, `replay.getSnapshots(missionId)` — mission determinism verification
|
|
22
|
+
- `limen.security.rotateKey(newMasterKey)` — atomic key rotation
|
|
23
|
+
- `maintenance.retentionEnabled`, `maintenance.retentionIntervalMs` config options
|
|
24
|
+
- `security.consent.required`, `security.consent.scope` config options
|
|
25
|
+
- `cognitive.autoSuggestConnections` config option
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
- **Dispute recomputation** — `disputed` flag now correctly recomputes to `false` after contradicting claim is retracted (3 sites: queryClaims, searchClaims, vectorHydrateDisputed)
|
|
29
|
+
- **Classification filter bypass** — search path now filters by classification level (was query-only)
|
|
30
|
+
- **Consent fail-open** — consent enforcement now fail-closed when registry unavailable
|
|
31
|
+
- **Replay SQLITE_BUSY** — replay snapshots use orchestrationConn instead of separate connection
|
|
32
|
+
- **Stale worktree/stryker pollution** — cleaned phantom test failures from stale temp directories
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
- Removed all AI attribution from source code, tests, and documentation
|
|
36
|
+
- `vitest.config.ts` added at root to prevent phantom failures from node:test files
|
|
37
|
+
- Permission gateway updated with maintenance, replay, security namespace registrations
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## [2.0.0] - 2026-04-03 (THINK)
|
|
42
|
+
|
|
43
|
+
### Added
|
|
44
|
+
- **Phase 11: Vector Search** — semantic search via `sqlite-vec` (optional dependency). Hybrid search combining FTS5 keyword + vector similarity. Duplicate detection before storage with configurable similarity threshold. Embedding queue with `embedPending()` for batch processing. `embeddingStats()` for monitoring. Falls back to full-text search when `sqlite-vec` is unavailable.
|
|
45
|
+
- **Phase 12: Cognitive Engine** — self-healing retraction cascades (opt-in, disabled by default). Consolidation engine: merge similar claims, archive stale claims, suggest contradiction resolutions with dry-run mode. 5-factor importance scoring (recency, confidence, connections, access, centrality). KNN-based auto-connection suggestions via embedding similarity with accept/reject workflow. Mission-scoped narrative snapshots. External verification provider integration (advisory only, never mutates claims).
|
|
46
|
+
- `limen.semanticSearch(query, options?)` — async semantic search via embedding provider.
|
|
47
|
+
- `limen.checkDuplicate(subject, predicate, value)` — pre-storage duplicate detection.
|
|
48
|
+
- `limen.embedPending()` — process embedding queue for pending claims.
|
|
49
|
+
- `limen.embeddingStats()` — embedding pipeline statistics.
|
|
50
|
+
- `limen.cognitive.consolidate(options?)` — merge, archive, suggest resolutions.
|
|
51
|
+
- `limen.cognitive.importance(claimId, weights?)` — composite importance score.
|
|
52
|
+
- `limen.cognitive.narrative(missionId?)` — knowledge state snapshot.
|
|
53
|
+
- `limen.cognitive.verify(claimId)` — external claim verification (async).
|
|
54
|
+
- `limen.cognitive.suggestConnections(claimId)` — KNN relationship suggestions.
|
|
55
|
+
- `limen.cognitive.acceptSuggestion(id)` / `rejectSuggestion(id)` — suggestion workflow.
|
|
56
|
+
- `selfHealing` configuration: `{ enabled, autoRetractThreshold, maxCascadeDepth }`.
|
|
57
|
+
- `vector` configuration: `{ provider, dimensions }`.
|
|
58
|
+
- Migration v036 (cognitive engine tables: connection_suggestions, consolidation_log).
|
|
59
|
+
|
|
60
|
+
### Changed
|
|
61
|
+
- **BREAKING:** `SearchOptions.mode` now includes `'semantic' | 'hybrid'` alongside existing `'fulltext'`.
|
|
62
|
+
- **BREAKING:** Major version bump signals cognitive capabilities. No breaking API removals — all v1.x APIs continue to work.
|
|
63
|
+
- `sqlite-vec` added as optional dependency (not required for core functionality).
|
|
64
|
+
|
|
65
|
+
## [1.5.0] - 2026-04-03 (GOVERN)
|
|
66
|
+
|
|
67
|
+
### Added
|
|
68
|
+
- **Phase 9: Security Hardening** — PII detection engine with configurable patterns (emails, phone numbers, SSNs, credit cards). Claim content sanitization against prompt injection patterns. FTS5 query injection defense. Subject/predicate URI format validation. Sensitivity levels controlling enforcement (block, redact, log). Consent tracking API (`limen.consent`) with CRUD operations, expiry computation on read, and audit trail on all mutations.
|
|
69
|
+
- **Phase 10: Governance Suite** — Data classification engine with configurable rules. Protected predicate system preventing unauthorized mutation of critical knowledge domains. GDPR Article 17 erasure with cryptographic certificate generation (`limen.governance.erasure()`). SOC 2 Type II audit package export (`limen.governance.exportAudit()`). Classification rule management (`addRule`, `removeRule`, `listRules`). Protected predicate management (`protectPredicate`, `listProtectedPredicates`).
|
|
70
|
+
- `limen.consent.register()` / `revoke()` / `check()` / `list()` — consent lifecycle management.
|
|
71
|
+
- `limen.governance.erasure()` — GDPR erasure with audit certificate.
|
|
72
|
+
- `limen.governance.exportAudit()` — SOC 2 compliance export.
|
|
73
|
+
- `limen.governance.addRule()` / `removeRule()` / `listRules()` — classification rule management.
|
|
74
|
+
- `limen.governance.protectPredicate()` / `listProtectedPredicates()` — predicate access control.
|
|
75
|
+
- Migrations for security tables and governance tables.
|
|
76
|
+
|
|
77
|
+
### Changed
|
|
78
|
+
- Security controls applied at the claim assertion boundary — PII detection and injection defense run before storage, not after.
|
|
79
|
+
|
|
8
80
|
## [1.4.0] - 2026-03-31
|
|
9
81
|
|
|
10
82
|
### Added
|
package/README.md
CHANGED
|
@@ -14,31 +14,50 @@
|
|
|
14
14
|
|
|
15
15
|
# Limen
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Cognitive infrastructure for AI agents — beliefs that decay, governance that enforces, knowledge that heals itself.
|
|
18
|
+
|
|
19
|
+
> **Requires Node.js >= 22.** ESM-only package (`"type": "module"`).
|
|
18
20
|
|
|
19
21
|
```
|
|
20
22
|
npm install limen-ai
|
|
21
23
|
```
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
Run with: `npx tsx yourscript.ts`
|
|
26
|
+
|
|
27
|
+
Optional, for semantic/vector search:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
npm install sqlite-vec
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## What's New in v3.0.0
|
|
34
|
+
|
|
35
|
+
- **Decay in recall** — `effectiveConfidence` now decays on every read (was only in search)
|
|
36
|
+
- **Automated retention** — background scheduler cleans expired data automatically
|
|
37
|
+
- **Replay verification** — mission determinism verified via state snapshots
|
|
38
|
+
- **Auto-connection** — relationship suggestions fire automatically on claim assertion
|
|
39
|
+
- **Consent enforcement** — claim assertion blocked without active consent (when configured)
|
|
40
|
+
- **Classification filtering** — claims filtered by clearance level at query and search time
|
|
41
|
+
- **Key rotation** — atomic re-encryption of all vault entries with new master key
|
|
42
|
+
- **11 new MCP tools** — 36 total tools, full CLI parity
|
|
43
|
+
- **Dispute fix** — `disputed` flag correctly recomputes after contradicting claim retracted
|
|
44
|
+
|
|
45
|
+
## Quick Start
|
|
24
46
|
|
|
25
47
|
```typescript
|
|
26
48
|
import { createLimen } from 'limen-ai';
|
|
27
49
|
|
|
28
50
|
const limen = await createLimen();
|
|
29
51
|
|
|
30
|
-
// Store a belief
|
|
31
52
|
limen.remember('entity:user:alice', 'preference.food', 'loves Thai food');
|
|
32
53
|
|
|
33
|
-
// Recall what you know
|
|
34
54
|
const beliefs = limen.recall('entity:user:alice');
|
|
35
55
|
if (beliefs.ok) {
|
|
36
|
-
console.log(beliefs.value[0].value);
|
|
37
|
-
console.log(beliefs.value[0].confidence);
|
|
56
|
+
console.log(beliefs.value[0].value); // "loves Thai food"
|
|
57
|
+
console.log(beliefs.value[0].confidence); // 0.7 (governed ceiling)
|
|
38
58
|
console.log(beliefs.value[0].effectiveConfidence); // decays over time
|
|
39
59
|
}
|
|
40
60
|
|
|
41
|
-
// Search across all knowledge
|
|
42
61
|
const results = limen.search('Thai');
|
|
43
62
|
if (results.ok) {
|
|
44
63
|
console.log(results.value[0].belief.value); // "loves Thai food"
|
|
@@ -48,11 +67,17 @@ if (results.ok) {
|
|
|
48
67
|
await limen.shutdown();
|
|
49
68
|
```
|
|
50
69
|
|
|
51
|
-
`createLimen()` with no arguments auto-detects providers, generates a dev encryption key, and provisions a local SQLite database. Copy, paste, run.
|
|
70
|
+
`createLimen()` with no arguments auto-detects LLM providers, generates a dev encryption key, and provisions a local SQLite database. Copy, paste, run. If no LLM provider is configured, core CRUD (remember, recall, search, forget) works in degraded mode — only cognitive features (chat, infer, verify, narrative) require a provider.
|
|
71
|
+
|
|
72
|
+
## What Makes Limen Different
|
|
73
|
+
|
|
74
|
+
Most AI memory systems store data — key-value pairs, vector embeddings, chat history. Limen stores **beliefs**.
|
|
75
|
+
|
|
76
|
+
**Beliefs, not data.** Every claim has a confidence score, a temporal anchor, and a decay curve. A belief stored 90 days ago with no reinforcement is weaker than one stored yesterday. This is computed on every read — nothing is stored. `effectiveConfidence` always reflects the current state of belief.
|
|
52
77
|
|
|
53
|
-
|
|
78
|
+
**Governance, not storage.** Auto-extracted claims are capped at 0.7 confidence — the `maxAutoConfidence` ceiling prevents confidence laundering. Structural conflict detection flags contradictions on write. Cascade retraction penalizes downstream beliefs when a source is retracted. PII detection blocks sensitive data before it reaches the database. Protected predicates prevent unauthorized mutation of critical knowledge.
|
|
54
79
|
|
|
55
|
-
|
|
80
|
+
**Cognition, not retrieval.** The engine consolidates duplicate beliefs, computes importance scores, suggests connections between claims, generates narrative snapshots of knowledge state, and optionally self-heals by auto-retracting derived claims whose parents have decayed below threshold.
|
|
56
81
|
|
|
57
82
|
## Core API
|
|
58
83
|
|
|
@@ -60,23 +85,15 @@ AI agents accumulate knowledge, but most systems store it as flat data -- key-va
|
|
|
60
85
|
|---|---|
|
|
61
86
|
| `remember(subject, predicate, value, options?)` | Store a belief with confidence and temporal anchoring |
|
|
62
87
|
| `remember(text, options?)` | Store a free-text observation (auto-generates subject) |
|
|
63
|
-
| `recall(subject?, predicate?, options?)` | Retrieve beliefs, filtered by subject/predicate |
|
|
88
|
+
| `recall(subject?, predicate?, options?)` | Retrieve beliefs, filtered by subject/predicate, with decay applied |
|
|
64
89
|
| `search(query, options?)` | Full-text search across all beliefs (FTS5 + BM25) |
|
|
65
|
-
| `forget(claimId, reason?)` | Retract a belief (governed, audited, never deleted) |
|
|
90
|
+
| `forget(claimId, reason?)` | Retract a belief (governed, audited, never deleted). Reason: `'incorrect'` \| `'superseded'` \| `'expired'` \| `'manual'` (default) |
|
|
66
91
|
| `connect(claimId1, claimId2, type)` | Relate beliefs: `supports`, `contradicts`, `supersedes`, `derived_from` |
|
|
67
92
|
| `reflect(entries)` | Batch-store categorized learnings (decisions, patterns, warnings, findings) |
|
|
68
|
-
| `promptInstructions()` | Get system prompt text teaching agents how to use Limen |
|
|
69
|
-
| `cognitive.health(config?)` | Knowledge health report: freshness, conflicts, gaps, stale domains |
|
|
70
|
-
|
|
71
|
-
## Beliefs That Breathe
|
|
72
|
-
|
|
73
|
-
Beliefs decay without reinforcement. Limen uses the FSRS power-decay formula: `R(t) = (1 + t/(9*S))^-1`, where `S` is stability in days (governance claims: 365d, findings: 90d, ephemeral: 7d).
|
|
74
93
|
|
|
75
94
|
```typescript
|
|
76
|
-
//
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
// 60 days later, recall shows decay
|
|
95
|
+
// Beliefs decay without reinforcement (FSRS power-decay)
|
|
96
|
+
// R(t) = (1 + t/(9*S))^-1, where S is stability in days
|
|
80
97
|
const beliefs = limen.recall('entity:project:limen');
|
|
81
98
|
if (beliefs.ok) {
|
|
82
99
|
const b = beliefs.value[0];
|
|
@@ -84,42 +101,210 @@ if (beliefs.ok) {
|
|
|
84
101
|
console.log(b.effectiveConfidence); // 0.57 (after 60d decay with S=90)
|
|
85
102
|
console.log(b.freshness); // "stale" | "aging" | "fresh"
|
|
86
103
|
}
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Effective confidence is computed at query time. Nothing is stored. Recall always reflects the current state of belief.
|
|
90
|
-
|
|
91
|
-
## Safety and Governance
|
|
92
|
-
|
|
93
|
-
Limen contains wrongness by default. Auto-extracted claims are capped at 0.7 confidence -- the `maxAutoConfidence` ceiling prevents confidence laundering. Structural conflict detection flags contradictions. Cascade retraction penalizes downstream beliefs when a source is retracted.
|
|
94
104
|
|
|
95
|
-
```typescript
|
|
96
105
|
// Wrongness containment: confidence is capped
|
|
97
106
|
const r = limen.remember('entity:market:ev', 'size.2025', '$45B', { confidence: 0.95 });
|
|
98
|
-
|
|
107
|
+
// r.value.confidence === 0.7 (capped, not 0.95)
|
|
99
108
|
|
|
100
|
-
// Conflict detection
|
|
109
|
+
// Conflict detection is automatic
|
|
101
110
|
limen.remember('entity:market:ev', 'size.2025', '$52B');
|
|
102
111
|
// ^ creates a 'contradicts' relationship with the first claim
|
|
103
112
|
|
|
104
|
-
//
|
|
113
|
+
// Batch-store learnings
|
|
114
|
+
limen.reflect([
|
|
115
|
+
{ category: 'decision', statement: 'Chose FSRS over exponential decay', confidence: 0.85 },
|
|
116
|
+
{ category: 'warning', statement: 'FTS5 trigram index doubles storage', confidence: 0.7 },
|
|
117
|
+
]);
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Cognitive API
|
|
121
|
+
|
|
122
|
+
The `cognitive` namespace provides knowledge health diagnostics and active knowledge management.
|
|
123
|
+
|
|
124
|
+
| Method | Description |
|
|
125
|
+
|---|---|
|
|
126
|
+
| `cognitive.health(config?)` | Knowledge health report: freshness distribution, conflicts, gaps, stale domains |
|
|
127
|
+
| `cognitive.consolidate(options?)` | Merge similar claims, archive stale ones, suggest contradiction resolutions |
|
|
128
|
+
| `cognitive.importance(claimId, weights?)` | 5-factor composite importance score for a claim |
|
|
129
|
+
| `cognitive.narrative(missionId?)` | Snapshot of knowledge state — threads, themes, evolution over time |
|
|
130
|
+
| `cognitive.verify(claimId)` | Verify a claim via external provider (async, advisory only) |
|
|
131
|
+
| `cognitive.suggestConnections(claimId)` | KNN-based relationship suggestions via embedding similarity |
|
|
132
|
+
| `cognitive.acceptSuggestion(id)` | Accept a pending connection suggestion |
|
|
133
|
+
| `cognitive.rejectSuggestion(id)` | Reject a pending connection suggestion |
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
// Knowledge health diagnostics
|
|
105
137
|
const health = limen.cognitive.health();
|
|
106
138
|
if (health.ok) {
|
|
107
|
-
console.log(health.value.
|
|
108
|
-
console.log(health.value.freshness);
|
|
139
|
+
console.log(health.value.totalClaims); // total active claims
|
|
140
|
+
console.log(health.value.freshness); // { fresh: N, aging: N, stale: N }
|
|
141
|
+
console.log(health.value.conflicts.unresolved); // unresolved contradictions
|
|
142
|
+
console.log(health.value.gaps); // predicates with no recent claims
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Consolidation: merge duplicates, archive stale, suggest resolutions
|
|
146
|
+
const result = limen.cognitive.consolidate({ dryRun: true });
|
|
147
|
+
if (result.ok) {
|
|
148
|
+
console.log(result.value.merged); // claims merged
|
|
149
|
+
console.log(result.value.archived); // claims archived
|
|
150
|
+
console.log(result.value.suggestedResolutions); // contradiction resolutions
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Importance scoring
|
|
154
|
+
const score = limen.cognitive.importance(claimId);
|
|
155
|
+
if (score.ok) {
|
|
156
|
+
console.log(score.value.score); // 0.0-1.0 weighted composite
|
|
157
|
+
console.log(score.value.factors); // { accessFrequency, recency, connectionDensity, confidence, governanceWeight }
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Knowledge narrative
|
|
161
|
+
const narrative = limen.cognitive.narrative();
|
|
162
|
+
if (narrative.ok) {
|
|
163
|
+
console.log(narrative.value.threads); // thematic threads across claims
|
|
164
|
+
console.log(narrative.value.momentum); // 'growing' | 'stable' | 'declining'
|
|
109
165
|
}
|
|
110
166
|
```
|
|
111
167
|
|
|
112
|
-
##
|
|
168
|
+
## Governance API
|
|
169
|
+
|
|
170
|
+
Classification, access control, compliance, and audit infrastructure.
|
|
171
|
+
|
|
172
|
+
| Method | Description |
|
|
173
|
+
|---|---|
|
|
174
|
+
| `governance.erasure(request)` | GDPR Article 17 erasure with certificate generation |
|
|
175
|
+
| `governance.exportAudit(options)` | SOC 2 Type II audit package export |
|
|
176
|
+
| `governance.addRule(rule)` | Add a data classification rule |
|
|
177
|
+
| `governance.removeRule(ruleId)` | Remove a classification rule |
|
|
178
|
+
| `governance.listRules()` | List all active classification rules |
|
|
179
|
+
| `governance.protectPredicate(rule)` | Protect a predicate from unauthorized mutation |
|
|
180
|
+
| `governance.listProtectedPredicates()` | List all protected predicate rules |
|
|
113
181
|
|
|
114
|
-
|
|
182
|
+
```typescript
|
|
183
|
+
// GDPR erasure with audit certificate
|
|
184
|
+
const erasure = limen.governance.erasure({
|
|
185
|
+
dataSubjectId: 'user:alice',
|
|
186
|
+
reason: 'Right to erasure request',
|
|
187
|
+
requestedBy: 'dpo@company.com',
|
|
188
|
+
});
|
|
189
|
+
if (erasure.ok) {
|
|
190
|
+
console.log(erasure.value.certificateId); // audit-grade certificate
|
|
191
|
+
console.log(erasure.value.claimsErased); // count
|
|
192
|
+
}
|
|
115
193
|
|
|
116
|
-
|
|
194
|
+
// Protect critical predicates
|
|
195
|
+
limen.governance.protectPredicate({
|
|
196
|
+
predicatePattern: 'governance.*',
|
|
197
|
+
requiredRole: 'admin',
|
|
198
|
+
description: 'Governance claims require admin role',
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
// SOC 2 audit export
|
|
202
|
+
const audit = limen.governance.exportAudit({
|
|
203
|
+
fromDate: '2026-01-01T00:00:00Z',
|
|
204
|
+
toDate: '2026-04-01T00:00:00Z',
|
|
205
|
+
format: 'json',
|
|
206
|
+
});
|
|
207
|
+
```
|
|
117
208
|
|
|
118
|
-
|
|
209
|
+
## Security
|
|
210
|
+
|
|
211
|
+
Limen applies security controls before data reaches storage.
|
|
212
|
+
|
|
213
|
+
**PII Detection.** Configurable patterns detect and block or redact PII (emails, phone numbers, SSNs, credit cards) before claims are stored. Detections are logged. Sensitivity levels control enforcement.
|
|
214
|
+
|
|
215
|
+
**Injection Defense.** Claim content is sanitized against prompt injection patterns. SQL injection via FTS5 queries is neutralized. Subject/predicate formats are validated against URI patterns.
|
|
216
|
+
|
|
217
|
+
**Consent Enforcement.** CRUD for data subject consent records with enforcement on claim assertion. When `security.consent.required` is true, claims about entities are blocked without active consent. Consent status (active, revoked, expired) is computed on read. All mutations produce audit trail entries.
|
|
218
|
+
|
|
219
|
+
**Classification Filtering.** Claims are classified at assertion time (unrestricted, internal, confidential, restricted, critical). Query and search results are filtered by the requesting agent's clearance level, derived from trust progression (untrusted=0, probationary=1, trusted=2, admin=4).
|
|
220
|
+
|
|
221
|
+
**Key Rotation.** Atomic re-encryption of all vault entries with a new master key. Transactional — partial failure rolls back completely. Audit trail records every rotation event.
|
|
222
|
+
|
|
223
|
+
**Poisoning Defense.** The `maxAutoConfidence` ceiling (default 0.7) prevents any programmatic source from laundering high-confidence claims. Only human-verified claims via `evidence_path` grounding can exceed the ceiling.
|
|
224
|
+
|
|
225
|
+
```typescript
|
|
226
|
+
// Consent management
|
|
227
|
+
limen.consent.register({
|
|
228
|
+
dataSubjectId: 'user:alice',
|
|
229
|
+
scope: 'knowledge-storage',
|
|
230
|
+
basis: 'consent',
|
|
231
|
+
expiresAt: '2027-01-01T00:00:00Z',
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
const consent = limen.consent.check('user:alice', 'knowledge-storage');
|
|
235
|
+
// consent.value.status === 'active' | 'revoked' | 'expired'
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Vector Search
|
|
239
|
+
|
|
240
|
+
Semantic search, hybrid search, and duplicate detection. Requires the optional `sqlite-vec` dependency.
|
|
241
|
+
|
|
242
|
+
```
|
|
243
|
+
npm install sqlite-vec
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
```typescript
|
|
247
|
+
import { createLimen } from 'limen-ai';
|
|
248
|
+
|
|
249
|
+
const limen = await createLimen({
|
|
250
|
+
vector: {
|
|
251
|
+
provider: yourEmbeddingProvider, // (query: string) => Promise<Float32Array>
|
|
252
|
+
dimensions: 384,
|
|
253
|
+
},
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
// Embed pending claims (call after batch inserts)
|
|
257
|
+
await limen.embedPending();
|
|
258
|
+
|
|
259
|
+
// Semantic search — finds conceptually similar beliefs
|
|
260
|
+
const results = await limen.semanticSearch('food preferences');
|
|
261
|
+
|
|
262
|
+
// Hybrid search — combines FTS5 keyword + vector similarity
|
|
263
|
+
const hybrid = limen.search('Thai food', { mode: 'hybrid' });
|
|
264
|
+
|
|
265
|
+
// Duplicate detection before storing
|
|
266
|
+
const dup = await limen.checkDuplicate(
|
|
267
|
+
'entity:user:alice', 'preference.food', 'loves Thai cuisine'
|
|
268
|
+
);
|
|
269
|
+
if (dup.ok && dup.value.isDuplicate) {
|
|
270
|
+
console.log(dup.value.similarClaimId); // existing claim
|
|
271
|
+
console.log(dup.value.similarity); // 0.0-1.0
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// Embedding statistics
|
|
275
|
+
const stats = limen.embeddingStats();
|
|
276
|
+
if (stats.ok) {
|
|
277
|
+
console.log(stats.value.totalEmbedded);
|
|
278
|
+
console.log(stats.value.pendingCount);
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
Without `sqlite-vec`, `semanticSearch()` falls back to full-text search. The core engine functions identically with or without vector capabilities.
|
|
283
|
+
|
|
284
|
+
## Self-Healing
|
|
285
|
+
|
|
286
|
+
When a parent claim is retracted or decays below threshold, derived claims can be automatically retracted in a cascade. This is opt-in.
|
|
287
|
+
|
|
288
|
+
```typescript
|
|
289
|
+
const limen = await createLimen({
|
|
290
|
+
selfHealing: {
|
|
291
|
+
enabled: true,
|
|
292
|
+
autoRetractThreshold: 0.1, // retract derived claims when parent drops below this
|
|
293
|
+
maxCascadeDepth: 5, // prevent unbounded recursion
|
|
294
|
+
},
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
// If "entity:source:data" is retracted...
|
|
298
|
+
limen.forget(sourceClaimId, 'incorrect');
|
|
299
|
+
// ...all claims with derived_from relationships to it
|
|
300
|
+
// are auto-retracted if their effective confidence < 0.1
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Disabled by default. Existing applications upgrading to v2.0.0 see no behavior changes unless explicitly configured.
|
|
119
304
|
|
|
120
305
|
## Configuration
|
|
121
306
|
|
|
122
|
-
All fields
|
|
307
|
+
All fields optional. `createLimen()` with no arguments runs in zero-config mode.
|
|
123
308
|
|
|
124
309
|
| Option | Type | Default | Description |
|
|
125
310
|
|---|---|---|---|
|
|
@@ -130,12 +315,96 @@ All fields are optional when calling `createLimen()` with no arguments (zero-con
|
|
|
130
315
|
| `tenancy.isolation` | `'row-level' \| 'database'` | `'row-level'` | Multi-tenant isolation strategy |
|
|
131
316
|
| `cognitive.maxAutoConfidence` | `number` | `0.7` | Confidence ceiling for auto-extracted claims |
|
|
132
317
|
| `autoConflict` | `boolean` | `true` | Structural conflict detection on assertion |
|
|
133
|
-
| `
|
|
318
|
+
| `selfHealing.enabled` | `boolean` | `false` | Auto-retraction cascades (opt-in) |
|
|
319
|
+
| `selfHealing.autoRetractThreshold` | `number` | `0.1` | Effective confidence floor for derived claims |
|
|
320
|
+
| `selfHealing.maxCascadeDepth` | `number` | `5` | Maximum cascade recursion depth |
|
|
321
|
+
| `vector.provider` | `EmbeddingProvider` | `undefined` | Embedding function for semantic search |
|
|
322
|
+
| `vector.dimensions` | `number` | `undefined` | Embedding vector dimensions |
|
|
323
|
+
| `requireRbac` | `boolean` | `false` | Enforce RBAC + classification filtering |
|
|
324
|
+
| `security.consent.required` | `boolean` | `false` | Enforce consent check on claim assertion |
|
|
325
|
+
| `maintenance.retentionEnabled` | `boolean` | `true` | Automatic retention scheduling |
|
|
326
|
+
| `maintenance.retentionIntervalMs` | `number` | `86400000` | Retention check interval (24h default) |
|
|
327
|
+
| `cognitive.autoSuggestConnections` | `boolean` | `true` | Auto-suggest connections on claim assertion |
|
|
134
328
|
| `defaultTimeoutMs` | `number` | `60000` | Chat/infer timeout (ms) |
|
|
135
329
|
| `rateLimiting.apiCallsPerMinute` | `number` | `100` | API rate limit |
|
|
136
330
|
| `failoverPolicy` | `'degrade' \| 'allow-overdraft' \| 'block'` | `'degrade'` | Provider failure behavior |
|
|
137
331
|
| `logger` | `(event) => void` | No-op | Structured logging callback |
|
|
138
332
|
|
|
333
|
+
## Command Line
|
|
334
|
+
|
|
335
|
+
Limen includes a full CLI with JSON output for every operation.
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
npm install -g limen-cli
|
|
339
|
+
|
|
340
|
+
limen init # initialize database
|
|
341
|
+
limen remember --subject entity:user:alice --predicate preference.food --value "loves Thai"
|
|
342
|
+
limen recall --subject entity:user:alice
|
|
343
|
+
limen search --query "Thai food"
|
|
344
|
+
limen forget --claimId <id> --reason incorrect
|
|
345
|
+
limen health # knowledge health report
|
|
346
|
+
limen consolidate # merge, archive, resolve
|
|
347
|
+
limen importance --claimId <id> # 5-factor importance score
|
|
348
|
+
limen maintenance-retention # run retention manually
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
All 36 MCP tools have CLI equivalents. Run `limen --help` for the full list.
|
|
352
|
+
|
|
353
|
+
## Limen for Claude (MCP)
|
|
354
|
+
|
|
355
|
+
Add to `~/.claude/mcp.json`:
|
|
356
|
+
|
|
357
|
+
```json
|
|
358
|
+
{
|
|
359
|
+
"mcpServers": {
|
|
360
|
+
"limen": {
|
|
361
|
+
"command": "npx",
|
|
362
|
+
"args": ["-y", "limen-mcp"],
|
|
363
|
+
"env": {
|
|
364
|
+
"LIMEN_DATA_DIR": "/path/to/your/data"
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
36 tools available: `limen_remember`, `limen_recall`, `limen_search`, `limen_forget`, `limen_connect`, `limen_reflect`, `limen_consolidate`, `limen_importance`, `limen_narrative`, `limen_verify`, `limen_suggest_connections`, `limen_replay_verify`, `limen_consent_register`, `limen_consent_check`, `limen_maintenance_retention`, `limen_governance_erasure`, `limen_governance_audit_export`, and more.
|
|
372
|
+
|
|
373
|
+
## Architecture
|
|
374
|
+
|
|
375
|
+
```
|
|
376
|
+
API Surface createLimen(), remember(), recall(), search(), cognitive.*,
|
|
377
|
+
governance.*, consent.*, on(), exportData(), importData()
|
|
378
|
+
|
|
379
|
+
Orchestration Missions, task graphs, budgets, 16 system calls
|
|
380
|
+
|
|
381
|
+
Substrate LLM gateway, transport engine, worker pool
|
|
382
|
+
|
|
383
|
+
Kernel SQLite (WAL), audit trail, RBAC, crypto, events
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
Layers depend downward only. The kernel knows nothing about AI. The API composes everything into a single frozen `Limen` object via `Object.freeze`.
|
|
387
|
+
|
|
388
|
+
4,000+ tests. 134+ invariants across 3 tiers. 16 system calls. 36 MCP tools. 1 production dependency (`better-sqlite3`). Every state mutation is audited in a hash-chained, append-only trail. RBAC on every operation. AES-256-GCM encryption at rest. Consent enforcement. Classification-filtered retrieval. Automated retention scheduling.
|
|
389
|
+
|
|
390
|
+
## Trust Surface
|
|
391
|
+
|
|
392
|
+
What is proven:
|
|
393
|
+
|
|
394
|
+
- Every invariant in [docs/proof/invariants.md](docs/proof/invariants.md) links to a file and line number in the source. CI verifies these references stay fresh.
|
|
395
|
+
- 16 system calls, each with interface, implementation, and dual-path test coverage (success + rejection). Evidence: [docs/proof/system-calls.md](docs/proof/system-calls.md).
|
|
396
|
+
- Security model with 8 mechanisms and 25 declared non-protections. Evidence: [docs/proof/security-model.md](docs/proof/security-model.md).
|
|
397
|
+
- Failure mode defenses with honest accounting. Evidence: [docs/proof/failure-modes.md](docs/proof/failure-modes.md).
|
|
398
|
+
|
|
399
|
+
What is not:
|
|
400
|
+
|
|
401
|
+
- Limen is not a vector database. Semantic search requires an external embedding provider and the optional `sqlite-vec` dependency.
|
|
402
|
+
- Limen does not guarantee real-time performance at scale. SQLite with WAL mode is the foundation — appropriate for single-node deployments with thousands to low millions of claims.
|
|
403
|
+
- The cognitive engine (consolidation, narrative, importance) uses heuristic algorithms, not ML models. Results are deterministic but approximate.
|
|
404
|
+
- Self-healing cascades are opt-in and advisory by design. They retract derived claims but do not rewrite or repair them.
|
|
405
|
+
|
|
406
|
+
Full trust surface with file-and-line evidence: [docs/proof/readiness.md](docs/proof/readiness.md).
|
|
407
|
+
|
|
139
408
|
## Installation Troubleshooting
|
|
140
409
|
|
|
141
410
|
Limen depends on `better-sqlite3`, which requires native C++ compilation.
|
|
@@ -169,17 +438,6 @@ RUN npm install limen-ai
|
|
|
169
438
|
|
|
170
439
|
If `npm install` fails with `node-gyp` errors, ensure a C++ toolchain is available. On macOS: `xcode-select --install`. On Linux: `apt install build-essential` or `yum groupinstall "Development Tools"`.
|
|
171
440
|
|
|
172
|
-
## Architecture
|
|
173
|
-
|
|
174
|
-
```
|
|
175
|
-
API Surface createLimen(), remember(), recall(), search(), cognitive.health()
|
|
176
|
-
Orchestration Missions, task graphs, budgets, 16 system calls
|
|
177
|
-
Substrate LLM gateway, transport engine, worker pool
|
|
178
|
-
Kernel SQLite (WAL), audit trail, RBAC, crypto, events
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
Layers depend downward only. The kernel knows nothing about AI. The API composes everything into a single frozen `Limen` object.
|
|
182
|
-
|
|
183
441
|
## License
|
|
184
442
|
|
|
185
443
|
[Apache License 2.0](LICENSE)
|
|
@@ -75,4 +75,24 @@ export type ViolationSeverity = 'low' | 'medium' | 'high' | 'critical';
|
|
|
75
75
|
* any on untrusted → null (already at lowest)
|
|
76
76
|
*/
|
|
77
77
|
export declare function getDemotionTarget(currentLevel: TrustLevel, severity: ViolationSeverity): TrustLevel | null;
|
|
78
|
+
/**
|
|
79
|
+
* Map trust levels to classification clearance levels.
|
|
80
|
+
* Clearance values align with CLASSIFICATION_LEVEL_ORDER in governance_types.ts:
|
|
81
|
+
* unrestricted=0, internal=1, confidential=2, restricted=3, critical=4
|
|
82
|
+
*
|
|
83
|
+
* untrusted -> 0 (unrestricted only)
|
|
84
|
+
* probationary -> 1 (internal and below)
|
|
85
|
+
* trusted -> 2 (confidential and below)
|
|
86
|
+
* admin -> 4 (all levels including critical)
|
|
87
|
+
*
|
|
88
|
+
* This mapping enforces principle of least privilege:
|
|
89
|
+
* agents must earn trust before accessing sensitive data.
|
|
90
|
+
*/
|
|
91
|
+
export declare const TRUST_TO_CLEARANCE: Readonly<Record<TrustLevel, number>>;
|
|
92
|
+
/**
|
|
93
|
+
* Get the clearance level for a given trust level.
|
|
94
|
+
* Returns the maximum classification level the agent can access.
|
|
95
|
+
* Returns 4 (all) for undefined/null trust (backward compat single-user mode).
|
|
96
|
+
*/
|
|
97
|
+
export declare function getClearanceForTrust(trustLevel: TrustLevel | null | undefined): number;
|
|
78
98
|
//# sourceMappingURL=trust_progression.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trust_progression.d.ts","sourceRoot":"","sources":["../../../src/api/agents/trust_progression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAIhE,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,cAAc,GAAG,SAAS,GAAG,OAAO,CAAC;AAgB5E;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI,CAExE;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,UAAU,EACrB,WAAW,EAAE,UAAU,EACvB,SAAS,EAAE,QAAQ,GAAG,OAAO,GAC5B;IAAE,KAAK,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CA4BpD;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,EACtC,aAAa,EAAE,OAAO,GAAG,MAAM,GAC9B;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAQxD;AAID;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;AAEvE;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,UAAU,EACxB,QAAQ,EAAE,iBAAiB,GAC1B,UAAU,GAAG,IAAI,CAmBnB"}
|
|
1
|
+
{"version":3,"file":"trust_progression.d.ts","sourceRoot":"","sources":["../../../src/api/agents/trust_progression.ts"],"names":[],"mappings":"AA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34 @@ export function getDemotionTarget(currentLevel, severity) {
|
|
|
121
121
|
};
|
|
122
122
|
return demotionMap[currentLevel];
|
|
123
123
|
}
|
|
124
|
+
// ─── v3.0.0 EG-03: Trust-to-Clearance Mapping ───
|
|
125
|
+
/**
|
|
126
|
+
* Map trust levels to classification clearance levels.
|
|
127
|
+
* Clearance values align with CLASSIFICATION_LEVEL_ORDER in governance_types.ts:
|
|
128
|
+
* unrestricted=0, internal=1, confidential=2, restricted=3, critical=4
|
|
129
|
+
*
|
|
130
|
+
* untrusted -> 0 (unrestricted only)
|
|
131
|
+
* probationary -> 1 (internal and below)
|
|
132
|
+
* trusted -> 2 (confidential and below)
|
|
133
|
+
* admin -> 4 (all levels including critical)
|
|
134
|
+
*
|
|
135
|
+
* This mapping enforces principle of least privilege:
|
|
136
|
+
* agents must earn trust before accessing sensitive data.
|
|
137
|
+
*/
|
|
138
|
+
export const TRUST_TO_CLEARANCE = {
|
|
139
|
+
untrusted: 0,
|
|
140
|
+
probationary: 1,
|
|
141
|
+
trusted: 2,
|
|
142
|
+
admin: 4,
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Get the clearance level for a given trust level.
|
|
146
|
+
* Returns the maximum classification level the agent can access.
|
|
147
|
+
* Returns 4 (all) for undefined/null trust (backward compat single-user mode).
|
|
148
|
+
*/
|
|
149
|
+
export function getClearanceForTrust(trustLevel) {
|
|
150
|
+
if (trustLevel === null || trustLevel === undefined)
|
|
151
|
+
return 4; // full access
|
|
152
|
+
return TRUST_TO_CLEARANCE[trustLevel] ?? 4;
|
|
153
|
+
}
|
|
124
154
|
//# sourceMappingURL=trust_progression.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trust_progression.js","sourceRoot":"","sources":["../../../src/api/agents/trust_progression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAQH,wCAAwC;AAExC;;;;GAIG;AACH,MAAM,UAAU,GAA0C;IACxD,SAAS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,KAAK;YACd,MAAM,EAAE,2DAA2D;SACpE,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3B,CAAC;AASD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAC/B,YAAwB,EACxB,QAA2B;IAE3B,iDAAiD;IACjD,IAAI,YAAY,KAAK,WAAW,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,wEAAwE;IACxE,IAAI,QAAQ,KAAK,UAAU,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;QACnD,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,sCAAsC;IACtC,MAAM,WAAW,GAAyD;QACxE,KAAK,EAAE,SAAS;QAChB,OAAO,EAAE,cAAc;QACvB,YAAY,EAAE,WAAW;KAC1B,CAAC;IAEF,OAAO,WAAW,CAAC,YAAY,CAAC,CAAC;AACnC,CAAC"}
|
|
1
|
+
{"version":3,"file":"trust_progression.js","sourceRoot":"","sources":["../../../src/api/agents/trust_progression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAQH,wCAAwC;AAExC;;;;GAIG;AACH,MAAM,UAAU,GAA0C;IACxD,SAAS,EAAE,cAAc;IACzB,YAAY,EAAE,SAAS;IACvB,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,IAAI,EAAE,sCAAsC;CACpD,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAmB;IACnD,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAC/B,SAAqB,EACrB,WAAuB,EACvB,SAA6B;IAE7B,gCAAgC;IAChC,IAAI,SAAS,KAAK,WAAW,EAAE,CAAC;QAC9B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,2BAA2B,SAAS,IAAI,EAAE,CAAC;IAC5E,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