Skip to content

fix(ce-compound-refresh): check inbound links before deletion#713

Merged
tmchow merged 7 commits intomainfrom
tmchow/ce-compound-refresh-inbound-links
Apr 28, 2026
Merged

fix(ce-compound-refresh): check inbound links before deletion#713
tmchow merged 7 commits intomainfrom
tmchow/ce-compound-refresh-inbound-links

Conversation

@tmchow
Copy link
Copy Markdown
Collaborator

@tmchow tmchow commented Apr 28, 2026

ce-compound-refresh could auto-delete a learning whose code was gone without checking whether anything else in the repo cited it. PR #712 hit this: a sweep deleted claude-permissions-optimizer-classification-fix.md because its skill isn't in this repo, but 8 plan-file citations dangled until a reviewer caught it.

The Delete logic now requires a final check for inbound references — across docs/, plugins/, and project instruction files — before classification or unlinking. If references exist, the agent picks one of three paths: clean up the citers in the same commit, downgrade to Replace (rewrite at the same path), or downgrade to stale-marking. Autofix mode auto-downgrades to stale-marking on any inbound link, since cleanup is judgment work.

Three coordinated edits to SKILL.md:

  • Core Rule 8 — adds inbound-link check as a precondition for auto-delete
  • Phase 2 "Delete" — new "Before deleting: check for inbound links" subsection with the three resolution paths; auto-delete criteria now require "no inbound links remain"
  • Phase 4 "Delete Flow" — final inbound-link gate before the unlink, with the same three resolution paths

The check is steered toward native content-search tools (e.g., Grep in Claude Code) for efficiency and to avoid permission prompts, without forbidding shell when the agent judges it materially better. Search guidance also notes searching narrowly (filename slug is usually unique) and reading context lines rather than whole files when evaluating each match.


Compound Engineering
Claude Code

The Delete flow checked the implementation and problem domain but never
verified that other files cite the doc. A skill running in autofix mode
deleted a learning that had 8 inbound citations across 3 plan files;
those references dangled until the next reviewer caught it.

Adds an inbound-link check as a precondition for Delete classification
and as a final gate in the Delete Flow execution. Steers the agent
toward the platform's native content-search tool (e.g., Grep in
Claude Code) for efficiency without forbidding shell when judgment
warrants. References get cleaned up alongside the delete in the same
commit, downgraded to Replace (rewrite at the same path), or downgraded
to stale-marking (autofix mode hands off to a human).
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: 90ab5b9720

ℹ️ 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".

Comment thread plugins/compound-engineering/skills/ce-compound-refresh/SKILL.md Outdated
tmchow added 3 commits April 28, 2026 00:46
- Split Delete Flow per-match handling by mode. Autofix mode now
  terminates Delete classification on any inbound-link match and
  stale-marks immediately; the cleanup and Replace paths are explicitly
  gated to interactive mode.
…eanup

Cleanup of citations is always mechanical: parentheticals dropped,
"see X for details" clauses removed, bare reference list entries
deleted. The judgment lives upstream — given the citations, is Delete
still the right call, or is Replace closer to right?

- Decorative citations (principle stated inline, citation is
  decorative): Delete + cleanup is fine, including in autofix.
- Substantive citations (citing doc relies on cited doc to provide
  content not stated inline): signal Replace instead. Autofix
  stale-marks rather than writing a successor unattended.
- Mixed or unclear: stale-mark.

Replaces the prior "any inbound link -> stale" rule (too conservative)
and the per-match decorative/substantive cleanup taxonomy (wrong-
flavored — cleanup is uniform; the taxonomy belongs at classification).
Phase 4 Delete Flow no longer re-litigates the classification — it
trusts Phase 2's call and only escalates if a substantive citation
surfaces late.
Cuts ~30% of the inbound-link section: collapses the three-bullet
auto-delete criteria (each repeating "AND decorative") into three
conditions, drops the "removing a citation example" enumeration, drops
restated principles already covered by earlier rules. Phase 4 Delete
Flow trimmed to two short paragraphs with the autofix vs interactive
escalation as a single inline branch instead of a separate section.

Same rules; less prose.
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: 16d8390c69

ℹ️ 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".

Comment thread plugins/compound-engineering/skills/ce-compound-refresh/SKILL.md Outdated
tmchow added 3 commits April 28, 2026 01:01
The inbound-link search instructions named `plugins/` as a place to
look — but `plugins/` is specific to this multi-plugin development
repo. A user installing the skill into their own codebase has no
plugins/ directory. Replace explicit folder lists with "search the
repo" and trust the agent to scope. The filename slug is unique
enough that one repo-wide query covers all citation sites.
Citations to learning docs live in markdown (other docs, plans,
instruction files, READMEs), not source code where they only appear in
comments and are rare. "Search the repo" was wasteful and
underspecified. Narrowing to markdown content makes the intent clear
and the search faster, without naming specific folders that may not
exist in user repos.
- Phase 4 Delete Flow late-discovery gate now mirrors Phase 2's full
  three-class taxonomy: escalates on substantive AND mixed/unclear
  citations, with cleanup-and-proceed only when late-discovered
  citations are unambiguously decorative.
@tmchow tmchow merged commit e806522 into main Apr 28, 2026
2 checks passed
@github-actions github-actions Bot mentioned this pull request Apr 28, 2026
michaelvolz pushed a commit to michaelvolz/compound-engineering-plugin-windows-version that referenced this pull request Apr 28, 2026
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