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

# selftune sync

> Synchronize agent session data from all platforms

## Usage

```bash theme={null}
selftune sync [options]
```

Scans configured agent platforms (Claude Code, Codex, OpenCode, OpenClaw, Pi) and ingests all new session data into the selftune database.

## What it scans

| Platform    | Source                    | Data                          |
| ----------- | ------------------------- | ----------------------------- |
| Claude Code | Claude Code hooks         | Prompts, tool calls, results  |
| Codex       | Codex logs                | Agent interactions            |
| OpenCode    | OpenCode data directory   | Session events                |
| OpenClaw    | OpenClaw agents directory | Agent execution traces        |
| Pi          | Pi sessions directory     | Agent messages and tool calls |

## Options

```
--since <date>                   Only sync sessions after this date (ISO 8601)
--dry-run                        Show summary without writing to SQLite or files
--force                          Rescan all sessions, ignore markers
--no-claude                      Skip Claude transcript replay
--no-codex                       Skip Codex rollout ingest
--no-opencode                    Skip OpenCode ingest
--no-openclaw                    Skip OpenClaw ingest
--no-pi                          Skip Pi ingest
--no-repair                      Skip rebuilding repaired skill-usage data
--json                           Output results as JSON
--projects-dir <dir>             Claude transcript directory (default: ~/.claude/projects)
--codex-home <dir>               Codex home directory (default: ~/.codex)
--opencode-data-dir <dir>        OpenCode data directory
--openclaw-agents-dir <dir>      OpenClaw agents directory
--pi-sessions-dir <dir>          Pi sessions directory (default: ~/.pi/agent/sessions)
--skill-log <path>               Raw skill usage log path
--repaired-skill-log <path>      Repaired overlay log path
--repaired-sessions-marker <p>   Repaired session marker path
```

## Examples

Sync all platforms:

```bash theme={null}
selftune sync
```

Sync only sessions from the last 24 hours:

```bash theme={null}
selftune sync --since 2026-04-07
```

Sync with custom Pi sessions directory:

```bash theme={null}
selftune sync --pi-sessions-dir ~/my-pi-data/sessions
```

Rescan everything and re-ingest all sessions:

```bash theme={null}
selftune sync --force
```

## Output

Returns a JSON summary with sync results:

```json theme={null}
{
  "status": "success",
  "metrics": {
    "total_synced": 42,
    "claude_synced": 15,
    "codex_synced": 8,
    "opencode_synced": 10,
    "openclaw_synced": 5,
    "pi_synced": 4
  },
  "elapsedMs": 2341
}
```

## Next steps

After syncing, analyze your data:

```bash theme={null}
selftune status          # View sync statistics
selftune grade           # Grade agent performance
selftune eval <name>     # Evaluate a specific skill
```
