Delete worktree-before-remove and --implementation from os:worktree finish #842

Closed
opened 2026-09-30 14:11:56 +00:00 by jared · 2 comments
Owner

Problem

plugins/os/bin/worktree finish runs each worktree-before-remove=COMMAND line from .cc-os/config (ADR-0240). The feature has no users. Its only user was the os-sdlc usage sweep, os-sdlc-implementation-report --sweep-only {implementation}, and #836 deletes that sweep. .cc-os/config has no worktree-before-remove lines now.

The feature also keeps an os-sdlc idea inside the generic os plugin: the --implementation flag and the {implementation} placeholder. Agents still pass --implementation <id> from habit, because the os:worktree skill tells them to.

Observed

grep -rn "implementation" plugins/os/lib/worktree plugins/os/skills/worktree/SKILL.md
plugins/os/lib/worktree/before_remove.rb:8:    PLACEHOLDER = '{implementation}'
plugins/os/lib/worktree/cli.rb:23:    method_option :implementation, type: :string,
plugins/os/skills/worktree/SKILL.md:26:3. Run `plugins/os/bin/worktree finish <name> --implementation <id>` ...
grep -n "worktree-before-remove" .cc-os/config

(no output)

Reproduce

n/a: design removal; nothing fails.

Approach

Delete the whole before-remove feature. finish merges, refreshes the plugin cache when plugins/ changed, and removes the worktree. It runs no config hooks. ADR-0252 supersedes ADR-0240.

Required work:

  1. Delete plugins/os/lib/worktree/before_remove.rb and plugins/os/tests/support/before_remove_test_case.rb (tests keep the key: acceptance criterion 1 writes a worktree-before-remove= line) — check: absent before_remove in plugins/os/lib/**/*.rb
  2. In plugins/os/lib/worktree/finish_command.rb, delete the before_remove: keyword, @before_remove, its call in run, the refuse_missing_before_remove refusal, and EXIT_BEFORE_REMOVE_NOT_FOUND = 6 — check: absent before_remove in plugins/os/lib/worktree/finish_command.rb
  3. In plugins/os/lib/worktree/cli.rb, delete the --implementation option, the private before_remove method, and @search_path; in plugins/os/bin/worktree, delete the search_path: argument — check: absent search_path in plugins/os/lib/worktree/cli.rb
  4. Delete Config#lines in plugins/os/lib/worktree/config.rb; its only caller was the before-remove method. Keep Config#list — check: absent def lines in plugins/os/lib/worktree/config.rb

Documentation, done by the orchestrator, not by a pipeline agent:

  • ADR-0252 supersedes ADR-0240 (created 2026-09-30).
  • Rewrite plugins/os/skills/worktree/SKILL.md finish step 3 and its exit list (lines 26, 27, 33) without --implementation, before-remove text, or exit 6.
  • In plugins/os-sdlc/skills/implement/SKILL.md, delete "Pass the implementation id received at open when the worktree ran an os-sdlc implementation."
  • Add one History row to docs/implementation-status/os.md.
  • Run bin/refresh-plugins right after the skill edits; until then, active sessions still pass --implementation.

Rejected: keep the generic hook and delete only {implementation} — the hook has no user; keeping it is a speculative feature.

Acceptance criteria

  1. Given a .cc-os/config with a worktree-before-remove= line, when worktree finish <name> runs, then it merges and removes the worktree and does not run the line.
  2. Given worktree finish <name> --implementation 4, when it runs, then it fails with an unknown-option usage error and makes no change.

Owner sketch

module Worktree
  class FinishCommand
    def run
      refusal = pre_merge_refusal
      return refusal if refusal
      return EXIT_CONFLICTS unless merge_into_base

      verify_ancestry!
      @after_merge.call(worktree_path: worktree_path, pre_merge_head: @pre_merge_head)
      return EXIT_REMOVAL_FAILED unless remove_worktree
      # ...

Retired tests

plugins/os/tests/worktree/finish_command_refuses_before_remove_not_on_path_test.rb
plugins/os/tests/worktree/finish_command_runs_before_remove_commands_test.rb
plugins/os/tests/worktree/bin_worktree_finish_runs_before_remove_test.rb
plugins/os/tests/worktree/finish_command_without_before_remove_key_test.rb

Origin

  • Trigger: /os-sdlc:implement #836 hand-finish; the orchestrator planned worktree finish ticket-836 --implementation 4 from the skill text
  • Improvised this session: run finish without --implementation
  • Chain: --implementation passed from habit ← os:worktree SKILL.md:26 tells agents to pass it ← {implementation} placeholder served only the --sweep-only line ← DESIGN: ADR-0240; #836 deletes the sweep
  • Root candidate: this ticket
  • Where: plugins/os/lib/worktree/before_remove.rb; plugins/os/lib/worktree/cli.rb; plugins/os/skills/worktree/SKILL.md
  • Session: 3ce2d004-fe35-42ec-ba9a-b9bc2d1e9097
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/3ce2d004-fe35-42ec-ba9a-b9bc2d1e9097.jsonl

User decision 2026-09-30: delete the whole feature (option B). Follows #836.

VERDICT: CREATE — user-requested hard floor; ADR-0252 records the decision (ticket-skeptic, 2026-09-30).

## Problem `plugins/os/bin/worktree finish` runs each `worktree-before-remove=COMMAND` line from `.cc-os/config` (ADR-0240). The feature has no users. Its only user was the os-sdlc usage sweep, `os-sdlc-implementation-report --sweep-only {implementation}`, and #836 deletes that sweep. `.cc-os/config` has no `worktree-before-remove` lines now. The feature also keeps an os-sdlc idea inside the generic `os` plugin: the `--implementation` flag and the `{implementation}` placeholder. Agents still pass `--implementation <id>` from habit, because the `os:worktree` skill tells them to. ## Observed ``` grep -rn "implementation" plugins/os/lib/worktree plugins/os/skills/worktree/SKILL.md ``` ``` plugins/os/lib/worktree/before_remove.rb:8: PLACEHOLDER = '{implementation}' plugins/os/lib/worktree/cli.rb:23: method_option :implementation, type: :string, plugins/os/skills/worktree/SKILL.md:26:3. Run `plugins/os/bin/worktree finish <name> --implementation <id>` ... ``` ``` grep -n "worktree-before-remove" .cc-os/config ``` (no output) ## Reproduce n/a: design removal; nothing fails. ## Approach Delete the whole before-remove feature. `finish` merges, refreshes the plugin cache when `plugins/` changed, and removes the worktree. It runs no config hooks. ADR-0252 supersedes ADR-0240. Required work: 1. Delete `plugins/os/lib/worktree/before_remove.rb` and `plugins/os/tests/support/before_remove_test_case.rb` (tests keep the key: acceptance criterion 1 writes a `worktree-before-remove=` line) — check: absent `before_remove` in `plugins/os/lib/**/*.rb` 2. In `plugins/os/lib/worktree/finish_command.rb`, delete the `before_remove:` keyword, `@before_remove`, its call in `run`, the `refuse_missing_before_remove` refusal, and `EXIT_BEFORE_REMOVE_NOT_FOUND = 6` — check: absent `before_remove` in `plugins/os/lib/worktree/finish_command.rb` 3. In `plugins/os/lib/worktree/cli.rb`, delete the `--implementation` option, the private `before_remove` method, and `@search_path`; in `plugins/os/bin/worktree`, delete the `search_path:` argument — check: absent `search_path` in `plugins/os/lib/worktree/cli.rb` 4. Delete `Config#lines` in `plugins/os/lib/worktree/config.rb`; its only caller was the before-remove method. Keep `Config#list` — check: absent `def lines` in `plugins/os/lib/worktree/config.rb` Documentation, done by the orchestrator, not by a pipeline agent: - ADR-0252 supersedes ADR-0240 (created 2026-09-30). - Rewrite `plugins/os/skills/worktree/SKILL.md` finish step 3 and its exit list (lines 26, 27, 33) without `--implementation`, before-remove text, or exit 6. - In `plugins/os-sdlc/skills/implement/SKILL.md`, delete "Pass the implementation id received at open when the worktree ran an os-sdlc implementation." - Add one History row to `docs/implementation-status/os.md`. - Run `bin/refresh-plugins` right after the skill edits; until then, active sessions still pass `--implementation`. Rejected: keep the generic hook and delete only `{implementation}` — the hook has no user; keeping it is a speculative feature. ## Acceptance criteria 1. Given a `.cc-os/config` with a `worktree-before-remove=` line, when `worktree finish <name>` runs, then it merges and removes the worktree and does not run the line. 2. Given `worktree finish <name> --implementation 4`, when it runs, then it fails with an unknown-option usage error and makes no change. ## Owner sketch ```ruby module Worktree class FinishCommand def run refusal = pre_merge_refusal return refusal if refusal return EXIT_CONFLICTS unless merge_into_base verify_ancestry! @after_merge.call(worktree_path: worktree_path, pre_merge_head: @pre_merge_head) return EXIT_REMOVAL_FAILED unless remove_worktree # ... ``` ## Retired tests plugins/os/tests/worktree/finish_command_refuses_before_remove_not_on_path_test.rb plugins/os/tests/worktree/finish_command_runs_before_remove_commands_test.rb plugins/os/tests/worktree/bin_worktree_finish_runs_before_remove_test.rb plugins/os/tests/worktree/finish_command_without_before_remove_key_test.rb ## Origin - Trigger: `/os-sdlc:implement #836` hand-finish; the orchestrator planned `worktree finish ticket-836 --implementation 4` from the skill text - Improvised this session: run `finish` without `--implementation` - Chain: `--implementation` passed from habit ← `os:worktree` SKILL.md:26 tells agents to pass it ← `{implementation}` placeholder served only the `--sweep-only` line ← DESIGN: ADR-0240; #836 deletes the sweep - Root candidate: this ticket - Where: plugins/os/lib/worktree/before_remove.rb; plugins/os/lib/worktree/cli.rb; plugins/os/skills/worktree/SKILL.md - Session: 3ce2d004-fe35-42ec-ba9a-b9bc2d1e9097 - Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/3ce2d004-fe35-42ec-ba9a-b9bc2d1e9097.jsonl User decision 2026-09-30: delete the whole feature (option B). Follows #836. VERDICT: CREATE — user-requested hard floor; ADR-0252 records the decision (ticket-skeptic, 2026-09-30).
Author
Owner

Work started on branch ticket-842 (worktree .claude/worktrees/ticket-842) via /os-sdlc:implement.

Work started on branch ticket-842 (worktree .claude/worktrees/ticket-842) via /os-sdlc:implement.
Author
Owner

Resolution

Done: Deleted the worktree before-remove hook: before_remove.rb, the --implementation option, exit 6, search_path:, Config#lines, and 4 test files. finish runs no config commands; unknown options are a usage error. os:worktree finish step rewritten as one command plus an exit table; implement skill no longer passes an implementation id. ADR-0252 supersedes ADR-0240.

Evidence: Commit 6cd75d59 on ticket-842. ruby plugins/os/tests/all.rb: 22 runs, 0 failures. New tests: finish_command_ignores_before_remove_config_test.rb (AC1, AC2). Pipeline implementation 5: all gates passed except suite-check verdict:error, caused by ticket check 1 grepping plugins/os/tests; check corrected in the body; hand-finished.

Follow-ups: none (the verdict:error on a failed required-work check is already #841)

## Resolution **Done:** Deleted the worktree before-remove hook: before_remove.rb, the --implementation option, exit 6, search_path:, Config#lines, and 4 test files. finish runs no config commands; unknown options are a usage error. os:worktree finish step rewritten as one command plus an exit table; implement skill no longer passes an implementation id. ADR-0252 supersedes ADR-0240. **Evidence:** Commit 6cd75d59 on ticket-842. ruby plugins/os/tests/all.rb: 22 runs, 0 failures. New tests: finish_command_ignores_before_remove_config_test.rb (AC1, AC2). Pipeline implementation 5: all gates passed except suite-check verdict:error, caused by ticket check 1 grepping plugins/os/tests; check corrected in the body; hand-finished. **Follow-ups:** none (the verdict:error on a failed required-work check is already #841)
jared closed this issue 2026-09-30 16:52:49 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jared/cc-os#842
No description provided.