ms8 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (441) hide show
  1. ms8-0.2.0/LICENSE +21 -0
  2. ms8-0.2.0/MANIFEST.in +9 -0
  3. ms8-0.2.0/PKG-INFO +428 -0
  4. ms8-0.2.0/README.md +403 -0
  5. ms8-0.2.0/pyproject.toml +54 -0
  6. ms8-0.2.0/setup.cfg +4 -0
  7. ms8-0.2.0/src/ms8/__init__.py +3 -0
  8. ms8-0.2.0/src/ms8/__main__.py +15 -0
  9. ms8-0.2.0/src/ms8/agent_native/__init__.py +6 -0
  10. ms8-0.2.0/src/ms8/agent_native/agent_cli.py +478 -0
  11. ms8-0.2.0/src/ms8/agent_native/onboarding.py +294 -0
  12. ms8-0.2.0/src/ms8/agent_native/permission.py +65 -0
  13. ms8-0.2.0/src/ms8/agent_native/report.py +16 -0
  14. ms8-0.2.0/src/ms8/agent_native/task_spec.py +11 -0
  15. ms8-0.2.0/src/ms8/agent_native/task_templates.py +259 -0
  16. ms8-0.2.0/src/ms8/app/__init__.py +5 -0
  17. ms8-0.2.0/src/ms8/app/classifier/__init__.py +3 -0
  18. ms8-0.2.0/src/ms8/app/classifier/context_builder.py +48 -0
  19. ms8-0.2.0/src/ms8/app/classifier/hybrid_classifier.py +82 -0
  20. ms8-0.2.0/src/ms8/app/classifier/llm_classifier.py +39 -0
  21. ms8-0.2.0/src/ms8/app/classifier/rule_classifier.py +27 -0
  22. ms8-0.2.0/src/ms8/app/classifier/threshold_manager.py +25 -0
  23. ms8-0.2.0/src/ms8/app/config.py +152 -0
  24. ms8-0.2.0/src/ms8/app/extractors/__init__.py +0 -0
  25. ms8-0.2.0/src/ms8/app/extractors/action_extractor.py +66 -0
  26. ms8-0.2.0/src/ms8/app/extractors/entity_extractor.py +121 -0
  27. ms8-0.2.0/src/ms8/app/extractors/technical_extractor.py +9 -0
  28. ms8-0.2.0/src/ms8/app/feedback/__init__.py +0 -0
  29. ms8-0.2.0/src/ms8/app/feedback/feedback_service.py +47 -0
  30. ms8-0.2.0/src/ms8/app/feedback/rule_optimizer.py +117 -0
  31. ms8-0.2.0/src/ms8/app/integrations/__init__.py +0 -0
  32. ms8-0.2.0/src/ms8/app/integrations/ollama_client.py +57 -0
  33. ms8-0.2.0/src/ms8/app/main.py +12 -0
  34. ms8-0.2.0/src/ms8/app/memory/__init__.py +0 -0
  35. ms8-0.2.0/src/ms8/app/memory/indexer.py +230 -0
  36. ms8-0.2.0/src/ms8/app/memory/models.py +9 -0
  37. ms8-0.2.0/src/ms8/app/memory/repository.py +142 -0
  38. ms8-0.2.0/src/ms8/app/memory/search.py +48 -0
  39. ms8-0.2.0/src/ms8/app/observability/__init__.py +0 -0
  40. ms8-0.2.0/src/ms8/app/observability/logger.py +44 -0
  41. ms8-0.2.0/src/ms8/app/observability/metrics.py +14 -0
  42. ms8-0.2.0/src/ms8/app/observability/trace.py +16 -0
  43. ms8-0.2.0/src/ms8/app/pipeline/__init__.py +37 -0
  44. ms8-0.2.0/src/ms8/app/pipeline/consistency.py +8 -0
  45. ms8-0.2.0/src/ms8/app/pipeline/decision.py +19 -0
  46. ms8-0.2.0/src/ms8/app/pipeline/dedupe.py +51 -0
  47. ms8-0.2.0/src/ms8/app/pipeline/memory_admission_engine.py +207 -0
  48. ms8-0.2.0/src/ms8/app/pipeline/memory_pipeline.py +414 -0
  49. ms8-0.2.0/src/ms8/app/pipeline/quality_gate.py +28 -0
  50. ms8-0.2.0/src/ms8/app/pipeline/risk_scoring.py +45 -0
  51. ms8-0.2.0/src/ms8/app/review/__init__.py +0 -0
  52. ms8-0.2.0/src/ms8/app/review/batch_review.py +112 -0
  53. ms8-0.2.0/src/ms8/app/review/review_service.py +82 -0
  54. ms8-0.2.0/src/ms8/app/rules/__init__.py +3 -0
  55. ms8-0.2.0/src/ms8/app/rules/base.py +53 -0
  56. ms8-0.2.0/src/ms8/app/rules/block_rules.py +177 -0
  57. ms8-0.2.0/src/ms8/app/rules/category_rules.py +58 -0
  58. ms8-0.2.0/src/ms8/app/rules/conflict_rules.py +72 -0
  59. ms8-0.2.0/src/ms8/app/rules/dedupe_rules.py +27 -0
  60. ms8-0.2.0/src/ms8/app/rules/extraction_rules.py +14 -0
  61. ms8-0.2.0/src/ms8/app/rules/preprocess_rules.py +41 -0
  62. ms8-0.2.0/src/ms8/app/rules/privacy_rules.py +99 -0
  63. ms8-0.2.0/src/ms8/app/rules/registry.py +19 -0
  64. ms8-0.2.0/src/ms8/app/rules/tag_rules.py +12 -0
  65. ms8-0.2.0/src/ms8/app/schemas/__init__.py +0 -0
  66. ms8-0.2.0/src/ms8/app/schemas/feedback_schema.py +16 -0
  67. ms8-0.2.0/src/ms8/app/schemas/pipeline_schema.py +70 -0
  68. ms8-0.2.0/src/ms8/app/schemas/review_schema.py +37 -0
  69. ms8-0.2.0/src/ms8/ask.py +41 -0
  70. ms8-0.2.0/src/ms8/cli.py +1657 -0
  71. ms8-0.2.0/src/ms8/compression_governance.py +133 -0
  72. ms8-0.2.0/src/ms8/connect/__init__.py +13 -0
  73. ms8-0.2.0/src/ms8/connect/adapter_registry/__init__.py +4 -0
  74. ms8-0.2.0/src/ms8/connect/adapter_registry/registry.py +92 -0
  75. ms8-0.2.0/src/ms8/connect/adapter_registry/scan_tools.py +23 -0
  76. ms8-0.2.0/src/ms8/connect/integration_hooks/service_models.py +23 -0
  77. ms8-0.2.0/src/ms8/connect/local_llm_adapter/__init__.py +1 -0
  78. ms8-0.2.0/src/ms8/connect/local_llm_adapter/adapter_llm.py +54 -0
  79. ms8-0.2.0/src/ms8/connect/mcp_server/__init__.py +13 -0
  80. ms8-0.2.0/src/ms8/connect/mcp_server/mcp_server.py +286 -0
  81. ms8-0.2.0/src/ms8/connect/mcp_server/memory_service_interface.py +537 -0
  82. ms8-0.2.0/src/ms8/connect/mcp_server/stdio_server.py +262 -0
  83. ms8-0.2.0/src/ms8/connect/scripts/__init__.py +2 -0
  84. ms8-0.2.0/src/ms8/connect/scripts/apply_client_configs.py +157 -0
  85. ms8-0.2.0/src/ms8/connect/scripts/bootstrap.py +523 -0
  86. ms8-0.2.0/src/ms8/connect/scripts/client_config.py +472 -0
  87. ms8-0.2.0/src/ms8/connect/scripts/common.py +118 -0
  88. ms8-0.2.0/src/ms8/connect/scripts/connect.py +196 -0
  89. ms8-0.2.0/src/ms8/connect/scripts/generate_client_configs.py +44 -0
  90. ms8-0.2.0/src/ms8/connect/scripts/install_env.py +20 -0
  91. ms8-0.2.0/src/ms8/connect/scripts/rollback_client_configs.py +108 -0
  92. ms8-0.2.0/src/ms8/connect/scripts/scan_register.py +26 -0
  93. ms8-0.2.0/src/ms8/connect/scripts/smoke_test.py +72 -0
  94. ms8-0.2.0/src/ms8/connect/scripts/status.py +49 -0
  95. ms8-0.2.0/src/ms8/connect/scripts/verify_client_configs.py +128 -0
  96. ms8-0.2.0/src/ms8/dashboard.py +227 -0
  97. ms8-0.2.0/src/ms8/demo.py +75 -0
  98. ms8-0.2.0/src/ms8/doctor.py +576 -0
  99. ms8-0.2.0/src/ms8/engine.py +666 -0
  100. ms8-0.2.0/src/ms8/engine_core/__init__.py +10 -0
  101. ms8-0.2.0/src/ms8/engine_core/admission_compat.py +78 -0
  102. ms8-0.2.0/src/ms8/engine_core/agent_skills_standard.py +399 -0
  103. ms8-0.2.0/src/ms8/engine_core/auto_memory.py +545 -0
  104. ms8-0.2.0/src/ms8/engine_core/built_in_skills.py +526 -0
  105. ms8-0.2.0/src/ms8/engine_core/config.py +1163 -0
  106. ms8-0.2.0/src/ms8/engine_core/context_material.py +424 -0
  107. ms8-0.2.0/src/ms8/engine_core/context_understanding.py +555 -0
  108. ms8-0.2.0/src/ms8/engine_core/core.py +4821 -0
  109. ms8-0.2.0/src/ms8/engine_core/enhanced_self_improvement.py +373 -0
  110. ms8-0.2.0/src/ms8/engine_core/enhanced_subagents.py +684 -0
  111. ms8-0.2.0/src/ms8/engine_core/expression_preference_profile.py +172 -0
  112. ms8-0.2.0/src/ms8/engine_core/file_store.py +54 -0
  113. ms8-0.2.0/src/ms8/engine_core/file_write_guard.py +108 -0
  114. ms8-0.2.0/src/ms8/engine_core/git_utils.py +211 -0
  115. ms8-0.2.0/src/ms8/engine_core/governance.py +168 -0
  116. ms8-0.2.0/src/ms8/engine_core/knowledge_arbitration.py +113 -0
  117. ms8-0.2.0/src/ms8/engine_core/knowledge_feedback.py +330 -0
  118. ms8-0.2.0/src/ms8/engine_core/knowledge_graph.py +3271 -0
  119. ms8-0.2.0/src/ms8/engine_core/knowledge_rules.py +54 -0
  120. ms8-0.2.0/src/ms8/engine_core/learning.py +983 -0
  121. ms8-0.2.0/src/ms8/engine_core/license.py +229 -0
  122. ms8-0.2.0/src/ms8/engine_core/local_llm.py +933 -0
  123. ms8-0.2.0/src/ms8/engine_core/maintenance/__init__.py +1 -0
  124. ms8-0.2.0/src/ms8/engine_core/maintenance/self_check/__init__.py +10 -0
  125. ms8-0.2.0/src/ms8/engine_core/maintenance/self_check/check_runner.py +405 -0
  126. ms8-0.2.0/src/ms8/engine_core/maintenance/self_check/check_specs.py +2921 -0
  127. ms8-0.2.0/src/ms8/engine_core/maintenance/self_check/reporter.py +884 -0
  128. ms8-0.2.0/src/ms8/engine_core/maintenance/self_repair/__init__.py +13 -0
  129. ms8-0.2.0/src/ms8/engine_core/maintenance/self_repair/repair_audit.py +151 -0
  130. ms8-0.2.0/src/ms8/engine_core/maintenance/self_repair/repair_cli.py +74 -0
  131. ms8-0.2.0/src/ms8/engine_core/maintenance/self_repair/repair_orchestrator.py +176 -0
  132. ms8-0.2.0/src/ms8/engine_core/maintenance/self_repair/repair_policies.py +986 -0
  133. ms8-0.2.0/src/ms8/engine_core/maintenance/self_repair/repair_runner.py +1037 -0
  134. ms8-0.2.0/src/ms8/engine_core/maintenance/self_repair/repair_schema.py +87 -0
  135. ms8-0.2.0/src/ms8/engine_core/maintenance/self_repair/repair_validator.py +33 -0
  136. ms8-0.2.0/src/ms8/engine_core/maintenance_manager.py +581 -0
  137. ms8-0.2.0/src/ms8/engine_core/maintenance_policy.py +808 -0
  138. ms8-0.2.0/src/ms8/engine_core/memory_blocks.py +110 -0
  139. ms8-0.2.0/src/ms8/engine_core/memory_section_parser.py +96 -0
  140. ms8-0.2.0/src/ms8/engine_core/meta_cognition.py +847 -0
  141. ms8-0.2.0/src/ms8/engine_core/metrics_contract.py +58 -0
  142. ms8-0.2.0/src/ms8/engine_core/monitoring.py +1103 -0
  143. ms8-0.2.0/src/ms8/engine_core/pattern_recognition.py +562 -0
  144. ms8-0.2.0/src/ms8/engine_core/policy_engine_iface.py +54 -0
  145. ms8-0.2.0/src/ms8/engine_core/policy_engine_loader.py +213 -0
  146. ms8-0.2.0/src/ms8/engine_core/policy_engine_open.py +273 -0
  147. ms8-0.2.0/src/ms8/engine_core/priority_engine.py +217 -0
  148. ms8-0.2.0/src/ms8/engine_core/record_gateway.py +46 -0
  149. ms8-0.2.0/src/ms8/engine_core/response_mode_router.py +336 -0
  150. ms8-0.2.0/src/ms8/engine_core/response_mode_types.py +77 -0
  151. ms8-0.2.0/src/ms8/engine_core/security/__init__.py +21 -0
  152. ms8-0.2.0/src/ms8/engine_core/security/cli.py +11 -0
  153. ms8-0.2.0/src/ms8/engine_core/security/crypto_manager.py +6 -0
  154. ms8-0.2.0/src/ms8/engine_core/security/encryption/__init__.py +15 -0
  155. ms8-0.2.0/src/ms8/engine_core/security/encryption/cli.py +86 -0
  156. ms8-0.2.0/src/ms8/engine_core/security/encryption/crypto_manager.py +267 -0
  157. ms8-0.2.0/src/ms8/engine_core/security/encryption/file_crypto.py +61 -0
  158. ms8-0.2.0/src/ms8/engine_core/security/encryption/key_manager.py +261 -0
  159. ms8-0.2.0/src/ms8/engine_core/security/encryption/recovery.py +23 -0
  160. ms8-0.2.0/src/ms8/engine_core/security/encryption/security_schema.py +55 -0
  161. ms8-0.2.0/src/ms8/engine_core/security/file_crypto.py +6 -0
  162. ms8-0.2.0/src/ms8/engine_core/security/key_manager.py +6 -0
  163. ms8-0.2.0/src/ms8/engine_core/security/recovery.py +6 -0
  164. ms8-0.2.0/src/ms8/engine_core/security/security_schema.py +6 -0
  165. ms8-0.2.0/src/ms8/engine_core/security/shadow/__init__.py +10 -0
  166. ms8-0.2.0/src/ms8/engine_core/security/shadow/shadow_audit.py +42 -0
  167. ms8-0.2.0/src/ms8/engine_core/security/shadow/shadow_capacity_guard.py +66 -0
  168. ms8-0.2.0/src/ms8/engine_core/security/shadow/shadow_checkpoint_guard.py +53 -0
  169. ms8-0.2.0/src/ms8/engine_core/security/shadow/shadow_cli.py +258 -0
  170. ms8-0.2.0/src/ms8/engine_core/security/shadow/shadow_control_gate.py +164 -0
  171. ms8-0.2.0/src/ms8/engine_core/security/shadow/shadow_fs_guard.py +25 -0
  172. ms8-0.2.0/src/ms8/engine_core/security/shadow/shadow_guard.py +1562 -0
  173. ms8-0.2.0/src/ms8/engine_core/security/shadow/shadow_ledger.py +723 -0
  174. ms8-0.2.0/src/ms8/engine_core/security/shadow/shadow_locking.py +80 -0
  175. ms8-0.2.0/src/ms8/engine_core/security/shadow/shadow_manifest_guard.py +244 -0
  176. ms8-0.2.0/src/ms8/engine_core/security/shadow/shadow_permissions.py +83 -0
  177. ms8-0.2.0/src/ms8/engine_core/security/shadow/shadow_platform_log.py +20 -0
  178. ms8-0.2.0/src/ms8/engine_core/security/shadow/shadow_quarantine.py +33 -0
  179. ms8-0.2.0/src/ms8/engine_core/security/shadow/shadow_recovery.py +145 -0
  180. ms8-0.2.0/src/ms8/engine_core/security/shadow/shadow_recovery_guard.py +272 -0
  181. ms8-0.2.0/src/ms8/engine_core/security/shadow/shadow_schema.py +101 -0
  182. ms8-0.2.0/src/ms8/engine_core/security/shadow/shadow_seal.py +297 -0
  183. ms8-0.2.0/src/ms8/engine_core/security/shadow/shadow_tokens.py +53 -0
  184. ms8-0.2.0/src/ms8/engine_core/self_improvement.py +674 -0
  185. ms8-0.2.0/src/ms8/engine_core/semantic_search.py +240 -0
  186. ms8-0.2.0/src/ms8/engine_core/skill_github_discovery.py +546 -0
  187. ms8-0.2.0/src/ms8/engine_core/skill_marketplace.py +342 -0
  188. ms8-0.2.0/src/ms8/engine_core/skill_search_index.py +410 -0
  189. ms8-0.2.0/src/ms8/engine_core/skills.py +549 -0
  190. ms8-0.2.0/src/ms8/engine_core/sqlite_store.py +385 -0
  191. ms8-0.2.0/src/ms8/engine_core/sticky_prompt_templates.py +85 -0
  192. ms8-0.2.0/src/ms8/engine_core/subagents.py +237 -0
  193. ms8-0.2.0/src/ms8/engine_core/synthetic_memory.py +1444 -0
  194. ms8-0.2.0/src/ms8/engine_core/tests/__init__.py +3 -0
  195. ms8-0.2.0/src/ms8/engine_core/tests/test_auto_memory.py +51 -0
  196. ms8-0.2.0/src/ms8/engine_core/tests/test_c_lifecycle_ops.py +90 -0
  197. ms8-0.2.0/src/ms8/engine_core/tests/test_compression.py +70 -0
  198. ms8-0.2.0/src/ms8/engine_core/tests/test_connect_target_profiles.py +187 -0
  199. ms8-0.2.0/src/ms8/engine_core/tests/test_encrypted_file_store.py +31 -0
  200. ms8-0.2.0/src/ms8/engine_core/tests/test_encrypted_repository.py +44 -0
  201. ms8-0.2.0/src/ms8/engine_core/tests/test_feedback_review_loop.py +67 -0
  202. ms8-0.2.0/src/ms8/engine_core/tests/test_llm_setup_runtime.py +46 -0
  203. ms8-0.2.0/src/ms8/engine_core/tests/test_local_overlay.py +28 -0
  204. ms8-0.2.0/src/ms8/engine_core/tests/test_maintenance_policy_kg_tiering.py +116 -0
  205. ms8-0.2.0/src/ms8/engine_core/tests/test_maintenance_policy_shadow.py +93 -0
  206. ms8-0.2.0/src/ms8/engine_core/tests/test_meta_cognition.py +43 -0
  207. ms8-0.2.0/src/ms8/engine_core/tests/test_monitoring_shadow_replay.py +304 -0
  208. ms8-0.2.0/src/ms8/engine_core/tests/test_monitoring_slo.py +64 -0
  209. ms8-0.2.0/src/ms8/engine_core/tests/test_pipeline_guardrails.py +57 -0
  210. ms8-0.2.0/src/ms8/engine_core/tests/test_priority_engine.py +39 -0
  211. ms8-0.2.0/src/ms8/engine_core/tests/test_security_enable.py +36 -0
  212. ms8-0.2.0/src/ms8/engine_core/tests/test_security_recovery.py +21 -0
  213. ms8-0.2.0/src/ms8/engine_core/tests/test_security_unlock.py +18 -0
  214. ms8-0.2.0/src/ms8/engine_core/tests/test_shadow_control_gate.py +128 -0
  215. ms8-0.2.0/src/ms8/engine_core/tests/test_shadow_hardening.py +156 -0
  216. ms8-0.2.0/src/ms8/engine_core/tests/test_shadow_system.py +196 -0
  217. ms8-0.2.0/src/ms8/engine_core/tests/test_synthetic_memory.py +123 -0
  218. ms8-0.2.0/src/ms8/engine_core/tests/test_synthetic_reasoning_mode.py +85 -0
  219. ms8-0.2.0/src/ms8/engine_core/tests/test_threshold_approval_integrity.py +200 -0
  220. ms8-0.2.0/src/ms8/engine_core/threshold_cli.py +98 -0
  221. ms8-0.2.0/src/ms8/engine_core/utils.py +74 -0
  222. ms8-0.2.0/src/ms8/engine_core/whoosh_search.py +213 -0
  223. ms8-0.2.0/src/ms8/engine_core/working_memory.py +286 -0
  224. ms8-0.2.0/src/ms8/lifecycle.py +245 -0
  225. ms8-0.2.0/src/ms8/onboarding.py +127 -0
  226. ms8-0.2.0/src/ms8/paths.py +71 -0
  227. ms8-0.2.0/src/ms8/record_policy.py +439 -0
  228. ms8-0.2.0/src/ms8/review_governance.py +232 -0
  229. ms8-0.2.0/src/ms8/runtime.py +2616 -0
  230. ms8-0.2.0/src/ms8/service.py +80 -0
  231. ms8-0.2.0/src/ms8/shortcut.py +76 -0
  232. ms8-0.2.0/src/ms8/watch.py +86 -0
  233. ms8-0.2.0/src/ms8.egg-info/PKG-INFO +428 -0
  234. ms8-0.2.0/src/ms8.egg-info/SOURCES.txt +439 -0
  235. ms8-0.2.0/src/ms8.egg-info/dependency_links.txt +1 -0
  236. ms8-0.2.0/src/ms8.egg-info/entry_points.txt +2 -0
  237. ms8-0.2.0/src/ms8.egg-info/requires.txt +16 -0
  238. ms8-0.2.0/src/ms8.egg-info/top_level.txt +1 -0
  239. ms8-0.2.0/tests/test_admission_compat_and_record_gateway.py +40 -0
  240. ms8-0.2.0/tests/test_agent_native_bug_report.py +26 -0
  241. ms8-0.2.0/tests/test_agent_native_cli_branches_more.py +56 -0
  242. ms8-0.2.0/tests/test_agent_native_init.py +39 -0
  243. ms8-0.2.0/tests/test_agent_native_migrate_policy.py +42 -0
  244. ms8-0.2.0/tests/test_agent_native_onboarding_edges.py +79 -0
  245. ms8-0.2.0/tests/test_agent_native_run.py +72 -0
  246. ms8-0.2.0/tests/test_agent_native_small_model_sim.py +82 -0
  247. ms8-0.2.0/tests/test_agent_native_tasks.py +30 -0
  248. ms8-0.2.0/tests/test_agent_native_verify.py +46 -0
  249. ms8-0.2.0/tests/test_agent_native_verify_tasks_more.py +37 -0
  250. ms8-0.2.0/tests/test_agent_skills_standard_module.py +124 -0
  251. ms8-0.2.0/tests/test_app_classifier_flows.py +122 -0
  252. ms8-0.2.0/tests/test_app_memory_models_search.py +67 -0
  253. ms8-0.2.0/tests/test_app_memory_repository.py +108 -0
  254. ms8-0.2.0/tests/test_app_pipeline_e2e.py +75 -0
  255. ms8-0.2.0/tests/test_app_rules_and_admission.py +77 -0
  256. ms8-0.2.0/tests/test_baseline_request_governance.py +77 -0
  257. ms8-0.2.0/tests/test_built_in_skills_module.py +125 -0
  258. ms8-0.2.0/tests/test_check_governance_gate_policy_attack.py +57 -0
  259. ms8-0.2.0/tests/test_cli.py +188 -0
  260. ms8-0.2.0/tests/test_cli_connect_branches_more.py +112 -0
  261. ms8-0.2.0/tests/test_cli_lifecycle_exit_codes.py +31 -0
  262. ms8-0.2.0/tests/test_cli_ops_branches_more.py +103 -0
  263. ms8-0.2.0/tests/test_cli_ops_dispatch_matrix_more.py +81 -0
  264. ms8-0.2.0/tests/test_cli_top_dispatch_matrix_more.py +135 -0
  265. ms8-0.2.0/tests/test_compression_governance.py +85 -0
  266. ms8-0.2.0/tests/test_connect_bootstrap_helpers.py +107 -0
  267. ms8-0.2.0/tests/test_connect_client_config_more.py +92 -0
  268. ms8-0.2.0/tests/test_connect_common_and_registry.py +122 -0
  269. ms8-0.2.0/tests/test_connect_contracts.py +458 -0
  270. ms8-0.2.0/tests/test_connect_module_and_mcp_server_helpers.py +128 -0
  271. ms8-0.2.0/tests/test_connect_scan_status_verify.py +120 -0
  272. ms8-0.2.0/tests/test_connect_scripts_more.py +132 -0
  273. ms8-0.2.0/tests/test_connect_stdio_server.py +105 -0
  274. ms8-0.2.0/tests/test_context_and_pattern_understanding.py +204 -0
  275. ms8-0.2.0/tests/test_context_material.py +121 -0
  276. ms8-0.2.0/tests/test_core_dispatch_expression_more.py +120 -0
  277. ms8-0.2.0/tests/test_core_graph_and_maintenance_more.py +98 -0
  278. ms8-0.2.0/tests/test_core_graph_skill_wrappers_more3.py +101 -0
  279. ms8-0.2.0/tests/test_core_graph_skills_wrappers_more.py +163 -0
  280. ms8-0.2.0/tests/test_core_helper_branches.py +81 -0
  281. ms8-0.2.0/tests/test_core_helpers_more.py +179 -0
  282. ms8-0.2.0/tests/test_core_init_paths_more.py +98 -0
  283. ms8-0.2.0/tests/test_core_learning_synthetic_review_wrappers_more.py +169 -0
  284. ms8-0.2.0/tests/test_core_maintenance_selfrepair_more.py +107 -0
  285. ms8-0.2.0/tests/test_core_misc_wrappers_more.py +172 -0
  286. ms8-0.2.0/tests/test_core_response_context_more.py +137 -0
  287. ms8-0.2.0/tests/test_core_security_shadow_wrappers_more.py +258 -0
  288. ms8-0.2.0/tests/test_core_shadow_and_threshold_wrappers_more.py +217 -0
  289. ms8-0.2.0/tests/test_core_skills_and_improvement_wrappers_more.py +175 -0
  290. ms8-0.2.0/tests/test_core_synthetic_runtime_more.py +88 -0
  291. ms8-0.2.0/tests/test_core_threshold_and_synthetic_branches_more.py +233 -0
  292. ms8-0.2.0/tests/test_core_threshold_helpers_more.py +121 -0
  293. ms8-0.2.0/tests/test_core_threshold_navigation_more.py +132 -0
  294. ms8-0.2.0/tests/test_core_wrapper_surface_more.py +157 -0
  295. ms8-0.2.0/tests/test_core_wrappers_additional.py +101 -0
  296. ms8-0.2.0/tests/test_dashboard_watch_service.py +226 -0
  297. ms8-0.2.0/tests/test_doctor_agent_native_status.py +55 -0
  298. ms8-0.2.0/tests/test_doctor_branches_more.py +116 -0
  299. ms8-0.2.0/tests/test_doctor_helpers_additional.py +56 -0
  300. ms8-0.2.0/tests/test_doctor_memory_quality_fallback_more.py +124 -0
  301. ms8-0.2.0/tests/test_doctor_ops_wrappers_more.py +64 -0
  302. ms8-0.2.0/tests/test_doctor_runtime_flow.py +114 -0
  303. ms8-0.2.0/tests/test_doctor_runtime_more.py +122 -0
  304. ms8-0.2.0/tests/test_doctor_selfcheck_compat.py +37 -0
  305. ms8-0.2.0/tests/test_encryption_stack_more.py +184 -0
  306. ms8-0.2.0/tests/test_engine_core_config_more.py +100 -0
  307. ms8-0.2.0/tests/test_engine_fallback_paths.py +115 -0
  308. ms8-0.2.0/tests/test_engine_governance_module.py +109 -0
  309. ms8-0.2.0/tests/test_engine_more_paths2.py +143 -0
  310. ms8-0.2.0/tests/test_engine_retrieval_gateway.py +83 -0
  311. ms8-0.2.0/tests/test_enhanced_self_improvement_module.py +107 -0
  312. ms8-0.2.0/tests/test_enhanced_subagents_module.py +166 -0
  313. ms8-0.2.0/tests/test_entrypoints_and_connect_helpers.py +187 -0
  314. ms8-0.2.0/tests/test_entrypoints_and_permission.py +42 -0
  315. ms8-0.2.0/tests/test_exception_policy_guard.py +30 -0
  316. ms8-0.2.0/tests/test_expression_mode_router.py +175 -0
  317. ms8-0.2.0/tests/test_feedback_review_indexer.py +138 -0
  318. ms8-0.2.0/tests/test_file_write_guard_module.py +104 -0
  319. ms8-0.2.0/tests/test_git_utils_more.py +136 -0
  320. ms8-0.2.0/tests/test_governance_backfill.py +56 -0
  321. ms8-0.2.0/tests/test_knowledge_arbitration_more.py +55 -0
  322. ms8-0.2.0/tests/test_knowledge_feedback_recorder_more.py +186 -0
  323. ms8-0.2.0/tests/test_knowledge_graph_basic.py +87 -0
  324. ms8-0.2.0/tests/test_knowledge_graph_helpers_more.py +104 -0
  325. ms8-0.2.0/tests/test_knowledge_graph_ingest_context_more.py +131 -0
  326. ms8-0.2.0/tests/test_knowledge_graph_maintenance_more.py +177 -0
  327. ms8-0.2.0/tests/test_knowledge_graph_queries_more.py +90 -0
  328. ms8-0.2.0/tests/test_labs_gate_cli.py +25 -0
  329. ms8-0.2.0/tests/test_learning_bootstrap_scheduler_paths.py +245 -0
  330. ms8-0.2.0/tests/test_learning_helpers_more2.py +130 -0
  331. ms8-0.2.0/tests/test_learning_module_more.py +302 -0
  332. ms8-0.2.0/tests/test_learning_scheduler_and_report_more.py +120 -0
  333. ms8-0.2.0/tests/test_lifecycle_more.py +60 -0
  334. ms8-0.2.0/tests/test_lifecycle_safety.py +75 -0
  335. ms8-0.2.0/tests/test_local_llm_module.py +114 -0
  336. ms8-0.2.0/tests/test_local_llm_more_paths.py +88 -0
  337. ms8-0.2.0/tests/test_maintenance_manager_module.py +190 -0
  338. ms8-0.2.0/tests/test_maintenance_manager_more.py +155 -0
  339. ms8-0.2.0/tests/test_maintenance_policy_predicates.py +171 -0
  340. ms8-0.2.0/tests/test_maintenance_policy_shadow_selfcheck_more.py +162 -0
  341. ms8-0.2.0/tests/test_maintenance_policy_stats_more.py +174 -0
  342. ms8-0.2.0/tests/test_memory_service_interface_edges.py +160 -0
  343. ms8-0.2.0/tests/test_meta_cognition_module_more.py +168 -0
  344. ms8-0.2.0/tests/test_monitoring_alerts_and_stats.py +84 -0
  345. ms8-0.2.0/tests/test_monitoring_helpers_more.py +103 -0
  346. ms8-0.2.0/tests/test_monitoring_slo_sampling.py +49 -0
  347. ms8-0.2.0/tests/test_multi_llm_fallback.py +96 -0
  348. ms8-0.2.0/tests/test_ollama_client_and_app_main.py +80 -0
  349. ms8-0.2.0/tests/test_onboarding_and_shortcut_runtime.py +113 -0
  350. ms8-0.2.0/tests/test_paths_and_release_isolation.py +80 -0
  351. ms8-0.2.0/tests/test_paths_more.py +41 -0
  352. ms8-0.2.0/tests/test_policy_engine_attack_samples.py +68 -0
  353. ms8-0.2.0/tests/test_policy_engine_closed_adversarial.py +106 -0
  354. ms8-0.2.0/tests/test_policy_engine_iface_contract.py +28 -0
  355. ms8-0.2.0/tests/test_policy_engine_loader.py +112 -0
  356. ms8-0.2.0/tests/test_policy_engine_phase2_hooks.py +128 -0
  357. ms8-0.2.0/tests/test_policy_engine_phase4_hooks.py +55 -0
  358. ms8-0.2.0/tests/test_policy_engine_regressions.py +98 -0
  359. ms8-0.2.0/tests/test_policy_filter.py +99 -0
  360. ms8-0.2.0/tests/test_policy_license_phase0.py +29 -0
  361. ms8-0.2.0/tests/test_policy_license_phase1.py +100 -0
  362. ms8-0.2.0/tests/test_product_integration_e2e.py +159 -0
  363. ms8-0.2.0/tests/test_record_policy_and_review_edges.py +107 -0
  364. ms8-0.2.0/tests/test_record_policy_more.py +96 -0
  365. ms8-0.2.0/tests/test_record_policy_validation_more.py +78 -0
  366. ms8-0.2.0/tests/test_repair_and_security_entrypoints.py +61 -0
  367. ms8-0.2.0/tests/test_review_governance.py +106 -0
  368. ms8-0.2.0/tests/test_review_governance_branch_more.py +101 -0
  369. ms8-0.2.0/tests/test_review_governance_more.py +110 -0
  370. ms8-0.2.0/tests/test_review_service_observability.py +27 -0
  371. ms8-0.2.0/tests/test_review_writeback_integration.py +135 -0
  372. ms8-0.2.0/tests/test_runtime_and_maturity_gate.py +92 -0
  373. ms8-0.2.0/tests/test_runtime_branches_extra.py +101 -0
  374. ms8-0.2.0/tests/test_runtime_compression_repair_more.py +126 -0
  375. ms8-0.2.0/tests/test_runtime_governance_helpers_more.py +137 -0
  376. ms8-0.2.0/tests/test_runtime_llm_and_risk_more.py +187 -0
  377. ms8-0.2.0/tests/test_runtime_more_paths.py +85 -0
  378. ms8-0.2.0/tests/test_runtime_policy_attack_report.py +71 -0
  379. ms8-0.2.0/tests/test_runtime_quarantine_maintenance_more.py +108 -0
  380. ms8-0.2.0/tests/test_runtime_wrapper_methods_map.py +74 -0
  381. ms8-0.2.0/tests/test_runtime_wrappers_bulk.py +81 -0
  382. ms8-0.2.0/tests/test_runtime_wrappers_more.py +105 -0
  383. ms8-0.2.0/tests/test_security_and_threshold_clis.py +222 -0
  384. ms8-0.2.0/tests/test_security_shims_and_platform_log.py +54 -0
  385. ms8-0.2.0/tests/test_self_check_health_card.py +151 -0
  386. ms8-0.2.0/tests/test_self_check_reporter_alerts_more.py +82 -0
  387. ms8-0.2.0/tests/test_self_check_reporter_helpers.py +61 -0
  388. ms8-0.2.0/tests/test_self_check_reporter_persist_more.py +85 -0
  389. ms8-0.2.0/tests/test_self_check_runner_additional.py +120 -0
  390. ms8-0.2.0/tests/test_self_check_runner_more.py +86 -0
  391. ms8-0.2.0/tests/test_self_check_runner_reporter_more2.py +102 -0
  392. ms8-0.2.0/tests/test_self_check_specs_connect_c1_c5_more.py +169 -0
  393. ms8-0.2.0/tests/test_self_check_specs_connect_checks_more.py +107 -0
  394. ms8-0.2.0/tests/test_self_check_specs_connect_quality_more.py +212 -0
  395. ms8-0.2.0/tests/test_self_check_specs_db_and_slo_more.py +98 -0
  396. ms8-0.2.0/tests/test_self_check_specs_helpers_more.py +93 -0
  397. ms8-0.2.0/tests/test_self_check_specs_index_consistency_more.py +97 -0
  398. ms8-0.2.0/tests/test_self_check_specs_l1_healthcard_more.py +66 -0
  399. ms8-0.2.0/tests/test_self_check_specs_l1_more.py +169 -0
  400. ms8-0.2.0/tests/test_self_check_specs_l3_more.py +109 -0
  401. ms8-0.2.0/tests/test_self_check_specs_l4_branches_more.py +179 -0
  402. ms8-0.2.0/tests/test_self_check_specs_l4_s_domain_more.py +161 -0
  403. ms8-0.2.0/tests/test_self_check_specs_m_domain_more.py +171 -0
  404. ms8-0.2.0/tests/test_self_check_specs_pipeline_checks_more.py +170 -0
  405. ms8-0.2.0/tests/test_self_check_specs_policy_guards_more.py +106 -0
  406. ms8-0.2.0/tests/test_self_check_specs_primitives_more.py +43 -0
  407. ms8-0.2.0/tests/test_self_check_specs_remaining_ids_more.py +144 -0
  408. ms8-0.2.0/tests/test_self_check_specs_repair_effectiveness_more.py +115 -0
  409. ms8-0.2.0/tests/test_self_repair_audit_and_validator.py +169 -0
  410. ms8-0.2.0/tests/test_self_repair_l4_mapping.py +49 -0
  411. ms8-0.2.0/tests/test_self_repair_orchestrator_more.py +105 -0
  412. ms8-0.2.0/tests/test_self_repair_policies_more.py +327 -0
  413. ms8-0.2.0/tests/test_self_repair_runner_more.py +613 -0
  414. ms8-0.2.0/tests/test_semantic_search_module.py +131 -0
  415. ms8-0.2.0/tests/test_shadow_cli_full_dispatch_more.py +215 -0
  416. ms8-0.2.0/tests/test_shadow_guard_disabled_more.py +54 -0
  417. ms8-0.2.0/tests/test_shadow_guard_misc_more.py +513 -0
  418. ms8-0.2.0/tests/test_shadow_guard_recovery_more.py +184 -0
  419. ms8-0.2.0/tests/test_shadow_guard_smoke_more.py +91 -0
  420. ms8-0.2.0/tests/test_shadow_guard_startup_integrity_more.py +163 -0
  421. ms8-0.2.0/tests/test_shadow_ledger_more.py +126 -0
  422. ms8-0.2.0/tests/test_shadow_locking_more.py +49 -0
  423. ms8-0.2.0/tests/test_shadow_manifest_guard_more.py +158 -0
  424. ms8-0.2.0/tests/test_shadow_policy_engine_hook.py +62 -0
  425. ms8-0.2.0/tests/test_shadow_recovery_and_quarantine.py +182 -0
  426. ms8-0.2.0/tests/test_shadow_recovery_guard_more.py +115 -0
  427. ms8-0.2.0/tests/test_shadow_seal_more.py +115 -0
  428. ms8-0.2.0/tests/test_shadow_security_modules.py +187 -0
  429. ms8-0.2.0/tests/test_skill_github_discovery_module.py +190 -0
  430. ms8-0.2.0/tests/test_skill_marketplace_module.py +144 -0
  431. ms8-0.2.0/tests/test_skill_search_index_module.py +136 -0
  432. ms8-0.2.0/tests/test_skills_module.py +116 -0
  433. ms8-0.2.0/tests/test_sqlite_store_module.py +168 -0
  434. ms8-0.2.0/tests/test_status_machine_and_governance_report.py +401 -0
  435. ms8-0.2.0/tests/test_sticky_prompt_templates_module.py +61 -0
  436. ms8-0.2.0/tests/test_subagents_module.py +66 -0
  437. ms8-0.2.0/tests/test_support_bundle.py +44 -0
  438. ms8-0.2.0/tests/test_synthetic_memory_helpers_more.py +371 -0
  439. ms8-0.2.0/tests/test_whoosh_search_more.py +84 -0
  440. ms8-0.2.0/tests/test_working_memory_manager_more.py +128 -0
  441. ms8-0.2.0/tests/test_write_idempotency.py +74 -0
ms8-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026
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.
ms8-0.2.0/MANIFEST.in ADDED
@@ -0,0 +1,9 @@
1
+ include README.md
2
+ include LICENSE
3
+ global-exclude *.db *.sqlite *.jsonl .env
4
+ prune .ms8_runtime
5
+ prune backups
6
+ prune cache
7
+ prune artifacts
8
+ prune restored_connect_from_pyc
9
+ prune repo_public
ms8-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,428 @@
1
+ Metadata-Version: 2.4
2
+ Name: ms8
3
+ Version: 0.2.0
4
+ Summary: MS8 — local memory system. Memory belongs to you, not to tools.
5
+ License-Expression: MIT
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: whoosh>=2.7.4
10
+ Requires-Dist: PyYAML>=6.0.0
11
+ Requires-Dist: gitpython>=3.1.0
12
+ Requires-Dist: schedule>=1.2.0
13
+ Requires-Dist: requests>=2.31.0
14
+ Requires-Dist: numpy>=1.26.0
15
+ Requires-Dist: jieba>=0.42.1
16
+ Requires-Dist: ollama>=0.4.0
17
+ Requires-Dist: cryptography>=44.0.0
18
+ Requires-Dist: argon2-cffi>=25.0.0
19
+ Provides-Extra: dev
20
+ Requires-Dist: pytest; extra == "dev"
21
+ Requires-Dist: ruff; extra == "dev"
22
+ Requires-Dist: mypy; extra == "dev"
23
+ Requires-Dist: build; extra == "dev"
24
+ Dynamic: license-file
25
+
26
+ <p align="center">
27
+ <h1 align="center">MS8 — 本地记忆引擎</h1>
28
+ <p align="center">
29
+ <em>记忆属于人,不属于工具。</em><br>
30
+ <em>Memory belongs to you, not to tools.</em>
31
+ </p>
32
+ </p>
33
+
34
+ <p align="center">
35
+ <img src="https://img.shields.io/badge/version-0.2.0-blue" alt="version">
36
+ <img src="https://img.shields.io/badge/python-≥3.10-green" alt="python">
37
+ <img src="https://img.shields.io/badge/license-MIT-orange" alt="license">
38
+ <img src="https://img.shields.io/badge/tests-123%20passed-brightgreen" alt="tests">
39
+ <img src="https://img.shields.io/badge/platform-macOS%20%7C%20Linux-lightgrey" alt="platform">
40
+ </p>
41
+
42
+ ---
43
+
44
+ ## 为什么是 MS8?
45
+
46
+ 市面上的 AI 记忆工具(Mem0、Zep、Letta)都在推云服务——你的记忆数据存在他们的服务器上。
47
+
48
+ **MS8 不同。** 你的记忆数据完全存在你自己的电脑上。没有云端,没有上传,没有订阅。
49
+
50
+ ```
51
+ 其他工具: 你的对话 → 云端存储 → 他们的服务器
52
+ MS8: 你的对话 → 本地存储 → 你的电脑
53
+ ```
54
+
55
+ ---
56
+
57
+ ## 核心能力
58
+
59
+ | 能力 | 说明 |
60
+ |------|------|
61
+ | 🧠 **记忆引擎** | 写入/检索/注入/压缩,JSONL + SQLite + 知识图谱 |
62
+ | 🛡️ **治理管道** | 5 路准入、9 种拦截规则、13 种 PII 检测、风险评分 |
63
+ | 🔌 **MCP 连接** | 7 个 Tools + 3 个 Resources,支持 10 个 AI 工具 |
64
+ | 🔒 **安全系统** | AES-256-GCM 加密 + 影子系统(18 模块) |
65
+ | 🔧 **自维护** | 61 项自检查 + 24 条自修复策略 + 25 条维护策略 |
66
+ | 📊 **多 LLM 路由** | 3 Provider 自动切换 + 语义缓存 + 批量处理 |
67
+
68
+ ---
69
+
70
+ ## 30 秒上手
71
+
72
+ ```bash
73
+ # 安装
74
+ python3 -m venv .venv && source .venv/bin/activate
75
+ pip install -e ".[dev]"
76
+
77
+ # 验证
78
+ ms8 doctor
79
+
80
+ # 写入一条记忆
81
+ ms8 ask "remember: 我喜欢用 Python"
82
+
83
+ # 检索记忆
84
+ ms8 ask "我喜欢什么语言?"
85
+
86
+ # 查看概览
87
+ ms8 dashboard
88
+ ```
89
+
90
+ ---
91
+
92
+ ## 连接 AI 工具
93
+
94
+ MS8 通过 MCP (Model Context Protocol) 连接你的 AI 工具,让它们共享同一份记忆。
95
+
96
+ ### 支持的工具
97
+
98
+ | 工具 | 状态 | 配置方式 |
99
+ |------|------|---------|
100
+ | Claude Desktop | ✅ 已验证 | `ms8 connect apply --target claude_desktop` |
101
+ | OpenAI Codex | ✅ 已验证 | `~/.codex/config.toml` MCP 配置 |
102
+ | Cursor | ✅ 支持 | `ms8 connect apply --target cursor` |
103
+ | Windsurf | ✅ 支持 | `ms8 connect apply --target windsurf` |
104
+ | Cline | ✅ 支持 | `ms8 connect apply --target cline` |
105
+ | Roo | ✅ 支持 | `ms8 connect apply --target roo` |
106
+ | Continue | ✅ 支持 | `ms8 connect apply --target continue` |
107
+ | Cherry Studio | ✅ 支持 | `ms8 connect apply --target cherry_studio` |
108
+ | Hermes | ✅ 支持 | `ms8 connect apply --target hermes` |
109
+ | OpenClaw | ✅ 支持 | `ms8 connect apply --target openclaw` |
110
+
111
+ ### MCP 接入流程
112
+
113
+ ```bash
114
+ # 查看支持的工具
115
+ ms8 connect list-targets
116
+
117
+ # 查看连接指南(手动 / 自动)
118
+ ms8 connect guide --mode both
119
+
120
+ # 查看 AGENTS 模板路径(可自定义)
121
+ ms8 connect template --target claude_desktop
122
+
123
+ # 生成配置
124
+ ms8 connect generate --target claude_desktop
125
+
126
+ # 应用配置
127
+ ms8 connect apply --target claude_desktop
128
+
129
+ # 验证连接
130
+ ms8 connect verify --target claude_desktop
131
+ ```
132
+
133
+ ### 两种连接方式
134
+
135
+ - 手动连接:`generate -> apply -> verify -> smoke`
136
+ - Agent 自动配置:`bootstrap --target all` 一次完成检测、写入、验证
137
+
138
+ 文档入口:
139
+
140
+ - [CONNECT_GUIDE.md](src/ms8/connect/CONNECT_GUIDE.md)
141
+ - [AGENTS.md](src/ms8/connect/AGENTS.md)
142
+
143
+ ### MCP Tools & Resources
144
+
145
+ **Tools (7 个):**
146
+
147
+ | Tool | 功能 |
148
+ |------|------|
149
+ | `prepare_reply` | 聚合查询:获取记忆上下文用于回复 |
150
+ | `submit` | 写入单条记忆 |
151
+ | `batch_submit` | 批量写入多条记忆 |
152
+ | `query` | 语义搜索记忆 |
153
+ | `context` | 获取对话相关记忆上下文 |
154
+ | `status` | 返回系统状态 |
155
+ | `profile` | 返回用户画像 |
156
+
157
+ **Resources (3 个):**
158
+
159
+ | Resource | 功能 |
160
+ |----------|------|
161
+ | `ms8://long-term` | 长期记忆 |
162
+ | `ms8://profile` | 用户画像 |
163
+ | `ms8://recent` | 近期记忆 |
164
+
165
+ ---
166
+
167
+ ## CLI 命令
168
+
169
+ ### 常用命令
170
+
171
+ ```bash
172
+ ms8 version # 版本
173
+ ms8 doctor # 健康检查
174
+ ms8 ask "..." # 快速写入/检索
175
+ ms8 dashboard # 运行概览
176
+ ms8 demo # 演示
177
+ ```
178
+
179
+ ### 维护命令
180
+
181
+ ```bash
182
+ ms8 watch # 定时巡检
183
+ ms8 backup # 备份记忆
184
+ ms8 cleanup # 清理旧备份
185
+ ms8 clean # 清理缓存(安全)
186
+ ms8 reset # 重置派生状态
187
+ ms8 uninstall # 卸载
188
+ ```
189
+
190
+ ### MCP 连接
191
+
192
+ ```bash
193
+ ms8 connect list-targets # 列出支持的工具
194
+ ms8 connect guide # 连接说明(manual/agent)
195
+ ms8 connect template # AGENTS 模板路径与快速步骤
196
+ ms8 connect bootstrap # 自动检测+配置+验证
197
+ ms8 connect apply # 应用配置
198
+ ms8 connect verify # 验证连接
199
+ ms8 connect smoke # 冒烟验证(save/search/context/status)
200
+ ms8 connect rollback # 回滚配置
201
+ ```
202
+
203
+ ### 安全与维护
204
+
205
+ ```bash
206
+ ms8 security enable # 启用加密
207
+ ms8 shadow status # 影子系统状态
208
+ ms8 ops self-check-report # 自检查报告
209
+ ms8 ops self-repair-run # 自修复
210
+ ms8 graph stats # 知识图谱统计
211
+ ms8 review list # 审批队列
212
+ ```
213
+
214
+ ### LLM 配置
215
+
216
+ ```bash
217
+ ms8 llm status # LLM 状态
218
+ ms8 llm setup # 交互式配置
219
+ ```
220
+
221
+ ### Labs(实验能力,默认关闭)
222
+
223
+ MS8 主线默认只开放稳定能力。实验命令会被 gate,需显式开启:
224
+
225
+ ```bash
226
+ ms8 labs status # 查看实验开关状态
227
+ ms8 labs enable # 开启实验命令
228
+ ms8 labs disable # 关闭实验命令
229
+ ```
230
+
231
+ 常见实验命令(示例):
232
+
233
+ ```bash
234
+ ms8 synthetic list
235
+ ms8 ops meta-run
236
+ ms8 ops advanced-insight-status
237
+ ```
238
+
239
+ 如果你看到 “labs command disabled by default”,先执行 `ms8 labs enable`。
240
+
241
+ 完整命令列表:`ms8 --help`(26 个一级命令 + 56 个 ops 子命令)
242
+
243
+ ---
244
+
245
+ ## 架构
246
+
247
+ ```
248
+ src/ms8/ 215 文件, 50,566 行
249
+
250
+ ├── cli.py CLI 入口(26 个命令)
251
+ ├── runtime.py 运行时调度
252
+ ├── paths.py 统一路径解析
253
+
254
+ ├── app/ 治理管道层
255
+ │ ├── pipeline/ 准入引擎(5 路由 + 风险评分)
256
+ │ ├── rules/ 规则系统(10 个模块)
257
+ │ └── review/ 审批服务
258
+
259
+ ├── connect/ MCP 连通层
260
+ │ ├── mcp_server/ MCP Server(stdio)
261
+ │ │ ├── stdio_server.py 协议处理
262
+ │ │ ├── mcp_server.py Tools/Resources 路由
263
+ │ │ └── memory_service_interface.py 统一服务接口
264
+ │ └── scripts/ 连接/验证/配置
265
+
266
+ └── engine_core/ 核心引擎层
267
+ ├── core.py 记忆系统核心(153 方法)
268
+ ├── knowledge_graph.py 知识图谱
269
+ ├── auto_memory.py 自动记忆提取
270
+ ├── security/ 安全层(加密 + 影子系统)
271
+ └── maintenance/ 自维护(61 检查 + 24 修复)
272
+ ```
273
+
274
+ ---
275
+
276
+ ## 数据存储
277
+
278
+ 所有数据存储在本地 `~/.ms8_runtime/` 目录:
279
+
280
+ ```
281
+ ~/.ms8_runtime/
282
+ ├── memory/
283
+ │ ├── auto_memory_records.jsonl # 主记忆记录
284
+ │ ├── auto_memory_index.json # 索引
285
+ │ ├── knowledge_graph.db # 知识图谱
286
+ │ ├── memory.db # SQLite 存储
287
+ │ ├── MEMORY.md # 长期记忆文本
288
+ │ └── backups/ # 自动备份
289
+ ├── health/ # 健康报告
290
+ └── connect/ # MCP 连接状态
291
+ ```
292
+
293
+ 环境变量覆盖路径:
294
+
295
+ ```bash
296
+ export MS8_HOME=~/custom_path
297
+ export MS8_DATA_DIR=~/custom_data
298
+ export MS8_CONFIG_DIR=~/custom_config
299
+ export MS8_LOG_DIR=~/custom_logs
300
+ ```
301
+
302
+ ---
303
+
304
+ ## 安全
305
+
306
+ | 特性 | 说明 |
307
+ |------|------|
308
+ | AES-256-GCM | 内存记录加密 |
309
+ | Argon2id | 密钥派生 |
310
+ | 影子系统 | 18 模块,链式哈希事件账本 |
311
+ | PII 检测 | 13 种模式(邮箱/手机/身份证/银行卡等) |
312
+ | 9 种拦截规则 | 阻止敏感内容写入 |
313
+ | 隔离区 | 损坏数据自动隔离 |
314
+
315
+ ---
316
+
317
+ ## 自维护
318
+
319
+ MS8 能自己诊断和修复问题:
320
+
321
+ - **61 项自检查**:分 L1(快速)→ L4(趋势)四级
322
+ - **24 条自修复策略**:分 L1(安全自动)/ L2(半自动)/ L3(需人工确认)
323
+ - **25 条维护策略**:调度检查频率和修复时机
324
+ - **自动备份**:每 24 小时
325
+
326
+ ```bash
327
+ # 查看健康状态
328
+ ms8 doctor
329
+
330
+ # 运行自检查
331
+ ms8 ops self-check-report
332
+
333
+ # 运行自修复
334
+ ms8 ops self-repair-run --dry-run
335
+ ```
336
+
337
+ 说明:
338
+ - `l4_capture_trend` 出现 `warn` 时,如果提示“无质量样本(仅噪声/策略丢弃样本)”,属于可解释告警,不代表系统故障。
339
+
340
+ ---
341
+
342
+ ## 开发
343
+
344
+ ### 运行测试
345
+
346
+ ```bash
347
+ pytest -q # 全量测试(123 个)
348
+ pytest src/ms8/engine_core/tests/ -q # 引擎测试
349
+ ```
350
+
351
+ ### 代码检查
352
+
353
+ ```bash
354
+ ruff check src/ms8/
355
+ ```
356
+
357
+ ### 构建
358
+
359
+ ```bash
360
+ python -m build --no-isolation
361
+ ```
362
+
363
+ ### 发布检查
364
+
365
+ ```bash
366
+ scripts/check_release_artifacts.sh
367
+ scripts/release_isolated_test.sh
368
+ scripts/publish_testpypi.sh
369
+ scripts/publish_pypi.sh
370
+ ```
371
+
372
+ ### 安全发布(Token 不落盘)
373
+
374
+ ```bash
375
+ export TWINE_USERNAME="__token__"
376
+ export TWINE_PASSWORD="pypi-***"
377
+
378
+ # 先做发布前检查
379
+ bash scripts/release_checklist.sh
380
+
381
+ # 预发布到 TestPyPI
382
+ bash scripts/publish_testpypi.sh
383
+
384
+ # 正式发布到 PyPI
385
+ bash scripts/publish_pypi.sh
386
+
387
+ # 或使用 Make 一步化
388
+ make publish-test
389
+ make clear-release-env
390
+ ```
391
+
392
+ 可先用 `--dry-run` 验证上传目标,不会实际发布。
393
+ 详细说明见:[RELEASE_SECURITY.md](docs/RELEASE_SECURITY.md)
394
+
395
+ ---
396
+
397
+ ## 与竞品对比
398
+
399
+ | 特性 | MS8 | Mem0 | Zep | Letta |
400
+ |------|-----|------|-----|-------|
401
+ | 数据完全本地 | ✅ | ❌ 推云 | ❌ 推云 | ❌ 推云 |
402
+ | 无需订阅 | ✅ | ❌ | ❌ | ❌ |
403
+ | MCP 原生支持 | ✅ 10 工具 | ❌ | ❌ | ❌ |
404
+ | 自检查/自修复 | ✅ 61+24 | ❌ | ❌ | ❌ |
405
+ | 加密存储 | ✅ AES-256 | ❌ | ❌ | ❌ |
406
+ | 影子安全系统 | ✅ 18 模块 | ❌ | ❌ | ❌ |
407
+ | 知识图谱 | ✅ | ❌ | ✅ Graphiti | ❌ |
408
+ | 治理管道 | ✅ 5 路准入 | ❌ | ❌ | ❌ |
409
+
410
+ ---
411
+
412
+ ## 系统要求
413
+
414
+ - Python ≥ 3.10
415
+ - macOS / Linux(Windows 适配计划中)
416
+ - 磁盘空间:约 50MB(引擎)+ 记忆数据
417
+
418
+ ---
419
+
420
+ ## 许可证
421
+
422
+ MIT License
423
+
424
+ ---
425
+
426
+ <p align="center">
427
+ <em>"记忆是习惯的载体。它改变人,也改变模型。记忆是个人资产。"</em>
428
+ </p>