sheldon-context 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.
- sheldon_context-0.1.0/LICENSE +21 -0
- sheldon_context-0.1.0/MANIFEST.in +8 -0
- sheldon_context-0.1.0/PKG-INFO +178 -0
- sheldon_context-0.1.0/PYPI_README.md +134 -0
- sheldon_context-0.1.0/README.md +4490 -0
- sheldon_context-0.1.0/pyproject.toml +65 -0
- sheldon_context-0.1.0/setup.cfg +4 -0
- sheldon_context-0.1.0/sheldon_context/__init__.py +1087 -0
- sheldon_context-0.1.0/sheldon_context/__main__.py +6 -0
- sheldon_context-0.1.0/sheldon_context/_version.py +3 -0
- sheldon_context-0.1.0/sheldon_context/adapters.py +287 -0
- sheldon_context-0.1.0/sheldon_context/adaptive_context_policy.py +318 -0
- sheldon_context-0.1.0/sheldon_context/adaptive_context_policy_c2.py +69 -0
- sheldon_context-0.1.0/sheldon_context/answer_anchored_reader.py +287 -0
- sheldon_context-0.1.0/sheldon_context/answer_contract.py +539 -0
- sheldon_context-0.1.0/sheldon_context/answer_object_execution.py +579 -0
- sheldon_context-0.1.0/sheldon_context/answer_object_programs.py +441 -0
- sheldon_context-0.1.0/sheldon_context/answer_object_realization.py +769 -0
- sheldon_context-0.1.0/sheldon_context/answer_ready_compiler.py +615 -0
- sheldon_context-0.1.0/sheldon_context/answer_ready_compiler_v2.py +229 -0
- sheldon_context-0.1.0/sheldon_context/answer_slot_reader.py +224 -0
- sheldon_context-0.1.0/sheldon_context/api.py +5376 -0
- sheldon_context-0.1.0/sheldon_context/artifacts.py +3869 -0
- sheldon_context-0.1.0/sheldon_context/atomic_evidence.py +672 -0
- sheldon_context-0.1.0/sheldon_context/block_conditioned_adaptation.py +365 -0
- sheldon_context-0.1.0/sheldon_context/block_conditioned_reader.py +233 -0
- sheldon_context-0.1.0/sheldon_context/block_conditioned_runtime.py +111 -0
- sheldon_context-0.1.0/sheldon_context/canonical_citation_reader.py +109 -0
- sheldon_context-0.1.0/sheldon_context/citation_copy_lowering.py +261 -0
- sheldon_context-0.1.0/sheldon_context/cli.py +5534 -0
- sheldon_context-0.1.0/sheldon_context/client.py +2452 -0
- sheldon_context-0.1.0/sheldon_context/compact_cli.py +97 -0
- sheldon_context-0.1.0/sheldon_context/compare.py +2041 -0
- sheldon_context-0.1.0/sheldon_context/compare_cli.py +98 -0
- sheldon_context-0.1.0/sheldon_context/compiler.py +260 -0
- sheldon_context-0.1.0/sheldon_context/compiler_profiles.py +72 -0
- sheldon_context-0.1.0/sheldon_context/compression.py +263 -0
- sheldon_context-0.1.0/sheldon_context/context_program.py +914 -0
- sheldon_context-0.1.0/sheldon_context/copy_alignment_executor.py +205 -0
- sheldon_context-0.1.0/sheldon_context/coverage_gated_fallback.py +304 -0
- sheldon_context-0.1.0/sheldon_context/coverage_recovery_execution.py +235 -0
- sheldon_context-0.1.0/sheldon_context/coverage_verified_reader.py +356 -0
- sheldon_context-0.1.0/sheldon_context/diagnostics.py +298 -0
- sheldon_context-0.1.0/sheldon_context/domain_adaptation.py +737 -0
- sheldon_context-0.1.0/sheldon_context/domain_applications.py +436 -0
- sheldon_context-0.1.0/sheldon_context/domain_continuation.py +806 -0
- sheldon_context-0.1.0/sheldon_context/domain_curriculum.py +433 -0
- sheldon_context-0.1.0/sheldon_context/domain_execution.py +932 -0
- sheldon_context-0.1.0/sheldon_context/domain_kits.py +901 -0
- sheldon_context-0.1.0/sheldon_context/domain_preference.py +524 -0
- sheldon_context-0.1.0/sheldon_context/domain_preference_training.py +432 -0
- sheldon_context-0.1.0/sheldon_context/domain_profiles.py +1195 -0
- sheldon_context-0.1.0/sheldon_context/domain_programs.py +484 -0
- sheldon_context-0.1.0/sheldon_context/domain_training.py +807 -0
- sheldon_context-0.1.0/sheldon_context/engine.py +11373 -0
- sheldon_context-0.1.0/sheldon_context/evaluate_cli.py +286 -0
- sheldon_context-0.1.0/sheldon_context/evaluation.py +5510 -0
- sheldon_context-0.1.0/sheldon_context/evidence_checklist.py +165 -0
- sheldon_context-0.1.0/sheldon_context/evidence_fusion.py +754 -0
- sheldon_context-0.1.0/sheldon_context/evidence_indexed_realization.py +694 -0
- sheldon_context-0.1.0/sheldon_context/explicit_facet_parser.py +117 -0
- sheldon_context-0.1.0/sheldon_context/extractive_qa_selector.py +164 -0
- sheldon_context-0.1.0/sheldon_context/facet_answer_contract.py +243 -0
- sheldon_context-0.1.0/sheldon_context/facet_extractive_executor.py +208 -0
- sheldon_context-0.1.0/sheldon_context/factorized_relevance.py +141 -0
- sheldon_context-0.1.0/sheldon_context/few_shot_domain_kits.py +563 -0
- sheldon_context-0.1.0/sheldon_context/generation_boundaries.py +110 -0
- sheldon_context-0.1.0/sheldon_context/generic_compiler_v1.json +61 -0
- sheldon_context-0.1.0/sheldon_context/grounded_clause_repair.py +195 -0
- sheldon_context-0.1.0/sheldon_context/grounded_reader.py +300 -0
- sheldon_context-0.1.0/sheldon_context/ingest.py +619 -0
- sheldon_context-0.1.0/sheldon_context/isolated_source_slot_execution.py +232 -0
- sheldon_context-0.1.0/sheldon_context/line_pointer_executor.py +239 -0
- sheldon_context-0.1.0/sheldon_context/linear_evidence_binder.py +156 -0
- sheldon_context-0.1.0/sheldon_context/local_mlx.py +303 -0
- sheldon_context-0.1.0/sheldon_context/models.py +79 -0
- sheldon_context-0.1.0/sheldon_context/neural_answer_realization.py +552 -0
- sheldon_context-0.1.0/sheldon_context/obligation_bound_adaptation.py +707 -0
- sheldon_context-0.1.0/sheldon_context/obligation_bound_evidence.py +293 -0
- sheldon_context-0.1.0/sheldon_context/obligation_bound_runtime.py +462 -0
- sheldon_context-0.1.0/sheldon_context/obligation_clause_executor.py +310 -0
- sheldon_context-0.1.0/sheldon_context/obligation_copy_executor.py +114 -0
- sheldon_context-0.1.0/sheldon_context/obligation_evidence_executor.py +322 -0
- sheldon_context-0.1.0/sheldon_context/omission_explicit_recovery.py +422 -0
- sheldon_context-0.1.0/sheldon_context/packet.py +6415 -0
- sheldon_context-0.1.0/sheldon_context/profile_source_slot_execution.py +314 -0
- sheldon_context-0.1.0/sheldon_context/py.typed +1 -0
- sheldon_context-0.1.0/sheldon_context/question_scoped_facet_executor.py +159 -0
- sheldon_context-0.1.0/sheldon_context/quoted_evidence_executor.py +259 -0
- sheldon_context-0.1.0/sheldon_context/readiness.py +304 -0
- sheldon_context-0.1.0/sheldon_context/record_io.py +20 -0
- sheldon_context-0.1.0/sheldon_context/relative_relevance.py +86 -0
- sheldon_context-0.1.0/sheldon_context/retrieval.py +546 -0
- sheldon_context-0.1.0/sheldon_context/retrieval_aware_context.py +403 -0
- sheldon_context-0.1.0/sheldon_context/robust_omission_recovery.py +435 -0
- sheldon_context-0.1.0/sheldon_context/robust_slot_binding.py +189 -0
- sheldon_context-0.1.0/sheldon_context/routed_few_shot_domain_kits.py +599 -0
- sheldon_context-0.1.0/sheldon_context/salience_quoted_evidence_executor.py +156 -0
- sheldon_context-0.1.0/sheldon_context/scientific_context.py +575 -0
- sheldon_context-0.1.0/sheldon_context/scientific_evaluation.py +286 -0
- sheldon_context-0.1.0/sheldon_context/scientific_obligation.py +621 -0
- sheldon_context-0.1.0/sheldon_context/scientific_obligation_v3.py +455 -0
- sheldon_context-0.1.0/sheldon_context/selected_source_slot_execution.py +170 -0
- sheldon_context-0.1.0/sheldon_context/selective_evidence_executor.py +652 -0
- sheldon_context-0.1.0/sheldon_context/semantic_evidence_selector.py +264 -0
- sheldon_context-0.1.0/sheldon_context/semantic_markdown.py +305 -0
- sheldon_context-0.1.0/sheldon_context/slot_preserving_recovery.py +459 -0
- sheldon_context-0.1.0/sheldon_context/source_complete_reader.py +234 -0
- sheldon_context-0.1.0/sheldon_context/source_constrained_decoder.py +211 -0
- sheldon_context-0.1.0/sheldon_context/source_decomposed_quote_executor.py +182 -0
- sheldon_context-0.1.0/sheldon_context/source_exact_realization.py +849 -0
- sheldon_context-0.1.0/sheldon_context/source_hint_resolution.py +154 -0
- sheldon_context-0.1.0/sheldon_context/source_hint_resolution_v2.py +161 -0
- sheldon_context-0.1.0/sheldon_context/source_material_unit_execution.py +318 -0
- sheldon_context-0.1.0/sheldon_context/source_obligation_delta.py +615 -0
- sheldon_context-0.1.0/sheldon_context/source_only_regeneration.py +178 -0
- sheldon_context-0.1.0/sheldon_context/source_query_execution.py +788 -0
- sheldon_context-0.1.0/sheldon_context/source_query_programs.py +348 -0
- sheldon_context-0.1.0/sheldon_context/source_risk_pair_selector.py +199 -0
- sheldon_context-0.1.0/sheldon_context/source_risk_pareto_selector.py +113 -0
- sheldon_context-0.1.0/sheldon_context/source_scoped_atomic_copy.py +970 -0
- sheldon_context-0.1.0/sheldon_context/source_scoped_domain_execution.py +192 -0
- sheldon_context-0.1.0/sheldon_context/source_scoped_retrieval.py +249 -0
- sheldon_context-0.1.0/sheldon_context/source_scoped_retrieval_v2.py +320 -0
- sheldon_context-0.1.0/sheldon_context/source_structural_block_execution.py +324 -0
- sheldon_context-0.1.0/sheldon_context/source_supported_slot_execution.py +558 -0
- sheldon_context-0.1.0/sheldon_context/source_tail_completion.py +536 -0
- sheldon_context-0.1.0/sheldon_context/source_unit_completion.py +469 -0
- sheldon_context-0.1.0/sheldon_context/source_verified_revision.py +200 -0
- sheldon_context-0.1.0/sheldon_context/state.py +488 -0
- sheldon_context-0.1.0/sheldon_context/store.py +695 -0
- sheldon_context-0.1.0/sheldon_context/sufficiency_execution.py +1212 -0
- sheldon_context-0.1.0/sheldon_context/temporal_scope_router.py +93 -0
- sheldon_context-0.1.0/sheldon_context/text.py +124 -0
- sheldon_context-0.1.0/sheldon_context/transfer_dev_answer_ready_v1.json +45 -0
- sheldon_context-0.1.0/sheldon_context/transfer_dev_answer_ready_v2.json +53 -0
- sheldon_context-0.1.0/sheldon_context/typed_closure_execution.py +575 -0
- sheldon_context-0.1.0/sheldon_context/typed_closure_programs.py +334 -0
- sheldon_context-0.1.0/sheldon_context/unit_complete_coverage_reader.py +227 -0
- sheldon_context-0.1.0/sheldon_context/workload_contracts.py +1113 -0
- sheldon_context-0.1.0/sheldon_context/workload_policies.py +482 -0
- sheldon_context-0.1.0/sheldon_context/workload_proposals.py +245 -0
- sheldon_context-0.1.0/sheldon_context.egg-info/PKG-INFO +178 -0
- sheldon_context-0.1.0/sheldon_context.egg-info/SOURCES.txt +146 -0
- sheldon_context-0.1.0/sheldon_context.egg-info/dependency_links.txt +1 -0
- sheldon_context-0.1.0/sheldon_context.egg-info/entry_points.txt +5 -0
- sheldon_context-0.1.0/sheldon_context.egg-info/requires.txt +26 -0
- sheldon_context-0.1.0/sheldon_context.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Om Bhojane
|
|
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,178 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sheldon-context
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Local-first, source-grounded context management for small language models.
|
|
5
|
+
Author: Om Bhojane
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://sheldon.omisaur.app
|
|
8
|
+
Project-URL: Documentation, https://github.com/ombhojane/sheldon/tree/main/context-engine
|
|
9
|
+
Project-URL: Repository, https://github.com/ombhojane/sheldon
|
|
10
|
+
Project-URL: Issues, https://github.com/ombhojane/sheldon/issues
|
|
11
|
+
Keywords: context engineering,local ai,rag,small language models,source grounding
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: markdown-it-py<5,>=4.0
|
|
26
|
+
Provides-Extra: lsa
|
|
27
|
+
Requires-Dist: numpy>=1.24; extra == "lsa"
|
|
28
|
+
Provides-Extra: embeddings
|
|
29
|
+
Requires-Dist: sentence-transformers>=3.0; extra == "embeddings"
|
|
30
|
+
Provides-Extra: pdf
|
|
31
|
+
Requires-Dist: pypdf>=4.0; extra == "pdf"
|
|
32
|
+
Provides-Extra: mlx
|
|
33
|
+
Requires-Dist: mlx>=0.29; extra == "mlx"
|
|
34
|
+
Requires-Dist: mlx-lm>=0.31; extra == "mlx"
|
|
35
|
+
Requires-Dist: huggingface-hub>=0.30; extra == "mlx"
|
|
36
|
+
Provides-Extra: research
|
|
37
|
+
Requires-Dist: markdown-it-py==4.2.0; extra == "research"
|
|
38
|
+
Provides-Extra: dev
|
|
39
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
40
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
41
|
+
Requires-Dist: tomli>=2; python_version < "3.11" and extra == "dev"
|
|
42
|
+
Requires-Dist: twine>=6; extra == "dev"
|
|
43
|
+
Dynamic: license-file
|
|
44
|
+
|
|
45
|
+
# Sheldon
|
|
46
|
+
|
|
47
|
+
**Local evidence in. Source-grounded context out.**
|
|
48
|
+
|
|
49
|
+
Sheldon is a local-first context compiler for small language models. It turns
|
|
50
|
+
Markdown, text, LaTeX, PDF, and structured records into compact context packets
|
|
51
|
+
with visible citations, temporal state, conflict warnings, and a generation
|
|
52
|
+
gate.
|
|
53
|
+
|
|
54
|
+
Sheldon does not hide a hosted model behind the package. Core ingestion,
|
|
55
|
+
retrieval, state resolution, packet compilation, bundle verification, and the
|
|
56
|
+
HTTP API run locally. Model calls are explicit and optional.
|
|
57
|
+
|
|
58
|
+
## Install
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
python -m pip install sheldon-context
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The distribution is named `sheldon-context` because the older `sheldon` name on
|
|
65
|
+
PyPI belongs to an unrelated project. The command is simply `sheldon`, and the
|
|
66
|
+
Python import is `sheldon_context`.
|
|
67
|
+
|
|
68
|
+
## Five-minute path
|
|
69
|
+
|
|
70
|
+
Create a note:
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
# Release state
|
|
74
|
+
|
|
75
|
+
Current release: 2.4.
|
|
76
|
+
|
|
77
|
+
The 2.3 line is supported for security fixes only.
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Then compile it:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
sheldon --db /tmp/sheldon.db ingest release.md
|
|
84
|
+
sheldon --db /tmp/sheldon.db query "Which release is current?"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The packet includes the selected evidence and citations. With `--json`, inspect
|
|
88
|
+
`generation_gate.status` before calling a model:
|
|
89
|
+
|
|
90
|
+
- `ready`: the cited sources and packet fingerprint are current.
|
|
91
|
+
- `caution`: generation is allowed, but a warning must be preserved.
|
|
92
|
+
- `blocked`: source drift or an unresolved integrity issue must be repaired.
|
|
93
|
+
|
|
94
|
+
## Python
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
from pathlib import Path
|
|
98
|
+
from sheldon_context import LocalContextEngine
|
|
99
|
+
|
|
100
|
+
engine = LocalContextEngine(Path(".sheldon-context/context.db"))
|
|
101
|
+
try:
|
|
102
|
+
engine.ingest_text(
|
|
103
|
+
"Current release: 2.4. The 2.3 line gets security fixes only.",
|
|
104
|
+
source="release-note",
|
|
105
|
+
title="Release state",
|
|
106
|
+
)
|
|
107
|
+
result = engine.query("Which release is current?", token_budget=600)
|
|
108
|
+
print(result["packet"])
|
|
109
|
+
print(result["generation_gate"])
|
|
110
|
+
finally:
|
|
111
|
+
engine.close()
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## What the compiler owns
|
|
115
|
+
|
|
116
|
+
```text
|
|
117
|
+
local sources
|
|
118
|
+
-> typed evidence and temporal state
|
|
119
|
+
-> retrieval and conflict resolution
|
|
120
|
+
-> budgeted, cited context packet
|
|
121
|
+
-> generation gate and replayable bundle
|
|
122
|
+
-> your local or self-hosted model
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
This boundary matters. Evidence can be present while a model still omits,
|
|
126
|
+
misreads, or mixes it. Sheldon makes the pre-generation evidence path explicit
|
|
127
|
+
and keeps generated answers separate from deterministic context artifacts.
|
|
128
|
+
|
|
129
|
+
## Useful commands
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
sheldon --help
|
|
133
|
+
sheldon ingest --help
|
|
134
|
+
sheldon query --help
|
|
135
|
+
sheldon compile-context --help
|
|
136
|
+
sheldon bundle --help
|
|
137
|
+
sheldon verify-bundle --help
|
|
138
|
+
sheldon serve --help
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The complete research and evaluation surface remains available under:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
sheldon research --help
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Optional local backends
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
python -m pip install "sheldon-context[lsa]"
|
|
151
|
+
python -m pip install "sheldon-context[embeddings]"
|
|
152
|
+
python -m pip install "sheldon-context[pdf]"
|
|
153
|
+
python -m pip install "sheldon-context[mlx]"
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The dependency-free hashed and TF-IDF retrieval paths remain available without
|
|
157
|
+
those extras. Sentence-transformer and MLX weights are never bundled into this
|
|
158
|
+
package.
|
|
159
|
+
|
|
160
|
+
## Research boundary
|
|
161
|
+
|
|
162
|
+
Sheldon is alpha research software. The repository includes frozen positive,
|
|
163
|
+
mixed, and negative studies. Package verification proves artifact integrity and
|
|
164
|
+
installability; it does not turn every experimental method into a confirmed
|
|
165
|
+
accuracy improvement.
|
|
166
|
+
|
|
167
|
+
The current supported mechanism claim is narrow: reader adaptation and fixed
|
|
168
|
+
demonstrations can improve how a local model uses supplied evidence. A universal
|
|
169
|
+
context-rendering advantage, robust multi-source execution, and reliable
|
|
170
|
+
abstention have not been established.
|
|
171
|
+
|
|
172
|
+
## Links
|
|
173
|
+
|
|
174
|
+
- [Source and full documentation](https://github.com/ombhojane/sheldon)
|
|
175
|
+
- [Project site](https://sheldon.omisaur.app)
|
|
176
|
+
- [Issue tracker](https://github.com/ombhojane/sheldon/issues)
|
|
177
|
+
|
|
178
|
+
MIT licensed. Built by Om Bhojane.
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Sheldon
|
|
2
|
+
|
|
3
|
+
**Local evidence in. Source-grounded context out.**
|
|
4
|
+
|
|
5
|
+
Sheldon is a local-first context compiler for small language models. It turns
|
|
6
|
+
Markdown, text, LaTeX, PDF, and structured records into compact context packets
|
|
7
|
+
with visible citations, temporal state, conflict warnings, and a generation
|
|
8
|
+
gate.
|
|
9
|
+
|
|
10
|
+
Sheldon does not hide a hosted model behind the package. Core ingestion,
|
|
11
|
+
retrieval, state resolution, packet compilation, bundle verification, and the
|
|
12
|
+
HTTP API run locally. Model calls are explicit and optional.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
python -m pip install sheldon-context
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The distribution is named `sheldon-context` because the older `sheldon` name on
|
|
21
|
+
PyPI belongs to an unrelated project. The command is simply `sheldon`, and the
|
|
22
|
+
Python import is `sheldon_context`.
|
|
23
|
+
|
|
24
|
+
## Five-minute path
|
|
25
|
+
|
|
26
|
+
Create a note:
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
# Release state
|
|
30
|
+
|
|
31
|
+
Current release: 2.4.
|
|
32
|
+
|
|
33
|
+
The 2.3 line is supported for security fixes only.
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Then compile it:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
sheldon --db /tmp/sheldon.db ingest release.md
|
|
40
|
+
sheldon --db /tmp/sheldon.db query "Which release is current?"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The packet includes the selected evidence and citations. With `--json`, inspect
|
|
44
|
+
`generation_gate.status` before calling a model:
|
|
45
|
+
|
|
46
|
+
- `ready`: the cited sources and packet fingerprint are current.
|
|
47
|
+
- `caution`: generation is allowed, but a warning must be preserved.
|
|
48
|
+
- `blocked`: source drift or an unresolved integrity issue must be repaired.
|
|
49
|
+
|
|
50
|
+
## Python
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from pathlib import Path
|
|
54
|
+
from sheldon_context import LocalContextEngine
|
|
55
|
+
|
|
56
|
+
engine = LocalContextEngine(Path(".sheldon-context/context.db"))
|
|
57
|
+
try:
|
|
58
|
+
engine.ingest_text(
|
|
59
|
+
"Current release: 2.4. The 2.3 line gets security fixes only.",
|
|
60
|
+
source="release-note",
|
|
61
|
+
title="Release state",
|
|
62
|
+
)
|
|
63
|
+
result = engine.query("Which release is current?", token_budget=600)
|
|
64
|
+
print(result["packet"])
|
|
65
|
+
print(result["generation_gate"])
|
|
66
|
+
finally:
|
|
67
|
+
engine.close()
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## What the compiler owns
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
local sources
|
|
74
|
+
-> typed evidence and temporal state
|
|
75
|
+
-> retrieval and conflict resolution
|
|
76
|
+
-> budgeted, cited context packet
|
|
77
|
+
-> generation gate and replayable bundle
|
|
78
|
+
-> your local or self-hosted model
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
This boundary matters. Evidence can be present while a model still omits,
|
|
82
|
+
misreads, or mixes it. Sheldon makes the pre-generation evidence path explicit
|
|
83
|
+
and keeps generated answers separate from deterministic context artifacts.
|
|
84
|
+
|
|
85
|
+
## Useful commands
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
sheldon --help
|
|
89
|
+
sheldon ingest --help
|
|
90
|
+
sheldon query --help
|
|
91
|
+
sheldon compile-context --help
|
|
92
|
+
sheldon bundle --help
|
|
93
|
+
sheldon verify-bundle --help
|
|
94
|
+
sheldon serve --help
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The complete research and evaluation surface remains available under:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
sheldon research --help
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Optional local backends
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
python -m pip install "sheldon-context[lsa]"
|
|
107
|
+
python -m pip install "sheldon-context[embeddings]"
|
|
108
|
+
python -m pip install "sheldon-context[pdf]"
|
|
109
|
+
python -m pip install "sheldon-context[mlx]"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The dependency-free hashed and TF-IDF retrieval paths remain available without
|
|
113
|
+
those extras. Sentence-transformer and MLX weights are never bundled into this
|
|
114
|
+
package.
|
|
115
|
+
|
|
116
|
+
## Research boundary
|
|
117
|
+
|
|
118
|
+
Sheldon is alpha research software. The repository includes frozen positive,
|
|
119
|
+
mixed, and negative studies. Package verification proves artifact integrity and
|
|
120
|
+
installability; it does not turn every experimental method into a confirmed
|
|
121
|
+
accuracy improvement.
|
|
122
|
+
|
|
123
|
+
The current supported mechanism claim is narrow: reader adaptation and fixed
|
|
124
|
+
demonstrations can improve how a local model uses supplied evidence. A universal
|
|
125
|
+
context-rendering advantage, robust multi-source execution, and reliable
|
|
126
|
+
abstention have not been established.
|
|
127
|
+
|
|
128
|
+
## Links
|
|
129
|
+
|
|
130
|
+
- [Source and full documentation](https://github.com/ombhojane/sheldon)
|
|
131
|
+
- [Project site](https://sheldon.omisaur.app)
|
|
132
|
+
- [Issue tracker](https://github.com/ombhojane/sheldon/issues)
|
|
133
|
+
|
|
134
|
+
MIT licensed. Built by Om Bhojane.
|