Skip to content

Commit a8a18cf

Browse files
committed
GCC v2: lean git-backed memory with utility scripts
Replace verbose markdown storage (~500 tokens/entry) with lean index.yaml format (~50 tokens/entry) backed by real git commits. Context is reconstructed on demand via git show. New scripts: - gcc_commit.sh: real git commit + lean index entry - gcc_context.sh: reconstruct context from hashes - gcc_bridge.sh: feed commit data to aiyoucli vector memory - gcc_cleanup.sh: TTL-based worktree cleanup + index pruning Updated gcc_init.sh with dual mode (git/standalone) detection. Updated SKILL.md, README.md, file_formats.md, sample_session.md for v2 format and workflows.
1 parent 85c8539 commit a8a18cf

File tree

9 files changed

+1239
-437
lines changed

9 files changed

+1239
-437
lines changed

README.md

Lines changed: 127 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,69 @@
1-
# Git Context Controller (GCC)
1+
# Git Context Controller (GCC) v2
22

3-
[![Release](https://img.shields.io/github/v/release/faugustdev/git-context-controller)](https://github.com/faugustdev/git-context-controller/releases/tag/v1.0.0)
3+
[![Release](https://img.shields.io/github/v/release/faugustdev/git-context-controller)](https://github.com/faugustdev/git-context-controller/releases)
44
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
55
[![Skills.sh](https://img.shields.io/badge/skills.sh-compatible-blue)](https://skills.sh)
66

7-
**Structured context management framework for LLM agents.**
7+
**Lean, git-backed context management for LLM agents.**
88

9-
GCC implements Git-like operations (COMMIT, BRANCH, MERGE, CONTEXT) to manage long-horizon agent memory as a persistent, versioned file system.
9+
GCC v2 stores **hash + intent + optional decision notes** instead of verbose markdown. Full context is reconstructed on demand via `git show`. Dual mode: git-backed or standalone.
1010

1111
> Based on the research paper: [Git Context Controller](https://arxiv.org/abs/2508.00031)
1212
1313
---
1414

1515
## Why GCC?
1616

17-
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:
17+
LLM agents lose context as conversations grow. GCC solves this by giving agents structured memory:
1818

19-
- **No more lost context** -- milestones are persisted with full technical reasoning
20-
- **Safe experimentation** -- branches isolate alternative approaches without polluting the main flow
21-
- **Cross-session continuity** -- agents recover exactly where they left off
22-
- **Multi-agent handoff** -- one agent's work is readable by another
19+
- **Lean storage** -- ~50 tokens per entry vs ~500 in v1
20+
- **Git-backed truth** -- real commits, not narrative copies
21+
- **Safe experimentation** -- branches via git worktrees for real isolation
22+
- **Cross-session recovery** -- reconstruct context from hashes on demand
23+
- **aiyoucli bridge** -- auto-feeds commit data to vector memory when available
2324

2425
## How It Works
2526

27+
### Git Mode (with repo)
28+
29+
```
30+
.GCC/
31+
├── index.yaml # Single source of truth (~50 tokens/entry)
32+
├── branches/ # Branch-specific notes
33+
├── worktrees/ # Worktree tracking
34+
└── .bridge-log # Sync state with aiyoucli
35+
36+
index.yaml entry:
37+
- id: C001
38+
hash: 85c8539 ← pointer to git truth
39+
intent: "release prep" ← why
40+
note: "descartamos semantic-release por overhead" ← optional decision
41+
branch: main
42+
date: "2026-02-25T21:40:00Z"
43+
```
44+
45+
### Standalone Mode (no repo)
46+
47+
Falls back to markdown files compatible with v1:
48+
49+
```
50+
.GCC/
51+
├── index.yaml # Timeline
52+
├── main.md # Roadmap (v1 compat)
53+
├── log.md # OTA traces (v1 compat)
54+
└── branches/
55+
```
56+
57+
### Context Reconstruction
58+
2659
```
27-
┌─────────────────────────────────┐
28-
│ .GCC/ │
29-
│ │
30-
│ main.md (roadmap) │
31-
│ metadata.yaml (state) │
32-
│ commit.md (history) │
33-
│ log.md (OTA traces) │
34-
│ │
35-
│ branches/ │
36-
│ ├── feature-x/ │
37-
│ │ ├── summary.md │
38-
│ │ ├── commit.md │
39-
│ │ └── log.md │
40-
│ └── experiment-y/ │
41-
│ ├── summary.md │
42-
│ ├── commit.md │
43-
│ └── log.md │
44-
└─────────────────────────────────┘
45-
```
46-
47-
### The OTA Cycle
48-
49-
Agents operate through **Observation-Thought-Action** cycles, logged in real time:
50-
51-
```
52-
┌───────────┐ ┌───────────┐ ┌───────────┐
53-
│ OBSERVE │────>│ THINK │────>│ ACT │
54-
│ │ │ │ │ │
55-
│ Read logs │ │ Analyze │ │ Execute │
56-
│ Check │ │ Decide │ │ COMMIT │
57-
│ state │ │ strategy │ │ BRANCH │
58-
└───────────┘ └───────────┘ │ MERGE │
59-
^ └─────┬─────┘
60-
│ │
61-
└───────────────────────────────────┘
62-
Logged to log.md
63-
```
64-
65-
### Command Flow
66-
67-
```
68-
User works on task
69-
70-
71-
┌──────────────┐ milestone? ┌──────────┐
72-
│ OTA Cycle │────────────────> │ COMMIT │──> commit.md
73-
│ (ongoing) │ └──────────┘
74-
└──────┬───────┘
75-
76-
│ need alternative?
77-
78-
┌──────────────┐ ┌──────────┐
79-
│ BRANCH │────────────────> │ Isolated │──> branches/<name>/
80-
│ │ │ workspace│
81-
└──────────────┘ └────┬─────┘
82-
83-
validated?
84-
85-
86-
┌──────────┐
87-
│ MERGE │──> main.md updated
88-
└──────────┘
89-
90-
┌──────────────┐
91-
│ CONTEXT │──> Retrieve memory at any resolution
92-
│ --branch │ (summary, traces, metadata, full)
93-
│ --log │
94-
│ --metadata │
95-
│ --full │
96-
└──────────────┘
60+
Agent needs context
61+
62+
63+
gcc_context.sh --summary ← ~50 tokens, zero git calls
64+
gcc_context.sh --last 5 ← reconstructs via git show
65+
gcc_context.sh --decisions ← only entries with notes
66+
gcc_context.sh --hash abc123 ← full diff for one commit
9767
```
9868

9969
## Installation
@@ -114,7 +84,8 @@ cp -r gcc/ your-project/.claude/skills/gcc/
11484
git clone https://github.com/faugustdev/git-context-controller.git
11585

11686
# Initialize GCC in your project
117-
./scripts/gcc_init.sh /path/to/your/project/.GCC
87+
cd your-project
88+
/path/to/scripts/gcc_init.sh
11889
```
11990

12091
## Quick Start
@@ -126,108 +97,130 @@ Once installed, GCC activates automatically. Use commands or natural language:
12697
| Save progress | `/gcc commit` | "save this milestone" |
12798
| Try alternative | `/gcc branch experiment` | "branch to try a different approach" |
12899
| Integrate results | `/gcc merge experiment` | "merge the experiment results" |
129-
| Recover context | `/gcc context --full` | "where were we?" |
130-
| View recent work | `/gcc context --log` | "show recent activity" |
131-
| Check structure | `/gcc context --metadata` | "what files do we have?" |
100+
| Quick status | `/gcc context --summary` | "where were we?" |
101+
| Recent work | `/gcc context --last 10` | "show recent activity" |
102+
| View decisions | `/gcc context --decisions` | "what did we decide about X?" |
103+
| Deep dive | `/gcc context --hash abc123` | "details on that commit" |
104+
| Clean up | `/gcc cleanup` | "clean up old worktrees" |
105+
| Sync memory | `/gcc bridge --sync` | "sync to aiyoucli" |
106+
107+
## Scripts
108+
109+
GCC v2 includes utility scripts for mechanical operations:
110+
111+
| Script | Purpose |
112+
|---|---|
113+
| `gcc_init.sh` | Initialize GCC (auto-detects git/standalone) |
114+
| `gcc_commit.sh` | Real git commit + lean index entry |
115+
| `gcc_context.sh` | Reconstruct context from hashes |
116+
| `gcc_bridge.sh` | Feed commit data to aiyoucli vector memory |
117+
| `gcc_cleanup.sh` | TTL-based worktree cleanup + index pruning |
118+
119+
### gcc_commit.sh
120+
121+
```bash
122+
gcc_commit.sh "implement retry logic"
123+
gcc_commit.sh "release prep" "descartamos semantic-release por overhead"
124+
gcc_commit.sh --staged "hotfix: null check"
125+
```
126+
127+
### gcc_context.sh
128+
129+
```bash
130+
gcc_context.sh --summary # one-line per entry (cheapest)
131+
gcc_context.sh --last 5 # last 5 with git details
132+
gcc_context.sh --hash abc123 # full diff for specific commit
133+
gcc_context.sh --decisions # only entries with notes
134+
gcc_context.sh --full # everything
135+
```
136+
137+
### gcc_bridge.sh
138+
139+
```bash
140+
gcc_bridge.sh --status # check bridge connectivity
141+
gcc_bridge.sh --sync # sync all unsynced entries to aiyoucli
142+
```
143+
144+
### gcc_cleanup.sh
145+
146+
```bash
147+
gcc_cleanup.sh --dry-run # show what would be cleaned
148+
gcc_cleanup.sh --force # clean without asking
149+
gcc_cleanup.sh --prune-index 50 # keep last 50 timeline entries
150+
```
132151

133152
## Commands Reference
134153

135154
### COMMIT
136155

137-
Persists a milestone with full technical context.
156+
Persists a milestone. In git mode, executes a real commit.
138157

139158
```
140159
/gcc commit <summary>
141160
```
142161

143-
Each commit captures:
144-
- Sequential ID and timestamp
145-
- Branch context and purpose
146-
- Previous progress summary
147-
- Detailed technical contribution
148-
- Files touched
149-
150162
### BRANCH
151163

152-
Creates an isolated workspace for experimentation.
164+
Creates an isolated workspace. In git mode, uses real git worktrees.
153165

154166
```
155167
/gcc branch <name>
156168
```
157169

158-
Creates a new directory under `.GCC/branches/<name>/` with its own commit history, OTA log, and summary.
159-
160170
### MERGE
161171

162-
Synthesizes a completed branch back into the main flow.
172+
Integrates a branch back. In git mode, real git merge + synthesis note.
163173

164174
```
165175
/gcc merge <branch-name>
166176
```
167177

168-
Updates `main.md` with results, marks the branch as merged or abandoned, and creates a synthesis commit.
169-
170178
### CONTEXT
171179

172-
Retrieves historical memory at different resolution levels.
180+
Retrieves historical memory reconstructed from git.
173181

174182
```
175-
/gcc context [--branch [name] | --log [n] | --metadata | --full]
183+
/gcc context [--summary | --last N | --hash HASH | --decisions | --full]
176184
```
177185

178-
| Flag | Returns | Use Case |
186+
| Flag | Returns | Cost |
179187
|---|---|---|
180-
| `--branch` | Branch summary + recent commits | Understand what happened on a branch |
181-
| `--log [n]` | Last N OTA entries (default: 20) | Debug or resume interrupted work |
182-
| `--metadata` | Project structure, dependencies | Recover file tree and config |
183-
| `--full` | Complete roadmap from main.md | Cross-session recovery or agent handoff |
184-
185-
## File Formats
186-
187-
### main.md
188-
189-
Global roadmap with objectives, milestones, and active branches.
190-
191-
### commit.md
192-
193-
Structured commit entries with branch purpose, previous progress, and detailed contribution.
194-
195-
### log.md
196-
197-
Sequential OTA (Observation-Thought-Action) trace entries. Capped at 50 entries.
198-
199-
### metadata.yaml
200-
201-
Infrastructure state: branch registry, file tree, dependencies, configuration.
202-
203-
See [`references/file_formats.md`](references/file_formats.md) for complete format specifications with examples.
188+
| `--summary` | One-line per entry | ~0 extra tokens |
189+
| `--last N` | Last N entries with git details | ~200 tokens/entry |
190+
| `--hash HASH` | Full diff for one commit | Variable |
191+
| `--decisions` | Only entries with notes | Minimal |
192+
| `--full` | Everything | All entries |
204193

205194
## Configuration
206195

207-
GCC behavior is controlled via `metadata.yaml`:
196+
Controlled via `index.yaml`:
208197

209198
```yaml
210-
proactive_commits: true # Auto-suggest commits after milestones
211-
proactive_commits: false # Only commit when explicitly requested
199+
config:
200+
proactive_commits: true # Auto-suggest commits after milestones
201+
worktree_ttl: 24h # Auto-cleanup expired worktrees
202+
bridge_to_aiyoucli: auto # auto | off | manual
212203
```
213204
214-
Toggle with natural language: "enable/disable proactive commits"
215-
216205
## Project Structure
217206
218207
```
219208
git-context-controller/
220-
├── SKILL.md # Claude Code skill definition
209+
├── SKILL.md # Skill definition (v2)
221210
├── README.md # This file
222211
├── LICENSE # MIT License
223212
├── CONTRIBUTING.md # Contribution guidelines
224-
├── .gitignore # Excludes .GCC/ and local files
213+
├── .gitignore
225214
├── scripts/
226-
│ └── gcc_init.sh # Initialization script
215+
│ ├── gcc_init.sh # Initialization (git detect + index.yaml)
216+
│ ├── gcc_commit.sh # Commit + lean entry
217+
│ ├── gcc_context.sh # Context reconstruction
218+
│ ├── gcc_bridge.sh # aiyoucli memory bridge
219+
│ └── gcc_cleanup.sh # Worktree TTL + index pruning
227220
├── references/
228-
│ └── file_formats.md # Detailed format specifications
221+
│ └── file_formats.md # Format specifications (v2)
229222
└── examples/
230-
└── sample_session.md # Example GCC session walkthrough
223+
└── sample_session.md # Example session (v2)
231224
```
232225

233226
## Contributing

0 commit comments

Comments
 (0)