Runtime UX truth: SSOT OmpKeep blueprint ยท Extension UX Contract. This page owns memory-system depth; SSOT owns the live extension surface.


1. ๐Ÿš€ Quick Start

OmpKeep exposes one human entry command: /ok. Bare /ok opens a compact status-first menu; /ok <route> is the scriptable fast path. Low-level tools remain model-facing, not slash-command clutter.

/ok routeActionKey options
doctor ยท diagnosticsHealth, integrity, and secret-safety checksdiagnostics --save
graph ยท timeline ยท proceduresRead-only relationships and historytimeline --memory <id> --save
inbox ยท learnings ยท curate ยท patchesReview candidates and patchescurate --mode=propose|auto
maintain ยท consolidate ยท meta ยท renderGoverned maintenancemaintain --report
handoffSnapshot state for continuation--goal <text>
session-sync ยท session-reindex ยท session-searchSession intelligence--yes for writes non-interactively

Mutating routes confirm in the TUI and require --yes when no interactive confirmation is possible.


2. ๐Ÿ”ง Directory Layout

Persistent data is stored by priority:

  1. OMP_MEMORY_ROOT environment variable
  2. OMPKEEP_ROOT environment variable
  3. PI_MEMORY_ROOT environment variable
  4. Legacy directory ~/.pi/agent/pi-memory/ (if it exists)
  5. Default directory ~/.omp/agent/omp-memory/

Local settings overrides cascades in settings.json:

  • {cwd}/.omp/settings.json looking for "ompkeep".localPath or "omp".localPath (with subfolder /omp-memory)
  • {cwd}/.pi/settings.json looking for "pi-persistent-intelligence".localPath or "pi-pi".localPath (with subfolder /pi-memory)
~/.omp/agent/omp-memory/  (or legacy ~/.pi/agent/pi-memory/)
โ”œโ”€โ”€ memory/
โ”‚   โ”œโ”€โ”€ L1.identity.jsonl       # Core identity records (Human ratification only)
โ”‚   โ”œโ”€โ”€ L2.playbooks.jsonl      # Working workflow records (Auto-curated or manual)
โ”‚   โ”œโ”€โ”€ evidence.jsonl          # Trust/provenance records with bounded excerpts
โ”‚   โ”œโ”€โ”€ tombstones.jsonl        # Delete markers preventing record re-creation
โ”‚   โ”œโ”€โ”€ reinforcement.jsonl     # Outcome logs used for stability adjustments
โ”‚   โ””โ”€โ”€ inquiries.jsonl         # Open questions triggered by context matching
โ”œโ”€โ”€ daily/                  # Daily logs matching YYYY-MM-DD.md
โ”œโ”€โ”€ inbox/                  # Captured candidate records before curation
โ”‚   โ””โ”€โ”€ captured.jsonl      # Bounded candidate writes
โ”œโ”€โ”€ patches/                # Pending patch files containing memory changes
โ”œโ”€โ”€ search/                 # FTS5 search index
โ””โ”€โ”€ config.json             # Configuration

3. ๐Ÿ“ฆ Hook Registration

OmpKeep hooks directly into the OMP lifecycle events.

export interface OmpExtensionAPI {
  on(
    event: "session_start" | "before_agent_start" | "agent_end" | "session_shutdown",
    handler: (event: any, ctx: any) => Promise<any> | any,
  ): void
  registerTool(def: {
    name: string
    label: string
    description: string
    parameters: unknown
    execute(id: string, params: any): any
  }): void
  registerCommand(
    name: string,
    def: { description: string; handler(args: string, ctx: any): void },
  ): void
}

Hook Pipeline Details

  • session_start: Resolves the project profile context, synchronizes FTS5 indices, and parses/exports Markdown session summaries.
  • before_agent_start: Evaluates pending inbox candidates, launches the inbox overlay TUI, and injects context blocks into the agent turn.
  • agent_end: Scans user turns for corrections/Guidance patterns and populates local user/assistant turn buffers.
  • session_shutdown: Runs LLM consolidation (Claude Haiku-powered candidate extraction) and triggers auto-curation patches.

4. ๐Ÿ’ก Injection Pipeline

Context retrieval uses a tiered, budget-bounded assembly pipeline.

[User Prompt] โ”€โ”€> [FTS5 + Semantic Vector Search] โ”€โ”€> [Scope Filter] โ”€โ”€> [Negative Filter] โ”€โ”€> [Budget Assembly]
  1. Relevance Selection: Retrieves top maxRecords candidates using hybrid SQLite FTS5 index and qmd vector search.
  2. Profile Scope: Excludes records belonging to other repository profiles or hashes.
  3. Basic Scope: Drops project-scoped records that do not match the current working directory.
  4. Negative Scope: Removes records whose does_not_apply_when or known_exceptions match terms in the current prompt.
  5. Context Compaction: Assembles the selected statements under category prefixes (โš ๏ธ AVOID:, โœ“ PREFER:, ๐Ÿ“Œ CONVENTION:) into a compact Markdown injection block.

5. ๐Ÿšจ Gotchas & Safety

  • ๐Ÿšจ Precedence: Programmatic settings in config.json override runtime defaults; L1 records never auto-apply.
  • ๐Ÿšจ Secret Blocking: Candidates matching secret-like regex signatures are blocked immediately before serialization.
  • ๐Ÿšจ Memory Leak: Watchers and polling timers must be fully cleared in session_shutdown to avoid process leaks.
  • ๐Ÿšจ Nginx Rule: Any static Markdown representation (MEMORY.md) is a projection; JSONL files remain the sole source of truth.

6. ๐Ÿ” Curation Rules

Curation requires deterministic validation before mutating memory.

  • Tombstone Check: Candidates attempting to recreate a tombstoned record ID must be rejected.
  • Provenance Check: Candidate text must share at least 35% overlap coverage (matched statement tokens divided by total statement tokens) with its supporting evidence.
  • Poisoning Gate: Auto-curation is blocked if a candidate is sourced from repository text or third-party documentation.
  • Decay Cycle: Overdue playbooks lose confidence (0.05 for stable, 0.15 for semi-stable) on each maintenance loop.