|
| 1 | +# Git Context Controller (GCC) |
| 2 | + |
| 3 | +**Structured context management framework for LLM agents.** |
| 4 | + |
| 5 | +GCC implements Git-like operations (COMMIT, BRANCH, MERGE, CONTEXT) to manage long-horizon agent memory as a persistent, versioned file system. |
| 6 | + |
| 7 | +> Based on the research paper: [Git Context Controller](https://arxiv.org/abs/2508.00031) |
| 8 | +
|
| 9 | +--- |
| 10 | + |
| 11 | +## Why GCC? |
| 12 | + |
| 13 | +LLM agents lose context as conversations grow. Critical decisions, technical reasoning, and intermediate results vanish behind token limits. GCC solves this by giving agents a structured memory system: |
| 14 | + |
| 15 | +- **No more lost context** -- milestones are persisted with full technical reasoning |
| 16 | +- **Safe experimentation** -- branches isolate alternative approaches without polluting the main flow |
| 17 | +- **Cross-session continuity** -- agents recover exactly where they left off |
| 18 | +- **Multi-agent handoff** -- one agent's work is readable by another |
| 19 | + |
| 20 | +## How It Works |
| 21 | + |
| 22 | +``` |
| 23 | + ┌─────────────────────────────────┐ |
| 24 | + │ .GCC/ │ |
| 25 | + │ │ |
| 26 | + │ main.md (roadmap) │ |
| 27 | + │ metadata.yaml (state) │ |
| 28 | + │ commit.md (history) │ |
| 29 | + │ log.md (OTA traces) │ |
| 30 | + │ │ |
| 31 | + │ branches/ │ |
| 32 | + │ ├── feature-x/ │ |
| 33 | + │ │ ├── summary.md │ |
| 34 | + │ │ ├── commit.md │ |
| 35 | + │ │ └── log.md │ |
| 36 | + │ └── experiment-y/ │ |
| 37 | + │ ├── summary.md │ |
| 38 | + │ ├── commit.md │ |
| 39 | + │ └── log.md │ |
| 40 | + └─────────────────────────────────┘ |
| 41 | +``` |
| 42 | + |
| 43 | +### The OTA Cycle |
| 44 | + |
| 45 | +Agents operate through **Observation-Thought-Action** cycles, logged in real time: |
| 46 | + |
| 47 | +``` |
| 48 | +┌───────────┐ ┌───────────┐ ┌───────────┐ |
| 49 | +│ OBSERVE │────>│ THINK │────>│ ACT │ |
| 50 | +│ │ │ │ │ │ |
| 51 | +│ Read logs │ │ Analyze │ │ Execute │ |
| 52 | +│ Check │ │ Decide │ │ COMMIT │ |
| 53 | +│ state │ │ strategy │ │ BRANCH │ |
| 54 | +└───────────┘ └───────────┘ │ MERGE │ |
| 55 | + ^ └─────┬─────┘ |
| 56 | + │ │ |
| 57 | + └───────────────────────────────────┘ |
| 58 | + Logged to log.md |
| 59 | +``` |
| 60 | + |
| 61 | +### Command Flow |
| 62 | + |
| 63 | +``` |
| 64 | + User works on task |
| 65 | + │ |
| 66 | + ▼ |
| 67 | + ┌──────────────┐ milestone? ┌──────────┐ |
| 68 | + │ OTA Cycle │────────────────> │ COMMIT │──> commit.md |
| 69 | + │ (ongoing) │ └──────────┘ |
| 70 | + └──────┬───────┘ |
| 71 | + │ |
| 72 | + │ need alternative? |
| 73 | + ▼ |
| 74 | + ┌──────────────┐ ┌──────────┐ |
| 75 | + │ BRANCH │────────────────> │ Isolated │──> branches/<name>/ |
| 76 | + │ │ │ workspace│ |
| 77 | + └──────────────┘ └────┬─────┘ |
| 78 | + │ |
| 79 | + validated? |
| 80 | + │ |
| 81 | + ▼ |
| 82 | + ┌──────────┐ |
| 83 | + │ MERGE │──> main.md updated |
| 84 | + └──────────┘ |
| 85 | +
|
| 86 | + ┌──────────────┐ |
| 87 | + │ CONTEXT │──> Retrieve memory at any resolution |
| 88 | + │ --branch │ (summary, traces, metadata, full) |
| 89 | + │ --log │ |
| 90 | + │ --metadata │ |
| 91 | + │ --full │ |
| 92 | + └──────────────┘ |
| 93 | +``` |
| 94 | + |
| 95 | +## Installation |
| 96 | + |
| 97 | +### As a Claude Code Skill |
| 98 | + |
| 99 | +```bash |
| 100 | +# Via skills.sh |
| 101 | +npx skills add <owner>/git-context-controller |
| 102 | + |
| 103 | +# Manual installation |
| 104 | +# Copy the skill to your project's .claude/skills/ directory |
| 105 | +cp -r gcc/ your-project/.claude/skills/gcc/ |
| 106 | +``` |
| 107 | + |
| 108 | +### Standalone |
| 109 | + |
| 110 | +```bash |
| 111 | +# Clone the repository |
| 112 | +git clone https://github.com/<owner>/git-context-controller.git |
| 113 | + |
| 114 | +# Initialize GCC in your project |
| 115 | +./scripts/gcc_init.sh /path/to/your/project/.GCC |
| 116 | +``` |
| 117 | + |
| 118 | +## Quick Start |
| 119 | + |
| 120 | +Once installed, GCC activates automatically. Use commands or natural language: |
| 121 | + |
| 122 | +| Action | Command | Natural Language | |
| 123 | +|---|---|---| |
| 124 | +| Save progress | `/gcc commit` | "save this milestone" | |
| 125 | +| Try alternative | `/gcc branch experiment` | "branch to try a different approach" | |
| 126 | +| Integrate results | `/gcc merge experiment` | "merge the experiment results" | |
| 127 | +| Recover context | `/gcc context --full` | "where were we?" | |
| 128 | +| View recent work | `/gcc context --log` | "show recent activity" | |
| 129 | +| Check structure | `/gcc context --metadata` | "what files do we have?" | |
| 130 | + |
| 131 | +## Commands Reference |
| 132 | + |
| 133 | +### COMMIT |
| 134 | + |
| 135 | +Persists a milestone with full technical context. |
| 136 | + |
| 137 | +``` |
| 138 | +/gcc commit <summary> |
| 139 | +``` |
| 140 | + |
| 141 | +Each commit captures: |
| 142 | +- Sequential ID and timestamp |
| 143 | +- Branch context and purpose |
| 144 | +- Previous progress summary |
| 145 | +- Detailed technical contribution |
| 146 | +- Files touched |
| 147 | + |
| 148 | +### BRANCH |
| 149 | + |
| 150 | +Creates an isolated workspace for experimentation. |
| 151 | + |
| 152 | +``` |
| 153 | +/gcc branch <name> |
| 154 | +``` |
| 155 | + |
| 156 | +Creates a new directory under `.GCC/branches/<name>/` with its own commit history, OTA log, and summary. |
| 157 | + |
| 158 | +### MERGE |
| 159 | + |
| 160 | +Synthesizes a completed branch back into the main flow. |
| 161 | + |
| 162 | +``` |
| 163 | +/gcc merge <branch-name> |
| 164 | +``` |
| 165 | + |
| 166 | +Updates `main.md` with results, marks the branch as merged or abandoned, and creates a synthesis commit. |
| 167 | + |
| 168 | +### CONTEXT |
| 169 | + |
| 170 | +Retrieves historical memory at different resolution levels. |
| 171 | + |
| 172 | +``` |
| 173 | +/gcc context [--branch [name] | --log [n] | --metadata | --full] |
| 174 | +``` |
| 175 | + |
| 176 | +| Flag | Returns | Use Case | |
| 177 | +|---|---|---| |
| 178 | +| `--branch` | Branch summary + recent commits | Understand what happened on a branch | |
| 179 | +| `--log [n]` | Last N OTA entries (default: 20) | Debug or resume interrupted work | |
| 180 | +| `--metadata` | Project structure, dependencies | Recover file tree and config | |
| 181 | +| `--full` | Complete roadmap from main.md | Cross-session recovery or agent handoff | |
| 182 | + |
| 183 | +## File Formats |
| 184 | + |
| 185 | +### main.md |
| 186 | + |
| 187 | +Global roadmap with objectives, milestones, and active branches. |
| 188 | + |
| 189 | +### commit.md |
| 190 | + |
| 191 | +Structured commit entries with branch purpose, previous progress, and detailed contribution. |
| 192 | + |
| 193 | +### log.md |
| 194 | + |
| 195 | +Sequential OTA (Observation-Thought-Action) trace entries. Capped at 50 entries. |
| 196 | + |
| 197 | +### metadata.yaml |
| 198 | + |
| 199 | +Infrastructure state: branch registry, file tree, dependencies, configuration. |
| 200 | + |
| 201 | +See [`references/file_formats.md`](references/file_formats.md) for complete format specifications with examples. |
| 202 | + |
| 203 | +## Configuration |
| 204 | + |
| 205 | +GCC behavior is controlled via `metadata.yaml`: |
| 206 | + |
| 207 | +```yaml |
| 208 | +proactive_commits: true # Auto-suggest commits after milestones |
| 209 | +proactive_commits: false # Only commit when explicitly requested |
| 210 | +``` |
| 211 | +
|
| 212 | +Toggle with natural language: "enable/disable proactive commits" |
| 213 | +
|
| 214 | +## Project Structure |
| 215 | +
|
| 216 | +``` |
| 217 | +git-context-controller/ |
| 218 | +├── SKILL.md # Claude Code skill definition |
| 219 | +├── README.md # This file |
| 220 | +├── LICENSE # MIT License |
| 221 | +├── CONTRIBUTING.md # Contribution guidelines |
| 222 | +├── scripts/ |
| 223 | +│ └── gcc_init.sh # Initialization script |
| 224 | +├── references/ |
| 225 | +│ └── file_formats.md # Detailed format specifications |
| 226 | +└── examples/ |
| 227 | + └── sample_session.md # Example GCC session walkthrough |
| 228 | +``` |
| 229 | + |
| 230 | +## Contributing |
| 231 | + |
| 232 | +Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines. |
| 233 | + |
| 234 | +## References |
| 235 | + |
| 236 | +- **Paper**: [Git Context Controller: Structured Context Management for LLM Agents](https://arxiv.org/abs/2508.00031) |
| 237 | +- **Concept**: [Emergent Mind - GCC Topic](https://www.emergentmind.com/topics/git-context-controller-gcc) |
| 238 | + |
| 239 | +## License |
| 240 | + |
| 241 | +[MIT](LICENSE) |
0 commit comments