cxc-ast-grep
FreeUse for AST search and codemods. Triggers: ast-grep, sg, function/call/class/import, empty catch, missing await, YAML rules.
The English summary is being prepared. Showing the original description.
Use for Codex-app worktrees. Triggers: worktree, rename worktree, detached HEAD, ~/.codex/worktrees, 워크트리, 워크트리 이름, 새 워크트리, 브랜치랑 워크트리.
The English summary is being prepared. Showing the original description.
Review the instructions the agent will receive before you install.
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.
| Namespace | What it is | How to rename |
|---|---|---|
| branch | a git ref | git branch -m <name> (or git switch -c <name> from detached HEAD), run inside the worktree |
| worktree | a directory + its .git/worktrees/<id> admin entry | git worktree move <old> <new> — never for the ACTIVE one (WG-MOVE-01) |
| thread title | the Codex app sidebar entry | the 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.
$CODEX_HOME/worktrees (default ~/.codex/worktrees); the app setting can
move it (Settings → Worktrees) — codexclaw detection then needs
CODEXCLAW_WORKTREE_ROOTS (WG-LIMIT-01).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.
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.~/.codex/worktrees without the user explicitly
naming that path — another live session may be bound to it.Adopt-and-continue (DEFAULT for "이름 붙이고 새로 시작"):
git switch -c <name> (detached HEAD) or
git branch -m <name>.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.
CODEX_HOME + CODEXCLAW_WORKTREE_ROOTS
(path.delimiter-separated). A custom app-side root needs that env.^Bash$): deterministic deny of self-worktree
deletion — applies to subagent turns too. The deny is intentional; follow §4
instead of routing around it.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.$(...) 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'.For repos where codexclaw hooks are not installed:
## 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.
No reviews yet. Tell others what you thought.
No login needed. Share how it worked for you, ask a question, or note where it did not run.
No comments yet. Be the first to write one.
Use for AST search and codemods. Triggers: ast-grep, sg, function/call/class/import, empty catch, missing await, YAML rules.
The English summary is being prepared. Showing the original description.
Use for coding, PR delivery, scaffolding and QA. Triggers: develop, fix, refactor, test, review, docs, browse, stacked PR, 개발, 수정, 검토, 스택 PR.
The English summary is being prepared. Showing the original description.
Use for module boundaries and dependencies. Triggers: circular import, coupling, barrel, re-export, validation placement, 모듈 경계, 순환 참조.
The English summary is being prepared. Showing the original description.
Use for APIs, servers and app databases. Triggers: REST, GraphQL, migration, query optimization, middleware, caching, queues, 백엔드, API 작업, 마이그레이션, 쿼리 최적화.
The English summary is being prepared. Showing the original description.
Use for code/PR/diff review and refactor audits. Triggers: review this, before merge, antipattern, 리뷰, 코드 리뷰, 머지 전에 확인.
The English summary is being prepared. Showing the original description.
Use for analytics and data pipelines. Triggers: ETL, ELT, data quality, SQL optimization, schema drift, backfill, 데이터 파이프라인, 데이터 품질, 백필.
The English summary is being prepared. Showing the original description.