Skip to main content

GAIT: git-like versioning for AI turns, commits, and context

Project description

GAIT (Git for AI Turns)

Git-Like Version Control for AI Conversations, Prompts, and Long-Lived Memory.

GAIT is a specialized version control system built to solve the "poisoned context" problem in LLM workflows. In standard AI chat interfaces, conversations are linear and fragile; one bad turn or a significant hallucination permanently alters the model's "window," often requiring you to delete the chat and start over.

GAIT treats AI context as versioned infrastructure. It allows you to commit conversation states, branch different reasoning paths, pin specific memories, and sync your "reasoning repos" across machines.

1. Why GAIT?

The Problem with Linear Chat

Traditional AI workflows suffer from three major issues:

  • Context Pollution: If an LLM gives a wrong answer and you continue the chat, the model is now "primed" by its own mistake.

  • Memory Drift: As conversations get long, important early instructions or "ground truths" get pushed out of the model's sliding window.

  • The "What-If" Wall: If you want to see how a different prompt or model would have handled a question 10 turns ago, you usually have to copy-paste the whole history into a new window.

GAIT fixes this by introducing the Commit/Branch/Merge workflow to AI reasoning.

2. Core Concepts

The Turn (The "Blob")

A Turn is the atomic unit of GAIT. It contains the user's prompt and the assistant's response. Like a Git blob, it is content-addressed (hashed); if the text changes, the ID changes.

The Commit

A Commit wraps one or more turns with metadata: the model used, the provider, the timestamp, and—most importantly—a pointer to the parent commit. This creates a Directed Acyclic Graph (DAG) of your conversation.

HEAD+ Memory (The "Secret Sauce")

This is GAIT's most powerful feature. Standard LLMs have "short-term memory" (the sliding window). GAIT adds HEAD+ Memory:

  • Intentional: You explicitly /pin turns that contain "Golden Rules" or vital project info.

  • Persistent: Pinned turns are injected into the System Prompt for every future turn on that branch, regardless of how long the history gets.

  • Versioned: Memory has its own Reflog. If you revert a commit, GAIT can automatically rewind your memory to exactly how it looked at that moment.

3. Installation & Quick Start

Requirements

Python 3.10+

A local LLM framework running: Ollama, LM Studio, or Microsoft Foundry Local.

Installation

git clone https://github.com/your-username/gait.git
cd gait
pip gait-ai

Initialize a Repository

Navigate to your project folder and run:

gait init

This creates a .gait/ directory. You are now ready to version your thoughts.

4. The Interactive Chat Workflow

The primary way to use GAIT is through the gait chat command. It feels like a standard terminal chat but works like a version-controlled environment.

gait chat --model llama3.1

Common Commands inside gait chat

Commands and Actions:

/undo

The Safety Net. Erases the last Q&A turn and moves the branch back to the previous state.

/pin

Freeze Context. Marks the current turn as "Memory." It will now stay in the model's context forever.

/branch

Split Reality. Create a new timeline to explore a different idea without affecting your main chat.

/checkout

Time Travel. Instantly switch between different conversation timelines.

/merge [--with-memory]

Merge another branch into the current one. Use --with-memory to also bring over pinned turns.

/fetch

Sync with Remote. Pull down the latest commits and memory from your GaitHub remote.

/pull [--path

]

Fast-forward Clone. Grab a reasoning repository from GaitHub and set it up locally.

/push --owner --repo

Upload your current branch and memory to GaitHub for remote storage and sharing.

/model

Swap Brains. Switch from a 7B model to a 70B model mid-conversation.

/memory

Audit. View a JSON manifest of everything currently pinned to your branch.

5. Advanced Usage Scenarios

Scenario A: Recovering from Hallucinations

You've been chatting for an hour. You ask a complex coding question, and the AI provides a 200-line script that is completely wrong.

The Old Way: You try to tell the AI it's wrong, but it gets confused and keeps referencing the bad code.

The GAIT Way: Type /undo. The bad code is gone from the history. The model's "window" is restored to the moment before the error occurred.

Scenario B: Model Comparison

You want to see if Gemma-2 or Llama-3 handles a specific logic puzzle better.Start on main with Llama-3 and ask the question.

/branch gemma-test

/checkout gemma-test

/model gemma-2-9b

Ask the same question. Now you have two distinct commits you can compare using gait log.

Scenario C: Knowledge Merging

You spent a branch researching "AWS Security Patterns" and pinned the best answers. Now you want those security rules in your "Development" branch.

gait checkout development
gait merge research-branch --with-memory

GAIT merges the histories and brings over all the pinned memory turns, deduplicating them so your context remains clean.

6. Remote Syncing with GaitHub

GAIT is not limited to your local machine. By using a GaitHub remote, you can treat AI reasoning as a shared asset.

Setting up a Remote

gait remote add origin https://gaithub-960937205198.us-central1.run.app/

Pushing & Pulling

# Push your reasoning to the cloud
# (Requires GAITHUB_TOKEN environment variable)

gait push origin --owner john --repo architecture-decisions

# Resume that conversation on your laptop
gait clone https://gaithub.your-server.com --owner john --repo architecture-decisions --path ./decisions

7. Configuration & Environment Variables

GAIT is designed to be "zero-config," but you can customize it heavily:

Variables and Descriptions

GAIT_PROVIDER

Set to ollama or openai_compat.GAIT_DEFAULT_MODELThe model to use if none is specified.

GAIT_BASE_URL

The endpoint for your LLM (e.g., http://127.0.0.1:1234/v1).

GAITHUB_TOKEN

Your authentication token for pushing to GaitHub.

8. Repository Layout

GAIT is transparent. You can open any file in .gait/ to see exactly what is happening:

.gait/objects/:

The content-addressed database. Every turn, commit, and memory manifest is stored here as a JSON file named by its SHA-256 hash.

.gait/refs/:

Simple text files containing hashes. refs/heads/main tells GAIT which commit is the "top" of the main branch.

.gait/memory.jsonl:

The Memory Reflog. A line-by-line audit trail of every time you pinned or unpinned an item.

.gait/turns.jsonl:

A mapping of Turn IDs to Commit IDs for easy lookup.

9. Philosophy

History is cheap. Storing text turns costs almost nothing.Memory is expensive. Large contexts slow down models and cause "Lost in the Middle" syndrome.

GAIT empowers the user to record everything but curate specifically.

By treating your conversations like code, you move from "chatting with a bot" to "architecting a knowledge base."

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gait_ai-0.0.6.tar.gz (37.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gait_ai-0.0.6-py3-none-any.whl (42.7 kB view details)

Uploaded Python 3

File details

Details for the file gait_ai-0.0.6.tar.gz.

File metadata

  • Download URL: gait_ai-0.0.6.tar.gz
  • Upload date:
  • Size: 37.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0b1

File hashes

Hashes for gait_ai-0.0.6.tar.gz
Algorithm Hash digest
SHA256 15e53826bb41411111f1cb94b528a7bc55dc1ab1778cbab2c78f3d86d05f4c07
MD5 1711ad0aefb20ba66b03c0767b9cfadd
BLAKE2b-256 5c9d0b0f6dae33c3c8970191e703d233aeed83992622f1d80db87770d7754dd1

See more details on using hashes here.

File details

Details for the file gait_ai-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: gait_ai-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 42.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0b1

File hashes

Hashes for gait_ai-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 2bbc9572fab5bbc3903f48dad122e2f391813f6681a406cbb20f59eeb3b51f6a
MD5 dad5779964a228758b8a941673992611
BLAKE2b-256 9a55e80d63c0f5b44e5282834fa3bdcb81a5aa6f1d1e8d929892fe75fdd10dba

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page