Skip to content

task-observer: new-session updates from 2026-05-01#6

Open
divad12 wants to merge 1 commit intomasterfrom
task-observer/new-session-2026-05-01
Open

task-observer: new-session updates from 2026-05-01#6
divad12 wants to merge 1 commit intomasterfrom
task-observer/new-session-2026-05-01

Conversation

@divad12
Copy link
Copy Markdown
Owner

@divad12 divad12 commented May 1, 2026

Target\nskill: .agents/skills/new-session/SKILL.md\n\n## Observations addressed\n- Observation 12 (journology/log.md): Worktree recovery should minimise workspace sprawl — a clean existing worktree is the safest landing zone after checkpointing accidental main-checkout work → changed: expanded step 1 to check git worktree list for a clean existing worktree before creating a new one; only create when no suitable one exists


Generated by Claude Code

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6f587b386c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

If the current working directory is already inside `.claude/worktrees/`, you're in a worktree that was created externally (e.g. by Claude Code desktop). Skip to step 3.

If you're in the main repo, use the `EnterWorktree` tool to create one. Let it generate a name (or use one the user provides).
If you're in the main repo, first run `git worktree list` to check whether a clean existing worktree is available on the target branch. If one exists with no uncommitted changes, prefer it over creating a new one — reusing minimises workspace sprawl and stale port locks. Only create a new worktree when no suitable one exists, then use the `EnterWorktree` tool. Let it generate a name (or use one the user provides).
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Exclude main checkout from reusable worktree candidates

This new reuse rule can accidentally select the main checkout as the “clean existing worktree” (especially when the target branch is main), because git worktree list includes the main repo entry as well; step 2 in this same file even relies on that [main] entry. If that happens, the rest of the flow runs in the main repo instead of an isolated worktree, which can lead to accidental main-branch edits/commits and incorrect worktree port-lock setup. Add an explicit guard that reusable candidates must be linked worktrees (e.g., under .claude/worktrees/) and never the [main] entry.

Useful? React with 👍 / 👎.

If the current working directory is already inside `.claude/worktrees/`, you're in a worktree that was created externally (e.g. by Claude Code desktop). Skip to step 3.

If you're in the main repo, use the `EnterWorktree` tool to create one. Let it generate a name (or use one the user provides).
If you're in the main repo, first run `git worktree list` to check whether a clean existing worktree is available on the target branch. If one exists with no uncommitted changes, prefer it over creating a new one — reusing minimises workspace sprawl and stale port locks. Only create a new worktree when no suitable one exists, then use the `EnterWorktree` tool. Let it generate a name (or use one the user provides).
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Verify cleanliness with git status before reusing a worktree

The instruction says to use git worktree list to find a worktree with “no uncommitted changes,” but that command does not expose dirty/clean state (git worktree list -h only provides --porcelain, --verbose, and --expire output modes). Following this step as written can therefore reuse a worktree that still has local changes from an earlier task, contaminating a new session. Require an explicit per-candidate check such as git -C <path> status --porcelain before reuse.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant