К основному содержанию
скилл CX Codex

session-crosslink — скилл для Claude Code: привязка сессий к коммитам

Привязывает сессию агента к HEAD-коммиту каждого репозитория с Entire, если работа шла вне того репозитория, который должен её записать.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add entireio/skills --skill session-crosslink -a claude-code
Открыть на GitHub

Что делает session-crosslink

Бывает так: агент запущен из папки уровнем выше, или из репозитория без Entire, или из одного репозитория, а правки ушли в другой. Тогда сессия нигде не записана. Скилл находит её и прикрепляет к HEAD-коммиту каждого затронутого репозитория с включённым Entire.

Сначала он разрешает id сессии: пробует entire session current --json в текущей папке, потом в соседнем репозитории с Entire, а если не вышло — читает транскрипт рантайма. Для Claude это файлы в ~/.claude/projects/<encoded-cwd>/<session-id>.jsonl, для Codex — каталог $CODEX_HOME/sessions/. Дальше собирает список затронутых репозиториев из вашего сообщения, соседних папок и истории правок, проверяет каждый через entire status --json и считает, что именно произойдёт.

Перед записью скилл показывает таблицу: репозиторий, HEAD-коммит, действие и checkpoint. Только после подтверждения выполняется entire session attach — и обязательно из папки нужного репозитория, потому что CLI определяет репозиторий по cwd. Нужен entire 0.6.2 или новее. Учтите: attach правит HEAD, поэтому локальная ветка в каждом затронутом репозитории разойдётся с удалённой. Если по ней открыт пул-реквест, обновлять придётся через git push --force-with-lease — это повод проверить ветки перед запуском.

Какие задачи решает

  • привязать сессию агента к коммитам репозитория, из которого её не запускали
  • найти id сессии, когда Entire её не записал
  • собрать список репозиториев, затронутых за одну сессию
  • посмотреть, что изменит attach, до самой записи
  • переиспользовать существующий checkpoint вместо создания нового

Примеры запросов агенту

  • Привяжи эту сессию к репозиториям, которые я правил: foo и bar api
  • Сессия запускалась из родительской папки, найди затронутые репозитории с Entire и покажи превью
  • Покажи таблицу с действиями по attach, потом прикрепи сессию

Как установить session-crosslink

1Через Skills CLI (Vercel)

npx skills add entireio/skills --skill session-crosslink -a claude-code

2Вручную: положить файлы

~/.claude/skills/session-crosslink/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/session-crosslink/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о session-crosslink

Как установить session-crosslink в Claude?

Через npx: npx skills add entireio/skills --skill session-crosslink -a claude-code. Скилл встанет в ~/.claude/skills/session-crosslink/SKILL.md.

Что делает session-crosslink?

Находит сессию агента, запущенную вне того репозитория, который должен её записать, и прикрепляет её к HEAD-коммиту каждого затронутого репозитория с Entire. Перед записью показывает таблицу с действиями.

Что нужно для работы скилла?

CLI entire версии 0.6.2 или новее. Отдельные флаги не нужны: attach работает через cwd, поэтому скилл каждый раз переходит в папку целевого репозитория.

Исходный текст

SKILL.md · MIT
---
name: session-crosslink
description: Use when an agent session ran outside the repo whose commits should record it — e.g. launched from a higher-level folder, a non-Entire repo, or one repo but editing another — to attach the session to each affected Entire-enabled repo's HEAD commit.
---

# Session Crosslink

## Response Format

Begin the first response to this skill invocation with the line:

`Entire Session Crosslink:`

followed by a blank line, then the content. Apply the header to the **first response of the invocation only** — not on follow-up turns and not on error / early-exit responses (no session resolved, no affected repos found).

## STOP — Read these rules before doing ANYTHING

1. **Do NOT ask clarifying questions until the resolver/discovery steps have run.** The session id and candidate repo list usually resolve from `entire session current --json` plus what the user said. Only ask if both come back empty.
2. **Do NOT run `entire session attach` without showing the preview table first.** The whole point of this skill is preview-then-confirm. `attach` amends the target repo's HEAD; previewing wrong means amending the wrong commit.
3. **Always `cd` into the target repo before running `entire session attach`.** The CLI resolves the repo from cwd. Use one `cd … && entire session attach …` per call so each invocation hits the right repo.

Required CLI: `entire` 0.6.2+. No special flags needed — this skill works against the shipped CLI via cwd-scoped `entire session attach`.

## Flow

### Step 1: Resolve the session id

Try each strategy in order until one returns a session id.

**Strategy A: Entire-enabled cwd.**

```bash
entire session current --json
```

If the output is valid JSON **and** has a non-empty `session_id`, read `session_id` and `agent` and continue with those values. If the JSON parses but `session_id` is missing or empty, treat Strategy A as failed and fall through to B — don't proceed to attach with no session id.

**Strategy B: Entire-enabled sibling repo.** If the user named a repo that has Entire enabled (e.g. `the foo repo`), `cd` there and re-try `entire session current --json`. The session state lives wherever the session was tracked.

**Strategy C: Runtime-specific transcript directory.** If neither A nor B works, the session was never recorded by Entire and you must read it from the agent runtime:

- **Claude Code:** transcripts live at `~/.claude/projects/<encoded-cwd>/<session-id>.jsonl`. Encoded cwd is the launch directory with `/` → `-`. The most recent `.jsonl` file under the project directory matching the agent's launch cwd is this session. Read the basename minus `.jsonl` as `session_id`. Set `agent` to `claude-code`.
- **Codex:** check `$CODEX_HOME/sessions/` or `~/.codex/sessions/`. Set `agent` to `codex`.
- **Other runtimes:** ask the user for the session id.

Record `agent` so Step 4 can pass `--agent <name>` to attach.

**If all strategies fail:** print "Could not resolve a session id — pass one explicitly or run from an Entire-enabled directory" and stop.

### Step 2: Discover affected repos

Build a candidate set, union from these sources, then de-duplicate by path:

1. **From the user's message**: any repo paths or aliases the user named explicitly (e.g. "the foo repo and the bar api"). Resolve aliases via the user's `CLAUDE.md` or treat as filesystem paths.

2. **From sibling repos under the launch directory** (only if launch dir is NOT Entire-enabled): list immediate subdirectories that have their own `.git` and a `.entire/settings.json`.

3. **From the agent's edit history in this session**: any repo whose files were edited during the session — derive from the agent's own context. If unsure, ask the user.

For each candidate, run `entire status --json` (with cwd inside that repo) and decide:

- `"enabled": true` → keep.
- `"enabled": false` with a settings-parse error (`unknown field "..."`) → keep. Status fails noisily on misconfigured local settings even when attach would succeed.
- `"enabled": false` with no error → drop. Repo opted out of Entire.

If the candidate set is empty, ask the user which repos to crosslink.

### Step 3: Compute the preview locally

For each candidate, inspect git and the session store to compute the action — same logic `entire session attach` uses internally, but without amending anything:

```bash
# Get HEAD hash and message
HEAD_HASH=$(git -C <repo> rev-parse HEAD)
HEAD_MSG=$(git -C <repo> log -1 --format=%B HEAD)

# Existing Entire-Checkpoint trailer on HEAD, if any
EXISTING_TRAILER=$(printf '%s\n' "$HEAD_MSG" | grep -E '^Entire-Checkpoint:' | tail -1 | awk '{print $2}')

# Is the session already tracked in this repo's store?
STATE_FILE=<repo>/.git/entire-sessions/<session-id>.json
```

Decide the action per repo:

- Both `STATE_FILE` exists AND its `last_checkpoint_id` field is non-empty → `would_skip_existing_in_state`. Attach is a no-op; report that.
- HEAD has an `EXISTING_TRAILER` → `would_link_existing_in_head`. Attach reuses that checkpoint id and adds this session to it.
- Neither → `would_add_trailer`. Attach generates a fresh checkpoint id and amends HEAD with it.

For `would_link_existing_in_head` rows, the checkpoint id is `EXISTING_TRAILER`. For `would_add_trailer` rows, the checkpoint id can't be known ahead of time — attach generates one at write time. Show "new" in the table.

If HEAD has no commits in the repo (`git rev-parse` fails), record an error row: `error: no commits yet`.

### Step 4: Render the preview table

Show the user a compact table:

```
repo                              HEAD commit   action                          checkpoint
foo                               a1b2c3d       would_add_trailer               (new)
bar                               e4f5g6h       would_link_existing_in_head     ckpt-7d6c
baz                               —             error: no commits yet           —
```

Then ask: "Attach session `<id>` to the would_* rows? Error rows and `would_skip_existing_in_state` rows will be skipped."

### Step 5: Execute on confirmation

For each row the user confirmed where `action` is `would_add_trailer` or `would_link_existing_in_head`:

```bash
cd <repo> && entire session attach <session-id> --agent <agent> --force
```

Skip `would_skip_existing_in_state` rows (re-attach there is a no-op) and `error:` rows.

Capture exit status per repo. Report a final summary:

```
attached:
  foo    ckpt-9f8e  (new trailer on a1b2c3d)
  bar    ckpt-7d6c  (added to existing checkpoint on e4f5g6h)
skipped:
  baz    (no commits yet)
  qux    (already linked: ckpt-c97b)
```

Remind the user: attach amends HEAD, so each touched repo's local branch has diverged from its remote. If those branches have open PRs, force-push (`git push --force-with-lease`) to update them.

## Failure modes

- **Session id not resolvable**: stop with a one-line message — see Step 1.
- **No candidate repos**: ask the user which repos to crosslink.
- **All candidates report `would_skip_existing_in_state`**: tell the user the session is already linked everywhere; no work to do.
- **A repo's `attach` fails mid-run after others succeeded**: do not retry automatically. Report which repos succeeded vs failed and surface the failing repo's stderr. The succeeded amends are idempotent — re-running the skill is safe.
- **HEAD has no commits in a candidate**: skip that row with `error: no commits yet`. Tell the user to make at least one commit there first.
- **`entire session attach` fails with `Entire is disabled`**: the target repo opted out. Tell the user; don't retry.

## Why this skill exists

Entire tracks agent sessions per repo via state stored under each repo's git common dir. When an agent runs from a higher-level folder, a sibling repo, or a non-Entire-enabled parent, none of the child repos see the session. This skill resolves the session id from the agent runtime (which always has it), discovers affected repos, previews each, then runs `entire session attach` per repo on confirmation — without amending the wrong commit or asking the user to babysit per-repo `cd`s.

© entireio · MIT · entireio/skills

Похожие скиллы

Все скиллы по теме «Настройка агента: память, контекст, субагенты» →
session-handoff softaworks Создаёт документы передачи контекста между сессиями агента. Помогает при переполнении окна контекста и долгих проектах. CX Codex +1 4 200установок session-wrap ai-native-camp Разбирает завершённую работу перед закрытием сессии: что закоммитить, какие знания записать, какие задачи остались. CX Codex +1 1 300установок project-session-manager Yeachan-Heo Скилл автоматизирует создание отдельных git-воркtræев для каждой задачи, PR или фичи, с опциональной оркестровкой tmux-сессий. Позволяет параллельно работать над несколькими ветками без конфликтов. CX Codex +1 866установок session-history rohitg00 Показывает историю недавних сессий проекта в виде временной шкалы. Нужен, чтобы быстро восстановить прошлую работу. CX Codex +1 13 900установок nemo-rl-session-memory NVIDIA Ведёт durable-заметки о рабочей сессии в каталоге session/, чтобы другой агент поднял контекст после обрыва связи или перезапуска VS Code. CX Codex +1 2 000установок git-workflow-and-versioning addyosmani Скилл задаёт агенту правила работы с git: атомарные коммиты, короткие ветки, воркtrees для параллельных задач. Пригодится, когда ИИ пишет код быстрее, чем вы успеваете ревьюить. CX Codex +1 59 500установок

Из того же набора8

session-handoff Передаёт контекст и историю работы между разными ИИ-агентами через CLI entire без лишних вопросов и ручного копирования. CX Codex +1 532установок what-happened Объясняет историю строк кода через git blame и контрольные точки entire. Помогает понять, кто и зачем менял фрагмент. CX Codex +1 519установок search Ищет решения, обсуждения и код в сохранённой истории Entire по всем доступным репозиториям. Помогает вспомнить контекст прошлых задач до чтения файлов проекта. CX Codex +1 458установок session-to-skill Превращает сессии и чекпоинты Entire в черновик скилла: берёт повторяющийся рабочий процесс и описывает его как будущее поведение агента. CX Codex +1 426установок recall Ищет прошлые сессии по описанию задачи через Entire CLI и превращает найденные чекпоинты в пошаговый план работы. CX Codex +1 404установок using-entire Скилл заставляет агента сначала читать записанные намерения в чекпоинтах Entire, а уже потом открывать файлы и грепать. Пригодится, когда разбираешься в чужом коде. CX Codex +1 401установок review Читает checkpoint-транскрипты, чтобы понять, чего хотел разработчик, и только потом проверяет диф. Пригодится перед мержем, когда важно поймать расхождение между задумкой и кодом. CX Codex +1 395установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой