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
累計下載
4066
星標
3
全站排名
#2,494
全站前 50% · 「開發程式設計」前 56%
平台累計安裝累計下載星標評論
ClawHub ↗12637543-
SkillHub ↗20540663—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

機制是 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 資訊

月度資料趨勢

累計下載4066
2784347341612026-03 · 累計下載 28792026-05 · 累計下載 32232026-06 · 累計下載 33482026-07 · 累計下載 36232026-08 · 累計下載 37602026-09 · 累計下載 406626-0326-09
星標3
2342026-03 · 星標 32026-05 · 星標 32026-06 · 星標 32026-07 · 星標 32026-08 · 星標 32026-09 · 星標 326-0326-09

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。

月份累計下載環比星標
2026-094066—3
2026-083760+3.8%3
2026-073623+8.2%3
2026-063348+3.9%3
2026-053223—3
2026-032879—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),按月更新。口徑說明見資料方法。