Joseph Sagiv

Project Context Sync

开发编程v1.0.0
作者:Joseph Sagiv更新于 2026-05-11project-context-sync@clawhub_joe3112/project-context-sync
脚本工具Git 辅助#Sync#Document

据 AlphaMoat 统计,截至 2026-09,Project Context Sync 累计下载 4,066 次、获 3 个星标,在全部 5,078 个 AI 技能中排名第 2,494 位,在「开发编程」分类(577 个)中排名第 321 位。

累计安装
205
累计下载
4,066
星标
3
全站排名
#2,494
全站前 50% · 「开发编程」前 56%
平台累计安装累计下载星标评论
ClawHub ↗1263,7543-
SkillHub ↗2054,0663—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

机制是 Git 提交 → post-commit 钩子 → 自动更新仓库根目录的 PROJECT_STATE.md:钩子收集最近提交、历史、分支与变更文件,可选调用 LLM 生成智能摘要,再写入文档。安装用 scripts/install.sh(或 project-context-sync install),会安装 .git/hooks/ 下的 post-commit 钩子、创建默认配置 .project-context.yml、生成初始 PROJECT_STATE.md 并将其加入 .gitignore;卸载与免提交手动更新各有对应脚本。配置项含 ai_summary(默认 true)、recent_commits(默认 5 条)、include_diff_stats 与章节选择(last_commit、recent_changes、current_focus、suggested_next,后两者由 AI 生成)。AI 模式走 Clawdbot 的 OpenAI 兼容端点 /v1/chat/completions,出于安全默认关闭,需在 ~/.clawdbot/clawdbot.json 开启;端点继承网关鉴权(Bearer token),默认 bind: loopback 仅本机可连,脚本自动读取 token。输出含最近提交(哈希/信息/分支/时间/变更文件数)、近期变更、当前焦点与建议下一步;PROJECT_STATE.md 默认被 gitignore 本地再生成,Clawdbot 未运行时回退为原始 git 信息模式。该技能以 MIT 许可发布。

资料发布于 2026-10-27

可以用来做什么

  • 让每次提交后自动沉淀项目状态文档
  • 给下一个会话或智能体提供项目现状上下文
  • 免提交手动刷新项目状态

什么时候用

  • 希望在 Git 仓库里维护一份常驻的项目状态文档供智能体读取时

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

给这个仓库装上提交后自动更新状态的钩子
手动刷新一下 PROJECT_STATE.md
把 AI 摘要关掉只记原始 git 信息

月度数据趋势

累计下载4,066
2,7843,4734,1612026-03 · 累计下载 2,8792026-05 · 累计下载 3,2232026-06 · 累计下载 3,3482026-07 · 累计下载 3,6232026-08 · 累计下载 3,7602026-09 · 累计下载 4,06626-0326-09
星标3
2342026-03 · 星标 32026-05 · 星标 32026-06 · 星标 32026-07 · 星标 32026-08 · 星标 32026-09 · 星标 326-0326-09

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-094,066—3
2026-083,760+3.8%3
2026-073,623+8.2%3
2026-063,348+3.9%3
2026-053,223—3
2026-032,879—3

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

3.7 KB · ClawHub v1.0.0
# project-context-sync

Keep a living project state document updated after each commit, so any agent (or future session) can instantly understand where things stand.

## What It Does

```
┌─────────────┐     ┌──────────────────┐     ┌─────────────────────┐
│ Git Commit  │ ──▶ │ Post-commit Hook │ ──▶ │ PROJECT_STATE.md    │
│             │     │                  │     │ (auto-updated)      │
展开全部(共 146 行)
└─────────────┘     └──────────────────┘     └─────────────────────┘
```

After each commit, the hook:
1. Gathers git info (last commit, recent history, branch, changed files)
2. Optionally calls an LLM to generate a smart summary
3. Updates `PROJECT_STATE.md` in the repo root

## Installation

```bash
# From the repo you want to enable:
cd /path/to/your/repo
/path/to/skills/project-context-sync/scripts/install.sh
```

Or if you have the skill in your path:
```bash
project-context-sync install
```

This will:
1. Install a post-commit hook in `.git/hooks/`
2. Create `.project-context.yml` with default config
3. Create initial `PROJECT_STATE.md`
4. Add `PROJECT_STATE.md` to `.gitignore`

## Uninstall

```bash
cd /path/to/your/repo
/path/to/skills/project-context-sync/scripts/uninstall.sh
```

## Manual Update

Trigger an update without committing:

```bash
cd /path/to/your/repo
/path/to/skills/project-context-sync/scripts/update-context.sh
```

## Configuration

Edit `.project-context.yml` in your repo root:

```yaml
project_context:
  # Use AI to generate smart summaries (default: true)
  ai_summary: true
  
  # How many recent commits to include
  recent_commits: 5
  
  # Include diff stats in context
  include_diff_stats: true
  
  # Sections to include
  sections:
    - last_commit
    - recent_changes
    - current_focus    # AI-generated
    - suggested_next   # AI-generated
```

### AI Summary Mode

**With `ai_summary: true`** (default):
- Generates intelligent summaries of what changed
- Infers current focus from recent commit patterns
- Suggests next steps
- Costs tokens but provides rich context
- **Requires:** Gateway HTTP API enabled (see below)

**With `ai_summary: false`**:
- Just logs raw git info
- Fast and free
- Less intelligent but still useful

### Enabling the Gateway HTTP API

AI mode uses Clawdbot's OpenAI-compatible endpoint (`/v1/chat/completions`). This is **disabled by default** for security. To enable:

```json5
// ~/.clawdbot/clawdbot.json
{
  "gateway": {
    "http": {
      "endpoints": {
        "chatCompletions": { "enabled": true }
      }
    }
  }
}
```

**Security notes:**
- The endpoint inherits gateway auth (requires bearer token)
- With `bind: "loopback"` (default), only local processes can connect
- The script reads the token from `~/.clawdbot/clawdbot.json` automatically
- Risk is minimal for local development setups

## Output

`PROJECT_STATE.md` will contain:

```markdown
# Project State
*Auto-updated by project-context-sync*

## Last Commit
- **Hash:** abc123
- **Message:** Implement isPro check for app blocking
- **Branch:** feature/subscription-gating
- **When:** 2026-01-29 12:34
- **Files changed:** 3

## Recent Changes
- abc123: Implement isPro check for app blocking
- def456: Add PaywallPrompt component
- ...

## Current Focus
[AI-generated summary of what's being worked on]

## Suggested Next Steps
[AI-suggested based on commit patterns]
```

## Notes

- `PROJECT_STATE.md` is gitignored by default (regenerated locally)
- The hook requires Clawdbot to be running for AI summaries
- Without Clawdbot, falls back to raw git info mode

「开发编程」分类下的热门技能

数据月份:2026-09 · 下载/星标/安装数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。