Skip to content

Repository files navigation

research-git logo   research-git

Reapply or remove previous experiments & features safely on today’s code.
Works with Claude Code, Codex, Gemini CLI, and opencode.

Quick Start License: MIT Claude Code Codex Python 3.11+

research-git capture and removal workflow in Codex

research-git is a new Git tool for researchers and developers, built for the agentic coding era.

It captures important experiments and feature decisions as reusable semantic units, links experimental results to the code that produced them, and helps coding agents reapply, adapt, or safely remove earlier ideas on today’s codebase.

Why research-git

AI coding tools can generate many different experiments and features in a day. But when you try to reintroduce a previously removed experiment just a few days later, the codebase may have changed so much that the experiment no longer fits the current infrastructure.

Traditional Git preserves commits and diffs, but it does not preserve the context behind them. It cannot tell an agent which changes belong to an experiment, why they were made, what assumptions they depended on, or what results they produced. Without that context, reverting may erase later work, replaying an old diff may fail against a changed architecture, and removing a feature may damage shared infrastructure.

research-git records experiments and feature decisions as reusable Capsules, capturing their intent, relevant code, dependencies, configuration, and restoration guidance. It also links experimental results to the exact code that produced them. This gives coding agents the context to safely reapply or remove earlier ideas on today's codebase without restoring an old snapshot or deleting code piece by piece.

The context problem of traditional Git

Quick Start

Note

We publish a new research-git release after major iterations. Keep research-git updated.

1. Install

pip install research-git
rgit install                # wires research-git into every agent client on this machine
cd your-project
rgit init                   # creates the .rgit/ store in your repo

Installation takes less than 30 seconds. Restart your coding agent afterwards so it loads research-git.

Install details: choosing platforms, guidance modes, capture-on-commit
  • rgit install claude-code (or codex / gemini / opencode / generic) targets one client; --list shows all; --uninstall removes.
  • The installer also writes a short guidance block into your client's global file (~/.claude/CLAUDE.md, ~/.codex/AGENTS.md, …) so the agent knows when to save ideas. On an interactive terminal you pick how proactive that should be (default / manual-only / none); pass --guidance <mode> to choose non-interactively.
  • Optional: rgit install-hooks (per repo) makes every git commit stage its own snapshot automatically, so nothing slips through even when you forget. It never touches an existing hook, hooks never approve anything, and rgit install-hooks --uninstall removes it. Skip it in CI or shared clones.
  • Manual route on Claude Code: /plugin marketplace add StepzeroLab/research-git then /plugin install research-git@research-git.

2. Working with an agent? Just talk to it

If your repository already has history, let your agent run the rgit-digest skill. It turns earlier work into Capsules, giving recall something to find from day one.

Agent prompt: @research-git:rgit-digest Digest this repository's history.

After install your agent does the remembering. Work as usual. It saves each meaningful idea as a Feature Capsule and asks you before anything is kept. Weeks later, when the code has moved on, just ask:

Agent prompt: Bring back the re-ranking retrieval step.

The agent finds the capsule and re-implements the idea onto today's code, leaving you a reviewable diff. There are no commands to memorize. If you like being explicit, /rgit-capture saves recent work and /rgit-recall <what you want back> brings an idea home.

Agent prompt: @research-git:rgit-recall Bring back the re-ranking retrieval step.

After the idea is brought back, ask your agent to run its evaluation with research-git. The Run keeps the exact code snapshot and metrics together. If the implementation includes code changes, research-git also stages them as a Capsule Proposal for you to decide whether to keep.

Agent prompt: The re-ranking step is ready. Run its evaluation and record the results with research-git.

3. Working in the terminal? Three commands

rgit run -- python eval_agent.py --retrieval rerank   # run an experiment; freezes a byte-exact snapshot + metrics
rgit review                                           # see what's been captured, approve what's worth keeping
rgit compare rerank                                   # which variant won?

rgit capture saves the current changes (or the last commit) when you're not using rgit run. Bringing an idea back needs an agent session because that's where the intelligence lives. From the terminal, you can always browse the memory with rgit features and rgit graph.

More commands as your store grows: More commands.

Where it fits

Anywhere you try many variations of one thing and later want to bring one back or safely remove one from today's codebase.

  • 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.
  • Backend / Systems: Three caching strategies, two rate-limiters, a reworked query plan. Which won? Pull the winning variant forward without reverting everything built since.
  • Frontend: Competing interaction flows and layout variants, half commented out. Resurrect the one that tested best onto the current component tree.
  • ML research: Different loss terms, attention blocks, and augmentations. The experiment is the idea, the metrics are the result, and you want one variant back on today's code.

How it works

Figure 1 shows how code changes become Capsules. After you edit code or complete an rgit run, research-git's local engine reads the Git diff, maps changed hunks to code symbols, stores the captured change, and stages a raw Proposal. This processing is deterministic and does not call a model or API. The experiment executed by rgit run still uses whatever compute it requires.

The agentic phase begins with the /rgit-capture skill. In the default mode, your coding agent starts this flow automatically after meaningful changes; you can also invoke the skill explicitly. A capsule-segmenter sub-agent turns the raw Proposal into focused Capsule candidates and asks which ones you want to keep. After approval, an edge-judge sub-agent identifies relationships with the existing graph. These sub-agents run on your existing coding-agent subscription without using a paid API.

research-git Capsule capture workflow
Figure 1. Capturing code changes into the Capsule graph.

Figure 2 shows how a stored Capsule is used on today's code. The /rgit-recall skill searches the graph and retrieves the relevant intent, code context, assumptions, dependencies, and restoration guidance. A coding agent uses this context to reapply or remove the idea against the current code, leaving a reviewable diff instead of restoring an old snapshot or replaying an outdated patch.

After you review the diff, rgit run can evaluate the implementation, freeze the exact code that ran, and record its metrics. If the resulting Proposal is approved, the new Capsule is linked to the recalled Capsule as a variant. rgit run records the result and lineage; it does not perform recall or create the variant before approval.

research-git Capsule recall workflow
Figure 2. Recalling Capsules and recording new variants.

Learn more (under the hood)

Build the memory, borrow the agent

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.

Two-phase capture

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.

Ranked, edge-aware recall

Recall scores every approved capsule against your query in plain Python, without embeddings or SQL LIKE traps. It boosts a hit when a connected capsule also matches, so related work surfaces together. Each result carries its related subgraph.

Two planes

  • MCP: shared memory (query-only). Returns graph snippets; safe to expose so a team shares one memory. Carries no intelligence.
  • 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.

Reproducibility contract

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.

What a Capsule Contains

Every idea you keep becomes a self-contained Capsule that a future agent can use to bring the idea back:

Field What it holds
intent Why this change existed: the hypothesis, not a restatement of the diff.
code slices The relevant snippets, files, and symbols.
knobs The parameters, flags, and configuration.
dependencies The other Capsules it needs, including silent assumptions.
result The metrics, notes, and reasons it worked or did not work, linked to the runs it produced.
resurrection guide How to regenerate it onto a changed codebase.

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. This ensures "the code behind this result" is always a perfect replay, never at the mercy of an agent.

Additional Capabilities

1. Run Experiments and Record Results

rgit run -- python eval.py                           # run an experiment; freeze code, record metrics
rgit run --from feat_ab12 -- python eval.py          # record a recalled variant + lineage

rgit run records the command, base commit, exit status, content-addressed code snapshot, and metrics from rgit_metrics.json or stdout. Any code diff is staged as a Proposal for review.

Capsules remember intent; Runs preserve execution and measurements. Together, they give auto-research agents a durable history for comparing variants and deciding what to try next. --from records lineage but does not run recall; after approval, the new Capsule becomes a variant of the source. Use --with <capsule> to record approved Capsules active in the Run.

2. Share Memory with Your Team

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. Their session then regenerates an idea onto their code using their subscription. The memory is shared; the intelligence is local.

Updating

rgit update
Learn more

Upgrades the package (via whichever of uv/pipx/pip installed it) and refreshes every installed platform surface: the Claude Code plugin copy, MCP config, and the managed guidance blocks. Guidance blocks you have customized or removed are left alone. The command tells you how to restore them instead.

rgit checks PyPI for a newer release at most once a day (in the background, terminal sessions only). Once one is found, it prints a one-line upgrade notice after every qualifying command until you upgrade or turn the notice off. The check is throttled, but the reminder is not. Silence it for good with rgit update --off, or per-environment with RGIT_UPDATE_CHECK=0.

More commands

As your store grows, these additional commands become useful. Run rgit <command> --help to learn more about any of them:

Command What it does
rgit watch free, deterministic background capture that stages raw material as you edit, so fleeting in-between states aren't lost
rgit capture [REV | A..B] bare: auto-picks the working tree or, when clean, the last commit; pass a commit or an A..B range for precise control
rgit install-hooks opt-in: stage every commit's diff via a post-commit hook (not installed by rgit install; won't touch an existing hook). See install details above
rgit run --from <capsule> -- <command> run and record an experiment for an implementation regenerated from a Capsule; after its Proposal is approved, the resulting Capsule is saved as a variant_of the source
rgit compare <query> which variant won: ranked table, Δ vs baseline, ★ winner
rgit provenance <run_id> per-feature clean (capsule) vs agent-adapted (frozen) diff for a run
rgit mcp serve the graph read-only so a teammate's client can recall against it
rgit digest scan [A..B] cluster a mature repo's git history into a scored digestion plan (rgit init offers this interactively); rgit digest status shows progress, the rgit-digest skill drains the queue into origin=backfill capsules, and rgit digest clear removes them all if you change your mind

See the command-line guide for every command and option.

License

MIT

About

A new Git tool for researchers and developers to capture experiments and features as reusable semantic units, then let agents reapply, adapt, or safely remove them on today’s codebase — aka Agentic Git.

Topics

Resources

Stars

40 stars

Watchers

1 watching

Forks

Releases

Contributors

Languages