Mastering `cm-continuity`: The Complete Guide

Hướng dẫn chi tiết về Mastering `cm-continuity`: The Complete Guide trong Vibe Coding dành cho None.

Skills used: cm-continuity

Mastering cm-continuity: The Complete Guide

In the high-velocity world of Vibe Coding, there is a silent killer of productivity that every developer has encountered at least once: The Goldfish Memory Effect.

You know the feeling. You’ve spent the last three hours orchestrating a complex refactor of an Astro-based ecommerce engine. You’ve navigated the nuances of Cloudflare Workers, fine-tuned the wrangler.toml configurations, and finally solved that nagging i18n routing bug. You’re in the “vibe.” But then, the session hits a token limit, the IDE restarts, or you simply have to close your laptop for a meeting.

When you return and issue the next command, the AI agent greets you with a cheerful, “Hello! How can I help you today?” and proceeds to suggest the exact same implementation that you just spent two hours proving was incompatible with your stack.

The “vibe” is dead. You are no longer a high-level architect; you are a babysitter, repeating instructions and manually restoring context that should have been permanent.

This is where cm-continuity changes the game. It is not just a tool; it is a Working Memory Protocol designed to bridge the gap between ephemeral AI sessions and long-term project success. In this guide, we will dive deep into how to master this skill to ensure your AI partner never forgets a mistake, a constraint, or a hard-won victory.


Core Concepts: How cm-continuity Actually Works

Most developers rely on the “Context Window” of an LLM. While context windows are growing, they are still essentially a “First-In, First-Out” (FIFO) buffer. As the conversation gets longer, the oldest (and often most foundational) instructions are the first to be pruned or “lost in the middle.”

cm-continuity solves this by moving the project’s “Working Memory” out of the volatile chat history and into a persistent, project-resident file: CONTINUITY.md.

The Three Pillars of Continuity

  1. Stateful Orchestration: Unlike standard chat logs, CONTINUITY.md is a living document. It doesn’t just record what happened; it records the current state of the project’s logic. It identifies what we are doing, why we are doing it, and what we must never do again.
  2. The Turn-Based Cycle: The protocol operates on a strict “Read-at-Start, Update-at-End” lifecycle. At the beginning of every turn, the agent is mandated to read the continuity file. This acts as an instant “brain transplant,” giving a fresh AI model the full weight of the project’s history. At the end of the turn, the agent summarizes the session’s findings, updating the file before the context is lost.
  3. Epistemic Pruning: A raw log is noisy. cm-continuity focuses on high-signal information. It filters out the “How are yous” and “I will now runs” to focus on architectural decisions, configuration “gotchas,” and terminal error patterns.

The Anatomy of a CONTINUITY.md File

To master this skill, you need to understand the structure that makes it effective. A well-maintained CONTINUITY.md file typically contains five mission-critical sections:

1. Active Objectives & Progress

This section lists the high-level goals and the atomic sub-tasks currently in flight. It answers the question: “Where did we leave off?”

  • Example: “Implementing dynamic SEO metadata for Astro collection pages. Currently stuck on OG:Image generation in the SSR environment.”

2. Verified Constraints

The “Physics” of your specific project. These are things the AI might try to “help” with but would actually break the build.

  • Example: “Do NOT use fs modules in /src/pages/api/. This project runs on Cloudflare Pages (Edge Runtime). Only use fetch and Standard Web APIs.”

3. Recent Learnings & Discoveries

The most valuable part of the file. Every time a command fails and a fix is found, it goes here.

  • Example: “Found that astro:content requires a manual npx astro sync after updating config.ts if the dev server is running in a background process.”

4. Mistakes to Avoid (The “Blacklist”)

A list of failed paths. This prevents the AI from suggesting the same wrong solution twice.

  • Example: “Tried using @astrojs/node for SSR; it conflicts with the existing wrangler.toml setup. Stick to @astrojs/cloudflare.”

5. Next Immediate Actions

The “Next Action” in GTD terms. This is the first thing the agent should do when the session resumes.

  • Example: “Next: Update src/layouts/Layout.astro to accept the new seoProps object.”

Practical Example: Rescuing a Failing i18n Migration

Let’s look at a real-world scenario. You are working on the Cody_Master_Web project (the very one we see in our workspace). You are trying to refactor the language switcher logic in scripts/refactor-lang-switcher.js.

The Session Crash

You’ve spent 40 minutes debugging why the i18n parity check fails. You discovered that src/consts.ts has a hardcoded locale list that isn’t syncing with the JSON files in public/i18n/. You’re right on the edge of a fix, and suddenly… Token Limit Exceeded.

The Continuity Recovery

If you were using cm-continuity, the agent would have updated the file just before the crash (or you would have prompted it to do so). When you start the next session, here is what the agent sees in CONTINUITY.md:

# Project Continuity: Cody_Master_Web

## Recent Mistake
Tried to sync locales by reading the filesystem directly. 
**Problem:** The Astro build environment doesn't allow direct FS access for client-side components.
**Fix:** We must use the `src/consts.ts` as the single source of truth and generate the JSON from there.

## Current Goal
Sync `public/i18n/` parity with `src/consts.ts`.

## Next Step
Modify `scripts/sync-i18n-parity-strict.js` to import `SUPPORTED_LOCALES` from `src/consts.ts` instead of hardcoding the array.

The new AI agent reads this and instantly knows that it shouldn’t try to use fs.readdirSync on the client, and it knows exactly which file to edit. You’ve saved 20 minutes of re-explanation.


Best Practices for Mastery

To get the most out of cm-continuity, follow these professional standards:

1. The “Audit” Turn

Every 10-15 tool calls, ask the agent: “Update the continuity file with our latest findings.” Don’t wait for the session to end. In Vibe Coding, things move fast. Constant checkpoints are your safety net.

2. Be Brutally Honest about Mistakes

The AI’s greatest weakness is its desire to be “right.” Force it to record its failures. If an agent suggests a command that returns a 127 Command Not Found, that is a learning. Record it: “Note: npm run lint is actually mapped to npm run audit-i18n in this project.”

3. Version Control the Continuity

Do not .gitignore your CONTINUITY.md. It is as important as your package.json. By committing it to Git, you allow other human collaborators (or other AI agents on different machines) to sync their “Working Memory” with yours. It becomes the ultimate “Project Onboarding” document.

cm-continuity is the partner to cm-planning. While the plan is the map (where we want to go), the continuity is the journal (what actually happened on the trail). Use the continuity file to mark off tasks in your PLAN.md as “Verified” or “Blocked.”


Why This Solves the “Vibe Coding” Problem

“Vibe Coding” is about the seamless flow between human intent and machine execution. That flow depends entirely on shared context.

In traditional development, shared context is built over months of meetings and documentation. In Vibe Coding, we don’t have months; we have milliseconds. If the AI “loses the vibe,” the human has to step in and do the manual labor of context-setting, which defeats the purpose of autonomous agents.

cm-continuity acts as the “Save Game” button for your coding sessions. It ensures that the progress you make is cumulative, not circular. It transforms the AI from a stateless function into a stateful partner.

The “Loki Mode” Connection

In the skill description, cm-continuity is noted as being “Inspired by Loki Mode.” Loki Mode is a philosophy of autonomous agents where the agent is allowed to fail, learn, and self-correct without human intervention. By maintaining a continuity file, the agent can “reflect” on its own history. It can see its previous attempt to edit wrangler.toml failed because of a syntax error, and it can try a different approach in the next turn without you ever having to point out the error.


Conclusion: Stop Babysitting, Start Architecting

Mastering cm-continuity is the difference between a developer who struggles with “AI hallucinations” and a Vibe Coder who delivers production-grade software at 10x speed.

By treating CONTINUITY.md as a first-class citizen in your workspace, you are building a Project Brain that grows smarter with every session. You are creating a repository of institutional knowledge that persists across tool restarts, model upgrades, and coffee breaks.

The next time you start a complex task, don’t just dive in. Activate cm-continuity. Tell your agent: “We are starting a mission. Read the continuity, and from this point on, every mistake we make must be recorded so we never make it again.”

That is how you maintain the vibe. That is how you master the craft.


Actionable Step: Check your root directory now. If you don’t see a CONTINUITY.md (or a docs/skills/cm-continuity.md reference), create one. Start by listing the top three constraints of your current project. You’ll thank yourself in the next session.