nauro-core 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.
@@ -0,0 +1,14 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ .venv/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ .env
10
+ .DS_Store
11
+ **/.DS_Store
12
+ config.json
13
+ .sync-state.json
14
+ .nauro/
@@ -0,0 +1,13 @@
1
+ [importlinter]
2
+ root_packages =
3
+ nauro_core
4
+ include_external_packages = True
5
+
6
+ [importlinter:contract:isolation]
7
+ name = nauro_core must not import from consumers
8
+ type = forbidden
9
+ source_modules =
10
+ nauro_core
11
+ forbidden_modules =
12
+ nauro
13
+ mcp_server
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 Nauro AI
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,67 @@
1
+ Metadata-Version: 2.4
2
+ Name: nauro-core
3
+ Version: 0.1.0
4
+ Summary: Shared pure-Python logic for Nauro: parsing, validation, context assembly, constants.
5
+ Project-URL: Homepage, https://github.com/nauro-ai/nauro
6
+ Project-URL: Repository, https://github.com/nauro-ai/nauro/tree/main/packages/nauro-core
7
+ Project-URL: Issues, https://github.com/nauro-ai/nauro/issues
8
+ Author: Thomas Thomsen
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Requires-Python: >=3.11
17
+ Requires-Dist: bm25s>=0.2
18
+ Requires-Dist: pystemmer>=2.2
19
+ Provides-Extra: dev
20
+ Requires-Dist: import-linter; extra == 'dev'
21
+ Requires-Dist: pytest; extra == 'dev'
22
+ Requires-Dist: ruff; extra == 'dev'
23
+ Description-Content-Type: text/markdown
24
+
25
+ # nauro-core
26
+
27
+ Shared pure-Python library for the [Nauro](https://github.com/nauro-ai/nauro) ecosystem. Provides parsing, validation, context assembly, and constants used by both the Nauro CLI and the remote MCP server.
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ pip install nauro-core
33
+ ```
34
+
35
+ ## What's inside
36
+
37
+ - **`format`** — compiled regexes and parse/format functions for the Nauro markdown protocol (decision titles, metadata fields, section headers)
38
+ - **`constants`** — limits, thresholds, valid values, file paths shared across all Nauro surfaces
39
+ - **`parsing`** — pure `str → dict` functions: `parse_decision`, `parse_questions`, `extract_stack_summary`, `decisions_summary_lines`
40
+ - **`context`** — `build_l0`/`build_l1`/`build_l2` context assembly from pre-loaded files and parsed decisions
41
+ - **`validation`** — structural screening, hash dedup, Jaccard similarity for decision conflict detection
42
+ - **`pending`** — `PendingStore` for the propose/confirm decision workflow
43
+
44
+ ## Design principles
45
+
46
+ - **Zero runtime dependencies** — pure Python, no I/O, no filesystem, no network
47
+ - **Function injection** — callers pass pre-loaded data (`files: dict[str, str]`, `decisions: list[dict]`); nauro-core never reads files or calls APIs
48
+ - **Import isolation** — enforced via `import-linter`: nauro-core cannot import from `nauro` or `mcp_server`
49
+
50
+ ## Usage
51
+
52
+ ```python
53
+ from nauro_core import parse_decision, build_l0, compute_hash
54
+
55
+ # Parse a decision markdown file
56
+ decision = parse_decision(markdown_content, "042-use-s3.md")
57
+
58
+ # Build L0 context from pre-loaded files
59
+ context = build_l0(files={"state.md": state, "stack.md": stack}, decisions=decisions)
60
+
61
+ # Check for duplicate decisions
62
+ hash_val = compute_hash(title="Use S3 for storage", rationale="...")
63
+ ```
64
+
65
+ ## License
66
+
67
+ Apache 2.0
@@ -0,0 +1,43 @@
1
+ # nauro-core
2
+
3
+ Shared pure-Python library for the [Nauro](https://github.com/nauro-ai/nauro) ecosystem. Provides parsing, validation, context assembly, and constants used by both the Nauro CLI and the remote MCP server.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install nauro-core
9
+ ```
10
+
11
+ ## What's inside
12
+
13
+ - **`format`** — compiled regexes and parse/format functions for the Nauro markdown protocol (decision titles, metadata fields, section headers)
14
+ - **`constants`** — limits, thresholds, valid values, file paths shared across all Nauro surfaces
15
+ - **`parsing`** — pure `str → dict` functions: `parse_decision`, `parse_questions`, `extract_stack_summary`, `decisions_summary_lines`
16
+ - **`context`** — `build_l0`/`build_l1`/`build_l2` context assembly from pre-loaded files and parsed decisions
17
+ - **`validation`** — structural screening, hash dedup, Jaccard similarity for decision conflict detection
18
+ - **`pending`** — `PendingStore` for the propose/confirm decision workflow
19
+
20
+ ## Design principles
21
+
22
+ - **Zero runtime dependencies** — pure Python, no I/O, no filesystem, no network
23
+ - **Function injection** — callers pass pre-loaded data (`files: dict[str, str]`, `decisions: list[dict]`); nauro-core never reads files or calls APIs
24
+ - **Import isolation** — enforced via `import-linter`: nauro-core cannot import from `nauro` or `mcp_server`
25
+
26
+ ## Usage
27
+
28
+ ```python
29
+ from nauro_core import parse_decision, build_l0, compute_hash
30
+
31
+ # Parse a decision markdown file
32
+ decision = parse_decision(markdown_content, "042-use-s3.md")
33
+
34
+ # Build L0 context from pre-loaded files
35
+ context = build_l0(files={"state.md": state, "stack.md": stack}, decisions=decisions)
36
+
37
+ # Check for duplicate decisions
38
+ hash_val = compute_hash(title="Use S3 for storage", rationale="...")
39
+ ```
40
+
41
+ ## License
42
+
43
+ Apache 2.0
@@ -0,0 +1,49 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "nauro-core"
7
+ version = "0.1.0"
8
+ description = "Shared pure-Python logic for Nauro: parsing, validation, context assembly, constants."
9
+ readme = "README.md"
10
+ license = "Apache-2.0"
11
+ requires-python = ">= 3.11"
12
+ authors = [
13
+ {name = "Thomas Thomsen"},
14
+ ]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "License :: OSI Approved :: Apache Software License",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ ]
22
+ dependencies = [
23
+ "bm25s>=0.2",
24
+ "PyStemmer>=2.2",
25
+ ]
26
+
27
+ [project.optional-dependencies]
28
+ dev = ["pytest", "ruff", "import-linter"]
29
+
30
+ [project.urls]
31
+ Homepage = "https://github.com/nauro-ai/nauro"
32
+ Repository = "https://github.com/nauro-ai/nauro/tree/main/packages/nauro-core"
33
+ Issues = "https://github.com/nauro-ai/nauro/issues"
34
+
35
+ [tool.hatch.build.targets.wheel]
36
+ packages = ["src/nauro_core"]
37
+
38
+ [tool.ruff]
39
+ target-version = "py311"
40
+ line-length = 99
41
+
42
+ [tool.ruff.lint]
43
+ select = ["E", "F", "I", "UP", "B", "SIM"]
44
+
45
+ [tool.ruff.format]
46
+ quote-style = "double"
47
+
48
+ [tool.pytest.ini_options]
49
+ testpaths = ["tests"]
@@ -0,0 +1,202 @@
1
+ """nauro-core: shared pure-Python logic for the Nauro ecosystem.
2
+
3
+ Re-export facade — public API symbols from all modules.
4
+ """
5
+
6
+ __version__ = "0.1.0"
7
+
8
+ from nauro_core.constants import (
9
+ DECISION_HASHES_FILE as DECISION_HASHES_FILE,
10
+ )
11
+ from nauro_core.constants import (
12
+ DECISION_TYPES as DECISION_TYPES,
13
+ )
14
+ from nauro_core.constants import (
15
+ DECISIONS_DIR as DECISIONS_DIR,
16
+ )
17
+ from nauro_core.constants import (
18
+ EXPIRY_MINUTES as EXPIRY_MINUTES,
19
+ )
20
+ from nauro_core.constants import (
21
+ EXTRACTION_SOURCES as EXTRACTION_SOURCES,
22
+ )
23
+ from nauro_core.constants import (
24
+ JACCARD_THRESHOLD as JACCARD_THRESHOLD,
25
+ )
26
+ from nauro_core.constants import (
27
+ L0_DECISIONS_SUMMARY_LIMIT as L0_DECISIONS_SUMMARY_LIMIT,
28
+ )
29
+ from nauro_core.constants import (
30
+ L0_QUESTIONS_LIMIT as L0_QUESTIONS_LIMIT,
31
+ )
32
+ from nauro_core.constants import (
33
+ L1_DECISIONS_LIMIT as L1_DECISIONS_LIMIT,
34
+ )
35
+ from nauro_core.constants import (
36
+ L1_DECISIONS_SUMMARY_LIMIT as L1_DECISIONS_SUMMARY_LIMIT,
37
+ )
38
+ from nauro_core.constants import (
39
+ MAX_APPROACH_LENGTH as MAX_APPROACH_LENGTH,
40
+ )
41
+ from nauro_core.constants import (
42
+ MAX_CONTEXT_LENGTH as MAX_CONTEXT_LENGTH,
43
+ )
44
+ from nauro_core.constants import (
45
+ MAX_DELTA_LENGTH as MAX_DELTA_LENGTH,
46
+ )
47
+ from nauro_core.constants import (
48
+ MAX_QUESTION_LENGTH as MAX_QUESTION_LENGTH,
49
+ )
50
+ from nauro_core.constants import (
51
+ MAX_RATIONALE_LENGTH as MAX_RATIONALE_LENGTH,
52
+ )
53
+ from nauro_core.constants import (
54
+ MAX_TITLE_LENGTH as MAX_TITLE_LENGTH,
55
+ )
56
+ from nauro_core.constants import (
57
+ MCP_INSTRUCTIONS as MCP_INSTRUCTIONS,
58
+ )
59
+ from nauro_core.constants import (
60
+ MIN_RATIONALE_LENGTH as MIN_RATIONALE_LENGTH,
61
+ )
62
+ from nauro_core.constants import (
63
+ OPEN_QUESTIONS_MD as OPEN_QUESTIONS_MD,
64
+ )
65
+ from nauro_core.constants import (
66
+ PROJECT_MD as PROJECT_MD,
67
+ )
68
+ from nauro_core.constants import (
69
+ REVERSIBILITY_LEVELS as REVERSIBILITY_LEVELS,
70
+ )
71
+ from nauro_core.constants import (
72
+ SNAPSHOTS_DIR as SNAPSHOTS_DIR,
73
+ )
74
+ from nauro_core.constants import (
75
+ STACK_EMPTY_MARKER as STACK_EMPTY_MARKER,
76
+ )
77
+ from nauro_core.constants import (
78
+ STACK_MD as STACK_MD,
79
+ )
80
+ from nauro_core.constants import (
81
+ STATE_CURRENT_FILENAME as STATE_CURRENT_FILENAME,
82
+ )
83
+ from nauro_core.constants import (
84
+ STATE_HISTORY_FILENAME as STATE_HISTORY_FILENAME,
85
+ )
86
+ from nauro_core.constants import (
87
+ STATE_LEGACY_FILENAME as STATE_LEGACY_FILENAME,
88
+ )
89
+ from nauro_core.constants import (
90
+ STATE_MD as STATE_MD,
91
+ )
92
+ from nauro_core.constants import (
93
+ VALID_CONFIDENCES as VALID_CONFIDENCES,
94
+ )
95
+ from nauro_core.context import (
96
+ build_l0 as build_l0,
97
+ )
98
+ from nauro_core.context import (
99
+ build_l1 as build_l1,
100
+ )
101
+ from nauro_core.context import (
102
+ build_l2 as build_l2,
103
+ )
104
+ from nauro_core.format import (
105
+ METADATA_PATTERN as METADATA_PATTERN,
106
+ )
107
+ from nauro_core.format import (
108
+ SECTION_PATTERN as SECTION_PATTERN,
109
+ )
110
+ from nauro_core.format import (
111
+ TITLE_PATTERN as TITLE_PATTERN,
112
+ )
113
+ from nauro_core.format import (
114
+ format_metadata_field as format_metadata_field,
115
+ )
116
+ from nauro_core.format import (
117
+ format_title as format_title,
118
+ )
119
+ from nauro_core.format import (
120
+ parse_metadata as parse_metadata,
121
+ )
122
+ from nauro_core.format import (
123
+ parse_title as parse_title,
124
+ )
125
+ from nauro_core.mcp_tools import (
126
+ ALL_TOOLS as ALL_TOOLS,
127
+ )
128
+ from nauro_core.mcp_tools import (
129
+ ToolSpec as ToolSpec,
130
+ )
131
+ from nauro_core.mcp_tools import (
132
+ get_tool_spec as get_tool_spec,
133
+ )
134
+ from nauro_core.parsing import (
135
+ decisions_summary_lines as decisions_summary_lines,
136
+ )
137
+ from nauro_core.parsing import (
138
+ extract_current_state as extract_current_state,
139
+ )
140
+ from nauro_core.parsing import (
141
+ extract_decision_number as extract_decision_number,
142
+ )
143
+ from nauro_core.parsing import (
144
+ extract_relevance_snippet as extract_relevance_snippet,
145
+ )
146
+ from nauro_core.parsing import (
147
+ extract_stack_oneliner as extract_stack_oneliner,
148
+ )
149
+ from nauro_core.parsing import (
150
+ extract_stack_summary as extract_stack_summary,
151
+ )
152
+ from nauro_core.parsing import (
153
+ parse_decision as parse_decision,
154
+ )
155
+ from nauro_core.parsing import (
156
+ parse_metadata_field as parse_metadata_field,
157
+ )
158
+ from nauro_core.parsing import (
159
+ parse_questions as parse_questions,
160
+ )
161
+ from nauro_core.parsing import (
162
+ strip_frontmatter as strip_frontmatter,
163
+ )
164
+ from nauro_core.pending import (
165
+ PendingStore as PendingStore,
166
+ )
167
+ from nauro_core.search import (
168
+ bm25_retrieve as bm25_retrieve,
169
+ )
170
+ from nauro_core.search import (
171
+ bm25_search as bm25_search,
172
+ )
173
+ from nauro_core.state import (
174
+ StateUpdateResult as StateUpdateResult,
175
+ )
176
+ from nauro_core.state import (
177
+ assemble_state_for_context as assemble_state_for_context,
178
+ )
179
+ from nauro_core.state import (
180
+ migrate_legacy_state as migrate_legacy_state,
181
+ )
182
+ from nauro_core.state import (
183
+ prepare_state_update as prepare_state_update,
184
+ )
185
+ from nauro_core.validation import (
186
+ check_content_length as check_content_length,
187
+ )
188
+ from nauro_core.validation import (
189
+ check_jaccard_similarity as check_jaccard_similarity,
190
+ )
191
+ from nauro_core.validation import (
192
+ compute_hash as compute_hash,
193
+ )
194
+ from nauro_core.validation import (
195
+ jaccard_similarity as jaccard_similarity,
196
+ )
197
+ from nauro_core.validation import (
198
+ screen_structural as screen_structural,
199
+ )
200
+ from nauro_core.validation import (
201
+ word_set as word_set,
202
+ )
@@ -0,0 +1,103 @@
1
+ """Shared limits, thresholds, valid values, and store filenames.
2
+
3
+ Canonical definitions for magic numbers and string constants used across
4
+ the Nauro ecosystem: token budgets, file names, decision statuses, field
5
+ defaults, and similarity thresholds.
6
+ """
7
+
8
+ # ── L0/L1/L2 payload limits ──
9
+ L0_QUESTIONS_LIMIT = 3
10
+ L0_DECISIONS_SUMMARY_LIMIT = 10
11
+ L1_DECISIONS_LIMIT = 10
12
+ L1_DECISIONS_SUMMARY_LIMIT = 10
13
+
14
+ # ── Validation thresholds ──
15
+ VALID_CONFIDENCES: set[str] = {"high", "medium", "low"}
16
+ MIN_RATIONALE_LENGTH = 20
17
+ JACCARD_THRESHOLD = 0.5
18
+
19
+ # ── Pending confirmation ──
20
+ EXPIRY_MINUTES = 10
21
+
22
+ # ── Decision hash dedup ──
23
+ DECISION_HASHES_FILE = ".decision-hashes.json"
24
+
25
+ # ── Store filenames ──
26
+ PROJECT_MD = "project.md"
27
+ STATE_MD = "state.md"
28
+ STATE_CURRENT_FILENAME = "state_current.md"
29
+ STATE_HISTORY_FILENAME = "state_history.md"
30
+ STATE_LEGACY_FILENAME = "state.md"
31
+ STACK_MD = "stack.md"
32
+ OPEN_QUESTIONS_MD = "open-questions.md"
33
+ DECISIONS_DIR = "decisions"
34
+ SNAPSHOTS_DIR = "snapshots"
35
+
36
+ # ── Decision types ──
37
+ DECISION_TYPES: tuple[str, ...] = (
38
+ "architecture",
39
+ "library_choice",
40
+ "pattern",
41
+ "refactor",
42
+ "api_design",
43
+ "infrastructure",
44
+ "data_model",
45
+ )
46
+
47
+ # ── Reversibility levels ──
48
+ REVERSIBILITY_LEVELS: tuple[str, ...] = ("easy", "moderate", "hard")
49
+
50
+ # ── Extraction sources ──
51
+ EXTRACTION_SOURCES: tuple[str, ...] = ("compaction", "commit", "manual", "mcp")
52
+
53
+ # ── Stack empty marker ──
54
+ STACK_EMPTY_MARKER = "# Stack\n<!-- Tech choices with rationale and rejected alternatives -->"
55
+
56
+ # ── Content size limits (H3 — STRIDE) ──
57
+ MAX_TITLE_LENGTH = 300
58
+ MAX_RATIONALE_LENGTH = 10_000
59
+ MAX_DELTA_LENGTH = 5_000
60
+ MAX_QUESTION_LENGTH = 2_000
61
+ MAX_CONTEXT_LENGTH = 5_000
62
+ MAX_APPROACH_LENGTH = 5_000
63
+
64
+ # ── MCP server instructions ──
65
+ # Delivered via the MCP `initialize` response to every connected client.
66
+ # Single source of truth — both local (stdio) and remote (HTTP) servers
67
+ # should reference this constant.
68
+ MCP_INSTRUCTIONS = """\
69
+ Nauro is the project's decision memory. Use it to check past decisions \
70
+ before committing to an approach, and to record new decisions as you make them.
71
+
72
+ ## When to check decisions
73
+
74
+ Before adopting any technical approach — architecture, library choice, \
75
+ API design, data model, infrastructure — call `check_decision` with a \
76
+ description of what you're considering. This includes when the user asks \
77
+ "should we...", "what if we...", "can we...", or "check if...". \
78
+ The tool surfaces conflicts with past decisions so you don't repeat \
79
+ rejected approaches.
80
+
81
+ ## When to propose decisions
82
+
83
+ Call `propose_decision` when you choose between two or more approaches, \
84
+ replace or remove a dependency, establish a new pattern, or cut scope. \
85
+ Do it at the moment the decision is made, not at the end of the session. \
86
+ Always include what was rejected and why.
87
+
88
+ Do NOT propose decisions for obvious bug fixes, adding tests for existing \
89
+ behavior, or renaming variables.
90
+
91
+ ## When to get context
92
+
93
+ Call `get_context` at the start of a session or when you need to \
94
+ understand the project's current state, goals, and constraints. \
95
+ L0 includes the last 10 decisions — do not call `list_decisions` \
96
+ after `get_context` unless you need older or superseded decisions.
97
+
98
+ ## When to update state
99
+
100
+ Call `update_state` when you complete a meaningful unit of work — \
101
+ a feature, a refactor, a bug fix — so the next session starts with \
102
+ current context.\
103
+ """