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

# Anchor Schema

> JSON schema reference for anchors, session links, transcripts, and timelines

## Anchor (`metadata.json`)

The root-level `metadata.json` for each commit:

```json theme={null}
{
  "anchor_schema_version": 1,
  "oobo_version": "2.0.0",
  "commit_hash": "c8e12fa9b3d4abcdef1234567890abcdef123456",
  "branch": "main",
  "author": "Teddy <teddy@example.com>",
  "author_type": "assisted",
  "contributors": [
    { "name": "Teddy <teddy@example.com>", "role": "human" },
    { "name": "cursor", "role": "agent", "model": "claude-sonnet-4-20250514" }
  ],
  "committed_at": 1714500000,
  "message": "feat: add widget support",
  "files_changed": ["src/widget.rs", "src/lib.rs"],
  "added": 42,
  "deleted": 5,
  "file_changes": [
    {
      "path": "src/widget.rs",
      "added": 40,
      "deleted": 0,
      "attribution": "ai",
      "agent": "cursor",
      "line_attributions": [
        {
          "author": "ai",
          "ranges": [{ "start": 1, "end": 40 }],
          "agent": "cursor"
        }
      ]
    },
    {
      "path": "src/lib.rs",
      "added": 2,
      "deleted": 5,
      "attribution": "human"
    }
  ],
  "ai_added": 40,
  "ai_deleted": 0,
  "human_added": 2,
  "human_deleted": 5,
  "ai_percentage": 85.1,
  "session_ids": ["sess-abc"],
  "summary": "Added widget module with rendering pipeline",
  "intent": "User asked to create a reusable widget component",
  "reasoning": "Chose composition over inheritance for flexibility",
  "transparency_mode": "on",
  "file_interactions": [
    {
      "path": "src/widget.rs",
      "sessions": [
        { "session_id": "sess-abc", "role": "writer" },
        { "session_id": "sess-def", "role": "reader" }
      ]
    }
  ],
  "turns": [
    {
      "id": "turn-001",
      "session_id": "sess-abc",
      "source": "cursor",
      "turn_index": 3,
      "tree_hash": "a1b2c3d4e5f6..."
    }
  ]
}
```

### Field Reference

| Field | Type | Required | Description |
| - | - | - | - |
| `anchor_schema_version` | `u32` | Yes | Always `1`. Use for forward compatibility checks |
| `oobo_version` | `string` | Yes | CLI version that wrote this anchor (semver) |
| `commit_hash` | `string` | Yes | Full 40-char SHA of the enriched commit |
| `branch` | `string` | Yes | Branch name at commit time |
| `author` | `string` | Yes | Git author line: `Name <email>` |
| `author_type` | `enum` | Yes | How the commit was authored (see below) |
| `contributors` | `array` | No | All humans + AI tools that contributed |
| `committed_at` | `i64` | Yes | Unix timestamp in **seconds** |
| `message` | `string` | Yes | Full commit message |
| `files_changed` | `string[]` | Yes | Paths of all files changed in the commit |
| `added` | `u32` | Yes | Total lines added |
| `deleted` | `u32` | Yes | Total lines deleted |
| `file_changes` | `array` | No | Per-file breakdown (empty for legacy anchors) |
| `ai_added` | `u32` | Yes | Lines added attributed to AI |
| `ai_deleted` | `u32` | Yes | Lines deleted attributed to AI |
| `human_added` | `u32` | Yes | Lines added attributed to human |
| `human_deleted` | `u32` | Yes | Lines deleted attributed to human |
| `ai_percentage` | `f64?` | No | 0.0-100.0. `null` if no AI involvement |
| `session_ids` | `string[]` | Yes | IDs of linked AI sessions (empty if pure human) |
| `summary` | `string?` | No | AI-generated summary of the commit |
| `intent` | `string?` | No | What the user asked the AI to do |
| `reasoning` | `string?` | No | Why the AI chose this approach |
| `transparency_mode` | `enum` | Yes | `"on"` or `"off"` - indicates if transcripts are present |
| `file_interactions` | `array?` | No | Multi-agent file access patterns (present when 2+ sessions) |
| `turns` | `array` | No | Turn references that led into this commit |

### `author_type` Enum

| Value | Meaning |
| - | - |
| `"agent"` | AI autonomously committed (non-interactive terminal + active session) |
| `"assisted"` | Human committed while collaborating with AI (most common) |
| `"human"` | Pure human commit - no AI involvement whatsoever |
| `"automated"` | CI/CD or script (non-interactive, no AI session) |

### `contributors[].role` Enum

| Value | Meaning |
| - | - |
| `"human"` | Human developer |
| `"agent"` | AI tool/model |

### `file_changes[].attribution` Enum

| Value | Meaning |
| - | - |
| `"ai"` | AI agent wrote/edited this file |
| `"human"` | Human wrote this file |
| `"mixed"` | Both contributed to this file |

### `line_attributions[].ranges`

* 1-indexed line numbers
* Inclusive on both ends (`start` and `end`)
* Only covers lines **added or modified** in this commit
* Lines unchanged from the parent are not represented

### `file_interactions[].sessions[].role` Enum

| Value | Meaning |
| - | - |
| `"writer"` | Session edited this file |
| `"reader"` | Session read this file |
| `"both"` | Session both read and wrote this file |

### `turns[]` Fields

| Field | Type | Description |
| - | - | - |
| `id` | `string` | Unique turn identifier |
| `session_id` | `string` | Parent session |
| `source` | `string` | Tool that generated the turn |
| `turn_index` | `i64` | Position within the session |
| `tree_hash` | `string?` | Git tree hash capturing workspace state at this turn |

***

## SessionLink (`N/metadata.json`)

```json theme={null}
{
  "session_id": "sess-abc",
  "agent": "cursor",
  "model": "claude-sonnet-4-20250514",
  "link_type": "explicit",
  "input_tokens": 15000,
  "output_tokens": 8000,
  "cache_read_tokens": 5000,
  "cache_creation_tokens": 2000,
  "duration_secs": 120,
  "tool_calls": 14,
  "files_touched": ["src/widget.rs", "src/lib.rs"],
  "tool_usage": { "Edit": 8, "Bash": 3, "Read": 2, "Grep": 1 },
  "tool_failures": 1,
  "subagent_count": 2,
  "bash_commands": ["cargo build", "cargo test"],
  "thinking_duration_ms": 45000,
  "compact_count": 1,
  "context_tokens": 128000,
  "context_window_size": 200000,
  "is_subagent": false,
  "parent_session_id": null,
  "subagent_type": null,
  "is_estimated": false,
  "peer_session_ids": ["sess-def"]
}
```

### Field Reference

| Field | Type | Required | Description |
| - | - | - | - |
| `session_id` | `string` | Yes | Unique session identifier |
| `agent` | `string` | Yes | Tool name (see supported agents below) |
| `model` | `string?` | No | LLM model identifier |
| `link_type` | `enum` | Yes | `"explicit"` (hooks confirmed) or `"inferred"` (time-window heuristic) |
| `input_tokens` | `u64?` | No | Prompt tokens consumed |
| `output_tokens` | `u64?` | No | Completion tokens generated |
| `cache_read_tokens` | `u64?` | No | Tokens served from prompt cache |
| `cache_creation_tokens` | `u64?` | No | Tokens written to prompt cache |
| `duration_secs` | `u64?` | No | Wall-clock session duration in seconds |
| `tool_calls` | `u32?` | No | Total tool invocations |
| `files_touched` | `string[]?` | No | Relative file paths the AI read or wrote |
| `tool_usage` | `map<string, u32>?` | No | Tool call breakdown by name |
| `tool_failures` | `u32?` | No | Count of failed tool calls |
| `subagent_count` | `u32?` | No | Number of subagents spawned |
| `bash_commands` | `string[]?` | No | Shell commands the AI executed |
| `thinking_duration_ms` | `u64?` | No | Cumulative thinking/reasoning time |
| `compact_count` | `u32?` | No | Context compaction events |
| `context_tokens` | `u64?` | No | Total context tokens at session end |
| `context_window_size` | `u64?` | No | Max context window capacity |
| `is_subagent` | `bool` | Yes | Whether this is a child/sub session |
| `parent_session_id` | `string?` | No | Parent session ID (if `is_subagent` is true) |
| `subagent_type` | `string?` | No | e.g. `"explore"`, `"shell"`, `"generalPurpose"` |
| `is_estimated` | `bool` | Yes | `true` if token counts are heuristic estimates |
| `peer_session_ids` | `string[]` | No | Sessions that shared files with this one |

### Supported `agent` Values

| Value | Tool |
| - | - |
| `"cursor"` | Cursor IDE |
| `"claude"` | Claude Code (CLI) |
| `"codex"` | OpenAI Codex CLI |
| `"copilot"` | GitHub Copilot |
| `"aider"` | Aider |
| `"gemini"` | Google Gemini CLI |
| `"zed"` | Zed editor |
| `"continue"` | Continue.dev |
| `"windsurf"` | Windsurf |
| `"amp"` | Amp |
| `"kiro"` | Kiro |
| `"junie"` | JetBrains Junie |
| `"trae"` | Trae |
| `"droid"` | Factory Droid |
| `"opencode"` | OpenCode |

***

## Transcript (`N/transcript.json`)

The transcript is the full AI conversation in JSON format. Its internal structure varies by agent:

* **Cursor/Claude/Codex**: JSONL-style array of message objects with `role`, `content`, tool calls
* **Copilot/Gemini/Zed**: Platform-specific JSON format

All transcripts are:

* **Redacted**: Secrets (API keys, passwords, tokens) replaced with `[REDACTED]`
* **Path-stripped**: Absolute paths normalized to relative paths
* **Present only when `transparency_mode == "on"`** in the parent anchor

The backend should store transcripts as opaque JSON blobs and parse them as needed.

***

## Timeline (`timeline.json`, optional)

Present only when multiple sessions interacted with the same files during a commit window.

```json theme={null}
{
  "session_count": 2,
  "longest_session_ms": 120000,
  "file_interactions": [
    {
      "path": "src/main.rs",
      "sessions": [
        { "session_id": "s1", "role": "writer" },
        { "session_id": "s2", "role": "reader" }
      ]
    }
  ],
  "events": [
    { "session_id": "s1", "path": "src/main.rs", "action": "write", "timestamp": 1714500010 },
    { "session_id": "s2", "path": "src/main.rs", "action": "read", "timestamp": 1714500059 }
  ]
}
```

***

## Subagent Metadata (`subagents/N/metadata.json`, optional)

```json theme={null}
{
  "subagent_type": "explore",
  "session_id": "sub-abc123"
}
```

Present alongside subagent transcripts to identify the subagent type.

***

## JSON Response Fields (`--json`)

### `oobo anchors --json`

Array of objects: `sha`, `project`, `subject`, `timestamp`, `tool`, `tokens`, `sessions`, `ai_pct`.

### `oobo anchor show <sha> --json`

Object: `sha`, `parents[]`, `timestamp`, `author.raw`, `subject`, `tools[]`, `tokens.{input,output,cache_read,cache_write,total}`, `attribution.{ai_lines,human_lines,ai_pct}`, `sessions[]`, `files_changed[]`.

### `oobo recall --json`

Object: `query`, `sources[]`, `total_hits`, `hits[]` for local and/or remote matches.

### `oobo blame --json`

Per-line attribution with cross-commit tracing. Each line is traced to its originating commit via `git blame --porcelain`, and the anchor for that commit is loaded to resolve AI/human attribution. Includes `origin_sha`, `ai`, `agent`, `session_ids`, `tokens`, `committed_at`, and `message` per line. See the [blame command reference](/commands#blame--git-blame--ai-attribution) for the full schema.

### `oobo goto --json`

Object: `action: "goto"`, `target`, `stashed` (bool), `memory_path` (optional).

### `oobo back --json`

Object: `action: "back"`, `label`, `stash_applied` (bool), `remaining_depth` (int).

### `oobo settings --json`

Object/array of effective setting rows. Valid keys: `key`, `api_url`, `remote`, `transparency`, `tools.experimental`, `setup.scan_roots`.

### Bare `oobo --json` (outside a repo)

Object: `projects[]` and aggregate `stats`. Each project includes `id`, `name`, `path`, `remote`, `enabled`, `last_activity`, `anchors`, `tokens`, `ai_pct`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.