model-d 0.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- model_d-0.4.0.dist-info/METADATA +309 -0
- model_d-0.4.0.dist-info/RECORD +39 -0
- model_d-0.4.0.dist-info/WHEEL +5 -0
- model_d-0.4.0.dist-info/entry_points.txt +4 -0
- model_d-0.4.0.dist-info/licenses/LICENSE +202 -0
- model_d-0.4.0.dist-info/licenses/NOTICE +7 -0
- model_d-0.4.0.dist-info/licenses/THIRD_PARTY_NOTICES +11 -0
- model_d-0.4.0.dist-info/licenses/ocm/LIFE_LICENSE +21 -0
- model_d-0.4.0.dist-info/top_level.txt +1 -0
- ocm/LIFE_LICENSE +21 -0
- ocm/__init__.py +2 -0
- ocm/__main__.py +14 -0
- ocm/build.py +77 -0
- ocm/calc.py +51 -0
- ocm/cli.py +182 -0
- ocm/cmlm_vector/__init__.py +6 -0
- ocm/cmlm_vector/chunk.py +38 -0
- ocm/cmlm_vector/cli.py +75 -0
- ocm/cmlm_vector/embed.py +66 -0
- ocm/cmlm_vector/lawsearch.py +146 -0
- ocm/cmlm_vector/memory.py +368 -0
- ocm/data/pools.json +503 -0
- ocm/embed_cache.py +41 -0
- ocm/hybrid.py +97 -0
- ocm/init.py +143 -0
- ocm/install.py +89 -0
- ocm/life.py +303 -0
- ocm/loop.py +127 -0
- ocm/mcp.py +100 -0
- ocm/measure.py +72 -0
- ocm/providers/__init__.py +2 -0
- ocm/providers/claude_api.py +43 -0
- ocm/providers/gemini_api.py +70 -0
- ocm/providers/openai_api.py +37 -0
- ocm/router/__init__.py +0 -0
- ocm/router/lanes.py +111 -0
- ocm/router/router.py +93 -0
- ocm/server.py +280 -0
- ocm/units.py +104 -0
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: model-d
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: A shared workspace memory a team's AI agents ask first and teach back: fewer model requests at the same accuracy.
|
|
5
|
+
Author: Devieswar Kancheti
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://optimal-context-mapping-site.vercel.app
|
|
8
|
+
Project-URL: Source, https://github.com/devkancheti4-design/optimal-context-mapping
|
|
9
|
+
Project-URL: Evidence, https://github.com/devkancheti4-design/optimal-context-mapping/tree/main/evidence
|
|
10
|
+
Project-URL: DOI, https://doi.org/10.5281/zenodo.23289068
|
|
11
|
+
Keywords: ai-agents,coding-agents,claude,mcp,code-search,retrieval,context,tokens
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Topic :: Software Development
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
License-File: NOTICE
|
|
22
|
+
License-File: THIRD_PARTY_NOTICES
|
|
23
|
+
License-File: ocm/LIFE_LICENSE
|
|
24
|
+
Requires-Dist: numpy>=2.0
|
|
25
|
+
Requires-Dist: torch>=2.1
|
|
26
|
+
Requires-Dist: transformers>=4.40
|
|
27
|
+
Provides-Extra: claude
|
|
28
|
+
Requires-Dist: anthropic; extra == "claude"
|
|
29
|
+
Provides-Extra: openai
|
|
30
|
+
Requires-Dist: openai; extra == "openai"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# Model D (Optimal Context Mapping)
|
|
34
|
+
|
|
35
|
+
[](https://doi.org/10.5281/zenodo.23289068)
|
|
36
|
+
[](LICENSE)
|
|
37
|
+
|
|
38
|
+
**AI on your codebase, with a bill that flattens as your team works.**
|
|
39
|
+
|
|
40
|
+
Every AI coding agent on a team pays to search the same code again, and each search step is a paid model request.
|
|
41
|
+
Model D is a deterministic kit fused with the Claude API you already use:
|
|
42
|
+
- The kit maps your code once, on your machines, into 1,024-bit fingerprints ranked by small laws.
|
|
43
|
+
- Before each request, it decides where to look, at zero tokens.
|
|
44
|
+
- Claude reads what the kit already knows and explores only what is new.
|
|
45
|
+
- Every exploration teaches the kit, so the next engineer's question costs less.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
uv tool install git+https://github.com/devkancheti4-design/optimal-context-mapping # PyPI: uv tool install model-d
|
|
49
|
+
modeld install # wires it into Claude Code, Codex, Gemini CLI and Kiro
|
|
50
|
+
modeld build . --cache ~/.cache/modeld/embed.sqlite # maps this repository; rebuilds embed only what changed
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Where it pays
|
|
54
|
+
|
|
55
|
+
| work | vs the same agent alone | measured on |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| **A team's real year of fixes on one codebase** | **2.09x cheaper, the same work (252 vs 253 right); 1.88x → 2.57x as the year went on** | Django's 288 fixes from 2022, in order ([evidence/team-year](evidence/team-year)) |
|
|
58
|
+
| A team asking about its own repository | 2.3–2.8x cheaper, same accuracy | a company app, 5 roles, 3 runs |
|
|
59
|
+
| The same question again, in other words | 5–10x cheaper | 228-question stream; Gemini, 3 runs |
|
|
60
|
+
| Brand-new, scattered bugs | about 1.35x | 114 Django bugs, 3 runs |
|
|
61
|
+
| Finding the fixed file, offline | top-5 176 vs Graphify's 131, of 285 | SWE-bench Lite, 12 full repositories |
|
|
62
|
+
| Code review | small, about 1.3x at most: reviewers search about 3 times per PR | SWR-Bench pilot, partial ([evidence/swr-pilot](evidence/swr-pilot)) |
|
|
63
|
+
|
|
64
|
+
Every plan was hashed before it ran, and `python evidence/verify.py` recomputes every number from the raw rows.
|
|
65
|
+
|
|
66
|
+
## Pricing
|
|
67
|
+
- **Open source, $0:** the whole kit under Apache-2.0, self-hosted, for one developer or a team server.
|
|
68
|
+
- **Team, $49 per engineer per month:** we set up your team server, send a monthly savings report from your own
|
|
69
|
+
logs, and give priority fixes and a private support channel.
|
|
70
|
+
- **Enterprise, by contract:** air-gapped installs, rollout across many repositories, and a guaranteed response time.
|
|
71
|
+
|
|
72
|
+
Model D adds no model cost of its own. It cuts the API bill you already pay. For a team server, Docker and offline
|
|
73
|
+
installs, see [DEPLOY.md](DEPLOY.md). To get the most out of it, see [GUIDE.md](GUIDE.md).
|
|
74
|
+
|
|
75
|
+
## Why it works: work on a codebase isn't novel
|
|
76
|
+
|
|
77
|
+
Ten years of Django, 5,333 real fixes, touched only 650 files. After the first thousand fixes, 96–99% landed in a
|
|
78
|
+
file already fixed before. The files a team touches grow like the square root of its work (Heaps' law, fitted:
|
|
79
|
+
D(n) = 12·n^0.48). So the search for where to look should be paid once. The learning law says how much that
|
|
80
|
+
saves: S = A / ((1 − ν)·E + ν·K), where ν is the share of new work, E one learned read ($0.0004) and K a first
|
|
81
|
+
exploration with the kit. On Django's 2022 it forecast each quarter's saving from the earlier ones within 14%.
|
|
82
|
+
|
|
83
|
+
## How to use it
|
|
84
|
+
|
|
85
|
+
### 1. Install (Python 3.10+)
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
uv tool install model-d # or pipx install model-d, or pip install model-d; from a clone: pip install -e .
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
This installs the `modeld` command (and `modeld-mcp`), with numpy, torch and transformers. `python -m ocm` runs
|
|
92
|
+
the same commands. The embedding model (bge-base-en-v1.5) downloads once on the first build;
|
|
93
|
+
after that you can set `OCM_OFFLINE=1`.
|
|
94
|
+
|
|
95
|
+
### 2. Scan your repositories into a workspace
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
modeld build ~/code/our-api ~/code/our-web ~/code/our-docs --out ~/ocm-workspace
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
- **What gets kept:** every code and doc file under the folders you pass. Code is cut into blocks and docs into
|
|
102
|
+
sentences, and each becomes a 1,024-bit fingerprint, computed on your machine.
|
|
103
|
+
- **What is skipped:** `.env` files, keys, certificates, credential files, lockfiles, dependency and build folders, and
|
|
104
|
+
anything over 512 KB.
|
|
105
|
+
- **Also indexed:** build files with no extension (`Dockerfile`, `Makefile` and the like), `.conf`, `.mjml`, `.vscode`.
|
|
106
|
+
Doc sentences keep their line numbers.
|
|
107
|
+
- **Device:** a GPU is used automatically when present (CUDA, or Apple silicon); `--device cpu` forces the CPU.
|
|
108
|
+
|
|
109
|
+
**Rebuilding after code changes?** Carry what the team taught into the new workspace:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
modeld build ~/code/our-api ~/code/our-web --out ~/ocm-workspace-new --carry ~/ocm-workspace
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
The workspace keeps an exact memory of what was taught (`taught.life.json`, a Life from living-fused). On a carry,
|
|
116
|
+
each taught question is found in the new code by its exact line and its vector is taught again; an entry whose line
|
|
117
|
+
is gone abstains instead of guessing.
|
|
118
|
+
|
|
119
|
+
### 3. Serve it to the team
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
modeld serve ~/ocm-workspace --port 7700 # just you
|
|
123
|
+
modeld serve ~/ocm-workspace --port 7700 --host 0.0.0.0 # your team, on your network
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Run one server per team; everyone's agents share it. Every call is logged to `<workspace>/calls.jsonl`.
|
|
127
|
+
|
|
128
|
+
For a bug report, or any question whose answer is in code, ask with `"scope": "code"`. Documentation (`.md`, `.rst`,
|
|
129
|
+
`.txt` and the like) then stays out of the ranking. In a full repository, release notes and reference pages can
|
|
130
|
+
otherwise fill much of the readout. `OCM_SCOPE=code` makes it the server's default; the MCP tools take `scope` too.
|
|
131
|
+
|
|
132
|
+
### 4. Put it in your agents' loop
|
|
133
|
+
|
|
134
|
+
**One command per agent.** `ocm init` writes the right config into a repository. It merges into existing files, keeps
|
|
135
|
+
your other settings, and is safe to run again:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
modeld init claude ~/code/our-api --url http://ws.internal:7700 # Claude Code: two hooks + a CLAUDE.md note
|
|
139
|
+
modeld init kiro ~/code/our-api --url http://ws.internal:7700 # Kiro: .kiro/settings/mcp.json + .kiro/steering/ocm.md
|
|
140
|
+
modeld init codex ~/code/our-api --url http://ws.internal:7700 # OpenAI Codex: .codex/config.toml + AGENTS.md
|
|
141
|
+
modeld init gemini ~/code/our-api --url http://ws.internal:7700 # Gemini CLI: .gemini/settings.json + GEMINI.md
|
|
142
|
+
modeld init all ~/code/our-api --url http://ws.internal:7700 # all four
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
What each writes, by hand, follows.
|
|
146
|
+
|
|
147
|
+
**Claude Code (recommended): two hooks, nothing for the model to call.** Add this to the project's
|
|
148
|
+
`.claude/settings.json`, and point `OCM_URL` at the team's server if it is not local:
|
|
149
|
+
|
|
150
|
+
```json
|
|
151
|
+
{"env": {"OCM_URL": "http://127.0.0.1:7700"},
|
|
152
|
+
"hooks": {
|
|
153
|
+
"UserPromptSubmit": [{"hooks": [{"type": "command", "command": "modeld hook prompt"}]}],
|
|
154
|
+
"Stop": [{"hooks": [{"type": "command", "command": "modeld hook stop"}]}]
|
|
155
|
+
}}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
- **Before each request**, the prompt hook adds the code its laws rank for the question: the code a taught question's
|
|
159
|
+
vector points to (and then the router's next readout), or the nearest code and docs by meaning and keyword.
|
|
160
|
+
- **The model** answers from them when they answer the question, searches when they do not, and ends its reply with
|
|
161
|
+
`TEACH: <question> | <path>:<line>`, the line its answer is on.
|
|
162
|
+
- **After the reply**, the stop hook teaches those lines on your machine, at no model cost: each question's vector
|
|
163
|
+
becomes a cue on the code holding that line. No answer text is stored.
|
|
164
|
+
- **Between tasks**, run `/clear`. The next task starts from the workspace, not from the old transcript.
|
|
165
|
+
|
|
166
|
+
**Cursor and other MCP clients: as tools.** Add this to `.mcp.json` (Cursor: `.cursor/mcp.json`), and add
|
|
167
|
+
`pilot/AGENT_INSTRUCTIONS.md` to the agent's rules:
|
|
168
|
+
|
|
169
|
+
```json
|
|
170
|
+
{"mcpServers": {"ocm": {"command": "modeld", "args": ["mcp"], "env": {"OCM_URL": "http://127.0.0.1:7700"}}}}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
This costs a round trip per question, and in our team proof it did not save requests on its own (section 6). Use the
|
|
174
|
+
hooks where you can.
|
|
175
|
+
|
|
176
|
+
**Kiro, OpenAI Codex, Gemini CLI: as MCP tools.** `ocm init kiro|codex|gemini` registers the same four tools in each
|
|
177
|
+
tool's own MCP config, and puts the instructions where that agent reads them (`.kiro/steering/`, `AGENTS.md`,
|
|
178
|
+
`GEMINI.md`).
|
|
179
|
+
|
|
180
|
+
**Any other agent loop:** call `ocm.loop.prefetch(question)` before the model call, put the result in the prompt, and
|
|
181
|
+
call `ocm.loop.teach_from_reply(reply)` after it.
|
|
182
|
+
|
|
183
|
+
### The hybrid: the kit decides, the model reads or teaches
|
|
184
|
+
|
|
185
|
+
`ocm hybrid` runs a question through the hybrid. The kit's laws make every decision, at no model cost, and a model is
|
|
186
|
+
called only for one of two jobs:
|
|
187
|
+
|
|
188
|
+
- **Read:** the question is near one the kit was taught. The model reads the code the kit chose, once and with no tools,
|
|
189
|
+
and answers. If that code does not hold the answer, it says so and the question goes on to be taught.
|
|
190
|
+
- **Teach:** the question is new. The model explores (search, read, list on the team's workspace) just enough to find
|
|
191
|
+
the one line the answer is on. The kit learns that line, so the next question like it costs one read.
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
export OCM_URL=http://ws.internal:7700
|
|
195
|
+
modeld hybrid "What stops a deploy with placeholder secrets?" --provider claude # ANTHROPIC_API_KEY
|
|
196
|
+
modeld hybrid "..." --provider openai # OPENAI_API_KEY (pip install openai)
|
|
197
|
+
modeld hybrid "..." --provider gemini # GEMINI_API_KEY, or a Vertex project
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
| Provider | Reads with | Teaches with | Keys |
|
|
201
|
+
|---|---|---|---|
|
|
202
|
+
| `claude` (Anthropic SDK) | Claude Haiku 5.5 | Claude Sonnet 5.5 | `ANTHROPIC_API_KEY`, or `OCM_VERTEX_PROJECT` for Claude on Vertex AI |
|
|
203
|
+
| `openai` (OpenAI SDK) | `--reader`, default `gpt-5.6-terra` | `--teacher`, same default | `OPENAI_API_KEY` |
|
|
204
|
+
| `gemini` (REST) | gemini-2.5-flash | gemini-2.5-flash | `GEMINI_API_KEY`, or `OCM_VERTEX_PROJECT` |
|
|
205
|
+
|
|
206
|
+
In code: `from ocm.hybrid import run, provider, Workspace`, then
|
|
207
|
+
`run(question, provider("claude"), Workspace("http://ws.internal:7700"))`. It returns the path taken (`read` or
|
|
208
|
+
`teach`), the answer, the line taught, and the number of model requests. Measured so far (gemini-2.5-flash): one read
|
|
209
|
+
was right on 90/90 taught questions, and on 30/30 with Claude Haiku 5.5. The Gemini adapter has been run live end to
|
|
210
|
+
end. The Claude and OpenAI adapters are covered by the offline tests, but have not yet been run against their live
|
|
211
|
+
APIs.
|
|
212
|
+
|
|
213
|
+
### 5. Measure what it saves you
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
modeld calc --repeat 0.5 --deep 0.3 --questions-per-month 16800 # an estimate for your mix
|
|
217
|
+
modeld measure compare ~/before-transcripts ~/after-transcripts # the real thing, from your agents' transcripts
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
`pilot/PILOT.md` is a two-to-four-week plan for a fair before-and-after; fix it before you start
|
|
221
|
+
(`pilot/PREREGISTRATION.md`). Run the kit's tests with `python -m pytest -q tests`.
|
|
222
|
+
|
|
223
|
+
## Big repositories
|
|
224
|
+
|
|
225
|
+
What we measured with this kit on a MacBook (Apple silicon; its GPU was picked automatically):
|
|
226
|
+
|
|
227
|
+
| | measured |
|
|
228
|
+
|---|---|
|
|
229
|
+
| Scanning | 3,898 units in 13 s; transformers (10.8M tokens, 2,347 files) is 183,830 units and took 28 minutes |
|
|
230
|
+
| Storage | 128 bytes of fingerprint per unit: 183,875 units take 23.5 MB |
|
|
231
|
+
| Readout per request | 0.07 s over 183,875 units (the bit comparison itself takes 2.5 ms) |
|
|
232
|
+
| Results at size | live, this kit: 1.71x fewer requests over 10.8M tokens against 1.25x over 148k; earlier research harness: 9.2x on repeats over 10.8M, 6.1x over 7 codebases (7M tokens) |
|
|
233
|
+
|
|
234
|
+
- **Scope it.** Build one workspace over the repositories a team actually works in; one workspace over everything beat
|
|
235
|
+
one per codebase in our test.
|
|
236
|
+
- **Recall falls as size grows.** First-time questions find their answer less often in the first readout. Repeated
|
|
237
|
+
questions, drawn by a taught question's vector, hold up.
|
|
238
|
+
- **Rebuild after large code changes,** with `--carry` to bring what was taught along.
|
|
239
|
+
|
|
240
|
+
## How it works
|
|
241
|
+
|
|
242
|
+
The workspace is a CMLM: vectors and laws, not a store of text.
|
|
243
|
+
- **The vector law** ranks every unit by bits shared with the question: through the vectors of questions taught on
|
|
244
|
+
it, and through its own text.
|
|
245
|
+
- **The router law** picks which readout to send from eight free checks: the code a taught question's vector points
|
|
246
|
+
to, the 10 nearest by meaning, by keyword, or both. When the first readout is the taught one, the hook also sends
|
|
247
|
+
the router's next readout (its ADVANCE), so a near miss costs no search.
|
|
248
|
+
- **The learned law** reorders the nearest by meaning once it beats the vector order on your team's own questions.
|
|
249
|
+
|
|
250
|
+
**Teaching trains the CMLM on your machine, at no model cost.** A TEACH line names a question and the line its answer
|
|
251
|
+
is on. The question's vector becomes a cue on the unit holding that line, so a later question near it in meaning is
|
|
252
|
+
drawn to that code (vector generalisation), and it is an example for the learned law. Nothing the model wrote is
|
|
253
|
+
stored, and what the model gets back is always the code itself, with its path and line.
|
|
254
|
+
|
|
255
|
+
It is ranking math. The readout is ranked, not verified, so the model is told to use it only if it answers the
|
|
256
|
+
question.
|
|
257
|
+
|
|
258
|
+
## Privacy
|
|
259
|
+
|
|
260
|
+
Everything runs on your machines. Only the embedding model is downloaded, once; your code and questions never leave
|
|
261
|
+
your network.
|
|
262
|
+
|
|
263
|
+
## Limits, stated plainly
|
|
264
|
+
|
|
265
|
+
- **Repetition drives savings.** One-off questions save less, and short sessions that keep their own context gain
|
|
266
|
+
little.
|
|
267
|
+
- **Clear the session between tasks.** In Claude Code the facts the hook adds stay in the transcript and are re-read
|
|
268
|
+
on every later request:
|
|
269
|
+
- At 100 questions in one session, that cost 1.25x more than no CMLM (section 10).
|
|
270
|
+
- The same 100 questions in fresh 10-question sessions cost 1.31x less than one long session, at the same accuracy
|
|
271
|
+
(section 11). The CMLM keeps what was taught.
|
|
272
|
+
- If you must keep one long session, `OCM_COMPACT=1` cuts each readout to its top 3 items. That cut the pile-up
|
|
273
|
+
1.19x, but it still cost 1.05x more than no CMLM.
|
|
274
|
+
- **Repeats still cost a read today.** The TEACH rule asks for the exact line, and agents read the file to confirm it
|
|
275
|
+
even when the readout held the answer. Only 6 of 100 questions were answered with no search (section 12).
|
|
276
|
+
- **Deep dives** that chain across many files save little today: a taught question points at one line, not a whole
|
|
277
|
+
trail.
|
|
278
|
+
- **Billed input falls less than requests**, because readouts add reading.
|
|
279
|
+
- **The learned law rarely switches on for code** in our tests.
|
|
280
|
+
- **Taught vectors are append-only.** A rebuild carries them only with `--carry`: to the same line, or to the same line
|
|
281
|
+
reformatted (whitespace ignored), and `--prune-after N` drops a lesson whose line has been gone for N rebuilds in a
|
|
282
|
+
row. In our live test a carry over 400 commits kept 40 of 47 entries, but it did not save requests (section 13).
|
|
283
|
+
- **The tests are narrow:** open-source code and one client app, with Claude agents and judges. Your codebase is the
|
|
284
|
+
real test.
|
|
285
|
+
|
|
286
|
+
## Public benchmarks
|
|
287
|
+
|
|
288
|
+
Model D's retrieval is compared with Graphify on LOCOMO and on finding the file a fix changed. On 285 SWE-bench Lite
|
|
289
|
+
issues in 12 full repositories, with the code scope and the test plan fixed before it ran, Model D listed the fixed file
|
|
290
|
+
in its first five 176 times (issue titles) and 183 times (title + 400 characters), against 131 and 122 for Graphify
|
|
291
|
+
0.9.87, with about 2.4x fewer tokens (`evidence/swe-bench-lite/`). The study is reproducible, and the Claude Code
|
|
292
|
+
plugin is in the same repository: https://github.com/devkancheti4-design/model-d-graphify
|
|
293
|
+
|
|
294
|
+
## Licence
|
|
295
|
+
|
|
296
|
+
Apache License 2.0 (see `LICENSE` and `NOTICE`).
|
|
297
|
+
- `ocm/life.py` is also available under the MIT licence (`ocm/LIFE_LICENSE`).
|
|
298
|
+
- Third-party components are listed in `THIRD_PARTY_NOTICES`.
|
|
299
|
+
|
|
300
|
+
## Cite
|
|
301
|
+
|
|
302
|
+
If you use this work, please cite it:
|
|
303
|
+
|
|
304
|
+
> Kancheti, D. (2026). *Optimal Context Mapping (Model D): a shared, learning retrieval layer for AI coding agents*
|
|
305
|
+
> (Version 0.2.1) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.23289068
|
|
306
|
+
|
|
307
|
+
`CITATION.cff` has the same citation, and the DOI for all versions is 10.5281/zenodo.23289067.
|
|
308
|
+
|
|
309
|
+
Copyright 2026 Devieswar Kancheti.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
model_d-0.4.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
2
|
+
model_d-0.4.0.dist-info/licenses/NOTICE,sha256=_eQyzI7mxsZYfMllgPLEhFDwunVG40QTTVzN9JnTIHU,305
|
|
3
|
+
model_d-0.4.0.dist-info/licenses/THIRD_PARTY_NOTICES,sha256=dD1c8sIATxdWDJE7F9noo3Uio9RAplCitLGLm7lo74o,598
|
|
4
|
+
model_d-0.4.0.dist-info/licenses/ocm/LIFE_LICENSE,sha256=2vGTL1OyhQdQUh8HMTLWm6BjZtPd6QY68MRnycVHp8I,1076
|
|
5
|
+
ocm/LIFE_LICENSE,sha256=2vGTL1OyhQdQUh8HMTLWm6BjZtPd6QY68MRnycVHp8I,1076
|
|
6
|
+
ocm/__init__.py,sha256=7icOYZ7d_Y7YbYPVVW4EMH77RqnMpKW0ZUv1TWnoVHA,127
|
|
7
|
+
ocm/__main__.py,sha256=ZsUVsGC0Z7GgYFuOYKK-AnMeGoBvSZ8Z0z5EPHRyj-E,506
|
|
8
|
+
ocm/build.py,sha256=8llDPYO270JZMKmRgMCCT5fRyfgZBsz_jH_LQEA3dUY,4970
|
|
9
|
+
ocm/calc.py,sha256=QYoaYkyA0Fh9gEcREQyAeygke9QfU62_AJoSKu2rxCU,3512
|
|
10
|
+
ocm/cli.py,sha256=9sMJ9Qg9bBK0qf60wVC1bSjAlHBbKyc16pdhgbhS2zI,8369
|
|
11
|
+
ocm/embed_cache.py,sha256=hQWGFajvemh4UKfQpjb42tO4rbdxCYQFTlJnByMpS2s,2367
|
|
12
|
+
ocm/hybrid.py,sha256=FGR-1mWyQgEpp7KHLclWrHH7icMDpLF2jW5Z3McMIWU,5860
|
|
13
|
+
ocm/init.py,sha256=VPm5LjSDxx0rSoKINWl8TTqz17KLsSoxSg3pdivPlgc,6708
|
|
14
|
+
ocm/install.py,sha256=_b2dzNzbG4bPbb2hrWJurOuE0uM2EtOZUFA1utd6WDk,4383
|
|
15
|
+
ocm/life.py,sha256=vY2Ywuxfbv9Q6JAYbJIKj_5DF_0kssqvGCp3yx7fwBA,12286
|
|
16
|
+
ocm/loop.py,sha256=YEx9A68XHrmxTiVft7Kg0RTnRLR2EIJuK3SGeUDW_Os,5807
|
|
17
|
+
ocm/mcp.py,sha256=OpccTQC3R0i3DMT6qyby66DD0GAyQ0ExwA-ETQv5RDE,5793
|
|
18
|
+
ocm/measure.py,sha256=lPyDs5Z5VGKo3Z3X69se0J1l6CAOCMwbXIAuso5Xs_o,3868
|
|
19
|
+
ocm/server.py,sha256=04dXF1Rl5w2OAduIwXPCD_y2xWbXPoOA-83LPSG1pdA,17232
|
|
20
|
+
ocm/units.py,sha256=7V4CppCPSNDZPuVjS8gQZWBQddYTzYftkPvJVmG9gPM,5293
|
|
21
|
+
ocm/cmlm_vector/__init__.py,sha256=OoR4SRXV2Ty1tHaWT54Rl4Mpk_-W_YVkEFUNhn5hcUI,209
|
|
22
|
+
ocm/cmlm_vector/chunk.py,sha256=Ub5ssiOzsmXawy6S6-JhU7Wd_OgXhfOeCnfbmnP35PQ,1982
|
|
23
|
+
ocm/cmlm_vector/cli.py,sha256=_6L_BcWwGQuUdM8r-0FpUCi-a7kTbajLYf1UnHMmPag,4331
|
|
24
|
+
ocm/cmlm_vector/embed.py,sha256=gyKt3yyXAbUBz6Ug8A1QV7fqTymCNB7xkAh_lVFOl7E,3221
|
|
25
|
+
ocm/cmlm_vector/lawsearch.py,sha256=FdQGc3DpgXjUJPHHWTIw3UTaR9T-79QLRqwEQFG0DiI,7802
|
|
26
|
+
ocm/cmlm_vector/memory.py,sha256=qx3F98VWvlXcenlednNZGE4Wd85d57vrWNVWsMj0QGI,21655
|
|
27
|
+
ocm/data/pools.json,sha256=E0xt3l1vBHw0m4MnKWLDVWhikjosEGXiGWtxWPwV82U,3686
|
|
28
|
+
ocm/providers/__init__.py,sha256=FinIDGSHf4GoK1N0-NRVi89tvGB7DWU3tQ7a-XsoC3Y,195
|
|
29
|
+
ocm/providers/claude_api.py,sha256=9fQmtWXZd6Dca6tajbdQLUfOLBiIwsctlXMVln2hTJA,2611
|
|
30
|
+
ocm/providers/gemini_api.py,sha256=tQ-BwPiCeFYqYseWmYsoKVHTr5r95pdCN3GXMPdquEs,4555
|
|
31
|
+
ocm/providers/openai_api.py,sha256=XKYALSEd-oVq8spAl0VH0cFQe5IsTRlfYqZ_J2kYZMs,2204
|
|
32
|
+
ocm/router/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
33
|
+
ocm/router/lanes.py,sha256=aO1SFdTADX45LuYesvCR86xkiDV2flX4km-D8WVBw3Q,7314
|
|
34
|
+
ocm/router/router.py,sha256=k6Q1M2FhBGGfIQBs0L0MrjUA6oNnFOaiy5BLsgb0iPk,3914
|
|
35
|
+
model_d-0.4.0.dist-info/METADATA,sha256=inYNX841RquXO8uOyXwYafNGi0-kZG91ovnPGlobl8o,17421
|
|
36
|
+
model_d-0.4.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
37
|
+
model_d-0.4.0.dist-info/entry_points.txt,sha256=fU9-bJO9jbgvnKmfaOZBP7U2LB-DHqeKhoHgoWSJF-w,90
|
|
38
|
+
model_d-0.4.0.dist-info/top_level.txt,sha256=JGU4u4TV6pTRvXJ2yPQin4IB1P8OVZ-OsoF0Sb7muYw,4
|
|
39
|
+
model_d-0.4.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Optimal Context Mapping (Model D)
|
|
2
|
+
Copyright 2026 Devieswar Kancheti
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
5
|
+
|
|
6
|
+
ocm/life.py (the Life) is also available under the MIT licence; see ocm/LIFE_LICENSE.
|
|
7
|
+
The third-party components it installs or downloads are listed in THIRD_PARTY_NOTICES.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Third-party components
|
|
2
|
+
|
|
3
|
+
Optimal Context Mapping installs and uses these open-source components, each under its own licence. None of them is
|
|
4
|
+
modified or bundled in this package; pip installs them from their usual sources.
|
|
5
|
+
|
|
6
|
+
- NumPy: BSD 3-Clause licence.
|
|
7
|
+
- PyTorch: BSD 3-Clause licence.
|
|
8
|
+
- Hugging Face transformers, tokenizers, safetensors and huggingface-hub: Apache License 2.0.
|
|
9
|
+
- BAAI/bge-base-en-v1.5 (the embedding model, downloaded once from Hugging Face on the first build): MIT licence.
|
|
10
|
+
|
|
11
|
+
Optional, only if you use the matching provider in `ocm hybrid`: anthropic (MIT), openai (Apache 2.0).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 devkancheti4-design
|
|
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 @@
|
|
|
1
|
+
ocm
|
ocm/LIFE_LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 devkancheti4-design
|
|
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.
|
ocm/__init__.py
ADDED
ocm/__main__.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""python -m ocm <build | serve | hook | mcp | init | hybrid | measure | calc> ... (see README.md)"""
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def main():
|
|
6
|
+
cmds = {"build": "build", "serve": "server", "hook": "loop", "mcp": "mcp", "init": "init", "hybrid": "hybrid", "measure": "measure", "calc": "calc"}
|
|
7
|
+
if len(sys.argv) < 2 or sys.argv[1] not in cmds:
|
|
8
|
+
print(__doc__); sys.exit(2)
|
|
9
|
+
import importlib
|
|
10
|
+
importlib.import_module(f"ocm.{cmds[sys.argv[1]]}").main(sys.argv[2:])
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
if __name__ == "__main__":
|
|
14
|
+
main()
|