Skip to content

refactor(hooks): split init.rs into per-agent submodules - #3878

Merged
KuSh merged 2 commits into
rtk-ai:developfrom
jpds:refactor/hooks-init-split
Sep 25, 2026
Merged

KuSh merged 2 commits into
rtk-ai:developfrom
jpds:refactor/hooks-init-split

Conversation

@jpds

@jpds jpds commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Split the gargantuan init.rs into per-agent submodules.
  • Verify the bodies are byte-identical modulo visibility markers.
  • Remove the fancy comment headers from files.

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test
  • Manual testing: rtk <command> output inspected

Important: All PRs must target the develop branch (not master).
See CONTRIBUTING.md for details.

@jpds
jpds force-pushed the refactor/hooks-init-split branch 2 times, most recently from 271680b to f0cbf73 Compare September 13, 2026 17:26
@KuSh KuSh self-assigned this Sep 17, 2026

@KuSh KuSh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Round 1 of 3 — CHANGES REQUESTED

Claim: Split the 11,123-line src/hooks/init.rs into twelve per-agent submodules, bodies unchanged.

Scope: accept (round 1, frozen). The split is worth merging as stated — I verified the claim independently and it holds. Nothing here argues for narrowing; the one blocking item is that the branch is a 14-day-old snapshot.

Ran: merge-base d0c29851 vs head f0cbf73d vs develop@0a71fcf3, one CARGO_TARGET_DIR each (binary md5 93f8086 / 0adc158 / fd9e220 — all distinct). Per-item structural diff of all 221 top-level items; rtk init --show before/after against a mode-000 Cursor hook; full gate on the head and on the merged tree. Savings: N/A — pure refactor, no command output changes, so the 20% floor doesn't apply.

CI @f0cbf73d: never run. One run exists (34771579972, created 2026-09-13) stuck at action_required with 0 jobs — it never executed. Approving it now would achieve nothing: while the PR conflicts there is no merge commit for pull_request to build. Only license/cla is green.

Blocks merge (1, frozen at round 1)

1. src/hooks/init/mod.rs — stale base: the modify/delete resolution silently reverts develop.

The conflict is modify/delete on src/hooks/init.rs. Resolving it the natural way (git rm src/hooks/init.rs) discards all four develop commits to that file (229 insertions / 243 deletions). Three announce themselves; one does not:

develop commit what catches it if dropped
ad631395 rustfmt style-edition 2024 cargo fmt --check — 14 files
7c185671 edition 2024 cargo test --all fails to compile — 12 × E0133
d00c514e let-chains cargo clippy --all-targets — 18 × collapsible_if
75b30a44 unreadable Cursor hook nothing. No test, no lint, cargo build --release succeeds.

The loud three mask the silent one: fix fmt, clippy and the compile errors, and the revert is still sitting there. Evidence — rtk init --show with chmod 000 ~/.cursor/hooks/rtk-rewrite.sh:

develop  93f8086:  [warn] Cursor hook: … (legacy script, NOT executable)
                   …full report…                              exit 0
merged   fd9e220:  rtk: Permission denied (os error 13)        exit 1

A status command failing on the thing it is meant to report about — exactly the regression 75b30a44 removed. Test that closes it: none exists. 75b30a44 shipped no test, which is precisely why the revert is invisible.

One caveat on the rebase: 7c185671 is not a mechanical unsafe {} wrap — develop restructured those 12 std::env::set_var/remove_var sites into temp_env::with_var closures (temp-env was added to [dev-dependencies] for it). I started preparing this as a fixup and stopped there: that part is real porting work, better done by you than guessed by me.

Optional — will not hold merge

  • agents.rs:1 — //! Agents agent: hook install/uninstall helpers. names an agent that doesn't exist; the file holds Cline/Roo Code, Windsurf, Kilo Code, Antigravity and Kimi. opencode.rs:1 says //! Opencode agent: but the file carries 70 Pi references. Both read as template fill.
  • Six in-repo references to the now-deleted path, across five files: hooks/README.md:9, AWARENESS_CONFIG.md:73 and :214, .claude/rules/search-strategy.md:149, .claude/agents/rust-rtk.md:328, .claude/commands/tech/codereview.md:66.

I deliberately did not prepare these as a fixup commit — whatever you do to resolve the conflict is likely to drop a commit added now. Fold them into that push.

Checked and correct — no need to re-verify

  • The core claim holds. All 221 top-level items reproduced, 0 missing; every body byte-identical after normalizing visibility, rustfmt's vertical-signature trailing comma, and the include_str! depth bump (../../ → ../../../, correct one level deeper).
  • 234 #[test] functions, identical name set. 31 pub items, identical names — external API surface unchanged.
  • Comments: only 19 decorative ─── banners removed. No comment content lost.
  • Head on its own base: cargo fmt --check clean, cargo clippy --all-targets clean, 3578 tests pass.
  • agents.rs is a sensible home for the Cursor-family agents — that hypothesis dropped.

Hypotheses built and dropped

  • "The 100 added normalized lines hide a semantic change" — all accounted for: signature rewraps, #[cfg(test)] headers, include_str! depths, re-exports.
  • "A line moved into a different function" — the per-item body diff rules this out; the 9 flagged items differ only by rustfmt layout.
  • "Non-Cursor agents lost their section markers" — they are in agents.rs, named.

Your questions

None — no comments or review threads on the PR.

Next

Rebase carrying develop's four commits, and specifically 75b30a44 — the other three will shout at you, that one will not. Then the fresh CI run will need approving (this PR has never been built).

One coordination fact worth flagging: 44 other open PRs touch src/hooks/init.rs, and a file deletion hands every one of them the same modify/delete conflict the moment this lands. That is an argument for landing it in a deliberate window, not against landing it.

Rounds: 1/3. Threads: 0 open, 0 resolved this round.

Comment thread src/hooks/init/mod.rs Resolved
jpds added a commit to jpds/rtk that referenced this pull request Sep 18, 2026
Drops the dead _is_thin read (PR rtk-ai#3878 review): its '?' aborted
rtk init --show before the rest of the report when the legacy
Cursor hook file exists but is unreadable.
@jpds
jpds force-pushed the refactor/hooks-init-split branch from f0cbf73 to 46264c5 Compare September 18, 2026 07:14

@KuSh KuSh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Round 2 of 3 — CHANGES REQUESTED

Claim: Split the 11,109-line src/hooks/init.rs into twelve per-agent submodules, bodies unchanged.

Scope: accept (round 1, frozen). The rebase landed cleanly and the split holds up — see "Checked and correct".

Ran: develop 6d104308 vs head 46264c58, one CARGO_TARGET_DIR each (md5 5380e491 / 984c944c, distinct). Re-ran the round-1 matrix in full against develop's init.rs, the round-1 blocker repro, and semgrep in Docker against .semgrep.yml. Savings: N/A — pure refactor, no command output changes.

CI @46264c58: fmt, clippy, doc review, test presence, Security Scan, benchmark, and test on ubuntu + macOS + windows all green. semgrep security scan failing — item 1.

Round 1's blocker is cleared

75b30a44 is carried: the _is_thin read is gone and rtk init --show against a mode-000 Cursor hook now produces output byte-identical to develop, exit 0 (round 1: Permission denied, exit 1). The other three develop commits are carried too — 0 raw env::set_var (4 temp_env::with_var), 7 let-chains matching develop's 7, edition 2024, fmt clean. Thread resolved.

Blocks merge (1)

1. semgrep security scan is red, and it will stay red until the deletion sites are annotated.

The job runs semgrep scan --config .semgrep.yml --baseline-commit <base>, which normally reports nothing for unchanged code. The split defeats that, and the log says so: "Skipping baseline scan, because all current findings are in files that didn't exist in the baseline commit." So all 21 fs::remove_* calls get rescanned and the 9 carrying no annotation fail the job.

I checked this is not new deletion code: develop has 21 calls (1 remove_dir_all, 20 remove_file), the head has the same 21, both have the same 12 annotated and the same 9 bare. Reproduced locally in Docker — 9 blocking, matching CI exactly.

The nine, at this head:

cursor.rs:27      let _ = fs::remove_file(&old_hook);
gemini.rs:265     fs::remove_file(&hook_path)
gemini.rs:277     fs::remove_file(&gemini_md)
mod.rs:914        fs::remove_file(&hook_path)
mod.rs:937        fs::remove_file(&rtk_md_path)
mod.rs:1397       let _ = std::fs::remove_file(&hash_file);
mod.rs:1409       let _ = std::fs::remove_file(&cursor_hook);
opencode.rs:772   fs::remove_file(&path)
opencode.rs:834   fs::remove_file(&plugin_path).unwrap();

All nine are hook/RTK.md/plugin cleanup on uninstall paths, plus one test — exactly what the rule's own message calls expected ("Expected in hooks/init cleanup"). How you silence it is your call; the repo already annotates the other 12 with // nosemgrep: filesystem-deletion.

Requested this round

These are not retroactive additions to round 1's blocking set — they were all present at f0cbf73d and I missed them. They are not merge gates on their own; I'm raising them now because the PR is coming back for item 1 anyway and you are in this code.

2. The split assigns generic AGENTS.md helpers to claude.rs, which does not use them.

In init.rs these had no owner — one file holds everything, so there was no wrong place. The split has to choose, and it chose Claude:

function defined in called from
patch_agents_md claude.rs codex.rs
remove_rtk_reference_from_agents claude.rs codex.rs
write_rtk_block claude.rs copilot.rs, agents.rs, mod.rs
remove_rtk_block claude.rs codex.rs, copilot.rs, mod.rs

claude.rs is not a caller of any of the four, and AGENTS_MD is referenced by codex.rs, agents.rs, mod.rs and opencode.rs — never by claude.rs. Related: rtk_block builds the block in mod.rs while write_rtk_block writes it from claude.rs, so the pair straddles two files.

Where they belong is yours to decide — a dedicated module under init/, or core/. The ask is only that they stop being Claude's.

3. agents.rs is named after one of the things it isn't.

agents collides three ways: Antigravity's .agents/rules directory, Kimi writing AGENTS.md, and patch_agents_md over in claude.rs. The five it holds — Cline/Roo Code, Windsurf, Kilo Code, Antigravity, Kimi, at 27–65 lines each — share exactly one property: they install no hook and are configured by writing an instructions file, all ending in print_rules_only_awareness_note. Grouping them is reasonable (five ~50-line files would be out of proportion; the smallest sibling is gemini.rs at 365). Naming them for that property would make the grouping legible. The header //! Agents agent: hook install/uninstall helpers. is doubly wrong: there is no "Agents agent", and the file installs no hook.

4. show_claude_config is the one item that is not a verbatim move.

It carries the pre-rebase if let Ok(..) = resolve_opencode_dir()/resolve_cursor_dir() { .. } else { .. } where 7c185671 had already rewritten both as match. The two forms are equivalent, clippy is clean and the output is identical, so nothing is broken. But it is the only divergence: with it restored, all 221 top-level items are byte-identical to their old home, and the whole refactor becomes checkable by machine rather than by reading. For an 11k-line move that property is worth keeping.

5. Docs.

//! Opencode agent: hook install/uninstall helpers. — the file also owns all of Pi (PI_PLUGIN, resolve_pi_dir, run_pi_mode*). And six in-repo references still point at the deleted path: hooks/README.md:9, AWARENESS_CONFIG.md:73 and :214, .claude/rules/search-strategy.md:149, .claude/agents/rust-rtk.md:328, .claude/commands/tech/codereview.md:66.

Checked and correct — no need to re-verify

  • 221 top-level items, 0 missing, and 0 changed apart from item 4, compared against develop's init.rs with visibility, rustfmt layout and the include_str! depth bump normalised. The bodies really are unchanged.
  • 234 #[test] functions, identical name set; 3809 tests pass locally.
  • All 12 pre-existing nosemgrep annotations carried.
  • External API surface unchanged.
  • Grouping the five rules-only agents is sound; only the name and header are at issue.
  • opencode_plugin_path / prepare_opencode_plugin_path / ensure_opencode_plugin_installed called from claude.rs are a genuine cross-agent dependency (rtk init --opencode), not misplacement. Same for run_gemini / run_copilot / uninstall_codex reached from mod.rs and hook_cmd.rs — those are entry points being routed.

Hypotheses built and dropped

  • "The rebase dropped one of develop's four commits again" — all four verified present by execution.
  • "semgrep found real new deletion code" — dropped; 21/12/9 identical on both sides.
  • "The five rules-only agents should each get their own file" — dropped; 27–65 lines each against a 365-line smallest sibling.
  • "prompt_user_confirmation / prompt_user_consent / prompt_telemetry_consent in mod.rs are misplaced" — dropped, they are genuinely generic and mod.rs is the right home.

Next

Annotate the nine deletion sites so CI can go green; that is the only merge gate. Items 2–5 are cheap while you are here and I would rather they land with the move than trail it. CI has to be approved by a maintainer on each push — ping me and I will approve the run.

Rounds: 2/3. Threads: 1 resolved this round, 0 open.

Comment thread src/hooks/init/cursor.rs Resolved
@jpds
jpds force-pushed the refactor/hooks-init-split branch from 46264c5 to 8afb151 Compare September 19, 2026 08:48
@jpds
jpds force-pushed the refactor/hooks-init-split branch from 8afb151 to 5ec8b8c Compare September 22, 2026 20:49
@KuSh KuSh mentioned this pull request Sep 24, 2026
4 tasks done
…ew modules

develop changed src/hooks/init.rs after this branch's base (rtk-ai#4151: consolidate
hook config I/O, and the null-matcher follow-up). Resolving the modify/delete
conflict by keeping the split alone would drop those changes: the merged tree
builds and its test suite passes, yet `rtk init -g --uninstall` removes a
user's own hook from a group it shares with RTK's, where develop prunes only
the RTK entry.

Carry each of develop's changes to the file its item now lives in: the sixteen
rewritten helpers in mod.rs, codex.rs, cursor.rs and trae.rs; the shared
hook-entry helpers (is_command_hook, group_covers_tool,
claude_group_covers_bash, HookEntries, hook_present, append_hook_entry,
remove_hook_entries) after clean_double_blanks in mod.rs;
is_cursor_hook_entry in cursor.rs; print_codex_hook_status beside its only
caller in codex.rs; and the six new tests after
test_global_default_mode_creates_artifacts in mod.rs.

Restore the 26 `///` doc comments the split dropped -- read_json_file,
patch_claude_md, patch_agents_md and 23 Codex tests -- verbatim from develop,
and move the `upsert_rtk_block tests` banner to agents_md.rs, where that test
now lives.

Narrow the module's visibility to what is used. The split had re-exported
eight submodules with `pub(crate) use x::*` and marked 154 moved items
`pub(crate)`, although nothing outside src/hooks/init/ uses any of them except
copilot_user_dir and COPILOT_HOOK_JSON (hook_cmd.rs). Submodules see mod.rs's
private items and its private glob imports through `use super::*`, so the
globs become private, the helpers shared between submodules become
pub(super), and the rest return to private. Four functions init.rs had
exported -- run_omp_mode, uninstall_omp, uninstall_omp_with_patch_mode and
run_pi_mode -- were left `pub` inside private modules with no re-export; in a
binary crate a re-export nobody calls is an unused import, so the three that
only tests (or nothing) call are private with their `allow(dead_code)`
comment rewritten to say so, and the one mod.rs calls is pub(super).

Put code where its callers are. print_instructions_agents_awareness_note
is named for instructions_agents.rs and called only from there; GEMINI_MD is
used only by gemini.rs; read_json_file, backup_path_for and
backup_and_atomic_write had drifted from beside atomic_write to the bottom of
mod.rs; is_codex_hook_command and is_trae_hook_command each have a single
consumer, so they leave hooks/mod.rs for codex.rs and trae.rs with their four
tests (is_claude_hook_command stays: four modules use it). run_pi_mode and
run_omp_mode are called only by their files' tests, so they live in those test
modules; uninstall_omp has had no caller since OMP uninstall
started going through uninstall_omp_with_patch_mode, and is gone. The one test that
exercised cursor.rs helpers from mod.rs moves to cursor.rs, which lets
insert_cursor_hook_entry and remove_cursor_hook_from_json be private again.
The remaining pub(super) items are entry points the mod.rs dispatcher calls,
the shared block helpers in agents_md.rs, the OpenCode plugin helpers the
Claude flow installs alongside its own hook, and eight helpers pinned by three
tests that deliberately exercise several agents' hook registration side by
side.

Pi and Oh My Pi share one extension file: OMP loads Pi's `rtk.ts` through its
legacy-pi-compat layer, and 170 of omp.rs's 253 lines were calls into the
Pi machinery that lived in opencode.rs beside the unrelated OpenCode plugin.
pi.rs now holds both agents and the shared install, uninstall, stock-content
and ownership-tracking code; opencode.rs keeps the OpenCode plugin alone.
The Claude settings.json flow -- run_default_mode, patch_settings_json_command
and the migration helpers, some 490 lines and 26 tests -- moves from mod.rs
to claude.rs, which until now held only the CLAUDE.md patching its header
did not describe. canonicalize_path_for_comparison is a filesystem helper
codex.rs depends on, so it joins read_json_file in mod.rs; the two Pi/OMP
test fixtures follow their tests into pi.rs. Each file imports the constants
it uses instead of receiving all fifty through mod.rs, and mod.rs
glob-imports only the two modules whose helpers siblings share.

Three copies of the same logic, all older than the split, collapse onto the
helpers that already existed. Four of the five "config directory from an env
override, else under home" resolvers become calls to resolve_config_dir
(Droid's stays: its override replaces the home directory itself, and now
says so). remove_hook_from_settings re-implemented read_json_file and
backup_and_atomic_write inline; it and the six other per-agent "serialise,
print under --dry-run, back up, write atomically, report under -v" envelopes
in claude.rs, codex.rs, cursor.rs and droid.rs go through update_json_file,
which takes each site's messages as arguments so every line they print stays
the same (Trae's all-or-nothing batch is left as it is). One behaviour
changes on purpose: copilot_user_dir treated an empty COPILOT_HOME as a
path and wrote Copilot's files relative to the working directory; like the
other agents it now ignores an empty override and falls back to home.

instructions_agents.rs opened with `///` above `use super::*;`, which documents
the import; make it the `//!` module header the other files use. The last
three `// --- section ---` banners go the way of the ones the split already
removed, and remove_rtk_block's doc no longer names CLAUDE.md -- it strips the
block from any instructions file.

Apart from the deletion, the moves and the thirteen de-duplicated functions
named above, every top-level item in develop's init.rs is byte-identical to its copy in src/hooks/init/, doc
comments included, modulo visibility, rustfmt layout, the include_str! paths
one directory deeper, and the split's rename of print_rules_only_awareness_note
to print_instructions_agents_awareness_note; develop's 297 tests all match by
name.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

@KuSh KuSh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Round 3 of 3 — APPROVED, fixup pushed

Claim: Split the 13,626-line src/hooks/init.rs into per-agent submodules, bodies unchanged.
Scope: accept (round 1, frozen).
Ran: develop feac25d1 vs author head 5ec8b8c6 vs fixup 384b8a5c, one CARGO_TARGET_DIR each (md5 bfbb8701 / dc9bb90c / 13b1fb3f), plus a fourth for the naive-merge tree (84b189e3). Per-item structural diff of every top-level item against develop's init.rs; doc-comment and test-name audits; rtk init before/after in isolated HOMEs — five targeted scenarios and a 920-case matrix covering every init form (13 agents × local/global × install/uninstall × --auto-patch/--no-patch/default × --dry-run, plus the --show forms) on six seeds — empty; user hooks, files and a legacy script; env overrides pointing at custom dirs; empty env overrides; empty/BOM/invalid/null JSON in every hook file; pre-existing .bak files — with and without -v, each run twice and then uninstalled, comparing exit code, stdout, stderr and every file under HOME; semgrep and a Windows cfg cross-check; two independent review passes. Savings: N/A — pure refactor.
Matrix: executed rounds 1 and 2; re-executed this round on 5ec8b8c6 and on 384b8a5c.
CI @5ec8b8c6: 10/10 green. @384b8a5c: 10/10 green (run 36197873695: fmt, clippy, doc review, test presence, semgrep, Security Scan, benchmark, test on ubuntu/macOS/windows) plus the CLA check.

Round 2's five items — all addressed by the author

semgrep 0 findings (21/21 annotated); the AGENTS.md helpers in agents_md.rs; agents.rs → instructions_agents.rs; show_claude_config verbatim again; 0 stale references.

Blocks merge (0)

What stood between this head and merge was develop, not the PR: #4151 landed on init.rs after your rebase (+483/−344, eight functions, six tests), making the merge a modify/delete conflict for the third time. Resolved by keeping the split, the tree builds and 3832 tests pass, and:

settings.json: shared "Bash" group holding "rtk hook claude" and the user's "echo user"
$ rtk init -g --uninstall
develop  bfbb8701:  group kept, only "echo user" remains        exit 0
naive    84b189e3:  "PreToolUse": []  — the user's hook is gone   exit 0

Content loss, silent except one unrelated integration test. Round 3 does not ask for a fourth rebase, so the fixup carries it.

Fixup 384b8a5c — one merge commit, parents 5ec8b8c6 + feac25d1

Carries develop. Each of #4151's changes to the file its item lives in — sixteen rewritten helpers, the shared hook-entry helpers after clean_double_blanks in mod.rs, is_cursor_hook_entry in cursor.rs, print_codex_hook_status beside its only caller in codex.rs, six tests — plus the 26 /// doc comments the last re-split dropped, restored verbatim.

Puts code where its callers are (at the maintainer's request, after two review passes on the fixup itself):

  • claude.rs was titled "hook install/uninstall helpers" and held none; the Claude settings.json flow — run_default_mode, patch_settings_json_command, the migration helpers, ~490 lines and 26 tests — moves there from mod.rs, which drops from 3,130 to 2,345 lines
  • pi.rs now holds Pi and Oh My Pi together with the shared-extension machinery they both use (OMP loads Pi's rtk.ts; 170 of omp.rs's 253 lines were calls into it); opencode.rs keeps the OpenCode plugin alone (135 lines)
  • is_codex_hook_command / is_trae_hook_command (one consumer each) leave hooks/mod.rs for codex.rs / trae.rs with their four tests; is_claude_hook_command stays — four modules use it
  • print_instructions_agents_awareness_note → instructions_agents.rs; GEMINI_MD → gemini.rs; canonicalize_path_for_comparison (a filesystem helper codex.rs depends on) → mod.rs beside read_json_file; the atomic-write trio back beside atomic_write; the two Pi/OMP test fixtures → pi.rs
  • run_pi_mode and run_omp_mode are called only by their files' tests and now live in those test modules; uninstall_omp has had no caller since OMP uninstall went through uninstall_omp_with_patch_mode (256d4a77, a month before the split) and is gone
  • the one mod.rs test that exercised only cursor.rs helpers moves to cursor.rs, letting two helpers be private again

Narrows visibility to what is used. The split had eight pub(crate) use x::* globs and 154 pub(crate) items; nothing outside src/hooks/init/ used any of them except the two Copilot items hook_cmd.rs reads. Now: 3 pub(crate) (those two plus their re-export), pub(super) only where a parent or sibling actually calls, private globs for the two modules whose helpers siblings share (agents_md, pi) and by-name imports for the rest, and each file imports the constants it uses instead of receiving all fifty through mod.rs. The four names init.rs had exported but nothing calls (run_omp_mode, uninstall_omp, uninstall_omp_with_patch_mode, run_pi_mode) stay unexported: in a binary crate a re-export nobody calls is an unused import under deny(warnings) — tried it, 2 errors.

De-duplicates three pre-existing copies (maintainer's call): four of the five "config dir from env override, else under home" resolvers become resolve_config_dir (Droid's override replaces home itself and now says so); remove_hook_from_settings no longer re-implements read_json_file + backup_and_atomic_write inline; it and six other per-agent serialise/dry-run/backup/write/report envelopes in claude.rs, codex.rs, cursor.rs, droid.rs go through update_json_file, which takes each site's messages as arguments so every printed line is unchanged (Trae's all-or-nothing batch stays). Net −20 lines. One behaviour change, on purpose: copilot_user_dir treated an empty COPILOT_HOME as a path and wrote Copilot's files relative to the working directory; like every other agent it now ignores an empty override and falls back to home. The matrix shows exactly that and nothing else.

Wording. instructions_agents.rs gets a //! header; the last three // --- section --- banners go; remove_rtk_block's doc no longer names CLAUDE.md; three comments that pointed across files by bare name now say which file.

Verified on 384b8a5c

fmt / clippy / Windows cfg cross-check clean · 3954 passed / 0 failed · semgrep 0 in init/ · 272 top-level items, 0 changed against develop's init.rs (the only ones not found at top level are the deletion, the two test helpers and the rename named above) · doc comments identical on 583 items except the three rewritten on purpose · develop's 297 tests all present by name, +4 that followed the matchers in, no duplicates · hooks/mod.rs vs develop is exactly −2 functions −4 tests, 0 additions · five targeted repros byte-identical to develop, including pi install → omp install → omp --show → omp --uninstall · the 920-case matrix: 0 differences and 0 crashes across 920 cases × 2 seeds × up to 3 phases per case · a fresh checkout of the commit rebuilds to the same binary.

Hypotheses built and dropped

  • "uninstall_omp having no caller means the split lost one" — git grep on develop, the merge-base and every PR head: no caller anywhere; git log -S puts the last call at 256d4a77 (2026-08-28). Dead before the split.
  • "37ec9595's null-matcher handling is lost and Trae registers twice" — develop does it too (2 groups both sides).
  • "semgrep over all of src/hooks/ reports 3 findings" — hook_cmd.rs and integrity.rs, files this PR never touches; develop has the same three plus nine in init.rs, so the moved code is now cleaner than develop.
  • "Restore the four exported names with pub use" — unused imports under deny(warnings); see above.
  • "The #4151 revert is loud" — half true: one unrelated test fails, the ownership semantics revert silently.

Follow-ups

  • The matrix also showed, on both binaries, that rtk init -g fails in a HOME with no ~/.claude (atomic_write never creates the parent). That is #2519, already documented there with a fix in #2521; nothing to add and nothing this PR changes. Note for whoever lands second: #2521 edits src/hooks/init.rs, so after this merge its fix re-applies in init/mod.rs (atomic_write / write_if_changed) and init/claude.rs (the settings.json patch).

Your questions

None posted.

Next

Nothing — approving. Merge soon: this branch has conflicted three times in eleven days, every time on a develop commit to init.rs. Thank you for carrying an 11k-line move through two rebases and a full round of relocation cleanly; the layout is now checkable by machine, which is what made an 11k-line diff reviewable.

Rounds: 3/3. Threads: 0 open, 2 resolved (round 1 by 46264c58, round 2 by 5ec8b8c6).

@KuSh
KuSh merged commit c50ff30 into rtk-ai:develop Sep 25, 2026
11 checks passed
@rtk-release-bot rtk-release-bot Bot mentioned this pull request Sep 25, 2026
KuSh added a commit to rNoz/rtk that referenced this pull request Sep 25, 2026
Carries the Cursor hunk into src/hooks/init/cursor.rs after the init.rs
split (rtk-ai#3878).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

2 participants