Skip to content

feat(hooks): inject the using-tracedecay mandate contract on Claude and Kiro - #249

Merged
ScriptedAlchemy merged 2 commits into
masterfrom
feat/adoption-contract-injection
Jul 3, 2026
Merged

feat(hooks): inject the using-tracedecay mandate contract on Claude and Kiro#249
ScriptedAlchemy merged 2 commits into
masterfrom
feat/adoption-contract-injection

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Stacked on #248 (base: feat/claude-plugin-bundle).

What

Makes all hosts inject tracedecay's session-start adoption contract. Today only Cursor and Codex inject the full using-tracedecay skill (wrapped in <EXTREMELY_IMPORTANT>); Claude emitted only a one-line index-status string and Kiro used "Prefer" preference language — so the plugin shipped the skill but two hosts never delivered the mandate.

Changes

  • Claude (src/hooks/claude.rs): claude_session_context_for_event now calls append_tracedecay_bootstrap_context on the initialized arm, injecting the full contract via the existing SessionStart additionalContext channel (index-status line retained).
  • Kiro (src/agents/kiro.rs): rewrote the steering body from ## Prefer tracedecay MCP tools preference prose to a compact mandate (moment→action + red-flags tables), keeping the CLI-fallback + delegate-guardrail blocks; PROMPT_MARKER updated in lockstep (install/uninstall/strip/doctor all key off the constant).
  • append_tracedecay_bootstrap_contextpub(super) so sibling hook modules can inject it.
  • Contract hardening (shared using-tracedecay skill, all 3 surfaces byte-identical): added a ## Scope and priority section with a subagent-skip guard (scoped subagents with explicit files don't re-run discovery) and a user-instruction priority ladder (defers to CLAUDE.md/AGENTS.md above the mandate) so it doesn't fight the host prompt or waste subagent tokens.

Tests

  • hooks_lsp_suite: 112 pass, incl. new test_claude_session_context_injects_bootstrap_when_initialized / _omits_bootstrap_for_unindexed_project.
  • agent_suite: kiro marker/idempotency, prompt-rules parity (new KIRO_MARKER), skill_lint {claude,cursor}, plugin_skill_contract byte-copies, plugin_bundle_sync — all pass; using-tracedecay byte-identical across claude/codex/cursor (single hash).
  • fmt/clippy/build clean.

🤖 Generated with Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@changeset-bot

changeset-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 9890962

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

ScriptedAlchemy and others added 2 commits July 3, 2026 19:17
The full using-tracedecay bootstrap (the `<EXTREMELY_IMPORTANT>` mandate)
was injected on Cursor and Codex session start but never on Claude or
Kiro, so two hosts shipped the skill without ever delivering the mandate.

- steering: expose `append_tracedecay_bootstrap_context` as `pub(super)`
  so sibling hook modules can inject the same contract.
- claude: `claude_session_context_for_event` now appends the bootstrap
  contract after the index status line on initialized projects, matching
  Cursor/Codex. Delivered via the SessionStart additionalContext channel.
- kiro: rewrite the static steering body from "Prefer tracedecay" preference
  language to a compact mandate (moment->action + red-flag tables), keeping
  the CLI-fallback block, the delegate guardrail, and the issue-report line.
  `PROMPT_MARKER` updated in lockstep to the new heading so install /
  uninstall / strip / doctor still anchor on the managed block.
- skill: add a SUBAGENT-STOP guard and instruction-priority ladder to the
  shared using-tracedecay SKILL.md (cursor + codex copies kept byte-
  identical) so scoped subagents skip re-discovery and the mandate defers
  to explicit user instructions and CLAUDE.md / AGENTS.md.
- tests: assert Claude SessionStart injects the bootstrap when initialized
  and omits it for unindexed workspaces; update Kiro marker assertions and
  the prompt-rules parity marker to the new Kiro heading.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Rebasing feat/adoption-contract-injection onto the claude-plugin bundle
surfaced two byte-identity/build gaps in the bundle base:

- claude-plugin/skills/using-tracedecay/SKILL.md lacked the adoption
  "## Scope and priority" section (SUBAGENT-STOP guard + user-instruction
  priority ladder) that the codex/cursor copies carry. Copied the section
  in so all three using-tracedecay/SKILL.md copies are byte-identical, as
  the cross-surface byte-identity tests (claude_bundle_skills_stay_byte_
  identical_to_the_codex_source, plugin_bundle_sync) require.

- claude-plugin/.mcp.json was referenced by src/agents/claude.rs via
  include_str! but never committed: .gitignore ignores `.mcp.json` and only
  negated codex-plugin/.mcp.json. The lib failed to build. Added the file
  (byte-identical to codex-plugin/.mcp.json: stdio serve + global-DB env)
  and a matching `!claude-plugin/.mcp.json` gitignore negation so it is
  tracked. Satisfies claude_bundle_mcp_config_declares_the_tracedecay_server.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ScriptedAlchemy
ScriptedAlchemy force-pushed the feat/adoption-contract-injection branch from 1bd9587 to 9890962 Compare July 3, 2026 19:21
@ScriptedAlchemy
ScriptedAlchemy changed the base branch from feat/claude-plugin-bundle to master July 3, 2026 19:39
@ScriptedAlchemy
ScriptedAlchemy merged commit 6cc152e into master Jul 3, 2026
29 of 30 checks passed
@ScriptedAlchemy
ScriptedAlchemy deleted the feat/adoption-contract-injection branch July 4, 2026 01:13
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