plugin-development

A guide and toolkit for creating, testing, signing, and publishing Memoria governance plugins. These plugins add rules that review or control how Memoria operates.

In plain words
What is it for?
Use it to start a plugin, write Rhai or gRPC-based governance logic, define its capabilities and permissions, and publish it with integrity information.
Why use it?
It provides the required plugin structure, runtime choices, permissions, limits, and integrity fields so plugins can be managed consistently.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/matrixorigin/memoria/plugin-development
Any agent
npx skills add matrixorigin/memoria --skill plugin-development
Clone the repo
git clone --depth 1 https://github.com/matrixorigin/memoria

Made for: Claude Code, Codex.

Per session 37 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,142 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00037 $0.01142
Opus 5 $0.00018 $0.00571
Sonnet 5 $0.00007 $0.00228
Haiku 4.5 $0.00004 $0.00114

Measured yesterday against content hash 9d8bba1f7c20, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

plugin-development scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/plugin-development/SKILL.md · 136 lines

How it starts

The opening of the file, as written. The whole thing — 136 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Quick Start

memoria plugin init --dir ./my-plugin --name my-governance \
  --capabilities governance.plan,governance.execute

Creates:

my-plugin/
├── manifest.json    # Plugin metadata, permissions, limits
└── policy.rhai      # Governance logic (Rhai script)

manifest.json

{
  "name": "memoria-my-governance",
  "version": "0.1.0",
  "api_version": "v1",
  "runtime": "rhai",
  "entry": { "rhai": { "script": "policy.rhai", "entrypoint": "memoria_plugin" } },
  "capabilities": ["governance.plan", "governance.execute"],
  "compatibility": { "memoria": ">=0.1.0" },
  "permissions": { "network": false, "filesystem": false, "env": [] },
  "limits": { "timeout_ms": 500, "max_memory_mb": 32, "max_output_bytes": 8192 },
  "integrity": { "sha256": "", "signature": "", "signer": "" },
  "metadata": { "display_name": "My Governance Plugin" }
}

Key fields:

  • runtime: rhai (sandboxed) or grpc (remote service)
  • capabilities: must include governance.plan and/or governance.execute
  • integrity: auto-filled by memoria plugin publish

policy.rhai

fn memoria_plugin(ctx) {
    if ctx["phase"] == "plan" {
        let review = decision("my-plugin:check", "Description", 0.8);
        review["evidence"] = [evidence("source", "What was found")];
        return #{
            requires_approval: false,
            actions: [review],
            estimated_impact: #{ "my.metric": 1.0 }
        };
    }
    if ctx["phase"] == "execute" {
        return #{ warnings: [], metrics: #{ "my.metric": 1.0 } };
    }
    return #{};
}

Built-in helpers: decision(id, reason, confidence), evidence(source, description)

Runtime Types

Runtime Sandboxing Use Case
rhai In-process, memory/time limited Simple rules, no external deps
grpc Out-of-process, network call Complex logic, external services

Development Workflow

1. Local dev (no signature, no DB)

MEMORIA_GOVERNANCE_ENABLED=true \
MEMORIA_GOVERNANCE_PLUGIN_DIR=./my-plugin \
memoria serve

Read the full file on GitHub · 136 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 136 lines · 37 tokens per session scan A 9d8bba1f7c20

Subscribe to this mod's changes

plugin-development is a skill published in the GitHub repository matrixorigin/memoria (591 stars, last pushed 6d ago), licensed Apache-2.0. It adds 37 tokens to every session and 1,142 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.