$npx -y skills add tody-agent/codymaster --skill cm-ux-masterWorking memory protocol — maintains context across sessions via CONTINUITY.md. Inspired by Loki Mode. Read at turn start, update at turn end. Captures mistakes and learnings to prevent repeating errors.
| 1 | # Continuity — Working Memory Protocol |
| 2 | |
| 3 | > **Context persistence across sessions. Mistakes captured. Learnings applied.** |
| 4 | > Inspired by Loki Mode's CONTINUITY.md protocol (Autonomi). |
| 5 | |
| 6 | ## When to Use |
| 7 | |
| 8 | **ALWAYS** — This is a background protocol, not an explicit invocation. |
| 9 | |
| 10 | - **Start of every session:** Read `.cm/CONTINUITY.md` to orient yourself |
| 11 | - **End of every session:** Update `.cm/CONTINUITY.md` with progress |
| 12 | - **On error:** Record in Mistakes & Learnings section |
| 13 | - **On key decision:** Record in Key Decisions section |
| 14 | |
| 15 | ## Setup |
| 16 | |
| 17 | ```bash |
| 18 | # Initialize working memory for current project |
| 19 | cm continuity init |
| 20 | |
| 21 | # Check current state |
| 22 | cm continuity status |
| 23 | |
| 24 | # View captured learnings |
| 25 | cm continuity learnings |
| 26 | ``` |
| 27 | |
| 28 | ## The Protocol |
| 29 | |
| 30 | ### AT THE START OF EVERY SESSION: |
| 31 | |
| 32 | ``` |
| 33 | 1. Read .cm/CONTINUITY.md to understand current state |
| 34 | 2. Read "Mistakes & Learnings" to avoid past errors |
| 35 | 3. Check "Next Actions" to determine what to do |
| 36 | 4. Reference Active Goal throughout your work |
| 37 | ``` |
| 38 | |
| 39 | ### DURING WORK: |
| 40 | |
| 41 | ``` |
| 42 | PRE-ACT ATTENTION CHECK (before every significant action): |
| 43 | - Re-read Active Goal |
| 44 | - Ask: "Does my planned action serve this goal?" |
| 45 | - Ask: "Am I solving the original problem, not a tangent?" |
| 46 | - If DRIFT detected → log it → return to goal |
| 47 | ``` |
| 48 | |
| 49 | ### AT THE END OF EVERY SESSION: |
| 50 | |
| 51 | ``` |
| 52 | 1. Update "Just Completed" with accomplishments |
| 53 | 2. Update "Next Actions" with remaining work |
| 54 | 3. Record any new "Mistakes & Learnings" |
| 55 | 4. Record any "Key Decisions" made |
| 56 | 5. Update "Files Modified" list |
| 57 | 6. Set currentPhase and timestamp |
| 58 | ``` |
| 59 | |
| 60 | ### ON ERROR (Self-Correction Loop): |
| 61 | |
| 62 | ``` |
| 63 | ON_ERROR: |
| 64 | 1. Capture error details (stack trace, context) |
| 65 | 2. Analyze root cause (not just symptoms) |
| 66 | 3. Write learning to CONTINUITY.md "Mistakes & Learnings" |
| 67 | 4. Update approach based on learning |
| 68 | 5. Retry with corrected approach |
| 69 | 6. Max 3 retries per error pattern before ESCALATE |
| 70 | ``` |
| 71 | |
| 72 | ## CONTINUITY.md Template |
| 73 | |
| 74 | ```markdown |
| 75 | # CodyMaster Working Memory |
| 76 | Last Updated: [ISO timestamp] |
| 77 | Current Phase: [planning|executing|testing|deploying|reviewing] |
| 78 | Current Iteration: [number] |
| 79 | Project: [project name] |
| 80 | |
| 81 | ## Active Goal |
| 82 | [What we're currently trying to accomplish — 1-2 sentences max] |
| 83 | |
| 84 | ## Current Task |
| 85 | - ID: [task-id from dashboard] |
| 86 | - Title: [task title] |
| 87 | - Status: [in-progress|blocked|reviewing] |
| 88 | - Skill: [cm-skill being used] |
| 89 | - Started: [timestamp] |
| 90 | |
| 91 | ## Just Completed |
| 92 | - [Most recent accomplishment with file:line references] |
| 93 | - [Previous accomplishment] |
| 94 | - [etc — last 5 items] |
| 95 | |
| 96 | ## Next Actions (Priority Order) |
| 97 | 1. [Immediate next step] |
| 98 | 2. [Following step] |
| 99 | 3. [etc] |
| 100 | |
| 101 | ## Active Blockers |
| 102 | - [Any current blockers or waiting items] |
| 103 | |
| 104 | ## Key Decisions This Session |
| 105 | - [Decision]: [Rationale] — [timestamp] |
| 106 | |
| 107 | ## Mistakes & Learnings |
| 108 | |
| 109 | ### Pattern: Error → Learning → Prevention |
| 110 | - **What Failed:** [Specific error that occurred] |
| 111 | - **Why It Failed:** [Root cause analysis] |
| 112 | - **How to Prevent:** [Concrete action to avoid this in future] |
| 113 | - **Timestamp:** [When learned] |
| 114 | - **Agent:** [Which agent] |
| 115 | - **Task:** [Which task ID] |
| 116 | |
| 117 | ## Working Context |
| 118 | [Critical information for current work — API keys paths, |
| 119 | architecture decisions, patterns being followed] |
| 120 | |
| 121 | ## Files Currently Being Modified |
| 122 | - [file path]: [what we're changing] |
| 123 | ``` |
| 124 | |
| 125 | ## Memory Hierarchy |
| 126 | |
| 127 | The memory systems complement each other: |
| 128 | |
| 129 | ``` |
| 130 | 1. CONTINUITY.md = Working memory (current session state) |
| 131 | 2. learnings.json = Extracted error patterns (persists across sessions) |
| 132 | 3. decisions.json = Architecture decisions (persists across projects) |
| 133 | 4. tasks.md/cm-tasks.json = Task queue + RARV logs (Mode D integration) |
| 134 | ``` |
| 135 | |
| 136 | **CONTINUITY.md is the PRIMARY source of truth for "what am I doing right now?"** |
| 137 | |
| 138 | ## Integration |
| 139 | |
| 140 | | Skill | How it integrates | |
| 141 | |-------|-------------------| |
| 142 | | `cm-execution` | RARV Mode D reads CONTINUITY.md in REASON phase | |
| 143 | | `cm-planning` | Sets Active Goal and Next Actions | |
| 144 | | `cm-debugging` | Records errors in Mistakes & Learnings | |
| 145 | | `cm-quality-gate` | VERIFY phase updates CONTINUITY.md | |
| 146 | | `cm-code-review` | Records review feedback as learnings | |
| 147 | |
| 148 | ## Rules |
| 149 | |
| 150 | ``` |
| 151 | ✅ DO: |
| 152 | - Read CONTINUITY.md at session start (ALWAYS) |
| 153 | - Update CONTINUITY.md at session end (ALWAYS) |
| 154 | - Record EVERY error in Mistakes & Learnings |
| 155 | - Keep "Just Completed" to last 5 items |
| 156 | - Be specific: "Fixed auth bug in login.ts:42" not "Fixed stuff" |
| 157 | |
| 158 | ❌ DON'T: |
| 159 | - Skip reading CONTINUITY.md ("I remember what I was doing") |
| 160 | - Write vague learnings: "It didn't work" → WHY didn't it work? |
| 161 | - Ignore past learnings when they're relevant |
| 162 | - Let CONTINUITY.md grow beyond ~500 words (rotate old entries) |
| 163 | - Delete Mistakes & Learnings (archive to learnings.json instead) |
| 164 | ``` |
| 165 | |
| 166 | ## The Bottom Line |
| 167 | |
| 168 | **Your memory is your superpower. Without it, you repeat every mistake forever.** |