Agent skill

Architecture

by matrixorigin in matrixorigin/memoria

Memoria codebase structure, workspace layout, key traits, database tables, config patterns, and testing conventions.

Apache-2.0Auto-check passedBackend & APIs

Install Architecture

skills CLI
$ npx skills add matrixorigin/memoria --skill architecture -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install matrixorigin/memoria architecture --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/matrixorigin/memoria.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/architecture .claude/skills/architecture && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
architecture
GitHub stars
607
Token cost
~1.8k tokens
SKILL.md length
306 words
Files
1
Skills in repo
9
Repo updated
First seen
Licence
Apache-2.0

At a glance

Memoria codebase structure, workspace layout, key traits, database tables, config patterns, and testing conventions.

  • Works in 3 steps: Add handler in memoria-api/src/routes/ → Register route in memoria-api/src/lib.rs… → Add e2e test in…
  • Modifying Memoria code
  • SKILL.md covers Workspace Layout, Key Traits, Database Tables and Config, plus 6 more sections
  • Calls make

What it does

Architecture is an agent skill from matrixorigin/memoria. Memoria codebase structure, workspace layout, key traits, database tables, config patterns, and testing conventions. Use when navigating or modifying Memoria code.

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs. The repository describes itself as: Secure memory management for AI Agents • Ensures data integrity • Reduces hallucinations • Maintains consistent long-term context. The licence is Apache-2.0.

When your agent uses it

  • Modifying Memoria code

Example prompts

  • “/architecture”

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. Add handler in memoria-api/src/routes/
  2. Register route in memoria-api/src/lib.rs build_router()
  3. Add e2e test in memoria-api/tests/api_e2e.rs using spawn_server()

What it can do on your machine

Read from SKILL.md and the folder at commit 81c5cc6. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • make

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Architecture loads about 1.8k tokens when it runs. Until then it costs about 44 tokens; SKILL.md has 306 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~44
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from matrixorigin/memoria at commit 81c5cc6, republished under its Apache-2.0 licence (© matrixorigin). 306 words, ~1,787 tokens.

Download SKILL.mdSave it as .claude/skills/architecture/SKILL.md (or your agent's skills folder).
name
architecture
description
Memoria codebase structure, workspace layout, key traits, database tables, config patterns, and testing conventions. Use when navigating or modifying Memoria code.

Workspace Layout

memoria/                          # Cargo workspace root
├── crates/
│   ├── memoria-core/             # Shared types: MemoriaError, Memory, MemoryType
│   ├── memoria-storage/          # SqlMemoryStore — all SQL queries, migrations
│   ├── memoria-service/          # Business logic
│   │   └── src/
│   │       ├── service.rs        # MemoryService — main entry point
│   │       ├── scheduler.rs      # GovernanceScheduler — periodic tasks + leader election
│   │       ├── config.rs         # Config struct (reads env vars)
│   │       ├── distributed.rs    # DistributedLock, AsyncTaskStore traits + SQL impls
│   │       ├── governance/       # GovernanceStrategy trait, DefaultGovernanceStrategy
│   │       └── plugin/           # Plugin system (manifest, repository, rhai, grpc)
│   ├── memoria-api/              # REST API (axum)
│   │   └── src/
│   │       ├── lib.rs            # build_router(), route registration
│   │       ├── state.rs          # AppState (service, task_store, instance_id)
│   │       └── routes/           # memory, admin, governance, plugins, sessions
│   ├── memoria-mcp/              # MCP server (stdio/SSE transport)
│   ├── memoria-cli/              # CLI binary: init, mcp, serve, plugin, benchmark
│   ├── memoria-embedding/        # Embedding + LLM client
│   └── memoria-git/              # Git-for-Data: snapshots, branches, merge
├── Cargo.toml                    # Workspace deps
└── build.rs                      # Proto compilation (tonic)

Key Traits

rust
trait GovernanceStrategy: Send + Sync {
    fn strategy_key(&self) -> &str;
    async fn plan(&self, store, task) -> Result<GovernancePlan>;
    async fn execute(&self, store, task, plan) -> Result<GovernanceExecution>;
}

trait GovernanceStore: Send + Sync {
    async fn list_active_users(&self) -> Result<Vec<String>>;
    async fn quarantine_low_confidence(&self, user) -> Result<i64>;
    // ... cleanup/maintenance methods
}

trait DistributedLock: Send + Sync {
    async fn try_acquire(&self, key, holder, ttl) -> Result<bool>;
    async fn renew(&self, key, holder, ttl) -> Result<bool>;
    async fn release(&self, key, holder) -> Result<()>;
}

trait AsyncTaskStore: Send + Sync {
    async fn create_task(&self, task) -> Result<()>;
    async fn complete_task(&self, task_id, result) -> Result<()>;
    async fn fail_task(&self, task_id, error) -> Result<()>;
    async fn get_task(&self, task_id) -> Result<Option<AsyncTask>>;
}

Database Tables

GroupTables
Coremem_memories, mem_user_state, mem_branches, mem_snapshots
Graphmemory_graph_nodes, memory_graph_edges, mem_entities, mem_memory_entity_links, mem_entity_links
Auditmem_edit_log, mem_retrieval_feedback, mem_memories_stats
Governancemem_governance_cooldown, mem_governance_runtime_state, mem_user_retrieval_params
Authmem_api_keys
Pluginmem_plugin_packages, mem_plugin_signers, mem_plugin_bindings, mem_plugin_binding_rules, mem_plugin_reviews, mem_plugin_audit_events
Distributedmem_distributed_locks, mem_async_tasks

Config

Config struct in config.rs reads from env vars:

FieldEnv VarDefault
db_urlDATABASE_URLmysql://root:111@localhost:6001/memoria
embedding_providerEMBEDDING_PROVIDERlocal
instance_idMEMORIA_INSTANCE_IDRandom UUID
lock_ttl_secsMEMORIA_LOCK_TTL_SECS120
governance_plugin_dirMEMORIA_GOVERNANCE_PLUGIN_DIRNone
governance_plugin_bindingMEMORIA_GOVERNANCE_PLUGIN_BINDINGdefault
governance_plugin_subjectMEMORIA_GOVERNANCE_PLUGIN_SUBJECTsystem

When adding a Config field: update ALL test Config { .. } constructors — check scheduler.rs tests AND tests/plugin_repository.rs.

REST API Structure

PrefixModuleAuthPurpose
/v1/memoriesroutes/memory.rsBearerCRUD, search, retrieve
/v1/snapshots, /v1/branchesroutes/memory.rsBearerGit-for-Data
/v1/sessionsroutes/sessions.rsBearerEpisodic memory, async tasks
/v1/governanceroutes/governance.rsBearerTrigger governance
/admin/*routes/admin.rsMasterAdmin ops
/admin/plugins/*routes/plugins.rsMasterPlugin repository
/healthroutes/admin.rsNoneLiveness probe
/health/instanceroutes/memory.rsNoneReadiness probe (returns instance_id)

Adding a New REST Endpoint

  1. Add handler in memoria-api/src/routes/
  2. Register route in memoria-api/src/lib.rs build_router()
  3. Add e2e test in memoria-api/tests/api_e2e.rs using spawn_server()

Plugin System Files

plugin/
├── mod.rs              # Re-exports
├── manifest.rs         # PluginManifest, PluginPackage, signing verification
├── repository.rs       # Publish, review, score, binding rules, audit
├── rhai_runtime.rs     # RhaiGovernanceStrategy (sandboxed Rhai)
├── grpc_runtime.rs     # GrpcGovernanceStrategy (remote gRPC)
├── governance_hook.rs  # Contract testing harness
└── templates/          # Rhai governance template

Distributed Components

ComponentFilePurpose
DistributedLock traitdistributed.rsLock abstraction
NoopDistributedLockdistributed.rsSingle-instance no-op
SqlMemoryStore lock impldistributed.rsINSERT-based DB lock with TTL
AsyncTaskStore traitdistributed.rsCross-instance task visibility
GovernanceSchedulerscheduler.rsLeader election + heartbeat
AppStatestate.rsHolds instance_id + DB task store

Testing

bash
make check          # cargo check + clippy -D warnings (MUST pass)
make test-unit      # Unit tests (no DB): memoria-core, memoria-service, memoria-mcp
make test           # All tests (needs MatrixOne, --test-threads=1)
make test-e2e       # API e2e tests only

Patterns:

  • E2e: spawn_server() → random port, shared DB, reqwest client
  • Distributed e2e: spawn_server_with_instance() → custom instance ID
  • Plugin: build_signed_plugin_files() helper for base64 file maps
  • Unique names: uuid::Uuid::new_v4().simple() for test isolation
  • DB tests need DATABASE_URL env var

Common Pitfalls

  1. Adding Config fields → must update ALL test constructors
  2. Clippy -D warnings → any warning = build failure
  3. PathBuf::from("x") in comparisons → use Path::new("x")
  4. format!() inside println!() → inline args directly
  5. Plugin exports → re-export chain: repository.rs → plugin/mod.rs → lib.rs
  6. Shared DB in tests → use unique names for isolation
  7. GovernanceScheduler constructors → #[allow(clippy::too_many_arguments)]
  8. MatrixOne DATETIME columns → use chrono::NaiveDateTime, not String

© matrixorigin, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/architecture of matrixorigin/memoria.

Open the folder on GitHubat commit 81c5cc6

Compare with similar skills

Architecture next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Architecture compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Architecture this skillmatrixorigin/memoria607—~1.8kAutomated safety check: PassApache-2.0
Configuring Horizoncoollabsio/coolify63k4 repos~898Automated safety check: PassMIT
Nestjs Best Practicesrolling-scopes/rsschool-app10k6 repos~1.2kAutomated safety check: PassMIT
Sub2API AdminWei-Shaw/sub2api43k1 repos~717Automated safety check: PassLGPL-3.0
Firecrawl Build Onboardingfirecrawl/firecrawl189k1 repos~1.4kAutomated safety check: NotesISC
Obsidian BasesAtmosphere/atmosphere3.8k22 repos~3.2kAutomated safety check: PassApache-2.0

Similar skills

  • Configuring Horizon

    coollabsio/coolify

    A skill your agent uses whenever the user mentions Horizon by name in a Laravel context.

    63k GitHub starsUsed in 4 repos~898 tokens
    Backend & APIsAuto-check passed
  • Nestjs Best Practices

    rolling-scopes/rsschool-app

    NestJS best practices and architecture patterns for building production-ready applications.

    10k GitHub starsUsed in 6 repos~1.2k tokens
    Backend & APIsAuto-check passed
  • Sub2API Admin

    Wei-Shaw/sub2api

    Manages a Sub2API deployment from the command line: accounts, redeem and invitation codes, groups, proxies, imports, exports and raw admin API calls.

    43k GitHub starsUsed in 1 repo~717 tokens
    Backend & APIsAuto-check passed
  • Firecrawl Build Onboarding

    firecrawl/firecrawl

    Gets Firecrawl working in a project: signs you in through the browser, saves FIRECRAWL_API_KEY to .env and picks the first SDK or REST path.

    189k GitHub starsUsed in 1 repo~1.4k tokens
    Backend & APIsAuto-check: notes
  • Obsidian Bases

    Atmosphere/atmosphere

    Create and edit Obsidian Bases (.base files) with views, filters, formulas, and summaries.

    3.8k GitHub starsUsed in 22 repos~3.2k tokens
    Backend & APIsAuto-check passed
  • Fortify Development

    coollabsio/coolify

    ACTIVATE when the user works on authentication in Laravel. An agent skill from coollabsio/coolify.

    63k GitHub starsUsed in 4 repos~1.9k tokens
    Backend & APIsAuto-check passed

More from matrixorigin/memoria

All 9 skills in this repo
  • Thememoria

    matrixorigin/memoria

    Use Memoria as OpenClaw's durable memory slot. An agent skill from matrixorigin/memoria.

    607 GitHub stars~728 tokensUpdated today
    Auto-check passed
  • API Reference

    matrixorigin/memoria

    Memoria REST API endpoints, request/response formats, auth, rate limits.

    607 GitHub stars~2.3k tokensUpdated today
    Auto-check passed
  • Deployment

    matrixorigin/memoria

    Deploy Memoria with Docker Compose or Kubernetes. An agent skill from matrixorigin/memoria.

    607 GitHub stars~1.6k tokensUpdated today
    Auto-check: notes
  • Local Embedding

    matrixorigin/memoria

    Run embedding on-device with ONNX Runtime. An agent skill from matrixorigin/memoria.

    607 GitHub stars~444 tokensUpdated today
    Auto-check: notes
  • Plugin Development

    matrixorigin/memoria

    Create, test, sign, and publish Memoria governance plugins. An agent skill from matrixorigin/memoria.

    607 GitHub stars~1k tokensUpdated today
    Auto-check passed
  • Release

    matrixorigin/memoria

    Cut a Memoria release. An agent skill from matrixorigin/memoria.

    607 GitHub stars~494 tokensUpdated today
    Auto-check passed

Categories

Questions about Architecture

What does Architecture do?

Memoria codebase structure, workspace layout, key traits, database tables, config patterns, and testing conventions. Architecture is an agent skill from matrixorigin/memoria. Memoria codebase structure, workspace layout, key traits, database tables, config patterns, and testing conventions.

When should I use Architecture?

Architecture fits situations like: modifying Memoria code.

How do I install Architecture in Claude Code?

Run `npx skills add matrixorigin/memoria --skill architecture -a claude-code`. Or copy the skill folder (skills/architecture in matrixorigin/memoria) into .claude/skills/architecture in your project. Claude Code loads it when a task matches its description.

How do I install Architecture in Codex?

Run `npx skills add matrixorigin/memoria --skill architecture -a codex`. Or copy the skill folder (skills/architecture in matrixorigin/memoria) into .agents/skills/architecture in your project. Codex loads it when a task matches its description.

Can I use Architecture in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add matrixorigin/memoria --skill architecture -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/architecture, .gemini/skills/architecture, .github/skills/architecture and .opencode/skills/architecture in your project.

What does Architecture need to run?

Going by SKILL.md and its folder, Architecture needs the command-line tools its instructions call (make).

Does Architecture access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Architecture safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Architecture use?

Architecture is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Architecture use?

About 1.8k tokens (SKILL.md is roughly 7.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Architecture?

Skills that share tags, products or a category with Architecture: Configuring Horizon (coollabsio/coolify, 63k stars), Nestjs Best Practices (rolling-scopes/rsschool-app, 10k stars), Sub2API Admin (Wei-Shaw/sub2api, 43k stars) and Firecrawl Build Onboarding (firecrawl/firecrawl, 189k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Architecture?

matrixorigin (a GitHub organization) maintains it in matrixorigin/memoria, which has 607 GitHub stars. The repository holds 9 skills in this directory. The repository was last updated on October 7, 2026.

Source: matrixorigin/memoria on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.