mneme-cli 0.4.0__py3-none-any.whl

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.
mneme/__init__.py ADDED
@@ -0,0 +1,8 @@
1
+ """Mnemosyne - knowledge engine for documents.
2
+
3
+ Public API:
4
+ from mneme import core, config
5
+ from mneme.core import ingest_source_to_both, dual_search, ...
6
+ """
7
+
8
+ __version__ = "0.4.0"
mneme/__main__.py ADDED
@@ -0,0 +1,5 @@
1
+ """Allow `python -m mneme` to run the CLI."""
2
+ from .core import main
3
+
4
+ if __name__ == '__main__':
5
+ main()
mneme/config.py ADDED
@@ -0,0 +1,103 @@
1
+ """
2
+ Mnemosyne configuration and path resolution.
3
+
4
+ Two distinct roots:
5
+
6
+ * PACKAGE_DIR - where the installed mneme source lives. Bundled, read-only
7
+ assets (profile JSONs, the web UI HTML, workspace templates) are loaded
8
+ from here.
9
+
10
+ * WORKSPACE_DIR - where the user's data lives (wiki/, sources/, schema/,
11
+ memvid/, index.md, log.md). Resolved in this order:
12
+ 1. The MNEME_HOME environment variable, if set.
13
+ 2. The current working directory.
14
+
15
+ This means a single installed mneme CLI can serve many independent
16
+ workspaces. Each project (e.g. parkiwatch, cardio-monitor) is just a
17
+ directory; switch between them by `cd`-ing or by exporting MNEME_HOME.
18
+
19
+ `BASE_DIR` is preserved as an alias of WORKSPACE_DIR for backwards
20
+ compatibility with the rest of the codebase.
21
+ """
22
+
23
+ import os
24
+
25
+ # ---------------------------------------------------------------------------
26
+ # Package root (bundled assets)
27
+ # ---------------------------------------------------------------------------
28
+
29
+ PACKAGE_DIR = os.path.dirname(os.path.abspath(__file__))
30
+
31
+ # Bundled assets shipped with the package (read-only).
32
+ PROFILES_DIR = os.path.join(PACKAGE_DIR, 'profiles')
33
+ TEMPLATE_WORKSPACE_DIR = os.path.join(PACKAGE_DIR, 'templates', 'workspace')
34
+ UI_FILE = os.path.join(PACKAGE_DIR, 'ui.html')
35
+
36
+
37
+ # ---------------------------------------------------------------------------
38
+ # Workspace root (user data)
39
+ # ---------------------------------------------------------------------------
40
+
41
+ def _resolve_workspace() -> str:
42
+ home = os.environ.get('MNEME_HOME')
43
+ if home:
44
+ return os.path.abspath(os.path.expanduser(home))
45
+ return os.path.abspath(os.getcwd())
46
+
47
+
48
+ WORKSPACE_DIR = _resolve_workspace()
49
+
50
+ # Backwards-compatible alias. Older code (and most of core.py) still uses
51
+ # BASE_DIR; we treat it as the workspace root from now on.
52
+ BASE_DIR = WORKSPACE_DIR
53
+
54
+ WIKI_DIR = os.path.join(WORKSPACE_DIR, 'wiki')
55
+ SOURCES_DIR = os.path.join(WORKSPACE_DIR, 'sources')
56
+ SCHEMA_DIR = os.path.join(WORKSPACE_DIR, 'schema')
57
+ MEMVID_DIR = os.path.join(WORKSPACE_DIR, 'memvid')
58
+ MASTER_MV2 = os.path.join(MEMVID_DIR, 'master.mv2')
59
+ PER_CLIENT_DIR = os.path.join(MEMVID_DIR, 'per-client')
60
+ INDEX_FILE = os.path.join(WORKSPACE_DIR, 'index.md')
61
+ LOG_FILE = os.path.join(WORKSPACE_DIR, 'log.md')
62
+ TEMPLATES_DIR = os.path.join(WIKI_DIR, '_templates')
63
+ TRACEABILITY_FILE = os.path.join(SCHEMA_DIR, 'traceability.json')
64
+ ACTIVE_PROFILE_FILE = os.path.join(WORKSPACE_DIR, '.mneme-profile')
65
+
66
+ # Workspace-local profile overrides. Profiles dropped here shadow the bundled
67
+ # ones with the same name. Per-project frameworks (e.g. an internal QMS variant)
68
+ # go here so they don't need to be packaged with mneme.
69
+ WORKSPACE_PROFILES_DIR = os.path.join(WORKSPACE_DIR, 'profiles')
70
+ WORKSPACE_MAPPINGS_DIR = os.path.join(WORKSPACE_PROFILES_DIR, 'mappings')
71
+
72
+
73
+ # ---------------------------------------------------------------------------
74
+ # Tunables
75
+ # ---------------------------------------------------------------------------
76
+
77
+ # Excluded from sync
78
+ EXCLUDED_DIRS = ['_templates', '.baselines']
79
+ EXCLUDED_FILES = ['_meta.yaml']
80
+
81
+ # Chunk settings for memvid
82
+ MAX_CHUNK_SIZE = 500 # characters per Smart Frame
83
+ MIN_CHUNK_SIZE = 50 # don't create tiny frames
84
+
85
+ # Ingest limits to prevent hangs on huge files
86
+ MAX_CHUNKS_PER_INGEST = 200 # hard cap on chunks sent to memvid per page
87
+ CHUNK_COMMIT_BATCH = 50 # commit to memvid every N chunks
88
+
89
+ # Entity extraction stopwords
90
+ ENTITY_STOPWORDS = {
91
+ 'key facts', 'open questions', 'page title', 'page types', 'special files',
92
+ 'client directories', 'cross references', 'source summary', 'detail section',
93
+ 'wiki page', 'wiki pages', 'wiki protocol', 'knowledge engine', 'mnemosyne', 'mneme', 'summary section',
94
+ 'how to', 'last updated', 'activity log', 'health report', 'action plan',
95
+ 'executive summary', 'final verdict', 'risk scorecard', 'prior art',
96
+ 'patent strategy', 'filing strategy', 'negotiation strategy',
97
+ 'competitive landscape', 'technology stack', 'bill of materials',
98
+ 'system architecture', 'operating principle', 'performance analysis',
99
+ 'technical specifications', 'environmental conditions', 'safety compliance',
100
+ 'target market', 'intended use', 'design rationale', 'component photographs',
101
+ 'novelty and inventive step', 'background and technical', 'thermal and electrical',
102
+ 'prefer anglo', 'total pages', 'recent activity',
103
+ }