micro-cc 0.2.141__tar.gz → 0.2.142__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 (237) hide show
  1. {micro_cc-0.2.141/src/micro_cc.egg-info → micro_cc-0.2.142}/PKG-INFO +1 -1
  2. {micro_cc-0.2.141 → micro_cc-0.2.142}/pyproject.toml +1 -1
  3. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/claude_loop_.py +16 -114
  4. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/postgres_store/pg_store_.py +1 -3
  5. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/customizing-micro-cc/SKILL.md +1 -0
  6. micro_cc-0.2.142/src/micro_cc/skills/tool-hooks/SKILL.md +31 -0
  7. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/bash_tool.py +1 -1
  8. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/memory_store_.py +0 -29
  9. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/msg_store_.py +6 -11
  10. micro_cc-0.2.142/src/micro_cc/utils/system_prompt_text_.py +115 -0
  11. micro_cc-0.2.142/src/micro_cc/utils/tool_hooks_.py +101 -0
  12. {micro_cc-0.2.141 → micro_cc-0.2.142/src/micro_cc.egg-info}/PKG-INFO +1 -1
  13. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc.egg-info/SOURCES.txt +4 -0
  14. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_interrupted_run.py +4 -17
  15. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_model_catalog.py +2 -2
  16. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_pagination.py +0 -1
  17. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_replica.py +2 -10
  18. micro_cc-0.2.142/tests/test_tool_hooks.py +219 -0
  19. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_use_tool_dispatcher.py +2 -1
  20. {micro_cc-0.2.141 → micro_cc-0.2.142}/LICENSE +0 -0
  21. {micro_cc-0.2.141 → micro_cc-0.2.142}/README.md +0 -0
  22. {micro_cc-0.2.141 → micro_cc-0.2.142}/setup.cfg +0 -0
  23. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/__init__.py +0 -0
  24. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/browser/__init__.py +0 -0
  25. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/browser/_cookies.py +0 -0
  26. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/browser/_md_convert.py +0 -0
  27. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/browser/browser_manager.py +0 -0
  28. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/browser/simpletextbrowser.py +0 -0
  29. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/cache/__init__.py +0 -0
  30. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/cache/state_store.py +0 -0
  31. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/execute_tool.py +0 -0
  32. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/models/__init__.py +0 -0
  33. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/models/adapters/__init__.py +0 -0
  34. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/models/adapters/anthropic.py +0 -0
  35. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/models/adapters/chat.py +0 -0
  36. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/models/adapters/responses.py +0 -0
  37. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/models/apis/__init__.py +0 -0
  38. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/models/apis/anthropic_messages.py +0 -0
  39. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/models/apis/openai_chat.py +0 -0
  40. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/models/apis/openai_responses.py +0 -0
  41. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/models/catalog.json +0 -0
  42. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/models/catalog.py +0 -0
  43. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/models/catalog_sync.py +0 -0
  44. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/models/client.py +0 -0
  45. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/models/providers.py +0 -0
  46. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/models/retry.py +0 -0
  47. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/models/schema.py +0 -0
  48. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/models/types.py +0 -0
  49. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/mods_.py +0 -0
  50. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/postgres_store/__init__.py +0 -0
  51. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/postgres_store/schema_.py +0 -0
  52. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/self_heal_.py +0 -0
  53. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/corpus-library/SKILL.md +0 -0
  54. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/corpus-library/scripts/wiki.py +0 -0
  55. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/design/SKILL.md +0 -0
  56. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/docx/SKILL.md +0 -0
  57. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/docx/docx-js.md +0 -0
  58. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/docx/ooxml.md +0 -0
  59. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/github/SKILL.md +0 -0
  60. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/graph-orchestration/SKILL.md +0 -0
  61. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/hairline/LICENSE-lib +0 -0
  62. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/hairline/SKILL.md +0 -0
  63. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/hairline/bench.html +0 -0
  64. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/hairline/build.mjs +0 -0
  65. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/hairline/concepts.md +0 -0
  66. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/hairline/examples/contour.js +0 -0
  67. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/hairline/examples/riffle.js +0 -0
  68. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/hairline/examples/terrain.js +0 -0
  69. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/hairline/free.js +0 -0
  70. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/hairline/kernel.js +0 -0
  71. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/hairline/look.md +0 -0
  72. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/hairline/look.mjs +0 -0
  73. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/hairline/rules.md +0 -0
  74. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/hairline/stamp.mjs +0 -0
  75. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/hairline/validate.mjs +0 -0
  76. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/keep-checking/SKILL.md +0 -0
  77. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/painted-video/RENDERER.md +0 -0
  78. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/painted-video/SKILL.md +0 -0
  79. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/painted-video/TIMING.md +0 -0
  80. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/painted-video/lib/lib.js +0 -0
  81. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/painted-video/lib/paint.js +0 -0
  82. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/painted-video/scripts/analysis/align.py +0 -0
  83. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/painted-video/scripts/analysis/build_data.py +0 -0
  84. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/painted-video/scripts/analysis/features.py +0 -0
  85. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/painted-video/scripts/analysis/transcribe.py +0 -0
  86. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/painted-video/scripts/check.mjs +0 -0
  87. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/painted-video/scripts/install_stack.sh +0 -0
  88. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/painted-video/scripts/render.mjs +0 -0
  89. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/painted-video/scripts/scaffold.py +0 -0
  90. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/pptx/SKILL.md +0 -0
  91. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/pptx/brief.md +0 -0
  92. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/pptx/scripts/build_deck.py +0 -0
  93. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/pptx/scripts/deck_to_images.py +0 -0
  94. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/pptx/scripts/inspect_template.py +0 -0
  95. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/pptx/scripts/office/__init__.py +0 -0
  96. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/pptx/scripts/office/soffice.py +0 -0
  97. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/pptx/scripts/render_svg.py +0 -0
  98. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/pptx/scripts/template_ops.py +0 -0
  99. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/pptx/svg-slides.md +0 -0
  100. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/pptx/template.md +0 -0
  101. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/skill_loader.py +0 -0
  102. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/skills/xlsx/SKILL.md +0 -0
  103. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/start_headless_.py +0 -0
  104. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/start_live_tui_.py +0 -0
  105. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/__init__.py +0 -0
  106. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/ask_user_tool.py +0 -0
  107. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/browser_tool_.py +0 -0
  108. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/chart_tool_.py +0 -0
  109. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/computer_tool_.py +0 -0
  110. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/file_tools_.py +0 -0
  111. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/mcp_client_.py +0 -0
  112. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/mcp_login_.py +0 -0
  113. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/mcp_oauth.py +0 -0
  114. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/memory_review_.py +0 -0
  115. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/memory_tool_.py +0 -0
  116. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/message_session_.py +0 -0
  117. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/monitor_.py +0 -0
  118. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/monitor_poll_.py +0 -0
  119. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/monitor_schedule_.py +0 -0
  120. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/monitor_schedule_runtime.py +0 -0
  121. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/monitor_store_.py +0 -0
  122. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/monitor_watch_.py +0 -0
  123. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/reload_tool_.py +0 -0
  124. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/search_history_tool_.py +0 -0
  125. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/search_tool_.py +0 -0
  126. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/skill_tools_.py +0 -0
  127. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/todo_tools_.py +0 -0
  128. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/use_tool_.py +0 -0
  129. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/vision_tools_.py +0 -0
  130. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tools/web_tools_.py +0 -0
  131. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/__init__.py +0 -0
  132. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/alt_screen_.py +0 -0
  133. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/approval_ui_.py +0 -0
  134. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/banner_fx_.py +0 -0
  135. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/detect_images_.py +0 -0
  136. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/diff_viewer_.py +0 -0
  137. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/etype_handler_.py +0 -0
  138. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/glyphs_.py +0 -0
  139. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/keys_.py +0 -0
  140. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/kill_ring_.py +0 -0
  141. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/login_ui_.py +0 -0
  142. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/md_render_.py +0 -0
  143. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/message_row_.py +0 -0
  144. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/option_panel_.py +0 -0
  145. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/pane_.py +0 -0
  146. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/panel_layout_.py +0 -0
  147. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/pollers_.py +0 -0
  148. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/prompt_input_.py +0 -0
  149. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/question_ui_.py +0 -0
  150. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/renderers_.py +0 -0
  151. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/screen_cmds_.py +0 -0
  152. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/scroll_view_.py +0 -0
  153. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/self_reload_ui_.py +0 -0
  154. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/self_terminal_setup_.py +0 -0
  155. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/self_update_.py +0 -0
  156. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/stack_.py +0 -0
  157. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/status_bar_.py +0 -0
  158. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/stdin_buffer_.py +0 -0
  159. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/terminal_.py +0 -0
  160. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/text_.py +0 -0
  161. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/text_utils_.py +0 -0
  162. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/theme_.py +0 -0
  163. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/truncated_text_.py +0 -0
  164. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/ui_api_.py +0 -0
  165. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/undo_stack_.py +0 -0
  166. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/tui_native/word_navigation_.py +0 -0
  167. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/__init__.py +0 -0
  168. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/annotate_.py +0 -0
  169. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/banner_.py +0 -0
  170. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/chart_.py +0 -0
  171. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/claude_md_loader.py +0 -0
  172. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/claude_subscription.py +0 -0
  173. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/command_registry.py +0 -0
  174. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/default_status_sh.py +0 -0
  175. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/gate_check_.py +0 -0
  176. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/helpers.py +0 -0
  177. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/hidden_prompts.py +0 -0
  178. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/hints.py +0 -0
  179. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/history_mount_.py +0 -0
  180. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/inbox_store_.py +0 -0
  181. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/keep_awake_.py +0 -0
  182. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/legacy_status_sh.py +0 -0
  183. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/loop_events_.py +0 -0
  184. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/msg_normalize_.py +0 -0
  185. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/project_files_.py +0 -0
  186. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/self_reload_.py +0 -0
  187. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/session_ipc_.py +0 -0
  188. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/settings_store_.py +0 -0
  189. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/status_marker.py +0 -0
  190. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/statusline_.py +0 -0
  191. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/subagent_notice_.py +0 -0
  192. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/subagent_tracker_.py +0 -0
  193. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/system_prompt_.py +0 -0
  194. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/terminal_setup.py +0 -0
  195. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/theme_store_.py +0 -0
  196. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/tokenization_simple.py +0 -0
  197. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/tool_limits.py +0 -0
  198. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/tool_result_storage.py +0 -0
  199. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/tool_safety_.py +0 -0
  200. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/utils/whats_new.py +0 -0
  201. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/webui/__init__.py +0 -0
  202. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/webui/bridge.py +0 -0
  203. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/webui/dist/assets/index-50EhKMKx.js +0 -0
  204. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/webui/dist/assets/index-D24bns9q.css +0 -0
  205. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/webui/dist/index.html +0 -0
  206. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/webui/history.py +0 -0
  207. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/webui/launch.py +0 -0
  208. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/webui/live.py +0 -0
  209. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/webui/server.py +0 -0
  210. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc/webui/session.py +0 -0
  211. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc.egg-info/dependency_links.txt +0 -0
  212. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc.egg-info/entry_points.txt +0 -0
  213. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc.egg-info/requires.txt +0 -0
  214. {micro_cc-0.2.141 → micro_cc-0.2.142}/src/micro_cc.egg-info/top_level.txt +0 -0
  215. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_chart.py +0 -0
  216. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_durability.py +0 -0
  217. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_gate_check.py +0 -0
  218. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_keep_awake.py +0 -0
  219. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_listening_pause.py +0 -0
  220. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_mcp.py +0 -0
  221. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_mod_pane.py +0 -0
  222. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_mods.py +0 -0
  223. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_monitor_poll.py +0 -0
  224. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_pg_theme_row.py +0 -0
  225. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_provider_switch.py +0 -0
  226. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_reply_thinking.py +0 -0
  227. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_schedule.py +0 -0
  228. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_self_reload.py +0 -0
  229. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_subagent_lifecycle.py +0 -0
  230. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_subagent_notice.py +0 -0
  231. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_thinking_origin.py +0 -0
  232. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_truncated_calls.py +0 -0
  233. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_tui_render_golden.py +0 -0
  234. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_turn_door.py +0 -0
  235. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_turn_recovery.py +0 -0
  236. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_webui.py +0 -0
  237. {micro_cc-0.2.141 → micro_cc-0.2.142}/tests/test_write_ahead.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: micro-cc
3
- Version: 0.2.141
3
+ Version: 0.2.142
4
4
  Summary: Harness that gives frontier models full system access — shell, filesystem, browser, MCP — running directly on the metal.
5
5
  Author: George Salapa
6
6
  License: MIT License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "micro-cc"
7
- version = "0.2.141"
7
+ version = "0.2.142"
8
8
  description = "Harness that gives frontier models full system access — shell, filesystem, browser, MCP — running directly on the metal."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
@@ -1,8 +1,8 @@
1
1
  import asyncio
2
- import datetime
3
2
  import os
4
3
  import time
5
4
  from functools import partial
5
+ from types import SimpleNamespace
6
6
 
7
7
  from dotenv import load_dotenv
8
8
 
@@ -11,21 +11,19 @@ from micro_cc.models import model_call
11
11
  from micro_cc.models.client import thinking_origin
12
12
  from micro_cc.utils import system_prompt_
13
13
  from micro_cc.models.catalog import DEFAULT_MODEL, DEFAULT_TRIM_BUDGET
14
- from micro_cc.utils import settings_store_
14
+ from micro_cc.utils import settings_store_, system_prompt_text_, tool_hooks_
15
15
  from micro_cc.utils.tool_limits import cap_for, DEFAULT_TOOL_RESULT_CAP, MAX_TOOL_RESULTS_PER_MESSAGE
16
16
  from micro_cc.utils.tool_result_storage import persist_and_preview
17
17
  from micro_cc.models.schema import function_to_schema
18
- from micro_cc.skills.skill_loader import get_skill_summary
19
18
  from micro_cc.tools.bash_tool import bash_
20
19
  from micro_cc.tools.monitor_ import monitor_
21
20
  from micro_cc.tools.file_tools_ import read_, write_, edit_, glob_, grep_
22
21
  from micro_cc.tools.search_tool_ import search_tools, list_mcps
23
- from micro_cc.tools.use_tool_ import use_tool_, check_wrapper_shape, inner_block
22
+ from micro_cc.tools.use_tool_ import use_tool_, check_wrapper_shape
24
23
  from micro_cc.utils.msg_normalize_ import DISPATCHER, interrupted_text, resolve_call, window_base
25
24
  from micro_cc.tools.todo_tools_ import todo_tool_
26
25
  from micro_cc.tools.memory_tool_ import memory_
27
26
  from micro_cc.tools.search_history_tool_ import search_history_
28
- from micro_cc.utils import memory_store_
29
27
  from micro_cc.tools.skill_tools_ import read_skill, list_skills
30
28
  from micro_cc.tools.ask_user_tool import ask_user_question_tool_, validate_ask_questions
31
29
  from micro_cc.tools.search_tool_ import (
@@ -41,7 +39,6 @@ from micro_cc.tools.mcp_client_ import resolve_mcp_tools, call_mcp_tool
41
39
  from micro_cc.tools.memory_review_ import review_memory
42
40
  from micro_cc.utils.msg_store_ import load_summary, load_checkpoint, compact_checkpoint, store_msgs, inflight_path
43
41
  from micro_cc.utils.tokenization_simple import token_cutter, token_stats, save_token_stats, detect_cache_miss, record_prompt_segments
44
- from micro_cc.utils.claude_md_loader import load_claude_md_file
45
42
  from micro_cc.models.providers import active_provider
46
43
  from micro_cc.utils.tool_safety_ import READ_ONLY_TOOLS, read_only_by_input
47
44
  from micro_cc.utils.gate_check_ import needs_approval
@@ -180,10 +177,7 @@ async def claude_loop(
180
177
 
181
178
  provider = active_provider() # pinned for the whole turn
182
179
 
183
- skills_summary = get_skill_summary(project_dir)
184
- claude_md_content = load_claude_md_file(project_dir)
185
180
  mcp_catalog = get_effective_mcp_catalog(project_dir)
186
- package_dir = os.path.dirname(os.path.abspath(__file__))
187
181
 
188
182
  # The running tool batch on disk: what started and what finished survives a kill -9 (load_msgs reads it back).
189
183
  sidecar = inflight_path(project_dir)
@@ -220,108 +214,8 @@ async def claude_loop(
220
214
 
221
215
  yield {"type": "status", "message": "", "msgs": msgs}
222
216
 
223
- orchestration_line = (
224
- "- Multi-subagent orchestration: read_skill('graph-orchestration') to "
225
- "orchestrate headless subagents any time you judge a task benefits "
226
- "from parallel or sequenced work."
227
- ) if surface == "tui" else ""
228
-
229
- def _build_memory_manifest() -> str | None:
230
- """Index memory keys across global and project scopes."""
231
- parts = []
232
- global_items = memory_store_.list_memories()
233
- if global_items:
234
- parts.append(
235
- "Global (all projects):\n"
236
- + "\n".join(f"- {it['key']} — {it['description']}" for it in global_items)
237
- )
238
- project_items = memory_store_.list_memories(project_dir=project_dir)
239
- if project_items:
240
- parts.append(
241
- "Project (this project_dir only):\n"
242
- + "\n".join(f"- {it['key']} — {it['description']}" for it in project_items)
243
- )
244
- return "\n\n".join(parts) if parts else None
245
-
246
- # Volatile parts of the system prompt; the head is rendered from the conversation's first set (system_prompt_).
247
- sections = {name: text for name, text in {
248
- "date": datetime.datetime.now().strftime("%B %d, %Y"),
249
- "orchestration": orchestration_line,
250
- "skills": skills_summary,
251
- "claude_md": claude_md_content,
252
- "memory": _build_memory_manifest(),
253
- }.items() if text}
254
-
255
- def _system_msgs(s: dict) -> list:
256
- claude_md_section = f"\n\n<project-instructions>\n{s['claude_md']}\n</project-instructions>" if s.get("claude_md") else ""
257
- system_prompt_msg = {
258
- "role": "system",
259
- "content": f"""You are micro cognitive compute - a CLI assistant. You have full system access and thus using code you can achieve any task.
260
-
261
- ## Environment
262
- - You are running LOCALLY on the user's machine (on the metal), NOT a remote server
263
- - You have direct access to the local filesystem, Desktop, Documents, etc.
264
- - Project directory: {project_dir}
265
- - Your own source code lives at: {package_dir} (not project_dir) — plain, editable .py. You can change the harness itself: edit it, then once the user allows it call reload_harness_ (load it with search_tools) to restart into your change, otherwise it never takes effect; the conversation persists across the restart. Before changing the harness, read the customizing-micro-cc skill: it says which changes belong in ~/.micro-cc (they survive updates) and which edit core (overwritten by the next /update).
266
- - Date: {s.get("date", "")}
267
-
268
- ## Core Tools (always available)
269
- - bash_: Execute shell commands (runs in project_dir, use path param or absolute paths for elsewhere)
270
- - read_: Read file contents with line numbers — also reads image files (png/jpg/gif/webp/bmp) directly, no separate tool needed
271
- - write_: Create/overwrite files
272
- - edit_: Surgical string replacement in files
273
- - glob_: Find files by pattern
274
- - grep_: Search file contents with regex
275
-
276
- ## Discoverable Tools
277
- search_tools is two-step and cheap: `search_tools(action="discover")` lists
278
- every tool and MCP you could load (name + one-line description, no schemas),
279
- then `search_tools(action="add", names="browser, deepwiki")` returns the
280
- schemas of the ones you want — including several at once — as text in its
281
- result. Those tools are not in your tool list: call each one through the
282
- fixed dispatcher `use_tool_(name="browser", args=...)` with args matching the
283
- schema you were given. A call with args that don't match the schema fails
284
- and the error carries the schema, so retry from that.
285
- Do this when you need a capability you don't currently have: web research,
286
- browser, computer_use, message_session_ (list and message other live
287
- micro-cc sessions), etc.
288
- {s.get("orchestration", "")}
289
-
290
- ## Planning Tools
291
- - todo_tool_: For multi-step complex work, write a todo plan and keep on track.
292
-
293
- ## Long-term Memory
294
- memory_ (action=add|edit|get|delete|list, scope=global|project).
295
- scope="global": cross-project facts (~/.micro-cc/memory.json). scope="project":
296
- this project only (~/.micro-cc/projects/{{name}}_{{hash}}/memory.json).
297
- <memory-manifest> lists keys each loop; memory_(action="get", key=...) expands
298
- one. In-progress state: use todo_tool_ instead.
299
-
300
- ## Conversation History Search
301
- conversation grows forever
302
- search_history_(query=..., limit=...): full-text search over this project's
303
- whole conversation history, including compacted turns.
304
-
305
- {s.get("skills", "")}
306
- {claude_md_section}
307
-
308
- ## Guidelines
309
- - Read files before editing them
310
- - Use absolute paths when working outside project_dir
311
- - When writing to user, remove all mannered prose
312
- """,
313
- # cache breakpoint: tools + this prompt, byte-identical across iterations of this call
314
- "cache_control": {"type": "ephemeral"},
315
- }
316
- if not s.get("memory"):
317
- return [system_prompt_msg]
318
- # Own system block with its own cache breakpoint.
319
- memory_manifest_msg = {
320
- "role": "system",
321
- "content": f"## Long-term Memory\nKey+description index for both scopes — call memory_(action=\"get\", key=..., scope=...) to expand an entry.\n\n{s['memory']}",
322
- "cache_control": {"type": "ephemeral"},
323
- }
324
- return [system_prompt_msg, memory_manifest_msg]
217
+ # The system prompt's sections as of now; the head is rendered from the conversation's first set (system_prompt_).
218
+ sections = system_prompt_text_.sections(project_dir, surface)
325
219
 
326
220
  images = [encoded_image] if isinstance(encoded_image, str) else (encoded_image or [])
327
221
  if query is None:
@@ -389,7 +283,7 @@ whole conversation history, including compacted turns.
389
283
  "to restart into the change; the conversation is kept.\n</reload-pending>"
390
284
  )
391
285
 
392
- current_manifest = _build_memory_manifest() # Mid-turn edits surfaced as delta
286
+ current_manifest = system_prompt_text_.memory_manifest(project_dir) # Mid-turn edits surfaced as delta
393
287
  if current_manifest is not None and current_manifest != _last_shown_manifest:
394
288
  status_sections.append(
395
289
  "<memory-manifest-update>\nMemory changed since this turn started "
@@ -414,7 +308,7 @@ whole conversation history, including compacted turns.
414
308
  )
415
309
  else:
416
310
  trimmed_rest = token_cutter(msgs, max_tokens)
417
- system_msgs = _system_msgs(system_prompt_.head(msgs, trimmed_rest))
311
+ system_msgs = system_prompt_text_.render(system_prompt_.head(msgs, trimmed_rest), project_dir)
418
312
  trimmed_loop_msgs = system_msgs + trimmed_rest + status_msgs # Cache: system, memory, transcript, ephemeral
419
313
 
420
314
  record_prompt_segments(
@@ -623,6 +517,12 @@ whole conversation history, including compacted turns.
623
517
  pass # disk full: the sidecar is a crash record, the tool still runs and its result is stored
624
518
 
625
519
  async def _run_and_record(c):
520
+ # Tool hooks (~/.micro-cc/hooks): may change the args, or answer the call so it never runs.
521
+ c["args"], instead = await tool_hooks_.before(c["name"], c["args"], project_dir)
522
+ if instead is not None:
523
+ c["result"], c["done"] = instead, True
524
+ _note({"id": c["id"], "result": _result_text(instead, c["name"])})
525
+ return
626
526
  c["started"] = True
627
527
  _note({"id": c["id"], "started": True})
628
528
  try:
@@ -633,11 +533,13 @@ whole conversation history, including compacted turns.
633
533
  headers=route.get("headers"), entry=route.get("entry"), project_dir=project_dir,
634
534
  )
635
535
  else:
636
- c["result"] = await execute_tool_call(inner_block(c["tb"]), tools, project_dir, model)
536
+ call = SimpleNamespace(name=c["name"], input=c["args"], id=c["id"]) # use_tool_'s inner call
537
+ c["result"] = await execute_tool_call(call, tools, project_dir, model)
637
538
  except Exception as e:
638
539
  c["result"] = f"Tool error ({c['name']}): {type(e).__name__}: {e}"
639
540
  c["done"] = True
640
541
  _note({"id": c["id"], "result": _result_text(c["result"], c["name"])}) # text only, capped
542
+ await tool_hooks_.after(c["name"], c["args"], c["result"], project_dir)
641
543
 
642
544
  # Reads in a row run in parallel; a mutating tool runs alone.
643
545
  for batch in _partition_tool_batches([c for c in calls if not c["error"] and c["run"]]):
@@ -17,9 +17,7 @@ def _connect():
17
17
  "Postgres backend selected but psycopg isn't installed — "
18
18
  "run `pip install micro-cc[postgres]`"
19
19
  ) from e
20
- # Embedding apps set the mirror URL so memory and settings stay local; either URL turns the copy on.
21
- url = os.environ.get("MICRO_CC_MIRROR_POSTGRES_URL") or os.environ["MICRO_CC_POSTGRES_URL"]
22
- conn = psycopg.connect(url, autocommit=True)
20
+ conn = psycopg.connect(os.environ["MICRO_CC_POSTGRES_URL"], autocommit=True)
23
21
  schema_.ensure_all(conn)
24
22
  return conn
25
23
 
@@ -19,6 +19,7 @@ Rule: put the change in a mod or a config file below. Edit core only when nothin
19
19
  | Colors | `theme.json` (or `/theme`) |
20
20
  | Add or tweak a model | `models.json` |
21
21
  | Skill | `skills/<name>/SKILL.md` |
22
+ | A rule on tool calls: block, approve, rewrite args, audit | a hook in `hooks/<name>.py` (read the `tool-hooks` skill) |
22
23
 
23
24
  ## Mods
24
25
 
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: tool-hooks
3
+ description: Read before adding a rule that runs on tool calls — block a tool, require approval, change a call's arguments, or log/audit calls. Hooks apply in every micro-cc process (TUI, headless, subagents).
4
+ ---
5
+
6
+ # Tool hooks
7
+
8
+ A hook is one Python file in `~/.micro-cc/hooks/<name>.py`. Every tool call of every micro-cc process passes through the enabled hooks before it runs (`before`) and after it ran (`after`).
9
+
10
+ ```python
11
+ MATCH = "memory_" # regex over the whole tool name; omit for every tool
12
+
13
+ def before(name, args, project_dir):
14
+ # None -> run the call as asked
15
+ # {"args": {...}} -> run it with these args
16
+ # {"result": "text"} -> don't run it; the model gets this text and carries on
17
+ if args.get("scope", "global") == "global" and args.get("action") in ("add", "edit", "delete"):
18
+ return {"result": "Proposed for review; not stored until a person approves it."}
19
+ return None
20
+
21
+ def after(name, args, result, project_dir): # optional: the call ran, result is what the model got
22
+ pass
23
+ ```
24
+
25
+ - `name` is the real tool name (a `use_tool_` call arrives as the tool it dispatches to); `args` is a copy.
26
+ - Either function may be `async`. Files run in name order; each `before` sees the args the previous one returned; the first `{"result"}` wins.
27
+ - Fail closed: if a hook raises, takes over 30 s, returns anything else, or the file fails to load, the call is blocked and the model is told why. A broken file blocks **every** call until fixed, so build it disabled first:
28
+ 1. Write it as `~/.micro-cc/hooks/_<name>.py` (a leading `_` disables it).
29
+ 2. Check it: `python -c "import importlib.util as u; s=u.spec_from_file_location('h', '<path>'); m=u.module_from_spec(s); s.loader.exec_module(m); print(m.before('memory_', {'scope': 'global', 'action': 'add'}, '/tmp'))"`
30
+ 3. Rename it to `<name>.py`. It applies from the next tool call, no restart.
31
+ - Disable a hook by renaming it with a leading `_`; remove it by deleting the file. Ask the user before enabling a hook that blocks or rewrites calls.
@@ -17,7 +17,7 @@ from micro_cc.utils.msg_store_ import _get_storage_dir
17
17
  _SHELL = shutil.which("bash") or "/bin/bash"
18
18
 
19
19
  # Env vars stripped from bash_ subprocesses: built-in and provider keys, plus MICROCC_BASH_ENV_DENYLIST.
20
- _DENIED_ENV = {"ANTHROPIC_API_KEY", "ANTHROPIC_OAUTH_TOKEN", "OPENAI_API_KEY", "MICRO_CC_POSTGRES_URL", "MICRO_CC_MIRROR_POSTGRES_URL"}
20
+ _DENIED_ENV = {"ANTHROPIC_API_KEY", "ANTHROPIC_OAUTH_TOKEN", "OPENAI_API_KEY", "MICRO_CC_POSTGRES_URL"}
21
21
 
22
22
 
23
23
  def _bash_env() -> dict:
@@ -2,7 +2,6 @@ import datetime
2
2
  import json
3
3
  import os
4
4
  from pathlib import Path
5
- from typing import Callable, Optional
6
5
  from micro_cc.postgres_store import pg_store_
7
6
  from micro_cc.utils.helpers import project_hash as _project_hash
8
7
 
@@ -16,25 +15,6 @@ def _use_postgres() -> bool:
16
15
  return bool(os.getenv("MICRO_CC_POSTGRES_URL"))
17
16
 
18
17
 
19
- # Post-local-write callback: (project_dir, action, key, description, content).
20
- _sink: Optional[Callable[[Optional[str], str, str, str, str], None]] = None
21
-
22
-
23
- def set_sink(fn) -> None:
24
- """Register a post-local-write callback. None to unregister."""
25
- global _sink
26
- _sink = fn
27
-
28
-
29
- def _notify_sink(project_dir: Optional[str], action: str, key: str, description: str, content: str) -> None:
30
- if _sink is None:
31
- return
32
- try:
33
- _sink(project_dir, action, key, description, content)
34
- except Exception as e:
35
- print(f"[memory_store_] sink failed for {project_dir!r} key {key!r}: {e}", flush=True)
36
-
37
-
38
18
  def _project_memory_path(project_dir: str) -> Path:
39
19
  """Path to project's memory.json in its storage dir."""
40
20
  from micro_cc.utils.msg_store_ import _get_storage_dir
@@ -64,11 +44,6 @@ def _phash(project_dir: str | None) -> str:
64
44
  return _project_hash(project_dir) if project_dir else ""
65
45
 
66
46
 
67
- def hydrate_local(entries: dict, project_dir: str | None = None) -> None:
68
- """Seed local memory from an embedding app's durable copy. entries: {key: {description, content, updated_at}}. Full replace, no sink notify."""
69
- _save(_path_for(project_dir), entries)
70
-
71
-
72
47
  def list_memories(project_dir: str | None = None) -> list:
73
48
  """List [{key, description, updated_at}], newest first."""
74
49
  if _use_postgres():
@@ -115,7 +90,6 @@ def add_memory(key: str, description: str, content: str, project_dir: str | None
115
90
  "updated_at": datetime.datetime.now().isoformat(),
116
91
  }
117
92
  _save(path, store)
118
- _notify_sink(project_dir, "add", key, description, content)
119
93
  return {"status": "ok", "key": key}
120
94
 
121
95
 
@@ -139,8 +113,6 @@ def edit_memory(
139
113
  store[key]["description"] = new_description
140
114
  store[key]["updated_at"] = datetime.datetime.now().isoformat()
141
115
  _save(path, store)
142
- # Relay merged values, not the partial diff.
143
- _notify_sink(project_dir, "edit", key, store[key]["description"], store[key]["content"])
144
116
  return {"status": "ok", "key": key}
145
117
 
146
118
 
@@ -155,5 +127,4 @@ def delete_memory(key: str, project_dir: str | None = None) -> dict:
155
127
  return {"status": "missing", "key": key}
156
128
  del store[key]
157
129
  _save(path, store)
158
- _notify_sink(project_dir, "delete", key, "", "")
159
130
  return {"status": "ok", "key": key}
@@ -22,16 +22,11 @@ from micro_cc.postgres_store import pg_store_
22
22
 
23
23
 
24
24
  def _use_postgres() -> bool:
25
- """MICRO_CC_POSTGRES_URL: memory, settings, theme and token stats live in Postgres (their modules read this)."""
25
+ """MICRO_CC_POSTGRES_URL: the conversation is also kept in Postgres (messages.jsonl stays the working copy), and
26
+ memory, settings, theme and token stats live there (their modules read this too)."""
26
27
  return bool(os.getenv("MICRO_CC_POSTGRES_URL"))
27
28
 
28
29
 
29
- def _replica_on() -> bool:
30
- """Either Postgres URL: the conversation is also kept in Postgres. MICRO_CC_MIRROR_POSTGRES_URL alone leaves
31
- memory and settings local, for an app that handles those itself (e.g. through memory_store_'s sink)."""
32
- return bool(os.getenv("MICRO_CC_POSTGRES_URL") or os.getenv("MICRO_CC_MIRROR_POSTGRES_URL"))
33
-
34
-
35
30
  def _storage_path(project_dir: str) -> Path:
36
31
  """~/.micro-cc/projects/{name}_{hash}/ for this project (not created)."""
37
32
  normalized = os.path.abspath(os.path.expanduser(project_dir))
@@ -54,7 +49,7 @@ def relink(old_dir: str, new_dir: str) -> str:
54
49
  """Move old_dir's store to new_dir's hash name (a moved project folder); returns a one-line report."""
55
50
  old = os.path.abspath(os.path.expanduser(old_dir))
56
51
  new = os.path.abspath(os.path.expanduser(new_dir))
57
- if _replica_on():
52
+ if _use_postgres():
58
53
  return "relink is local-only: the Postgres copy keys history by the original path's hash"
59
54
  source, target = _storage_path(old), _storage_path(new)
60
55
  if source == target:
@@ -118,7 +113,7 @@ def claim_writer(project_dir: str) -> int | None:
118
113
  holder = os.read(fd, 32).decode(errors="replace").strip()
119
114
  os.close(fd)
120
115
  return int(holder) if holder.isdigit() else -1
121
- if _replica_on():
116
+ if _use_postgres():
122
117
  try:
123
118
  conn = pg_store_.take_lease(project_dir)
124
119
  except Exception:
@@ -132,7 +127,7 @@ def claim_writer(project_dir: str) -> int | None:
132
127
  os.write(fd, str(os.getpid()).encode())
133
128
  _leases[str(storage_dir)] = fd
134
129
  _persisted.pop(project_dir, None) # recounted as the writer, which also cuts a torn last line
135
- if _replica_on():
130
+ if _use_postgres():
136
131
  try:
137
132
  _sync_with_replica(project_dir)
138
133
  except Exception:
@@ -279,7 +274,7 @@ def _rewrite_all(project_dir: str, msgs: list, raw: bool = False) -> None:
279
274
 
280
275
 
281
276
  # ---------------------------------------------------------------------------
282
- # The Postgres copy (either Postgres URL). messages.jsonl stays the working copy: every read is local, every write
277
+ # The Postgres copy (MICRO_CC_POSTGRES_URL). messages.jsonl stays the working copy: every read is local, every write
283
278
  # goes there first, then to Postgres. The copy is written only by the process holding the project's lease there.
284
279
  # ---------------------------------------------------------------------------
285
280
 
@@ -0,0 +1,115 @@
1
+ """The system prompt micro-cc sends: its sections as of now (sections), and the messages rendered from a set of them
2
+ (render). system_prompt_ decides which set a request is rendered from (the conversation's head, later changes as
3
+ patches); this module only says what the sections are and how they read."""
4
+
5
+ import datetime
6
+ from pathlib import Path
7
+
8
+ from micro_cc.skills.skill_loader import get_skill_summary
9
+ from micro_cc.utils import memory_store_
10
+ from micro_cc.utils.claude_md_loader import load_claude_md_file
11
+
12
+ PACKAGE_DIR = str(Path(__file__).resolve().parents[1]) # micro_cc/: the harness's own source
13
+
14
+ ORCHESTRATION = (
15
+ "- Multi-subagent orchestration: read_skill('graph-orchestration') to "
16
+ "orchestrate headless subagents any time you judge a task benefits "
17
+ "from parallel or sequenced work."
18
+ )
19
+
20
+
21
+ def memory_manifest(project_dir: str) -> str | None:
22
+ """Index of memory keys across the global and project scopes; None when both are empty."""
23
+ parts = []
24
+ global_items = memory_store_.list_memories()
25
+ if global_items:
26
+ parts.append("Global (all projects):\n" + "\n".join(f"- {it['key']} — {it['description']}" for it in global_items))
27
+ project_items = memory_store_.list_memories(project_dir=project_dir)
28
+ if project_items:
29
+ parts.append("Project (this project_dir only):\n"
30
+ + "\n".join(f"- {it['key']} — {it['description']}" for it in project_items))
31
+ return "\n\n".join(parts) if parts else None
32
+
33
+
34
+ def sections(project_dir: str, surface: str) -> dict:
35
+ """The volatile parts of the prompt as of now: {date, orchestration, skills, claude_md, memory}, empty ones left out."""
36
+ return {name: text for name, text in {
37
+ "date": datetime.datetime.now().strftime("%B %d, %Y"),
38
+ "orchestration": ORCHESTRATION if surface == "tui" else "",
39
+ "skills": get_skill_summary(project_dir),
40
+ "claude_md": load_claude_md_file(project_dir),
41
+ "memory": memory_manifest(project_dir),
42
+ }.items() if text}
43
+
44
+
45
+ def render(s: dict, project_dir: str) -> list:
46
+ """The system messages for sections s: the prompt, then the memory index in its own block (each its own cache
47
+ breakpoint, byte-identical across a call's iterations)."""
48
+ claude_md_section = f"\n\n<project-instructions>\n{s['claude_md']}\n</project-instructions>" if s.get("claude_md") else ""
49
+ package_dir = PACKAGE_DIR
50
+ system_prompt_msg = {
51
+ "role": "system",
52
+ "content": f"""You are micro cognitive compute - a CLI assistant. You have full system access and thus using code you can achieve any task.
53
+
54
+ ## Environment
55
+ - You are running LOCALLY on the user's machine (on the metal), NOT a remote server
56
+ - You have direct access to the local filesystem, Desktop, Documents, etc.
57
+ - Project directory: {project_dir}
58
+ - Your own source code lives at: {package_dir} (not project_dir) — plain, editable .py. You can change the harness itself: edit it, then once the user allows it call reload_harness_ (load it with search_tools) to restart into your change, otherwise it never takes effect; the conversation persists across the restart. Before changing the harness, read the customizing-micro-cc skill: it says which changes belong in ~/.micro-cc (they survive updates) and which edit core (overwritten by the next /update).
59
+ - Date: {s.get("date", "")}
60
+
61
+ ## Core Tools (always available)
62
+ - bash_: Execute shell commands (runs in project_dir, use path param or absolute paths for elsewhere)
63
+ - read_: Read file contents with line numbers — also reads image files (png/jpg/gif/webp/bmp) directly, no separate tool needed
64
+ - write_: Create/overwrite files
65
+ - edit_: Surgical string replacement in files
66
+ - glob_: Find files by pattern
67
+ - grep_: Search file contents with regex
68
+
69
+ ## Discoverable Tools
70
+ search_tools is two-step and cheap: `search_tools(action="discover")` lists
71
+ every tool and MCP you could load (name + one-line description, no schemas),
72
+ then `search_tools(action="add", names="browser, deepwiki")` returns the
73
+ schemas of the ones you want — including several at once — as text in its
74
+ result. Those tools are not in your tool list: call each one through the
75
+ fixed dispatcher `use_tool_(name="browser", args=...)` with args matching the
76
+ schema you were given. A call with args that don't match the schema fails
77
+ and the error carries the schema, so retry from that.
78
+ Do this when you need a capability you don't currently have: web research,
79
+ browser, computer_use, message_session_ (list and message other live
80
+ micro-cc sessions), etc.
81
+ {s.get("orchestration", "")}
82
+
83
+ ## Planning Tools
84
+ - todo_tool_: For multi-step complex work, write a todo plan and keep on track.
85
+
86
+ ## Long-term Memory
87
+ memory_ (action=add|edit|get|delete|list, scope=global|project).
88
+ scope="global": cross-project facts (~/.micro-cc/memory.json). scope="project":
89
+ this project only (~/.micro-cc/projects/{{name}}_{{hash}}/memory.json).
90
+ <memory-manifest> lists keys each loop; memory_(action="get", key=...) expands
91
+ one. In-progress state: use todo_tool_ instead.
92
+
93
+ ## Conversation History Search
94
+ conversation grows forever
95
+ search_history_(query=..., limit=...): full-text search over this project's
96
+ whole conversation history, including compacted turns.
97
+
98
+ {s.get("skills", "")}
99
+ {claude_md_section}
100
+
101
+ ## Guidelines
102
+ - Read files before editing them
103
+ - Use absolute paths when working outside project_dir
104
+ - When writing to user, remove all mannered prose
105
+ """,
106
+ "cache_control": {"type": "ephemeral"},
107
+ }
108
+ if not s.get("memory"):
109
+ return [system_prompt_msg]
110
+ memory_manifest_msg = {
111
+ "role": "system",
112
+ "content": f"## Long-term Memory\nKey+description index for both scopes — call memory_(action=\"get\", key=..., scope=...) to expand an entry.\n\n{s['memory']}",
113
+ "cache_control": {"type": "ephemeral"},
114
+ }
115
+ return [system_prompt_msg, memory_manifest_msg]
@@ -0,0 +1,101 @@
1
+ """Tool hooks: ~/.micro-cc/hooks/<name>.py, run around every tool call claude_loop makes (TUI, webui, headless and
2
+ subagents alike: each micro-cc process loads the folder).
3
+
4
+ A hook file sets MATCH (regex over the whole tool name; omitted: every tool) and defines before and/or after:
5
+ before(name, args, project_dir) -> None (run the call as asked)
6
+ | {"args": {...}} (run it with these args instead)
7
+ | {"result": "text"} (don't run it: the model gets this text, the loop goes on)
8
+ after(name, args, result, project_dir) -> None (the call ran; result is what the model gets)
9
+ Either may be async. Hooks get a copy of args. Files run in name order, each before() seeing the args the previous
10
+ one returned; the first {"result"} wins. A leading "_" disables a file. A changed file is loaded again on the next
11
+ call. A hook that fails to load, raises or exceeds TIMEOUT_S blocks the call (fail closed: a policy that errors must
12
+ never wave the call through); an after() failure is only logged, the call has already run.
13
+ """
14
+
15
+ import asyncio
16
+ import copy
17
+ import importlib.util
18
+ import inspect
19
+ import re
20
+ import sys
21
+ from pathlib import Path
22
+
23
+ TIMEOUT_S = 30
24
+
25
+ # path -> (mtime, module): a file is executed again only when it changes.
26
+ _loaded: dict[str, tuple[float, object]] = {}
27
+
28
+
29
+ def hooks_dir() -> Path:
30
+ return Path.home() / ".micro-cc" / "hooks"
31
+
32
+
33
+ def _hooks() -> list:
34
+ """The enabled hook modules, in file-name order; raises if one fails to load."""
35
+ d = hooks_dir()
36
+ paths = sorted(p for p in d.glob("*.py") if not p.name.startswith("_")) if d.is_dir() else []
37
+ for gone in set(_loaded) - {str(p) for p in paths}:
38
+ del _loaded[gone]
39
+ modules = []
40
+ for p in paths:
41
+ mtime = p.stat().st_mtime
42
+ if _loaded.get(str(p), (None,))[0] != mtime:
43
+ spec = importlib.util.spec_from_file_location(f"micro_cc_hook_{p.stem}", p)
44
+ module = importlib.util.module_from_spec(spec)
45
+ try:
46
+ spec.loader.exec_module(module)
47
+ except Exception as e:
48
+ raise RuntimeError(f"{p.name}: {type(e).__name__}: {e}") from e
49
+ _loaded[str(p)] = (mtime, module)
50
+ modules.append(_loaded[str(p)][1])
51
+ return modules
52
+
53
+
54
+ async def _call(fn, *args):
55
+ if inspect.iscoroutinefunction(fn):
56
+ return await asyncio.wait_for(fn(*args), TIMEOUT_S)
57
+ return await asyncio.wait_for(asyncio.to_thread(fn, *args), TIMEOUT_S)
58
+
59
+
60
+ async def before(name: str, args: dict, project_dir: str) -> tuple[dict, str | None]:
61
+ """(the args to run the call with, None), or (args, the text the model gets instead of running it)."""
62
+ try:
63
+ modules = _hooks()
64
+ except Exception as e:
65
+ return args, f"Blocked: a tool hook in {hooks_dir()} failed to load ({e}). Fix or remove it, then retry."
66
+ for module in modules:
67
+ fn = getattr(module, "before", None)
68
+ if fn is None or not re.fullmatch(getattr(module, "MATCH", ".*"), name):
69
+ continue
70
+ hook = Path(module.__file__).name
71
+ try:
72
+ out = await _call(fn, name, copy.deepcopy(args), project_dir)
73
+ except Exception as e:
74
+ return args, f"Blocked by tool hook {hook}: it failed ({type(e).__name__}: {e})."
75
+ if out is None:
76
+ continue
77
+ if isinstance(out, dict) and "result" in out:
78
+ return args, str(out["result"])
79
+ if isinstance(out, dict) and isinstance(out.get("args"), dict):
80
+ args = out["args"]
81
+ continue
82
+ return args, f"Blocked by tool hook {hook}: before() returned {out!r}, not None, {{'args': ...}} or {{'result': ...}}."
83
+ return args, None
84
+
85
+
86
+ async def after(name: str, args: dict, result, project_dir: str) -> None:
87
+ """Tell the matching hooks the call ran; their failures are logged, never raised."""
88
+ try:
89
+ modules = _hooks()
90
+ except Exception as e:
91
+ print(f"[tool_hooks_] {e}", file=sys.stderr, flush=True)
92
+ return
93
+ for module in modules:
94
+ fn = getattr(module, "after", None)
95
+ if fn is None or not re.fullmatch(getattr(module, "MATCH", ".*"), name):
96
+ continue
97
+ try:
98
+ await _call(fn, name, copy.deepcopy(args), result, project_dir)
99
+ except Exception as e:
100
+ print(f"[tool_hooks_] {Path(module.__file__).name} after() failed: {type(e).__name__}: {e}",
101
+ file=sys.stderr, flush=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: micro-cc
3
- Version: 0.2.141
3
+ Version: 0.2.142
4
4
  Summary: Harness that gives frontier models full system access — shell, filesystem, browser, MCP — running directly on the metal.
5
5
  Author: George Salapa
6
6
  License: MIT License