research-git 0.0.1__tar.gz

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 (81) hide show
  1. research_git-0.0.1/LICENSE +21 -0
  2. research_git-0.0.1/PKG-INFO +215 -0
  3. research_git-0.0.1/README.md +189 -0
  4. research_git-0.0.1/pyproject.toml +52 -0
  5. research_git-0.0.1/setup.cfg +4 -0
  6. research_git-0.0.1/src/research_git.egg-info/PKG-INFO +215 -0
  7. research_git-0.0.1/src/research_git.egg-info/SOURCES.txt +79 -0
  8. research_git-0.0.1/src/research_git.egg-info/dependency_links.txt +1 -0
  9. research_git-0.0.1/src/research_git.egg-info/entry_points.txt +2 -0
  10. research_git-0.0.1/src/research_git.egg-info/requires.txt +5 -0
  11. research_git-0.0.1/src/research_git.egg-info/top_level.txt +1 -0
  12. research_git-0.0.1/src/rgit/__init__.py +1 -0
  13. research_git-0.0.1/src/rgit/_plugin/.claude-plugin/marketplace.json +15 -0
  14. research_git-0.0.1/src/rgit/_plugin/.claude-plugin/plugin.json +14 -0
  15. research_git-0.0.1/src/rgit/_plugin/agents/capsule-regenerator.md +70 -0
  16. research_git-0.0.1/src/rgit/_plugin/agents/capsule-segmenter.md +58 -0
  17. research_git-0.0.1/src/rgit/_plugin/agents/edge-judge.md +59 -0
  18. research_git-0.0.1/src/rgit/_plugin/skills/rgit-capture/SKILL.md +95 -0
  19. research_git-0.0.1/src/rgit/_plugin/skills/rgit-recall/SKILL.md +54 -0
  20. research_git-0.0.1/src/rgit/ablation.py +70 -0
  21. research_git-0.0.1/src/rgit/agent_guidance.py +169 -0
  22. research_git-0.0.1/src/rgit/agent_platforms.py +49 -0
  23. research_git-0.0.1/src/rgit/astmap.py +106 -0
  24. research_git-0.0.1/src/rgit/cli.py +417 -0
  25. research_git-0.0.1/src/rgit/compare.py +125 -0
  26. research_git-0.0.1/src/rgit/compose.py +48 -0
  27. research_git-0.0.1/src/rgit/curation.py +48 -0
  28. research_git-0.0.1/src/rgit/edges.py +75 -0
  29. research_git-0.0.1/src/rgit/gitutil.py +112 -0
  30. research_git-0.0.1/src/rgit/graphview.py +238 -0
  31. research_git-0.0.1/src/rgit/hooks.py +64 -0
  32. research_git-0.0.1/src/rgit/installer.py +248 -0
  33. research_git-0.0.1/src/rgit/mcp_server.py +75 -0
  34. research_git-0.0.1/src/rgit/metricdir.py +43 -0
  35. research_git-0.0.1/src/rgit/metrics.py +28 -0
  36. research_git-0.0.1/src/rgit/provenance.py +95 -0
  37. research_git-0.0.1/src/rgit/ranking.py +55 -0
  38. research_git-0.0.1/src/rgit/recall.py +41 -0
  39. research_git-0.0.1/src/rgit/runner.py +48 -0
  40. research_git-0.0.1/src/rgit/segmenter.py +103 -0
  41. research_git-0.0.1/src/rgit/store/__init__.py +0 -0
  42. research_git-0.0.1/src/rgit/store/db.py +75 -0
  43. research_git-0.0.1/src/rgit/store/ids.py +5 -0
  44. research_git-0.0.1/src/rgit/store/models.py +92 -0
  45. research_git-0.0.1/src/rgit/store/objects.py +32 -0
  46. research_git-0.0.1/src/rgit/store/store.py +216 -0
  47. research_git-0.0.1/src/rgit/tables.py +31 -0
  48. research_git-0.0.1/src/rgit/toggles.py +84 -0
  49. research_git-0.0.1/src/rgit/watch.py +51 -0
  50. research_git-0.0.1/tests/test_ablation.py +60 -0
  51. research_git-0.0.1/tests/test_active_edges.py +36 -0
  52. research_git-0.0.1/tests/test_agent_guidance.py +165 -0
  53. research_git-0.0.1/tests/test_astmap.py +57 -0
  54. research_git-0.0.1/tests/test_cli.py +415 -0
  55. research_git-0.0.1/tests/test_compare.py +64 -0
  56. research_git-0.0.1/tests/test_compose.py +71 -0
  57. research_git-0.0.1/tests/test_curation.py +100 -0
  58. research_git-0.0.1/tests/test_db.py +41 -0
  59. research_git-0.0.1/tests/test_e2e.py +60 -0
  60. research_git-0.0.1/tests/test_edges.py +71 -0
  61. research_git-0.0.1/tests/test_gitutil.py +96 -0
  62. research_git-0.0.1/tests/test_graphview.py +270 -0
  63. research_git-0.0.1/tests/test_guidance_coupling.py +38 -0
  64. research_git-0.0.1/tests/test_hooks.py +78 -0
  65. research_git-0.0.1/tests/test_installer.py +315 -0
  66. research_git-0.0.1/tests/test_mcp_server.py +83 -0
  67. research_git-0.0.1/tests/test_metricdir.py +37 -0
  68. research_git-0.0.1/tests/test_metricdir_store.py +36 -0
  69. research_git-0.0.1/tests/test_metrics.py +33 -0
  70. research_git-0.0.1/tests/test_models.py +30 -0
  71. research_git-0.0.1/tests/test_objects.py +16 -0
  72. research_git-0.0.1/tests/test_provenance.py +69 -0
  73. research_git-0.0.1/tests/test_ranking.py +42 -0
  74. research_git-0.0.1/tests/test_recall.py +63 -0
  75. research_git-0.0.1/tests/test_review_fixes.py +131 -0
  76. research_git-0.0.1/tests/test_runner.py +85 -0
  77. research_git-0.0.1/tests/test_segmenter.py +71 -0
  78. research_git-0.0.1/tests/test_store.py +119 -0
  79. research_git-0.0.1/tests/test_tables.py +34 -0
  80. research_git-0.0.1/tests/test_toggles.py +61 -0
  81. research_git-0.0.1/tests/test_watch.py +37 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Stepzero Lab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,215 @@
1
+ Metadata-Version: 2.4
2
+ Name: research-git
3
+ Version: 0.0.1
4
+ Summary: A memory system that captures code ideas as semantic capsules you can regenerate onto today's codebase
5
+ Author: Stepzero Lab
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/StepzeroLab/research-git
8
+ Project-URL: Repository, https://github.com/StepzeroLab/research-git
9
+ Project-URL: Issues, https://github.com/StepzeroLab/research-git/issues
10
+ Keywords: research,idea-memory,code-memory,knowledge-graph,feature-capsule
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Topic :: Software Development :: Version Control :: Git
18
+ Requires-Python: >=3.11
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: libcst>=1.1
22
+ Requires-Dist: mcp>=1.2
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest>=8.0; extra == "dev"
25
+ Dynamic: license-file
26
+
27
+ <h1 align="center">research-git</h1>
28
+
29
+ <p align="center">
30
+ <strong>Capture a code idea as a clean semantic unit โ€” regenerate it onto today's codebase.</strong>
31
+ <br />
32
+ <em>Works with Claude Code, and any MCP-capable client (Codex, GPT, โ€ฆ).</em>
33
+ </p>
34
+
35
+ <p align="center">
36
+ <a href="#-quick-start"><img src="https://img.shields.io/badge/Quick_Start-blue" alt="Quick Start" /></a>
37
+ <img src="https://img.shields.io/badge/License-MIT-yellow" alt="License: MIT" />
38
+ <img src="https://img.shields.io/badge/Claude_Code-8A2BE2" alt="Claude Code" />
39
+ <img src="https://img.shields.io/badge/Python-3.11+-3776AB" alt="Python 3.11+" />
40
+ </p>
41
+
42
+ <p align="center">
43
+ <strong>Git recovers history. It can't recover an entangled idea onto today's code.</strong>
44
+ </p>
45
+
46
+ ---
47
+
48
+ **You're deep into building an agent. You've tried twenty things โ€” a restructured system prompt, splitting one overloaded tool into three, a re-ranking step before retrieval, a scratchpad for intermediate reasoning, two different few-shot sets โ€” half of them commented in and out, all tangled together in one working tree. Now you want *one* of those ideas back. Not the stale commit it lived in. The idea itself, re-applied to the agent you have today.**
49
+
50
+ Git can't do that. Its unit is a *tree snapshot*, not an *idea*. `git checkout` drags back everything from that moment and throws away all the infrastructure you've built since. You can't pull one feature forward without rolling back the rest.
51
+
52
+ research-git makes the **idea** the unit. It captures each change as a self-contained **Feature Capsule**, stores it in a graph, and โ€” when you want it back โ€” *regenerates* it onto your current code instead of pasting a stale patch. The capsule is a specification of intent; the code is always rebuilt against today's reality.
53
+
54
+ The intelligent steps (segmenting a diff into capsules, regenerating one onto changed code) run as **subagents on your existing Claude subscription** โ€” there is **no pay-per-use API** anywhere.
55
+
56
+ ---
57
+
58
+ ## How it works
59
+
60
+ One loop: capture each idea into a graph, then regenerate it onto today's code. The engine (blue) is free and deterministic; intelligence happens at exactly two points (green) โ€” subagents dispatched onto your existing subscription, never a paid API.
61
+
62
+ ```mermaid
63
+ flowchart LR
64
+ A["edit code /<br/>rgit run -- ..."] -->|"free, deterministic"| B["raw proposal<br/>(diff staged)"]
65
+ B -->|"/rgit-capture"| C{{"capsule-<br/>segmenter"}}
66
+ C --> D[("Feature Capsule<br/>graph (.rgit/)")]
67
+ D -->|"/rgit-recall ยซqueryยป"| E["compose brief vs<br/>today's code"]
68
+ E --> F{{"capsule-<br/>regenerator"}}
69
+ F --> G["reviewable diff<br/>on today's code"]
70
+ G -.->|"rgit run โ€” freeze + link variant"| D
71
+
72
+ classDef engine fill:#eef2ff,stroke:#5b6cff,color:#1e2a78;
73
+ classDef agent fill:#eafff0,stroke:#36a85f,color:#0f5132;
74
+ class A,B,D,E,G engine;
75
+ class C,F agent;
76
+ ```
77
+
78
+ ---
79
+
80
+ ## The Feature Capsule
81
+
82
+ Every idea you keep becomes one capsule โ€” a self-contained unit a future agent can read and bring back:
83
+
84
+ | Field | What it holds |
85
+ |-------|---------------|
86
+ | **intent** | why this change existed โ€” the hypothesis, not a diff restatement |
87
+ | **code slices** | the relevant snippets / files / symbols |
88
+ | **knobs** | parameters / flags / configs |
89
+ | **dependencies** | other capsules it needs + silent assumptions |
90
+ | **result** | metrics / notes / why it worked or didn't, linked to the runs it produced |
91
+ | **resurrection guide** | how to regenerate it onto a changed codebase |
92
+
93
+ Capsules live in a small graph beside your repo (`.rgit/`), on top of normal git. Every run you launch through research-git also freezes a **byte-exact, content-addressed snapshot** of the code that ran โ€” so "the code behind this result" is always a perfect replay, never at the mercy of an agent.
94
+
95
+ ---
96
+
97
+ ## ๐Ÿš€ Quick Start
98
+
99
+ Five steps: install โ†’ init โ†’ run โ†’ capture โ†’ recall.
100
+
101
+ ### 1. Install
102
+
103
+ ```bash
104
+ pip install research-git # or, from a clone: pip install -e .
105
+
106
+ # wire the plugin (agents + skills) and the MCP server into your client
107
+ rgit install claude-code # Claude Code (via the official `claude` CLI)
108
+ rgit install codex # Codex / Gemini / opencode: symlinks the skills into ~/.agents/skills/
109
+ rgit install --list # all platforms; add --dry-run to preview, --uninstall to remove
110
+ ```
111
+
112
+ `codex`, `gemini`, and `opencode` share the `~/.agents/skills/` convention โ€” the installer symlinks each skill there and prints the one-line MCP server entry to drop into that client's config. It also writes a managed research-git guidance block into the client's global guidance file when the platform has one (`~/.codex/AGENTS.md`, `~/.claude/CLAUDE.md`, or `~/.gemini/GEMINI.md`). On an interactive terminal you're asked how proactive capture should be โ€” `default`, `manual-only`, or `none`; pass `--guidance <mode>` to choose non-interactively. Start a new agent session after install so the guidance is loaded. Prefer the manual route on Claude Code? `/plugin marketplace add StepzeroLab/research-git` then `/plugin install research-git@research-git`.
113
+
114
+ ### 2. Initialize in your repo
115
+
116
+ ```bash
117
+ cd your-project
118
+ rgit init # creates .rgit/ (the store) at the git root
119
+ ```
120
+
121
+ ### 3. Run a variation and capture the idea
122
+
123
+ Launch your work through `rgit run` โ€” it executes your command, freezes a reproducible artifact, records the run + any metrics, and stages what changed:
124
+
125
+ ```bash
126
+ rgit run -- python eval_agent.py --retrieval rerank
127
+ ```
128
+
129
+ Then turn that raw material into a clean capsule (in a Claude Code session):
130
+
131
+ ```
132
+ /rgit-capture # segments the diff into Feature Capsules, then wires up graph edges
133
+ rgit review # list proposals
134
+ rgit review --approve <proposal_id> --name rerank-retrieval
135
+ ```
136
+
137
+ ### 4. Bring an idea back onto today's code
138
+
139
+ Weeks later, after the agent has moved on:
140
+
141
+ ```
142
+ /rgit-recall bring back the re-ranking retrieval step
143
+ ```
144
+
145
+ Recall scores capsules against your query, surfaces each hit with its related neighbors, then dispatches a subagent that *re-implements* the idea onto today's structure โ€” adapting to refactors and leaving you a reviewable diff.
146
+
147
+ That's the whole loop. The rest of the commands you'll meet as you need them โ€” see [More commands](#more-commands).
148
+
149
+ ---
150
+
151
+ ## ๐Ÿงฉ Where it fits
152
+
153
+ Anywhere you try many variations of one thing and later want a single one back โ€” cleanly, on top of how the code looks now.
154
+
155
+ - ๐Ÿค– **Agent / Prompt engineering** โ€” you tried four prompt structures, two tool-splitting schemes, and a different retrieval step. Last week's version scored better; bring *that* idea back onto the agent you've since rewritten.
156
+ - โš™๏ธ **Backend / Systems** โ€” three caching strategies, two rate-limiters, a reworked query plan. Which won? Pull the winning variant forward without reverting everything built since.
157
+ - ๐ŸŽจ **Frontend** โ€” competing interaction flows and layout variants, half commented out. Resurrect the one that tested best onto the current component tree.
158
+
159
+ Also at home in ML research โ€” different loss terms, attention blocks, augmentations. Same shape: the experiment is the idea, the metrics are the result, and you want one variant back on today's code.
160
+
161
+ ---
162
+
163
+ ## ๐Ÿค Share the memory with your team
164
+
165
+ The graph is served over MCP **read-only** (`recall` / `compose` / `get`, plus the query commands `compare` / `ablation` / `provenance`). Point a teammate's client at your `rgit mcp` server and they get the same Feature Capsules and the same answers โ€” then *their* session regenerates an idea onto *their* code, on *their* subscription. The memory is shared; the intelligence is local.
166
+
167
+ ---
168
+
169
+ ## ๐Ÿ”ง Under the Hood
170
+
171
+ ### Build the memory, borrow the agent
172
+
173
+ The engine owns the durable, deterministic parts โ€” the graph, content-addressed object store, git diffing, and the byte-exact run freeze. The agentic parts are delegated to subagents the host already provides. We don't reimplement an agent loop, and we never call a paid API.
174
+
175
+ ### Two-phase capture
176
+
177
+ A free, deterministic Phase 1 (`libcst` maps diff hunks to the functions/classes they touch) produces a rough candidate for every change. Phase 2 is a dispatched `capsule-segmenter` subagent that clusters the diff into coherent features, drops infrastructure noise, and writes the real intent, knobs, assumptions, and resurrection guide. Once a capsule is approved, the engine deterministically links same-region edges and over-produces `depends_on` candidates from name overlap, which an `edge-judge` subagent confirms or rejects.
178
+
179
+ ### Ranked, edge-aware recall
180
+
181
+ Recall scores every approved capsule against your query in plain Python โ€” no embeddings, no SQL `LIKE` traps โ€” and boosts a hit when a connected capsule also matches, so related work surfaces together. Each result carries its related subgraph.
182
+
183
+ ### Two planes
184
+
185
+ - **MCP โ€” shared memory (query-only).** Returns graph snippets; safe to expose so a team shares one memory. Carries no intelligence.
186
+ - **Plugin โ€” local intelligence.** Three subagents (`capsule-segmenter`, `capsule-regenerator`, `edge-judge`) and two skills (`rgit-capture`, `rgit-recall`) define *how* a session acts on those snippets, natively, on its own subscription.
187
+
188
+ ### Reproducibility contract
189
+
190
+ The agent helps you *author*; it is never in the *replay* path. `rgit run` freezes the exact bytes that ran, content-addressed and immutable. "The code behind run X" is a byte-identical re-materialization of a stored blob.
191
+
192
+ ---
193
+
194
+ ## More commands
195
+
196
+ The five-step loop above is the core. These show up as your store grows โ€” run `rgit <command> --help` for any of them:
197
+
198
+ | Command | What it does |
199
+ |---------|--------------|
200
+ | `rgit watch` | free, deterministic background capture โ€” stages raw material as you edit, so fleeting in-between states aren't lost |
201
+ | `rgit install-hooks` | stage on every commit via a post-commit hook (won't touch an existing hook) |
202
+ | `rgit run --from <capsule>` | run a recalled variant and link the new run as a `variant_of` the original |
203
+ | `rgit compare <query>` | which variant won: ranked table, ฮ” vs baseline, โ˜… winner |
204
+ | `rgit provenance <run_id>` | per-feature clean (capsule) vs agent-adapted (frozen) diff for a run |
205
+ | `rgit mcp` | serve the graph read-only so a teammate's client can recall against it |
206
+
207
+ ---
208
+
209
+ ## License
210
+
211
+ <p align="center">
212
+ <strong>MIT</strong> ยฉ Stepzero Lab
213
+ <br />
214
+ <sub>Core contributors: Yuxiang Lin ยท Fengrong Wan ยท Jiajun Sun</sub>
215
+ </p>
@@ -0,0 +1,189 @@
1
+ <h1 align="center">research-git</h1>
2
+
3
+ <p align="center">
4
+ <strong>Capture a code idea as a clean semantic unit โ€” regenerate it onto today's codebase.</strong>
5
+ <br />
6
+ <em>Works with Claude Code, and any MCP-capable client (Codex, GPT, โ€ฆ).</em>
7
+ </p>
8
+
9
+ <p align="center">
10
+ <a href="#-quick-start"><img src="https://img.shields.io/badge/Quick_Start-blue" alt="Quick Start" /></a>
11
+ <img src="https://img.shields.io/badge/License-MIT-yellow" alt="License: MIT" />
12
+ <img src="https://img.shields.io/badge/Claude_Code-8A2BE2" alt="Claude Code" />
13
+ <img src="https://img.shields.io/badge/Python-3.11+-3776AB" alt="Python 3.11+" />
14
+ </p>
15
+
16
+ <p align="center">
17
+ <strong>Git recovers history. It can't recover an entangled idea onto today's code.</strong>
18
+ </p>
19
+
20
+ ---
21
+
22
+ **You're deep into building an agent. You've tried twenty things โ€” a restructured system prompt, splitting one overloaded tool into three, a re-ranking step before retrieval, a scratchpad for intermediate reasoning, two different few-shot sets โ€” half of them commented in and out, all tangled together in one working tree. Now you want *one* of those ideas back. Not the stale commit it lived in. The idea itself, re-applied to the agent you have today.**
23
+
24
+ Git can't do that. Its unit is a *tree snapshot*, not an *idea*. `git checkout` drags back everything from that moment and throws away all the infrastructure you've built since. You can't pull one feature forward without rolling back the rest.
25
+
26
+ research-git makes the **idea** the unit. It captures each change as a self-contained **Feature Capsule**, stores it in a graph, and โ€” when you want it back โ€” *regenerates* it onto your current code instead of pasting a stale patch. The capsule is a specification of intent; the code is always rebuilt against today's reality.
27
+
28
+ The intelligent steps (segmenting a diff into capsules, regenerating one onto changed code) run as **subagents on your existing Claude subscription** โ€” there is **no pay-per-use API** anywhere.
29
+
30
+ ---
31
+
32
+ ## How it works
33
+
34
+ One loop: capture each idea into a graph, then regenerate it onto today's code. The engine (blue) is free and deterministic; intelligence happens at exactly two points (green) โ€” subagents dispatched onto your existing subscription, never a paid API.
35
+
36
+ ```mermaid
37
+ flowchart LR
38
+ A["edit code /<br/>rgit run -- ..."] -->|"free, deterministic"| B["raw proposal<br/>(diff staged)"]
39
+ B -->|"/rgit-capture"| C{{"capsule-<br/>segmenter"}}
40
+ C --> D[("Feature Capsule<br/>graph (.rgit/)")]
41
+ D -->|"/rgit-recall ยซqueryยป"| E["compose brief vs<br/>today's code"]
42
+ E --> F{{"capsule-<br/>regenerator"}}
43
+ F --> G["reviewable diff<br/>on today's code"]
44
+ G -.->|"rgit run โ€” freeze + link variant"| D
45
+
46
+ classDef engine fill:#eef2ff,stroke:#5b6cff,color:#1e2a78;
47
+ classDef agent fill:#eafff0,stroke:#36a85f,color:#0f5132;
48
+ class A,B,D,E,G engine;
49
+ class C,F agent;
50
+ ```
51
+
52
+ ---
53
+
54
+ ## The Feature Capsule
55
+
56
+ Every idea you keep becomes one capsule โ€” a self-contained unit a future agent can read and bring back:
57
+
58
+ | Field | What it holds |
59
+ |-------|---------------|
60
+ | **intent** | why this change existed โ€” the hypothesis, not a diff restatement |
61
+ | **code slices** | the relevant snippets / files / symbols |
62
+ | **knobs** | parameters / flags / configs |
63
+ | **dependencies** | other capsules it needs + silent assumptions |
64
+ | **result** | metrics / notes / why it worked or didn't, linked to the runs it produced |
65
+ | **resurrection guide** | how to regenerate it onto a changed codebase |
66
+
67
+ Capsules live in a small graph beside your repo (`.rgit/`), on top of normal git. Every run you launch through research-git also freezes a **byte-exact, content-addressed snapshot** of the code that ran โ€” so "the code behind this result" is always a perfect replay, never at the mercy of an agent.
68
+
69
+ ---
70
+
71
+ ## ๐Ÿš€ Quick Start
72
+
73
+ Five steps: install โ†’ init โ†’ run โ†’ capture โ†’ recall.
74
+
75
+ ### 1. Install
76
+
77
+ ```bash
78
+ pip install research-git # or, from a clone: pip install -e .
79
+
80
+ # wire the plugin (agents + skills) and the MCP server into your client
81
+ rgit install claude-code # Claude Code (via the official `claude` CLI)
82
+ rgit install codex # Codex / Gemini / opencode: symlinks the skills into ~/.agents/skills/
83
+ rgit install --list # all platforms; add --dry-run to preview, --uninstall to remove
84
+ ```
85
+
86
+ `codex`, `gemini`, and `opencode` share the `~/.agents/skills/` convention โ€” the installer symlinks each skill there and prints the one-line MCP server entry to drop into that client's config. It also writes a managed research-git guidance block into the client's global guidance file when the platform has one (`~/.codex/AGENTS.md`, `~/.claude/CLAUDE.md`, or `~/.gemini/GEMINI.md`). On an interactive terminal you're asked how proactive capture should be โ€” `default`, `manual-only`, or `none`; pass `--guidance <mode>` to choose non-interactively. Start a new agent session after install so the guidance is loaded. Prefer the manual route on Claude Code? `/plugin marketplace add StepzeroLab/research-git` then `/plugin install research-git@research-git`.
87
+
88
+ ### 2. Initialize in your repo
89
+
90
+ ```bash
91
+ cd your-project
92
+ rgit init # creates .rgit/ (the store) at the git root
93
+ ```
94
+
95
+ ### 3. Run a variation and capture the idea
96
+
97
+ Launch your work through `rgit run` โ€” it executes your command, freezes a reproducible artifact, records the run + any metrics, and stages what changed:
98
+
99
+ ```bash
100
+ rgit run -- python eval_agent.py --retrieval rerank
101
+ ```
102
+
103
+ Then turn that raw material into a clean capsule (in a Claude Code session):
104
+
105
+ ```
106
+ /rgit-capture # segments the diff into Feature Capsules, then wires up graph edges
107
+ rgit review # list proposals
108
+ rgit review --approve <proposal_id> --name rerank-retrieval
109
+ ```
110
+
111
+ ### 4. Bring an idea back onto today's code
112
+
113
+ Weeks later, after the agent has moved on:
114
+
115
+ ```
116
+ /rgit-recall bring back the re-ranking retrieval step
117
+ ```
118
+
119
+ Recall scores capsules against your query, surfaces each hit with its related neighbors, then dispatches a subagent that *re-implements* the idea onto today's structure โ€” adapting to refactors and leaving you a reviewable diff.
120
+
121
+ That's the whole loop. The rest of the commands you'll meet as you need them โ€” see [More commands](#more-commands).
122
+
123
+ ---
124
+
125
+ ## ๐Ÿงฉ Where it fits
126
+
127
+ Anywhere you try many variations of one thing and later want a single one back โ€” cleanly, on top of how the code looks now.
128
+
129
+ - ๐Ÿค– **Agent / Prompt engineering** โ€” you tried four prompt structures, two tool-splitting schemes, and a different retrieval step. Last week's version scored better; bring *that* idea back onto the agent you've since rewritten.
130
+ - โš™๏ธ **Backend / Systems** โ€” three caching strategies, two rate-limiters, a reworked query plan. Which won? Pull the winning variant forward without reverting everything built since.
131
+ - ๐ŸŽจ **Frontend** โ€” competing interaction flows and layout variants, half commented out. Resurrect the one that tested best onto the current component tree.
132
+
133
+ Also at home in ML research โ€” different loss terms, attention blocks, augmentations. Same shape: the experiment is the idea, the metrics are the result, and you want one variant back on today's code.
134
+
135
+ ---
136
+
137
+ ## ๐Ÿค Share the memory with your team
138
+
139
+ The graph is served over MCP **read-only** (`recall` / `compose` / `get`, plus the query commands `compare` / `ablation` / `provenance`). Point a teammate's client at your `rgit mcp` server and they get the same Feature Capsules and the same answers โ€” then *their* session regenerates an idea onto *their* code, on *their* subscription. The memory is shared; the intelligence is local.
140
+
141
+ ---
142
+
143
+ ## ๐Ÿ”ง Under the Hood
144
+
145
+ ### Build the memory, borrow the agent
146
+
147
+ The engine owns the durable, deterministic parts โ€” the graph, content-addressed object store, git diffing, and the byte-exact run freeze. The agentic parts are delegated to subagents the host already provides. We don't reimplement an agent loop, and we never call a paid API.
148
+
149
+ ### Two-phase capture
150
+
151
+ A free, deterministic Phase 1 (`libcst` maps diff hunks to the functions/classes they touch) produces a rough candidate for every change. Phase 2 is a dispatched `capsule-segmenter` subagent that clusters the diff into coherent features, drops infrastructure noise, and writes the real intent, knobs, assumptions, and resurrection guide. Once a capsule is approved, the engine deterministically links same-region edges and over-produces `depends_on` candidates from name overlap, which an `edge-judge` subagent confirms or rejects.
152
+
153
+ ### Ranked, edge-aware recall
154
+
155
+ Recall scores every approved capsule against your query in plain Python โ€” no embeddings, no SQL `LIKE` traps โ€” and boosts a hit when a connected capsule also matches, so related work surfaces together. Each result carries its related subgraph.
156
+
157
+ ### Two planes
158
+
159
+ - **MCP โ€” shared memory (query-only).** Returns graph snippets; safe to expose so a team shares one memory. Carries no intelligence.
160
+ - **Plugin โ€” local intelligence.** Three subagents (`capsule-segmenter`, `capsule-regenerator`, `edge-judge`) and two skills (`rgit-capture`, `rgit-recall`) define *how* a session acts on those snippets, natively, on its own subscription.
161
+
162
+ ### Reproducibility contract
163
+
164
+ The agent helps you *author*; it is never in the *replay* path. `rgit run` freezes the exact bytes that ran, content-addressed and immutable. "The code behind run X" is a byte-identical re-materialization of a stored blob.
165
+
166
+ ---
167
+
168
+ ## More commands
169
+
170
+ The five-step loop above is the core. These show up as your store grows โ€” run `rgit <command> --help` for any of them:
171
+
172
+ | Command | What it does |
173
+ |---------|--------------|
174
+ | `rgit watch` | free, deterministic background capture โ€” stages raw material as you edit, so fleeting in-between states aren't lost |
175
+ | `rgit install-hooks` | stage on every commit via a post-commit hook (won't touch an existing hook) |
176
+ | `rgit run --from <capsule>` | run a recalled variant and link the new run as a `variant_of` the original |
177
+ | `rgit compare <query>` | which variant won: ranked table, ฮ” vs baseline, โ˜… winner |
178
+ | `rgit provenance <run_id>` | per-feature clean (capsule) vs agent-adapted (frozen) diff for a run |
179
+ | `rgit mcp` | serve the graph read-only so a teammate's client can recall against it |
180
+
181
+ ---
182
+
183
+ ## License
184
+
185
+ <p align="center">
186
+ <strong>MIT</strong> ยฉ Stepzero Lab
187
+ <br />
188
+ <sub>Core contributors: Yuxiang Lin ยท Fengrong Wan ยท Jiajun Sun</sub>
189
+ </p>
@@ -0,0 +1,52 @@
1
+ [project]
2
+ name = "research-git"
3
+ version = "0.0.1"
4
+ description = "A memory system that captures code ideas as semantic capsules you can regenerate onto today's codebase"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ authors = [{ name = "Stepzero Lab" }]
9
+ requires-python = ">=3.11"
10
+ keywords = ["research", "idea-memory", "code-memory", "knowledge-graph", "feature-capsule"]
11
+ classifiers = [
12
+ "Development Status :: 3 - Alpha",
13
+ "Intended Audience :: Developers",
14
+ "Programming Language :: Python :: 3",
15
+ "Programming Language :: Python :: 3.11",
16
+ "Programming Language :: Python :: 3.12",
17
+ "Operating System :: OS Independent",
18
+ "Topic :: Software Development :: Version Control :: Git",
19
+ ]
20
+ dependencies = [
21
+ "libcst>=1.1",
22
+ "mcp>=1.2",
23
+ ]
24
+
25
+ [project.optional-dependencies]
26
+ dev = ["pytest>=8.0"]
27
+
28
+ [project.urls]
29
+ Homepage = "https://github.com/StepzeroLab/research-git"
30
+ Repository = "https://github.com/StepzeroLab/research-git"
31
+ Issues = "https://github.com/StepzeroLab/research-git/issues"
32
+
33
+ [project.scripts]
34
+ rgit = "rgit.cli:main"
35
+
36
+ [build-system]
37
+ requires = ["setuptools>=77"]
38
+ build-backend = "setuptools.build_meta"
39
+
40
+ [tool.setuptools.packages.find]
41
+ where = ["src"]
42
+
43
+ [tool.setuptools.package-data]
44
+ rgit = [
45
+ "_plugin/agents/*.md",
46
+ "_plugin/skills/*/*.md",
47
+ "_plugin/.claude-plugin/*.json",
48
+ ]
49
+
50
+ [tool.pytest.ini_options]
51
+ pythonpath = ["src"]
52
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+