renkin 0.17.0 → 0.18.0

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.
package/README.md CHANGED
@@ -265,6 +265,55 @@ Yield/success prediction and automatic literature search are explicitly out
265
265
  of scope for this phase — tracked as future work in
266
266
  [#41](https://github.com/kent-tokyo/renkin/issues/41).
267
267
 
268
+ ### Substrate-specific examples (`schema_version: 2`)
269
+
270
+ Everything above is *template-level*: it applies to every step using that
271
+ template, regardless of the actual molecule. `schema_version: 2` adds
272
+ `examples` — a per-template array where each entry is one curated record of
273
+ *this exact reaction*, keyed by `target_smiles`/`precursor_smiles`:
274
+
275
+ ```json
276
+ {
277
+ "schema_version": 2,
278
+ "templates": {
279
+ "smirks-sha256:...": {
280
+ "references": [{ "id": "ref-1", "kind": "doi", "identifier": "10.xxxx/example" }],
281
+ "examples": [{
282
+ "id": "ex-1",
283
+ "target_smiles": "c1ccc(-c2ccccc2)cc1",
284
+ "precursor_smiles": ["Brc1ccccc1", "c1ccccc1"],
285
+ "conditions": { "catalysts": ["Pd(PPh3)4"], "solvents": ["EtOH"], "source": "literature", "scope": "substrate_specific", "reference_ids": ["ref-1"] },
286
+ "reported_yield": { "percentage": 78.0, "basis": "isolated", "source": "literature", "scope": "substrate_specific", "reference_ids": ["ref-1"] },
287
+ "reference_ids": ["ref-1"]
288
+ }]
289
+ }
290
+ }
291
+ }
292
+ ```
293
+
294
+ `examples` requires `schema_version: 2` (a hard error under `1`); under
295
+ `schema_version: 2`, reported yields must live under `examples[].reported_yield`
296
+ too — a non-empty template-level `reported_yields` is a hard error there (it
297
+ stays allowed under `schema_version: 1`), so a substrate-specific number can't
298
+ leak onto every step using that template. Every condition/yield/warning
299
+ nested inside an example must be scoped `substrate_specific`.
300
+
301
+ A route step's `evidence.examples` are **resolved**, not just copied from the
302
+ sidecar: matched against that step by canonical target SMILES plus the
303
+ canonical, order-independent precursor set (reordering `precursor_smiles` in
304
+ the sidecar changes nothing), with every exact-substrate match kept and
305
+ same-template-different-substrate precedents capped at 3. Each resolved entry
306
+ carries a `match_kind` (`exact_substrate`/`template_only`) in the JSON itself,
307
+ plus a `template_examples_total` count — so JSON/Python consumers, not just
308
+ `--format explain`, can tell "evidence for this exact reaction" apart from
309
+ "literature precedent for a different substrate." `--format explain` shows
310
+ exact-substrate matches first, each labeled either `Exact substrate example:`
311
+ or *"different substrate; not a prediction"*, with `conditions`/
312
+ `reported_yield`/`warnings` each showing their own cited references directly
313
+ underneath (deduplicated when the same reference backs more than one part of
314
+ an example). See [Reaction Evidence guide](docs/guides/reaction-evidence.md#substrate-specific-examples-schema_version-2)
315
+ for full matching/validation semantics.
316
+
268
317
  ---
269
318
 
270
319
  ## Key Features
@@ -276,7 +325,7 @@ of scope for this phase — tracked as future work in
276
325
  | **Up to 50k reaction templates** | Auto-extracted from USPTO-50k/MIT via rdchiral; frequency-weighted priority; `--templates` for custom sets |
277
326
  | **Route scoring** | `confidence`, `step_confidence`, `success_probability` (Retro-prob style), `convergency`, `atom_economy` per step — see caveat below the table |
278
327
  | **Step metadata provenance** | Each step reports `metadata_source`/`metadata_scope` (e.g. `handcrafted_default`/`reaction_family`) so it's machine-readable whether `conditions`/`reaction_family` came from a rule-author default vs. something more grounded; absent for extracted templates, since nothing is fabricated for them. |
279
- | **Stable template IDs + evidence sidecar** | Every template gets a stable `template_id` — `rule:<name>` for hand-crafted rules, `smirks-sha256:<hex>` for extracted templates (independent of file order/position/count). Attach curated DOIs/patents, reported conditions, reported yields, and known side-reaction warnings via a `--template-metadata sidecar.json` file keyed by `template_id`; matching steps get an `evidence` field, everything else stays untouched — see [Template evidence metadata](#template-evidence-metadata) below. Run `renkin template ids <file.smi>` to list stable IDs for authoring a sidecar. Automatic yield/success prediction and literature search remain out of scope ([#41](https://github.com/kent-tokyo/renkin/issues/41)). |
328
+ | **Stable template IDs + evidence sidecar** | Every template gets a stable `template_id` — `rule:<name>` for hand-crafted rules, `smirks-sha256:<hex>` for extracted templates (independent of file order/position/count). Attach curated DOIs/patents, reported conditions, reported yields, and known side-reaction warnings via a `--template-metadata sidecar.json` file keyed by `template_id`; matching steps get an `evidence` field, everything else stays untouched — see [Template evidence metadata](#template-evidence-metadata) below. `schema_version: 2` sidecars can additionally attach `examples` — curated records tied to one exact target/precursor set, matched by canonical SMILES and surfaced first in `--format explain`. Run `renkin template ids <file.smi>` to list stable IDs for authoring a sidecar. Automatic yield/success prediction and literature search remain out of scope ([#41](https://github.com/kent-tokyo/renkin/issues/41)). |
280
329
  | **Route cost scoring** | `route_cost = Σ(BB cost) + steps×0.5`; actual prices via `--bb-prices CSV` or `--stock stock.csv` |
281
330
  | **Pareto multi-objective search** | `--format pareto` returns a Pareto front across `route_cost`, `success_probability`, `steps`, etc.; objectives configurable via `--objectives cost:min,success_probability:max,steps:min` |
282
331
  | **Constraint DSL** | `--constraints constraints.json` — JSON-driven synthesis planning: element filters, step limits, confidence thresholds, preferred reaction families; enables LLM → RENKIN pipeline |
@@ -539,6 +588,7 @@ renkin/ ← Cargo workspace root
539
588
  ### Recently shipped
540
589
 
541
590
  - [x] Stable `template_id` (`rule:<name>` / `smirks-sha256:<hex>`) + `--template-metadata` evidence sidecar + `renkin template ids` ([#41](https://github.com/kent-tokyo/renkin/issues/41) phase 1)
591
+ - [x] Substrate-specific `examples` (`schema_version: 2`) — per-step exact-substrate vs. same-template-different-substrate resolution, surfaced in `--format explain` and as `match_kind` in JSON ([#41](https://github.com/kent-tokyo/renkin/issues/41) phase 2)
542
592
  - [x] `renkin-bench cascade` — multi-stage search (fast defaults → hard cases re-run deeper); only unsolved targets propagate to later stages. **78.0% → 95.9%** on USPTO-50k
543
593
  - [x] `renkin-bench --failure-taxonomy` — classify unsolved targets by cause (beam limit / depth limit / template gap / stock near-miss)
544
594
  - [x] Graph-based ester cleavage — BFS-leakage-free `R-C(=O)-O-R' → RCOOH + R'OH`
@@ -607,8 +657,8 @@ If you use RENKIN in academic work, please cite:
607
657
  author = {kent-tokyo},
608
658
  title = {{RENKIN}: Retrosynthesis Engine for Knowledge-Informed Navigation},
609
659
  year = {2026},
610
- url = {https://github.com/kent-tokyo/renkin/releases/tag/v0.17.0},
611
- version = {0.17.0},
660
+ url = {https://github.com/kent-tokyo/renkin/releases/tag/v0.18.0},
661
+ version = {0.18.0},
612
662
  license = {MIT}
613
663
  }
614
664
  ```
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "renkin",
3
3
  "type": "module",
4
+ "collaborators": [
5
+ "kent-tokyo <kent-tokyo@users.noreply.github.com>"
6
+ ],
4
7
  "description": "Ultra-fast retrosynthesis engine for computer-aided synthesis planning (CASP) — pure Rust, WASM-ready, Python bindings via PyO3",
5
- "version": "0.17.0",
8
+ "version": "0.18.0",
6
9
  "license": "MIT",
7
10
  "repository": {
8
11
  "type": "git",
package/renkin_bg.wasm CHANGED
Binary file