reql 0.1.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 (154) hide show
  1. reql-0.1.0/LICENSE +21 -0
  2. reql-0.1.0/PKG-INFO +473 -0
  3. reql-0.1.0/README.md +406 -0
  4. reql-0.1.0/pyproject.toml +100 -0
  5. reql-0.1.0/setup.cfg +4 -0
  6. reql-0.1.0/src/agents/__init__.py +5 -0
  7. reql-0.1.0/src/agents/gen-skill.py +964 -0
  8. reql-0.1.0/src/agents/install.py +916 -0
  9. reql-0.1.0/src/agents/py.typed +1 -0
  10. reql-0.1.0/src/api/__init__.py +27 -0
  11. reql-0.1.0/src/api/memory_graph.py +660 -0
  12. reql-0.1.0/src/mcp/__init__.py +10 -0
  13. reql-0.1.0/src/mcp/server.py +269 -0
  14. reql-0.1.0/src/mcp/tools.py +774 -0
  15. reql-0.1.0/src/memory/__init__.py +24 -0
  16. reql-0.1.0/src/memory/analysis/__init__.py +22 -0
  17. reql-0.1.0/src/memory/analysis/bridge_detection.py +285 -0
  18. reql-0.1.0/src/memory/analysis/centrality.py +123 -0
  19. reql-0.1.0/src/memory/analysis/communities.py +188 -0
  20. reql-0.1.0/src/memory/analysis/hubs.py +228 -0
  21. reql-0.1.0/src/memory/analysis/specificity.py +123 -0
  22. reql-0.1.0/src/memory/artifacts/__init__.py +60 -0
  23. reql-0.1.0/src/memory/artifacts/cache.py +367 -0
  24. reql-0.1.0/src/memory/artifacts/compiler.py +2764 -0
  25. reql-0.1.0/src/memory/artifacts/context_scope.py +19 -0
  26. reql-0.1.0/src/memory/artifacts/delta.py +128 -0
  27. reql-0.1.0/src/memory/artifacts/fingerprint.py +75 -0
  28. reql-0.1.0/src/memory/artifacts/ignore.py +117 -0
  29. reql-0.1.0/src/memory/artifacts/mime.py +148 -0
  30. reql-0.1.0/src/memory/artifacts/models.py +122 -0
  31. reql-0.1.0/src/memory/artifacts/project.py +438 -0
  32. reql-0.1.0/src/memory/artifacts/scanner.py +196 -0
  33. reql-0.1.0/src/memory/cli.py +1049 -0
  34. reql-0.1.0/src/memory/code_analysis/__init__.py +34 -0
  35. reql-0.1.0/src/memory/code_analysis/base.py +353 -0
  36. reql-0.1.0/src/memory/code_analysis/catalog.py +164 -0
  37. reql-0.1.0/src/memory/code_analysis/factory.py +88 -0
  38. reql-0.1.0/src/memory/code_analysis/graph_utils.py +21 -0
  39. reql-0.1.0/src/memory/code_analysis/languages/__init__.py +73 -0
  40. reql-0.1.0/src/memory/code_analysis/languages/apex.py +19 -0
  41. reql-0.1.0/src/memory/code_analysis/languages/bash.py +20 -0
  42. reql-0.1.0/src/memory/code_analysis/languages/c.py +21 -0
  43. reql-0.1.0/src/memory/code_analysis/languages/cpp.py +22 -0
  44. reql-0.1.0/src/memory/code_analysis/languages/csharp.py +22 -0
  45. reql-0.1.0/src/memory/code_analysis/languages/dockerfile.py +18 -0
  46. reql-0.1.0/src/memory/code_analysis/languages/elixir.py +23 -0
  47. reql-0.1.0/src/memory/code_analysis/languages/fortran.py +20 -0
  48. reql-0.1.0/src/memory/code_analysis/languages/fsharp.py +19 -0
  49. reql-0.1.0/src/memory/code_analysis/languages/generic.py +711 -0
  50. reql-0.1.0/src/memory/code_analysis/languages/go.py +20 -0
  51. reql-0.1.0/src/memory/code_analysis/languages/java.py +21 -0
  52. reql-0.1.0/src/memory/code_analysis/languages/javascript.py +147 -0
  53. reql-0.1.0/src/memory/code_analysis/languages/julia.py +22 -0
  54. reql-0.1.0/src/memory/code_analysis/languages/just.py +19 -0
  55. reql-0.1.0/src/memory/code_analysis/languages/kotlin.py +21 -0
  56. reql-0.1.0/src/memory/code_analysis/languages/lua.py +21 -0
  57. reql-0.1.0/src/memory/code_analysis/languages/makefile.py +19 -0
  58. reql-0.1.0/src/memory/code_analysis/languages/pascal.py +19 -0
  59. reql-0.1.0/src/memory/code_analysis/languages/php.py +24 -0
  60. reql-0.1.0/src/memory/code_analysis/languages/powershell.py +20 -0
  61. reql-0.1.0/src/memory/code_analysis/languages/python.py +438 -0
  62. reql-0.1.0/src/memory/code_analysis/languages/razor.py +20 -0
  63. reql-0.1.0/src/memory/code_analysis/languages/ruby.py +22 -0
  64. reql-0.1.0/src/memory/code_analysis/languages/rust.py +20 -0
  65. reql-0.1.0/src/memory/code_analysis/languages/scala.py +19 -0
  66. reql-0.1.0/src/memory/code_analysis/languages/solidity.py +550 -0
  67. reql-0.1.0/src/memory/code_analysis/languages/sql.py +20 -0
  68. reql-0.1.0/src/memory/code_analysis/languages/swift.py +22 -0
  69. reql-0.1.0/src/memory/code_analysis/languages/terraform.py +19 -0
  70. reql-0.1.0/src/memory/code_analysis/languages/tsx.py +10 -0
  71. reql-0.1.0/src/memory/code_analysis/languages/typescript.py +148 -0
  72. reql-0.1.0/src/memory/code_analysis/languages/verilog.py +20 -0
  73. reql-0.1.0/src/memory/code_analysis/languages/zig.py +21 -0
  74. reql-0.1.0/src/memory/code_analysis/models.py +138 -0
  75. reql-0.1.0/src/memory/code_analysis/parser_base.py +36 -0
  76. reql-0.1.0/src/memory/code_analysis/symbol_table.py +26 -0
  77. reql-0.1.0/src/memory/config/__init__.py +56 -0
  78. reql-0.1.0/src/memory/config/loader.py +285 -0
  79. reql-0.1.0/src/memory/config/models.py +302 -0
  80. reql-0.1.0/src/memory/diagnostics.py +148 -0
  81. reql-0.1.0/src/memory/document_ingestion/__init__.py +14 -0
  82. reql-0.1.0/src/memory/document_ingestion/base.py +74 -0
  83. reql-0.1.0/src/memory/document_ingestion/chunking.py +66 -0
  84. reql-0.1.0/src/memory/document_ingestion/formats/__init__.py +12 -0
  85. reql-0.1.0/src/memory/document_ingestion/formats/markdown.py +231 -0
  86. reql-0.1.0/src/memory/document_ingestion/formats/pdf.py +90 -0
  87. reql-0.1.0/src/memory/document_ingestion/formats/text.py +56 -0
  88. reql-0.1.0/src/memory/document_ingestion/metadata.py +103 -0
  89. reql-0.1.0/src/memory/document_ingestion/models.py +61 -0
  90. reql-0.1.0/src/memory/domain/__init__.py +19 -0
  91. reql-0.1.0/src/memory/domain/constants.py +119 -0
  92. reql-0.1.0/src/memory/domain/exceptions.py +16 -0
  93. reql-0.1.0/src/memory/domain/ids.py +22 -0
  94. reql-0.1.0/src/memory/domain/models.py +169 -0
  95. reql-0.1.0/src/memory/domain/timeutils.py +35 -0
  96. reql-0.1.0/src/memory/engines/__init__.py +4 -0
  97. reql-0.1.0/src/memory/engines/activation.py +168 -0
  98. reql-0.1.0/src/memory/engines/salience.py +89 -0
  99. reql-0.1.0/src/memory/extraction/__init__.py +11 -0
  100. reql-0.1.0/src/memory/extraction/deterministic.py +121 -0
  101. reql-0.1.0/src/memory/extraction/document_processor.py +290 -0
  102. reql-0.1.0/src/memory/extraction/normalization.py +142 -0
  103. reql-0.1.0/src/memory/extraction/semantic.py +11 -0
  104. reql-0.1.0/src/memory/extraction/signature.py +16 -0
  105. reql-0.1.0/src/memory/py.typed +0 -0
  106. reql-0.1.0/src/memory/query/__init__.py +15 -0
  107. reql-0.1.0/src/memory/query/ast.py +193 -0
  108. reql-0.1.0/src/memory/query/errors.py +14 -0
  109. reql-0.1.0/src/memory/query/evaluator.py +1061 -0
  110. reql-0.1.0/src/memory/query/lexer.py +180 -0
  111. reql-0.1.0/src/memory/query/parser/__init__.py +6 -0
  112. reql-0.1.0/src/memory/query/parser/clauses.py +140 -0
  113. reql-0.1.0/src/memory/query/parser/commands.py +338 -0
  114. reql-0.1.0/src/memory/query/parser/core.py +143 -0
  115. reql-0.1.0/src/memory/query/parser/expressions.py +155 -0
  116. reql-0.1.0/src/memory/query/parser/patterns.py +43 -0
  117. reql-0.1.0/src/memory/query/result.py +68 -0
  118. reql-0.1.0/src/memory/reporting/__init__.py +9 -0
  119. reql-0.1.0/src/memory/reporting/cache_report.py +49 -0
  120. reql-0.1.0/src/memory/reporting/delta_report.py +37 -0
  121. reql-0.1.0/src/memory/reporting/graph_report.py +183 -0
  122. reql-0.1.0/src/memory/reporting/html_graph.py +1093 -0
  123. reql-0.1.0/src/memory/reporting/project_report.py +185 -0
  124. reql-0.1.0/src/memory/security.py +165 -0
  125. reql-0.1.0/src/memory/services/__init__.py +3 -0
  126. reql-0.1.0/src/memory/services/incremental_compilation.py +497 -0
  127. reql-0.1.0/src/memory/services/project_watch.py +225 -0
  128. reql-0.1.0/src/memory/services/retrieval.py +3636 -0
  129. reql-0.1.0/src/memory/storage/__init__.py +5 -0
  130. reql-0.1.0/src/memory/storage/adapters/__init__.py +3 -0
  131. reql-0.1.0/src/memory/storage/adapters/block_store.py +2910 -0
  132. reql-0.1.0/src/memory/storage/block_store.py +3 -0
  133. reql-0.1.0/src/memory/storage/extractor.py +14 -0
  134. reql-0.1.0/src/memory/storage/graph_store.py +54 -0
  135. reql-0.1.0/src/reql/__init__.py +36 -0
  136. reql-0.1.0/src/reql/config/__init__.py +4 -0
  137. reql-0.1.0/src/reql/py.typed +1 -0
  138. reql-0.1.0/src/reql/query/__init__.py +4 -0
  139. reql-0.1.0/src/reql.egg-info/PKG-INFO +473 -0
  140. reql-0.1.0/src/reql.egg-info/SOURCES.txt +152 -0
  141. reql-0.1.0/src/reql.egg-info/dependency_links.txt +1 -0
  142. reql-0.1.0/src/reql.egg-info/entry_points.txt +3 -0
  143. reql-0.1.0/src/reql.egg-info/requires.txt +42 -0
  144. reql-0.1.0/src/reql.egg-info/top_level.txt +5 -0
  145. reql-0.1.0/tests/test_block_storage.py +590 -0
  146. reql-0.1.0/tests/test_cli.py +972 -0
  147. reql-0.1.0/tests/test_code_analysis_graph_utils.py +31 -0
  148. reql-0.1.0/tests/test_code_graph_compilation.py +1055 -0
  149. reql-0.1.0/tests/test_document_ingestion_layers.py +57 -0
  150. reql-0.1.0/tests/test_end_to_end_flow.py +294 -0
  151. reql-0.1.0/tests/test_incremental_compilation.py +445 -0
  152. reql-0.1.0/tests/test_markdown_ingestion.py +463 -0
  153. reql-0.1.0/tests/test_memory_graph.py +695 -0
  154. reql-0.1.0/tests/test_security.py +195 -0
reql-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Safi Shamsi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
reql-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,473 @@
1
+ Metadata-Version: 2.4
2
+ Name: reql
3
+ Version: 0.1.0
4
+ Summary: Relational Entities Query Language: a graph-native deterministic memory engine.
5
+ Author: sh1zen
6
+ License-Expression: MIT
7
+ Project-URL: Documentation, https://github.com/sh1zen/reql#readme
8
+ Project-URL: Issues, https://github.com/sh1zen/reql/issues
9
+ Project-URL: Source, https://github.com/sh1zen/reql
10
+ Keywords: agents,graph,knowledge-graph,memory,property-graph,query-language,skill,llm
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Operating System :: OS Independent
21
+ Classifier: Topic :: Database
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: tree-sitter<0.26,>=0.25
29
+ Requires-Dist: tree-sitter-bash>=0.25
30
+ Requires-Dist: tree-sitter-c>=0.24
31
+ Requires-Dist: tree-sitter-c-sharp>=0.23
32
+ Requires-Dist: tree-sitter-cpp>=0.23
33
+ Requires-Dist: tree-sitter-elixir>=0.3
34
+ Requires-Dist: tree-sitter-fortran>=0.6
35
+ Requires-Dist: tree-sitter-go>=0.25
36
+ Requires-Dist: tree-sitter-hcl>=1.2
37
+ Requires-Dist: tree-sitter-java>=0.23
38
+ Requires-Dist: tree-sitter-javascript>=0.25
39
+ Requires-Dist: tree-sitter-julia>=0.23
40
+ Requires-Dist: tree-sitter-kotlin>=1.1
41
+ Requires-Dist: tree-sitter-language-pack>=1.8
42
+ Requires-Dist: tree-sitter-lua>=0.5
43
+ Requires-Dist: tree-sitter-make>=1.1
44
+ Requires-Dist: tree-sitter-php>=0.24
45
+ Requires-Dist: tree-sitter-powershell>=0.26
46
+ Requires-Dist: tree-sitter-python>=0.25
47
+ Requires-Dist: tree-sitter-ruby>=0.23
48
+ Requires-Dist: tree-sitter-rust>=0.24
49
+ Requires-Dist: tree-sitter-scala>=0.26
50
+ Requires-Dist: tree-sitter-solidity>=1.2
51
+ Requires-Dist: tree-sitter-sql>=0.3
52
+ Requires-Dist: tree-sitter-swift>=0.7
53
+ Requires-Dist: tree-sitter-typescript>=0.23
54
+ Requires-Dist: tree-sitter-verilog>=1.0
55
+ Requires-Dist: tree-sitter-zig>=1.1
56
+ Provides-Extra: watch
57
+ Requires-Dist: watchdog>=4.0; extra == "watch"
58
+ Provides-Extra: pdf
59
+ Requires-Dist: pypdf>=4.0; extra == "pdf"
60
+ Provides-Extra: all
61
+ Requires-Dist: pypdf>=4.0; extra == "all"
62
+ Requires-Dist: watchdog>=4.0; extra == "all"
63
+ Provides-Extra: dev
64
+ Requires-Dist: pypdf>=4.0; extra == "dev"
65
+ Requires-Dist: watchdog>=4.0; extra == "dev"
66
+ Dynamic: license-file
67
+
68
+ # REQL
69
+
70
+ REQL is a local repository context index for coding agents and developer tools.
71
+ It compiles source files and supported documents into a property graph, then
72
+ answers bounded queries over code, symbols, tests, documents, dependencies,
73
+ findings, and provenance.
74
+
75
+ The important part is that REQL turns a repository into queryable structure
76
+ before an agent starts editing:
77
+
78
+ - `project compile` scans the project, fingerprints artifacts, parses supported
79
+ code and documents, and writes graph nodes, edges, cache records, compilation
80
+ runs, and deltas;
81
+ - retrieval commands such as `query_context`, `query_explore`, `query_graph`,
82
+ and `query_memories` find lexical seed nodes, expand a bounded graph
83
+ neighborhood, rank the result, and return compact source-backed context;
84
+ - every result can point back to paths, line ranges, relationships, evidence,
85
+ and graph provenance instead of relying on broad source dumps;
86
+ - incremental compile and watch mode keep the graph current without rebuilding
87
+ unchanged files.
88
+
89
+ REQL is deterministic by default. Compilation, storage, query, retrieval,
90
+ analysis, reports, and MCP access work locally without mandatory LLM calls,
91
+ accounts, hosted services, or an external graph database. Optional semantic
92
+ adapters can exist at integration boundaries, but the core memory system remains
93
+ usable on its own.
94
+
95
+ ## Quick Start
96
+
97
+ REQL requires Python 3.10 or newer. Install the package with pip:
98
+
99
+ ```bash
100
+ python -m pip install reql
101
+ ```
102
+
103
+ For local development from a checkout, install it in editable mode:
104
+
105
+ ```bash
106
+ python -m pip install -e .
107
+ ```
108
+
109
+ Compile a project and retrieve context:
110
+
111
+ ```bash
112
+ reql project compile .
113
+ reql query_context --query "payment service"
114
+ reql query_memories --query "payment service" --limit 8 --json
115
+ reql query_explore --query "payment service serialization" --view owners --view code
116
+ ```
117
+
118
+ From a source checkout, `python cli.py ...` exposes the same command surface
119
+ without requiring an editable install:
120
+
121
+ ```bash
122
+ python cli.py project compile .
123
+ python cli.py query_context --query "payment service"
124
+ ```
125
+
126
+ Use the Python API directly:
127
+
128
+ ```python
129
+ from reql import MemoryGraph
130
+
131
+ graph = MemoryGraph.open(".reql/memory.reql")
132
+
133
+ try:
134
+ graph.compile_project(".")
135
+
136
+ context = graph.query_context("payment service")
137
+ print(context)
138
+ finally:
139
+ graph.close()
140
+ ```
141
+
142
+ Install assistant instructions and start MCP when needed:
143
+
144
+ ```bash
145
+ reql install codex
146
+ reql-mcp --read-only
147
+ ```
148
+
149
+ Project/cache commands default storage to `<project>/.reql/memory.reql`; other
150
+ commands default to `./.reql/memory.reql`. Use `--storage`, `--config`, `--set`,
151
+ and `--json` for automation. See [docs/CLI.md](docs/CLI.md) for the complete
152
+ command reference, query modes, install behavior, MCP startup, config lookup,
153
+ reports, exports, and maintenance workflows.
154
+
155
+ ## Features
156
+
157
+ - Local project compilation into a property graph with explicit provenance.
158
+ - Retrieval with lexical seed nodes, bounded graph expansion, and chain-aware ranking.
159
+ - Compact `query_context`, `query_explore`, `query_graph`, and `query_memories`
160
+ outputs for coding-agent workflows.
161
+ - Local block-file persistence with fixed-size pages, compressed records,
162
+ locking, transactions, and compaction.
163
+ - Incremental compilation cache with persistent compilation runs and graph deltas.
164
+ - Artifact document parsing for Markdown, plain text, and PDF with graceful
165
+ fallbacks.
166
+ - Code artifact recognition for Python, TS/JS, Go, Rust, Java, C/C++,
167
+ Ruby, C#, Kotlin, Scala, PHP, Swift, Lua, Zig, PowerShell, Elixir, Julia,
168
+ Verilog, Fortran, Bash, SQL, Terraform, Apex, Pascal, Razor, and related
169
+ extensions, with Tree-sitter AST graph extraction for recognized languages.
170
+ - Static-analysis findings for cleanup-oriented queries.
171
+ - Deterministic community detection, hub analysis, and bridge analysis with
172
+ generic-node penalties.
173
+ - Markdown reports, JSON export, standalone `graph.html`, guided launcher,
174
+ installable CLI, typed Python API, and optional dependency-free MCP server.
175
+
176
+ ## Runtime Model
177
+
178
+ REQL works as a local repository index backed by a property graph:
179
+
180
+ - `project compile` scans the project with default ignores plus configured
181
+ include/exclude rules;
182
+ - each artifact is fingerprinted, so unchanged files can be skipped on later
183
+ compiles;
184
+ - supported code files are parsed into modules, symbols, imports, calls,
185
+ dependencies, endpoints, config records, tests, and static-analysis findings;
186
+ - supported documents are split into source fragments, ranked document terms,
187
+ raw observations, and document-to-code links when they explicitly name code
188
+ symbols;
189
+ - graph records keep file paths, line ranges, evidence, confidence, and
190
+ provenance so query results can be traced back to source;
191
+ - queries find lexical seed nodes, expand only a bounded graph neighborhood,
192
+ rank the resulting records, and render compact context instead of dumping the
193
+ repository;
194
+ - `project update` and watch mode reuse the same incremental compiler and write
195
+ `CompilationRun`, `GraphDelta`, and cache records for changed or deleted
196
+ artifacts.
197
+
198
+ The core path is deterministic and local. Optional semantic adapters can exist
199
+ at integration boundaries, but project compilation, storage, retrieval, reports,
200
+ analysis, and MCP tools do not require model calls.
201
+
202
+ ## Interactive Launcher
203
+
204
+ The project root `launcher.py` starts a guided terminal menu when run without
205
+ arguments. It uses `./.reql/memory.reql` in the current working directory by default and lets you choose actions
206
+ interactively without writing command-line arguments:
207
+
208
+ ```bash
209
+ python launcher.py
210
+ ```
211
+
212
+ You can pass a storage path directly:
213
+
214
+ ```bash
215
+ python launcher.py --storage .reql/memory.reql
216
+ ```
217
+
218
+ The menu guides these workflows:
219
+
220
+ - create or open a graph storage file and initialize it;
221
+ - list available graph files under `.reql/`, open them, inspect them, or
222
+ delete managed `.reql` files after an explicit name confirmation;
223
+ - retrieve ranked code records or compose bounded agent context;
224
+ - scan and incrementally compile projects;
225
+ - run predefined REQL queries or custom graph queries;
226
+ - inspect stats, communities, hubs, and graph analysis;
227
+ - export Markdown reports, JSON, and standalone `graph.html`;
228
+ - print Codex and Claude Desktop MCP configuration for `reql-mcp`.
229
+
230
+ For command-line automation, use `python cli.py ...` or `reql`:
231
+
232
+ ```bash
233
+ reql project compile .
234
+ reql query_memories --query "payment service" --limit 5 --json
235
+ reql query "FIND nodes WHERE type = 'Function' LIMIT 10"
236
+ ```
237
+
238
+ ## Documentation
239
+
240
+ The README gives the project overview and common workflows. The focused
241
+ documentation lives under `docs/`:
242
+
243
+ - [Architecture](docs/ARCHITECTURE.md): layers, storage port, compile flow,
244
+ retrieval, maintenance, and deterministic analysis.
245
+ - [CLI](docs/CLI.md): command reference for compilation, retrieval, graph
246
+ queries, exports, configuration, install helpers, and MCP startup.
247
+ - [Configuration](docs/CONFIGURATION.md): `conf.yaml`, overrides, scan rules,
248
+ cache settings, document ingest, analysis toggles, and loader behavior.
249
+ - [REQL language](docs/REQL.md): first-class graph commands plus `FIND`,
250
+ `MATCH`, `PATH`, `SEARCH`, `RETRIEVE`, `EXPLAIN`, filters, and examples.
251
+ - [Schema](docs/SCHEMA.md): core node records, edge records, code types, and
252
+ relations used in the graph.
253
+ - [Storage](docs/STORAGE.md): block adapter, data locality, compression,
254
+ inspection, compaction, locking, transactions, and bounded operations.
255
+ - [Artifact ingestion](docs/ARTIFACT_INGESTION.md): supported document inputs,
256
+ parser behavior, graph output, and graceful fallbacks.
257
+ - [Code analysis](docs/CODE_ANALYSIS.md): language support, Tree-sitter parsing,
258
+ extracted symbols, static-analysis findings, and example queries.
259
+ - [Incremental compilation](docs/INCREMENTAL_COMPILATION.md): dirty planning,
260
+ cache entries, deltas, deletion handling, and failure behavior.
261
+ - [Graph analysis](docs/GRAPH_ANALYSIS.md): deterministic communities, hubs,
262
+ bridge signals, CLI usage, REQL examples, and known analysis limits.
263
+ - [Reporting](docs/REPORTING.md): generated Markdown reports and standalone
264
+ HTML graph export.
265
+ - [MCP server](docs/MCP.md): stdio/HTTP server startup, tool descriptions,
266
+ Codex and Claude configuration, workflow, and security notes.
267
+ - [Extending](docs/EXTENDING.md): storage adapters, extractors, engines, and
268
+ adding node or edge types.
269
+
270
+ ## Main Pipeline
271
+
272
+ REQL has a project compile pipeline. `compile` builds a technical graph for
273
+ programming agents from scanning, AST/static analysis, document parsing, and
274
+ deterministic document-to-code linking. It does not extract memories from chat
275
+ or non-code prose.
276
+
277
+ Retrieval:
278
+
279
+ ```text
280
+ query
281
+ -> tokenization
282
+ -> lexical seed-node search
283
+ -> bounded graph expansion
284
+ -> graph-aware ranking
285
+ -> subgraph or context block
286
+ ```
287
+
288
+ Maintenance:
289
+
290
+ ```text
291
+ activation and usage signals
292
+ -> salience update
293
+ -> sidecar retrieval usage updates
294
+ -> provenance preservation
295
+ ```
296
+
297
+ Compile-time project scan:
298
+
299
+ ```text
300
+ project directory
301
+ -> recursive scanner
302
+ -> default ignore rules and config include/exclude filtering
303
+ -> file classification and SHA-256 fingerprints
304
+ -> Project + Directory + File + SourceArtifact nodes
305
+ -> CONTAINS edges
306
+ ```
307
+
308
+ Project compile uses the same fingerprinting path and built-in default ignores.
309
+ Put additional compile exclusions in the configured `scan.exclude` list.
310
+
311
+ Incremental compilation:
312
+
313
+ ```text
314
+ SourceArtifact fingerprints
315
+ -> ArtifactCacheEntry comparison
316
+ -> dirty and deleted artifact set
317
+ -> deterministic compile graph updates
318
+ -> CompilationRun
319
+ -> GraphDelta
320
+ ```
321
+
322
+ Artifact document parsing:
323
+
324
+ ```text
325
+ SourceArtifact bytes
326
+ -> document parser
327
+ -> DocumentFragment records
328
+ -> SourceFragment nodes
329
+ -> provenance and document relations
330
+ ```
331
+
332
+ Code analysis:
333
+
334
+ ```text
335
+ code artifact
336
+ -> AST/static parser when supported
337
+ -> Module / Package / Class / Interface / Function / Method / useful Variable nodes
338
+ -> Import / Dependency / Endpoint / Schema / Config / Test nodes
339
+ -> CONTAINS / DEFINES / METHOD / IMPORTS / CALLS / REFERENCES / INHERITS edges
340
+ -> DEPENDS_ON / IMPORTS_FROM / RE_EXPORTS / READS / WRITES / RETURNS edges
341
+ -> RAISES / DECORATED_BY / HANDLES_ROUTE / HAS_FINDING edges
342
+ -> StaticAnalysisFinding cleanup candidates for unused code
343
+ ```
344
+
345
+ Graph analysis:
346
+
347
+ ```text
348
+ graph nodes and edges
349
+ -> deterministic community detection
350
+ -> specificity-aware hub scoring
351
+ -> cross-community bridge edges
352
+ -> Community nodes, BRIDGES_COMMUNITY edges, and hub properties
353
+ ```
354
+
355
+ ## Project Structure
356
+
357
+ ```text
358
+ src/api/
359
+ |-- memory_graph.py # Public facade
360
+ |-- __init__.py # Public Python API exports
361
+ src/agents/
362
+ |-- install.py # Agent skill/instruction installers
363
+ |-- __init__.py # Agent installer exports
364
+ src/mcp/
365
+ |-- tools.py # Dependency-free MCP tool handlers
366
+ `-- server.py # stdio and HTTP JSON-RPC MCP transports
367
+ src/memory/
368
+ |-- domain/ # Pure models, constants, ids, time, exceptions
369
+ |-- ports/ # Storage and extractor protocols
370
+ |-- infrastructure/ # Concrete adapters
371
+ | `-- block/ # BlockGraphStore
372
+ |-- extraction/ # Deterministic query/source extraction and optional adapters
373
+ |-- artifacts/ # Project scanning, file classification, fingerprints
374
+ |-- engines/ # Numeric and maintenance engines
375
+ | |-- activation.py # Spreading activation
376
+ | `-- salience.py # Salience scoring
377
+ |-- services/ # Application orchestration
378
+ | |-- retrieval.py
379
+ | |-- incremental_compilation.py
380
+ | `-- project_watch.py
381
+ |-- query/ # REQL lexer, parser, AST, and evaluator
382
+ |-- analysis/ # Communities, centrality, specificity, hubs, bridges
383
+ |-- reporting/ # Markdown reports
384
+ |-- config/ # conf.yaml models and loader
385
+ `-- cli.py # Command-line interface
386
+ ```
387
+
388
+ ## Public API
389
+
390
+ The main entry point is `MemoryGraph`. The canonical public import is
391
+ `from reql import MemoryGraph`.
392
+
393
+ ```python
394
+ from reql import MemoryGraph
395
+
396
+ graph = MemoryGraph.open(".reql/memory.reql")
397
+ ```
398
+
399
+ Main operations:
400
+
401
+ - `retrieve(query)`
402
+ - `compose_context(query)`
403
+ - `query_context(query)`
404
+ - `query_explore(query)`
405
+ - `query_graph(query)`
406
+ - `query_memories(query)`
407
+ - `query_memories_payload(query)`
408
+ - `export_json()`
409
+ - `query(statement)`
410
+ - `compile_project(path)`
411
+ - `update_project(path)`
412
+ - `project_status(path)`
413
+ - `project_report(path, output_dir=...)`
414
+ - `cache_status(path)`
415
+ - `clear_cache(path)`
416
+ - `list_deltas()`
417
+ - `show_delta(delta_id)`
418
+ - `detect_communities(project_id=...)`
419
+ - `analyze_hubs(project_id=..., limit=...)`
420
+
421
+ ## Extending the Project
422
+
423
+ ### New Storage Backend
424
+
425
+ Implement `memory.ports.graph_store.GraphStore` and pass it to the facade:
426
+
427
+ ```python
428
+ from reql import MemoryGraph
429
+
430
+ store = MyGraphStore(...)
431
+ graph = MemoryGraph(store)
432
+ ```
433
+
434
+ The bundled block backend is portable local persistence, not an architectural
435
+ constraint.
436
+
437
+ ### New Extractor
438
+
439
+ Implement `SemanticExtractor`:
440
+
441
+ ```python
442
+ class MyExtractor:
443
+ def extract(self, text: str):
444
+ ...
445
+
446
+ graph = MemoryGraph.open(".reql/memory.reql", extractor=MyExtractor())
447
+ ```
448
+
449
+ The extractor is used for query seed discovery. Project document ingest is
450
+ handled by the local deterministic compiler path. The default
451
+ `MemoryGraph.open()` extractor is dependency-free and deterministic.
452
+
453
+ Compile mode structurally parses text document fragments and links explicit
454
+ documentation mentions back to compiled code symbols where possible.
455
+
456
+ ### New Node or Edge Types
457
+
458
+ Types are strings. To keep them coherent:
459
+
460
+ 1. add constants in `domain/constants.py`;
461
+ 2. update compiler, retrieval, reporting, or analysis code if dedicated logic is needed;
462
+ 3. add integration tests when the new type changes retrieval, salience, or graph analysis.
463
+
464
+ ## License
465
+
466
+ MIT. See `LICENSE`.
467
+
468
+ ## Contributing
469
+
470
+ See `CONTRIBUTING.md` for development setup, contribution guidelines, and pull
471
+ request expectations.
472
+
473
+