pi-incise 0.2.0 → 0.3.1

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
@@ -16,12 +16,16 @@ Prebuilt binaries are provided for macOS arm64/x64 and glibc Linux arm64/x64. Wi
16
16
 
17
17
  Choose the profile when starting Pi:
18
18
 
19
+ * **Ornith 1.5 9B (recommended):** `INCISE_PROFILE=auto pi --thinking off`
19
20
  * **Gemma (recommended):** `INCISE_PROFILE=auto pi`
20
- * **MiniCPM general editing:** `INCISE_PROFILE=standard pi`
21
- * **MiniCPM list-addition evaluation:** `INCISE_PROFILE=minicpm-list pi`
21
+ * **MiniCPM5 2B (recommended):** `INCISE_PROFILE=auto pi --thinking off`
22
22
  * **Unknown or changing model families:** `INCISE_PROFILE=standard pi`
23
23
 
24
- The package default is `standard` for compatibility. `auto` currently enables the measured `safe-routed` profile only for Gemma; MiniCPM and unknown families stay on `standard`. If a local provider exposes a generic model ID, add `INCISE_MODEL_FAMILY=gemma` or `INCISE_MODEL_FAMILY=minicpm`.
24
+ For Ornith, configure its Pi model entry with `maxTokens: 2048` and `samplingParams.parallel_tool_calls: false`. The measured result used temperature 0.6, top-p 0.95, top-k 20, min-p 0, presence penalty 0, and repeat penalty 1 through llama.cpp.
25
+
26
+ For MiniCPM5, the measured result used the official Q8_0 checkpoint through llama.cpp, thinking off, a 65,536-token context, `maxTokens: 8192`, temperature 0.7, and top-p 0.95. The profile does not silently change provider decoding settings.
27
+
28
+ The package default is `standard` for model-agnostic compatibility. `auto` enables the measured `safe-routed` profile for Gemma, MiniCPM, and Ornith; unknown families stay on `standard`. If a local provider exposes a generic model ID, set `INCISE_MODEL_FAMILY=gemma`, `INCISE_MODEL_FAMILY=minicpm`, `INCISE_MODEL_FAMILY=ornith`, or `INCISE_MODEL_FAMILY=unknown`.
25
29
 
26
30
  After Pi starts, run `/incise-doctor`. It reports the requested and effective profiles, detected model family, selected binary, schema state, registered tools, and last route.
27
31
 
@@ -29,23 +33,23 @@ After Pi starts, run `/incise-doctor`. It reports the requested and effective pr
29
33
 
30
34
  The default `standard` profile registers `table_edit`, `list_edit`, `section_edit`, `frontmatter_edit`, `table_get`, `md_tables`, `md_lists`, and `md_outline`. Inspect document structure with the relevant read tool before editing, and follow the remedy in any Incise refusal. The former `measured` profile name remains an alias for `standard`.
31
35
 
32
- Set `INCISE_PROFILE=safe-routed` before starting Pi to use model-agnostic request routing directly. It retains the standard tools as a fallback, but for requests it can prove unambiguous it replaces them for that turn with one small, action-specific tool. The current measured routes are exact section rename, exact section-body replacement, explicit literal section insertion, exact quoted-sentence section append, table reads with explicit column/value predicates, typed edits to existing frontmatter keys, guarded creation of `build.cache`, exact quoted list-item removal, and same-heading list append resolved by an exact existing item. The adapter resolves the file and structural target, owns exact table filters and insertion or append content, constrains existing-key paths to inspected scalar leaves, verifies `build` is a map and `build.cache` is absent before create-only writes, validates exact current list items before removal or containing-item selection, uses a content hash plus `must_exist` or `must_absent` where applicable, permits one successful routed operation, and leaves tools from other extensions active. Ambiguous targets, fuzzy item matches, unsupported append wording, whole-table reads, ordinal reads, other frontmatter creation, frontmatter deletion or multi-key changes, and unsupported requests fall back to the standard profile.
36
+ Set `INCISE_PROFILE=safe-routed` to use guarded request routing directly, or use `auto` with a measured Gemma, MiniCPM, or Ornith identity. The routed profile retains standard tools as fallback. For requests it can prove unambiguous, it inspects current structure and replaces the broad surface for that turn with one small action-specific tool. Host-owned routes cover exact table reads and mutations, list relations and checkbox state, literal section insertion, append, deletion, rename, level changes and qualified body replacement, plus typed, create-only, delete, and compound frontmatter edits. Each write carries the inspected hash and permits one successful routed mutation. Ambiguous, unsupported, or structurally inconsistent requests fall back without reinterpretation.
33
37
 
34
- `INCISE_PROFILE=auto` is the recommended Gemma setup. It selects capabilities from the active Pi model identity: Gemma uses `safe-routed`, while MiniCPM and unknown families remain on `standard` because no general MiniCPM composition has passed evaluation. Selection is fixed on the first model-bearing turn. If a local provider exposes a generic model ID, set `INCISE_MODEL_FAMILY=gemma`; `minicpm` and `unknown` are also accepted. `/incise-doctor` reports the requested profile, effective profile, detected model family, selection reason, and last route. The latest full Gemma/Pi treatment attempted all 480 trials and retained 479 paired rows after one persistent generation timeout. Correctness rose from 473/479 to 475/479 and harmful outcomes fell from 1 to 0. Lists reached 100/100, sections 145/149 with only loud refusals, frontmatter 110/110, and tables plus table reads 60/60. All 200 routed trials were correct, and all 279 usable fallback trials retained the standard tool surface. The package default remains `standard` for one compatibility release cycle.
38
+ `auto` selects once on the first model-bearing turn. Gemma, MiniCPM, and Ornith use `safe-routed`; unknown identities use `standard`. `/incise-doctor` reports the requested profile, effective profile, model family, selection reason, and last route.
35
39
 
36
- Set `INCISE_PROFILE=safe-small` only to evaluate the experimental small-model composition. It exposes `md_tables`, `table_get`, `table_add_row`, `table_update_cell`, `md_lists`, `list_get`, `list_add_item`, `md_outline`, `section_insert`, `section_append`, `frontmatter_get`, and `frontmatter_set`. It intentionally omits generic multi-action tools and destructive section/frontmatter operations. A preregistered MiniCPM5 run found a significant list-addition gain but section and frontmatter regressions, including 0/27 correct frontmatter trials, so this profile is not recommended for general use.
40
+ Set `INCISE_PROFILE=safe-small` only to reproduce the earlier experimental small-model composition. It omits generic multi-action tools and destructive section/frontmatter operations, but that older MiniCPM5 run failed its family and safety gates and has been superseded by the measured `auto` route profile.
37
41
 
38
- Set `INCISE_PROFILE=minicpm-list` to evaluate the MiniCPM-specific list-addition pipeline. Each request must name exactly one Markdown path. Pi activates a required heading-and-ordinal selector, reads the selected list, then activates one append, after, or between content tool with exact current-item constraints. The adapter supplies the file and list address, validates relative anchors, writes with the read hash, and permits at most one successful mutation in that user turn. The adapter-independent arm reached 21/21 supported additions, while the real Pi composition reached 16/21; keep this profile opt-in. It supports adding list items only.
39
-
40
- The preregistered real-Pi run reached 16/21 rather than the adapter-independent result of 21/21. Every executed mutation was correct and no document was damaged, but five trials stopped in prose instead of invoking the sole active phase tool. A paired forced-choice follow-up also reached 16/21 even though every observed active-phase request transmitted the exact advertised tool choice; the local MiniCPM/llama.cpp path did not enforce it. Compact list-only framing reached 19/21 and eliminated all no-call failures, but two previously correct trials wrote the wrong new item text. Neither treatment is shipped, and the profile remains evaluation-only.
42
+ Set `INCISE_PROFILE=minicpm-list` only to reproduce the earlier MiniCPM-specific list-addition pipeline. It supports list additions only; the general MiniCPM recommendation is now `auto`.
41
43
 
42
44
  ## Measured results
43
45
 
44
- The current Gemma `auto` profile completed **475/479 usable full-composition trials (99.2%) with zero harmful outcomes**. Tables, lists, frontmatter, and table reads were perfect; sections were 145/149 with four loud refusals. All **200/200 routed trials** were correct, and every unsupported request retained the standard tool surface.
46
+ The current MiniCPM5 2B `auto` profile completed **480/480 full-composition trials (100%) with zero harmful outcomes**. Tables were 60/60, lists 100/100, sections 150/150, frontmatter 110/110, and table reads 60/60. All **470/470 routed trials** passed exact tool-surface and host-resolved-argument audits; all 10 standard fallbacks exposed the unchanged eight-tool surface. The recorded configuration used the official Q8_0 checkpoint through llama.cpp with thinking off, a 65,536-token context, `maxTokens: 8192`, temperature 0.7, and top-p 0.95.
47
+
48
+ The current Ornith 1.5 9B `auto` profile completed **480/480 full-composition trials (100%) with zero harmful outcomes**. Tables were 60/60, lists 100/100, sections 150/150, frontmatter 110/110, and table reads 60/60. All **360/360 routed trials** passed the exact route audit; all 120 fallback trials retained the standard tool surface. The recorded configuration used the official Q8 checkpoint through llama.cpp, thinking off, `maxTokens: 2048`, and `parallel_tool_calls: false`.
45
49
 
46
- The MiniCPM-specific list pipeline is narrower. Its adapter-independent arm reached **21/21** supported additions from a 13/21 control, while the real Pi profile reached **16/21**. Every executed Pi mutation was correct and no document was damaged; the remaining failures were model no-calls. Keep it opt-in.
50
+ The current Gemma `auto` profile completed **475/479 usable trials (99.2%) with zero harmful outcomes**. Tables, lists, frontmatter, and table reads were perfect; sections were 145/149 with four loud refusals. Every one of the 17 MiniCPM v3 affected tasks then passed across three seeds for Gemma (**51/51**) and Ornith (**51/51**) before the MiniCPM composition run.
47
51
 
48
- These results are tied to the recorded models, llama.cpp runtime, Pi version, prompts, schemas, tasks, seeds, and graders. See [the full findings](../../bench/FINDINGS.md) and [Gemma v8 analysis](../../bench/results/gemma_safe_routed_full_v8_20260922_analysis.json).
52
+ These results are tied to the recorded models, llama.cpp runtime, Pi version, prompts, schemas, tasks, seeds, graders, and inference settings. See [the full findings](../../bench/FINDINGS.md), [MiniCPM composition analysis](../../bench/results/minicpm5_safe_routed_composition_v3_20260925_corrected_analysis.json), [Ornith final analysis](../../bench/results/ornith_final_v2_safe_routed_20260923_analysis.json), and [Gemma v8 analysis](../../bench/results/gemma_safe_routed_full_v8_20260922_analysis.json).
49
53
 
50
54
  ## Binary resolution
51
55
 
@@ -13,6 +13,7 @@ export type ListRoute = "append" | "after" | "between";
13
13
  export interface ListEntry {
14
14
  heading: string;
15
15
  ordinal: number;
16
+ loose?: boolean;
16
17
  }
17
18
 
18
19
  export interface ListItem {
@@ -64,9 +65,15 @@ export function routeListRequest(prompt: string): ListRoute {
64
65
 
65
66
  export function parseListSummary(text: string): ListEntry[] {
66
67
  const entries: ListEntry[] = [];
67
- const pattern = /^ heading "(.*)" ordinal ([0-9]+)$/gm;
68
- for (const match of text.matchAll(pattern)) {
69
- entries.push({ heading: match[1], ordinal: Number(match[2]) });
68
+ const lines = text.split(/\r?\n/);
69
+ for (let index = 0; index < lines.length; index += 1) {
70
+ const match = lines[index].match(/^ heading "(.*)" ordinal ([0-9]+)$/);
71
+ if (!match) continue;
72
+ entries.push({
73
+ heading: match[1],
74
+ ordinal: Number(match[2]),
75
+ ...(/\bloose\b/i.test(lines[index + 1] ?? "") ? { loose: true } : {}),
76
+ });
70
77
  }
71
78
  return entries;
72
79
  }
@@ -6,7 +6,7 @@ export type RequestedProfile =
6
6
  | "minicpm-list";
7
7
 
8
8
  export type EffectiveProfile = Exclude<RequestedProfile, "auto">;
9
- export type ModelFamily = "gemma" | "minicpm" | "unknown";
9
+ export type ModelFamily = "gemma" | "minicpm" | "ornith" | "unknown";
10
10
 
11
11
  export interface ModelIdentity {
12
12
  id?: string;
@@ -39,16 +39,17 @@ export function modelFamily(
39
39
  ): ModelFamily {
40
40
  if (override !== undefined && override !== "") {
41
41
  const normalized = override.toLowerCase();
42
- if (normalized === "gemma" || normalized === "minicpm" || normalized === "unknown") {
42
+ if (normalized === "gemma" || normalized === "minicpm" || normalized === "ornith" || normalized === "unknown") {
43
43
  return normalized;
44
44
  }
45
45
  throw new Error(
46
- `Unknown INCISE_MODEL_FAMILY ${JSON.stringify(override)}. Use gemma, minicpm, or unknown.`,
46
+ `Unknown INCISE_MODEL_FAMILY ${JSON.stringify(override)}. Use gemma, minicpm, ornith, or unknown.`,
47
47
  );
48
48
  }
49
49
  const identity = `${model?.provider ?? ""} ${model?.id ?? ""} ${model?.name ?? ""}`.toLowerCase();
50
50
  if (/mini[-_ ]?cpm/.test(identity)) return "minicpm";
51
51
  if (/gemma/.test(identity)) return "gemma";
52
+ if (/ornith/.test(identity)) return "ornith";
52
53
  return "unknown";
53
54
  }
54
55
 
@@ -73,13 +74,17 @@ export function selectProfile(
73
74
  reason: `explicit INCISE_PROFILE=${requested}`,
74
75
  };
75
76
  }
76
- if (family === "gemma") {
77
+ if (family === "gemma" || family === "minicpm" || family === "ornith") {
77
78
  return {
78
79
  requested,
79
80
  effective: "safe-routed",
80
81
  family,
81
82
  model: label,
82
- reason: "auto selected the measured Gemma routing capabilities",
83
+ reason: family === "gemma"
84
+ ? "auto selected the measured Gemma routing capabilities"
85
+ : family === "minicpm"
86
+ ? "auto selected the measured MiniCPM routing capabilities"
87
+ : "auto selected the measured Ornith routing capabilities",
83
88
  };
84
89
  }
85
90
  return {
@@ -87,8 +92,6 @@ export function selectProfile(
87
92
  effective: "standard",
88
93
  family,
89
94
  model: label,
90
- reason: family === "minicpm"
91
- ? "auto kept the standard profile because no general MiniCPM profile has passed evaluation"
92
- : "auto kept the model-agnostic standard profile for an unknown model family",
95
+ reason: "auto kept the model-agnostic standard profile for an unknown model family",
93
96
  };
94
97
  }