@mcptoolshop/research-os 0.2.0 → 0.3.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/CHANGELOG.md CHANGED
@@ -2,6 +2,84 @@
2
2
 
3
3
  All notable changes to `research-os` are documented here.
4
4
 
5
+ ## [0.3.0] — 2026-05-09
6
+
7
+ Tight release. One real, tested, dogfooded improvement: `--detector` flag on
8
+ `research-os contradict map`. F-09 from Experiment 3 Session 1 (XRPL pack)
9
+ earned the fix. No other v0.3 candidates shipped — F-01 (init version-stamp),
10
+ F-02 (packs-dir docs), F-05 (discover --query example), F-08 (Windows process
11
+ recovery) are deferred to v0.3.x.
12
+
13
+ ### Added
14
+
15
+ - **`--detector <auto|heuristic|ollama-intern>`** flag on
16
+ `research-os contradict map`. Three explicit modes:
17
+
18
+ - `auto` (default) — preserves env-var-driven behavior. When the
19
+ configured Ollama model is available, runs the LLM detector;
20
+ otherwise falls through to heuristic. Mirrors v0.2.x behavior.
21
+ - `heuristic` — bypasses Ollama entirely. No model availability check,
22
+ no LLM calls. Always works. Always completes quickly.
23
+ - `ollama-intern` — requires the configured model. Exits with code 2
24
+ and a visible failure message if the model is unavailable, instead
25
+ of silently falling back to heuristic.
26
+
27
+ Invalid `--detector` values exit with code 2. The mode chosen is
28
+ announced visibly on the first output line of every run; there are no
29
+ silent shifts. Full reference: [`docs/contradict-map.md`](docs/contradict-map.md).
30
+
31
+ - **12 new tests** in `test/contradictions-detector-flag.test.ts` covering
32
+ all three modes (heuristic never instantiates the Ollama client;
33
+ ollama-intern errors visibly when model unavailable; auto preserves
34
+ existing behavior; invalid value fails fast), heuristic ledger validity,
35
+ and a regression fixture that mirrors the XRPL Section 01 pattern (~60
36
+ claims with ~5-token shared vocabulary completes via heuristic in well
37
+ under 30 seconds).
38
+
39
+ - **`docs/contradict-map.md`** — full CLI reference: detector modes, mode
40
+ announcements (verbatim strings), when-to-use-which guidance, and the
41
+ release thesis.
42
+
43
+ - **Handbook page** at `/handbook/contradict-map` — condensed reference
44
+ matching the docs page.
45
+
46
+ ### Changed
47
+
48
+ - **CLI `--help`** for `contradict map` now lists the three `--detector`
49
+ choices.
50
+ - **Reference page** in the handbook updated to mention the flag and
51
+ link to the new contradict-map page.
52
+
53
+ ### Documentation
54
+
55
+ - README status block updated to v0.3.0; version badge updated.
56
+ - `docs/roadmap.md` Experiment 3 entry: F-09 chain blocker noted as
57
+ resolved in v0.3.0 (Experiment 3 itself remains in progress; closure
58
+ requires a third external-domain pack).
59
+ - **Cross-repo:** `research-packs/docs/operator-playbook.md` updated in
60
+ the same release window. The earlier "clear `OLLAMA_INTERN_MODEL` to
61
+ force heuristic" workaround is replaced with `--detector heuristic`
62
+ as the canonical operator surface. The handbook mirror in this repo
63
+ is kept consistent with the canonical.
64
+ - `SHIP_GATE.md` D2 updated: version bump + tag for v0.3.0.
65
+
66
+ ### Tests
67
+
68
+ - **527 total** (515 at v0.2.0 → 527 at v0.3.0, +12 from
69
+ `test/contradictions-detector-flag.test.ts`).
70
+
71
+ ### Migration notes
72
+
73
+ No code-level migration required. Existing scripts that don't pass
74
+ `--detector` continue to work via `auto` mode.
75
+
76
+ For operators who previously cleared `OLLAMA_INTERN_MODEL` to force the
77
+ heuristic detector: that pattern still works in environments where the
78
+ default model isn't installed, but the flag is the canonical surface
79
+ and is environment-independent. Switch to `--detector heuristic` when
80
+ re-running narrow-topic sections; the v0.3.0 operator-playbook update
81
+ in `research-packs` documents the rationale.
82
+
5
83
  ## [0.2.0] — 2026-05-09
6
84
 
7
85
  Tight release. Two real, tested, dogfooded improvements: `research-os pack publish`
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  </p>
8
8
 
9
9
  <p align="center">
10
- <a href="https://github.com/mcp-tool-shop-org/research-os/releases/tag/v0.2.0"><img src="https://img.shields.io/badge/version-0.2.0-blue" alt="version 0.2.0"></a>
10
+ <a href="https://github.com/mcp-tool-shop-org/research-os/releases/tag/v0.3.0"><img src="https://img.shields.io/badge/version-0.3.0-blue" alt="version 0.3.0"></a>
11
11
  <a href="https://github.com/mcp-tool-shop-org/research-os/actions/workflows/ci.yml"><img src="https://github.com/mcp-tool-shop-org/research-os/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
12
12
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="MIT License"></a>
13
13
  <img src="https://img.shields.io/badge/node-%E2%89%A520-brightgreen" alt="Node ≥20">
@@ -151,9 +151,11 @@ This is the structural alternative to *search → summarize → pretty report*.
151
151
 
152
152
  ## Status
153
153
 
154
- **v0.2.0** — published to npm as `@mcptoolshop/research-os@0.2.0`, 2026-05-09. Ships `research-os pack publish` (Experiment 2) and the Pattern 2 readiness predicate fix. 515/515 vitest passing. See [CHANGELOG.md](CHANGELOG.md).
154
+ **v0.3.0** — published to npm as `@mcptoolshop/research-os@0.3.0`, 2026-05-09. Ships the `--detector <auto|heuristic|ollama-intern>` flag on `contradict map` (F-09 chain-blocker fix from Experiment 3 Session 1, XRPL pack). 527/527 vitest passing. See [CHANGELOG.md](CHANGELOG.md) and [`docs/contradict-map.md`](docs/contradict-map.md).
155
155
 
156
- **`research-os pack publish`** — Frozen packs export to the canonical `research-packs` archive with a single command. Derives `pack.manifest.json`, generates `README.md`, provisions `docs/how-to-read-this.md`, verifies the admission contract. See [`docs/pack-publish.md`](docs/pack-publish.md). Dogfood: both existing packages re-derived and `verify-pack.mjs` PASS see [`docs/pack-publish-dogfood.md`](docs/pack-publish-dogfood.md).
156
+ **`contradict map --detector`** — Detector selection is now an explicit operator choice instead of a state-dependent env-var dance. `auto` (default) preserves prior behavior; `heuristic` always works without LLM and completes quickly on narrow-topic documentation sections; `ollama-intern` requires the configured model and exits visibly if unavailable. Mode is announced visibly on every run. The earlier "clear `OLLAMA_INTERN_MODEL` to force heuristic" workaround is superseded by `--detector heuristic` as the canonical operator surface; see the [research-packs operator playbook](https://github.com/mcp-tool-shop-org/research-packs/blob/main/docs/operator-playbook.md) and the [handbook contradict-map page](https://mcp-tool-shop-org.github.io/research-os/handbook/contradict-map/).
157
+
158
+ **v0.2.0** — published 2026-05-09. Shipped `research-os pack publish` (Experiment 2) and the Pattern 2 readiness predicate fix. 515/515 vitest passing then. See [CHANGELOG.md](CHANGELOG.md). Frozen packs export to the canonical `research-packs` archive with a single command; admission contract is enforced by code, not checklist. See [`docs/pack-publish.md`](docs/pack-publish.md).
157
159
 
158
160
  **v0.1.0** — dogfood pack frozen 2026-05-08. The pack at `research-os-packs/research-os-spec/` (sibling repo) reached freeze with 296 accepted claims across 8 sections, 17 dispositioned, 30 operator-overridden, 0 active repair blockers, 0 unresolved contradictions, all gates `synthesis_eligible=true`. Sixteen load-bearing laws cumulative. See [`docs/dogfood-proof.md`](docs/dogfood-proof.md) for the seven findings and freeze receipt fingerprints.
159
161
 
@@ -161,9 +163,9 @@ This is the structural alternative to *search → summarize → pretty report*.
161
163
 
162
164
  **v1 Experiment 1 (ComfyUI workflow durability)** — CLOSED 2026-05-09. All 8 sections at Terminal A, pack frozen, archive live. See [`docs/experiment-1-proof.md`](docs/experiment-1-proof.md) and [`docs/roadmap.md`](docs/roadmap.md).
163
165
 
164
- ### What v0.2 is not
166
+ ### What v0.3 is not
165
167
 
166
- - Not battle-tested by external users. Two dogfood arcs have run — one self-referential, one external-domain. External user pressure is Experiment 3 (API stability) in the v1.0 roadmap.
168
+ - Not battle-tested by external users. Two dogfood arcs have closed — one self-referential, one external-domain and Experiment 3 (API stability under external pressure) is in progress: pack #1 of 3 (XRPL creator-token durability) earned the v0.3.0 `--detector` flag. Two more external-domain packs required for Experiment 3 closure.
167
169
  - Not a synthesis writer. The `synth workspace` command generates the structured workspace; humans (or Cowork) write the prose against accepted claim IDs.
168
170
  - Not API-stable under semver. v1.0.0 is an earned state, not a calendar date — see [`docs/roadmap.md`](docs/roadmap.md) for the six experiments that close the gap.
169
171
 
package/dist/cli.js CHANGED
@@ -2774,9 +2774,6 @@ Hard rules:
2774
2774
  });
2775
2775
 
2776
2776
  // src/contradictions/detectors/index.ts
2777
- function defaultContradictionDetectors() {
2778
- return [new OllamaInternContradictionDetector(), new HeuristicContradictionDetector()];
2779
- }
2780
2777
  async function pickContradictionDetector(detectors) {
2781
2778
  for (const d of detectors) {
2782
2779
  if (await d.available()) return d;
@@ -3250,6 +3247,48 @@ function buildContradiction(args) {
3250
3247
  created_at: (/* @__PURE__ */ new Date()).toISOString()
3251
3248
  });
3252
3249
  }
3250
+ async function resolveDetector(options) {
3251
+ const mode = options.detectorMode ?? "auto";
3252
+ if (!VALID_DETECTOR_MODES.includes(mode)) {
3253
+ throw new Error(
3254
+ `contradict map: invalid --detector value "${mode}"; valid values are: auto, heuristic, ollama-intern`
3255
+ );
3256
+ }
3257
+ if (mode === "heuristic") {
3258
+ return {
3259
+ detector: new HeuristicContradictionDetector(),
3260
+ announcement: "contradict map: using heuristic detector"
3261
+ };
3262
+ }
3263
+ if (mode === "ollama-intern") {
3264
+ const d = new OllamaInternContradictionDetector(options.ollamaConfig ?? {});
3265
+ if (!await d.available()) {
3266
+ throw new Error(
3267
+ `contradict map: ollama-intern detector requested but model ${d.model} is unavailable; aborting (use --detector heuristic to bypass)`
3268
+ );
3269
+ }
3270
+ return {
3271
+ detector: d,
3272
+ announcement: `contradict map: using ollama-intern detector with model ${d.model}`
3273
+ };
3274
+ }
3275
+ const detectors = options.detectors ?? [
3276
+ new OllamaInternContradictionDetector(options.ollamaConfig ?? {}),
3277
+ new HeuristicContradictionDetector()
3278
+ ];
3279
+ const detector = await pickContradictionDetector(detectors);
3280
+ if (detector.name === "ollama-intern") {
3281
+ const modelName = detector instanceof OllamaInternContradictionDetector ? detector.model : process.env.OLLAMA_INTERN_MODEL ?? "hermes3:8b";
3282
+ return {
3283
+ detector,
3284
+ announcement: `contradict map: using ollama-intern detector with model ${modelName}`
3285
+ };
3286
+ }
3287
+ return {
3288
+ detector,
3289
+ announcement: "contradict map: ollama-intern unavailable; using heuristic detector"
3290
+ };
3291
+ }
3253
3292
  async function map(options) {
3254
3293
  const packPath = options.packPath ? resolve7(options.packPath) : process.cwd();
3255
3294
  if (!existsSync9(join10(packPath, "research.yaml"))) throw new PackNotFoundError(packPath);
@@ -3261,8 +3300,7 @@ async function map(options) {
3261
3300
  const allowed = await readTriagedClaimIds2(packPath, options.sectionId);
3262
3301
  candidateClaims = candidateClaims.filter((c) => allowed.has(c.claim_id));
3263
3302
  }
3264
- const adapters = options.detectors ?? defaultContradictionDetectors();
3265
- const detector = await pickContradictionDetector(adapters);
3303
+ const { detector, announcement } = await resolveDetector(options);
3266
3304
  const summary = {
3267
3305
  sectionId: options.sectionId,
3268
3306
  detector: detector.name,
@@ -3272,7 +3310,8 @@ async function map(options) {
3272
3310
  contradictionsAdded: 0,
3273
3311
  contradictionsDeduped: 0,
3274
3312
  contradictionIds: [],
3275
- detectorError: null
3313
+ detectorError: null,
3314
+ detectorAnnouncement: announcement
3276
3315
  };
3277
3316
  const ledgerPath = join10(sectionDir, "contradictions.jsonl");
3278
3317
  const mdPath = join10(sectionDir, "contradictions.md");
@@ -3336,7 +3375,7 @@ async function map(options) {
3336
3375
  await writeFile9(mdPath, md, "utf8");
3337
3376
  return summary;
3338
3377
  }
3339
- var DETECTOR_ID_PART;
3378
+ var DETECTOR_ID_PART, VALID_DETECTOR_MODES;
3340
3379
  var init_map = __esm({
3341
3380
  "src/contradictions/map.ts"() {
3342
3381
  "use strict";
@@ -3344,11 +3383,14 @@ var init_map = __esm({
3344
3383
  init_schema5();
3345
3384
  init_schema7();
3346
3385
  init_detectors();
3386
+ init_heuristic3();
3387
+ init_ollama_intern3();
3347
3388
  init_markdown();
3348
3389
  DETECTOR_ID_PART = {
3349
3390
  heuristic: "heuristic",
3350
3391
  "ollama-intern": "ollama_intern"
3351
3392
  };
3393
+ VALID_DETECTOR_MODES = ["auto", "heuristic", "ollama-intern"];
3352
3394
  }
3353
3395
  });
3354
3396
 
@@ -11692,7 +11734,7 @@ var init_src = __esm({
11692
11734
  init_triage();
11693
11735
  init_discover();
11694
11736
  init_errors();
11695
- RESEARCH_OS_VERSION = "0.2.0";
11737
+ RESEARCH_OS_VERSION = "0.3.0";
11696
11738
  }
11697
11739
  });
11698
11740
 
@@ -12123,7 +12165,7 @@ init_synth();
12123
12165
  init_audit();
12124
12166
  init_freeze();
12125
12167
  init_invalidate();
12126
- import { Command } from "commander";
12168
+ import { Command, Option } from "commander";
12127
12169
 
12128
12170
  // src/pack/publish/index.ts
12129
12171
  import { existsSync as existsSync30, mkdirSync as mkdirSync3, writeFileSync as writeFileSync2, readFileSync as readFileSync3, readdirSync as readdirSync2 } from "fs";
@@ -13054,13 +13096,21 @@ contradictCmd.command("map").description("Detect contradiction candidates among
13054
13096
  "--triaged-only",
13055
13097
  "Only consider claims that triage selected_for_review; reduces N\xB2 pair classification on dense sections",
13056
13098
  false
13099
+ ).addOption(
13100
+ new Option(
13101
+ "--detector <mode>",
13102
+ "Detector to use: auto (default, env-var-driven), heuristic (always fast, no LLM), ollama-intern (require LLM, fail visibly if unavailable)"
13103
+ ).choices(["auto", "heuristic", "ollama-intern"]).default("auto")
13057
13104
  ).action(async (section, opts) => {
13058
13105
  try {
13059
13106
  const result = await map({
13060
13107
  sectionId: section,
13061
13108
  packPath: opts.pack,
13062
- triagedOnly: opts.triagedOnly
13109
+ triagedOnly: opts.triagedOnly,
13110
+ detectorMode: opts.detector
13063
13111
  });
13112
+ process.stdout.write(`${result.detectorAnnouncement}
13113
+ `);
13064
13114
  process.stdout.write(`contradiction map complete
13065
13115
  `);
13066
13116
  process.stdout.write(` section: ${result.sectionId}