feat: close agent-host integration parity gaps (CLI fallback, Claude hooks)#212
Conversation
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0561a89196
ℹ️ 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".
…ion-parity # Conflicts: # CHANGELOG.md
…ion-parity # Conflicts: # src/hooks.rs
…ion-parity # Conflicts: # src/hooks.rs
Summary
Audit of TraceDecay's agent-host integrations (host × feature parity) found two clearly-missing, low-risk gaps; both are fixed here.
1. CLI-fallback steering reached only Cursor and Codex (
feat(agents): add CLI-fallback steering to host prompt rules)The recent CLI-fallback work (PR #177) put "if MCP fails, use
tracedecay tool ..." into the Cursor plugin rule, the Codex session-hook context, the MCP server instructions, and theusing-the-cliskill — but none of the other hosts' prompt-rules surfaces. This PR adds a sharedCLI_FALLBACK_PROMPT_RULESparagraph (src/agents/mod.rs) and threads it into the prompt rules written for Claude Code (CLAUDE.md), Copilot/VS Code (copilot-instructions.md ×3), Gemini (GEMINI.md), OpenCode (AGENTS.md), Kimi (AGENTS.md), Vibe, and Kiro (steering file). Hosts with no managed rules surface (Zed, Cline, Roo Code, Antigravity, Kilo) still get the fallback via the MCP server instructions.2. Claude Code was missing the SessionStart / PostToolUse hook coverage every other hook-capable host has (
feat(claude): register SessionStart and PostToolUse lifecycle hooks)Cursor, Codex, and Kiro all register post-edit hooks for daemon-driven incremental sync, and Cursor/Codex inject session-start index-freshness plus the LCM compaction-recovery hint. Claude Code — which supports both events — only had
PreToolUse/UserPromptSubmit/Stop. Now:SessionStartemitshookSpecificOutput.additionalContextwith index freshness (or atracedecay initnudge in unindexed projects) and appends the LCM context-recovery hint when the session restarts from compaction (source: "compact").PostToolUse(matcherEdit|MultiEdit|Write|NotebookEdit|Bash) notifies the daemon for targeted sync, reusing the agent-agnosticpostToolUseEdit/postToolUseShelldaemon routing.claude.rsnow derives install/uninstall/doctor-check/auto-repair from a singleMANAGED_HOOKStable, so existing installs backfill the new hooks via the post-upgrade path ortracedecay doctor.Parity matrix findings (deferred items, with reasons)
agents/subagent defs (code-explorer, code-health-auditor, session-historian) exist only in the Cursor bundlebuild_codex_session_contextandhook_codex_session_start.InstallScope/global-DB env only used by Codexserveregistration.Coordination note: no changes to
src/serve.rs, doctor's Cursor checks, orcursor-plugin/files — those are owned by the in-flightcodex/serve-literal-workspacefolderandcodex/cursor-integration-hardeningbranches.Test plan
cargo check --all-targets— cleancargo clippy --all-targets— no new warnings (remaining ones are vendored libsql)cargo fmt --all -- --check— cleancargo test --test agent_suite(includesplugin_skill_contract_test,update_plugin_test,claude_agent_test) — 353 passedcargo test --lib -- agents:: hooks::— 161 passed (plus new unit tests forclaude_edit_rel_paths, edit-tool matching, index-status lines)cargo test --test hooks_lsp_suite— 104 passedcargo test --test update_health_pass_test— 4 passedhook-claude-session-startemits{}outside projects, an init nudge in unindexed repos, and the compaction-recovery hint forsource: "compact";hook-claude-post-tool-useexits 0 fail-open; freshinstall --agent copilotrenders the CLI-fallback paragraph