memgentic 0.4.4__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 (105) hide show
  1. memgentic-0.4.4/.gitignore +58 -0
  2. memgentic-0.4.4/PKG-INFO +62 -0
  3. memgentic-0.4.4/SKILL.md +195 -0
  4. memgentic-0.4.4/hooks/__init__.py +6 -0
  5. memgentic-0.4.4/hooks/install.py +79 -0
  6. memgentic-0.4.4/hooks/session_start.py +54 -0
  7. memgentic-0.4.4/hooks/user_prompt_submit.py +22 -0
  8. memgentic-0.4.4/memgentic/__init__.py +7 -0
  9. memgentic-0.4.4/memgentic/__version__.py +1 -0
  10. memgentic-0.4.4/memgentic/adapters/__init__.py +62 -0
  11. memgentic-0.4.4/memgentic/adapters/aider.py +191 -0
  12. memgentic-0.4.4/memgentic/adapters/antigravity.py +308 -0
  13. memgentic-0.4.4/memgentic/adapters/base.py +157 -0
  14. memgentic-0.4.4/memgentic/adapters/chatgpt_import.py +268 -0
  15. memgentic-0.4.4/memgentic/adapters/claude_code.py +281 -0
  16. memgentic-0.4.4/memgentic/adapters/claude_web_import.py +208 -0
  17. memgentic-0.4.4/memgentic/adapters/codex_cli.py +180 -0
  18. memgentic-0.4.4/memgentic/adapters/copilot_cli.py +189 -0
  19. memgentic-0.4.4/memgentic/adapters/cursor.py +191 -0
  20. memgentic-0.4.4/memgentic/adapters/gemini_cli.py +208 -0
  21. memgentic-0.4.4/memgentic/cli.py +1658 -0
  22. memgentic-0.4.4/memgentic/config.py +256 -0
  23. memgentic-0.4.4/memgentic/daemon/__init__.py +5 -0
  24. memgentic-0.4.4/memgentic/daemon/watcher.py +311 -0
  25. memgentic-0.4.4/memgentic/events.py +96 -0
  26. memgentic-0.4.4/memgentic/exceptions.py +21 -0
  27. memgentic-0.4.4/memgentic/graph/__init__.py +1 -0
  28. memgentic-0.4.4/memgentic/graph/knowledge.py +286 -0
  29. memgentic-0.4.4/memgentic/graph/search.py +210 -0
  30. memgentic-0.4.4/memgentic/init_wizard.py +392 -0
  31. memgentic-0.4.4/memgentic/mcp/__init__.py +1 -0
  32. memgentic-0.4.4/memgentic/mcp/server.py +1343 -0
  33. memgentic-0.4.4/memgentic/models.py +424 -0
  34. memgentic-0.4.4/memgentic/observability/__init__.py +136 -0
  35. memgentic-0.4.4/memgentic/processing/__init__.py +6 -0
  36. memgentic-0.4.4/memgentic/processing/consolidation.py +156 -0
  37. memgentic-0.4.4/memgentic/processing/context_generator.py +163 -0
  38. memgentic-0.4.4/memgentic/processing/corroboration.py +72 -0
  39. memgentic-0.4.4/memgentic/processing/embedder.py +211 -0
  40. memgentic-0.4.4/memgentic/processing/file_ingest.py +322 -0
  41. memgentic-0.4.4/memgentic/processing/heuristics.py +506 -0
  42. memgentic-0.4.4/memgentic/processing/intelligence.py +709 -0
  43. memgentic-0.4.4/memgentic/processing/llm.py +133 -0
  44. memgentic-0.4.4/memgentic/processing/pipeline.py +533 -0
  45. memgentic-0.4.4/memgentic/processing/query.py +120 -0
  46. memgentic-0.4.4/memgentic/processing/scrubber.py +147 -0
  47. memgentic-0.4.4/memgentic/processing/search_basic.py +57 -0
  48. memgentic-0.4.4/memgentic/processing/skill_extractor.py +197 -0
  49. memgentic-0.4.4/memgentic/processing/utils.py +30 -0
  50. memgentic-0.4.4/memgentic/skills/__init__.py +6 -0
  51. memgentic-0.4.4/memgentic/skills/distributor.py +165 -0
  52. memgentic-0.4.4/memgentic/skills/importer.py +428 -0
  53. memgentic-0.4.4/memgentic/storage/__init__.py +6 -0
  54. memgentic-0.4.4/memgentic/storage/metadata.py +1404 -0
  55. memgentic-0.4.4/memgentic/storage/migrations.py +203 -0
  56. memgentic-0.4.4/memgentic/storage/vectors.py +275 -0
  57. memgentic-0.4.4/memgentic/system_info.py +212 -0
  58. memgentic-0.4.4/memgentic/templates/__init__.py +0 -0
  59. memgentic-0.4.4/memgentic/templates/memory_instructions.md +19 -0
  60. memgentic-0.4.4/memgentic/utils/__init__.py +1 -0
  61. memgentic-0.4.4/memgentic/utils/process_lock.py +47 -0
  62. memgentic-0.4.4/pyproject.toml +130 -0
  63. memgentic-0.4.4/tests/__init__.py +0 -0
  64. memgentic-0.4.4/tests/conftest.py +123 -0
  65. memgentic-0.4.4/tests/test_aider_adapter.py +158 -0
  66. memgentic-0.4.4/tests/test_antigravity_adapter.py +344 -0
  67. memgentic-0.4.4/tests/test_benchmarks.py +160 -0
  68. memgentic-0.4.4/tests/test_briefing.py +166 -0
  69. memgentic-0.4.4/tests/test_chatgpt_adapter.py +380 -0
  70. memgentic-0.4.4/tests/test_claude_code_adapter.py +199 -0
  71. memgentic-0.4.4/tests/test_claude_web_adapter.py +231 -0
  72. memgentic-0.4.4/tests/test_cli.py +806 -0
  73. memgentic-0.4.4/tests/test_codex_cli_adapter.py +172 -0
  74. memgentic-0.4.4/tests/test_collections.py +186 -0
  75. memgentic-0.4.4/tests/test_consolidation.py +308 -0
  76. memgentic-0.4.4/tests/test_copilot_cli_adapter.py +176 -0
  77. memgentic-0.4.4/tests/test_corroboration.py +186 -0
  78. memgentic-0.4.4/tests/test_cursor_adapter.py +107 -0
  79. memgentic-0.4.4/tests/test_daemon.py +500 -0
  80. memgentic-0.4.4/tests/test_edge_cases.py +476 -0
  81. memgentic-0.4.4/tests/test_embedder.py +371 -0
  82. memgentic-0.4.4/tests/test_exceptions.py +48 -0
  83. memgentic-0.4.4/tests/test_gemini_cli_adapter.py +195 -0
  84. memgentic-0.4.4/tests/test_hybrid_search.py +251 -0
  85. memgentic-0.4.4/tests/test_init_wizard.py +288 -0
  86. memgentic-0.4.4/tests/test_integration.py +1014 -0
  87. memgentic-0.4.4/tests/test_intelligence.py +194 -0
  88. memgentic-0.4.4/tests/test_intelligence_activation.py +756 -0
  89. memgentic-0.4.4/tests/test_intelligence_heuristics.py +229 -0
  90. memgentic-0.4.4/tests/test_knowledge_graph.py +97 -0
  91. memgentic-0.4.4/tests/test_llm_client.py +160 -0
  92. memgentic-0.4.4/tests/test_mcp_server.py +632 -0
  93. memgentic-0.4.4/tests/test_metadata_store.py +272 -0
  94. memgentic-0.4.4/tests/test_models.py +91 -0
  95. memgentic-0.4.4/tests/test_noise_filtering.py +65 -0
  96. memgentic-0.4.4/tests/test_observability.py +64 -0
  97. memgentic-0.4.4/tests/test_pins.py +139 -0
  98. memgentic-0.4.4/tests/test_pipeline.py +313 -0
  99. memgentic-0.4.4/tests/test_process_lock.py +47 -0
  100. memgentic-0.4.4/tests/test_query_intent.py +89 -0
  101. memgentic-0.4.4/tests/test_scrubber.py +128 -0
  102. memgentic-0.4.4/tests/test_search_relevance.py +212 -0
  103. memgentic-0.4.4/tests/test_skill_distributor.py +215 -0
  104. memgentic-0.4.4/tests/test_skills_store.py +185 -0
  105. memgentic-0.4.4/tests/test_vector_store.py +167 -0
@@ -0,0 +1,58 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .eggs/
8
+
9
+ # Virtual environments
10
+ .venv/
11
+ venv/
12
+
13
+ # UV
14
+ # uv.lock is tracked for reproducible builds
15
+
16
+ # Environment
17
+ .env
18
+
19
+ # Claude Code
20
+ .claude/
21
+
22
+ # IDE
23
+ .vscode/
24
+ .idea/
25
+ *.swp
26
+ *.swo
27
+
28
+ # OS
29
+ .DS_Store
30
+ Thumbs.db
31
+
32
+ # Memgentic data (local development)
33
+ *.db
34
+ data/
35
+ .memgentic/
36
+
37
+ # Backup archives
38
+ *.tar.gz
39
+
40
+ # Docker
41
+ docker-compose.override.yml
42
+
43
+ # Testing
44
+ .pytest_cache/
45
+ .coverage
46
+ htmlcov/
47
+
48
+ # Playwright
49
+ .playwright-mcp/
50
+
51
+ # Private/internal working docs (not for public repo)
52
+ cloud/
53
+ .mneme/
54
+
55
+ # Rust
56
+ target/
57
+ Cargo.lock
58
+ !memgentic-native/Cargo.lock
@@ -0,0 +1,62 @@
1
+ Metadata-Version: 2.4
2
+ Name: memgentic
3
+ Version: 0.4.4
4
+ Summary: Universal AI memory layer — cross-tool knowledge capture with MCP, semantic search, and knowledge graphs
5
+ Project-URL: Homepage, https://github.com/Chariton-kyp/memgentic
6
+ Project-URL: Repository, https://github.com/Chariton-kyp/memgentic
7
+ Project-URL: Issues, https://github.com/Chariton-kyp/memgentic/issues
8
+ Author-email: Chariton Kypraios <chariton@ellinai.com>
9
+ License-Expression: Apache-2.0
10
+ Keywords: ai,claude,codex,gemini,knowledge-graph,mcp,memory,rag,semantic-search
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
16
+ Requires-Python: >=3.12
17
+ Requires-Dist: aiosqlite>=0.22
18
+ Requires-Dist: click>=8.1
19
+ Requires-Dist: httpx>=0.28
20
+ Requires-Dist: mcp[cli]>=1.26
21
+ Requires-Dist: pydantic-settings>=2.10
22
+ Requires-Dist: pydantic>=2.12
23
+ Requires-Dist: python-dotenv>=1.0
24
+ Requires-Dist: qdrant-client>=1.17
25
+ Requires-Dist: rich>=14.0
26
+ Requires-Dist: structlog>=25.0
27
+ Requires-Dist: tenacity>=9.0
28
+ Requires-Dist: watchdog>=6.0
29
+ Provides-Extra: dev
30
+ Requires-Dist: google-genai>=1.50; extra == 'dev'
31
+ Requires-Dist: langchain-anthropic>=1.0; extra == 'dev'
32
+ Requires-Dist: langchain-core>=1.2; extra == 'dev'
33
+ Requires-Dist: langchain-google-genai>=4.0; extra == 'dev'
34
+ Requires-Dist: langchain-ollama>=0.3; extra == 'dev'
35
+ Requires-Dist: langgraph>=1.1; extra == 'dev'
36
+ Requires-Dist: networkx>=3.4; extra == 'dev'
37
+ Requires-Dist: pyright>=1.1; extra == 'dev'
38
+ Requires-Dist: pytest-asyncio>=1.0; extra == 'dev'
39
+ Requires-Dist: pytest-cov>=6.0; extra == 'dev'
40
+ Requires-Dist: pytest>=9.0; extra == 'dev'
41
+ Requires-Dist: ruff>=0.14; extra == 'dev'
42
+ Provides-Extra: documents
43
+ Requires-Dist: ebooklib>=0.18; extra == 'documents'
44
+ Requires-Dist: openpyxl>=3.1; extra == 'documents'
45
+ Requires-Dist: pdfminer-six>=20231228; extra == 'documents'
46
+ Requires-Dist: python-docx>=1.1; extra == 'documents'
47
+ Requires-Dist: python-pptx>=1.0; extra == 'documents'
48
+ Requires-Dist: striprtf>=0.0.26; extra == 'documents'
49
+ Provides-Extra: intelligence
50
+ Requires-Dist: google-genai>=1.50; extra == 'intelligence'
51
+ Requires-Dist: langchain-anthropic>=1.0; extra == 'intelligence'
52
+ Requires-Dist: langchain-core>=1.2; extra == 'intelligence'
53
+ Requires-Dist: langchain-google-genai>=4.0; extra == 'intelligence'
54
+ Requires-Dist: langchain-ollama>=0.3; extra == 'intelligence'
55
+ Requires-Dist: langgraph>=1.1; extra == 'intelligence'
56
+ Requires-Dist: networkx>=3.4; extra == 'intelligence'
57
+ Provides-Extra: observability
58
+ Requires-Dist: opentelemetry-api>=1.28; extra == 'observability'
59
+ Requires-Dist: opentelemetry-exporter-otlp>=1.28; extra == 'observability'
60
+ Requires-Dist: opentelemetry-instrumentation-httpx>=0.49; extra == 'observability'
61
+ Requires-Dist: opentelemetry-instrumentation-sqlite3>=0.49; extra == 'observability'
62
+ Requires-Dist: opentelemetry-sdk>=1.28; extra == 'observability'
@@ -0,0 +1,195 @@
1
+ ---
2
+ name: memgentic
3
+ description: >-
4
+ Universal AI memory — recall past decisions, learnings, and context
5
+ from all your AI conversations (Claude Code, Gemini CLI, ChatGPT, Aider, etc.)
6
+ context: fork
7
+ ---
8
+
9
+ # Memgentic — Universal AI Memory Layer
10
+
11
+ Memgentic captures knowledge from all your AI tools and makes it searchable.
12
+ Every memory carries full provenance: which tool, which session, when it happened.
13
+
14
+ ## When to Use
15
+
16
+ Search memory **before** doing work, not after:
17
+
18
+ - **Starting a new task** — Check for prior decisions, context, or related work.
19
+ - **Making architectural decisions** — Check if this was discussed before.
20
+ - **Debugging** — Search for related past issues and solutions.
21
+ - **User asks about history** — "what did we decide about...", "remember when...",
22
+ "how did we handle..."
23
+ - **Encountering unfamiliar code** — Check for context on why it was written that way.
24
+ - **Setting up or configuring something** — Check for user preferences and conventions.
25
+
26
+ When in doubt, search. It costs little and prevents repeated work.
27
+
28
+ ## CLI Commands
29
+
30
+ ### Semantic Search (primary)
31
+
32
+ ```bash
33
+ # Search memories by meaning
34
+ memgentic search "database migration strategy"
35
+
36
+ # Compact output — fewer tokens, good for scanning
37
+ memgentic search "database migration strategy" --format compact
38
+
39
+ # Filter by platform
40
+ memgentic search "auth implementation" -s claude_code
41
+ memgentic search "API design" -s chatgpt
42
+
43
+ # Filter by content type
44
+ memgentic search "why we chose PostgreSQL" -t decision
45
+ memgentic search "user coding style" -t preference
46
+ ```
47
+
48
+ ### Store a Memory
49
+
50
+ ```bash
51
+ # Save an important fact or decision
52
+ memgentic remember "We chose Qdrant over Pinecone for local-first vector storage"
53
+
54
+ # Memory type is auto-classified from content
55
+ memgentic remember "Always use UV for package management"
56
+ ```
57
+
58
+ ### Other Commands
59
+
60
+ ```bash
61
+ # See which platforms have memories and how many
62
+ memgentic sources
63
+
64
+ # Generate standalone context file with recent activity
65
+ memgentic update-context
66
+
67
+ # Explore knowledge graph around an entity
68
+ memgentic graph "authentication"
69
+
70
+ # Check system health
71
+ memgentic doctor
72
+ ```
73
+
74
+ ## MCP Tools
75
+
76
+ If the Memgentic MCP server is running, these tools are available directly:
77
+
78
+ | Tool | Purpose |
79
+ |------|---------|
80
+ | `memgentic_recall` | Semantic search with source filtering |
81
+ | `memgentic_remember` | Store a new memory |
82
+ | `memgentic_search` | Full-text keyword search |
83
+ | `memgentic_recent` | Recent memories by timestamp |
84
+ | `memgentic_briefing` | Cross-agent briefing of recent activity |
85
+ | `memgentic_sources` | List platforms and memory counts |
86
+ | `memgentic_configure_session` | Set session-level source filters |
87
+ | `memgentic_stats` | Memory statistics and analytics |
88
+ | `memgentic_forget` | Archive (soft-delete) a memory |
89
+ | `memgentic_export` | Export memories as JSON |
90
+
91
+ ### MCP Examples
92
+
93
+ ```
94
+ memgentic_recall(query="authentication flow", limit=5)
95
+ memgentic_recall(query="auth", sources=["claude_code", "chatgpt"])
96
+ memgentic_remember(content="Project uses JWT with refresh tokens", memory_type="decision")
97
+ memgentic_search(query="PostgreSQL", content_type="decision")
98
+ memgentic_configure_session(exclude_sources=["codex_cli"])
99
+ memgentic_briefing(hours=24)
100
+ ```
101
+
102
+ ## Efficient Retrieval Strategy
103
+
104
+ Minimize token usage with a progressive approach:
105
+
106
+ 1. **Start compact** — Use `--format compact` for an overview of what exists.
107
+ 2. **Narrow down** — Add platform filter (`-s claude_code`) or type filter (`-t decision`)
108
+ when you know what you are looking for.
109
+ 3. **Full detail** — Drop `--format compact` only when you need the complete memory content.
110
+ 4. **Limit results** — Use `--limit` to cap the number of results returned.
111
+
112
+ ```bash
113
+ # Step 1: Quick scan
114
+ memgentic search "deployment" --format compact --limit 10
115
+
116
+ # Step 2: Found relevant results, get details from a specific platform
117
+ memgentic search "deployment" -s claude_code --limit 3
118
+ ```
119
+
120
+ ## Memory Types
121
+
122
+ Memories are classified into types for filtering:
123
+
124
+ | Type | Contains |
125
+ |------|----------|
126
+ | `decision` | Architectural and technical decisions with rationale |
127
+ | `learning` | Things learned during development |
128
+ | `preference` | User preferences, conventions, coding style |
129
+ | `fact` | General knowledge and project context |
130
+ | `bug_fix` | Bug fixes, root causes, and solutions |
131
+ | `conversation_summary` | Summaries of complete sessions |
132
+
133
+ Filter by type to get precise results:
134
+
135
+ ```bash
136
+ memgentic search "database" -t decision # Only decisions about databases
137
+ memgentic search "testing" -t preference # Only testing preferences
138
+ memgentic search "auth" -t bug_fix # Only auth-related bug fixes
139
+ ```
140
+
141
+ ## Cross-Platform Context
142
+
143
+ Memgentic captures from multiple AI tools. Each memory records its source platform:
144
+
145
+ | Platform | Source ID |
146
+ |----------|-----------|
147
+ | Claude Code | `claude_code` |
148
+ | Gemini CLI | `gemini_cli` |
149
+ | ChatGPT | `chatgpt` |
150
+ | Aider | `aider` |
151
+ | Codex CLI | `codex_cli` |
152
+ | Copilot CLI | `copilot_cli` |
153
+ | Claude Web/Desktop | `claude_web` |
154
+ | Antigravity | `antigravity` |
155
+
156
+ Use source filtering to scope searches:
157
+
158
+ ```bash
159
+ # What did we discuss in Claude Code about this project?
160
+ memgentic search "project architecture" -s claude_code
161
+
162
+ # What did ChatGPT suggest about this topic?
163
+ memgentic search "caching strategy" -s chatgpt
164
+
165
+ # See all available sources
166
+ memgentic sources
167
+ ```
168
+
169
+ ## Capture Methods
170
+
171
+ Memories enter the system through:
172
+
173
+ - **auto_daemon** — File watcher captures conversations automatically in the background.
174
+ - **mcp_tool** — Stored via MCP tool calls during AI sessions.
175
+ - **cli** — Manually saved via `memgentic remember`.
176
+ - **json_import** — Bulk imported from conversation exports (ChatGPT, Claude Web).
177
+
178
+ ## Setup
179
+
180
+ ```bash
181
+ # Check prerequisites
182
+ memgentic doctor
183
+
184
+ # Interactive setup (model selection, configuration)
185
+ memgentic setup
186
+
187
+ # Import existing conversations from all detected AI tools
188
+ memgentic import-existing
189
+
190
+ # Start background capture daemon
191
+ memgentic daemon
192
+
193
+ # Start MCP server for AI tool integration
194
+ memgentic serve
195
+ ```
@@ -0,0 +1,6 @@
1
+ """Memgentic hooks for Claude Code integration.
2
+
3
+ Shell hooks that auto-inject memory context into Claude Code sessions:
4
+ - UserPromptSubmit: searches for relevant memories on each prompt
5
+ - SessionStart: injects recent cross-tool activity summary
6
+ """
@@ -0,0 +1,79 @@
1
+ """Install Memgentic hooks into Claude Code settings.
2
+
3
+ Adds a SessionStart hook that injects recent memory context at the
4
+ beginning of each session. No UserPromptSubmit hook — memory retrieval
5
+ is pull-based via MCP tools and SKILL.md subagent.
6
+
7
+ Usage:
8
+ python -m memgentic.hooks.install [--global]
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import json
14
+ import sys
15
+ from pathlib import Path
16
+
17
+
18
+ def get_hook_commands() -> dict[str, str]:
19
+ """Return hook event -> command mappings."""
20
+ hooks_dir = Path(__file__).parent.resolve()
21
+ python = sys.executable
22
+ return {
23
+ "SessionStart": f'"{python}" "{hooks_dir / "session_start.py"}"',
24
+ }
25
+
26
+
27
+ def install_hooks(settings_path: Path) -> None:
28
+ """Add Memgentic hooks to a Claude Code settings file."""
29
+ if settings_path.exists():
30
+ data = json.loads(settings_path.read_text(encoding="utf-8"))
31
+ else:
32
+ settings_path.parent.mkdir(parents=True, exist_ok=True)
33
+ data = {}
34
+
35
+ hooks = data.setdefault("hooks", {})
36
+ commands = get_hook_commands()
37
+
38
+ for event, command in commands.items():
39
+ event_hooks = hooks.setdefault(event, [])
40
+
41
+ # Check if already installed
42
+ already = False
43
+ for matcher in event_hooks:
44
+ for h in matcher.get("hooks", []):
45
+ if "memgentic" in h.get("command", ""):
46
+ already = True
47
+ break
48
+
49
+ if already:
50
+ print(f" {event}: already installed")
51
+ continue
52
+
53
+ event_hooks.append(
54
+ {
55
+ "hooks": [{"type": "command", "command": command}],
56
+ }
57
+ )
58
+ print(f" {event}: installed")
59
+
60
+ settings_path.write_text(json.dumps(data, indent=2, ensure_ascii=False), encoding="utf-8")
61
+ print(f"\nSettings saved to: {settings_path}")
62
+
63
+
64
+ def main() -> None:
65
+ use_global = "--global" in sys.argv
66
+
67
+ if use_global:
68
+ settings_path = Path.home() / ".claude" / "settings.json"
69
+ print("Installing Memgentic hooks globally...")
70
+ else:
71
+ settings_path = Path.cwd() / ".claude" / "settings.json"
72
+ print("Installing Memgentic hooks for this project...")
73
+
74
+ install_hooks(settings_path)
75
+ print("\nDone. Restart Claude Code to activate hooks.")
76
+
77
+
78
+ if __name__ == "__main__":
79
+ main()
@@ -0,0 +1,54 @@
1
+ """SessionStart hook — inject compact memory briefing into Claude's context.
2
+
3
+ Runs once when a new Claude Code session starts. Queries SQLite directly
4
+ for recent memories and outputs JSON with additionalContext for silent
5
+ injection. No Ollama/embedding dependency — just a database read.
6
+
7
+ Output format: Claude Code hookSpecificOutput.additionalContext (silent).
8
+ Timeout: if anything fails, outputs nothing (safe degradation).
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import asyncio
14
+ import json
15
+ import sys
16
+
17
+
18
+ def main() -> None:
19
+ try:
20
+ briefing = asyncio.run(asyncio.wait_for(_get_briefing(), timeout=3.0))
21
+ if briefing:
22
+ output = {
23
+ "hookSpecificOutput": {
24
+ "additionalContext": (
25
+ "## Memgentic Memory Context\n\n"
26
+ + briefing
27
+ + "\n\nUse memgentic_recall(query) for detailed memory search."
28
+ )
29
+ }
30
+ }
31
+ json.dump(output, sys.stdout)
32
+ except Exception:
33
+ pass # Silent failure — no output means no injection
34
+
35
+
36
+ async def _get_briefing() -> str:
37
+ from memgentic.config import settings
38
+ from memgentic.processing.context_generator import generate_briefing
39
+ from memgentic.storage.metadata import MetadataStore
40
+
41
+ metadata_store = MetadataStore(settings.sqlite_path)
42
+ await metadata_store.initialize()
43
+ try:
44
+ return await generate_briefing(
45
+ metadata_store,
46
+ hours=settings.hook_briefing_hours,
47
+ limit=settings.hook_briefing_limit,
48
+ )
49
+ finally:
50
+ await metadata_store.close()
51
+
52
+
53
+ if __name__ == "__main__":
54
+ main()
@@ -0,0 +1,22 @@
1
+ """UserPromptSubmit hook — lightweight memory availability nudge.
2
+
3
+ Does NOT perform search (that would add 2-5s latency per prompt).
4
+ Instead, outputs a minimal systemMessage reminding Claude that
5
+ memory tools are available. Actual search happens via MCP tools
6
+ or SKILL.md subagent when Claude decides it needs context.
7
+
8
+ This matches the memsearch pattern: nudge, don't search.
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+
14
+ def main() -> None:
15
+ # Intentionally empty — no per-prompt overhead.
16
+ # Memory retrieval is pull-based via MCP tools and SKILL.md.
17
+ # The SessionStart hook already provides initial context.
18
+ pass
19
+
20
+
21
+ if __name__ == "__main__":
22
+ main()
@@ -0,0 +1,7 @@
1
+ """Memgentic — Universal AI Memory Layer.
2
+
3
+ Zero-effort knowledge capture across all AI tools.
4
+ Source-aware memory with semantic search, filtering, and knowledge graphs.
5
+ """
6
+
7
+ __version__ = "0.1.0"
@@ -0,0 +1 @@
1
+ __version__ = "0.4.4"
@@ -0,0 +1,62 @@
1
+ """Memgentic adapters — parse conversations from different AI tools.
2
+
3
+ Provides a registry of all available adapters for daemon watching
4
+ and bulk import operations.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from memgentic.adapters.aider import AiderAdapter
10
+ from memgentic.adapters.antigravity import AntigravityAdapter
11
+ from memgentic.adapters.base import BaseAdapter
12
+ from memgentic.adapters.chatgpt_import import ChatGPTImportAdapter
13
+ from memgentic.adapters.claude_code import ClaudeCodeAdapter
14
+ from memgentic.adapters.claude_web_import import ClaudeWebImportAdapter
15
+ from memgentic.adapters.codex_cli import CodexCliAdapter
16
+ from memgentic.adapters.copilot_cli import CopilotCliAdapter
17
+ from memgentic.adapters.cursor import CursorAdapter
18
+ from memgentic.adapters.gemini_cli import GeminiCliAdapter
19
+
20
+ __all__ = [
21
+ "AiderAdapter",
22
+ "AntigravityAdapter",
23
+ "BaseAdapter",
24
+ "ChatGPTImportAdapter",
25
+ "ClaudeCodeAdapter",
26
+ "ClaudeWebImportAdapter",
27
+ "CodexCliAdapter",
28
+ "CopilotCliAdapter",
29
+ "CursorAdapter",
30
+ "GeminiCliAdapter",
31
+ "get_daemon_adapters",
32
+ "get_import_adapters",
33
+ ]
34
+
35
+
36
+ def get_daemon_adapters() -> list[BaseAdapter]:
37
+ """Get adapters that support file-watching (have watch_paths).
38
+
39
+ These are used by the daemon to monitor directories for new conversations.
40
+ Aider is excluded — it has no fixed watch_paths (project-specific).
41
+ """
42
+ return [
43
+ ClaudeCodeAdapter(),
44
+ GeminiCliAdapter(),
45
+ CodexCliAdapter(),
46
+ CopilotCliAdapter(),
47
+ AntigravityAdapter(),
48
+ ]
49
+
50
+
51
+ def get_import_adapters() -> list[BaseAdapter]:
52
+ """Get all adapters including import-only ones.
53
+
54
+ Import-only adapters (no watch_paths) are used by the import-existing
55
+ command and the REST API import endpoints.
56
+ """
57
+ return get_daemon_adapters() + [
58
+ AiderAdapter(),
59
+ ChatGPTImportAdapter(),
60
+ ClaudeWebImportAdapter(),
61
+ CursorAdapter(),
62
+ ]