@herjarsa/omo-meta-governor 0.50.1 → 0.51.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
@@ -615,9 +615,13 @@ All configuration lives under the `meta_governor` key in
615
615
  |-------|------|---------|-------------|
616
616
  | `saveDecisions` | boolean | `true` | Whether to save decision records. |
617
617
  | `saveLessons` | boolean | `true` | Whether to save lessons. |
618
- | `autoRemember.enabled` | boolean | `true` | v0.49.1: kill-switch for the Phase 4 auto-remember prompt (warn/escalate/stop → agentmemory_memory_save). Set `false` to disable it entirely. |
619
- | `autoRemember.cooldownMs` | number | `300000` | v0.49.1: min ms between two auto-remember fires in the same session. |
620
- | `autoRemember.dedupe` | boolean | `true` | v0.49.1: identical content is never re-queued in the same session. |
618
+ | `autoRemember.enabled` | boolean | `false` | Opt-in kill-switch for the auto-remember prompt (escalate/stop only → `omo_remember`). Conscience fix 2026-09-27: default flipped `true` → `false`; `warn` no longer triggers. |
619
+ | `autoRemember.cooldownMs` | number | `300000` | Min ms between two auto-remember fires in the same session. |
620
+ | `autoRemember.dedupe` | boolean | `true` | Identical content (stable key: action + evidence sources + deviation categories, score floats excluded) is never re-queued in the same session. |
621
+ | `conscience.enabled` | boolean | `false` | Master switch for conscience memory persistence (opt-in). |
622
+ | `conscience.maxMemoriesPerSession` | integer | `5` | Max conscience memories persisted per session. |
623
+ | `conscience.toolRoute` | enum | `omo_remember` | Tool route for conscience writes (`omo_remember` only). |
624
+ | `conscience.requireNovelty` | boolean | `true` | When true, only novel structured content (`mistake`, `whatToDo`, `whereToGo`, `toolRoute`) is persisted; raw dumps forbidden. |
621
625
 
622
626
  ### `modelOverride`
623
627
 
@@ -15,7 +15,7 @@
15
15
  * - Decisions go to agentmemory_memory_save (type: "fact").
16
16
  * - No file I/O, no MCP calls — just decision logic + DI write.
17
17
  */
18
- import type { AgentmemoryWriteBackend, ClosedLoopConfig, LearnFromOutcomeInput, LearnFromOutcomeOutput } from "./types";
18
+ import type { AgentmemoryWriteBackend, ClosedLoopConfig, Decision, Deviation, LearnFromOutcomeInput, LearnFromOutcomeOutput } from "./types";
19
19
  /** Severity ordering for threshold comparison. */
20
20
  declare const SEVERITY_ORDER: Record<string, number>;
21
21
  /**
@@ -29,4 +29,53 @@ export declare function observeAndLearn(input: LearnFromOutcomeInput, backend: A
29
29
  * Helper: create a default ClosedLoopConfig.
30
30
  */
31
31
  export declare function defaultClosedLoopConfig(): ClosedLoopConfig;
32
+ /**
33
+ * Conscience value-gate (D3). Single gate for all conscience memory writes.
34
+ *
35
+ * Requires ALL of:
36
+ * - action in {escalate, stop} (D1 — warn/continue never persist)
37
+ * - config.enabled
38
+ * - config.saveLessons !== false
39
+ * - severityMeetsThreshold(deviations, config.minSeverityToLearn)
40
+ * - novelty === true (caller-owned novelty check)
41
+ * - lessonCount < config.maxLessonsPerSession
42
+ */
43
+ export interface ShouldPersistConscienceMemoryInput {
44
+ readonly action: Decision["action"];
45
+ readonly deviations: readonly Deviation[];
46
+ readonly config: ClosedLoopConfig;
47
+ readonly novelty: boolean;
48
+ readonly lessonCount: number;
49
+ }
50
+ export declare function shouldPersistConscienceMemory(input: ShouldPersistConscienceMemoryInput): boolean;
51
+ /**
52
+ * Stable dedupe key (D5). Hash of stable fields only — action + sorted
53
+ * evidence sources + sorted deviation categories. Score floats are
54
+ * deliberately excluded: float jitter previously defeated dedupe.
55
+ */
56
+ export interface ConscienceDedupeKeyInput {
57
+ readonly action: string;
58
+ readonly evidenceSources: readonly string[];
59
+ readonly deviationCategories: readonly string[];
60
+ }
61
+ export declare function conscienceDedupeKey(input: ConscienceDedupeKeyInput): string;
62
+ /**
63
+ * Structured conscience memory content (D4/D6). Built via buildLessonContent
64
+ * + extractConcepts — never a raw dump. Delivery route is always the
65
+ * Zod-validated omo_remember tool.
66
+ */
67
+ export interface BuildConscienceMemoryContentInput {
68
+ readonly action: "escalate" | "stop";
69
+ readonly mistake: string;
70
+ readonly whatToDo: string;
71
+ readonly whereToGo: string;
72
+ readonly toolRoute: "omo_remember";
73
+ readonly score: number;
74
+ readonly files: readonly string[];
75
+ }
76
+ export interface ConscienceMemoryContent {
77
+ readonly content: string;
78
+ readonly concepts: string[];
79
+ }
80
+ export declare function buildConscienceMemoryContent(input: BuildConscienceMemoryContentInput): ConscienceMemoryContent;
32
81
  export { SEVERITY_ORDER };
package/dist/config.d.ts CHANGED
@@ -45,8 +45,10 @@ export interface MetaGovernorPluginConfig {
45
45
  /** v0.18.0: was silently dropped by loadOrchestratorConfig */
46
46
  defaultEscalationTarget?: "oracle" | "user";
47
47
  /**
48
- * v0.38.4 Option D: Oracle invocation frequency. Derived from
49
- * `oracle.frequency` (canonical) — exposed here only as a fallback.
48
+ * v0.38.4 Option D: Oracle invocation frequency.
49
+ * @deprecated READ-ONLY fallback — do not set. Canonical knob is
50
+ * `oracle.frequency`; this field is read only for back-compat with
51
+ * pre-v0.38.4 configs and is ignored when `oracle.frequency` is set.
50
52
  * Users should set `oracle.frequency` in opencode.jsonc, not this field.
51
53
  */
52
54
  oracleFrequency?: "per-stop" | "final-only" | "off";
@@ -64,6 +66,19 @@ export interface MetaGovernorPluginConfig {
64
66
  cooldownMs?: number;
65
67
  dedupe?: boolean;
66
68
  };
69
+ /**
70
+ * v0.50.0 (D10): conscience memory gate config. Canonical source for
71
+ * high-value memory persistence (escalate|stop only, value-gated).
72
+ * NOTE: typed structurally (not ConscienceConfig) so config.ts
73
+ * typechecks regardless of T1 landing order — shapes must match
74
+ * ClosedLoopConfig.conscience once T1 lands.
75
+ */
76
+ conscience?: {
77
+ enabled?: boolean;
78
+ maxMemoriesPerSession?: number;
79
+ toolRoute?: "omo_remember";
80
+ requireNovelty?: boolean;
81
+ };
67
82
  };
68
83
  /** Model override for MetaGovernor internal LLM usage. */
69
84
  modelOverride?: ModelOverrideConfig;
@@ -34,6 +34,7 @@ export interface PendingDelivery {
34
34
  export type DeliveryStatus = "pending" | "delivered" | "expired";
35
35
  export declare class PendingDeliveryRegistry {
36
36
  private readonly entries;
37
+ private static readonly MAX_ENTRIES;
37
38
  /** When mcpArgs match is disabled (no mcpArgs available on observed call) */
38
39
  private deliveredCount;
39
40
  private expiredCount;