/create-adapter
Create conversation adapters for importing AI chat history from different tools (Claude Code, Cursor, Warp, Codex, etc.). Covers the adapter.Adapter interface, caching strategies, incremental parsing, watch/FD management, and performance standards. Use when creating a new
$ npx -y skills add marcus/sidecar --skill create-adapter --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/create-adapter
Context preview
The summary Claude sees to decide when to auto-load this skill.
Create conversation adapters for importing AI chat history from different tools (Claude Code, Cursor, Warp, Codex, etc.). Covers the adapter.Adapter interface, caching strategies, incremental parsing, watch/FD management, and performance standards. Use when creating a new
SKILL.md
create-adapter.SKILL.mdname: create-adapter
description: >
Create conversation adapters for importing AI chat history from different
tools (Claude Code, Cursor, Warp, Codex, etc.). Covers the adapter.Adapter
interface, caching strategies, incremental parsing, watch/FD management, and
performance standards. Use when creating a new adapter, modifying adapter
behavior, or debugging adapter performance issues. See references/ for
Cursor DB and Warp SQLite schema details.
Create Adapter
Why Performance Matters
Adapters are the largest performance risk in Sidecar. Conversations refresh on watch events in a hot path that runs continuously during active sessions:
watch event -> coalescer -> session refresh -> adapter.Sessions() -> metadata parsing
If an adapter does full directory scans and full-file reparses on every change, CPU and FD usage spike quickly.
Reference Adapters
Study these before writing a new adapter:
- `internal/adapter/claudecode` - Incremental JSONL parsing, targeted refresh
- `internal/adapter/codex` - Directory cache, two-pass metadata parsing, global watch scope
- `internal/adapter/cursor` - SQLite/WAL-aware cache invalidation, FD-safe DB access
- `internal/adapter/pi` - Global scope, JSONL, CWD-based filtering, session classification, message prefix stripping
Required Interface
All adapters implement `adapter.Adapter`:
type Adapter interface {
ID() string
Name() string
Icon() string
Detect(projectRoot string) (bool, error)
Capabilities() CapabilitySet
Sessions(projectRoot string) ([]Session, error)
Messages(sessionID string) ([]Message, error)
Usage(sessionID string) (*UsageStats, error)
Watch(projectRoot string) (<-chan Event, io.Closer, error)
}Required Session Fields
Every session from `Sessions()` must set:
- `ID`, `Name`
- `AdapterID`, `AdapterName`, `AdapterIcon`
- `CreatedAt`, `UpdatedAt`
- `MessageCount`, `FileSize`
`FileSize` is used for dynamic debounce and huge-session auto-reload protection.
Treat source identity separately from lineage. Use the source's durable thread/session ID for `Session.ID`; parent, root, fork, or lineage IDs describe relationships and must not collapse distinct sessions. Decode metadata fields defensively when the source has emitted multiple shapes over time (for example, a string in one version and an object in another).
Path and Watch Strategy
Set `Session.Path` only when Sidecar should use tiered file watching for that adapter:
- **File-based append-only** (JSONL/log): set `Path` to absolute file path — this opts into TieredWatcher with HOT/COLD/FROZEN tiers
- **DB/WAL adapters** (Cursor, Warp, Kiro): prefer adapter-specific `Watch()` with WAL-aware invalidation; do not set `Path` unless tiered watching covers your write surface
**FROZEN tier**: File-based sessions with `Path` set automatically benefit from the FROZEN tier. Sessions unchanged for 24 hours (`FrozenThreshold`) are excluded from cold polling entirely — zero syscalls. They unfreeze when promoted to HOT (e.g., user selects the session). This is critical for adapters with thousands of session files; without it, `pollColdSessions()` does one `os.Stat()` per file every 30 seconds.
Performance Standards
1) Cache metadata and messages aggressively
Minimum cache keys:
- Metadata: `path + size + modTime`
- Messages: `path + size + modTime`
- SQLite/WAL: include WAL size+mtime in the key
Use bounded LRU behavior for every cache and index. Prune stale paths. Assume caches evict independently: a hit in one cache must restore any derived state required by another, or the authoritative source must remain available so eviction cannot change results such as aggregate usage or ID-to-path resolution.
2) Incremental parsing for append-only formats
For JSONL/event-log adapters:
- Cache last parsed byte offset
- Parse only appended bytes
- Fall back to full parse on shrink/rotation/corruption
- Preserve immutable head metadata from prior parse
3) Two-pass metadata for large files
When incremental metadata parse is impractical:
- Head pass: ID, CWD, first user message, first timestamp
- Tail pass: latest timestamp, token totals
- Skip middle of large files
When the source owns a metadata index, prefer its read-only index over scanning large event logs. Probe the schema and required columns before use, open it read-only with bounded/FD-safe access, and fall back to event-log discovery when it is missing, locked, or incompatible. The source index is an adapter seam, not a second source of truth to mutate.
4) Avoid repeated expensive path work
Resolve project path once per `Sessions()` call (`Abs`/`EvalSymlinks`), reuse for all matches.
5) Return defensive copies from caches
Never return cache-owned slices/maps directly. Copy message/session structures to avoid mutation bugs.
6) Keep DB access FD-safe
For SQLite adapters:
- Open read-only (`mode=ro`)
- `SetMaxOpenConns(1)`, `SetMaxIdleConns(0)`
- Close rows and DB handles promptly
- Avoid multiple DB connections per `Messages()` call
7) Preserve aggregate facts across incremental loads
Usage and similar cumulative facts may arrive as repeated totals or deltas. Define the source semantics, retain the authoritative aggregate across incremental parsing, and include all components the source exposes. Do not reconstruct a partial aggregate from whichever message cache entry survived eviction.
Watching and FD Management
1) Prefer directory-level watches
Do not watch per-session files when directory-level watch gives equivalent signals.
2) Implement watch scope
If adapter watches a global path (same location regardless of worktree):
func (a *Adapter) WatchScope() adapter.WatchScope {
return adapter.WatchScopeGlobal
}This prevents duplicate watchers across worktrees.
3) Always emit SessionID when known
Watch events should include session ID for targeted refresh (avoids full reloads).
#
Read more
name: create-adapter description: > Create conversation adapters for importing AI chat history from different tools (Claude Code, Cursor, Warp, Codex, etc.). Covers the adapter.Adapter interface, caching strategies, incremental parsing, watch/FD management, and performance standards. Use when creating a new adapter, modifying adapter behavior, or debugging adapter performance issues. See references/ for Cursor DB and Warp SQLite schema details.
Create Adapter
Why Performance Matters
Adapters are the largest performance risk in Sidecar. Conversations refresh on watch events in a hot path that runs continuously during active sessions:
watch event -> coalescer -> session refresh -> adapter.Sessions() -> metadata parsing
If an adapter does full directory scans and full-file reparses on every change, CPU and FD usage spike quickly.
Reference Adapters
Study these before writing a new adapter:
- `internal/adapter/claudecode` - Incremental JSONL parsing, targeted refresh
- `internal/adapter/codex` - Directory cache, two-pass metadata parsing, global watch scope
- `internal/adapter/cursor` - SQLite/WAL-aware cache invalidation, FD-safe DB access
- `internal/adapter/pi` - Global scope, JSONL, CWD-based filtering, session classification, message prefix stripping
Required Interface
All adapters implement `adapter.Adapter`:
type Adapter interface {
ID() string
Name() string
Icon() string
Detect(projectRoot string) (bool, error)
Capabilities() CapabilitySet
Sessions(projectRoot string) ([]Session, error)
Messages(sessionID string) ([]Message, error)
Usage(sessionID string) (*UsageStats, error)
Watch(projectRoot string) (<-chan Event, io.Closer, error)
}Required Session Fields
Every session from `Sessions()` must set:
- `ID`, `Name`
- `AdapterID`, `AdapterName`, `AdapterIcon`
- `CreatedAt`, `UpdatedAt`
- `MessageCount`, `FileSize`
`FileSize` is used for dynamic debounce and huge-session auto-reload protection.
Treat source identity separately from lineage. Use the source's durable thread/session ID for `Session.ID`; parent, root, fork, or lineage IDs describe relationships and must not collapse distinct sessions. Decode metadata fields defensively when the source has emitted multiple shapes over time (for example, a string in one version and an object in another).
Path and Watch Strategy
Set `Session.Path` only when Sidecar should use tiered file watching for that adapter:
- **File-based append-only** (JSONL/log): set `Path` to absolute file path — this opts into TieredWatcher with HOT/COLD/FROZEN tiers
- **DB/WAL adapters** (Cursor, Warp, Kiro): prefer adapter-specific `Watch()` with WAL-aware invalidation; do not set `Path` unless tiered watching covers your write surface
**FROZEN tier**: File-based sessions with `Path` set automatically benefit from the FROZEN tier. Sessions unchanged for 24 hours (`FrozenThreshold`) are excluded from cold polling entirely — zero syscalls. They unfreeze when promoted to HOT (e.g., user selects the session). This is critical for adapters with thousands of session files; without it, `pollColdSessions()` does one `os.Stat()` per file every 30 seconds.
Performance Standards
1) Cache metadata and messages aggressively
Minimum cache keys:
- Metadata: `path + size + modTime`
- Messages: `path + size + modTime`
- SQLite/WAL: include WAL size+mtime in the key
Use bounded LRU behavior for every cache and index. Prune stale paths. Assume caches evict independently: a hit in one cache must restore any derived state required by another, or the authoritative source must remain available so eviction cannot change results such as aggregate usage or ID-to-path resolution.
2) Incremental parsing for append-only formats
For JSONL/event-log adapters:
- Cache last parsed byte offset
- Parse only appended bytes
- Fall back to full parse on shrink/rotation/corruption
- Preserve immutable head metadata from prior parse
3) Two-pass metadata for large files
When incremental metadata parse is impractical:
- Head pass: ID, CWD, first user message, first timestamp
- Tail pass: latest timestamp, token totals
- Skip middle of large files
When the source owns a metadata index, prefer its read-only index over scanning large event logs. Probe the schema and required columns before use, open it read-only with bounded/FD-safe access, and fall back to event-log discovery when it is missing, locked, or incompatible. The source index is an adapter seam, not a second source of truth to mutate.
4) Avoid repeated expensive path work
Resolve project path once per `Sessions()` call (`Abs`/`EvalSymlinks`), reuse for all matches.
5) Return defensive copies from caches
Never return cache-owned slices/maps directly. Copy message/session structures to avoid mutation bugs.
6) Keep DB access FD-safe
For SQLite adapters:
- Open read-only (`mode=ro`)
- `SetMaxOpenConns(1)`, `SetMaxIdleConns(0)`
- Close rows and DB handles promptly
- Avoid multiple DB connections per `Messages()` call
7) Preserve aggregate facts across incremental loads
Usage and similar cumulative facts may arrive as repeated totals or deltas. Define the source semantics, retain the authoritative aggregate across incremental parsing, and include all components the source exposes. Do not reconstruct a partial aggregate from whichever message cache entry survived eviction.
Watching and FD Management
1) Prefer directory-level watches
Do not watch per-session files when directory-level watch gives equivalent signals.
2) Implement watch scope
If adapter watches a global path (same location regardless of worktree):
func (a *Adapter) WatchScope() adapter.WatchScope {
return adapter.WatchScopeGlobal
}This prevents duplicate watchers across worktrees.
3) Always emit SessionID when known
Watch events should include session ID for targeted refresh (avoids full reloads).
#
You might never open your editor again. Status: Ready for daily use. Please report any issues you encounter.
Other skills on sidecar.
- /create-modal
Create declarative modals using the modal library API. Covers modal types (confirm, input, select, form), sections (Text, Buttons, Input, Textarea, Checkbox, List, When, Custom), rendering with OverlayModal, and keyboard/mouse handling. Use when adding modals or dialogs to the
Open skill - /create-plugin
Create new sidecar plugins implementing the plugin.Plugin interface, rendering views with Bubble Tea, handling keyboard input via keymap contexts, and integrating with the app shell (footer hints, event bus, adapters). Use when creating a new plugin, modifying plugin
Open skill - /create-prompt
Create prompts for sidecar workspaces. Covers prompt structure (name, ticketMode, body), template variables (ticket with fallbacks), config file locations (global vs project), and scope overrides. Use when creating or modifying prompts in sidecar config files.
Open skill - /create-theme
Create custom color themes for Sidecar, including base theme selection, color overrides, gradient borders, tab styles, per-project themes, community themes, and programmatic theme registration. Use when creating or modifying themes, adjusting UI appearance, or debugging
Open skill - /drag-pane
Drag-and-drop pane resizing implementation for two-pane plugin layouts. Covers mouse event handling via the internal/mouse package, hit region registration, drag delta calculation, width clamping, state persistence, and pane layout management. Use when working on pane resizing,
Open skill - /feature-flags
Creating and using feature flags in sidecar for gating experimental functionality. Covers flag registration, checking flags in code, config file and CLI overrides, and priority resolution. Use when adding feature flags, toggling features, or gating new functionality behind flags.
Open skill

