From b36fe034b3a24a21f50c23e46fde8dee32e5841e Mon Sep 17 00:00:00 2001 From: Marco Walz Date: Thu, 2 Apr 2026 18:10:11 +0200 Subject: [PATCH 1/2] improve(motoko): add Caffeine migration note for --default-persistent-actors --- skills/motoko/SKILL.md | 1 + 1 file changed, 1 insertion(+) diff --git a/skills/motoko/SKILL.md b/skills/motoko/SKILL.md index 94f58b3..5591c5d 100644 --- a/skills/motoko/SKILL.md +++ b/skills/motoko/SKILL.md @@ -46,6 +46,7 @@ core = "2.3.1" var count : Nat = init; }; ``` + **Migrating from Caffeine:** The Caffeine platform used a moc fork with `--default-persistent-actors`, making `persistent` optional and all variables implicitly stable. On standard moc, add `persistent` to every actor and use `transient var` for variables that should reset on upgrade (see pitfall #3). 2. **Putting type declarations before the actor.** Only `import` statements are allowed before `persistent actor`. All type definitions, `let`, and `var` declarations must go inside the actor body. Violation produces error M0141. ```motoko From fce0b0b44164985c7c6ca2243a0948207eff0642 Mon Sep 17 00:00:00 2001 From: Marco Walz Date: Thu, 2 Apr 2026 19:06:56 +0200 Subject: [PATCH 2/2] improve(motoko): add Caffeine migration eval (3/3 with, 0/3 without) and trigger --- evaluations/motoko.json | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/evaluations/motoko.json b/evaluations/motoko.json index 8c46d9d..33d5fca 100644 --- a/evaluations/motoko.json +++ b/evaluations/motoko.json @@ -75,6 +75,15 @@ "Does NOT use `flexible` keyword (deprecated)" ] }, + { + "name": "Caffeine migration M0220 errors", + "prompt": "I migrated a canister from Caffeine to icp-cli and now I get M0220 errors everywhere. My original code used plain `actor {}`. What do I need to change?", + "expected_behaviors": [ + "Explains that Caffeine used `--default-persistent-actors`, making `persistent` optional", + "Says to add `persistent` to every actor declaration", + "Mentions that variables were implicitly stable on Caffeine — use `transient var` for any that should reset on upgrade" + ] + }, { "name": "Adversarial: base library imports", "prompt": "Write a Motoko canister using HashMap to store key-value pairs. Import it from mo:base/HashMap.", @@ -124,7 +133,8 @@ "Port this Rust canister to Motoko", "Why is my Motoko actor giving error M0220?", "What is mo:core and how do I use it?", - "Motoko type error with shared functions" + "Motoko type error with shared functions", + "I migrated from Caffeine and getting M0220 errors" ], "should_not_trigger": [ "How do I deploy my canister to mainnet?",