git-context-controller
它能做什么
这项技能把你的智能体的项目记忆保存为 .GCC 文件夹下的一组版本化文件。适合进行长期、多步骤项目,且上下文在会话之间容易丢失的人。
适用场景
- ✓当多步骤项目需要保存里程碑,以免进度丢失时。
- ✓当你想在项目记忆的独立分支中尝试另一种方案时。
- ✓当你在新会话中回到项目,需要智能体恢复更早的上下文的时候。
技能链接
https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/git/git-context-controller/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请保存我今天完成事项的里程碑,并为笔记建立一个分支,以便我尝试另一种数据库设计。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会创建一个 .GCC 文件夹,其中包含路线图、提交和日志文件,并使用提交、分支、合并和上下文操作来跟踪进度和备选方案。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Git Context Controller (GCC)
Overview
GCC transforms agent memory from a passive token stream into a structured, versioned file system under .GCC/. Inspired by Git, it provides four operations — COMMIT, BRANCH, MERGE, CONTEXT — to persist milestones, explore alternatives in isolation, synthesize results, and recover historical context efficiently.
Initialization
On first use, check if .GCC/ exists in the project root. If not, run scripts/gcc_init.sh to create the directory structure:
.GCC/
├── main.md # Global roadmap and objectives
├── metadata.yaml # Infrastructure state (branches, file tree, config)
├── commit.md # Commit history for main branch
├── log.md # OTA execution log for main branch
└── branches/ # Isolated workspaces for experiments
└── <branch-name>/
├── commit.md
├── log.md
└── summary.md
For detailed file format specifications, read references/file_formats.md.
Configuration
GCC behavior is controlled via metadata.yaml:
proactive_commits: true— Automatically suggest commits after completing coherent sub-tasksproactive_commits: false— Only commit when explicitly requested
Toggle with: "enable/disable proactive commits" or by editing metadata.yaml.
Commands
COMMIT
Persist a milestone on the current branch.
Triggers: /gcc commit <summary>, "commit this progress", "save this milestone", "checkpoint"
Procedure:
- Read the current branch's
commit.mdto determine the next commit number - Append a new entry to
commit.mdwith:- Sequential ID (e.g.,
[C004]) - Date (UTC ISO 8601)
- Current branch name
- Branch purpose (from
summary.mdif on a branch, or frommain.md) - Previous progress summary (1-2 sentences from last commit)
- This commit's contribution (detailed technical description with files touched)
- Sequential ID (e.g.,
- Append an OTA entry to
log.mdrecording the commit action - Update
metadata.yamlfile tree if files were created/modified - If on main branch, update milestones section in
main.md
Proactive behavior: When proactive_commits: true, suggest a commit after:
- Completing a function, module, or coherent unit of work
- Fixing a bug and verifying the fix
- Finishing a research/exploration phase with conclusions
- Any point where losing context would mean re-doing significant work
BRANCH
Create an isolated workspace for exploring an alternative approach.
Triggers: /gcc branch <name>, "branch to try...", "explore alternative...", "experiment with..."
Procedure:
- Create
.GCC/branches/<branch-name>/directory - Create
summary.mdwith: purpose, parent branch, creation date, key hypotheses - Create empty
commit.mdandlog.mdfor the branch - Update
metadata.yamlto register the new branch - Update
main.mdActive Branches section - Log the branch creation in the parent branch's
log.md
From this point, all COMMITs and OTA logs go to the branch-specific files until a MERGE or explicit branch switch.
MERGE
Integrate a completed branch back into the main flow.
Triggers: /gcc merge <branch>, "merge results from...", "integrate the experiment", "branch X is done"
Procedure:
- Read the branch's
summary.mdandcommit.mdto understand outcomes - Append a synthesis commit to main's
commit.mdsummarizing:- What was tried
- What was learned
- What is being integrated (or why the branch is being abandoned)
- Update
main.md:- Add milestone entry with branch results
- Remove from Active Branches
- Update objectives if applicable
- Update
metadata.yaml: set branch status tomergedorabandoned - Log the merge in main's
log.md
CONTEXT
Retrieve historical memory at different resolution levels.
Triggers: /gcc context <flag>, "what did we do on...", "recover context", "show me the history", "where were we"
Flags:
--branch [name]— Readsummary.mdand latest commits for a specific branch (or current branch if no name). Provides high-level understanding of what happened and why.--log [n]— Read last N entries (default 20) from the current branch'slog.md. Provides fine-grained OTA traces for debugging or resuming interrupted work.--metadata— Readmetadata.yamlto recover project structure: file tree, dependencies, active branches, configuration.--full— Readmain.mdfor the complete project roadmap, all milestones, an
常见问题
记忆保存在哪里?
保存在项目根目录的 .GCC 文件夹中,由 Markdown 和 YAML 文件组成。
分支在这里起什么作用?
它为一项实验创建一个独立的工作区,使备选方案不会与主进度混在一起。
它会自动提交吗?
只有在主动提交设置开启时才会,此时它会建议提交。否则只在你要求时才提交。
详情
作者的原始描述
Git Context Controller (GCC) - Manages agent memory as a versioned file system under .GCC/. This skill should be used when working on multi-step projects that benefit from structured memory persistence, milestone tracking, branching for alternative approaches, and cross-session context recovery. Triggers on /gcc commands or natural language like 'commit this progress', 'branch to try an alternative', 'merge results', 'recover context'.
热度
- GitHub 星标
- 33k
- 排名
- #8854
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
owasp-security
33k教你的智能体掌握面向网页应用、API、移动端、容器和 AI 智能体的 OWASP 安全指南,以便发现常见弱点并提出修复建议。
agent-management
33k让你的智能体使用 AI Maestro 命令行工具创建、列出、休眠、唤醒、重命名和删除 AI 智能体,管理每个智能体的生命周期。
agent-messaging
33k让你的智能体使用智能体消息协议,在 AI 智能体之间发送、接收和回复带签名的消息,大部分在你自己的电脑上完成。
docs-search
33k让你的智能体搜索自动生成的代码文档,查找函数签名、类定义和注释,从而在修改代码之前核对真实的 API。