pi-incise 0.5.0 → 0.6.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
@@ -19,23 +19,28 @@ Choose the profile when starting Pi:
19
19
  * **Ornith 1.5 9B (recommended):** `INCISE_PROFILE=auto pi --thinking off`
20
20
  * **Gemma (recommended):** `INCISE_PROFILE=auto pi`
21
21
  * **MiniCPM5 2B (recommended):** `INCISE_PROFILE=auto pi --thinking off`
22
+ * **Inkling 2 Mini Q3:** `INCISE_PROFILE=auto pi --thinking off`
22
23
  * **Unknown or changing model families:** `INCISE_PROFILE=standard pi`
23
24
 
24
25
  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
 
26
27
  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
 
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`.
29
+ The package default is `standard` for model-agnostic compatibility. `auto` enables the measured `safe-routed` profile for Gemma, MiniCPM, Ornith, and Inkling 2 Mini; 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`, `INCISE_MODEL_FAMILY=inkling`, or `INCISE_MODEL_FAMILY=unknown`. Inkling detection is limited to 2 Mini identities; other generations remain unknown.
29
30
 
30
31
  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.
31
32
 
33
+ LFM3-specific support was abandoned on 25 November 2026 after the evaluation failed to demonstrate an overall editing benefit and incurred substantial latency overhead. No LFM3-specific profile or focus preview is provided. Historical evaluation records remain under `bench/`.
34
+
35
+ For Inkling 2 Mini, the measured local UD-Q3_K_XL setup used Pi SDK 1.0.4, a 32,768-token context, `maxTokens: 2048`, temperature 0.6, top-p 0.95, top-k 0, min-p 0, repeat penalty 1, and presence penalty 0. Send native `reasoning_effort: "none"`; the model still emitted reasoning in this runtime. Select the local model separately; the plugin does not change decoding settings. Inkling uses Pi’s structured prompt options to keep the prompt’s tool list aligned with the active route, and receives the existing hash-bound inspection for checkbox edits.
36
+
32
37
  ## Tools
33
38
 
34
39
  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`.
35
40
 
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.
41
+ Set `INCISE_PROFILE=safe-routed` to use guarded request routing directly, or use `auto` with a measured Gemma, MiniCPM, Ornith, or Inkling 2 Mini 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.
37
42
 
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.
43
+ `auto` selects once on the first model-bearing turn. Gemma, MiniCPM, Ornith, and Inkling 2 Mini use `safe-routed`; unknown identities use `standard`. `/incise-doctor` reports the requested profile, effective profile, model family, selection reason, and last route.
39
44
 
40
45
  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.
41
46
 
@@ -57,6 +62,8 @@ The current Gemma `auto` profile completed **475/479 usable trials (99.2%) with
57
62
 
58
63
  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).
59
64
 
65
+ Inkling 2 Mini UD-Q3_K_XL completed 48/48 tasks at fresh seed 2 after one recorded grader correction, including 42/42 edits and zero incorrect changed documents. The original 47/48 grades already passed the preregistered gate; the omitted ordinal-read case independently matched the Python oracle. Two sessions attempted unavailable shell tools before recovering through the guarded route. This is one 48-task host qualification, not the ten-seed stability measurement used for the other models. On the M4 Mac mini with 24 GB RAM, these full workflows averaged 68.5 seconds. See the [original analysis](../../bench/results/inkling2_mini_q3_checkbox_v4_20261129_analysis.json) and [separate regrade](../../bench/results/inkling2_mini_q3_checkbox_v4_20261129_held_auto_regraded_v1_analysis.json).
66
+
60
67
  ## Binary resolution
61
68
 
62
69
  The extension uses `INCISE_BIN` first, then the matching optional native package, then `incise` on `PATH`, and finally a release or debug binary from a development checkout. `/incise-doctor` reports the selected path, versions, schema status, and registered-tool count. Version mismatches from explicit overrides are warnings; a mismatched packaged binary disables the tools as an installation-integrity failure.
@@ -78,7 +78,7 @@ export function installCheckSkillTool(
78
78
  };
79
79
 
80
80
  pi.on("before_agent_start", async (event) => {
81
- if (!isExplicitCheckSkillPrompt(event.prompt)) return;
81
+ if (!("prompt" in event) || !isExplicitCheckSkillPrompt(event.prompt)) return;
82
82
  restore = pi.getActiveTools().filter((name) => name !== CHECK_TOOL_NAME);
83
83
  active = true;
84
84
  register();
@@ -7,6 +7,7 @@ import { installMiniCpmListProfile, MINICPM_LIST_TOOL_NAMES } from "./minicpm-li
7
7
  import { prepareInvocation, READ_SUBCOMMAND, type ToolArguments } from "./normalize.ts";
8
8
  import {
9
9
  requestedProfile,
10
+ modelFamily,
10
11
  selectProfile,
11
12
  type ProfileDecision,
12
13
  type RequestedProfile,
@@ -207,6 +208,9 @@ export default async function inciseExtension(pi: ExtensionAPI): Promise<void> {
207
208
  }
208
209
  installSafeRoutedProfile(pi, binary, {
209
210
  standardTools: schemas.map((schema) => schema.name),
211
+ useStructuredPrompt(ctx) {
212
+ return modelFamily(ctx.model, familyOverride) === "inkling";
213
+ },
210
214
  isEnabled(ctx) {
211
215
  if (!decision && ctx.model) {
212
216
  decision = selectProfile(profile, ctx.model, familyOverride);
@@ -335,6 +335,10 @@ export function installMiniCpmListProfile(
335
335
 
336
336
  pi.on("before_agent_start", async (event, ctx) => {
337
337
  state = undefined;
338
+ if (!("prompt" in event)) {
339
+ pi.setActiveTools([]);
340
+ return;
341
+ }
338
342
  const found = extractMarkdownPath(event.prompt);
339
343
  if (!found) {
340
344
  pi.setActiveTools([]);
@@ -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" | "ornith" | "unknown";
9
+ export type ModelFamily = "gemma" | "minicpm" | "ornith" | "inkling" | "unknown";
10
10
 
11
11
  export interface ModelIdentity {
12
12
  id?: string;
@@ -39,17 +39,18 @@ 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 === "ornith" || normalized === "unknown") {
42
+ if (normalized === "gemma" || normalized === "minicpm" || normalized === "ornith" || normalized === "inkling" || normalized === "unknown") {
43
43
  return normalized;
44
44
  }
45
45
  throw new Error(
46
- `Unknown INCISE_MODEL_FAMILY ${JSON.stringify(override)}. Use gemma, minicpm, ornith, or unknown.`,
46
+ `Unknown INCISE_MODEL_FAMILY ${JSON.stringify(override)}. Use gemma, minicpm, ornith, inkling, 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
52
  if (/ornith/.test(identity)) return "ornith";
53
+ if (/\binkling[-_ ]2[-_ ]mini(?:\b|[_-])/.test(identity)) return "inkling";
53
54
  return "unknown";
54
55
  }
55
56
 
@@ -74,7 +75,7 @@ export function selectProfile(
74
75
  reason: `explicit INCISE_PROFILE=${requested}`,
75
76
  };
76
77
  }
77
- if (family === "gemma" || family === "minicpm" || family === "ornith") {
78
+ if (family === "gemma" || family === "minicpm" || family === "ornith" || family === "inkling") {
78
79
  return {
79
80
  requested,
80
81
  effective: "safe-routed",
@@ -84,7 +85,9 @@ export function selectProfile(
84
85
  ? "auto selected the measured Gemma routing capabilities"
85
86
  : family === "minicpm"
86
87
  ? "auto selected the measured MiniCPM routing capabilities"
87
- : "auto selected the measured Ornith routing capabilities",
88
+ : family === "ornith"
89
+ ? "auto selected the measured Ornith routing capabilities"
90
+ : "auto selected the measured Inkling 2 Mini routing capabilities",
88
91
  };
89
92
  }
90
93
  return {
@@ -147,6 +147,7 @@ interface RouteSpec {
147
147
  }>;
148
148
  resolvedArguments?(params: Record<string, unknown>): Record<string, unknown>;
149
149
  systemPrompt: string;
150
+ inspection?: string;
150
151
  }
151
152
 
152
153
  interface RoutedState {
@@ -1241,6 +1242,10 @@ async function routeForPrompt(
1241
1242
  checked: checked.checked,
1242
1243
  }),
1243
1244
  systemPrompt: `Incise resolved the exact checkbox item and requested state. Use ${schema.name} once with no arguments; the host supplies the file, list, item, state, and read hash.`,
1245
+ inspection: `Inspected ${JSON.stringify(path)} at read hash ${result.payload.hash}:\n${
1246
+ String(result.payload.text ?? "").length <= 2048 ? String(result.payload.text ?? "")
1247
+ : JSON.stringify({ checked: matches[0].checked, depth: matches[0].depth, parent: matches[0].parent })
1248
+ }`,
1244
1249
  };
1245
1250
  }
1246
1251
  const append = listAppendIntent(prompt);
@@ -1491,6 +1496,7 @@ function toolResult(text: string, details: Record<string, unknown>) {
1491
1496
  export interface SafeRoutedOptions {
1492
1497
  standardTools: string[];
1493
1498
  isEnabled(ctx: { model?: { id?: string; name?: string; provider?: string } }): boolean;
1499
+ useStructuredPrompt?(ctx: { model?: { id?: string; name?: string; provider?: string } }): boolean;
1494
1500
  onRoute?(kind: SafeRouteKind | "standard"): void;
1495
1501
  }
1496
1502
 
@@ -1578,7 +1584,7 @@ export function installSafeRoutedProfile(
1578
1584
 
1579
1585
  pi.on("before_agent_start", async (event, ctx) => {
1580
1586
  state = undefined;
1581
- if (!options.isEnabled(ctx)) {
1587
+ if (!options.isEnabled(ctx) || !("prompt" in event)) {
1582
1588
  options.onRoute?.("standard");
1583
1589
  activate(options.standardTools);
1584
1590
  return;
@@ -1593,6 +1599,25 @@ export function installSafeRoutedProfile(
1593
1599
  registerRoute(spec);
1594
1600
  options.onRoute?.(spec.kind);
1595
1601
  activate([spec.schema.name]);
1596
- return { systemPrompt: `${event.systemPrompt}\n\n${spec.systemPrompt}` };
1602
+ const structured = options.useStructuredPrompt?.(ctx);
1603
+ const routePrompt = structured && spec.inspection
1604
+ ? `${spec.inspection}\n\n${spec.systemPrompt}` : spec.systemPrompt;
1605
+ if (structured && event.systemPromptOptions &&
1606
+ event.systemPromptOptions.forceSystemPrompt === undefined) {
1607
+ const active = pi.getActiveTools();
1608
+ if (!active.includes(spec.schema.name)) {
1609
+ state = undefined;
1610
+ activate(options.standardTools);
1611
+ options.onRoute?.("standard");
1612
+ return;
1613
+ }
1614
+ event.systemPromptOptions.selectedTools = active;
1615
+ event.systemPromptOptions.toolSnippets[spec.schema.name] = spec.schema.description;
1616
+ const previous = event.systemPromptOptions.sections.incise_route;
1617
+ event.systemPromptOptions.sections.incise_route = previous
1618
+ ? `${previous}\n\n${routePrompt}` : routePrompt;
1619
+ return;
1620
+ }
1621
+ return { systemPrompt: `${event.systemPrompt}\n\n${routePrompt}` };
1597
1622
  });
1598
1623
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-incise",
3
- "version": "0.5.0",
4
- "description": "Semantic, byte-preserving Markdown editing tools for Pi and AI agents",
3
+ "version": "0.6.0",
4
+ "description": "Structured Markdown editing for Pi, with measured Inkling 2 Mini profiles and byte preservation",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": "Peter Dalinis",
@@ -20,7 +20,9 @@
20
20
  "llm-tools",
21
21
  "frontmatter",
22
22
  "obsidian",
23
- "knowledge-base"
23
+ "knowledge-base",
24
+ "inkling",
25
+ "local-llm"
24
26
  ],
25
27
  "engines": {
26
28
  "node": ">=22.19.0"
@@ -45,20 +47,21 @@
45
47
  "typebox": "*"
46
48
  },
47
49
  "devDependencies": {
48
- "@earendil-works/pi-coding-agent": "^0.99.1",
50
+ "@earendil-works/pi-coding-agent": "1.7.0",
49
51
  "@types/node": "^22.19.19",
50
52
  "typescript": "^5.9.3"
51
53
  },
52
54
  "optionalDependencies": {
53
- "@pdalinis/pi-incise-darwin-arm64": "0.5.0",
54
- "@pdalinis/pi-incise-darwin-x64": "0.5.0",
55
- "@pdalinis/pi-incise-linux-arm64-gnu": "0.5.0",
56
- "@pdalinis/pi-incise-linux-x64-gnu": "0.5.0"
55
+ "@pdalinis/pi-incise-darwin-arm64": "0.6.0",
56
+ "@pdalinis/pi-incise-darwin-x64": "0.6.0",
57
+ "@pdalinis/pi-incise-linux-arm64-gnu": "0.6.0",
58
+ "@pdalinis/pi-incise-linux-x64-gnu": "0.6.0"
57
59
  },
58
60
  "scripts": {
59
61
  "test": "node --test --experimental-strip-types test/*.test.ts",
60
62
  "typecheck": "tsc --noEmit",
61
- "pack:check": "node --experimental-strip-types test/pack-check.ts"
63
+ "pack:check": "node --experimental-strip-types test/pack-check.ts",
64
+ "native:check": "node --experimental-strip-types test/native-install-smoke.ts"
62
65
  },
63
66
  "publishConfig": {
64
67
  "access": "public"