krouter-memory 2.2.1__tar.gz → 2.3.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 (187) hide show
  1. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/PKG-INFO +2 -2
  2. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/README.md +1 -1
  3. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/krouter_memory.egg-info/PKG-INFO +2 -2
  4. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/krouter_memory.egg-info/SOURCES.txt +1 -0
  5. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/pyproject.toml +1 -1
  6. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/sdk/krouter/__init__.py +1 -1
  7. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/ask_reader.py +49 -3
  8. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/compile_subconscious.py +2 -2
  9. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/llm.py +8 -6
  10. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/mcp_server.py +1 -1
  11. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/recollect.py +31 -2
  12. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/route_knowledge.py +16 -0
  13. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/session_hook.py +6 -0
  14. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_ask_reader.py +32 -0
  15. krouter_memory-2.3.0/tests/test_hook_host.py +45 -0
  16. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_host_lane.py +11 -2
  17. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_index_pages.py +4 -4
  18. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_live_hooks.py +13 -2
  19. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_prompt_recall.py +1 -1
  20. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/LICENSE +0 -0
  21. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/krouter_memory.egg-info/dependency_links.txt +0 -0
  22. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/krouter_memory.egg-info/entry_points.txt +0 -0
  23. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/krouter_memory.egg-info/requires.txt +0 -0
  24. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/krouter_memory.egg-info/top_level.txt +0 -0
  25. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/sdk/krouter/cli.py +0 -0
  26. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/sdk/krouter/demo.py +0 -0
  27. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/sdk/krouter/doctor.py +0 -0
  28. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/sdk/krouter/integrations/__init__.py +0 -0
  29. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/sdk/krouter/integrations/langgraph.py +0 -0
  30. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/sdk/krouter/integrations/langgraph_demo.py +0 -0
  31. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/sdk/krouter/integrations/llamaindex.py +0 -0
  32. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/sdk/krouter/sample.py +0 -0
  33. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/sdk/krouter/view.py +0 -0
  34. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/sdk/krouter/view_ui/app.css +0 -0
  35. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/sdk/krouter/view_ui/app.js +0 -0
  36. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/sdk/krouter/view_ui/index.html +0 -0
  37. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/sdk/krouter/viewdata.py +0 -0
  38. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/sdk/krouter/why.py +0 -0
  39. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/setup.cfg +0 -0
  40. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/answer_cards.py +0 -0
  41. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/ask_product.py +0 -0
  42. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/associate.py +0 -0
  43. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/backup.py +0 -0
  44. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/canonical_lookup.py +0 -0
  45. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/canonical_sources.psv +0 -0
  46. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/capture_ledger.py +0 -0
  47. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/checkup.py +0 -0
  48. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/cocite.py +0 -0
  49. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/consolidate_topics.py +0 -0
  50. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/corrections.py +0 -0
  51. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/evidence.py +0 -0
  52. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/experience.py +0 -0
  53. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/hot.py +0 -0
  54. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/import_claude_mem.py +0 -0
  55. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/import_sessions.py +0 -0
  56. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/kb.py +0 -0
  57. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/krouter_home.py +0 -0
  58. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/krouter_redact.py +0 -0
  59. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/learn_mentions.py +0 -0
  60. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/lexicon_zh2.txt +0 -0
  61. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/nightly.py +0 -0
  62. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/notify.py +0 -0
  63. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/propose_aliases.py +0 -0
  64. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/pyfind.sh +0 -0
  65. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/recall_index.py +0 -0
  66. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/reconsolidate.py +0 -0
  67. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/route_knowledge.sh +0 -0
  68. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/route_worker.py +0 -0
  69. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/skills.py +0 -0
  70. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/team.py +0 -0
  71. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/zones.py +0 -0
  72. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/skill/krouter/scripts/zones_en.psv +0 -0
  73. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template/01 /351/241/271/347/233/256//347/244/272/344/276/213/351/241/271/347/233/256//347/244/272/344/276/213/351/241/271/347/233/256.md" +0 -0
  74. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template/01 /351/241/271/347/233/256//351/241/271/347/233/256.md" +0 -0
  75. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template/02 /347/273/217/351/252/214/344/270/216/346/226/271/346/263/225/Agent//347/224/250/346/210/267/345/201/217/345/245/275/344/270/216/345/267/245/344/275/234/347/272/246/346/235/237.md" +0 -0
  76. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template/02 /347/273/217/351/252/214/344/270/216/346/226/271/346/263/225/Automation/Seal the day from the log file.md" +0 -0
  77. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template/02 /347/273/217/351/252/214/344/270/216/346/226/271/346/263/225//345/207/206/347/273/217/351/252/214/A timer that fired is not a product.md" +0 -0
  78. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template/02 /347/273/217/351/252/214/344/270/216/346/226/271/346/263/225//345/207/206/347/273/217/351/252/214//345/207/206/347/273/217/351/252/214/345/205/245/345/217/243.md" +0 -0
  79. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template/02 /347/273/217/351/252/214/344/270/216/346/226/271/346/263/225//347/273/217/351/252/214/344/270/216/346/226/271/346/263/225.md" +0 -0
  80. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template/03 /350/265/204/346/226/231/344/270/216/350/257/201/346/215/256//350/265/204/346/226/231/344/270/216/350/257/201/346/215/256.md" +0 -0
  81. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template/04 /345/267/262/345/256/214/346/210/220/344/270/216/345/244/215/347/233/230//345/267/262/345/256/214/346/210/220/344/270/216/345/244/215/347/233/230.md" +0 -0
  82. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template/05 /346/227/266/351/227/264/346/227/245/345/277/227/2026-01/01/357/275/234/347/244/272/344/276/213/346/227/245.md" +0 -0
  83. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template/05 /346/227/266/351/227/264/346/227/245/345/277/227//346/227/266/351/227/264/346/227/245/345/277/227/345/205/245/345/217/243.md" +0 -0
  84. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template/90 /347/263/273/347/273/237/346/226/207/344/273/266/Agent/350/256/260/345/277/206//345/217/257/351/235/240/350/256/260/345/277/206/347/264/242/345/274/225.md" +0 -0
  85. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template/90 /347/263/273/347/273/237/346/226/207/344/273/266/Agent/350/256/260/345/277/206//347/272/240/351/224/231/344/270/216/345/217/226/344/273/243/350/256/260/345/275/225.md" +0 -0
  86. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template/90 /347/263/273/347/273/237/346/226/207/344/273/266/Clippings /346/225/264/347/220/206/350/256/260/345/275/225.json" +0 -0
  87. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template/90 /347/263/273/347/273/237/346/226/207/344/273/266//347/212/266/346/200/201.md" +0 -0
  88. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template/90 /347/263/273/347/273/237/346/226/207/344/273/266//350/207/252/345/212/250/345/214/226//346/227/245/346/233/264/345/201/245/345/272/267.md" +0 -0
  89. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template/90 /347/263/273/347/273/237/346/226/207/344/273/266//350/207/252/345/212/250/345/214/226//350/207/252/350/277/233/345/214/226/351/222/245/345/214/231.md" +0 -0
  90. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template/Agent/347/254/254/344/272/214/345/244/247/350/204/221.md" +0 -0
  91. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template-zh/01 /351/241/271/347/233/256//347/244/272/344/276/213/351/241/271/347/233/256//347/244/272/344/276/213/351/241/271/347/233/256.md" +0 -0
  92. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template-zh/01 /351/241/271/347/233/256//351/241/271/347/233/256.md" +0 -0
  93. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template-zh/02 /347/273/217/351/252/214/344/270/216/346/226/271/346/263/225/Agent//347/224/250/346/210/267/345/201/217/345/245/275/344/270/216/345/267/245/344/275/234/347/272/246/346/235/237.md" +0 -0
  94. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template-zh/02 /347/273/217/351/252/214/344/270/216/346/226/271/346/263/225//345/207/206/347/273/217/351/252/214//345/207/206/347/273/217/351/252/214/345/205/245/345/217/243.md" +0 -0
  95. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template-zh/02 /347/273/217/351/252/214/344/270/216/346/226/271/346/263/225//345/207/206/347/273/217/351/252/214//345/256/232/346/227/266/345/231/250/345/223/215/344/272/206/344/270/215/347/255/211/344/272/216/346/264/273/345/271/262/345/256/214/344/272/206.md" +0 -0
  96. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template-zh/02 /347/273/217/351/252/214/344/270/216/346/226/271/346/263/225//347/273/217/351/252/214/344/270/216/346/226/271/346/263/225.md" +0 -0
  97. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template-zh/02 /347/273/217/351/252/214/344/270/216/346/226/271/346/263/225//350/207/252/345/212/250/345/214/226//346/214/211/346/227/245/345/277/227/346/226/207/344/273/266/345/210/244/346/226/255/345/260/201/350/264/246.md" +0 -0
  98. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template-zh/03 /350/265/204/346/226/231/344/270/216/350/257/201/346/215/256//350/265/204/346/226/231/344/270/216/350/257/201/346/215/256.md" +0 -0
  99. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template-zh/04 /345/267/262/345/256/214/346/210/220/344/270/216/345/244/215/347/233/230//345/267/262/345/256/214/346/210/220/344/270/216/345/244/215/347/233/230.md" +0 -0
  100. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template-zh/05 /346/227/266/351/227/264/346/227/245/345/277/227/2026-01/01/357/275/234/347/244/272/344/276/213/346/227/245.md" +0 -0
  101. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template-zh/05 /346/227/266/351/227/264/346/227/245/345/277/227//346/227/266/351/227/264/346/227/245/345/277/227/345/205/245/345/217/243.md" +0 -0
  102. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template-zh/90 /347/263/273/347/273/237/346/226/207/344/273/266/Agent/350/256/260/345/277/206//345/217/257/351/235/240/350/256/260/345/277/206/347/264/242/345/274/225.md" +0 -0
  103. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template-zh/90 /347/263/273/347/273/237/346/226/207/344/273/266/Agent/350/256/260/345/277/206//347/272/240/351/224/231/344/270/216/345/217/226/344/273/243/350/256/260/345/275/225.md" +0 -0
  104. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template-zh/90 /347/263/273/347/273/237/346/226/207/344/273/266/Clippings /346/225/264/347/220/206/350/256/260/345/275/225.json" +0 -0
  105. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template-zh/90 /347/263/273/347/273/237/346/226/207/344/273/266/canonical_sources.psv" +0 -0
  106. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template-zh/90 /347/263/273/347/273/237/346/226/207/344/273/266//347/212/266/346/200/201.md" +0 -0
  107. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template-zh/90 /347/263/273/347/273/237/346/226/207/344/273/266//350/207/252/345/212/250/345/214/226//346/227/245/346/233/264/345/201/245/345/272/267.md" +0 -0
  108. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template-zh/90 /347/263/273/347/273/237/346/226/207/344/273/266//350/207/252/345/212/250/345/214/226//350/207/252/350/277/233/345/214/226/351/222/245/345/214/231.md" +0 -0
  109. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/template-zh/Agent/347/254/254/344/272/214/345/244/247/350/204/221.md" +0 -0
  110. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_answer_state.py +0 -0
  111. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_api_lane.py +0 -0
  112. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_api_writer.py +0 -0
  113. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_ask_product.py +0 -0
  114. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_asked_before.py +0 -0
  115. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_associate.py +0 -0
  116. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_backup.py +0 -0
  117. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_bootstrap.py +0 -0
  118. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_canonical_lookup.py +0 -0
  119. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_capture_exclusion.py +0 -0
  120. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_capture_ledger.py +0 -0
  121. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_claude_desktop.py +0 -0
  122. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_clone_25.py +0 -0
  123. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_correct_now.py +0 -0
  124. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_correction_capture.py +0 -0
  125. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_decision_capture_bench.py +0 -0
  126. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_deploy.py +0 -0
  127. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_docs_status.py +0 -0
  128. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_doctor_lang.py +0 -0
  129. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_english_paths_subconscious.py +0 -0
  130. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_evidence.py +0 -0
  131. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_experience.py +0 -0
  132. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_frameworks.py +0 -0
  133. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_hot.py +0 -0
  134. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_import_claude_mem.py +0 -0
  135. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_import_sessions.py +0 -0
  136. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_index_linked_table.py +0 -0
  137. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_install_commands.py +0 -0
  138. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_install_english.py +0 -0
  139. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_install_nightly.py +0 -0
  140. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_intraday_capture.py +0 -0
  141. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_knowledge_base.py +0 -0
  142. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_langgraph_store.py +0 -0
  143. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_lme_qa.py +0 -0
  144. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_lock_vs_neighbor.py +0 -0
  145. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_machine_input.py +0 -0
  146. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_mcp_apps.py +0 -0
  147. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_mcp_banks.py +0 -0
  148. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_mcp_http.py +0 -0
  149. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_mcp_official_sdk.py +0 -0
  150. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_mcp_server.py +0 -0
  151. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_memory_honesty.py +0 -0
  152. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_memory_honesty_competitors.py +0 -0
  153. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_memory_honesty_heldout.py +0 -0
  154. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_memory_honesty_v2.py +0 -0
  155. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_memory_honesty_v3.py +0 -0
  156. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_optional_extras.py +0 -0
  157. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_python_launcher.py +0 -0
  158. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_python_router.py +0 -0
  159. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_readme_example.py +0 -0
  160. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_recall_bench.py +0 -0
  161. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_recall_index.py +0 -0
  162. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_recall_judge.py +0 -0
  163. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_reconsolidate_grounded.py +0 -0
  164. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_rename_compat.py +0 -0
  165. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_resident_lookups.py +0 -0
  166. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_resolve.py +0 -0
  167. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_router_script.py +0 -0
  168. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_sdk.py +0 -0
  169. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_sdk_llamaindex.py +0 -0
  170. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_sealed_days.py +0 -0
  171. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_secrets.py +0 -0
  172. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_server_json.py +0 -0
  173. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_session_hook.py +0 -0
  174. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_session_start.py +0 -0
  175. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_skills.py +0 -0
  176. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_stale_injection.py +0 -0
  177. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_team_concurrency.py +0 -0
  178. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_team_identity.py +0 -0
  179. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_template_clean.py +0 -0
  180. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_thin_reply.py +0 -0
  181. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_unconfined_optin.py +0 -0
  182. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_unseen_words_note.py +0 -0
  183. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_view.py +0 -0
  184. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_view_recalled.py +0 -0
  185. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_why.py +0 -0
  186. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_wire_keys_writer.py +0 -0
  187. {krouter_memory-2.2.1 → krouter_memory-2.3.0}/tests/test_zones.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: krouter-memory
3
- Version: 2.2.1
3
+ Version: 2.3.0
4
4
  Summary: Your AI remembers what you decided, and what you changed your mind about: plain-Markdown memory for any MCP app.
5
5
  Author: KRouter contributors
6
6
  License: MIT
@@ -371,7 +371,7 @@ Methods and what still fails: [`docs/VERIFY.md`](docs/VERIFY.md). For agents ask
371
371
 
372
372
  **Maintenance.** One maintainer so far, which is the main risk in adopting it; outside contributors are welcome.
373
373
  What you keep if the project stops, and how it continues without its author: [`MAINTAINERS.md`](MAINTAINERS.md).
374
- A release goes out every Friday when `main` has changed, a patch in between only for a fix that cannot wait; `KROUTER_TAG=v2.2.1` (any tag) pins one. What counts
374
+ A release goes out every Friday when `main` has changed, a patch in between only for a fix that cannot wait; `KROUTER_TAG=v2.3.0` (any tag) pins one. What counts
375
375
  as the stable surface: [`DETAILS.md` → Stability and versions](docs/DETAILS.md#stability-and-versions). Bugs and
376
376
  questions: [issues](https://github.com/398894496-arch/KRouter/issues); security reports: [`SECURITY.md`](SECURITY.md).
377
377
 
@@ -349,7 +349,7 @@ Methods and what still fails: [`docs/VERIFY.md`](docs/VERIFY.md). For agents ask
349
349
 
350
350
  **Maintenance.** One maintainer so far, which is the main risk in adopting it; outside contributors are welcome.
351
351
  What you keep if the project stops, and how it continues without its author: [`MAINTAINERS.md`](MAINTAINERS.md).
352
- A release goes out every Friday when `main` has changed, a patch in between only for a fix that cannot wait; `KROUTER_TAG=v2.2.1` (any tag) pins one. What counts
352
+ A release goes out every Friday when `main` has changed, a patch in between only for a fix that cannot wait; `KROUTER_TAG=v2.3.0` (any tag) pins one. What counts
353
353
  as the stable surface: [`DETAILS.md` → Stability and versions](docs/DETAILS.md#stability-and-versions). Bugs and
354
354
  questions: [issues](https://github.com/398894496-arch/KRouter/issues); security reports: [`SECURITY.md`](SECURITY.md).
355
355
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: krouter-memory
3
- Version: 2.2.1
3
+ Version: 2.3.0
4
4
  Summary: Your AI remembers what you decided, and what you changed your mind about: plain-Markdown memory for any MCP app.
5
5
  Author: KRouter contributors
6
6
  License: MIT
@@ -371,7 +371,7 @@ Methods and what still fails: [`docs/VERIFY.md`](docs/VERIFY.md). For agents ask
371
371
 
372
372
  **Maintenance.** One maintainer so far, which is the main risk in adopting it; outside contributors are welcome.
373
373
  What you keep if the project stops, and how it continues without its author: [`MAINTAINERS.md`](MAINTAINERS.md).
374
- A release goes out every Friday when `main` has changed, a patch in between only for a fix that cannot wait; `KROUTER_TAG=v2.2.1` (any tag) pins one. What counts
374
+ A release goes out every Friday when `main` has changed, a patch in between only for a fix that cannot wait; `KROUTER_TAG=v2.3.0` (any tag) pins one. What counts
375
375
  as the stable surface: [`DETAILS.md` → Stability and versions](docs/DETAILS.md#stability-and-versions). Bugs and
376
376
  questions: [issues](https://github.com/398894496-arch/KRouter/issues); security reports: [`SECURITY.md`](SECURITY.md).
377
377
 
@@ -123,6 +123,7 @@ tests/test_english_paths_subconscious.py
123
123
  tests/test_evidence.py
124
124
  tests/test_experience.py
125
125
  tests/test_frameworks.py
126
+ tests/test_hook_host.py
126
127
  tests/test_host_lane.py
127
128
  tests/test_hot.py
128
129
  tests/test_import_claude_mem.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "krouter-memory"
7
- version = "2.2.1"
7
+ version = "2.3.0"
8
8
  description = "Your AI remembers what you decided, and what you changed your mind about: plain-Markdown memory for any MCP app."
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -19,7 +19,7 @@ import sys
19
19
  from dataclasses import dataclass, field
20
20
  from pathlib import Path
21
21
 
22
- __version__ = "2.2.1"
22
+ __version__ = "2.3.0"
23
23
  ROUTES = ("search", "preference", "correction", "memory", "project", "suggest")
24
24
 
25
25
 
@@ -39,6 +39,7 @@ HEAD = 300
39
39
  SPOTS = 3
40
40
  SPOT = 300
41
41
  PASSAGE = FULL
42
+ SECRET = "(a page marked secret: its text is not shown)"
42
43
  ASK = ("Below is a question someone asked their own memory vault, and the vault pages closest to it (number, title, "
43
44
  "the passage of the page closest to the question). Decide which pages hold information needed to answer it: the "
44
45
  "answer itself, a fact the answer can be worked out from, one of several items the question counts, compares or "
@@ -79,8 +80,13 @@ def passage(vault: Path, rel: str, question: str) -> tuple[str, str]:
79
80
 
80
81
  import recall_index as ri
81
82
 
83
+ raw = (vault / rel).read_text(encoding="utf-8", errors="replace")
84
+ import zones
85
+
86
+ if ri.is_secret_page(zones.canon(vault, rel), ri.split_frontmatter(raw)[0]):
87
+ return _body(vault, rel)[0], SECRET # 机密页只给路径和标题,正文不给宿主、也不发给模型
82
88
  title, lines = _body(vault, rel)
83
- whole = " ".join(lines)
89
+ whole = ri.redact(" ".join(lines))
84
90
  if len(whole) <= FULL:
85
91
  return title, whole
86
92
  q = set(ri.tokens(question))
@@ -96,7 +102,7 @@ def passage(vault: Path, rel: str, question: str) -> tuple[str, str]:
96
102
  hits = [low.find(w) for w in weight if low.find(w) >= 0]
97
103
  at = max(0, min(hits) - SPOT // 4) if hits else 0
98
104
  text = text[at:at + SPOT]
99
- parts.append(text)
105
+ parts.append(ri.redact(text))
100
106
  return title, " … ".join(parts)[:FULL]
101
107
 
102
108
 
@@ -146,7 +152,7 @@ def decide(vault: Path, query: str, scope: str = "") -> dict | None:
146
152
 
147
153
  res = ri.recall(vault, query, scope, gate=False)
148
154
  cands = [h["rel"] for h in res.get("hits") or []][:K]
149
- if not cands or recollect._judge_calls_today() >= c["cap"]:
155
+ if not cands or (c["cap"] > 0 and recollect._judge_calls_today() >= c["cap"]):
150
156
  return None
151
157
  text = prompt(recollect.redact(query), vault, cands)
152
158
  box: dict = {}
@@ -187,3 +193,43 @@ def outcome(vault: Path, hits: list[dict], picked: list[int]) -> list[dict] | No
187
193
  return None if long else [] # 长页只给了片段:模型说都不是不算数(set 54:长对话页上模型拒得太多)
188
194
  named = [hits[i - 1] for i in picked]
189
195
  return named + [h for h in long if h not in named]
196
+
197
+
198
+ # ---------- 宿主来判断(默认开,`KROUTER_ASK_HOST=0` 关)----------
199
+ # 不调任何模型:前 K 页(门槛不管)各附上和问题最相关的那段,交给正在回答用户的宿主模型来定哪一页回答了问题、
200
+ # 或者记忆里没有。宿主就是用户订阅的那个模型,不用 key、不外发、不多等。配了 `KROUTER_ASK_JUDGE` 且它判过时不出这一段。
201
+ HOST_HEAD = {
202
+ "en": ("host_judge: decide yourself from these passages. They are the {n} pages closest to the question by wording "
203
+ "(the gate above only weighs wording), each with the part of it closest to the question. Cite a page only if "
204
+ "its passage answers the question or a part of it; a page about a neighbouring matter, or one that only shares "
205
+ "words with the question, does not. If none of them does, tell the user the memory does not have it. Do not "
206
+ "guess, and do not fill the gap from your own knowledge."),
207
+ "zh": ("host_judge: 请你自己根据下面的段落判断。这是按字面最接近问题的 {n} 页(上面的把握只看字面),每页附上和问题"
208
+ "最相关的那部分。只有段落确实回答了问题(或回答了其中一部分)才引用那一页;说的是相邻的另一件事、只是碰巧有相同"
209
+ "的词,都不算。都不是就告诉用户记忆里没有,不要猜,也不要用你自己的知识补。"),
210
+ }
211
+
212
+
213
+ def host_on() -> bool:
214
+ return os.environ.get("KROUTER_ASK_HOST", "1").strip() != "0"
215
+
216
+
217
+ def host_block(vault: Path, query: str, scope: str = "") -> list[str]:
218
+ """The lines that hand the decision to the host: a head and, for each of the first K pages in force (the gate
219
+ off), its path, tier and title, then its passage (what set 54's reader is shown). [] when off or nothing ranks."""
220
+ if not host_on():
221
+ return []
222
+ import recall_index as ri
223
+
224
+ try:
225
+ hits = (ri.recall(vault, query, scope, gate=False).get("hits") or [])[:K]
226
+ except Exception: # noqa: BLE001 召回不可用就不出这一段
227
+ return []
228
+ if not hits:
229
+ return []
230
+ out = [HOST_HEAD[ri._note_lang(vault, query)].format(n=len(hits))]
231
+ for i, h in enumerate(hits, 1):
232
+ title, text = passage(vault, h["rel"], query)
233
+ out.append(f"{i}. {h['rel']} tier={h['tier']} title={title}")
234
+ out.append(f" passage: {text}")
235
+ return out
@@ -317,7 +317,7 @@ SYSTEM_DIR = "90 系统文件/"
317
317
 
318
318
 
319
319
  def index_pages(vault: Path, skip: set[str], today: date | None = None) -> list[dict]:
320
- """`KROUTER_INDEX_PAGES=1` (set 49): the pages in force that the alias table does not name, to be listed by title in
320
+ """`KROUTER_INDEX_PAGES` (set 49; on by default from set 51's h2, `0` turns it off): the pages in force that the alias table does not name, to be listed by title in
321
321
  the standing index: [{rel, name, when}]. In force as the prompt hook reads it (`recollect.current` gives the page
322
322
  itself: not replaced, not expired, not secret, not knowledge base), not a log type. Rule pages, then topic pages,
323
323
  the newest first; when the vault holds fewer than INDEX_PAGES_MIN of those, pages of the `other` tier outside
@@ -424,7 +424,7 @@ def standing_index(vault: Path, today: date | None = None, lines: int = INDEX_LI
424
424
 
425
425
  topics = index_topics(vault, today)
426
426
  # 第 49 套:别名表没点名的现行页,按标题排在「只列名字」那一段的后面,占同一份预算
427
- extra = index_pages(vault, {t["rel"] for t in topics}, today) if os.environ.get("KROUTER_INDEX_PAGES") == "1" else []
427
+ extra = index_pages(vault, {t["rel"] for t in topics}, today) if os.environ.get("KROUTER_INDEX_PAGES", "1").strip() != "0" else []
428
428
  if not topics and not extra:
429
429
  return ""
430
430
  lang = "en" if zones.lang(vault) == "en" else "zh"
@@ -356,15 +356,15 @@ class NoModel(RuntimeError):
356
356
  # declares it.
357
357
  # 3. No session around (the nightly run, a session-end hook): the host's own CLI in non-interactive mode, on the
358
358
  # login the user already has (`claude -p`, `codex exec`, `cursor-agent -p`, …), found by `detect_writer()`.
359
- # This spends the user's subscription, so: at most HOST_CLI_MAX_DEFAULT calls a day (`KROUTER_HOST_CLI_MAX`;
360
- # session import takes at most three fifths of them, the rest is kept for the nightly steps),
359
+ # This spends the user's subscription. No daily cap unless the user sets one (`KROUTER_HOST_CLI_MAX`, 0 or unset
360
+ # = no cap, the maintainer's call on 2026-11-27; with a cap, session import takes at most three fifths of it),
361
361
  # every call recorded where the user can see it (HOST_LOG_PAGE in the vault, host-calls.jsonl in the state
362
362
  # directory; metadata only, never the prompt), and `KROUTER_HOST_CLI=0` turns it off. KRouter only runs the CLI
363
363
  # the official way; it never reads, copies or forwards any app's login token, keychain item or credential file.
364
364
  # 4. A key the user set (`*_API_KEY`): used as before, and before an auto-detected CLI, because the user chose it.
365
365
 
366
366
  HOST_CLI_FLAG = "KROUTER_HOST_CLI"
367
- HOST_CLI_MAX_DEFAULT = 30
367
+ HOST_CLI_MAX_DEFAULT = 0 # 0 = 不限次数(2026-11-27 维护者定);想限就设 KROUTER_HOST_CLI_MAX
368
368
  HOST_LOG_PAGE = "90 系统文件/自动化/订阅调用记录.md"
369
369
  # 没有任何模型通道时,这些功能不开;其余(召回、纠错捕获、经验摘要、宿主自己写卡和笔记)照常
370
370
  NEEDS_MODEL = ("会话提炼(定了什么、改了什么)", "经验卡的模型抽取", "主题档案整合", "问答卡", "触发词提议",
@@ -443,6 +443,8 @@ def host_cli_room(step: str | None = None) -> bool:
443
443
  """Whether `step` (this process's script by default) may make one more call through the agent's CLI today:
444
444
  never past the day's cap, and session import not into what is still kept for the other steps."""
445
445
  cap = host_cli_max()
446
+ if cap <= 0:
447
+ return True # 不限次数
446
448
  day, other = host_calls_split()
447
449
  if day + other >= cap:
448
450
  return False
@@ -477,8 +479,8 @@ def _host_record(vault: Path | None, cli: str, prompt: str, text: str, ok: bool)
477
479
  if not page.exists():
478
480
  page.write_text("---\ntitle: 订阅调用记录\ntype: automation-log\nstatus: generated\nsource: krouter-llm\n---\n\n"
479
481
  "# 订阅调用记录\n\nKRouter 借你已登录的 agent 命令行(`claude -p`、`codex exec` 等)做夜间提炼时,每一次"
480
- "调用记一行。这会用掉你的订阅额度;每天最多 `KROUTER_HOST_CLI_MAX` 次(默认 "
481
- f"{HOST_CLI_MAX_DEFAULT}),`KROUTER_HOST_CLI=0` 关掉。只记元数据,不记内容。\n\n"
482
+ "调用记一行。这会用掉你的订阅额度;默认不限次数,想限就设 `KROUTER_HOST_CLI_MAX`(每天最多几次),"
483
+ "`KROUTER_HOST_CLI=0` 关掉。只记元数据,不记内容。\n\n"
482
484
  "| 时间 | 命令行 | 步骤 | 发出字数 | 收到字数 | 结果 |\n|---|---|---|---|---|---|\n",
483
485
  encoding="utf-8")
484
486
  with page.open("a", encoding="utf-8") as fh:
@@ -493,7 +495,7 @@ def channel_report(vault: Path | None = None) -> dict:
493
495
  first = steps[0] if steps else ("none", "")
494
496
  out = {"lane": first[0] if first[0] != "cli" else f"cli {writer_probe_argv(first[1])[0]}",
495
497
  "host_cli": "on" if host_cli_on() else f"off ({HOST_CLI_FLAG}=0)",
496
- "host_cli_calls_today": host_calls_today(), "host_cli_max": host_cli_max(),
498
+ "host_cli_calls_today": host_calls_today(), "host_cli_max": host_cli_max() or "no cap",
497
499
  "host_cli_kept": host_cli_kept()}
498
500
  if not steps:
499
501
  out["off_without_model"] = list(NEEDS_MODEL)
@@ -50,7 +50,7 @@ sys.path.insert(0, str(HERE))
50
50
  from krouter_home import vault_path # noqa: E402
51
51
  import team # noqa: E402
52
52
 
53
- VERSION = "2.2.1"
53
+ VERSION = "2.3.0"
54
54
  PROTOCOLS = ("2025-11-25", "2025-06-18", "2025-03-26", "2024-11-05")
55
55
  ROUTES = ("search", "preference", "correction", "memory", "project", "suggest")
56
56
  INSTRUCTIONS = (
@@ -630,7 +630,7 @@ def _recall_hits(vault: Path, res: dict | None, today: date, have: set[str]) ->
630
630
  JUDGE_K = 5
631
631
  JUDGE_MIN_WEIGHT = 12 # 一个汉字算 2、一个拉丁字母或数字算 1:比这轻的话(「好的」「go on」)没有可查的东西,不问
632
632
  JUDGE_TIMEOUT = 5.0
633
- JUDGE_MAX_DAILY = 500
633
+ JUDGE_MAX_DAILY = 0 # 0 = 不限次数(2026-11-27 维护者定);想限就设 KROUTER_JUDGE_MAX
634
634
  JUDGE_URL = "https://api.deepseek.com/chat/completions"
635
635
  JUDGE_MODEL = "deepseek-flash"
636
636
  JUDGE_LOG = "judge.jsonl"
@@ -647,6 +647,35 @@ JUDGE_ASK = {
647
647
  }
648
648
 
649
649
 
650
+ # `KROUTER_HOOK_HOST`(默认开,`0` 关):钩子没递页、也没有模型可问时,把字面最接近的几页的名字随这句话交给宿主,
651
+ # 宿主(用户正在用的那个模型)自己决定取不取。第 51 套 h2(同时开着索引列全部页名)两个库全部过线。
652
+ HOST_K = 3
653
+ HOST_HEAD = {
654
+ "zh": "KRouter 候选(按字面最接近这句话的几页,只有名字,没核对过,多半与这句话无关。只有这句话确实在说其中某一件事时"
655
+ "才去取那一页;否则当这段不存在,回复里也不要提):",
656
+ "en": "KRouter candidates (the pages closest to this message by wording; names only, not checked, most likely "
657
+ "unrelated. Fetch a page only if the message really is about that matter; otherwise act as if this note were "
658
+ "not here and do not mention it):",
659
+ }
660
+
661
+
662
+ def host_on() -> bool:
663
+ return os.environ.get("KROUTER_HOOK_HOST", "1").strip() != "0"
664
+
665
+
666
+ def host_note(vault: Path, text: str, today: date | None = None) -> str:
667
+ """The note that hands the closest pages' names to the host, or "" (off, a light message, nothing close)."""
668
+ if not host_on():
669
+ return ""
670
+ said = prose(text)
671
+ cands = candidates(vault, said, set(), HOST_K, today)
672
+ if not cands:
673
+ return ""
674
+ lang = "zh" if CJK.search(said) else "en"
675
+ rows = [f"- {c['title']} 〔{c['real']}〕" if lang == "zh" else f"- {c['title']} [{c['real']}]" for c in cands]
676
+ return "\n".join([HOST_HEAD[lang]] + rows)
677
+
678
+
650
679
  def _setting(name: str) -> str:
651
680
  """An environment variable, else the same name in the keys file (`llm.keys_file()`)."""
652
681
  val = os.environ.get(name, "").strip()
@@ -770,7 +799,7 @@ def judged(vault: Path, text: str, today: date | None = None) -> list[dict]:
770
799
  today = today or date.today()
771
800
  said = prose(text)
772
801
  cands = candidates(vault, said, set(), JUDGE_K, today)
773
- if not cands or _judge_calls_today() >= conf["cap"]:
802
+ if not cands or (conf["cap"] > 0 and _judge_calls_today() >= conf["cap"]):
774
803
  return []
775
804
  lang = "zh" if CJK.search(said) else "en"
776
805
  prompt = judge_prompt(redact(said), cands, lang)
@@ -499,6 +499,7 @@ def bounded_search(scope: Path, vault: Path, map_path: Path, route: str, query:
499
499
  print("scope_widened: vault (the route scope had no page covering this question)")
500
500
  print_recall(res, vault, 4 if (scope.is_file() and not widened) else 1, query)
501
501
  print("open_page: only the top recall hit, and only if its how does not close the question")
502
+ _host_block(vault, query, res)
502
503
  return
503
504
  if _ri is not None:
504
505
  # 记忆里没有(只有知识库对得上时这一行这样说);严格模式下「只有相关的页」也走这里
@@ -519,12 +520,27 @@ def bounded_search(scope: Path, vault: Path, map_path: Path, route: str, query:
519
520
  if folded:
520
521
  print(_ri.RELATED_PAGES[_ri._note_lang(vault, query)].format(pages="; ".join(_ri.page_list(res))))
521
522
  _ri.print_kb(vault, res, query, 2)
523
+ _host_block(vault, query, res)
522
524
  if folded:
523
525
  return # 相关页已经点名,不再把字面检索的原文行当结果打出来
524
526
  # 索引这次没用上(recall 抛了错)就别拿它挑候选页:它可能缺页或过期,整个范围照老办法扫
525
527
  md_search(query, scope, vault=vault if res is not None else None, skip=(res or {}).get("asked") or [])
526
528
 
527
529
 
530
+ def _host_block(vault: Path, query: str, res: dict | None) -> None:
531
+ """`KROUTER_ASK_HOST` (on by default): the first pages with their closest passages, for the host to decide from;
532
+ not printed when `KROUTER_ASK_JUDGE`'s reader already decided (`ask_reader.py`)."""
533
+ if res and res.get("judged"):
534
+ return
535
+ try:
536
+ import ask_reader
537
+
538
+ for line in ask_reader.host_block(vault, query):
539
+ print(line)
540
+ except Exception: # noqa: BLE001
541
+ pass
542
+
543
+
528
544
  NEAREST_MAX = 5
529
545
  NEAREST_HEAD = {
530
546
  "en": "nearest_pages: (the memory did not match this wording; these are only the nearest titles, not answers. Read "
@@ -588,6 +588,12 @@ def recall_note(payload: dict, agent: str, text: str) -> None:
588
588
  quiet = recollect.no_capture(agent, sid, True)
589
589
  recollect.remember_turn(agent, sid, text, hits, quiet) # 这一轮结束时 turn 看宿主自己取了什么
590
590
  if not hits:
591
+ # `KROUTER_HOOK_HOST`(默认开):没有模型可问时,把字面最接近的几页的名字交给宿主自己判断(第 51 套 h2)
592
+ if not found and not quiet and recollect.judge_conf() is None:
593
+ note = recollect.host_note(Path(raw).expanduser(), text)
594
+ if note:
595
+ print(json.dumps({"hookSpecificOutput": {"hookEventName": "UserPromptSubmit",
596
+ "additionalContext": note}}, ensure_ascii=False))
591
597
  return
592
598
  if quiet:
593
599
  hits = [{**h, "sentence": ""} for h in hits] # 标了不记:照样想起,但不把你的话写进记录
@@ -221,3 +221,35 @@ def test_the_receipt_says_who_decided(built, tmp_path, fake_server):
221
221
  assert sum(1 for ln in picked.splitlines() if ln.startswith("- ") and " tier=" in ln) == 1 # 只引那一页
222
222
  assert none.splitlines()[0].startswith("memory: none") and "found none" in none and "recall: none" in none
223
223
  assert len(_Fake.bodies) == 2 and _Fake.bodies[0]["model"] == "deepseek-flash" and _Fake.bodies[0]["temperature"] == 0
224
+
225
+
226
+ def _plain(built, tmp_path, **more) -> str:
227
+ env = {**built["env"], "KROUTER_STATE_DIR": str(tmp_path / "s2"), **more}
228
+ return subprocess.run([sys.executable, str(SCRIPTS / "route_knowledge.py"), "search", QUESTION], env=env,
229
+ capture_output=True, text=True, timeout=120).stdout
230
+
231
+
232
+ def test_the_host_decides_by_default_from_five_passages(built, tmp_path):
233
+ import ask_reader
234
+
235
+ out = _plain(built, tmp_path)
236
+ lines = out.splitlines()
237
+ i = next(n for n, ln in enumerate(lines) if ln.startswith("host_judge:"))
238
+ assert lines[i] == ask_reader.HOST_HEAD["en"].format(n=5)
239
+ assert sum(1 for ln in lines[i:] if ln.startswith(" passage: ")) == 5
240
+ assert "host_judge:" not in _plain(built, tmp_path, KROUTER_ASK_HOST="0")
241
+
242
+
243
+ def test_a_secret_page_shows_no_text(tmp_path):
244
+ import ask_reader
245
+
246
+ v = tmp_path / "v"
247
+ v.mkdir()
248
+ (v / "keys.md").write_text("---\nsecret: true\ntitle: Keys\n---\n\nThe vault password is hunter2.\n", encoding="utf-8")
249
+ title, text = ask_reader.passage(v, "keys.md", "what is the vault password")
250
+ assert title == "Keys" and text == ask_reader.SECRET and "hunter2" not in text
251
+
252
+
253
+ def test_no_host_block_after_the_reader_decided(built, tmp_path, fake_server):
254
+ out = _route(built, tmp_path, fake_server, "1")
255
+ assert "recall_judge:" in out and "host_judge:" not in out
@@ -0,0 +1,45 @@
1
+ """`KROUTER_HOOK_HOST` (on by default; set 51's h2 with set 49's titles): when the per-message hook brings no page and
2
+ there is no reader to ask, it hands the names of the closest pages to the host in a marked note, and the host decides.
3
+ Off with `0`; never for a `#不记` session; never when a reader (`KROUTER_RECALL_JUDGE`) is configured."""
4
+
5
+ from __future__ import annotations
6
+
7
+ import importlib.util
8
+ import json
9
+ import sys
10
+ from pathlib import Path
11
+
12
+ from test_prompt_recall import _say, box # noqa: F401 同一个库和钩子调用
13
+
14
+ REPO = Path(__file__).resolve().parents[1]
15
+ sys.path.insert(0, str(REPO / "skill/krouter/scripts"))
16
+ SAID = "下午我先去周会,回来以后你帮我把登录页的表单校验补上,再把按钮颜色统一一下" # 钩子自己不递页(test_prompt_recall)
17
+
18
+
19
+ def _on(box): # noqa: F811
20
+ return {**box["env"], "KROUTER_HOOK_HOST": "1"}
21
+
22
+
23
+ def test_the_note_carries_set_51s_words_and_page_names(box): # noqa: F811
24
+ import recollect
25
+
26
+ out = _say(box, SAID, env=_on(box))
27
+ ctx = json.loads(out)["hookSpecificOutput"]["additionalContext"]
28
+ head, *rows = ctx.splitlines()
29
+ assert head == recollect.HOST_HEAD["zh"] and 1 <= len(rows) <= recollect.HOST_K
30
+ assert all(r.startswith("- ") and "〔" in r and r.endswith("〕") for r in rows)
31
+ spec = importlib.util.spec_from_file_location("bench_candidates", REPO / "bench/subconscious/candidates.py")
32
+ bench = importlib.util.module_from_spec(spec)
33
+ spec.loader.exec_module(bench)
34
+ assert recollect.HOST_HEAD == bench.HEAD and recollect.HOST_K == bench.K_HOST
35
+
36
+
37
+ def test_off_with_0_and_never_in_a_quiet_session(box): # noqa: F811
38
+ assert _say(box, SAID, env={**box["env"], "KROUTER_HOOK_HOST": "0"}) == ""
39
+ assert _say(box, SAID + " #不记", env=_on(box)) == ""
40
+
41
+
42
+ def test_a_configured_reader_decides_instead(box): # noqa: F811
43
+ env = {**_on(box), "KROUTER_RECALL_JUDGE": "1", "KROUTER_JUDGE_KEY": "test-key",
44
+ "KROUTER_JUDGE_URL": "http://127.0.0.1:9/none", "KROUTER_JUDGE_TIMEOUT": "0.5"}
45
+ assert _say(box, SAID, env=env) == "" # 问不到模型:什么都不说,也不改递名字
@@ -1,12 +1,11 @@
1
1
  """The host lane (llm.py): with no key, KRouter borrows the agent the user already has through its official CLI,
2
- at most so many calls a day, each one recorded where the user can see it, and off with one switch. A shell-script
2
+ with no daily cap unless the user sets one, each one recorded where the user can see it, and off with one switch. A shell-script
3
3
  stand-in plays the CLI: no test spends a subscription."""
4
4
 
5
5
  from __future__ import annotations
6
6
 
7
7
  import json
8
8
  import os
9
- from pathlib import Path
10
9
 
11
10
  import pytest
12
11
 
@@ -140,3 +139,13 @@ def test_nightly_report_says_what_is_off_without_a_lane(lane, monkeypatch):
140
139
  monkeypatch.setenv("KROUTER_HOST_CLI", "0")
141
140
  text = "\n".join(nightly.channel_lines(vault))
142
141
  assert "off" in text and "这些功能没开" in text and "会话提炼" in text
142
+
143
+
144
+ def test_no_daily_cap_unless_the_user_sets_one(lane, monkeypatch):
145
+ """The maintainer's call (2026-11-27): no cap by default; KROUTER_HOST_CLI_MAX sets one."""
146
+ llm, vault, _ = lane
147
+ assert llm.host_cli_max() == 0 and llm.host_cli_kept() == 0
148
+ as_step(monkeypatch, "import_sessions")
149
+ for i in range(40): # 以前的默认上限是 30
150
+ llm.complete(f"session {i}", vault)
151
+ assert llm.host_calls_today() == 40 and llm.host_cli_room() and llm.channel_report(vault)["host_cli_max"] == "no cap"
@@ -1,5 +1,5 @@
1
- """`KROUTER_INDEX_PAGES=1` (set 49): the standing index also lists, by title, the pages in force that the alias table does
2
- not name. Off by default; with it off, or with a table that names every such page, the index is the shipped one."""
1
+ """`KROUTER_INDEX_PAGES` (set 49; on by default since set 51's h2, `0` turns it off): the standing index also lists, by
2
+ title, the pages in force that the alias table does not name. With it off, or with a table that names every such page, the index is the shipped one."""
3
3
 
4
4
  import shutil
5
5
  import sys
@@ -26,7 +26,7 @@ def env(tmp_path, monkeypatch):
26
26
  monkeypatch.setenv("KROUTER_STATE_DIR", str(tmp_path / "state"))
27
27
  monkeypatch.setenv("KROUTER_NO_QUERY_LOG", "1")
28
28
  monkeypatch.delenv("KROUTER_MAP", raising=False)
29
- monkeypatch.delenv("KROUTER_INDEX_PAGES", raising=False)
29
+ monkeypatch.setenv("KROUTER_INDEX_PAGES", "0") # 默认开;各测试自己打开
30
30
  monkeypatch.delenv("KROUTER_TOPICS", raising=False)
31
31
  recollect._PAGES.clear()
32
32
  return tmp_path
@@ -66,7 +66,7 @@ def re_split(text: str) -> list[str]:
66
66
  return [x.strip() for x in re.split(r"[、;]", text) if x.strip()]
67
67
 
68
68
 
69
- def test_off_by_default_and_listed_when_on(env, monkeypatch):
69
+ def test_off_with_0_and_listed_when_on(env, monkeypatch):
70
70
  import compile_subconscious as cs
71
71
 
72
72
  v = bench_vault(env, keep_every=8)
@@ -95,6 +95,18 @@ def _cursor_transcript(box, asks: list[tuple[str, str]], sid: str = "c0ffee00-11
95
95
  return _jsonl(box["tmp"] / "cursor" / slug / "agent-transcripts" / sid / f"{sid}.jsonl", rows)
96
96
 
97
97
 
98
+ def _wait_log_row(path: Path) -> dict:
99
+ for _ in range(200):
100
+ try:
101
+ rows = [ln for ln in path.read_text(encoding="utf-8").splitlines() if ln.startswith("{")]
102
+ except OSError:
103
+ rows = []
104
+ if rows:
105
+ return json.loads(rows[-1])
106
+ time.sleep(0.1)
107
+ raise AssertionError(f"no JSON row in {path.name} after 20 s")
108
+
109
+
98
110
  def _wait_page(folder: Path, needle: str) -> str:
99
111
  for _ in range(200): # 导入在后台跑;只认写完的 .md
100
112
  for page in folder.glob("*.md"):
@@ -141,8 +153,7 @@ def test_codex_turn_end_records_the_turn_without_a_model_call(box):
141
153
  assert res.returncode == 0 and res.stdout == "" # Codex:Stop 退出 0、不输出 = 照常结束
142
154
  page = _wait_page(box["folder"], "改成 10 分钟")
143
155
  assert "agent: codex" in page and f"project_root: {_root(box['work'])}" in page
144
- log = (box["state"] / "session-hook.log").read_text(encoding="utf-8")
145
- row = json.loads([ln for ln in log.splitlines() if ln.startswith("{")][-1])
156
+ row = _wait_log_row(box["state"] / "session-hook.log") # 页面写完时后台进程可能还没写日志:等那一行
146
157
  assert row["distilled"] == 0 and row["distill_failed"] == 0 and row["chars"] == 0
147
158
 
148
159
 
@@ -57,7 +57,7 @@ def box(tmp_path):
57
57
  "E25|status page|Handbook/Status page.md|Update within 15 minutes\n", encoding="utf-8")
58
58
  env = {k: val for k, val in os.environ.items() if not k.endswith("_API_KEY")}
59
59
  env.update(KROUTER_VAULT=str(v), KROUTER_STATE_DIR=str(tmp_path / "state"), KROUTER_CACHE_DIR=str(tmp_path / "cache"),
60
- KROUTER_NO_QUERY_LOG="1", KROUTER_RECALL_PROMPT="1")
60
+ KROUTER_NO_QUERY_LOG="1", KROUTER_RECALL_PROMPT="1", KROUTER_HOOK_HOST="0") # 这里测钩子自己递不递页;候选便条另测(test_hook_host.py)
61
61
  for k in ("KROUTER_IN_DISTILL", "KROUTER_INJECT", "KROUTER_MAP", "OBSIDIAN_VAULT"):
62
62
  env.pop(k, None)
63
63
  subprocess.run([sys.executable, str(SCRIPTS / "recall_index.py"), "--vault", str(v), "--stats"], env=env,
File without changes
File without changes