Logo di Cxc Worktree Guardian

Cxc Worktree Guardian

Community
lidge-jun
cxc-worktree-guardian

Use for Codex-app worktrees. Triggers: worktree, rename worktree, detached HEAD, ~/.codex/worktrees, 워크트리, 워크트리 이름, 새 워크트리, 브랜치랑 워크트리.

Panoramica

Autorelidge-jun
Repositorycodexclaw
Nome della skillcxc-worktree-guardian
Stelle
51
Fork
10
File inclusi
1
LicenzaMIT
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • 1 file inclusi

    Script, modelli di documento e riferimenti che il modello può leggere mentre lavora. I file sono di sola lettura e non vengono mai eseguiti.

  • Open source

    Pubblicata da lidge-jun su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Cxc Worktree Guardian in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/lidge-jun/codexclaw/tree/main/plugins/codexclaw/skills/worktree-guardian
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Nuova skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella nella cartella delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/lidge-jun/codexclaw.git /tmp/codexclaw
mkdir -p .claude/skills
cp -r /tmp/codexclaw/plugins/codexclaw/skills/worktree-guardian .claude/skills/cxc-worktree-guardian
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Cxc Worktree Guardian in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Cxc Worktree Guardian non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Cxc Worktree Guardian non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

Worktree Guardian — Codex-app managed worktrees

The Codex desktop app creates one worktree per thread under $CODEX_HOME/worktrees/ (hash or date-slug slot dirs, e.g. ~/.codex/worktrees/7627/opencodex), checked out from the selected base branch, usually detached HEAD. These sessions look like scratch directories but are not: the app binds the thread to that directory.

1. Three namespaces (WG-CONCEPT-01)

NamespaceWhat it isHow to rename
brancha git refgit branch -m <name> (or git switch -c <name> from detached HEAD), run inside the worktree
worktreea directory + its .git/worktrees/<id> admin entrygit worktree move <old> <new> — never for the ACTIVE one (WG-MOVE-01)
thread titlethe Codex app sidebar entrythe user renames it in the app; agents cannot

"워크트리 이름 붙여줘 / name the worktree" can mean any of these. Default: name the branch in place and tell the user to rename the thread in the app.

2. Managed-worktree facts (WG-FACTS-01)

  • Root: $CODEX_HOME/worktrees (default ~/.codex/worktrees); the app setting can move it (Settings → Worktrees) — codexclaw detection then needs CODEXCLAW_WORKTREE_ROOTS (WG-LIMIT-01).
  • Managed worktrees are per-chat disposable; the app retains the latest N (15 by default) and auto-deletes the worktree when the chat is archived (a snapshot is kept for restore). Commit early.
  • Source: developers.openai.com/codex/environments/git-worktrees; identity fragility is a known upstream area (openai/codex issues #10917, #10522, #14498, #34662; naming contract still a proposal, #12862).

One worktree per THREAD, not per agent (WG-FACTS-02). The per-chat worktree belongs to the Codex task. A subagent spawned with spawn_agent inherits this same directory: same path, same branch, same HEAD, and its writes appear in this worktree's git status. It never gets a worktree of its own, so spawning agents is not a way to parallelize branch work — that needs one task per lane, each with its own worktree. See Dispatch surfaces.

3. Never-list (WG-NEVER-01)

  • Never git worktree remove or rm -rf the session's OWN worktree, slot dir, or any ancestor of cwd — not even to "start clean". codexclaw's PreToolUse guard (WORKTREE-GUARD-03) denies it; do not try to bypass the deny.
  • Never copy the work elsewhere and delete the original — that loses the app binding and any uncommitted state you missed.
  • Never delete another slot under ~/.codex/worktrees without the user explicitly naming that path — another live session may be bound to it.

4. Safe procedures (WG-PROC-*)

Adopt-and-continue (DEFAULT for "이름 붙이고 새로 시작"):

  1. Stay in the worktree. git switch -c <name> (detached HEAD) or git branch -m <name>.
  2. Commit the work in progress (archive auto-deletes managed worktrees).
  3. Tell the user the thread title can be renamed in the app sidebar.

Move/repair — OTHER, inactive worktrees only (WG-MOVE-01): git worktree move <old> <new> (refuses the main worktree, locked worktrees, and worktrees containing submodules). After a manual directory move: git worktree repair <new-path>. Feature-detect with git worktree move -h / git worktree repair -h; do not version-gate. Moving the ACTIVE worktree kills the session's cwd (next command: ENOENT) and app rebinding is undocumented — don't.

Cleanup of other worktrees: verify clean (git status), merged (git merge-base --is-ancestor), no open PR head, not any session's cwd; then git worktree remove <path> — never rm -rf. A directory deleted without git worktree remove leaves admin state under .git/worktrees/; recover with git worktree prune (dry-run first). Automated or bulk cleanup of other worktrees follows cxc-dev-devops references/local-gc.md (DEVOPS-LOCAL-GC-01); the never-list above still wins.

5. Defense-in-depth limits (WG-LIMIT-01)

  • The PreToolUse guard matches literal paths. Pure variable/glob indirection that never mentions the slot path is out of scope — treat the deny as a seatbelt, not a sandbox.
  • Detection covers the default root + CODEX_HOME + CODEXCLAW_WORKTREE_ROOTS (path.delimiter-separated). A custom app-side root needs that env.

6. Hook interplay (WG-HOOK-01)

  • WORKTREE-GUARD-01 (SessionStart): identity block when cwd is managed.
  • WORKTREE-GUARD-02 (UserPromptSubmit): this guidance, once per session, on rename intent.
  • WORKTREE-GUARD-03 (PreToolUse, ^Bash$): deterministic deny of self-worktree deletion — applies to subagent turns too. The deny is intentional; follow §4 instead of routing around it.
  • WORKTREE-GUARD-04 (same PreToolUse hook): when the session bound a source worktree with cxc session source, git writes (commit, cherry-pick, merge, rebase, reset, checkout/switch, am, revert, push, pull, branch -D/-f/-m) whose repository is another worktree of the same repo are denied. Hooks receive only the command text, never exec_command's workdir, so write git -C <source> ... or cd <source> && .... --abort/--quit stay allowed.
  • SHELL-SUBST-01 (same hook): a backtick or $(...) that the shell will execute and that runs a git write or gh pr merge/close, gh issue close is denied with or without a binding; other backticks inside double quotes get an advisory. Pass generated text through apply_patch, files, or <<'EOF'.

7. AGENTS.md snippet (WG-AGENTS-01)

For repos where codexclaw hooks are not installed:

md
## Worktree safety
This session may run inside a Codex-app-managed worktree (~/.codex/worktrees/<slot>/<repo>).
Never delete or recreate that directory to "rename" it. Adopt in place:
`git switch -c <name>` / `git branch -m <name>`, commit early, and ask the user to
rename the thread in the app. `git worktree move` is for other, inactive worktrees only.

File inclusi

Il modello legge questi file quando servono, mentre la skill è caricata. Sono accessibili in sola lettura e non vengono mai eseguiti.

Domande frequenti

Cosa fa la skill IA Cxc Worktree Guardian?

Use for Codex-app worktrees. Triggers: worktree, rename worktree, detached HEAD, ~/.codex/worktrees, 워크트리, 워크트리 이름, 새 워크트리, 브랜치랑 워크트리.

Perché usare Cxc Worktree Guardian su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Cxc Worktree Guardian è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Cxc Worktree Guardian in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/lidge-jun/codexclaw/tree/main/plugins/codexclaw/skills/worktree-guardian. TypingMind legge il file SKILL.md, include i file associati e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Cxc Worktree Guardian?

Qualsiasi modello che colleghi in TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Cxc Worktree Guardian?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Cxc Worktree Guardian: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Cxc Worktree Guardian è gratuita?

Sì. È pubblicata su GitHub da lidge-jun con licenza MIT. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, modelli o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Vedi tutti

Crea subito la tua area di lavoro IA

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇