memory-loading

A shared startup procedure that loads relevant notes from previous Maigo projects before an agent begins work.

In plain words
What is it for?
It tells agents how to find memory indexes, select the most relevant entries, load up to ten of them, check their format, and report what was loaded.
Why use it?
Agents may repeat past mistakes or ignore established project knowledge if they start without that context.

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/lee-w/maigo/memory-loading
Any agent
npx skills add Lee-W/maigo --skill memory-loading
Clone the repo
git clone --depth 1 https://github.com/Lee-W/maigo

Made for: Claude Code, Codex.

Per session 68 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,617 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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.00068 $0.01617
Opus 5 $0.00034 $0.00809
Sonnet 5 $0.00014 $0.00323
Haiku 4.5 $0.00007 $0.00162

Measured 2d ago against content hash 182d2125e895, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

memory-loading scanned grade B with 1 finding 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 2d ago.

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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

- **Per-project**:`cat ~/.claude/projects/<current-project>/memory/MEMORY.md`(若存在)
skills/memory-loading/SKILL.md · 90 lines

How it starts

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

Memory Loading

Owner: all agents Consumers: agents/Raana.mdagents/Tomori.mdagents/Soyo.md、orchestrator 本身

為什麼這個 skill 存在

三個 agent 在啟動時都要做相同的「讀記憶 → schema 自檢 → fallback」流程,但過去各自在 agent prompt 裡重複寫。這個 skill 是三者共通行為的 single source of truth。

orchestrator 自己也是 consumer:orchestrator 開始跑任何 /maigo:* 流程前,也要主動查一次 memory,不能只靠 delegate 給 Raana/Tomori/Soyo 時才觸發這個 skill——曾經因為只有 delegate 對象 會查記憶,orchestrator 自己重複違反同一條「背景 agent 不用 ScheduleWakeup 輪詢」的教訓,兩次都 沒查過記憶就重犯(見 skills/failure-handling「等待自己開的背景 agent」段)。

標準 5 步流程

啟動後、正式開始工作之前,先載入記憶(兩層):

  1. 依序讀兩個 index

    • Cross-projectcat ~/.config/maigo/memory/MEMORY.md
    • Per-projectcat ~/.claude/projects/<current-project>/memory/MEMORY.md(若存在)

    <current-project> 是當前專案路徑 slug 化的結果(與 validate_memory.py 相同的枚舉方式——即 ~/.claude/projects/ 下對應的目錄名,例如 -Users-weilee-Programming-personal-maigo)。

  2. 讀 index 每行 - [Title](file.md) — description(兩層 index 合併),判斷哪些 description 跟當前 task 的 keyword / 主題有 overlap

  3. 相關性排序:把兩層合併後的候選 entry 依匹配度排序

  4. 限量載入:若相關條目過多,僅 Read 最相關的前 10 筆 entry 全文——10 筆是兩層合計上限,不是每層各 10;當作這次工作的 context

  5. 在輸出開頭印 ## Loaded memory entries,列出用了哪些 entry

Schema 自檢(lazy)

對每個讀進來的 entry frontmatter 做最小檢查:

  • name / description / type 任一欄位
  • type 值不在 {user, feedback, project, reference}

遇到問題不 abort,繼續使用該 entry(lenient),但在 ## Loaded memory entries 段該行末尾加 [schema warn: <缺什麼或 type 不合法>]

完整檢查可手動跑 python3 scripts/validate_memory.py

Fallback 規則(不報錯、不抱怨、繼續做事)

兩層各自獨立 fallback,任一層不影響另一層:

  • 某一層目錄不存在 → 該層當「沒記憶」,另一層照常讀
  • 某一層 MEMORY.md 不存在或是空的 → 該層當「沒記憶」,另一層照常讀
  • 某一層 index 裡完全沒有跟當前 task 相關的 entry → 該層當「沒記憶」,另一層照常讀
  • 兩層皆無相關記憶才整體當「沒記憶」處理

Read the full file on GitHub · 90 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. 2d ago First seen · 90 lines · 68 tokens per session scan B 182d2125e895

Subscribe to this mod's changes

memory-loading is a skill published in the GitHub repository Lee-W/maigo (14 stars, last pushed 9d ago), licensed MIT. It adds 68 tokens to every session and 1,617 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens

chat-perf

Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.

microsoft/vscode · 51 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens