contextgit 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/dist/bootstrap.d.ts +10 -0
  2. package/dist/bootstrap.d.ts.map +1 -0
  3. package/dist/bootstrap.js +43 -0
  4. package/dist/bootstrap.js.map +1 -0
  5. package/dist/commands/branch.d.ts +13 -0
  6. package/dist/commands/branch.d.ts.map +1 -0
  7. package/dist/commands/branch.js +52 -0
  8. package/dist/commands/branch.js.map +1 -0
  9. package/dist/commands/claim.d.ts +15 -0
  10. package/dist/commands/claim.d.ts.map +1 -0
  11. package/dist/commands/claim.js +60 -0
  12. package/dist/commands/claim.js.map +1 -0
  13. package/dist/commands/commit.d.ts +17 -0
  14. package/dist/commands/commit.d.ts.map +1 -0
  15. package/dist/commands/commit.js +83 -0
  16. package/dist/commands/commit.js.map +1 -0
  17. package/dist/commands/context.d.ts +9 -0
  18. package/dist/commands/context.d.ts.map +1 -0
  19. package/dist/commands/context.js +38 -0
  20. package/dist/commands/context.js.map +1 -0
  21. package/dist/commands/doctor.d.ts +6 -0
  22. package/dist/commands/doctor.d.ts.map +1 -0
  23. package/dist/commands/doctor.js +84 -0
  24. package/dist/commands/doctor.js.map +1 -0
  25. package/dist/commands/init.d.ts +10 -0
  26. package/dist/commands/init.d.ts.map +1 -0
  27. package/dist/commands/init.js +184 -0
  28. package/dist/commands/init.js.map +1 -0
  29. package/dist/commands/keygen.d.ts +10 -0
  30. package/dist/commands/keygen.d.ts.map +1 -0
  31. package/dist/commands/keygen.js +57 -0
  32. package/dist/commands/keygen.js.map +1 -0
  33. package/dist/commands/log.d.ts +13 -0
  34. package/dist/commands/log.d.ts.map +1 -0
  35. package/dist/commands/log.js +91 -0
  36. package/dist/commands/log.js.map +1 -0
  37. package/dist/commands/merge.d.ts +12 -0
  38. package/dist/commands/merge.d.ts.map +1 -0
  39. package/dist/commands/merge.js +29 -0
  40. package/dist/commands/merge.js.map +1 -0
  41. package/dist/commands/pull.d.ts +10 -0
  42. package/dist/commands/pull.d.ts.map +1 -0
  43. package/dist/commands/pull.js +123 -0
  44. package/dist/commands/pull.js.map +1 -0
  45. package/dist/commands/push.d.ts +10 -0
  46. package/dist/commands/push.d.ts.map +1 -0
  47. package/dist/commands/push.js +141 -0
  48. package/dist/commands/push.js.map +1 -0
  49. package/dist/commands/remote-show.d.ts +6 -0
  50. package/dist/commands/remote-show.d.ts.map +1 -0
  51. package/dist/commands/remote-show.js +71 -0
  52. package/dist/commands/remote-show.js.map +1 -0
  53. package/dist/commands/search.d.ts +11 -0
  54. package/dist/commands/search.d.ts.map +1 -0
  55. package/dist/commands/search.js +47 -0
  56. package/dist/commands/search.js.map +1 -0
  57. package/dist/commands/serve.d.ts +9 -0
  58. package/dist/commands/serve.d.ts.map +1 -0
  59. package/dist/commands/serve.js +51 -0
  60. package/dist/commands/serve.js.map +1 -0
  61. package/dist/commands/set-remote.d.ts +9 -0
  62. package/dist/commands/set-remote.d.ts.map +1 -0
  63. package/dist/commands/set-remote.js +26 -0
  64. package/dist/commands/set-remote.js.map +1 -0
  65. package/dist/commands/status.d.ts +6 -0
  66. package/dist/commands/status.d.ts.map +1 -0
  67. package/dist/commands/status.js +54 -0
  68. package/dist/commands/status.js.map +1 -0
  69. package/dist/commands/unclaim.d.ts +9 -0
  70. package/dist/commands/unclaim.d.ts.map +1 -0
  71. package/dist/commands/unclaim.js +22 -0
  72. package/dist/commands/unclaim.js.map +1 -0
  73. package/dist/config.d.ts +19 -0
  74. package/dist/config.d.ts.map +1 -0
  75. package/dist/config.js +58 -0
  76. package/dist/config.js.map +1 -0
  77. package/dist/git-hooks.d.ts +6 -0
  78. package/dist/git-hooks.d.ts.map +1 -0
  79. package/dist/git-hooks.js +58 -0
  80. package/dist/git-hooks.js.map +1 -0
  81. package/package.json +24 -18
  82. package/.claude/settings.local.json +0 -41
  83. package/.contextgit/config.json +0 -10
  84. package/.contextgit/system-prompt.md +0 -4
  85. package/.github/workflows/contextgit-ci.yml +0 -40
  86. package/CLAUDE.md +0 -123
  87. package/CLAUDE.md.next +0 -65
  88. package/docs/ContextGit_ARCHITECTURE_v3.md +0 -1141
  89. package/docs/ContextGit_DELTA.md +0 -84
  90. package/docs/ContextGit_PHASE1_PLAN.md +0 -177
  91. package/docs/ContextGit_PHASE2_PLAN.md +0 -535
  92. package/docs/ContextGit_PRD_v4.md +0 -488
  93. package/docs/decisions.md +0 -370
  94. package/packages/api/package.json +0 -25
  95. package/packages/api/src/bootstrap.ts +0 -64
  96. package/packages/api/src/config.ts +0 -45
  97. package/packages/api/src/index.ts +0 -17
  98. package/packages/api/src/middleware/auth.test.ts +0 -83
  99. package/packages/api/src/middleware/auth.ts +0 -41
  100. package/packages/api/src/remote-store.test.ts +0 -301
  101. package/packages/api/src/router.ts +0 -121
  102. package/packages/api/src/server-config.ts +0 -34
  103. package/packages/api/src/server.ts +0 -38
  104. package/packages/api/src/store-router.ts +0 -241
  105. package/packages/api/tsconfig.json +0 -8
  106. package/packages/cli/package.json +0 -29
  107. package/packages/cli/src/bootstrap.ts +0 -68
  108. package/packages/cli/src/commands/branch.ts +0 -58
  109. package/packages/cli/src/commands/claim.ts +0 -58
  110. package/packages/cli/src/commands/commit.ts +0 -79
  111. package/packages/cli/src/commands/context.ts +0 -46
  112. package/packages/cli/src/commands/doctor.ts +0 -99
  113. package/packages/cli/src/commands/init.ts +0 -141
  114. package/packages/cli/src/commands/keygen.ts +0 -65
  115. package/packages/cli/src/commands/log.ts +0 -103
  116. package/packages/cli/src/commands/merge.ts +0 -36
  117. package/packages/cli/src/commands/pull.ts +0 -145
  118. package/packages/cli/src/commands/push.ts +0 -158
  119. package/packages/cli/src/commands/remote-show.ts +0 -87
  120. package/packages/cli/src/commands/search.ts +0 -54
  121. package/packages/cli/src/commands/serve.ts +0 -61
  122. package/packages/cli/src/commands/set-remote.ts +0 -30
  123. package/packages/cli/src/commands/status.ts +0 -62
  124. package/packages/cli/src/commands/unclaim.ts +0 -28
  125. package/packages/cli/src/config.ts +0 -64
  126. package/packages/cli/src/git-hooks.ts +0 -61
  127. package/packages/cli/tsconfig.json +0 -9
  128. package/packages/core/package.json +0 -28
  129. package/packages/core/src/embeddings.test.ts +0 -58
  130. package/packages/core/src/embeddings.ts +0 -75
  131. package/packages/core/src/engine.ts +0 -274
  132. package/packages/core/src/index.ts +0 -6
  133. package/packages/core/src/snapshot.ts +0 -82
  134. package/packages/core/src/summarizer.test.ts +0 -120
  135. package/packages/core/src/summarizer.ts +0 -113
  136. package/packages/core/src/threads.ts +0 -29
  137. package/packages/core/src/types.ts +0 -240
  138. package/packages/core/tsconfig.json +0 -9
  139. package/packages/mcp/package.json +0 -31
  140. package/packages/mcp/src/auto-snapshot.ts +0 -83
  141. package/packages/mcp/src/config.ts +0 -53
  142. package/packages/mcp/src/git-sync.ts +0 -94
  143. package/packages/mcp/src/index.ts +0 -19
  144. package/packages/mcp/src/server.ts +0 -377
  145. package/packages/mcp/tsconfig.json +0 -9
  146. package/packages/store/package.json +0 -30
  147. package/packages/store/src/branch-merge.test.ts +0 -127
  148. package/packages/store/src/engine-integration.test.ts +0 -93
  149. package/packages/store/src/index.ts +0 -3
  150. package/packages/store/src/interface.ts +0 -62
  151. package/packages/store/src/local/claims.test.ts +0 -190
  152. package/packages/store/src/local/index.ts +0 -380
  153. package/packages/store/src/local/local-store.test.ts +0 -164
  154. package/packages/store/src/local/migrations.ts +0 -99
  155. package/packages/store/src/local/queries.ts +0 -760
  156. package/packages/store/src/local/schema.ts +0 -157
  157. package/packages/store/src/remote/index.ts +0 -300
  158. package/packages/store/tsconfig.json +0 -9
  159. package/pnpm-workspace.yaml +0 -2
  160. package/scripts/build.sh +0 -28
  161. package/tsconfig.base.json +0 -14
  162. package/vitest.config.ts +0 -15
  163. /package/{packages/cli/bin → bin}/run.js +0 -0
@@ -1,488 +0,0 @@
1
- # ContextGit
2
- ### The Memory Layer for AI Agent Workflows
3
-
4
- ---
5
-
6
- **Version 4.0 | March 2026**
7
- **Status: Draft for Co-founder Review**
8
- **Classification: Confidential**
9
-
10
- ---
11
-
12
- ## The Problem
13
-
14
- Every AI coding agent today suffers from amnesia. When you start a new session with Claude Code, Cursor, Codex, or any other AI coding tool, the agent knows nothing about your project, your conventions, your past decisions, or what it already tried and failed.
15
-
16
- The workaround is a CLAUDE.md or AGENTS.md file. But after weeks of active development, this file either becomes a massive context-eating blob, or stays too shallow to be useful. Neither scales. And it solves only the simplest case — a single developer, a single tool, a single session.
17
-
18
- The result is a cycle every developer using AI agents recognises:
19
-
20
- - **Context ramp-up waste** — Every session burns tokens re-discovering your architecture and codebase.
21
- - **Loop behavior** — The agent loses track of earlier fixes and starts re-applying or undoing its own work.
22
- - **Session isolation** — Knowledge from one session never transfers to the next. You re-teach the same things over and over.
23
- - **No cross-agent memory** — Switch tools, spawn a sub-agent, run a CI pipeline — each one starts from zero.
24
- - **Team fragmentation** — Multiple developers using AI agents on the same project share nothing. Every agent is an island.
25
-
26
- This problem manifests across every AI agent workflow in use today — interactive sessions, autonomous loops, CI pipelines, multi-agent orchestration. The tooling is different in each case. The amnesia is the same.
27
-
28
- ---
29
-
30
- ## The Insight
31
-
32
- ### What GCC Proved in the Lab
33
-
34
- An Oxford academic research project called GCC (Git-Context-Controller) proved that treating agent context like a git repository solves the amnesia problem. Agents use COMMIT, BRANCH, MERGE, and CONTEXT commands to manage their own reasoning history. Rolling summaries prevent context bloat. Paginated retrieval keeps sessions lean. GCC achieved state-of-the-art results on SWE-Bench — 48% resolution, outperforming 26 other systems.
35
-
36
- GCC was never built for real teams. It has no shared persistence, no multi-agent coordination, no web interface, and no way to share context across tools or developers.
37
-
38
- ### What Ralph Wiggum Proved in Practice
39
-
40
- Independently, a community of developers converged on a pattern called the Ralph Wiggum Technique. The core mechanic is disarmingly simple:
41
-
42
- ```bash
43
- while true; do cat PROMPT.md | claude -p --dangerously-skip-permissions; done
44
- ```
45
-
46
- Fresh context window every loop iteration. One task per iteration. `IMPLEMENTATION_PLAN.md` on disk is the shared state between loops. The agent reads the plan, picks the most important task, implements it, commits the code to git, exits. The loop restarts with a clean context. Repeat.
47
-
48
- Ralph solves the *execution loop* problem brilliantly. But `IMPLEMENTATION_PLAN.md` is a flat task list — it tells the agent what to do next, not why decisions were made, what was tried and failed, what the architectural conventions are, or what another developer's agent discovered last week. The plan file is explicitly disposable. That is fine for solo work. It breaks for teams.
49
-
50
- ### The Combination
51
-
52
- **ContextGit is the persistent institutional memory layer that every AI agent workflow is missing.**
53
-
54
- - GCC provides the proven context model — commits, branches, rolling summaries.
55
- - ContextGit builds the infrastructure, tooling, and platform around it — dual persistence, MCP server, REST API, web platform.
56
- - Every workflow — Ralph loops, interactive sessions, CI pipelines, multi-agent orchestration, custom frameworks — plugs into the same memory layer through the interface that fits them.
57
-
58
- The analogy to git is intentional. GCC gave us the commit model. Ralph proved that loops with persistent file state work at scale. ContextGit is the GitHub moment — making structured agent memory accessible, collaborative, and networked across every workflow.
59
-
60
- ---
61
-
62
- ## What is ContextGit
63
-
64
- ContextGit is the memory layer for AI agent workflows. It gives agents persistent, structured, shared memory across sessions, tools, loops, pipelines, and teams — regardless of how those agents are invoked.
65
-
66
- There are three ways to think about it:
67
-
68
- - **For a solo developer** — persistent memory that survives between sessions, zero infrastructure required
69
- - **For a team** — a shared context store where every agent's knowledge accumulates and compounds, across tools and workflows
70
- - **For the ecosystem** — a public platform where developers publish and clone agent context alongside their code, the same way they publish and clone code on GitHub
71
-
72
- ---
73
-
74
- ## Core Architecture
75
-
76
- ```
77
- ┌──────────────────────────────────────────────────────────────────┐
78
- │ HOW AGENTS CONNECT │
79
- │ │
80
- │ MCP Server REST API CLI / Git hooks │
81
- │ (interactive (pipelines, (Ralph loops, │
82
- │ tools) custom agents) CI, automation) │
83
- └──────────────────────────┬───────────────────────────────────────┘
84
-
85
- ┌──────────────────────────┴───────────────────────────────────────┐
86
- │ Context Engine (based on GCC / Aline) │
87
- │ COMMIT | BRANCH | MERGE | CONTEXT │
88
- │ Rolling summaries | Open threads | Session contract │
89
- │ AGENTS.md generator | Snapshot export │
90
- └──────────────────────────┬───────────────────────────────────────┘
91
-
92
- ┌────────────────┴────────────────┐
93
- │ │
94
- ┌─────────┴──────────┐ ┌──────────┴──────────┐
95
- │ LocalStore │ │ RemoteStore │
96
- │ SQLite + vec │ │ Postgres + pgvector │
97
- │ Solo dev │ │ Team / hosted │
98
- │ Zero setup │ │ Concurrent writes │
99
- └────────────────────┘ └─────────────────────┘
100
-
101
- ┌──────────────────────────┴───────────────────────────────────────┐
102
- │ ContextGit Web Platform │
103
- │ Explore repos | Branch viewer | Diff view | Search │
104
- │ Clone context | Fork | Star | Team dashboards │
105
- └──────────────────────────────────────────────────────────────────┘
106
- ```
107
-
108
- ### Layer 1 — Context Engine (based on GCC)
109
-
110
- The brain. Structured context management through four git-like operations:
111
-
112
- - **COMMIT** — Checkpoints a milestone with a rolling summary. Each commit carries compressed history of everything before it. An agent never needs to load hundreds of past entries to understand where it is.
113
- - **BRANCH** — Creates an isolated workspace to explore an alternative approach. If it fails, the main context is untouched.
114
- - **MERGE** — Integrates a successful branch back with a synthesis summary. Open threads from the branch carry forward if unresolved.
115
- - **CONTEXT** — Retrieves history at the right granularity: global snapshot, branch summary, specific commit, or semantic search. Always lean. Never bulk-loaded.
116
-
117
- ### Layer 2 — Persistence Layer (dual-mode)
118
-
119
- **LocalStore (SQLite + sqlite-vec)** — Zero infrastructure. Ships with the binary. Works offline. For solo developers.
120
-
121
- **RemoteStore (Postgres + pgvector)** — Hosted by ContextGit or self-hosted. Concurrent writes, semantic search, scales. For teams and hosted pipelines.
122
-
123
- One config field switches between them: `store: local` or `store: <remote-url>`.
124
-
125
- ### Layer 3 — Integration Interfaces
126
-
127
- Three ways agents connect, each suited to a different workflow:
128
-
129
- **MCP Server** — For interactive tools (Claude Code, Cursor, Codex). Runs locally alongside the developer's tool. Auto-detects git branches, installs git hooks, handles background snapshotting.
130
-
131
- **REST API** — For automated pipelines, CI agents, custom frameworks (LangChain, CrewAI), and anything that isn't MCP-compatible. POST commits, GET snapshots, search context. Full feature parity with the MCP server.
132
-
133
- **CLI** — For Ralph-style loops and shell scripts. `contextgit snapshot` generates AGENTS.md. `contextgit commit` checkpoints from the command line. `contextgit clone` downloads a public context repository. Composable with any bash workflow.
134
-
135
- ### Layer 4 — Web Platform
136
-
137
- A GitHub-like web application where developers browse, search, publish, and clone agent context repositories. The network layer that makes institutional knowledge shareable across the ecosystem.
138
-
139
- ---
140
-
141
- ## How It Works
142
-
143
- ### The Session Start Contract
144
-
145
- This is the most important mechanism in ContextGit. Whatever the workflow — an interactive session, a Ralph loop iteration, a CI pipeline run, a spawned sub-agent — the agent calls `context_get scope=global` and receives a compact, structured snapshot. Always the same shape. Always under 600 tokens. Regardless of whether the project has 5 commits or 500:
146
-
147
- ```
148
- === PROJECT STATE ===
149
- Next.js 14, Tailwind, JWT RS256 auth, Stripe webhooks.
150
- Middleware pattern for all auth. API routes under /api/v1.
151
- Postgres via Supabase. Prisma ORM.
152
-
153
- === CURRENT BRANCH: feature/rate-limiting ===
154
- Implementing rate limiting on API routes.
155
- Redis chosen over in-memory — must survive deploys.
156
- Upstash Redis client installed. Middleware skeleton in place.
157
-
158
- === LAST 3 COMMITS ===
159
- [2h ago] "Upstash client configured, env vars set" by dev via Claude Code
160
- [5h ago] "Decided against in-memory: won't survive server restarts" by dev
161
- [yesterday] "Rate limit middleware skeleton at middleware/rateLimit.ts" by dev
162
-
163
- === OPEN THREADS ===
164
- [ ] Sliding window vs fixed window algorithm — not yet decided
165
- [ ] Test coverage for rate limiter — pending
166
- [ ] Token refresh fails on mobile Safari — tracked in fix/safari-token
167
- ```
168
-
169
- **~400–600 tokens. Flat cost regardless of project age.**
170
-
171
- This is not the PRD. It is not the architecture document. It is the distilled reality of what has actually been built and decided — more useful to an agent than any document written before development started.
172
-
173
- For deeper history the agent uses semantic search on demand:
174
-
175
- ```
176
- context_get scope=search query="token refresh implementation"
177
- → 2–3 most relevant commits from any branch, any date, ~800 tokens
178
- ```
179
-
180
- ### Open Threads
181
-
182
- Open threads are a first-class data structure, not extracted from summaries. Every commit can tag items explicitly:
183
-
184
- ```
185
- threads.open: "sliding window vs fixed window not decided"
186
- threads.close: { id: "thread_abc", note: "chose Redis, see commit" }
187
- ```
188
-
189
- Unresolved decisions are never silently dropped by summary compression. They are always surfaced at session start.
190
-
191
- ---
192
-
193
- ## Workflow Integrations
194
-
195
- ContextGit is workflow-agnostic. Here is how it plugs into each major pattern in use today.
196
-
197
- ### 1. Interactive Sessions (Claude Code, Cursor, Codex)
198
-
199
- The largest segment of AI-assisted development today. Developer opens a tool, works for an hour, closes it. Next day, fresh context. ContextGit plugs in via the MCP server with zero workflow change.
200
-
201
- ```
202
- Session opens
203
- → Agent calls context_get scope=global automatically (system prompt injection)
204
- → Receives compact snapshot, fully oriented in ~500 tokens
205
- → Works normally, commits milestones via context_commit
206
- → Session closes
207
-
208
- Next session opens
209
- → Same compact snapshot, updated with yesterday's commits
210
- → Agent picks up exactly where the last one left off
211
- ```
212
-
213
- No new commands to learn. No workflow changes. The MCP server handles everything.
214
-
215
- ### 2. Ralph / Autonomous Loop
216
-
217
- Ralph's `while true` loop already solves the execution problem. ContextGit plugs in as the memory layer without changing the loop mechanics.
218
-
219
- ```bash
220
- while true; do
221
- # Generate AGENTS.md from ContextGit snapshot
222
- contextgit snapshot --format=agents-md > AGENTS.md
223
-
224
- # Run Ralph iteration (reads AGENTS.md + IMPLEMENTATION_PLAN.md as always)
225
- cat PROMPT.md | claude -p --dangerously-skip-permissions
226
-
227
- # Checkpoint context after iteration completes
228
- contextgit commit "Loop iteration: $(git log -1 --pretty=%s)"
229
-
230
- git push origin "$(git branch --show-current)"
231
- done
232
- ```
233
-
234
- **What this adds to Ralph:**
235
-
236
- - `AGENTS.md` is auto-generated from accumulated context — never manually maintained, never stale
237
- - Decisions, failed approaches, and architectural discoveries persist across loop restarts
238
- - When a second developer runs the same loop on the same project, their AGENTS.md reflects everything the first developer's loops discovered
239
- - The ContextGit web UI gives visibility into what the loop has been doing — branch tree, commit history, open threads — without reading raw git logs
240
-
241
- **What stays unchanged:** `IMPLEMENTATION_PLAN.md` remains entirely Ralph's domain. ContextGit does not touch it. Clean separation: Ralph owns task tracking, ContextGit owns institutional memory.
242
-
243
- ### 3. CI / GitHub Actions Pipelines
244
-
245
- Agents running in CI — auto-fix failing tests, auto-review PRs, auto-generate docs — are stateless by design. Each run is a fresh environment. ContextGit gives these agents project knowledge without any manual setup.
246
-
247
- ```yaml
248
- # .github/workflows/ai-review.yml
249
- - name: Pull context snapshot
250
- run: contextgit snapshot --project $PROJECT_ID --store $CONTEXTHUB_REMOTE_URL > AGENTS.md
251
-
252
- - name: Run review agent
253
- run: cat prompts/review.md | claude -p --dangerously-skip-permissions
254
-
255
- - name: Commit agent findings
256
- run: contextgit commit "CI review: PR #$PR_NUMBER findings" --store $CONTEXTHUB_REMOTE_URL
257
- ```
258
-
259
- Every CI run builds on what previous runs discovered. A flaky test pattern found in one run is committed to context. The next run that touches the same code area retrieves it automatically.
260
-
261
- ### 4. Multi-Agent Orchestration
262
-
263
- Orchestrators spawning dev agents, test agents, and review agents. Each sub-agent calls `context_get scope=global` on startup and is immediately oriented without manual briefing. Each agent writes its findings directly to the shared store, attributed by role.
264
-
265
- ```
266
- Orchestrator spawns dev agent:
267
- → Dev agent: context_get scope=global (~500 tokens, fully oriented)
268
- → Dev agent: implements feature
269
- → Dev agent: context_commit role=dev "Stripe webhooks implemented"
270
-
271
- Orchestrator spawns test agent (same branch):
272
- → Test agent: context_get scope=global (includes dev agent's commits)
273
- → Test agent: runs tests, finds edge case
274
- → Test agent: context_commit role=test "Edge case: duplicate webhook on retry"
275
- threads.open: ["duplicate webhook on retry — needs idempotency key update"]
276
-
277
- Orchestrator synthesis:
278
- → context_commit role=orchestrator "Feature complete. 1 open thread."
279
- ```
280
-
281
- No agent is manually briefed. The context store is the shared brain.
282
-
283
- ### 5. Background Agents (Cursor, etc.)
284
-
285
- Background agents run autonomously while the developer is away. ContextGit gives them full project context at startup via the MCP server. Their findings are committed back, so when the developer returns and opens an interactive session the next morning, the session snapshot includes everything the background agent discovered overnight.
286
-
287
- ### 6. Custom Agent Frameworks (LangChain, CrewAI, custom pipelines)
288
-
289
- Teams building their own agent pipelines call the ContextGit REST API directly. No MCP required.
290
-
291
- ```python
292
- import requests
293
-
294
- # Get session snapshot at pipeline start
295
- snapshot = requests.get(
296
- f"{CONTEXTHUB_URL}/v1/projects/{PROJECT_ID}/snapshot",
297
- headers={"Authorization": f"Bearer {API_KEY}"}
298
- ).json()
299
-
300
- agents_context = snapshot["projectSummary"]
301
-
302
- # ... run pipeline ...
303
-
304
- # Commit findings at pipeline end
305
- requests.post(
306
- f"{CONTEXTHUB_URL}/v1/projects/{PROJECT_ID}/commits",
307
- json={"message": "Pipeline run complete", "content": findings},
308
- headers={"Authorization": f"Bearer {API_KEY}"}
309
- )
310
- ```
311
-
312
- ContextGit becomes the memory backend for any orchestration framework, not just MCP-compatible tools.
313
-
314
- ---
315
-
316
- ## For the Open Source Ecosystem
317
-
318
- A developer building an open-source project publishes their context repository to ContextGit alongside their GitHub repo. The README links to both.
319
-
320
- A new contributor clones the code from GitHub and the agent context from ContextGit. Their AI coding tool — whatever it is, whatever workflow they use — immediately understands the architecture, the conventions, the known failure modes, and the active development threads.
321
-
322
- ```bash
323
- contextgit clone contextgit.dev/vercel/next.js-agent-context
324
- ```
325
-
326
- This is the flywheel. Every published context repository makes the platform more valuable. Every developer who clones a context repository has a reason to publish their own.
327
-
328
- ---
329
-
330
- ## How to Build It
331
-
332
- ### Phase 1 — Integration Core (Weeks 1–4)
333
-
334
- **Goal:** Context engine working on dual-mode persistence. Session start contract validated. All three integration interfaces (MCP, REST, CLI) functional. Validated on a real project using at least two different workflows.
335
-
336
- - Fork GCC/Aline (MIT licensed)
337
- - Build storage abstraction with LocalStore (SQLite + sqlite-vec)
338
- - Port COMMIT, BRANCH, MERGE, CONTEXT against the storage interface
339
- - Rolling summary (rule-based compression in Phase 1)
340
- - Open threads as first-class data
341
- - Git branch auto-detection and hook installer
342
- - Local vector embeddings for semantic search
343
- - MCP server: `npx contextgit init`
344
- - REST API: core context endpoints
345
- - CLI: `contextgit snapshot`, `contextgit commit`, `contextgit clone`
346
- - Validate on a real project across two workflows: interactive session + Ralph loop
347
-
348
- **The validation gate:** Does the session start snapshot orient an agent without reading any other documentation? Is AGENTS.md generated from the snapshot useful in a Ralph loop? If no to either, fix before Phase 2.
349
-
350
- **Deliverable:** All three interfaces working. Context survives across sessions, loop iterations, and tool switches. Zero infrastructure for solo use.
351
-
352
- ### Phase 2 — Multi-Agent and Team Support (Weeks 5–8)
353
-
354
- **Goal:** Multiple agents, multiple tools, multiple workflows sharing context on the same project.
355
-
356
- - RemoteStore (Postgres + pgvector) behind the same storage interface
357
- - Agent registry with roles (solo, dev, test, review, orchestrator, ci)
358
- - Namespacing: private branches and shared branches
359
- - Context sync: push local → remote, pull remote → local
360
- - CI integration: GitHub Actions example workflow
361
- - Basic auth and API keys
362
- - Project and user management
363
-
364
- **Deliverable:** Developer running interactive Claude Code sessions and Ralph loops on the same project share one context store. CI agents contribute to the same store. All workflows write to and read from the same institutional memory.
365
-
366
- ### Phase 3 — Web Platform (Weeks 9–14)
367
-
368
- **Goal:** GitHub-like interface for browsing, sharing, and discovering agent context across the ecosystem.
369
-
370
- - React web application with context repository explorer
371
- - Branch tree visualization (D3.js), aligned to git branches
372
- - Commit diff viewer — what changed, by which agent, from which workflow
373
- - Open threads panel — per project, per branch
374
- - Full-text and semantic search
375
- - Public context repositories — publish, clone, fork, star
376
- - Team dashboard — live WebSocket view of all active agents across all workflows
377
- - Session replay
378
- - User auth, project management, organization accounts
379
-
380
- **Deliverable:** Web platform where teams manage agent context visually and developers share context repositories with the world.
381
-
382
- ---
383
-
384
- ## Technical Stack
385
-
386
- | Component | Technology | Rationale |
387
- |-----------|-----------|-----------|
388
- | Context Engine | TypeScript / Node.js | Matches GCC/Aline and MCP ecosystem |
389
- | MCP Server | MCP SDK (TypeScript) | Native integration with Claude Code, Cursor |
390
- | REST API | Node.js / Express | CI, custom frameworks, non-MCP agents |
391
- | CLI | TypeScript / oclif | Ralph loops, shell scripts, automation |
392
- | LocalStore | SQLite + sqlite-vec | Zero setup, offline, solo dev |
393
- | RemoteStore | Postgres + pgvector | Concurrent writes, team + hosted |
394
- | Hosted Infra | Supabase | Postgres + pgvector + auth + realtime, free tier |
395
- | Semantic Search | Local embeddings (Phase 1), pgvector (Phase 2+) | No API key required locally |
396
- | Web Frontend | React + Tailwind + D3.js | D3 for branch/graph visualizations |
397
- | API Layer | REST + WebSocket | REST for CRUD, WebSocket for live agent activity |
398
- | Git Integration | simple-git | Branch detection, hook installation |
399
-
400
- ---
401
-
402
- ## Why This Is Defensible
403
-
404
- AI platforms — Anthropic, OpenAI, Google — will each build proprietary context management for their own tools. They will not agree on a shared standard. This creates the exact fragmentation that existed before git unified version control.
405
-
406
- ContextGit is the neutral, open-source layer that works across all of them and all workflows. Claude Code uses it. Cursor uses it. A Ralph loop uses it. A GitHub Actions pipeline uses it. A LangChain agent uses it. Whatever ships next year uses it.
407
-
408
- The moat is not the code — it is open source. The moat is:
409
-
410
- - **Accumulated knowledge** — A team's context repository is institutional memory. Migrating away means losing it.
411
- - **Workflow independence** — Works with every pattern, today and tomorrow. As new agent workflows emerge, ContextGit adds an integration interface. The memory layer stays the same.
412
- - **Network effects** — Public context repositories create discovery and sharing loops across the ecosystem.
413
- - **Community contributions** — Context templates, workflow-specific integrations, best practices contributed by the community compound over time.
414
-
415
- The longer-term hedge: context windows are getting larger. If vendors partially solve session memory natively within their own tools, the cross-tool, cross-workflow, cross-team knowledge graph becomes the headline value. That story is already in the product.
416
-
417
- ---
418
-
419
- ## Business Model
420
-
421
- Open-source core with commercial hosting:
422
-
423
- | Tier | Offering | Price |
424
- |------|----------|-------|
425
- | Open Source | CLI + MCP server + REST API + LocalStore + single-project web UI | Free forever |
426
- | Team | Hosted RemoteStore, team management, SSO, shared dashboards, private repos, CI integration | $15/user/month |
427
- | Enterprise | On-prem deployment, audit logs, compliance, SLA, priority support | Custom |
428
-
429
- Public context repositories are always free. The network effect depends on it.
430
-
431
- ---
432
-
433
- ## Open Source Strategy
434
-
435
- ContextGit is built on GCC/Aline (MIT licensed):
436
-
437
- - **Credit prominently** — Acknowledge GCC/Aline in the README, docs, and website.
438
- - **Contribute upstream** — Generic improvements to the context engine go back to GCC.
439
- - **MIT license the core** — Anyone can use, fork, and modify.
440
- - **Engage both communities** — GCC maintainers and the Ralph Wiggum community. Both are natural early adopters and potential contributors.
441
- - **Commercial layer is additive** — Paid tiers offer hosting and team features. Core functionality is never restricted.
442
-
443
- ---
444
-
445
- ## Success Criteria
446
-
447
- ### 30 Days
448
- - All three interfaces working: MCP, REST, CLI
449
- - Session start contract validated across two workflows (interactive + Ralph)
450
- - AGENTS.md generation from snapshot working and useful in a real Ralph loop
451
- - GitHub repo with README and architecture documentation
452
-
453
- ### 90 Days
454
- - RemoteStore live with Postgres + pgvector
455
- - CI integration with GitHub Actions example
456
- - Multi-agent support — orchestrator + dev + test on same project
457
- - Web UI prototype with branch visualization and open threads panel
458
- - 50+ GitHub stars, 3 external contributors
459
-
460
- ### 6 Months
461
- - Public context repositories live — publish and clone end to end
462
- - 500+ GitHub stars
463
- - Beta of hosted team product
464
- - 10 teams actively using across multiple workflow types
465
- - Featured in Ralph Wiggum and Claude Code communities
466
-
467
- ---
468
-
469
- ## Risks and Mitigations
470
-
471
- | Risk | Likelihood | Mitigation |
472
- |------|-----------|-----------|
473
- | Rolling summary drops important decisions over time | High | Versioned summary history — every summary stored, never overwritten. Raw commits always searchable. Open threads immune to compression. |
474
- | Platform vendors build native context management | High | Cross-tool, cross-workflow, open-source by design. Vendor solutions are siloed — increases demand for a neutral layer. |
475
- | Fragmented adoption — different teams use different workflows | Medium | Workflow-agnostic design is the answer. One memory layer, many integration points. Not a risk, it is the positioning. |
476
- | Low adoption in a crowded AI tooling space | Medium | Ralph community and Claude Code power users are the natural beachhead. Concrete value prop: AGENTS.md auto-generated, never stale. |
477
- | GCC approach doesn't scale beyond benchmark tasks | Medium | Validate on real 6+ week project in Phase 1. Hybrid retrieval is the fallback. |
478
- | Agent-cooperation in interactive sessions | Low | Ralph's loop enforces commits mechanically. For interactive sessions, background snapshotting and system prompt injection are the fallback. Validated in Phase 1. |
479
-
480
- ---
481
-
482
- **Ready to build this?**
483
-
484
- Phase 1 is four weeks. Three integration interfaces. One validation question: does the session start snapshot orient an agent without reading any other documentation, across at least two different workflows?
485
-
486
- Everything else follows from that answer.
487
-
488
- Let's talk.