Memory

Evolution

Understanding Mopheus's distillation skills architecture (Core/General/Specialty), negative pattern classification guards, cognitive promotion, and skill synthesis.

Without post-task reflection, teams are doomed to repeat the same troubleshooting steps.

However, an AI agent's execution transcript is naturally noisy—filled with trial-and-error commands, raw Bash outputs, and transient network hiccups. If raw transcripts are dumped into the knowledge base indiscriminately, the memory system quickly degenerates into an unsearchable data swamp.

Mopheus addresses this with Memory Distillation and Cognitive Promotion, using a modular distillation skills architecture and strict classification guards to transform ephemeral fixes into standard operating procedures and fully automated agent skills.


Memory Distillation Skills Architecture

In Mopheus, memory distillation is not a black-box background script. It is an agent cognitive task orchestrated by specialized Mopheus Skills declaring the memory_distillation capability:

┌─────────────────────────────────────────────────────────────────┐
│             Memory Distillation Skills Architecture             │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│   [Core Distillation Skill: mopheus-memory-distillation-core]   │
│   • Base standards: Enforces OKF format, forbids disk writes    │
│   • Guardrails: Classification guards & mop memory store        │
│   • Versioning: Explicit --supersedes chain tracking            │
│                                                                 │
│   [General Distillation: mopheus-memory-distillation-general]   │
│   • Cross-project generalization: Troubleshooting & pitfalls    │
│   • Context stripping: Removes transient IPs, paths & noise     │
│                                                                 │
│   [Specialty Domain Skills: <domain>-memory-distillation]       │
│   • Domain depth: DB administration, cloud infra, legal         │
│   • Scoping: Binds asset_id, db_type, project_id as needed      │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘
  1. mopheus-memory-distillation-core (Core Specification Skill):
    • Built-in foundational skill, mandatory for every distillation run.
    • Enforces baseline rules: never write files directly to local disk; persist strictly through mop memory store; adhere strictly to OKF schemas and the 7 memory types; parse ticket metadata and labels into structured context tags.
  2. mopheus-memory-distillation-general (General Practice Skill):
    • Built-in general skill instructing agents to distill portable, reusable engineering insights (e.g., third-party library pitfalls, common runtime errors, HTTP/network troubleshooting).
  3. Specialty Domain Skills (Domain Distillation Skills):
    • Workspace-registered skills declaring capabilities: [memory_distillation] in their Frontmatter.
    • Built-in official specialty domain skills include:
      • engineering-memory-distillation: Software engineering workflows, codebase architecture, CI/CD, and build/deploy troubleshooting;
      • legal-contract-memory-distillation: Commercial contracts, legal clause compliance, and audit criteria;
      • people-hr-memory-distillation: Organizational structure, recruiting, attendance evaluation, and employee services;
      • sales-customer-memory-distillation: Sales opportunities, client communication, milestone sign-off, and customer relationship history.
    • Deeply extract infrastructure configurations, instance topologies, and domain-specific logic.

The Three Distillation Selection Modes

When a ticket completes or when distillation is triggered manually, the system supports three selection modes:

ModeExecution MechanismTypical Use Case
auto (Default Matching)The agent reads the complete ticket transcript first and compares it against the registered specialty skill catalog. If a specialty skill matches, the agent dynamically selects it via mop skill select-distillation <skill-id> --output json; if none clearly fits, it proceeds with General only.Standard automated ticket retrospectives and routine operations.
general-only (General Only)Maps to the internal enum general_only. No specialty catalog is provided. The agent applies Core and General skills only, strictly filtering out environment-specific details.Generic third-party library bugfixes, build scripts, or common utility improvements.
specialty (Explicit Domain)The user or scheduler explicitly designates an authoritative domain skill (requires --specialty-skill-id <skill-id>). The agent applies that skill together with Core and General.Major database migrations, production cutovers, or custom hardware provisioning.

Ticket Distillation Trigger & Lifecycle Operations (CLI)

Engineers can manually trigger ticket distillation tasks or manage distillation status via the Mopheus CLI:

# 1. Trigger memory distillation for a ticket (default auto mode)
mop ticket distill "9b2c34a1-0000-0000-0000-000000000001" \
  --agent-id "3fa85f64-5717-4562-b3fc-2c963f66afa6"

# 2. Distill general insights only (bypass specialty domain skills)
mop ticket distill "9b2c34a1-0000-0000-0000-000000000001" \
  --agent-id "3fa85f64-5717-4562-b3fc-2c963f66afa6" \
  --mode general-only

# 3. Explicitly designate a specialty skill for deep domain distillation
mop ticket distill "9b2c34a1-0000-0000-0000-000000000001" \
  --agent-id "3fa85f64-5717-4562-b3fc-2c963f66afa6" \
  --mode specialty \
  --specialty-skill-id "8a1b2c3d-0000-0000-0000-000000000008"

# 4. Force re-distillation of an already distilled ticket
mop ticket distill "9b2c34a1-0000-0000-0000-000000000001" \
  --agent-id "3fa85f64-5717-4562-b3fc-2c963f66afa6" \
  --force

# 5. List resolved tickets that have not yet been distilled
mop ticket list --undistilled

# 6. List available skills equipped with memory distillation capability
mop skill list --capability memory_distillation

# 7. Manually mark a ticket as distilled (or document skip reason)
mop ticket mark-distilled "9b2c34a1-0000-0000-0000-000000000001" \
  --skipped-reason "No persistent engineering knowledge" \
  --yes

Negative Pattern Classification Guards

The most critical failure mode in memory distillation is Type Misclassification. For example, misclassifying an Out-Of-Memory (OOM) crash or a library version incompatibility as an "environment fact" (environment_fact) tricks future agents into believing the system is supposed to crash under those conditions.

Mopheus enforces Strict Classification Guards at the prompt and backend layers:

1. Fault vs. Fact Exclusion Guard

  • Forbidden: Any crash, exception, memory overflow (OOM), library conflict, network timeout, or command failure must never be saved as an environment_fact.
  • Mandatory Routing:
    • Unresolved pitfalls and warnings $\rightarrow$ categorize as failure_scenario (Risk);
    • Root-cause-identified, verified solutions $\rightarrow$ categorize as error_resolution (Resolution);
    • environment_fact is strictly reserved for healthy, steady-state infrastructure attributes (OS release, CPU cores, mount points, listening ports).

2. Human Correction Precedence

  • When an execution transcript contains direct corrective feedback from a human engineer or DBA (e.g., "Do not drop the column, introduce a soft-delete column instead"), the insight is forcefully tagged as human_correction.
  • Human corrections carry top precedence in retrieval, overriding standard agent habits.

3. Denoising and Secret Scrubbing

  • Automatically redacts API keys, passwords, bearer tokens, and session credentials.
  • Cleans up infinite retry loops and intermediate failed syntax attempts, preserving only the verified sequence of actions.

Cognitive Promotion Lifecycle

High-value institutional knowledge grows organically. Mopheus guides memories up a structured Cognitive Promotion Ladder:

                 [Stage 4: Automated Native Skill]
             Mopheus Skill (SKILL.md + Autonomous Task)
                             ▲
                             │ mop memory synthesize-skill
                 [Stage 3: Team Consensus Standard]
               Preference / Human Correction
                             ▲
                             │ Elevated to Team Standard
                 [Stage 2: Standard Operating Procedure]
               Success Playbook (5-Stage JSON SOP)
                             ▲
                             │ Repeatedly Verified
                 [Stage 1: Transient Error Resolution]
               Error Resolution / Failure Scenario

Practical Progression Example

  1. Stage 1 (Error Card):
    An agent fixes an ORA-00257: archiver error by identifying full recovery space. System distills runbooks/errors/<id>.md.
  2. Stage 2 (Standard Operating Procedure):
    The fix recurs across multiple databases. A senior DBA consolidates the card into a structured success_playbook with 5-stage JSON:
    • fault: Fast recovery of Oracle instance hanging due to archiver exhaustion;
    • preconditions: SYSDBA access verified, no active cross-node sync in progress;
    • steps: Check space utilization $\rightarrow$ backup and move expired archives $\rightarrow$ run RMAN crosscheck $\rightarrow$ resume suspended sessions;
    • validation: Query v$archived_log to confirm utilization dropped below 80%;
    • rollback: Trigger standby failover if unarchived logs were inadvertently affected.
  3. Stage 3 (Automated Skill Synthesis):
    Once the SOP proves mature and reliable, the team compiles it into an autonomous native Mopheus Skill.

Compiling Memories into Native Skills

Using the Mopheus CLI, teams can compile proven memory cards into executable, modular Mopheus Skills by dispatching a task to a designated Skiller agent:

# Dispatch skill synthesis task from memory cards to an agent with is_skiller enabled
mop memory synthesize-skill \
  "9b2c34a1-0000-0000-0000-000000000005" \
  "c971377d-839b-43e8-bf11-4ff24de977ce" \
  --agent-id "3fa85f64-5717-4562-b3fc-2c963f66afa6"

Skill Synthesis Workflow:

  1. Agent Qualification: The assigned agent must have is_skiller = true enabled.
  2. Asynchronous Task Dispatch: The server generates an agent task with context.kind = "memory_distillation" and injects the specified memory cards.
  3. Automated Skill Packaging:
    • The agent analyzes preconditions and execution steps from the memories;
    • Generates an OKF-compliant SKILL.md (defining parameters, tool requirements, and safety rollbacks);
    • Registers the capability into the workspace skill catalog, allowing all agents to invoke it as a native skill.

Memory Maintenance & Lifecycle Operations

All memories distilled by agents or created by engineers are persistently managed through the standard CLI:

# 1. List active memories filtered by type
mop memory list --type procedure --page 1 --per-page 10

# 2. Inspect a specific card's full details and linked source tickets
mop memory get "9b2c34a1-0000-0000-0000-000000000005"

# 3. Disable an outdated card without deleting historical audit links
mop memory update "9b2c34a1-0000-0000-0000-000000000005" --enabled false

# 4. Permanently delete an invalid or corrupted memory card
mop memory delete "9b2c34a1-0000-0000-0000-000000000005" --yes

Through this continuous loop, Mopheus marries the high-frequency distillation capacity of AI agents with the architectural oversight of engineering teams, creating a self-cleaning, compounding enterprise memory system.