fix(ce-compound-refresh): check inbound links before deletion#713
fix(ce-compound-refresh): check inbound links before deletion#713
Conversation
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).
There was a problem hiding this comment.
💡 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".
- 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.
There was a problem hiding this comment.
💡 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".
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.
ce-compound-refreshcould auto-delete a learning whose code was gone without checking whether anything else in the repo cited it. PR #712 hit this: a sweep deletedclaude-permissions-optimizer-classification-fix.mdbecause 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: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.