← 返回 Skills 市场
tobiaswestholm

Sync Claude Context - ensure agent files are up to date

作者 Tobasty · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
31
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install sync-claude-context
功能描述
Sync all Claude Code project context at the start of a new session or after significant changes. Use this whenever: starting fresh on a project after a gap,...
使用说明 (SKILL.md)

sync-project-docs

Audits and updates Claude Code's project-level context files. Autonomous for CLAUDE.md, skills, and memory; surfaces settings as suggestions since those require explicit user authorization.


Phase 1 — Orient

If the project uses git:

git log --oneline -20
git status --short

Then git diff HEAD~5 -- \x3Ckey files below> to see recent infrastructure changes.

If no git repo, read the directory structure and key files directly.

Find which of these exist:

Look for Examples
Package/dependency config package.json, pyproject.toml, Cargo.toml, go.mod, pom.xml, requirements.txt, Gemfile
Commands Makefile, justfile, scripts/, package.json scripts, taskfile.yml
Infrastructure docker-compose.yml, fly.toml, render.yaml, Procfile, vercel.json, k8s/
App config config.*, settings.*, config/, application.yml
Env template .env.example, .env.template, .env.sample

Goal: know what work landed, what's in-flight, and which key files changed.


Phase 2 — Audit and update CLAUDE.md

Check for all project-level instruction files:

ls CLAUDE.md .claude/CLAUDE.md CLAUDE.local.md .claude/rules/ 2>/dev/null

If no CLAUDE.md exists: invoke the init skill, then continue.

If CLAUDE.md exists, read it and cross-check each section against the sources from Phase 1:

Commands — compare against the actual command source. Fix changed commands, add useful new ones, remove deleted ones.

Architecture/structure — compare described modules and key files against what exists on disk. Add new additions; remove deleted or renamed things.

Configuration/env vars — compare against actual config files. Add new runtime-relevant settings; remove or correct stale ones.

Constraints and gotchas — check whether any documented constraints have been resolved by recent work.

Env template: verify it lists all vars the config requires. Missing vars here break fresh setups.

@import references: scan for @path/to/file lines and verify each imported file still exists. A missing import silently breaks context loading.

Size: if the file exceeds 200 lines, flag it — beyond that, adherence degrades and context cost rises. Suggest moving detail into .claude/rules/ topic files.

.claude/rules/: if this directory exists, check whether any path-scoped rule files reference commands, module names, or file paths that no longer match the current codebase. Fix or flag stale ones.

CLAUDE.local.md: if this exists, give it the same pass as CLAUDE.md — it's the gitignored personal supplement and can go stale too.

Be surgical: update what's stale, leave accurate content alone. It's read by a future Claude session.


Phase 3 — Audit project skills

ls .claude/skills/ 2>/dev/null

Read each skill. Two categories:

Infrastructure-coupled skills (run, deploy, migrate, CI, integration) reference concrete things — commands, services, ports, env vars, file paths. Cross-check each against Phase 1:

  • Do referenced commands still exist?
  • Do service names, ports, and URLs still match?
  • Do env vars still exist in config?
  • Are file paths and module names still valid?

Fix small divergences directly. For substantial rework of a run/startup skill (new startup sequence, major service changes), ask first:

"The run skill looks significantly out of date. Regenerate from scratch with /run-skill-generator (may lose custom gotchas) or rewrite stale sections manually?"

If no run skill exists and startup is non-trivial: suggest /run-skill-generator if available, or /run as a fallback.

Process/workflow skills (PR templates, commit style): only check if the git log suggests the described process changed; otherwise leave alone.


Phase 4 — Memory

The memory path is derived from the git repo root (or pwd outside a repo):

REPO=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
echo "$HOME/.claude/projects/$(echo "$REPO" | sed 's|/|-|g')/memory/"

If memory exists: invoke consolidate-memory.

If none exists: ask before creating anything —

"No project memory exists yet. Auto-memory is already on, so Claude will build it up over time — but want me to seed it now with key facts from this codebase so your next session starts oriented right away?"

If yes: seed with non-obvious facts a future session would otherwise waste time re-deriving:

  • Surprising constraints (concurrency models, version pins, unexpected defaults)
  • Current in-progress work and why
  • Non-obvious decisions baked into the code

Create MEMORY.md as a concise one-line-per-entry index. Detailed notes go in separate topic files (e.g. architecture.md, constraints.md) — MEMORY.md stays under 200 lines so it fits in the session context window.


Phase 5 — Settings

Check .claude/settings.json for stale hooks referencing scripts or commands that no longer exist.

Identify read-only commands that come up constantly (test runners, linters, health checks, git log, git diff) and would be safe to allow without prompting.

Don't write to settings.json — present them as suggestions. Point to:

  • update-config: to add permissions, env vars, or fix hooks
  • fewer-permission-prompts: to discover permissions from actual transcript history

Phase 6 — Compact

All findings are now on disk. Before wrapping up, handle the context.

Session start: run /compact now — it will incorporate the sync findings into a clean summary. Then stop; skip the Summary section below.

Mid-session: ask first —

"Want me to compact to clear the audit material? It'll summarize and remove the conversation history above this point."

If yes: run /compact and stop — skip the Summary below. If no: continue to the Summary.


Summary

Print only if compact was not run:

## Project sync complete

**CLAUDE.md**: \x3Cwhat changed, or "no changes needed">
**Skills**: \x3Cwhat was updated, or "accurate">
**Memory**: \x3Cconsolidated / seeded / "no changes">
**Settings suggestions**: \x3Csuggested allowances, or "nothing to add">
**Git state**: \x3Cuncommitted files + in-flight work, one sentence>

Run `git diff` to review file changes.
安全使用建议
Install this if you want an agent to audit and refresh Claude project context files. Before running it, be aware it may read broad project structure and update project documentation, skills, and Claude memory; review the resulting git diff, especially if your repository contains private architecture notes or personal local Claude context.
能力评估
Purpose & Capability
The stated purpose is to sync Claude project context, and the instructions align with that purpose: inspect recent git/project changes, update CLAUDE.md and related rules, review project skills, consolidate memory, and suggest settings changes.
Instruction Scope
The trigger language includes broad phrases like "sync" and "catch up," which could activate the workflow more often than intended, but the actions are described openly and remain tied to project-context upkeep.
Install Mechanism
The package contains only a markdown SKILL.md file with no executable install scripts, bundled binaries, dependency installation, or hidden setup behavior.
Credentials
Repository inspection, git commands, config/env-template review, and Claude context file edits are proportionate to auditing stale project context. It does not direct network calls, credential harvesting, destructive operations, or public/account mutations.
Persistence & Privilege
The skill can persist changes to CLAUDE.md, .claude/rules, project skills, and Claude project memory. That persistence is core to the stated purpose, and settings changes are explicitly limited to suggestions rather than automatic writes.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install sync-claude-context
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /sync-claude-context 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release: provides automated synchronization and auditing of Claude Code project context, improving session orientation and minimizing stale documentation. - Audits key project files (config, commands, infra, env templates) for recent and in-progress changes. - Reviews and updates CLAUDE.md and related instruction files, ensuring accuracy of commands, architecture, env vars, and imports. - Checks and refreshes project skills for both infrastructure and workflow, prompting regeneration if major changes are detected. - Consolidates or seeds project memory with critical facts to speed up future sessions. - Surfaces suggestions for updating `.claude/settings.json` based on observed command usage. - Guides context compaction for cleaner session starts and summaries.
元数据
Slug sync-claude-context
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Sync Claude Context - ensure agent files are up to date 是什么?

Sync all Claude Code project context at the start of a new session or after significant changes. Use this whenever: starting fresh on a project after a gap,... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 31 次。

如何安装 Sync Claude Context - ensure agent files are up to date?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install sync-claude-context」即可一键安装,无需额外配置。

Sync Claude Context - ensure agent files are up to date 是免费的吗?

是的,Sync Claude Context - ensure agent files are up to date 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Sync Claude Context - ensure agent files are up to date 支持哪些平台?

Sync Claude Context - ensure agent files are up to date 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Sync Claude Context - ensure agent files are up to date?

由 Tobasty(@tobiaswestholm)开发并维护,当前版本 v1.0.0。

💬 留言讨论