context-sync

Rules for keeping project context in sync, including decisions, known problems, interface notes, and progress across coding sessions or devices.

In plain words
What is it for?
Use it to record architecture decisions, bugs and their fixes, API behavior, completed tasks, and to restore project notes on another session or device.
Why use it?
They reduce the need to rediscover past decisions and pitfalls when work resumes. Context can be initialized, saved to a remote location, or loaded later with the specified commands.

Cursor rule

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 rules/1echa/context-sync-mcp/context-sync
Clone the repo
git clone --depth 1 https://github.com/1EchA/context-sync-mcp
Per session 725 This file is loaded in full into every session.
When invoked 725 The same file — it is already loaded in full.
Security scan A 0 findings. 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.00725 $0.00725
Opus 5 $0.00362 $0.00362
Sonnet 5 $0.00145 $0.00145
Haiku 4.5 $0.00072 $0.00072

Measured yesterday against content hash 9c9ea711438f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

context-sync scanned grade A with 0 findings 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 yesterday.

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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

rules/context-sync.mdc · 57 lines

What it actually says

上下文记忆规则(Context Sync MCP)

实时记录(自动,无需用户触发)

发现以下信息时,调用 write_context 工具批量写入:

  1. 避雷点/踩坑file:"gotchas", action:"append"

    • 必须包含:现象、原因、解决方案、影响文件
    • 写入后告知用户:"⚠️ 已记录避雷点:[标题]"
  2. 架构决策file:"architecture", action:"append"

    • 必须包含:决策、原因、权衡
    • 写入后告知用户:"📐 已记录架构决策:[决策]"
  3. 接口行为/限制file:"api_notes", action:"append"

    • 包含:接口路径、行为特征、限制条件
  4. 完成待办项file:"progress", action:"overwrite"

    • 更新完整的待办清单状态
  5. 如果新记录与已有记录有关联,在 related_to 中标注(如 ["ADR-1", "踩坑#2"]

可以在一次 write_context 调用中批量写入多个文件,减少工具调用次数。

/sync-init(用户手动,首次初始化)

当用户输入 /sync-init、“初始化上下文同步”、“初始化这个仓库的 context sync” 时:

  1. 调用 sync_init 工具建立初始 progresssummary
  2. 如果项目已有 .context/,不要覆盖,提示用户改用 /sync-load
  3. 初始化完成后,告知用户后续使用 /sync-save 保存增量、/sync-load 恢复上下文

/sync-save(用户手动,推送到远程)

当用户输入 /sync-savesync push、“保存上下文”、"上传上下文" 时:

  1. 确保 progress 和 summary 是最新的(如有需要先 write_context)
  2. 调用 sync_push 工具推送到远程
  3. 告知用户推送结果

/sync-load(用户手动,从远程拉取)

当用户输入 /sync-loadsync pull、“拉取上下文”、"恢复上下文"、"新设备恢复上下文" 时:

  1. 调用 sync_load 工具获取上下文
  2. 如返回引导信息,展示引导步骤
  3. 成功后重点关注:gotchas(避免踩坑)和 progress(继续进度)
  4. 向用户汇报恢复的上下文,询问继续哪个任务

命名约束

  • sync_push / sync_load 是 MCP 内部工具名,不是给用户看的 slash 命令
  • 面向用户时,推送统一说 /sync-save
  • 面向用户时,拉取统一说 /sync-load;其中 sync pull 视为 /sync-load 的自然语言别名

主动提醒

  • 完成大任务后提醒:"如果要切换设备,可以 /sync-save 推送上下文"
  • 本地有多条未推送记录时提醒用户
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. yesterday First seen · 57 lines · 725 tokens per session scan A 9c9ea711438f

Subscribe to this mod's changes

context-sync is a cursor rule published in the GitHub repository 1EchA/context-sync-mcp (20 stars, last pushed 5mo ago), licensed MIT. It adds 725 tokens to every session, about $0.0036 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.