Skip to content

feat: close agent-host integration parity gaps (CLI fallback, Claude hooks)#212

Merged
ScriptedAlchemy merged 9 commits into
masterfrom
codex/host-integration-parity
Jul 2, 2026
Merged

feat: close agent-host integration parity gaps (CLI fallback, Claude hooks)#212
ScriptedAlchemy merged 9 commits into
masterfrom
codex/host-integration-parity

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

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 the using-the-cli skill — but none of the other hosts' prompt-rules surfaces. This PR adds a shared CLI_FALLBACK_PROMPT_RULES paragraph (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:

  • SessionStart emits hookSpecificOutput.additionalContext with index freshness (or a tracedecay init nudge in unindexed projects) and appends the LCM context-recovery hint when the session restarts from compaction (source: "compact").
  • PostToolUse (matcher Edit|MultiEdit|Write|NotebookEdit|Bash) notifies the daemon for targeted sync, reusing the agent-agnostic postToolUseEdit/postToolUseShell daemon routing.
  • claude.rs now derives install/uninstall/doctor-check/auto-repair from a single MANAGED_HOOKS table, so existing installs backfill the new hooks via the post-upgrade path or tracedecay doctor.

Parity matrix findings (deferred items, with reasons)

Gap Status
Cursor agents/ subagent defs (code-explorer, code-health-auditor, session-historian) exist only in the Cursor bundle Deferred — Claude Code supports custom subagents but uses a different definition format; porting is a new feature, not a wiring gap. Codex plugins have no subagent surface.
Codex plugin session-start steering / compaction hint / CLI fallback Already present — verified in build_codex_session_context and hook_codex_session_start.
Hermes plugin skill template lacks CLI-fallback text Deferred — Hermes generates its own Python tool handlers; the fallback story there is different (plugin calls the CLI already).
InstallScope/global-DB env only used by Codex By design — only the Codex plugin bundle distinguishes global vs repo-local serve registration.
New hosts (Windsurf standalone, etc.) Not built per task scope; all 15 existing hosts are installable, doctor-checkable, and listed in help + USER-GUIDE.

Coordination note: no changes to src/serve.rs, doctor's Cursor checks, or cursor-plugin/ files — those are owned by the in-flight codex/serve-literal-workspacefolder and codex/cursor-integration-hardening branches.

Test plan

  • cargo check --all-targets — clean
  • cargo clippy --all-targets — no new warnings (remaining ones are vendored libsql)
  • cargo fmt --all -- --check — clean
  • cargo test --test agent_suite (includes plugin_skill_contract_test, update_plugin_test, claude_agent_test) — 353 passed
  • cargo test --lib -- agents:: hooks:: — 161 passed (plus new unit tests for claude_edit_rel_paths, edit-tool matching, index-status lines)
  • cargo test --test hooks_lsp_suite — 104 passed
  • cargo test --test update_health_pass_test — 4 passed
  • Manual smoke: hook-claude-session-start emits {} outside projects, an init nudge in unindexed repos, and the compaction-recovery hint for source: "compact"; hook-claude-post-tool-use exits 0 fail-open; fresh install --agent copilot renders the CLI-fallback paragraph

@changeset-bot

changeset-bot Bot commented Jul 2, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 8f67f0f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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: 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".

Comment thread src/daemon.rs Outdated
@ScriptedAlchemy ScriptedAlchemy merged commit 25d625e into master Jul 2, 2026
14 checks passed
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