openmodus 0.0.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 (194) hide show
  1. openmodus-0.0.1/.gitignore +46 -0
  2. openmodus-0.0.1/LICENSE +21 -0
  3. openmodus-0.0.1/PKG-INFO +251 -0
  4. openmodus-0.0.1/README.md +203 -0
  5. openmodus-0.0.1/README.zh-CN.md +164 -0
  6. openmodus-0.0.1/pyproject.toml +173 -0
  7. openmodus-0.0.1/schemas/module-meta.schema.yaml +86 -0
  8. openmodus-0.0.1/src/modus/__init__.py +13 -0
  9. openmodus-0.0.1/src/modus/__main__.py +6 -0
  10. openmodus-0.0.1/src/modus/activation_guidance.py +18 -0
  11. openmodus-0.0.1/src/modus/artifacts_io.py +1066 -0
  12. openmodus-0.0.1/src/modus/catalog.py +361 -0
  13. openmodus-0.0.1/src/modus/cli.py +1785 -0
  14. openmodus-0.0.1/src/modus/commands/__init__.py +17 -0
  15. openmodus-0.0.1/src/modus/commands/context_cmd.py +50 -0
  16. openmodus-0.0.1/src/modus/commands/help.py +131 -0
  17. openmodus-0.0.1/src/modus/commands/init_project.py +503 -0
  18. openmodus-0.0.1/src/modus/commands/install_state.py +212 -0
  19. openmodus-0.0.1/src/modus/commands/maintenance_scope.py +69 -0
  20. openmodus-0.0.1/src/modus/commands/permission_errors.py +26 -0
  21. openmodus-0.0.1/src/modus/commands/reporting.py +113 -0
  22. openmodus-0.0.1/src/modus/commands/self_update.py +577 -0
  23. openmodus-0.0.1/src/modus/commands/status.py +52 -0
  24. openmodus-0.0.1/src/modus/commands/uninstall.py +359 -0
  25. openmodus-0.0.1/src/modus/commands/uninstall_report.py +183 -0
  26. openmodus-0.0.1/src/modus/commands/uninstall_self.py +373 -0
  27. openmodus-0.0.1/src/modus/commands/update.py +526 -0
  28. openmodus-0.0.1/src/modus/commands/update_report.py +162 -0
  29. openmodus-0.0.1/src/modus/commands/verify_anchors.py +230 -0
  30. openmodus-0.0.1/src/modus/config.py +492 -0
  31. openmodus-0.0.1/src/modus/git_hygiene.py +466 -0
  32. openmodus-0.0.1/src/modus/hooks/__init__.py +21 -0
  33. openmodus-0.0.1/src/modus/hooks/bootstrap.py +232 -0
  34. openmodus-0.0.1/src/modus/hooks/context.py +29 -0
  35. openmodus-0.0.1/src/modus/hooks/contracts.py +111 -0
  36. openmodus-0.0.1/src/modus/hooks/environment.py +86 -0
  37. openmodus-0.0.1/src/modus/hooks/protocol.py +156 -0
  38. openmodus-0.0.1/src/modus/hooks/runtime.py +136 -0
  39. openmodus-0.0.1/src/modus/init_analysis/README.md +72 -0
  40. openmodus-0.0.1/src/modus/init_analysis/__init__.py +35 -0
  41. openmodus-0.0.1/src/modus/init_analysis/api.py +360 -0
  42. openmodus-0.0.1/src/modus/init_analysis/authoring_projection.py +192 -0
  43. openmodus-0.0.1/src/modus/init_analysis/build_context.py +1326 -0
  44. openmodus-0.0.1/src/modus/init_analysis/bundle.py +1092 -0
  45. openmodus-0.0.1/src/modus/init_analysis/capability_evidence.py +585 -0
  46. openmodus-0.0.1/src/modus/init_analysis/catalog.py +448 -0
  47. openmodus-0.0.1/src/modus/init_analysis/compiler/__init__.py +1 -0
  48. openmodus-0.0.1/src/modus/init_analysis/compiler/cache.py +63 -0
  49. openmodus-0.0.1/src/modus/init_analysis/compiler/cpp.py +536 -0
  50. openmodus-0.0.1/src/modus/init_analysis/compiler/go.py +158 -0
  51. openmodus-0.0.1/src/modus/init_analysis/compiler/java.py +112 -0
  52. openmodus-0.0.1/src/modus/init_analysis/compiler/merge.py +211 -0
  53. openmodus-0.0.1/src/modus/init_analysis/compiler/models.py +88 -0
  54. openmodus-0.0.1/src/modus/init_analysis/compiler/process.py +259 -0
  55. openmodus-0.0.1/src/modus/init_analysis/compiler/python.py +430 -0
  56. openmodus-0.0.1/src/modus/init_analysis/compiler/typescript.py +73 -0
  57. openmodus-0.0.1/src/modus/init_analysis/contracts.py +283 -0
  58. openmodus-0.0.1/src/modus/init_analysis/engine.py +230 -0
  59. openmodus-0.0.1/src/modus/init_analysis/entry_contracts.py +155 -0
  60. openmodus-0.0.1/src/modus/init_analysis/evidence_graph.py +133 -0
  61. openmodus-0.0.1/src/modus/init_analysis/evidence_records.py +211 -0
  62. openmodus-0.0.1/src/modus/init_analysis/extraction_cache.py +309 -0
  63. openmodus-0.0.1/src/modus/init_analysis/fingerprint.py +38 -0
  64. openmodus-0.0.1/src/modus/init_analysis/framework_facts.py +472 -0
  65. openmodus-0.0.1/src/modus/init_analysis/frontend.py +1523 -0
  66. openmodus-0.0.1/src/modus/init_analysis/generic.py +77 -0
  67. openmodus-0.0.1/src/modus/init_analysis/ids.py +35 -0
  68. openmodus-0.0.1/src/modus/init_analysis/input_snapshot.py +675 -0
  69. openmodus-0.0.1/src/modus/init_analysis/language-registry.json +550 -0
  70. openmodus-0.0.1/src/modus/init_analysis/language_capabilities.py +78 -0
  71. openmodus-0.0.1/src/modus/init_analysis/native_binding.py +734 -0
  72. openmodus-0.0.1/src/modus/init_analysis/native_parser.py +905 -0
  73. openmodus-0.0.1/src/modus/init_analysis/navigation.py +184 -0
  74. openmodus-0.0.1/src/modus/init_analysis/pipeline.py +504 -0
  75. openmodus-0.0.1/src/modus/init_analysis/projection.py +409 -0
  76. openmodus-0.0.1/src/modus/init_analysis/provider_assets/ModusJavaAnalyzer.java +350 -0
  77. openmodus-0.0.1/src/modus/init_analysis/provider_assets/modus_go_analyzer.go +367 -0
  78. openmodus-0.0.1/src/modus/init_analysis/provider_assets/modus_typescript_analyzer.cjs +163 -0
  79. openmodus-0.0.1/src/modus/init_analysis/reference_outcomes.py +318 -0
  80. openmodus-0.0.1/src/modus/init_analysis/resources.py +78 -0
  81. openmodus-0.0.1/src/modus/init_analysis/scan.py +95 -0
  82. openmodus-0.0.1/src/modus/init_analysis/scope_candidates.py +372 -0
  83. openmodus-0.0.1/src/modus/init_analysis/search_metadata.py +32 -0
  84. openmodus-0.0.1/src/modus/init_analysis/semantic_contracts.py +119 -0
  85. openmodus-0.0.1/src/modus/init_analysis/semantic_ir.py +582 -0
  86. openmodus-0.0.1/src/modus/init_analysis/semantic_providers.py +188 -0
  87. openmodus-0.0.1/src/modus/init_analysis/semantic_reconcile.py +491 -0
  88. openmodus-0.0.1/src/modus/init_analysis/source_contracts.py +127 -0
  89. openmodus-0.0.1/src/modus/init_analysis/source_coordinates.py +80 -0
  90. openmodus-0.0.1/src/modus/init_analysis/source_filters.py +184 -0
  91. openmodus-0.0.1/src/modus/init_analysis/source_inventory.py +251 -0
  92. openmodus-0.0.1/src/modus/init_analysis/source_roles.py +99 -0
  93. openmodus-0.0.1/src/modus/init_analysis/source_snapshot.py +65 -0
  94. openmodus-0.0.1/src/modus/init_analysis/structural.py +119 -0
  95. openmodus-0.0.1/src/modus/init_analysis/topology.py +2060 -0
  96. openmodus-0.0.1/src/modus/init_analysis/value_summary.py +463 -0
  97. openmodus-0.0.1/src/modus/init_analysis/view_quarantine.py +606 -0
  98. openmodus-0.0.1/src/modus/knowledge_identity.py +200 -0
  99. openmodus-0.0.1/src/modus/knowledge_reader.py +220 -0
  100. openmodus-0.0.1/src/modus/knowledge_seeds.py +56 -0
  101. openmodus-0.0.1/src/modus/knowledge_update.py +212 -0
  102. openmodus-0.0.1/src/modus/knowledge_write_session.py +241 -0
  103. openmodus-0.0.1/src/modus/manifest.py +210 -0
  104. openmodus-0.0.1/src/modus/orchestrator/README.md +67 -0
  105. openmodus-0.0.1/src/modus/orchestrator/__init__.py +14 -0
  106. openmodus-0.0.1/src/modus/orchestrator/context_resolver.py +142 -0
  107. openmodus-0.0.1/src/modus/orchestrator/evidence_search.py +473 -0
  108. openmodus-0.0.1/src/modus/orchestrator/fallback.py +83 -0
  109. openmodus-0.0.1/src/modus/orchestrator/knowledge_sync.py +349 -0
  110. openmodus-0.0.1/src/modus/orchestrator/models.py +82 -0
  111. openmodus-0.0.1/src/modus/orchestrator/module_meta.py +194 -0
  112. openmodus-0.0.1/src/modus/orchestrator/path_scope.py +38 -0
  113. openmodus-0.0.1/src/modus/orchestrator/preflight.py +125 -0
  114. openmodus-0.0.1/src/modus/orchestrator/query_terms.py +124 -0
  115. openmodus-0.0.1/src/modus/orchestrator/search_policy.py +161 -0
  116. openmodus-0.0.1/src/modus/paths.py +279 -0
  117. openmodus-0.0.1/src/modus/platforms/__init__.py +45 -0
  118. openmodus-0.0.1/src/modus/platforms/base.py +299 -0
  119. openmodus-0.0.1/src/modus/platforms/claude.py +98 -0
  120. openmodus-0.0.1/src/modus/platforms/codebuddy.py +51 -0
  121. openmodus-0.0.1/src/modus/platforms/codex.py +41 -0
  122. openmodus-0.0.1/src/modus/platforms/cursor.py +45 -0
  123. openmodus-0.0.1/src/modus/platforms/hooks.py +188 -0
  124. openmodus-0.0.1/src/modus/platforms/models.py +166 -0
  125. openmodus-0.0.1/src/modus/platforms/registry.py +88 -0
  126. openmodus-0.0.1/src/modus/platforms/rendering.py +77 -0
  127. openmodus-0.0.1/src/modus/platforms/sections.py +100 -0
  128. openmodus-0.0.1/src/modus/precedence.py +47 -0
  129. openmodus-0.0.1/src/modus/project_activation.py +99 -0
  130. openmodus-0.0.1/src/modus/retrieval/README.md +64 -0
  131. openmodus-0.0.1/src/modus/retrieval/__init__.py +9 -0
  132. openmodus-0.0.1/src/modus/retrieval/budget.py +50 -0
  133. openmodus-0.0.1/src/modus/retrieval/delivery.py +226 -0
  134. openmodus-0.0.1/src/modus/retrieval/index.py +92 -0
  135. openmodus-0.0.1/src/modus/retrieval/pipeline.py +718 -0
  136. openmodus-0.0.1/src/modus/retrieval/query.py +189 -0
  137. openmodus-0.0.1/src/modus/retrieval/routing.py +237 -0
  138. openmodus-0.0.1/src/modus/retrieval/runtime.py +39 -0
  139. openmodus-0.0.1/src/modus/retrieval/settings.py +75 -0
  140. openmodus-0.0.1/src/modus/retrieval/stages/__init__.py +7 -0
  141. openmodus-0.0.1/src/modus/retrieval/stages/discovery.py +91 -0
  142. openmodus-0.0.1/src/modus/retrieval/stages/documents.py +694 -0
  143. openmodus-0.0.1/src/modus/retrieval/stages/lexical.py +116 -0
  144. openmodus-0.0.1/src/modus/retrieval/stages/ranking.py +179 -0
  145. openmodus-0.0.1/src/modus/retrieval/stages/sections.py +64 -0
  146. openmodus-0.0.1/src/modus/retrieval/stages/selection.py +221 -0
  147. openmodus-0.0.1/src/modus/retrieval/stages/settings.py +7 -0
  148. openmodus-0.0.1/src/modus/scaffold/README.md +68 -0
  149. openmodus-0.0.1/src/modus/scaffold/__init__.py +36 -0
  150. openmodus-0.0.1/src/modus/scaffold/catalog.py +170 -0
  151. openmodus-0.0.1/src/modus/scaffold/project.py +361 -0
  152. openmodus-0.0.1/src/modus/scaffold/templates/README.md +37 -0
  153. openmodus-0.0.1/src/modus/scaffold/templates/commands/init.md +19 -0
  154. openmodus-0.0.1/src/modus/scaffold/templates/commands/reinit.md +18 -0
  155. openmodus-0.0.1/src/modus/scaffold/templates/commands/update-knowledge.md +19 -0
  156. openmodus-0.0.1/src/modus/scaffold/templates/knowledge/constraint/global-standard.md +18 -0
  157. openmodus-0.0.1/src/modus/scaffold/templates/knowledge/constraint/team-standard.md +28 -0
  158. openmodus-0.0.1/src/modus/scaffold/templates/knowledge/handbook/SKILL.md +21 -0
  159. openmodus-0.0.1/src/modus/scaffold/templates/skills/modus-init/SKILL.md +52 -0
  160. openmodus-0.0.1/src/modus/scaffold/templates/skills/modus-init/references/architecture-overview.md +23 -0
  161. openmodus-0.0.1/src/modus/scaffold/templates/skills/modus-init/references/business-skill.md +65 -0
  162. openmodus-0.0.1/src/modus/scaffold/templates/skills/modus-init/references/code-skill.md +190 -0
  163. openmodus-0.0.1/src/modus/scaffold/templates/skills/modus-init/references/constraint-extraction.md +86 -0
  164. openmodus-0.0.1/src/modus/scaffold/templates/skills/modus-init/references/constraint-profiles/cpp.md +39 -0
  165. openmodus-0.0.1/src/modus/scaffold/templates/skills/modus-init/references/constraint-profiles/go.md +39 -0
  166. openmodus-0.0.1/src/modus/scaffold/templates/skills/modus-init/references/constraint-profiles/java.md +39 -0
  167. openmodus-0.0.1/src/modus/scaffold/templates/skills/modus-init/references/constraint-profiles/php.md +39 -0
  168. openmodus-0.0.1/src/modus/scaffold/templates/skills/modus-init/references/constraint-profiles/web.md +50 -0
  169. openmodus-0.0.1/src/modus/scaffold/templates/skills/modus-init/references/global-standard.md +9 -0
  170. openmodus-0.0.1/src/modus/scaffold/templates/skills/modus-init/references/language-adaptation.md +19 -0
  171. openmodus-0.0.1/src/modus/scaffold/templates/skills/modus-init/references/scope-discovery.md +86 -0
  172. openmodus-0.0.1/src/modus/scaffold/templates/skills/modus-init/references/team-standard.md +52 -0
  173. openmodus-0.0.1/src/modus/scaffold/templates/skills/modus-init/references/workspace-init.md +67 -0
  174. openmodus-0.0.1/src/modus/scaffold/templates/skills/modus-init/references/zh-style.md +12 -0
  175. openmodus-0.0.1/src/modus/scaffold/templates/skills/modus-reinit/SKILL.md +22 -0
  176. openmodus-0.0.1/src/modus/scaffold/templates/skills/modus-sync-knowledge/SKILL.md +28 -0
  177. openmodus-0.0.1/src/modus/scaffold/templates/skills/modus-update-knowledge/SKILL.md +22 -0
  178. openmodus-0.0.1/src/modus/scaffold/templates/skills/using-modus/SKILL.md +31 -0
  179. openmodus-0.0.1/src/modus/scaffold/templates/skills/using-modus/references/constraint-usage.md +28 -0
  180. openmodus-0.0.1/src/modus/scaffold/templates/skills/using-modus/references/framework-update.md +15 -0
  181. openmodus-0.0.1/src/modus/scaffold/templates/skills/using-modus/references/knowledge-update-lifecycle.md +68 -0
  182. openmodus-0.0.1/src/modus/scaffold/templates/skills/using-modus/references/router-details.md +42 -0
  183. openmodus-0.0.1/src/modus/scaffold/writer.py +101 -0
  184. openmodus-0.0.1/src/modus/schema_resources.py +56 -0
  185. openmodus-0.0.1/src/modus/scope_models.py +504 -0
  186. openmodus-0.0.1/src/modus/scope_resolver.py +109 -0
  187. openmodus-0.0.1/src/modus/sensitive_literals.py +64 -0
  188. openmodus-0.0.1/src/modus/skillmd.py +144 -0
  189. openmodus-0.0.1/src/modus/source_listing.py +82 -0
  190. openmodus-0.0.1/src/modus/surface.py +65 -0
  191. openmodus-0.0.1/src/modus/text_tree.py +64 -0
  192. openmodus-0.0.1/src/modus/versioning.py +61 -0
  193. openmodus-0.0.1/src/modus/workspace.py +881 -0
  194. openmodus-0.0.1/uv.lock +1154 -0
@@ -0,0 +1,46 @@
1
+ # Python environments and bytecode
2
+ .venv/
3
+ venv/
4
+ __pycache__/
5
+ *.py[cod]
6
+ *$py.class
7
+
8
+ # Test, analysis, and coverage state
9
+ .pytest_cache/
10
+ .ruff_cache/
11
+ .mypy_cache/
12
+ .hypothesis/
13
+ .nox/
14
+ .tox/
15
+ .coverage
16
+ .coverage.*
17
+ coverage.xml
18
+ htmlcov/
19
+
20
+ # Distribution artifacts
21
+ dist/
22
+ build/
23
+ .eggs/
24
+ *.egg
25
+ *.egg-info/
26
+
27
+ # Local configuration and editor state
28
+ .env
29
+ .env.*
30
+ !.env.example
31
+ !.env.template
32
+ .DS_Store
33
+ .idea/
34
+ .vscode/
35
+ *.swp
36
+ *~
37
+
38
+ # Repository-local agent projections and generated workspaces
39
+ /.agents/
40
+ /.codex/
41
+ /.claude/
42
+ /.cursor/
43
+ /.codebuddy/
44
+ /.modus/
45
+ /.worktrees/
46
+ /.benchmark-state/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tencent Music Entertainment Group
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.
@@ -0,0 +1,251 @@
1
+ Metadata-Version: 2.5
2
+ Name: openmodus
3
+ Version: 0.0.1
4
+ Summary: Evidence-backed authored knowledge for coding agents.
5
+ Author: Modus contributors
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Keywords: code-intelligence,coding-agents,developer-tools,knowledge-management,static-analysis
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Environment :: Console
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
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: Topic :: Software Development
20
+ Requires-Python: >=3.11
21
+ Requires-Dist: click<8.4,>=8.1.0
22
+ Requires-Dist: jsonschema<5.0,>=4.0
23
+ Requires-Dist: networkx<4.0,>=3.4
24
+ Requires-Dist: pyyaml<7.0,>=6.0
25
+ Requires-Dist: questionary<3.0,>=2.1
26
+ Requires-Dist: tree-sitter-c-sharp<0.25,>=0.23
27
+ Requires-Dist: tree-sitter-c<0.25,>=0.23
28
+ Requires-Dist: tree-sitter-cpp<0.25,>=0.23
29
+ Requires-Dist: tree-sitter-go<0.26,>=0.23
30
+ Requires-Dist: tree-sitter-java<0.25,>=0.23
31
+ Requires-Dist: tree-sitter-javascript<0.26,>=0.23
32
+ Requires-Dist: tree-sitter-kotlin<2.0,>=1.0
33
+ Requires-Dist: tree-sitter-php<0.25,>=0.23
34
+ Requires-Dist: tree-sitter-python<0.26,>=0.23
35
+ Requires-Dist: tree-sitter-rust<0.25,>=0.23
36
+ Requires-Dist: tree-sitter-typescript<0.25,>=0.23
37
+ Requires-Dist: tree-sitter<0.26,>=0.23.0
38
+ Requires-Dist: typer<0.26,>=0.12.0
39
+ Provides-Extra: test
40
+ Requires-Dist: coverage[toml]<8.0,>=7.0; extra == 'test'
41
+ Requires-Dist: mypy<3.0,>=1.19; extra == 'test'
42
+ Requires-Dist: pytest<10.0,>=7.0; extra == 'test'
43
+ Requires-Dist: ruff<1.0,>=0.5.0; extra == 'test'
44
+ Requires-Dist: types-jsonschema<5.0,>=4.0; extra == 'test'
45
+ Requires-Dist: types-networkx<4.0,>=3.4; extra == 'test'
46
+ Requires-Dist: types-pyyaml<7.0,>=6.0; extra == 'test'
47
+ Description-Content-Type: text/markdown
48
+
49
+ # Modus
50
+
51
+ Modus turns a repository and its business material into reviewable,
52
+ source-grounded Markdown knowledge for coding agents.
53
+
54
+ The first open-source release keeps one durable product: authored knowledge.
55
+ Source graphs are not a second database. During `/modus-init` or
56
+ `/modus-reinit`, a disposable analyzer builds an in-memory evidence graph,
57
+ projects the evidence needed for authoring, and then releases its working
58
+ state.
59
+
60
+ ## Design
61
+
62
+ ```text
63
+ repository bytes + build context
64
+ │ freeze
65
+ ▼
66
+ CST / structural IR
67
+ │
68
+ project binding
69
+ │
70
+ compiler observations (optional)
71
+ │
72
+ explicit semantic reconciliation
73
+ │
74
+ in-memory evidence graph
75
+ │ project
76
+ ▼
77
+ deterministic JSON evidence bundle
78
+ │ current init/reinit only
79
+ ▼
80
+ reviewed Markdown knowledge
81
+ ```
82
+
83
+ This separation is intentional:
84
+
85
+ - source bytes and build configuration answer which code was analyzed;
86
+ - CST, project binding, and compiler observations retain their own provenance;
87
+ - exact, candidate, heuristic, and unresolved relationships stay distinct;
88
+ - conflicts become diagnostics instead of being overwritten;
89
+ - a method witness points back to source rather than copying method bodies;
90
+ - business domains and modules remain an agent-and-user judgment, never a
91
+ clustering side effect.
92
+
93
+ Ordinary knowledge use, hooks, status, and incremental updates read current
94
+ source and authored Markdown only. They cannot import or read initialization
95
+ analysis.
96
+
97
+ ## Product surface
98
+
99
+ Modus installs exactly five knowledge skills:
100
+
101
+ - `using-modus` progressively adds project evidence only when the task needs it;
102
+ - `modus-init` and `modus-reinit` create or fully refresh authored knowledge;
103
+ - `modus-update-knowledge` performs an explicitly requested scoped update;
104
+ - `modus-sync-knowledge` silently revises knowledge only after a code change
105
+ actually changes durable semantics or source anchors.
106
+
107
+ The first three authoring workflows are exposed as `/modus-init`,
108
+ `/modus-reinit`, and `/modus-update-knowledge`. `using-modus` and
109
+ `modus-sync-knowledge` are agent lifecycle helpers, not extra user workflows.
110
+ Unrelated conversations never inspect Modus state.
111
+
112
+ The project layout keeps control and data ownership visibly separate:
113
+
114
+ ```text
115
+ .modus/ config, manifest, neutral skills/commands, hooks
116
+ modus/knowledge/ the only durable product data
117
+ modus/.cache/ disposable analysis and authoring state, created on demand
118
+ ```
119
+
120
+ No other top-level entry belongs under `modus/`.
121
+
122
+ ## Evidence bundle
123
+
124
+ Each successful build publishes one immutable bundle:
125
+
126
+ ```text
127
+ modus/.cache/init-analysis/bundles/<bundleDigest>/
128
+ ├── manifest.json
129
+ ├── snapshot/{index.json,sources/,build-units/}
130
+ ├── scope/{index.json,candidates/}
131
+ ├── services/{index.json,boundaries/}
132
+ ├── diagnostics.json
133
+ └── evidence/{index.json,files/}
134
+ ```
135
+
136
+ Each namespace is a bounded stable-key range catalog. Source files, build
137
+ units, technical candidates, service boundaries, and evidence records have
138
+ independent shards. Scope exposes explainable technical signals and navigation,
139
+ never business names or conclusions.
140
+
141
+ The bundle contract has no absolute paths, timestamps, random IDs, raw graph,
142
+ SQL database, WAL, historical generation, full-text index, or query language.
143
+ JSON is stable-sorted UTF-8 with an explicit schema version.
144
+
145
+ Publication occurs in a same-filesystem temporary directory. The manifest binds
146
+ exactly five Merkle roots; recursive validation rejects bad catalogs, records,
147
+ references, paths, digests, and orphan shards before atomic rename. Current
148
+ initialization consumes only the `BuildReceipt` returned by its own invocation.
149
+
150
+ ## Commands
151
+
152
+ The supported CLI is deliberately small:
153
+
154
+ ```text
155
+ modus init
156
+ modus update
157
+ modus help
158
+ modus uninstall
159
+ modus status
160
+ modus --version
161
+ ```
162
+
163
+ `modus uninstall` removes managed project integration and the local CLI after
164
+ showing a preview. Authored knowledge under `modus/knowledge` is retained by
165
+ default; deleting that durable data requires the explicit
166
+ `modus uninstall --delete-knowledge` option.
167
+
168
+ Initialization Skills use one internal adapter:
169
+
170
+ ```text
171
+ modus internal init-analysis build --root . --compiler auto --json
172
+ modus internal init-analysis select --root . --bundle-digest <digest> --source-snapshot-digest <digest> --view scope|services|evidence --json
173
+ ```
174
+
175
+ The command is synchronous. Progress is written to stderr; JSON stdout contains
176
+ only the bundle digest, source-snapshot digest, coverage, and diagnostics
177
+ summaries. Select returns complete records under a byte/item budget and an
178
+ optional stable cursor. There is no graph update/status/query/export/doctor or
179
+ persisted progress command.
180
+
181
+ The design is informed by public ideas from CodeWiki, Aider, GitNexus,
182
+ Repomix, and OpenDeepWiki, while the implementation, contracts, tests, prompts,
183
+ and assets are independently authored for Modus. No source code from those
184
+ projects is included.
185
+
186
+ ## Failure semantics
187
+
188
+ Snapshot drift, an invalid manifest, a digest mismatch, or cross-bundle mixing
189
+ fails the current analysis. A failed build does not replace the last complete
190
+ bundle, but the current init/reinit also does not consume that older bundle.
191
+ It immediately continues from current source and user material.
192
+
193
+ A local parser or compiler-provider failure lowers only the affected evidence.
194
+ It never means the repository has no business behavior. Compiler observations
195
+ cannot silently overwrite CST or project binding; reconciliation retains the
196
+ chosen result, alternatives, reason, context, and source witness.
197
+
198
+ ## Workspace semantics
199
+
200
+ A workspace root never runs initialization analysis. When a user chooses to
201
+ initialize members that have no authored knowledge, each member runs as an
202
+ independent single repository. Bundle identities and evidence never cross
203
+ member roots.
204
+
205
+ ## Installation
206
+
207
+ Modus is distributed on PyPI as `openmodus`, while the installed command and
208
+ Python import remain `modus`:
209
+
210
+ ```bash
211
+ uv tool install openmodus
212
+ modus --version
213
+ modus init
214
+ ```
215
+
216
+ Python 3.11 or newer is required.
217
+
218
+ ## Development
219
+
220
+ The package supports Python 3.11–3.14.
221
+
222
+ ```bash
223
+ uv sync --locked --extra test
224
+ uv run pytest
225
+ uv run ruff check .
226
+ uv run mypy
227
+ uv build
228
+ ```
229
+
230
+ The architecture boundary test rejects imports of `modus.init_analysis` from
231
+ ordinary runtime packages. Distribution checks also reject legacy
232
+ `modus.graph`, SQLite stores, WAL/query code, and obsolete graph commands.
233
+
234
+ The public application boundary is intentionally narrow:
235
+
236
+ ```python
237
+ from modus.init_analysis import BuildOptions, EvidenceRequest
238
+ from modus.init_analysis import build, open_bundle, select
239
+
240
+ receipt = build(".", BuildOptions(compiler_mode="auto"))
241
+ bundle = open_bundle(
242
+ ".",
243
+ receipt.bundle_digest,
244
+ receipt.source_snapshot_digest,
245
+ )
246
+ scope = select(bundle, EvidenceRequest(view="scope"))
247
+ ```
248
+
249
+ Everything behind these calls is implementation detail. This keeps the first
250
+ release understandable today and leaves future machine-query capabilities free
251
+ to earn their own explicit product contract later.
@@ -0,0 +1,203 @@
1
+ # Modus
2
+
3
+ Modus turns a repository and its business material into reviewable,
4
+ source-grounded Markdown knowledge for coding agents.
5
+
6
+ The first open-source release keeps one durable product: authored knowledge.
7
+ Source graphs are not a second database. During `/modus-init` or
8
+ `/modus-reinit`, a disposable analyzer builds an in-memory evidence graph,
9
+ projects the evidence needed for authoring, and then releases its working
10
+ state.
11
+
12
+ ## Design
13
+
14
+ ```text
15
+ repository bytes + build context
16
+ │ freeze
17
+ ▼
18
+ CST / structural IR
19
+ │
20
+ project binding
21
+ │
22
+ compiler observations (optional)
23
+ │
24
+ explicit semantic reconciliation
25
+ │
26
+ in-memory evidence graph
27
+ │ project
28
+ ▼
29
+ deterministic JSON evidence bundle
30
+ │ current init/reinit only
31
+ ▼
32
+ reviewed Markdown knowledge
33
+ ```
34
+
35
+ This separation is intentional:
36
+
37
+ - source bytes and build configuration answer which code was analyzed;
38
+ - CST, project binding, and compiler observations retain their own provenance;
39
+ - exact, candidate, heuristic, and unresolved relationships stay distinct;
40
+ - conflicts become diagnostics instead of being overwritten;
41
+ - a method witness points back to source rather than copying method bodies;
42
+ - business domains and modules remain an agent-and-user judgment, never a
43
+ clustering side effect.
44
+
45
+ Ordinary knowledge use, hooks, status, and incremental updates read current
46
+ source and authored Markdown only. They cannot import or read initialization
47
+ analysis.
48
+
49
+ ## Product surface
50
+
51
+ Modus installs exactly five knowledge skills:
52
+
53
+ - `using-modus` progressively adds project evidence only when the task needs it;
54
+ - `modus-init` and `modus-reinit` create or fully refresh authored knowledge;
55
+ - `modus-update-knowledge` performs an explicitly requested scoped update;
56
+ - `modus-sync-knowledge` silently revises knowledge only after a code change
57
+ actually changes durable semantics or source anchors.
58
+
59
+ The first three authoring workflows are exposed as `/modus-init`,
60
+ `/modus-reinit`, and `/modus-update-knowledge`. `using-modus` and
61
+ `modus-sync-knowledge` are agent lifecycle helpers, not extra user workflows.
62
+ Unrelated conversations never inspect Modus state.
63
+
64
+ The project layout keeps control and data ownership visibly separate:
65
+
66
+ ```text
67
+ .modus/ config, manifest, neutral skills/commands, hooks
68
+ modus/knowledge/ the only durable product data
69
+ modus/.cache/ disposable analysis and authoring state, created on demand
70
+ ```
71
+
72
+ No other top-level entry belongs under `modus/`.
73
+
74
+ ## Evidence bundle
75
+
76
+ Each successful build publishes one immutable bundle:
77
+
78
+ ```text
79
+ modus/.cache/init-analysis/bundles/<bundleDigest>/
80
+ ├── manifest.json
81
+ ├── snapshot/{index.json,sources/,build-units/}
82
+ ├── scope/{index.json,candidates/}
83
+ ├── services/{index.json,boundaries/}
84
+ ├── diagnostics.json
85
+ └── evidence/{index.json,files/}
86
+ ```
87
+
88
+ Each namespace is a bounded stable-key range catalog. Source files, build
89
+ units, technical candidates, service boundaries, and evidence records have
90
+ independent shards. Scope exposes explainable technical signals and navigation,
91
+ never business names or conclusions.
92
+
93
+ The bundle contract has no absolute paths, timestamps, random IDs, raw graph,
94
+ SQL database, WAL, historical generation, full-text index, or query language.
95
+ JSON is stable-sorted UTF-8 with an explicit schema version.
96
+
97
+ Publication occurs in a same-filesystem temporary directory. The manifest binds
98
+ exactly five Merkle roots; recursive validation rejects bad catalogs, records,
99
+ references, paths, digests, and orphan shards before atomic rename. Current
100
+ initialization consumes only the `BuildReceipt` returned by its own invocation.
101
+
102
+ ## Commands
103
+
104
+ The supported CLI is deliberately small:
105
+
106
+ ```text
107
+ modus init
108
+ modus update
109
+ modus help
110
+ modus uninstall
111
+ modus status
112
+ modus --version
113
+ ```
114
+
115
+ `modus uninstall` removes managed project integration and the local CLI after
116
+ showing a preview. Authored knowledge under `modus/knowledge` is retained by
117
+ default; deleting that durable data requires the explicit
118
+ `modus uninstall --delete-knowledge` option.
119
+
120
+ Initialization Skills use one internal adapter:
121
+
122
+ ```text
123
+ modus internal init-analysis build --root . --compiler auto --json
124
+ modus internal init-analysis select --root . --bundle-digest <digest> --source-snapshot-digest <digest> --view scope|services|evidence --json
125
+ ```
126
+
127
+ The command is synchronous. Progress is written to stderr; JSON stdout contains
128
+ only the bundle digest, source-snapshot digest, coverage, and diagnostics
129
+ summaries. Select returns complete records under a byte/item budget and an
130
+ optional stable cursor. There is no graph update/status/query/export/doctor or
131
+ persisted progress command.
132
+
133
+ The design is informed by public ideas from CodeWiki, Aider, GitNexus,
134
+ Repomix, and OpenDeepWiki, while the implementation, contracts, tests, prompts,
135
+ and assets are independently authored for Modus. No source code from those
136
+ projects is included.
137
+
138
+ ## Failure semantics
139
+
140
+ Snapshot drift, an invalid manifest, a digest mismatch, or cross-bundle mixing
141
+ fails the current analysis. A failed build does not replace the last complete
142
+ bundle, but the current init/reinit also does not consume that older bundle.
143
+ It immediately continues from current source and user material.
144
+
145
+ A local parser or compiler-provider failure lowers only the affected evidence.
146
+ It never means the repository has no business behavior. Compiler observations
147
+ cannot silently overwrite CST or project binding; reconciliation retains the
148
+ chosen result, alternatives, reason, context, and source witness.
149
+
150
+ ## Workspace semantics
151
+
152
+ A workspace root never runs initialization analysis. When a user chooses to
153
+ initialize members that have no authored knowledge, each member runs as an
154
+ independent single repository. Bundle identities and evidence never cross
155
+ member roots.
156
+
157
+ ## Installation
158
+
159
+ Modus is distributed on PyPI as `openmodus`, while the installed command and
160
+ Python import remain `modus`:
161
+
162
+ ```bash
163
+ uv tool install openmodus
164
+ modus --version
165
+ modus init
166
+ ```
167
+
168
+ Python 3.11 or newer is required.
169
+
170
+ ## Development
171
+
172
+ The package supports Python 3.11–3.14.
173
+
174
+ ```bash
175
+ uv sync --locked --extra test
176
+ uv run pytest
177
+ uv run ruff check .
178
+ uv run mypy
179
+ uv build
180
+ ```
181
+
182
+ The architecture boundary test rejects imports of `modus.init_analysis` from
183
+ ordinary runtime packages. Distribution checks also reject legacy
184
+ `modus.graph`, SQLite stores, WAL/query code, and obsolete graph commands.
185
+
186
+ The public application boundary is intentionally narrow:
187
+
188
+ ```python
189
+ from modus.init_analysis import BuildOptions, EvidenceRequest
190
+ from modus.init_analysis import build, open_bundle, select
191
+
192
+ receipt = build(".", BuildOptions(compiler_mode="auto"))
193
+ bundle = open_bundle(
194
+ ".",
195
+ receipt.bundle_digest,
196
+ receipt.source_snapshot_digest,
197
+ )
198
+ scope = select(bundle, EvidenceRequest(view="scope"))
199
+ ```
200
+
201
+ Everything behind these calls is implementation detail. This keeps the first
202
+ release understandable today and leaves future machine-query capabilities free
203
+ to earn their own explicit product contract later.
@@ -0,0 +1,164 @@
1
+ # Modus
2
+
3
+ Modus 将代码仓库与业务材料整理为可评审、可追溯到源码的 Markdown
4
+ 知识,供编码 Agent 使用。
5
+
6
+ 首版开源版本只有一种长期产品资产:正文知识。源码图不是第二套数据库。
7
+ `/modus-init` 或 `/modus-reinit` 会临时构建内存证据图,投影出本轮
8
+ 正文创作需要的证据,随后释放工作状态。
9
+
10
+ ## 设计主线
11
+
12
+ ```text
13
+ 源码字节 + 真实构建上下文
14
+ │ 冻结
15
+ ▼
16
+ CST / 结构 IR
17
+ │
18
+ 项目绑定
19
+ │
20
+ 编译语义观察(可选)
21
+ │
22
+ 显式语义协调
23
+ │
24
+ 内存证据图
25
+ │ 投影
26
+ ▼
27
+ 确定性 JSON 证据包
28
+ │ 仅当前 init/reinit
29
+ ▼
30
+ 经评审的 Markdown 正文
31
+ ```
32
+
33
+ 这条边界保证:
34
+
35
+ - 源码摘要与构建配置唯一回答“分析的是哪一份代码”;
36
+ - CST、项目绑定和编译观察分别保留来源;
37
+ - exact、candidate、heuristic、unresolved 不被混成一个置信分;
38
+ - 冲突进入 diagnostics,不由更强层级无痕覆盖;
39
+ - 方法证据只保存见证坐标,不复制完整方法体;
40
+ - Domain/Module 仍由 Agent 理解业务、用户确认边界,不由聚类直接命名。
41
+
42
+ 普通知识使用、hooks、公开 status 与增量更新只读取当前源码和正文,
43
+ 不能导入或读取初始化分析。
44
+
45
+ ## 产品边界
46
+
47
+ Modus 只安装五个知识库 Skill:
48
+
49
+ - `using-modus` 仅在任务需要当前项目事实时渐进增强;
50
+ - `modus-init` 与 `modus-reinit` 创建或完整刷新正文知识;
51
+ - `modus-update-knowledge` 执行用户主动要求的局部更新;
52
+ - `modus-sync-knowledge` 仅在代码变化真正影响长期语义或源码锚点时静默回刷。
53
+
54
+ 主动入口只有 `/modus-init`、`/modus-reinit`、`/modus-update-knowledge`。
55
+ `using-modus` 与 `modus-sync-knowledge` 是 Agent 生命周期能力,不增加用户流程;
56
+ 炒股、翻译、一般问答等不依赖当前项目事实的会话完全不读取 Modus。
57
+
58
+ 控制面与数据面的边界固定为:
59
+
60
+ ```text
61
+ .modus/ 配置、安装清单、中立 Skill/命令与 Hook
62
+ modus/knowledge/ 唯一长期产品数据
63
+ modus/.cache/ 按需创建、可丢弃的分析与创作状态
64
+ ```
65
+
66
+ `modus/` 下不允许出现其他一级文件或目录。
67
+
68
+ ## JSON 证据包
69
+
70
+ ```text
71
+ modus/.cache/init-analysis/bundles/<bundleDigest>/
72
+ ├── manifest.json
73
+ ├── snapshot/{index.json,sources/,build-units/}
74
+ ├── scope/{index.json,candidates/}
75
+ ├── services/{index.json,boundaries/}
76
+ ├── diagnostics.json
77
+ └── evidence/{index.json,files/}
78
+ ```
79
+
80
+ 每个 namespace 都是按稳定 key 排序的有界 range catalog;源码文件、构建
81
+ 单元、技术候选、服务边界和 evidence record 各自分片。Scope 只给出可解释
82
+ 的技术 signals 与 navigation,不生成业务命名或业务结论。
83
+
84
+ 证据包不包含绝对路径、时间戳、随机 ID、原始完整图、SQL 数据库、WAL、
85
+ 历史 generation、全文索引或通用查询语言。JSON 使用稳定排序、UTF-8、
86
+ 统一换行和显式 schemaVersion。
87
+
88
+ 构建先写同文件系统临时目录,manifest 只绑定五个 Merkle 根;递归校验
89
+ catalog、record、引用、路径、摘要和孤儿分片后原子发布。当前初始化只消费
90
+ 自己调用返回的 `BuildReceipt`。
91
+
92
+ ## CLI
93
+
94
+ 公开命令刻意保持精简:
95
+
96
+ ```text
97
+ modus init
98
+ modus update
99
+ modus help
100
+ modus uninstall
101
+ modus status
102
+ modus --version
103
+ ```
104
+
105
+ `modus uninstall` 会先展示预览,再卸载受管项目集成与本机 CLI。
106
+ `modus/knowledge` 正文知识默认保留;只有显式使用
107
+ `modus uninstall --delete-knowledge` 才会删除这份长期数据。
108
+
109
+ 初始化 Skill 只使用一个内部适配器:
110
+
111
+ ```text
112
+ modus internal init-analysis build --root . --compiler auto --json
113
+ modus internal init-analysis select --root . --bundle-digest <digest> --source-snapshot-digest <digest> --view scope|services|evidence --json
114
+ ```
115
+
116
+ 命令同步完成,阶段进度写 stderr;构建回执只返回 bundleDigest、
117
+ sourceSnapshotDigest、覆盖摘要与 diagnostics 摘要。select 按字节/条目预算
118
+ 返回完整记录和可选稳定游标。
119
+ 不存在 graph update/status/query/export/doctor 或持久化 progress 命令。
120
+
121
+ 本设计参考 CodeWiki、Aider、GitNexus、Repomix 与 OpenDeepWiki 的公开理念,
122
+ 但实现、合同、测试、提示词和资产均围绕 Modus 独立编写,不包含这些项目的源码。
123
+
124
+ ## 失败语义
125
+
126
+ 源码快照漂移、manifest 缺失、摘要不符或跨 bundle 混读会让本轮分析失败。
127
+ 失败不会覆盖最近完整包,但本轮 init/reinit 也不会回退读取旧包,而是立即
128
+ 用当前源码与材料继续。
129
+
130
+ 局部 parser 或 compiler Provider 失败只降低对应证据,不能解释成全仓没有
131
+ 业务事实。编译观察不能静默覆盖 CST 或项目绑定;协调结果保留选中关系、
132
+ 备选项、原因、上下文和源码见证。
133
+
134
+ workspace 根永不运行 init-analysis。用户选择初始化没有正文的成员时,每个
135
+ 成员作为独立单仓分别构建,bundle 身份和消费上下文互不污染。
136
+
137
+ ## 安装
138
+
139
+ Modus 在 PyPI 上的发行包名为 `openmodus`,安装后的命令与 Python 导入名
140
+ 仍然是 `modus`:
141
+
142
+ ```bash
143
+ uv tool install openmodus
144
+ modus --version
145
+ modus init
146
+ ```
147
+
148
+ 需要 Python 3.11 或更高版本。
149
+
150
+ ## 开发
151
+
152
+ ```bash
153
+ uv sync --locked --extra test
154
+ uv run pytest
155
+ uv run ruff check .
156
+ uv run mypy
157
+ uv build
158
+ ```
159
+
160
+ 架构边界测试会阻止普通运行时导入 `modus.init_analysis`;发布包检查会
161
+ 拒绝旧 `modus.graph`、SQLite store、WAL/query 代码和废弃 graph 命令。
162
+
163
+ 公共 Python 边界只有 `build`、`open_bundle`、`select` 及必要的类型
164
+ 契约。解析器、Provider、内存图和 JSON 编码细节均为内部实现。