cli-mem 0.3.0__tar.gz → 0.3.1__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 (31) hide show
  1. {cli_mem-0.3.0 → cli_mem-0.3.1}/PKG-INFO +1 -1
  2. {cli_mem-0.3.0 → cli_mem-0.3.1}/pyproject.toml +1 -1
  3. {cli_mem-0.3.0 → cli_mem-0.3.1}/src/mem/__init__.py +1 -1
  4. {cli_mem-0.3.0 → cli_mem-0.3.1}/src/mem/patterns.py +11 -5
  5. {cli_mem-0.3.0 → cli_mem-0.3.1}/.github/workflows/ci.yml +0 -0
  6. {cli_mem-0.3.0 → cli_mem-0.3.1}/.github/workflows/release.yml +0 -0
  7. {cli_mem-0.3.0 → cli_mem-0.3.1}/.gitignore +0 -0
  8. {cli_mem-0.3.0 → cli_mem-0.3.1}/ARCHITECTURE.md +0 -0
  9. {cli_mem-0.3.0 → cli_mem-0.3.1}/LICENSE +0 -0
  10. {cli_mem-0.3.0 → cli_mem-0.3.1}/PHILOSOPHY.md +0 -0
  11. {cli_mem-0.3.0 → cli_mem-0.3.1}/README.md +0 -0
  12. {cli_mem-0.3.0 → cli_mem-0.3.1}/assets/.gitkeep +0 -0
  13. {cli_mem-0.3.0 → cli_mem-0.3.1}/docs/decisions/001-jsonl-over-sqlite.md +0 -0
  14. {cli_mem-0.3.0 → cli_mem-0.3.1}/docs/decisions/002-apple-fm-sdk-for-patterns.md +0 -0
  15. {cli_mem-0.3.0 → cli_mem-0.3.1}/docs/decisions/003-no-daemon.md +0 -0
  16. {cli_mem-0.3.0 → cli_mem-0.3.1}/docs/decisions/004-per-repo-jsonl.md +0 -0
  17. {cli_mem-0.3.0 → cli_mem-0.3.1}/hooks/mem.zsh +0 -0
  18. {cli_mem-0.3.0 → cli_mem-0.3.1}/install.sh +0 -0
  19. {cli_mem-0.3.0 → cli_mem-0.3.1}/src/mem/capture.py +0 -0
  20. {cli_mem-0.3.0 → cli_mem-0.3.1}/src/mem/cli.py +0 -0
  21. {cli_mem-0.3.0 → cli_mem-0.3.1}/src/mem/groups.py +0 -0
  22. {cli_mem-0.3.0 → cli_mem-0.3.1}/src/mem/models.py +0 -0
  23. {cli_mem-0.3.0 → cli_mem-0.3.1}/src/mem/search.py +0 -0
  24. {cli_mem-0.3.0 → cli_mem-0.3.1}/src/mem/storage.py +0 -0
  25. {cli_mem-0.3.0 → cli_mem-0.3.1}/src/mem/variables.py +0 -0
  26. {cli_mem-0.3.0 → cli_mem-0.3.1}/tests/conftest.py +0 -0
  27. {cli_mem-0.3.0 → cli_mem-0.3.1}/tests/test_capture.py +0 -0
  28. {cli_mem-0.3.0 → cli_mem-0.3.1}/tests/test_groups.py +0 -0
  29. {cli_mem-0.3.0 → cli_mem-0.3.1}/tests/test_patterns.py +0 -0
  30. {cli_mem-0.3.0 → cli_mem-0.3.1}/tests/test_search.py +0 -0
  31. {cli_mem-0.3.0 → cli_mem-0.3.1}/tests/test_storage.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cli-mem
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Privacy-first CLI that turns shell history into searchable memory
5
5
  Project-URL: GitHub, https://github.com/matinsaurralde/mem
6
6
  Author: Matias Insaurralde
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "cli-mem"
7
- version = "0.3.0"
7
+ version = "0.3.1"
8
8
  description = "Privacy-first CLI that turns shell history into searchable memory"
9
9
  license = "MIT"
10
10
  readme = "README.md"
@@ -1,3 +1,3 @@
1
1
  """mem — your shell history, understood."""
2
2
 
3
- __version__ = "0.3.0"
3
+ __version__ = "0.3.1"
@@ -95,18 +95,24 @@ async def _generalize_commands(tool: str, unique_commands: list[str]) -> dict[st
95
95
  """Generalize each unique command via Apple FM guided generation.
96
96
 
97
97
  Returns a mapping from concrete command -> generalized pattern.
98
- Uses one LanguageModelSession per tool to share context.
98
+ Uses a fresh session per command to avoid exceeding the on-device
99
+ model's context window when processing many commands.
99
100
  """
100
101
  import apple_fm_sdk as fm
101
102
 
102
103
  GeneralizedCommand = _get_generable_types()
103
- session = fm.LanguageModelSession()
104
104
  cmd_to_pattern: dict[str, str] = {}
105
105
 
106
106
  for cmd in unique_commands:
107
- prompt = GENERALIZE_PROMPT.format(tool=tool, command=cmd)
108
- result = await session.respond(prompt, generating=GeneralizedCommand)
109
- cmd_to_pattern[cmd] = result.pattern
107
+ try:
108
+ session = fm.LanguageModelSession()
109
+ prompt = GENERALIZE_PROMPT.format(tool=tool, command=cmd)
110
+ result = await session.respond(prompt, generating=GeneralizedCommand)
111
+ cmd_to_pattern[cmd] = result.pattern
112
+ except Exception:
113
+ # Skip commands that fail (too long, context issues, etc.)
114
+ # Fall back to the raw command as its own pattern.
115
+ cmd_to_pattern[cmd] = cmd
110
116
 
111
117
  return cmd_to_pattern
112
118
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes