# OpenGAP

> Define an agent as a git repository, export it anywhere

- Category: Agents & Automation / Agent Frameworks & Builders
- Language: TypeScript
- Licence: MIT
- Repository: https://github.com/open-gitagent/opengap
- Website: https://gitagent.sh
- Canonical page: https://ai-tldr.dev/tools/opengap/

## In short

OpenGAP is Define an agent as a git repository, export it anywhere. It sits in the Agent Frameworks & Builders category of the Agents & Automation tools and is open-source, written in TypeScript and licensed MIT. To get started: scaffold an agent.

## Overview

OpenGAP — the Git Agent Protocol — is a file convention rather than a runtime: drop a defined set of files into a git repository and that repository becomes a portable agent definition. `agent.yaml` carries the manifest (name, version, model, skills, tools, compliance), `SOUL.md` the identity and communication style, `RULES.md` the hard constraints, and directories such as `skills/`, `tools/`, `workflows/`, `knowledge/`, `memory/` and `hooks/` hold the rest.

Because the definition is just files in git, version control, branching, diffing and review work on an agent the way they work on code. Agents also compose: a definition can `extend` a parent repository, or declare `dependencies` on other agent repositories pinned to a semver range and mounted into a subdirectory.

The `opengap` CLI is the reference implementation, published on npm as `@open-gitagent/opengap` (the older `gitagent` command is still installed as an alias). Its adapters are the point of the exercise: one definition exports to a plain system prompt, a Claude Code CLAUDE.md, OpenAI Agents SDK Python, CrewAI YAML, Cursor rules, Gemini CLI files, GitHub Copilot instructions and a dozen more. It also carries unusually detailed support for financial regulatory compliance — FINRA supervision and recordkeeping rules, Federal Reserve SR 11-7 model risk, SEC Reg S-P — plus a segregation-of-duties model with roles, a conflict matrix and strict or advisory enforcement.

## What it does

- A git-native file layout — `agent.yaml`, `SOUL.md`, `RULES.md`, `skills/`, `tools/`, `workflows/`, `memory/`, `hooks/` — that any repository can adopt
- Adapters that export one definition to Claude Code, OpenAI Agents SDK, CrewAI, Cursor, Gemini CLI, Copilot, Codex, OpenCode, Lyzr, Nanobot and others
- Inheritance and composition: `extends` a parent agent repository, or declare versioned `dependencies` mounted as sub-agents
- Compliance as a first-class field — risk tier, frameworks, human-in-the-loop supervision, kill switch, audit logging and retention
- Segregation of duties with named roles, permissions, a conflict matrix and strict or advisory enforcement, declared in `DUTIES.md`
- `opengap run` executes an agent straight from a git repository or local directory through a chosen adapter

## Getting started

Install the CLI from npm, scaffold a definition from a template, then validate and export it to whichever runtime you use.

1. Scaffold an agent

   `init` writes the file layout. Templates run from `minimal` (agent.yaml plus SOUL.md) through `standard` and `full` to `llm-wiki`.

```bash
npx @open-gitagent/opengap init --template standard
```

2. Write the manifest

   `agent.yaml` is the manifest. A minimal one needs little more than a spec version, name and description; a regulated one adds the compliance block.

```yaml
spec_version: "0.1.0"
name: compliance-analyst
version: 1.0.0
description: Financial compliance analysis agent
model:
  preferred: claude-opus-4-6
compliance:
  risk_tier: high
  frameworks: [finra, federal_reserve, sec]
  supervision:
    human_in_the_loop: always
    kill_switch: true
```

3. Validate it

   `validate` checks the definition against the spec; `--compliance` additionally checks it against the declared regulatory requirements.

```bash
opengap validate --compliance
opengap info
```

4. Export to a runtime

   Pick the adapter for whatever you actually run. `system-prompt` produces a concatenated prompt that works with any LLM.

```bash
opengap export --format system-prompt
opengap export --format claude-code
```

5. Or run it directly

   `run` executes an agent from a repository or directory through an adapter, optionally against a separate target workspace.

```bash
opengap run --dir ./agents/reviewer --workspace ~/code/my-app \
    --adapter claude -p "Review this repository"
```

## When to use it

- Keep one agent definition under version control and run it on Claude Code, Cursor and CrewAI without maintaining three copies
- Review and diff changes to an agent's rules and skills in a pull request, the same way you review code
- Compose a team of agents from separate repositories, pinned to versions and mounted as dependencies
- Document supervision, audit logging and segregation of duties alongside the agent for a regulated deployment
