pi-continual-harness 0.5.0 → 0.5.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
@@ -13,7 +13,7 @@ with:
13
13
  → behavioral-file refinement (the "deep" path).
14
14
  - **pi-mem / pi-memory** — durable memory storage.
15
15
 
16
- The durable markdown file (`.pi/harness-state.md`) is the composition seam,
16
+ The durable markdown file (`~/.pi/agent/harness-state.md`) is the composition seam,
17
17
  and it is **two-way**: `/refine --commit` and `/harness export` write it;
18
18
  `/harness import` parses it back and merges into the live store (offline edits
19
19
  win on conflict), so refinements pi-reflect makes flow back online. `/harness push-mem`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-continual-harness",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Online self-improvement layer for pi. A unified, in-trajectory harness-state store (prompt notes, memory, skill descriptions, sub-agent specs) with a manual /refine that proposes evidence-backed structured CRUD deltas. Composes with pi-reflect (offline) and pi-mem (storage); owns only the online optimizer layer. Inspired by Continual Harness (arXiv 2605.09998) and ACE (arXiv 2510.04618).",
5
5
  "keywords": [
6
6
  "pi-package",
package/src/config.ts CHANGED
@@ -69,11 +69,19 @@ function mergeConfig(over: Partial<HarnessConfig>): HarnessConfig {
69
69
  proposer: over.proposer ?? "steering",
70
70
  outcomeImportance: {
71
71
  enabled: over.outcomeImportance?.enabled ?? false,
72
- bump: over.outcomeImportance?.bump ?? DEFAULT_REF_BUMP,
72
+ bump: coerceBump(over.outcomeImportance?.bump),
73
73
  },
74
74
  };
75
75
  }
76
76
 
77
+ /** Coerce a user-provided bump to a finite number, else the default. The bump
78
+ * is an ARITHMETIC operand (importance + bump), so a non-numeric value must not
79
+ * leak through: importance + "0.03" === "0.50.03" → NaN, which would then be
80
+ * pruned as below-floor on the next decay. */
81
+ function coerceBump(raw: unknown): number {
82
+ return typeof raw === "number" && Number.isFinite(raw) ? raw : DEFAULT_REF_BUMP;
83
+ }
84
+
77
85
  /** Load the config, merged over defaults. Tolerant: missing/malformed → defaults.
78
86
  * Cached for the process lifetime (config is read once per session). */
79
87
  export async function loadConfig(path: string = CONFIG_PATH): Promise<HarnessConfig> {
package/src/index.ts CHANGED
@@ -11,9 +11,9 @@ import { registerHarness } from "./harness.js";
11
11
  import { registerInjection } from "./inject.js";
12
12
  import { registerRefine } from "./refine.js";
13
13
  import { registerTools } from "./tools.js";
14
- import { registerReminder } from "./remind.js";
15
- import { registerAutoRefine } from "./auto-refine.js";
16
- import { registerOutcome } from "./outcome.js";
14
+ import { registerReminder, resetReminder } from "./remind.js";
15
+ import { registerAutoRefine, resetAutoRefine } from "./auto-refine.js";
16
+ import { registerOutcome, resetOutcome } from "./outcome.js";
17
17
  import { getState, reconstruct, STATE_ENTRY } from "./store.js";
18
18
 
19
19
  export default function continualHarness(pi: ExtensionAPI): void {
@@ -21,6 +21,11 @@ export default function continualHarness(pi: ExtensionAPI): void {
21
21
  // reload / resume / fork. This is what makes refinements branch-local and
22
22
  // rollback-able via /tree.
23
23
  pi.on("session_start", async (_event, ctx) => {
24
+ // A new/resumed/forked session starts from a fresh cadence baseline: reset
25
+ // the turn_end counters so a fork does not inherit the parent's window.
26
+ resetAutoRefine();
27
+ resetReminder();
28
+ resetOutcome();
24
29
  reconstruct(ctx.sessionManager.getBranch() as Iterable<unknown>);
25
30
  const n = getState().items.length;
26
31
  if (n > 0) {
@@ -50,5 +55,6 @@ export {
50
55
  registerProposer,
51
56
  type DeltaProposer,
52
57
  type ProposeInput,
58
+ type ProposedDelta,
53
59
  type ProposeResult,
54
60
  } from "./proposer.js";