lcode-cli 0.51.0__tar.gz → 0.52.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 (221) hide show
  1. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/CHANGELOG.md +35 -1
  2. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/PKG-INFO +1 -1
  3. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/configuration.md +4 -3
  4. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/how-it-works.md +2 -1
  5. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/memory.md +31 -16
  6. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/quickstart.md +1 -1
  7. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/usage.md +31 -12
  8. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/__init__.py +1 -1
  9. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/agent.py +23 -7
  10. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/api.py +1 -0
  11. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/cli.py +10 -1
  12. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/config.py +5 -0
  13. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/memory.py +62 -8
  14. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/repl.py +59 -27
  15. lcode_cli-0.52.0/src/lcode/repoid.py +65 -0
  16. lcode_cli-0.52.0/src/lcode/sessions.py +230 -0
  17. lcode_cli-0.52.0/tests/test_conversations.py +385 -0
  18. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_jobs.py +4 -1
  19. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_memory.py +20 -2
  20. lcode_cli-0.51.0/src/lcode/sessions.py +0 -124
  21. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/.editorconfig +0 -0
  22. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/.github/CODEOWNERS +0 -0
  23. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  24. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  25. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  26. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/.github/ISSUE_TEMPLATE/model_request.yml +0 -0
  27. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  28. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/.github/dependabot.yml +0 -0
  29. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/.github/workflows/ci.yml +0 -0
  30. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/.github/workflows/docs.yml +0 -0
  31. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/.github/workflows/release.yml +0 -0
  32. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/.gitignore +0 -0
  33. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/.pre-commit-config.yaml +0 -0
  34. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/AGENTS.md +0 -0
  35. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/CODE_OF_CONDUCT.md +0 -0
  36. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/CONTRIBUTING.md +0 -0
  37. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/LICENSE +0 -0
  38. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/README.md +0 -0
  39. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/SECURITY.md +0 -0
  40. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/action.yml +0 -0
  41. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/agents.md +0 -0
  42. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/assets/demo.svg +0 -0
  43. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/assets/extra.css +0 -0
  44. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/assets/film-fox-and-kitten.jpg +0 -0
  45. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/assets/long-clip-tulip.jpg +0 -0
  46. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/automation.md +0 -0
  47. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/bench.md +0 -0
  48. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/changelog.md +0 -0
  49. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/commands.md +0 -0
  50. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/contributing.md +0 -0
  51. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/editors.md +0 -0
  52. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/git.md +0 -0
  53. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/hooks.md +0 -0
  54. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/index.md +0 -0
  55. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/installation.md +0 -0
  56. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/lsp.md +0 -0
  57. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/mcp.md +0 -0
  58. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/models.md +0 -0
  59. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/modes.md +0 -0
  60. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/sandbox.md +0 -0
  61. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/search.md +0 -0
  62. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/servers.md +0 -0
  63. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/docs/troubleshooting.md +0 -0
  64. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/examples/README.md +0 -0
  65. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/examples/api/fix_tests.py +0 -0
  66. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/examples/commands/review.md +0 -0
  67. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/examples/skills/commit-message/SKILL.md +0 -0
  68. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/examples/skills/commit-message/scripts/staged.sh +0 -0
  69. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/install.sh +0 -0
  70. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/mkdocs.yml +0 -0
  71. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/overrides/main.html +0 -0
  72. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/pyproject.toml +0 -0
  73. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/scripts/make_logos.py +0 -0
  74. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/scripts/record_demo.py +0 -0
  75. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/scripts/social-preview.html +0 -0
  76. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/__main__.py +0 -0
  77. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/acp.py +0 -0
  78. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/action.py +0 -0
  79. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/assistant.py +0 -0
  80. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/backends.py +0 -0
  81. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/bench.py +0 -0
  82. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/bench_backend.py +0 -0
  83. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/bench_runtime.py +0 -0
  84. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/catalog.py +0 -0
  85. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/checkpoints.py +0 -0
  86. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/checks.py +0 -0
  87. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/clipboard.py +0 -0
  88. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/cloud.py +0 -0
  89. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/codesearch.py +0 -0
  90. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/comfy.py +0 -0
  91. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/context.py +0 -0
  92. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/edits.py +0 -0
  93. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/escalate.py +0 -0
  94. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/extensions.py +0 -0
  95. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/film.py +0 -0
  96. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/frontmatter.py +0 -0
  97. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/gitflow.py +0 -0
  98. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/hardware.py +0 -0
  99. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/hooks.py +0 -0
  100. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/imageopts.py +0 -0
  101. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/jobs.py +0 -0
  102. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/limits.py +0 -0
  103. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/lsp.py +0 -0
  104. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/manual.py +0 -0
  105. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/matching.py +0 -0
  106. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/mcp/__init__.py +0 -0
  107. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/mcp/auth.py +0 -0
  108. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/mcp/catalog.py +0 -0
  109. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/mcp/catalog.toml +0 -0
  110. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/mcp/client.py +0 -0
  111. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/mcp/commands.py +0 -0
  112. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/mcp/config.py +0 -0
  113. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/mcp/http.py +0 -0
  114. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/mcp/manager.py +0 -0
  115. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/mcp/protocol.py +0 -0
  116. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/mcp/server.py +0 -0
  117. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/mcp/stdio.py +0 -0
  118. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/media.py +0 -0
  119. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/media.toml +0 -0
  120. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/media_catalog.py +0 -0
  121. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/media_cloud.py +0 -0
  122. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/models.toml +0 -0
  123. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/modes.py +0 -0
  124. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/notify.py +0 -0
  125. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/ollama.py +0 -0
  126. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/permissions.py +0 -0
  127. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/planning.py +0 -0
  128. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/preview.py +0 -0
  129. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/render.py +0 -0
  130. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/repeats.py +0 -0
  131. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/repomap.py +0 -0
  132. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/residency.py +0 -0
  133. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/review.py +0 -0
  134. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/sandbox.py +0 -0
  135. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/screenshots.py +0 -0
  136. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/secretscan.py +0 -0
  137. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/servers/__init__.py +0 -0
  138. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/servers/encord.py +0 -0
  139. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/servers/valohai.py +0 -0
  140. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/servers/xai.py +0 -0
  141. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/steer.py +0 -0
  142. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/subagents.py +0 -0
  143. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/tools.py +0 -0
  144. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/unreachable.py +0 -0
  145. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/update.py +0 -0
  146. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/vision.py +0 -0
  147. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/web.py +0 -0
  148. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/workflows/__init__.py +0 -0
  149. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/workflows/flux2-klein-4b-t2i.json +0 -0
  150. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/workflows/remove-background.json +0 -0
  151. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/workflows/smooth-film.json +0 -0
  152. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/workflows/sound-stable-audio.json +0 -0
  153. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/workflows/upscale-esrgan.json +0 -0
  154. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/workflows/upscale-video-esrgan.json +0 -0
  155. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/workflows/wan21-fun-camera.json +0 -0
  156. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/workflows/wan21-vace.json +0 -0
  157. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/workflows/wan22-fun-inp-5b.json +0 -0
  158. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/workflows/wan22-ti2v-5b.json +0 -0
  159. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/src/lcode/workflows/z-image-turbo-t2i.json +0 -0
  160. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/comfy_standin.py +0 -0
  161. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/conftest.py +0 -0
  162. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/fake_lsp_server.py +0 -0
  163. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/fake_mcp_server.py +0 -0
  164. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_acp.py +0 -0
  165. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_action.py +0 -0
  166. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_agent.py +0 -0
  167. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_api.py +0 -0
  168. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_assistant.py +0 -0
  169. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_backends.py +0 -0
  170. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_bench.py +0 -0
  171. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_catalog.py +0 -0
  172. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_checkpoints.py +0 -0
  173. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_checks.py +0 -0
  174. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_cli.py +0 -0
  175. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_clipboard.py +0 -0
  176. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_cloud.py +0 -0
  177. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_codesearch.py +0 -0
  178. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_comfy.py +0 -0
  179. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_config.py +0 -0
  180. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_context.py +0 -0
  181. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_context_picker.py +0 -0
  182. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_escalate.py +0 -0
  183. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_extensions.py +0 -0
  184. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_film.py +0 -0
  185. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_gitflow.py +0 -0
  186. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_gpu_handover.py +0 -0
  187. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_hooks.py +0 -0
  188. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_image_edit.py +0 -0
  189. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_image_generate.py +0 -0
  190. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_long_clips.py +0 -0
  191. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_look.py +0 -0
  192. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_lsp.py +0 -0
  193. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_manual.py +0 -0
  194. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_matching.py +0 -0
  195. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_mcp.py +0 -0
  196. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_media_catalog.py +0 -0
  197. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_media_cloud.py +0 -0
  198. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_model_picker.py +0 -0
  199. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_modes.py +0 -0
  200. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_permissions.py +0 -0
  201. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_plan_mode.py +0 -0
  202. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_repeats.py +0 -0
  203. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_repomap.py +0 -0
  204. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_residency.py +0 -0
  205. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_review.py +0 -0
  206. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_robustness.py +0 -0
  207. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_sandbox.py +0 -0
  208. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_screenshots.py +0 -0
  209. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_secretscan.py +0 -0
  210. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_servers.py +0 -0
  211. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_sessions.py +0 -0
  212. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_steer.py +0 -0
  213. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_stuck.py +0 -0
  214. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_subagents.py +0 -0
  215. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_tools.py +0 -0
  216. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_update.py +0 -0
  217. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_video.py +0 -0
  218. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_vision.py +0 -0
  219. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_web.py +0 -0
  220. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/tests/test_xai.py +0 -0
  221. {lcode_cli-0.51.0 → lcode_cli-0.52.0}/uv.lock +0 -0
@@ -6,6 +6,39 @@ All notable changes to lcode are documented here. The format follows
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.52.0] - 2026-10-27
10
+
11
+ ### Added
12
+
13
+ - **`/resume` in two sections** (#141): *This folder* lists the conversations saved in this
14
+ folder and anywhere in its git repository, also from a subfolder, a worktree or another clone
15
+ (the same first commit). *Elsewhere* lists the 20 newest from other folders, with each one's
16
+ folder. They're numbered across both. Before, only sessions saved in exactly this folder were
17
+ listed, so starting lcode one folder up made them look lost.
18
+ - **The context each conversation uses**, in the list: `18.2K / 32K (57%)` against the current
19
+ window, in yellow when resuming it means a summary first. Sessions now save what they used,
20
+ and the status bar shows it right after resuming. Older sessions get an estimate, marked `~`.
21
+ - **Notes follow a repository that moved, was renamed or was cloned again.** A repository's
22
+ notes folder names its first commit (`repo.json`), and a checkout whose own folder has no notes
23
+ finds them by it. Notes from older versions get the file the first time lcode runs there.
24
+ - `lcode doctor` shows how many sessions are saved, how many for this folder, and where.
25
+
26
+ ### Changed
27
+
28
+ - **No memory check when a session ends, by default.** Quitting, `/clear` and summarizing no
29
+ longer wait for a model call asking what's worth remembering. Turn it back on with
30
+ `lcode config set memory_check true`. `/remember`, the model's memory tool and saved notes work
31
+ as before, and the conversation is always saved.
32
+ - `lcode -c` continues the latest conversation in this folder, else the latest in its repository,
33
+ and says when that takes it to another folder.
34
+ - `/resume` and `lcode --resume` leave out sessions from temporary folders that no longer exist,
35
+ such as scripted test runs; `/resume all` lists them, and everything else.
36
+
37
+ ### Fixed
38
+
39
+ - A session file that isn't a conversation (broken JSON, a list, odd messages) no longer stops
40
+ `/resume` from listing the others.
41
+
9
42
  ## [0.51.0] - 2026-10-27
10
43
 
11
44
  ### Added
@@ -1102,7 +1135,8 @@ First public release.
1102
1135
  - `AGENTS.md` project instructions and `/init` to generate them.
1103
1136
  - One-line installer for Linux and macOS.
1104
1137
 
1105
- [Unreleased]: https://github.com/nasser1941/lcode/compare/v0.51.0...HEAD
1138
+ [Unreleased]: https://github.com/nasser1941/lcode/compare/v0.52.0...HEAD
1139
+ [0.52.0]: https://github.com/nasser1941/lcode/compare/v0.51.0...v0.52.0
1106
1140
  [0.51.0]: https://github.com/nasser1941/lcode/compare/v0.50.0...v0.51.0
1107
1141
  [0.50.0]: https://github.com/nasser1941/lcode/compare/v0.49.1...v0.50.0
1108
1142
  [0.49.1]: https://github.com/nasser1941/lcode/compare/v0.49.0...v0.49.1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: lcode-cli
3
- Version: 0.51.0
3
+ Version: 0.52.0
4
4
  Summary: A local-first terminal coding agent powered by open-weight models on your own GPU or Mac, via Ollama.
5
5
  Project-URL: Homepage, https://nasser1941.github.io/lcode/
6
6
  Project-URL: Documentation, https://nasser1941.github.io/lcode/
@@ -42,6 +42,7 @@ lcode config path # print the file location
42
42
  | `vision_model` | `auto` | The model that [looks at images](usage.md#images): `auto`, `off` or an Ollama model that can see |
43
43
  | `mcp_tools` | `auto` | How [MCP](mcp.md#context) tool definitions reach the model: `auto`, `direct` or `search` (on demand) |
44
44
  | `memory` | `ask` | [Notes that carry over](memory.md) to later sessions: `ask` (confirm each), `auto` or `off` |
45
+ | `memory_check` | `false` | When a conversation ends, [ask the model what's worth remembering](memory.md#a-check-when-a-session-ends) (a model call before you can leave) |
45
46
  | `skills` | `all` | Which [skills](commands.md#skills) the model is offered: `all` (lcode's folders and the ones other agents share), `lcode` (only `.lcode/skills/` and `~/.config/lcode/skills/`) or `off` |
46
47
  | `repo_map` | `true` | Give the model a ranked [map of the repository](search.md) |
47
48
  | `embed_model` | `auto` | Embedding model for [semantic code search](search.md#semantic-code-search): `auto`, `off` or a model name |
@@ -93,20 +94,20 @@ Environment variables override the file, which is useful for one-off runs and CI
93
94
  | `LCODE_SANDBOX` | `sandbox` |
94
95
  | `LCODE_MEMORY` | `memory` |
95
96
  | `OLLAMA_API_KEY`, `BRAVE_API_KEY`, `TAVILY_API_KEY` | API key for that [search provider](usage.md#web-search) (never stored in the config file) |
96
- | `LCODE_HOME` | where sessions and prompt history are stored |
97
+ | `LCODE_HOME` | where sessions, notes and prompt history are stored, instead of `~/.local/state/lcode` |
97
98
 
98
99
  ## Files lcode creates
99
100
 
100
101
  | Path | Contents |
101
102
  |---|---|
102
103
  | `~/.config/lcode/config.toml` | Settings |
103
- | `~/.local/state/lcode/sessions/` | Saved conversations (for `lcode -c`) |
104
+ | `~/.local/state/lcode/sessions/` | Saved conversations (for `/resume` and `lcode -c`), one JSON file each |
104
105
  | `~/.local/state/lcode/history` | Prompt history (++up++ in the prompt) |
105
106
  | `~/.config/lcode/mcp.json` | [MCP servers](mcp.md) (readable only by you; may contain tokens) |
106
107
  | `~/.local/state/lcode/mcp-auth/` | Sign-in tokens for remote MCP servers (readable only by you) |
107
108
  | `~/.local/state/lcode/mcp-logs/` | Error output of local MCP servers |
108
109
  | `~/.local/state/lcode/checkpoints/` | Checkpoints for `/undo` (copies of your project's files; deleted after 14 days) |
109
- | `~/.local/state/lcode/memory/` | [Memory](memory.md) notes: `user/` for every repository, `projects/<repository>/` for each one |
110
+ | `~/.local/state/lcode/memory/` | [Memory](memory.md) notes: `user/` for every repository, `projects/<repository>/` for each one (`/memory path` shows this repository's) |
110
111
  | `~/.config/lcode/commands/`, `~/.config/lcode/skills/` | Your [commands and skills](commands.md) (a repository's go in `.lcode/`) |
111
112
  | `~/.local/state/lcode/extensions-approved.json` | Repositories whose commands, skills and agents you approved |
112
113
  | `~/.config/lcode/agents/` | Your [custom agents](agents.md#custom-agents) (a repository's go in `.lcode/agents/`) |
@@ -197,7 +197,8 @@ the Ollama server you configure, it only contacts the web when the model searche
197
197
  | `extensions.py` | Custom commands and skills, and approving a repository's own |
198
198
  | `frontmatter.py` | The `---` headers of notes, agents, commands and skills |
199
199
  | `planning.py` | Plan mode: what it allows, presenting a plan and approving it |
200
- | `memory.py` | Notes that carry over between sessions, and the end-of-session check |
200
+ | `memory.py` | Notes that carry over between sessions, and the optional end-of-session check |
201
+ | `sessions.py`, `repoid.py` | Saved conversations: listing them for this folder and elsewhere; which repository a folder is in, by its first commit |
201
202
  | `sandbox.py` | The optional container for shell commands |
202
203
  | `checkpoints.py` | Snapshots before the model changes files, for `/undo` and `/rewind` |
203
204
  | `catalog.py`, `models.toml` | Model catalog and memory estimates |
@@ -49,29 +49,37 @@ instead ("staging credentials are in 1Password, vault Dev").
49
49
  `-g` saves it for every repository. Start with `feedback:`, `reference:` or `user:` to set the
50
50
  type (the default is `project`).
51
51
 
52
- - **At the end of a session**, because local models rarely save anything on their own, lcode
53
- asks the model one short question: is anything from this session worth remembering? It happens
54
- when you quit, on `/clear`, and before the conversation is compacted (the summary leaves details
55
- out). The model proposes at most three notes:
52
+ ## A check when a session ends
56
53
 
57
- ```text
58
- ╭─ Worth remembering? ────────────────────────────────────────────────────────╮
59
- │ 1 [feedback] Use pnpm, not npm (this repository) │
60
- │ 2 [project] Integration tests need `docker compose up db` first (this │
61
- │ repository) │
62
- ╰───────────────────────────────────────────────────────────────────────────────╯
63
- Save them? [y]es / numbers to keep, e.g. 1,3 / [n]o: 1
64
- ```
54
+ Local models rarely save notes on their own. With `memory_check` on, lcode asks the model one short
55
+ question when a conversation ends: is anything from it worth remembering? It happens when you
56
+ quit, on `/clear`, and before the conversation is summarized (the summary leaves details out). The
57
+ model proposes at most three notes:
58
+
59
+ ```text
60
+ ╭─ Worth remembering? ────────────────────────────────────────────────────────╮
61
+ │ 1 [feedback] Use pnpm, not npm (this repository) │
62
+ │ 2 [project] Integration tests need `docker compose up db` first (this │
63
+ │ repository) │
64
+ ╰───────────────────────────────────────────────────────────────────────────────╯
65
+ Save them? [y]es / numbers to keep, e.g. 1,3 / [n]o: 1
66
+ ```
65
67
 
66
- The question is quick: it reuses the conversation Ollama already has in memory, so the model
67
- only writes a few lines. Short sessions (one request and little work) are skipped, and Ctrl+C
68
- skips it too.
68
+ It's off by default, because it's a model call you wait for before you can leave. Turn it on with:
69
+
70
+ ```bash
71
+ lcode config set memory_check true
72
+ ```
73
+
74
+ The question reuses the conversation Ollama already has in memory, so the model only writes a few
75
+ lines. Short sessions (one request and little work) are skipped, and Ctrl+C skips it too. The
76
+ conversation itself is always saved, with or without the check.
69
77
 
70
78
  ## Asking first: the `memory` setting
71
79
 
72
80
  | `memory` | |
73
81
  |---|---|
74
- | `ask` (default) | Every note the model saves, and the end-of-session proposals, need your OK. Answer `a` once to allow the model's notes for the rest of the session. This holds in `yolo` mode too. |
82
+ | `ask` (default) | Every note the model saves, and the [end-of-session](#a-check-when-a-session-ends) proposals, need your OK. Answer `a` once to allow the model's notes for the rest of the session. This holds in `yolo` mode too. |
75
83
  | `auto` | Notes are saved without asking; lcode prints each one. |
76
84
  | `off` | No notes are loaded or saved, and the model has no `memory` tool. |
77
85
 
@@ -116,6 +124,13 @@ The dev dependencies are in a uv dependency group, which plain pytest doesn't se
116
124
 
117
125
  Each folder also has a `MEMORY.md` listing its notes, for reading; lcode regenerates it, so edit
118
126
  the notes rather than that file. A folder that isn't in a git repository gets its own notes.
127
+ `/memory path` shows where this repository's are.
128
+
129
+ A repository's notes follow it when you move or rename it, or clone it again: its folder has a
130
+ `repo.json` naming the repository's first commit, which every clone shares. Notes saved before
131
+ lcode 0.52 get that file the first time lcode runs in their repository. Notes of a repository
132
+ that moved before then are in a folder named after its old name; copy them into the new one
133
+ (`/memory path`) to keep them.
119
134
 
120
135
  At the start of a session, the model gets a one-line index of the notes (description, name, date)
121
136
  in its instructions. The index is capped at about 2,000 tokens, or 5% of a small context window;
@@ -12,7 +12,7 @@ lcode
12
12
 
13
13
  ```text
14
14
  ╭──────────────────────────────────────────────╮
15
- │ lcode v0.51.0 — local coding agent │
15
+ │ lcode v0.52.0 — local coding agent │
16
16
  │ │
17
17
  │ model lcode-qwen3.6-35b │
18
18
  │ context 256K tokens │
@@ -712,40 +712,59 @@ Instructions that are only needed for some tasks fit better in a [command or ski
712
712
  which costs no context until it's used.
713
713
 
714
714
  What doesn't belong in `AGENTS.md` but should carry over, such as your corrections and preferences,
715
- goes into lcode's [memory](memory.md): short notes the model, you (`/remember`) or a short check at
716
- the end of a session save, and that every later session in the repository loads.
715
+ goes into lcode's [memory](memory.md): short notes the model or you (`/remember`) save, and that
716
+ every later session in the repository loads.
717
717
 
718
718
  ## Sessions
719
719
 
720
720
  Every conversation is saved after each request to `~/.local/state/lcode/sessions/`, so you can
721
- leave and pick up where you stopped.
721
+ leave and pick up where you stopped. Upgrading lcode keeps them, and the installed lcode and a
722
+ development checkout (`uv run lcode`) share them.
722
723
 
723
724
  ```text
724
725
  ❯ /rename auth refactor # name the current session
725
- ❯ /resume # list this folder's sessions and pick one
726
+ ❯ /resume # list the saved sessions and pick one
726
727
  ```
727
728
 
728
729
  ```text
729
- Saved sessions · /home/you/code/my-project
730
- # Session Last used Requests
731
- 1 auth refactor 2 h ago 14
730
+ This folder · ~/code/my-project
731
+ # Session Last used Requests Context
732
+ 1 auth refactor 2 h ago 14 41.3K / 128K (32%)
732
733
  Explain how login tokens are validated
733
- 2 The tests in tests/test_parser.py fail… yesterday 6
734
+ 2 The tests in tests/test_parser.py fail… yesterday 6 ~18K / 128K (14%)
735
+ in tests
736
+ Elsewhere
737
+ # Session Last used Requests Context Folder
738
+ 3 Set up the release script Oct 20 3 9.6K / 128K (8%) ~/code/tools
734
739
  Resume which session? (number or name, Enter to cancel): 1
735
740
  ```
736
741
 
742
+ - **This folder** lists the sessions saved in this folder, and anywhere else in its git
743
+ repository: a subfolder, a worktree, or another clone of the same repository (it has the same
744
+ first commit). A row from another folder says where it was.
745
+ - **Elsewhere** lists the 20 newest sessions from other folders. Sessions from temporary folders
746
+ that no longer exist, such as scripted test runs, are left out. `/resume all` lists everything.
747
+ - **Context** is what the conversation takes of the current context window. A `~` means it's an
748
+ estimate, for sessions saved before lcode 0.52. After resuming, the status bar shows it right
749
+ away, and a yellow number means lcode summarizes the conversation before your next request.
750
+
737
751
  Unnamed sessions are listed by their first request. After resuming, lcode shows your last request
738
752
  and the start of its last answer so you know where you left off.
739
753
 
740
754
  | From the shell | From a session | Resumes |
741
755
  |---|---|---|
742
- | `lcode -c` | | the most recently used session in this folder |
756
+ | `lcode -c` | | the latest session in this folder, else the latest under "This folder" |
743
757
  | `lcode --resume` | `/resume` | one you pick from a list |
744
758
  | `lcode --resume "auth refactor"` | `/resume auth refactor` | a session by name, list number, id or a unique part of its title |
745
- | | `/resume all` | a session from any folder (lcode switches to that folder) |
759
+ | `lcode --resume all` | `/resume all` | one you pick from every saved session |
760
+
761
+ A session from another folder takes lcode to that folder. `/clear` starts a new conversation and
762
+ keeps the old one saved. Files may have changed since a session was saved, so after resuming the
763
+ model has to read a file again before editing it.
746
764
 
747
- `/clear` starts a new conversation and keeps the old one saved. Files may have changed since a
748
- session was saved, so after resuming the model has to read a file again before editing it.
765
+ **Where are my sessions?** `lcode doctor` shows how many are saved and the folder they're in.
766
+ `LCODE_HOME`, or `XDG_STATE_HOME`, moves that folder: a terminal that sets one of them (some IDEs
767
+ and test scripts do) sees other sessions. `lcode bench` doesn't save its runs as sessions.
749
768
 
750
769
  ## Scripting
751
770
 
@@ -3,7 +3,7 @@
3
3
  From a program: `from lcode import Session` (see lcode.api).
4
4
  """
5
5
 
6
- __version__ = "0.51.0"
6
+ __version__ = "0.52.0"
7
7
 
8
8
  API = ("Session", "Result", "Options", "SetupError")
9
9
 
@@ -35,6 +35,7 @@ from lcode import (
35
35
  manual,
36
36
  notify,
37
37
  planning,
38
+ repoid,
38
39
  repomap,
39
40
  residency,
40
41
  review,
@@ -329,6 +330,7 @@ class Settings:
329
330
  sandbox_network: bool = False
330
331
  vision_model: str = "auto" # auto, off or an Ollama model that can see images
331
332
  memory: str = "off" # off, ask or auto: notes that carry over to later sessions (lcode.memory)
333
+ memory_check: bool = False # ask the model what's worth remembering when a conversation ends
332
334
  subagents: bool = False # the agent tool (lcode.subagents)
333
335
  trust_project: bool = False # use the repository's own commands, skills and agents (lcode.extensions)
334
336
  skills: str = "off" # all, lcode (only lcode's own skill folders) or off
@@ -431,6 +433,7 @@ class Agent:
431
433
  self.reply_trouble = "" # what went wrong with the last reply: "circles", "cut_off" or ""
432
434
  self.response = None # the streaming response, so another thread can abort it
433
435
  self.ctx_used = 0
436
+ self._repo: tuple[Path, repoid.Repo | None] | None = None # the workspace's repository, for saved sessions
434
437
  self.last_speed = 0.0
435
438
  self.usage = {"requests": 0, "prompt_tokens": 0, "prompt_ns": 0, "output_tokens": 0, "output_ns": 0}
436
439
  self.messages: list[dict] = []
@@ -701,8 +704,12 @@ class Agent:
701
704
  self.session_title = self.session_title or sessions.title_from(self.messages)
702
705
  f = self.session_file()
703
706
  f.parent.mkdir(parents=True, exist_ok=True)
707
+ repo = self.workspace_repo()
704
708
  data = {
705
709
  "cwd": str(self.workspace), # where `lcode -c` there finds it, wherever the shell moved
710
+ # /resume lists it under "this folder" in any checkout of the same repository, wherever it moves
711
+ **({"repo": repo.to_json()} if repo else {}),
712
+ "context": {"used": self.next_request_tokens(), "window": self.settings.context},
706
713
  "model": self.settings.model,
707
714
  "mode": self.settings.mode,
708
715
  "image_model": self.settings.image_model,
@@ -721,6 +728,12 @@ class Agent:
721
728
  partial.write_text(json.dumps(data))
722
729
  os.replace(partial, f)
723
730
 
731
+ def workspace_repo(self) -> repoid.Repo | None:
732
+ """The repository the workspace is in, looked up again when the workspace changes or gets its first commit."""
733
+ if self._repo is None or self._repo[0] != self.workspace or (self._repo[1] and not self._repo[1].first):
734
+ self._repo = (self.workspace, repoid.find(self.workspace))
735
+ return self._repo[1]
736
+
724
737
  def new_session(self) -> None:
725
738
  self.reset()
726
739
  self.skills_loaded.clear()
@@ -770,15 +783,18 @@ class Agent:
770
783
  self.tools.notes = [str(n) for n in data.get("notes") or []]
771
784
  self.tools.changed = dict.fromkeys(str(f) for f in data.get("changed") or [])
772
785
  self.reflected = len(self.messages) # checked for notes to remember when that session ended
773
- self.ctx_used = sum(len(json.dumps(m)) for m in self.messages) // 3
774
- self.counted_chars = None
786
+ saved = (data.get("context") or {}).get("used") if isinstance(data.get("context"), dict) else None
787
+ if isinstance(saved, int) and saved > 0: # what the model counted, plus what came after
788
+ self.ctx_used, self.counted_chars = saved, conversation_chars(self.messages)
789
+ else: # saved by a version before 0.52
790
+ self.ctx_used, self.counted_chars = sessions.estimate_tokens(self.messages), None
775
791
  return note
776
792
 
777
- def load_latest(self) -> bool:
778
- latest = sessions.list_sessions(self.workspace, limit=1)
779
- if latest:
780
- self.load(latest[0])
781
- return bool(latest)
793
+ def load_latest(self) -> str | None:
794
+ """Continue the latest conversation in this folder (or its repository). Returns a note about the working
795
+ directory ("" if it stayed), or None when there's nothing to continue."""
796
+ latest = sessions.latest(self.workspace)
797
+ return self.load(latest) if latest else None
782
798
 
783
799
  # -- model calls
784
800
  def options(self) -> dict:
@@ -214,6 +214,7 @@ def open_agent(cwd: Path, options: Options, console: Console, hw: Hardware | Non
214
214
  sandbox_network=cfg["sandbox_network"],
215
215
  vision_model=cfg["vision_model"],
216
216
  memory=switch(options.memory, cfg["memory"], "ask"),
217
+ memory_check=cfg["memory_check"],
217
218
  subagents=cfg["subagents"],
218
219
  max_parallel_agents=cfg["max_parallel_agents"],
219
220
  trust_project=trust_project,
@@ -20,7 +20,7 @@ from rich.progress import BarColumn, DownloadColumn, Progress, TextColumn, TimeR
20
20
  from rich.prompt import Confirm
21
21
  from rich.table import Table
22
22
 
23
- from lcode import __version__, backends, catalog, config, limits, web
23
+ from lcode import __version__, backends, catalog, config, limits, sessions, web
24
24
  from lcode.agent import Settings
25
25
  from lcode.catalog import ModelSpec
26
26
  from lcode.cloud import is_cloud, signin_command
@@ -553,6 +553,7 @@ def cmd_doctor(args) -> None:
553
553
 
554
554
  project, user = Memory(Path.cwd()).counts()
555
555
  line("Memory", f"{cfg['memory']} · {project} note(s) for this repository, {user} for every repository", True)
556
+ line("Sessions", sessions_status(Path.cwd()), True)
556
557
  node = shutil.which("npx")
557
558
  line("Node.js", "found" if node else "not found (some MCP servers need npx)", True if node else None)
558
559
  sys.exit(0 if ok else 1)
@@ -775,6 +776,14 @@ def exit_on_hangup() -> None:
775
776
  signal.signal(sig, leave)
776
777
 
777
778
 
779
+ def sessions_status(cwd: Path) -> str:
780
+ """How many conversations are saved, and where: a terminal with another LCODE_HOME or XDG_STATE_HOME has
781
+ other ones."""
782
+ listing = sessions.grouped(cwd, everything=True)
783
+ saved = len(listing.here) + len(listing.elsewhere)
784
+ return f"{saved} saved, {len(listing.here)} for this folder · in {sessions.sessions_dir()}"
785
+
786
+
778
787
  def comfyui_status(cfg: dict) -> tuple[str, bool | None]:
779
788
  """lcode doctor's ComfyUI line: running or found, and whether the image model is there."""
780
789
  from lcode import comfy
@@ -61,6 +61,11 @@ SETTINGS: dict[str, tuple[object, type, str]] = {
61
61
  "vision_model": ("auto", str, "model that looks at images: auto | off | an Ollama model with vision"),
62
62
  "mcp_tools": ("auto", str, "how MCP tools reach the model: auto | direct | search (on demand, saves context)"),
63
63
  "memory": ("ask", str, "notes that carry over to later sessions: off | ask (confirm each) | auto"),
64
+ "memory_check": (
65
+ False,
66
+ bool,
67
+ "when a conversation ends (quit, /clear, or before it's summarized), ask the model what's worth remembering",
68
+ ),
64
69
  "skills": ("all", str, "skills to offer the model: all (also other agents' folders) | lcode | off"),
65
70
  "repo_map": (True, bool, "give the model a ranked map of the repository's symbols"),
66
71
  "embed_model": ("auto", str, "embedding model for semantic code search (lcode index): auto | off | a model"),
@@ -15,13 +15,17 @@ repository, and `memory/projects/<repo>/` holds one repository's notes, shared b
15
15
  worktrees. The system prompt gets a one-line index of both, capped so it costs little context;
16
16
  the model reads a note's details with the memory tool.
17
17
 
18
- Notes come from three places: the model's memory tool, the user's /remember, and a short
19
- reflection when a session ends ("what from this session is worth remembering?"), because local
20
- models rarely save anything on their own.
18
+ Notes come from the model's memory tool and the user's /remember. With the memory_check setting on,
19
+ also from a short reflection when a session ends ("what from this session is worth remembering?"),
20
+ because local models rarely save anything on their own.
21
+
22
+ A repository's notes follow it when it's moved, renamed or cloned again: its folder holds a repo.json
23
+ naming the repository's first commit, and a checkout whose own folder has no notes finds them by it.
21
24
  """
22
25
 
23
26
  from __future__ import annotations
24
27
 
28
+ import contextlib
25
29
  import datetime as dt
26
30
  import difflib
27
31
  import hashlib
@@ -38,7 +42,7 @@ from rich.markup import escape
38
42
  from rich.panel import Panel
39
43
  from rich.text import Text
40
44
 
41
- from lcode import config
45
+ from lcode import config, repoid
42
46
  from lcode.frontmatter import split as frontmatter
43
47
 
44
48
  if TYPE_CHECKING:
@@ -175,9 +179,12 @@ def _git_common_dir(cwd: Path) -> Path | None:
175
179
  return (cwd / out).resolve()
176
180
 
177
181
 
178
- def project_dir(cwd: Path) -> Path:
179
- """Where the notes for the repository around `cwd` live: shared by its worktrees."""
180
- common = _git_common_dir(cwd)
182
+ IDENTITY = "repo.json" # in a repository's notes folder: which repository it is, by its first commit
183
+
184
+
185
+ def path_dir(cwd: Path, common: Path | None = None) -> Path:
186
+ """The notes folder named after where the repository (or folder) is: what lcode before 0.52 used."""
187
+ common = common or _git_common_dir(cwd)
181
188
  if common:
182
189
  root = common.parent if common.name == ".git" else common
183
190
  name, ident = root.name.removesuffix(".git"), common
@@ -187,6 +194,46 @@ def project_dir(cwd: Path) -> Path:
187
194
  return memory_dir() / "projects" / f"{slugify(name, 40) or 'folder'}-{key}"
188
195
 
189
196
 
197
+ def read_identity(folder: Path) -> str:
198
+ """The first commit a notes folder belongs to ("" if it doesn't say)."""
199
+ try:
200
+ data = json.loads((folder / IDENTITY).read_text())
201
+ except (OSError, ValueError):
202
+ return ""
203
+ return str(data.get("first") or "") if isinstance(data, dict) else ""
204
+
205
+
206
+ def write_identity(folder: Path, first: str, root: Path) -> None:
207
+ with contextlib.suppress(OSError):
208
+ _write_atomic(folder / IDENTITY, json.dumps({"first": first, "path": str(root)}, indent=1) + "\n")
209
+
210
+
211
+ def project_dir(cwd: Path) -> Path:
212
+ """Where the notes for the repository around `cwd` live: shared by its worktrees and every clone of it.
213
+
214
+ The folder named after the repository's place comes first, as older versions find it there. When that
215
+ folder has no notes, the repository may have moved or been cloned again: a folder whose repo.json names
216
+ the same first commit holds its notes."""
217
+ common = _git_common_dir(cwd)
218
+ here = path_dir(cwd, common)
219
+ if common is None:
220
+ return here # not a repository: notes for this folder
221
+ if here.is_dir() and read_identity(here):
222
+ return here
223
+ first = repoid.first_commit(cwd)
224
+ if not first:
225
+ return here
226
+ repo = repoid.find(cwd)
227
+ if here.is_dir(): # notes from before 0.52: say which repository they're for, so they follow it
228
+ write_identity(here, first, repo.root if repo else cwd)
229
+ return here
230
+ projects = memory_dir() / "projects"
231
+ elsewhere = [f for f in projects.iterdir() if f.is_dir() and read_identity(f) == first] if projects.is_dir() else []
232
+ if elsewhere: # the most recently used, if several clones had notes of their own
233
+ return max(elsewhere, key=lambda f: (f / "MEMORY.md").stat().st_mtime if (f / "MEMORY.md").exists() else 0)
234
+ return here
235
+
236
+
190
237
  def parse(text: str, scope: str, path: Path | None = None) -> Note | None:
191
238
  split = frontmatter(text)
192
239
  if not split:
@@ -293,7 +340,12 @@ class Memory:
293
340
  if existing and not note.details and existing.description == note.description:
294
341
  note = replace(note, details=existing.details)
295
342
  folder = self.folder(note.scope)
343
+ new_folder = not folder.is_dir()
296
344
  folder.mkdir(parents=True, exist_ok=True)
345
+ if new_folder and note.scope == "project":
346
+ repo = repoid.find(self.cwd)
347
+ if repo and repo.first:
348
+ write_identity(folder, repo.first, repo.root)
297
349
  path = folder / f"{note.name}.md"
298
350
  _write_atomic(path, note.render())
299
351
  self.write_index(note.scope)
@@ -471,7 +523,9 @@ def propose(agent: Agent) -> list[Note]:
471
523
 
472
524
  def reflect(agent: Agent) -> None:
473
525
  """At the end of a session (or before compaction): propose notes, then save the ones the user accepts."""
474
- if agent.settings.memory == "off" or not worth_reflecting(agent.messages, agent.reflected):
526
+ if agent.settings.memory == "off" or not agent.settings.memory_check:
527
+ return # off by default: quitting just saves the conversation
528
+ if not worth_reflecting(agent.messages, agent.reflected):
475
529
  return
476
530
  agent.reflected = len(agent.messages)
477
531
  c = agent.console