> ## Documentation Index
> Fetch the complete documentation index at: https://code.storage/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

> Code Storage is managed Git infrastructure for agents. Create repositories, write commits, merge branches, and get Git remote URLs through the SDK, the HTTP API, or Git over HTTPS.

Create a repository on demand for each user, project, or agent session, and commit to it without a
local clone. Each Code Storage request uses a JSON Web Token that your organization signs. You
control the repository access, scopes, expiration, and ref policy in each JWT, so every client,
agent, or task gets exactly the access it needs.

<CodeGroup>
  ```typescript TypeScript theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
  import { GitStorage } from '@pierre/storage';

  const storage = new GitStorage({
    name: 'your-org',
    key: process.env.PIERRE_PRIVATE_KEY!,
  });

  const repo = await storage.createRepo({ id: 'new-workspace' });

  const result = await repo
    .createCommit({
      targetBranch: 'main',
      commitMessage: 'Get started with Code Storage',
      author: { name: 'Pierre', email: 'pierre@pierre.co' },
    })
    .addFileFromString('README.md', '# Getting started\n')
    .addFileFromString('main.ts', 'console.log("Hello from Code Storage");')
    .send();

  console.log(result.commitSha);
  ```

  ```python Python theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
  import os

  from pierre_storage import GitStorage

  storage = GitStorage({
      "name": "your-org",
      "key": os.environ["PIERRE_PRIVATE_KEY"],
  })

  repo = await storage.create_repo(id="new-workspace")

  result = await (
      repo.create_commit(
          target_branch="main",
          commit_message="Get started with Code Storage",
          author={"name": "Pierre", "email": "pierre@pierre.co"},
      )
      .add_file_from_string("README.md", "# Getting started\n")
      .add_file_from_string("main.py", "print('Hello from Code Storage')")
      .send()
  )

  print(result["commit_sha"])
  ```

  ```go Go theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
  client, err := storage.NewClient(storage.Options{
  	Name: "your-org",
  	Key:  os.Getenv("PIERRE_PRIVATE_KEY"),
  })
  if err != nil {
  	return fmt.Errorf("create client: %w", err)
  }

  ctx := context.Background()
  repo, err := client.CreateRepo(ctx, storage.CreateRepoOptions{ID: "new-workspace"})
  if err != nil {
  	return fmt.Errorf("create repository: %w", err)
  }

  builder, err := repo.CreateCommit(storage.CommitOptions{
  	TargetBranch:  "main",
  	CommitMessage: "Get started with Code Storage",
  	Author:        storage.CommitSignature{Name: "Pierre", Email: "pierre@pierre.co"},
  })
  if err != nil {
  	return fmt.Errorf("create commit builder: %w", err)
  }

  result, err := builder.
  	AddFileFromString("README.md", "# Getting started\n", nil).
  	AddFileFromString("main.go", "package main\n\nfunc main() {}\n", nil).
  	Send(ctx)
  if err != nil {
  	return fmt.Errorf("create commit: %w", err)
  }

  fmt.Println(result.CommitSHA)
  ```

  ```bash HTTP theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
  export CODE_STORAGE_BASE_URL="https://api.your-org.code.storage/api"
  export CODE_STORAGE_TOKEN="YOUR_JWT_TOKEN"

  curl "$CODE_STORAGE_BASE_URL/repos" \
    -X POST \
    -H "Authorization: Bearer $CODE_STORAGE_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"default_branch": "main"}'
  ```
</CodeGroup>

## Features

* [**Git Operations**](/docs/guides/git-operations). Clone, fetch, push, and pull over HTTPS with
  JWT-authenticated remotes.
* [**Git LFS**](/docs/guides/git-lfs). Track large files over the same remote, with no separate LFS
  server.
* [**Git Notes**](/docs/guides/git-notes). Attach metadata to commits and keep note streams isolated by
  ref.
* [**Ref Policies**](/docs/guides/ref-policies). Limit the refs that a JWT can update and reject force
  pushes.
* [**Commit Signing**](/docs/guides/commit-signing). Register keys and require signed commits on selected
  refs.
* [**Import Namespace**](/docs/guides/imports). Bulk push large repositories, which Code Storage moves to
  cold storage.
* [**Ephemeral Namespace**](/docs/guides/ephemeral-branches). Create isolated refs for previews and
  experiments, then promote them.
* [**Repository Forks**](/docs/guides/forking). Copy a repository for a template, a snapshot, or isolated
  work.
* [**GitHub Sync**](/docs/guides/github-sync). Mirror a GitHub repository to and from Code Storage.
* [**Generic Sync**](/docs/guides/generic-sync). Mirror a GitLab, Bitbucket, or other HTTPS Git
  repository.
* [**Webhooks**](/docs/guides/webhooks). Receive push and sync events, verified with HMAC signatures.

## Workflows

These workflows give agents isolated, disposable Git state.

* [**Connect a Sandbox**](/docs/guides/sandboxes). Clone into Modal, E2B, Daytona, and other sandboxes
  with authenticated URLs.
* [**Store Session State**](/docs/guides/session-state). Store agent session state as ephemeral commits,
  with the normal branches unchanged.
* [**Resume Sandbox Work**](/docs/guides/resume-sandbox-work). Restore the last session state in a new
  sandbox.
* [**Run Parallel Attempts**](/docs/guides/parallel-attempts). Start several attempts from one commit and
  promote the best result.
* [**Show Live Diffs**](/docs/guides/live-diffs). Render an agent branch as a live diff that refreshes on
  each new state.

## Get started

Follow these steps in order:

1. [**Agent Setup**](/docs/getting-started/agent-setup): Give your agent the current docs through MCP or
   `llms.txt`.
2. [**Authentication & Security**](/docs/getting-started/authentication): Create an API key, store it,
   and sign JWTs with scopes and ref policies.
3. [**Quick Start**](/docs/getting-started/quickstart): Install the SDK, create a repository, and make
   your first commit.

<Note>Code Storage does not provide pull requests, issues, or code review.</Note>
