MOYU: A Zero Trust Security Memory Toolkit for AI Agents

Introduction

When adding “long-term memory” to Agents, a common practice is to directly write conversations into a vector database or Markdown files, and then stuff them back into the context during retrieval. This path is quick to pick up, but the writing side often lacks a unified security check: prompt injection, PII (Personally Identifiable Information), and abnormally high-frequency writes are difficult to intercept before they hit the disk. Furthermore, when the context reaches its limit, you usually have to orchestrate compression and forgetting yourself.

Below is an introduction to the Moyu — AI Agent Secure Memory Toolkit on SkillHub (located at @user_cac30d95/moyu, current version 2.10.1). It packages the MOYU memory layer into a universal Skill and comes with a pure Python toolkit. It emphasizes write-side defense, retrieval, and lifecycle management under a zero-trust model. LLM enhancement is enabled by default and automatically degrades when no API Key is present, ensuring core memory capabilities remain available offline.

What is this?

MOYU is positioned as a “security-first AI Agent memory layer.” It is written in pure Python and requires zero external infrastructure on the storage side (the “zero infrastructure” mentioned in the Skill description refers to the lack of need for self-hosted databases or Docker). It stores data locally using folders and SQLite FTS5, and can be installed via pip or by copying the moyu_toolkit/ directory.

  • Maintenance & Release: Sourced from the SkillHub community, published by user_cac30d95; the page lists the author as Ye Qingmian. The toolkit also provides a GitHub repository: https://github.com/awchzh/moyu-memory
  • SkillHub Category: ai-agent; Tag requires_api_key=false (installing the Skill itself does not require an API Key).
  • Problem Solved: It built multi-layered defense and automated pipelines into memory writing, retrieval, compression/forgetting, and cross-session bridging. This mitigates risks such as “memory pollution, privacy leaks to disk, and key information being crowded out of the context.”

Core Features

The following capabilities are derived from the SKILL.md included in the Skill and the official description, summarized according to a 6-layer capability system (Defense, Memory & Retrieval, Knowledge, Lifecycle, Learning & Reflection, Integration).

Defense Layer (11 items)

A pre-write content security gate (v2.10.1: anti-obfuscation preprocessing, pattern library with 613 regexes + LLM review), PII masking, write storm protection, tool loop detection, password verification, integrity verification & recovery, optional HMAC-SHA256 memory digital signature (MOYU_SIGN_KEY), user isolation & encryption, LLM secondary security checks, and access behavior monitoring form a defense chain that is enabled by default. The Skill documentation provides a graded explanation of threat coverage and mentions that benchmarks can be reproduced using moyu benchmark --full.

Memory & Retrieval

TEMPR multi-strategy retrieval (semantic, BM25, temporal, entity, etc., with configurable weights), local FastEmbed vectorization, SQLite FTS5, search feedback and adaptive weight tuning via moyu tune, automatic memory extraction, and Skill Memory for accumulating experience by function (moyu skill-note).

Knowledge Layer

Knowledge graphs (LLM-enhanced), workflow knowledge bases (Markdown indexed), and automatic user profile extraction.

Lifecycle Layer

Context compression and alerts, task maps, forgetting curves (including LLM review), memory merging, and access heat (HOT/WARM/COLD) tracking. v2.10.1 mentions reversible compression CCR and NAS dual-brain audit patches (subject to version notes).

Learning & Reflection, Integration Layer

Learning from corrections and self-reflection; wake-up orchestration, working memory, cross-session bridging (~/.moyu/session_state.json), standardized injection via moyu inject, defense logs, etc. Non-Hermes type Agents can add instructions to the system prompt to read session_state.json to continue sessions.

LLM Enhancement: Re-ranking, summarization, and graphs are enabled by default; if no Key is available, it automatically degrades according to the Skill description, while local retrieval and rule-based channels remain available.

Installation & Activation

This involves two steps: First, install the Skill into the current Agent’s skills directory (so the model follows SKILL.md), then install the moyu-memory CLI/library locally (to actually read and write memory).

1. Install SkillHub CLI (if not already installed)

Check or install according to https://skillhub.cn/install/skillhub.md:

command -v skillhub && skillhub --version

If not installed, you can execute the following (full installation, including default Skills):

curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash

2. Install the Moyu Skill to the current Agent

During installation, you must use --dir to point to the skills directory recognized by the current Agent (installing to the default ./skills/ might result in it not being loaded). The official page requires installing @user_cac30d95/moyu based on the installation documentation mentioned above.

skillhub install moyu --namespace user_cac30d95 --dir <your skills directory>

Common paths (from SkillHub installation documentation):

  • Cursor: ~/.cursor/skills/
  • Claude Code: ~/.claude/skills/
  • Codex: ~/.codex/skills/ or .agents/skills/ under the project

After installation, restart or refresh the Skill index as required by each client.

3. Install MOYU Toolkit (Python)

The plug-and-play method recommended within the Skill:

pip install moyu-memory

Alternatively, inside the Skill package, run pip install -r requirements.txt for moyu_toolkit/ and then call python3 moyu.py locally. This is suitable for scenarios where you do not wish to go through PyPI.

Optional environment variable examples (excerpted from Skill docs): Set MOYU_SIGN_KEY to enable memory signing; configure defense_log.webhook for non-Hermes Agents to integrate defense event notifications.

Typical Usage

The following commands are from the Skill’s official “Quick Start” and can be reproduced directly on your local machine.

Interactive Entry (Zero config, no API Key required):

moyu quickstart

Format retrieval results into text ready for context injection:

moyu inject "Current conversation topic"

Call within Python:

from moyu_toolkit.moyu import inject_context
inject_context("Current conversation topic")

In daily use, you can also use moyu search <query> for retrieval, moyu setup / moyu verify for security and integrity checks, moyu session state to view cross-session state, etc. For a full list of subcommands, please refer to the “Command Reference” in the SKILL.md within the Skill package.

Scenarios & Cautions

Who is this for?

  • Those who need persistent memory for Agents and want the write path to include injection detection, PII handling, and integrity verification by default.
  • Those who frequently hit context limits and want compression, forgetting, and merging to be handled automatically by the toolchain.
  • Those who want offline availability (local vectors and FTS) but do not mind enabling LLM enhancements when a Key is available.

Limitations & Cautions

  • The defense chain is a layered deterrent; the Skill documentation explicitly states it is not a “silver bullet.” Complex targeted attacks still require combination with business audits and permission design.
  • LLM-related capabilities depend on external models and are affected by Keys and network conditions; without a Key, they degrade by design, and the effectiveness of some graph/re-ranking features will be reduced.
  • SkillHub Metadata (as of scraping): Rating 100000, Downloads 2548; this is a community Skill, so upgrades and compliance require following the version notes yourself (current 2.10.1).

Conclusion

Moyu encapsulates MOYU’s secure memory capabilities into an installable Agent Skill and uses pip install moyu-memory along with the moyu CLI to create a complete implementation path. Write security checks, retrieval tuning, lifecycle management, and cross-session bridging are all completed within a single pure Python toolkit, making it suitable as a starting point for building your own Agent memory layer.

  • SkillHub Page: https://www.skillhub.cn/skills/user_cac30d95/moyu
  • Official API Coordinates Page: https://api.skillhub.cn/user_cac30d95/moyu
  • Installation Guide: https://skillhub.cn/install/skillhub.md
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye