Skip to content

🤖 docs: RFC for Cursor plugin support - #7829

Merged
ThomasK33 merged 13 commits into
mainfrom
cursor-plugins/rfc
Oct 31, 2026
Merged

ThomasK33 merged 13 commits into
mainfrom
cursor-plugins/rfc

Conversation

@ThomasK33

Copy link
Copy Markdown
Member

Summary

Adds rfc/20261030_cursor-plugin-support.md, the design for loading Cursor plugins (.cursor-plugin/plugin.json) and the Cursor marketplace (.cursor-plugin/marketplace.json) from the Plugins tab. Xum translates their skills, rules, agents, MCP servers and hooks into the parts it already has. This PR adds only the document. The implementation follows as its own PRs.

Background

The official Cursor marketplace (github.com/cursor/plugins) lists 128 plugins. Xum reads 2 of them today, because the rest ship only a Cursor manifest, and Xum skips such a folder with no message.

Implementation

The RFC records 29 decisions (D1-D29) and a plan of 9 PRs, each with its files, changes and tests. Scope rule: v1 builds what the marketplace plugins use today and tracks the rest. Section 8 lists every change to shipped behavior: the merged marketplace list, the Codex PreToolUse failure rule, and the turn-stop text passed to hooks.

Validation

  • The design went through two Goldfish review rounds (six lenses each) and a consolidated review, then an implementation-readiness re-audit.
  • PR 4 was re-anchored against main after 🤖 feat: per-agent Anthropic prompt-cache TTL #7767 moved the AI-settings layer code.
  • Docs only. make static-check passes.

Risks

None at runtime: this PR adds one Markdown file under rfc/.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $34.06

Adds rfc/20261030_cursor-plugin-support.md, the owner-approved design for
reading Cursor plugins (.cursor-plugin/plugin.json) and the Cursor
marketplace (.cursor-plugin/marketplace.json) from the Plugins tab, and
translating their skills, rules, agents, MCP servers and hooks into Xum's
Agent Plugin model. It records every owner decision (D1-D20), the
alternatives rejected, the changes to shipped behavior, and a 10-PR
implementation plan with a verification plan.

Drafted with the EGM brainstorm and draft skills (two Goldfish review
rounds). The EGM review runs next, in a separate workspace.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high` • Cost: `$16.80`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high costs=16.80 -->
Apply the 20 PROPOSE FIX items from the EGM Goldfish review (auto accept).
Owner decisions (D1-D20) are unchanged. D3, D6 and the manifest choice are
listed as open items.

- Correct false claims: hook scripts are not covered by update review, an
  invalid Codex updatedInput already blocks, plugin stdio MCP servers already
  start host processes, 18 skills (not 19), and the skills-only folder install.
- Fix moved or wrong code references (collectDefinitionLayers,
  marketplaceListingAt, line ranges, paths).
- Add Terms, a Decisions table and Risks & Mitigations. Restate each
  rejection reason without pointing to the brainstorm brief.
- Match Cursor discovery (a manifest path replaces the folder scan, extra
  rule and agent extensions, globs).
- Define the cursor-command hook schema, the loader owner and the shared
  runner parts.
- Make plan steps and tests concrete: read sites, loop_limit edge values,
  notice route, pathEnv, FakeRuntime, fixtures, repro tags, dogfood
  expectations and PR order.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high` • Cost: `$11.49`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high costs=11.49 -->
Apply the recommended option for each escalated review decision. D6 text and
the D3 confirmation stay open.

- D1: the update review lists every changed file of a plugin with a runnable
  Cursor command hook (new treeHash and installService steps in PR 7).
- D8: Cursor hooks follow Cursor's failure rule. Codex hooks keep the shipped
  rule, so PR 5 keeps only the turn-stop text change.
- D7: no Cursor hooks in remote workspaces (PR 9 removed, T6).
- D5, D9, D12, D19: no observe-only stop calls. Only afterFileEdit,
  afterAgentResponse and stop run, and matchers are not applied (PR 8 events
  removed). is_background and the MCP auth block are not applied (T7, T8).
- Commands are not applied (T9).
- D21 (new): a schema-less root plugin.json yields to a Cursor manifest.
- The docs PR is now PR 8.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high` • Cost: `$13.45`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high costs=13.45 -->
Apply the owner's final decisions, then resolve every finding of the one
allowed Stage 9 (Implementation Readiness) re-audit.

Owner decisions:
- D8: one failure rule. Cursor hooks follow Cursor's rule, and a Codex
  PreToolUse hook with malformed output blocks the call (new PR 6).
- D12: is_background is a hint in the task tool's agent list.
- D6 (kill switches, with verified readers) and D3 (shared default of 3)
  are stated. Open Questions is empty.

Re-audit: 60 raw findings (8 Blockers, 31 Majors, 21 Nits), 48 after
deduplication. 40 fixed, 5 resolved by new decisions D22-D29, 2 contested,
1 declined. The implementation plan is rewritten so each PR lists its files,
exact changes and input/expected-output tests, with 9 PRs.

New decisions: D22 turn-stop text keeps #6067 and only keeps the end; D23
cursor-marketplace is a preview selector, no marker; D24 folder paths only;
D25 afterFileEdit on two edit tools; D26 invalid settingsBase is ignored;
D27 no model-source header label; D28 one failure notice per hook; D29 the
cursor MCP dialect uses the Codex shape.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high` • Cost: `$19.12`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high costs=19.12 -->
#7767 moved the AI-settings layer code that PR 4 (model: fast) builds on and
added two consumers of an agent's inheritance chain: the prompt-cache TTL and
the descriptor's aiLayers shown in Settings > Tasks. PR 4 changed only the
runtime model lookup, so a fast agent would have run on Explore's model while
the TTL and the displayed settings used the inherited chain.

PR 4 now applies settingsBase through one pure helper
(applySettingsBaseChain) at every chain consumer, adds a descriptor field
aiSettingsBase for the renderer and ACP paths that walk declared bases, and
re-anchors every step against main at 85abd10. Section 7 states that fast
agents also take Explore's 5m cache TTL, and its mechanism text now matches
PR 4 instead of contradicting it.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high` • Cost: `$23.17`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high costs=23.17 -->
@chatgpt-codex-connector

This comment has been minimized.

@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: 7ca4e5b5eb

ℹ️ 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 rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Resolve the 14 Codex review findings on PR #7829 in the RFC text:

- Update review lists every changed file, skill and agent folders too (D1).
- `model: fast` keeps Explore's Exec layer. Goal 3, CUJ 2, section 7 and the
  PR 4 tests now say a configured Exec model comes before the parent model.
- PR 7 puts per-hook counts on `TurnStopContext` before `spine.run` and keys
  them by `<plugin instance id>:<hook key>`.
- PR 8 passes the event abort signal to `Runtime.exec` (a user Stop kills the
  hook), reloads Cursor hooks in the per-call trust gate, and tags the loop
  repro `mock-only`.
- PR 2 carries `notApplied` on the list item and update review, `ruleType` on
  preview skills, per-build marketplace status, the 500-entry truncation, and
  a file-path parameter for marketplace diagnostics.
- PR 1 caps the rewritten rule SKILL.md size like Claude commands.
- PR 4 drops the copied-schema test and cites the shipped `.strip()` schemas.

@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: 9f995dd67d

ℹ️ 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 rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Resolve the 7 Codex round-2 findings on PR #7829 in the RFC text, and
correct the section 8 row for per-hook stop limits:

- PR 4: `agents.list` publishes `aiSettingsBase` only when the settings base
  applies, so the renderer, Settings > Tasks and ACP walks follow `base` for
  an ignored one (D26). The tool-context descriptors carry no such field.
- PR 8: the runner reads stdout and stderr while it writes stdin, through the
  capped reader that drains past its cap. A Stop that lands before the hook
  chain starts gives the chain an already aborted signal. The update review
  takes file text from the tree walk's own `O_NOFOLLOW` read and shows a
  symlink's link text only.
- PR 3: the Cursor dialect rewrites only the two root names in a stdio cwd,
  so a data alias is refused.
- PR 2: a root Cursor manifest suppresses the marketplace listing.
- PR 1: a wrong-typed known manifest field gets a `notApplied` entry.
- Section 8 and section 6: per-hook limits are visible. Codex `Stop` hooks
  show the continuation notice, and after a nudge a Codex hook still gets
  its own 3, so one user turn can reach 4 continuations.
Names the stop context counts as PR 7 builds them (turnContinuations and
hookContinuations), shows the continuation notice only for continuations a
plugin hook asked for, states that two Codex Stop hooks can now continue one
user turn up to 6 times, and corrects the review-text call in PR 8.5 to
showInvisibleControls.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high` • Cost: `$40.70`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high costs=40.70 -->

@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: 65fb38a24e

ℹ️ 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 rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Codex rounds 1-3 kept finding gaps in the step-level PR 8 mechanics. Section 5
and the PR 8 section now state the hook runner as a contract: events and hook
points, input and output fields, environment, working folder, failure rules,
trust and review rules, kill switches, cancellation, local-only and the
security invariants. Each PR 8 finding from rounds 1-3 is an invariant or a
test stated as input and expected result. PR 8 settles each mechanism under
its own security review.

Round-3 fixes:
- D30: a plugin's first file review (first install, or an update that adds
  the first runnable Cursor command hook) lists every file as a diff from an
  empty tree.
- The registry entry records no install method, so an older build still
  lists and uninstalls a Cursor install. The rollout text said otherwise.
- PR 7 shows the continuation notice only when a plugin hook's reason is kept.
- A Cursor stop hook's loop_count is turnContinuations. Per-hook limits keep
  using hookContinuations.
- The Cursor root variable names are reserved for the cursor MCP dialect
  only. RESERVED_ENV_NAMES does not change.
The Agent Plugins manifest has no field for either, so the Cursor plugin RFC
lists them as not applied instead of claiming the Claude metadata handling.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high` • Cost: `$46.25`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high costs=46.25 -->

@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: 3a2fb9b6c7

ℹ️ 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 rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Nested settings bases are ignored, exit 127 names both causes, Cursor
installs update through chooseUpdateMethod, and only retained stop reasons
count toward a hook's limit.

---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 93c886a331

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@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: 93c886a331

ℹ️ 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 rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
@ThomasK33

Copy link
Copy Markdown
Member Author

Stopping the Codex review loop on this RFC after round 5.

Reason: the loop does not converge on a design document. Rounds 1 to 5 found 14, 7, 10, 4 and 5 findings. Each round finds new implementation-level detail, not design defects, and the code PRs are where that detail belongs.

Round-5 findings, all valid, each moved to the code PR that owns the code:

Finding Goes to
Scan-time rule rejections and skipped MCP values must be structured notApplied entries, not only warnings PR 1 (rules), PR 3 (MCP)
The file review must exclude .git PR 8
Cursor command hooks need a gate that does not require plugin MCP PR 8
The renderer must resolve the disabled settings-base chain the same way as a run PR 4
File-review summaries must escape control characters in paths PR 8 (security review)

One more drift is known: PR 7 puts the single prompt cut in mergeTurnStopContinuation, not in runTurnStopHooks (section 7.2).

The RFC text will be aligned with the code in one final commit after the code PRs are reviewed. Until then, the code PRs are the source of truth where they differ from this document.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

Adds an "As built" list to the RFC plan: the published PR order and each
point where the code differs from the plan, so the RFC matches the stack.

---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_

@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 Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: ff69703035

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread rfc/20261030_cursor-plugin-support.md Resolved

@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: ff69703035

ℹ️ 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 rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
@ThomasK33

Copy link
Copy Markdown
Member Author

Codex round 6 of 6 on this RFC (head ff69703035, the "As built" section) found 5 items. All are valid, and none needs more RFC text:

Finding Goes to
P1 security: first hook trust after an upgrade must show the full file review PR 8, fixed before it publishes
Hooks dropped at parse must be notApplied entries PR 8
390 px coverage for the hooks panel and file review PR 8 (screenshots; Pixel budget is full)
The no-method message must name the Cursor manifest PR 2
Over-cap rules need a notApplied summary Follow-up (PR 1 is merge-ready)

This PR has used its 6 Codex rounds, so I am not requesting another review. It has no explicit Codex approval on this head. Landing it needs an operator decision.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

Adds the PR 3 placeholder rule and the PR 8 trust changes made during
review, including the new reviewedSha field and the accepted risks.

---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_

@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: 61d5a9d38b

ℹ️ 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 rfc/20261030_cursor-plugin-support.md Resolved
Comment thread rfc/20261030_cursor-plugin-support.md Resolved
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

Head: 61d5a9d

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 61d5a9d38b

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 61d5a9d38b

ℹ️ 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".

@ThomasK33

Copy link
Copy Markdown
Member Author

Minimizing the Codex review summary as outdated. Its one listed advisory ("Require a first script review after upgrading") was fixed in PR 8 (#7846): the first trust of a Cursor hook now needs the full file review, and trust is bound to the reviewed commit. That thread is resolved. On this head (61d5a9d38b) the code review reports "Didn't find any major issues" and the security review found no issues.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

@ThomasK33
ThomasK33 added this pull request to the merge queue Oct 31, 2026
Merged via the queue into main with commit 34e910a Oct 31, 2026
69 of 74 checks passed
@ThomasK33
ThomasK33 deleted the cursor-plugins/rfc branch October 31, 2026 23:24
yermakoffivan pushed a commit to yermakoffivan/mux that referenced this pull request Nov 1, 2026
## Summary

Codex `Stop` hooks now receive the **end** of a long reply as
`last_assistant_message`, not its start. `lastAssistantText` keeps the
last 16 × 1024 UTF-16 units of the reply's trailing text run. If the cut
starts on the low half of a surrogate pair, it drops that one unit, so
the text never starts with a lone surrogate. The coder#6067 rule is
unchanged: the text is the trailing text run, and it is `null` when the
turn ends on a tool part.

This is the bottom PR of stack C for the Cursor plugin RFC (coder#7829). The
later Cursor `afterAgentResponse` and `stop` hooks use this text.

## Background

A stop-loop hook (for example a "ralph loop") ends the loop when the
reply contains a completion promise such as `<promise>DONE</promise>`.
That promise sits at the end of a reply. Today Xum keeps the first 16 ×
1024 characters, so a reply longer than that loses the promise, and the
hook keeps the loop running.

RFC:
[`rfc/20261030_cursor-plugin-support.md`](https://github.com/coder/xum/blob/cursor-plugins/rfc/rfc/20261030_cursor-plugin-support.md)
(on the RFC branch of coder#7829), section "PR 5: Turn-stop text", decision
D22, and the section 8 row for the turn-stop text.

## Implementation

- `src/node/services/agentPlugins/promptHooks.ts`: `text.slice(0, N)`
becomes `text.slice(-N).replace(LEADING_LONE_LOW_SURROGATE, "")`. The
whitespace-only `null` check still runs on the whole run, as before. The
doc comment says the end is kept and why.
- `src/node/services/agentPlugins/promptHooks.test.ts`: four tests for
`lastAssistantText`:
1. A 20,000-character run over two text parts that ends in the promise
returns its last 16,384 characters.
2. A cut inside a surrogate pair returns 16,383 characters with no lone
low surrogate.
  3. A cut on a high surrogate keeps the whole pair.
  4. A turn that ends on a tool part still returns `null`.

`lastAssistantText` has one production caller (`agentSession.ts`, which
fills `TurnStopContext.lastAssistantMessage`). Its only reader is the
Codex `Stop` hook input in `codexHookRunner.ts`. No caller needs the
start of the text.

## Validation

- Tests 1 to 3 fail on main's code and pass here. Test 4 passes on both,
as intended.
- I ran a scratch test with a real `AgentSession` and a real Codex
`Stop` hook (`registerCodexPluginHooks` on the event spine). It recorded
the hook's `${last_assistant_message}` for a 20,000-character reply that
comes after a tool call:
  - main: 16,384 characters that end in `yyyy…`, so the promise is lost.
- this branch: 16,384 characters that end in `…<promise>DONE</promise>`.
A turn that ends on a tool part gives `null`.
- An independent verifier checked the head before publish. It found no
blockers and measured the edge cases (empty text, exactly 16,384
characters, 16,385 characters, both surrogate cuts, and a turn that ends
on a tool part).
- `make crap-check`, `make dry-check` and `make mutate-check` (10
killed, 0 survived) pass on the changed function.

## Risks

Low. Only the Codex `Stop` hook input changes, and only for replies
longer than 16 × 1024 characters in their trailing text run. A hook that
parsed the start of a long reply now sees its end. Shorter replies are
unchanged. Two known edge cases remain, and both need malformed or
unusual model output:
- A reply that ends in more than 16 KiB of whitespace now gives a
whitespace-only string. Main had the mirror case for leading whitespace.
- A lone low surrogate at the very start of an uncut reply is dropped.
It is not valid text.

## Release note

The turn-stop text passed to hooks keeps the last 16 × 1024 characters
of the reply's trailing text run instead of the first. Codex `Stop`
hooks receive the same text.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking:
`xhigh` • Cost: `$4.69`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh
costs=4.69 -->

---------

Signed-off-by: Thomas Kosiewski <tk@coder.com>
yermakoffivan pushed a commit to yermakoffivan/mux that referenced this pull request Nov 1, 2026
…ns (coder#7844)

## Summary

Settings > Plugins now reads `.cursor-plugin/marketplace.json` beside
`.claude-plugin/marketplace.json` and shows one merged list. A name in
both files appears once, with "Preview Cursor build" and "Preview Claude
build". A Cursor entry installs through its own folder's manifest with
the new `cursor-plugin` method. The install preview, the update review
and the installed plugin card list every part Xum does not apply. Adding
github.com/cursor/plugins goes from 2 listed plugins to 128, and all 128
Cursor builds can install.

## Background

PR 2 of the Cursor plugin RFC (`rfc/20261030_cursor-plugin-support.md`,
docs PR coder#7829): section "PR 2", Technical Plan section 3, decisions D20
and D23. It sits on PR 4 (coder#7841) in the Cursor stack. PR 1 (coder#7837) reads
the Cursor manifest, rules and agents; this PR makes such plugins
reachable from the marketplace and shows what they do not apply.

## Implementation

- **Parser** (`claudeMarketplace.ts`): one reader for both files
(`parseClaudeMarketplace(content, file)`), per-file caps (8 MiB, 500
entries), and diagnostics that name the file. `mergeMarketplaces` lists
the Cursor entries in file order, then each Claude name the Cursor file
lacks; a shared name gets both builds, Cursor first. Entries with a
shape problem never merge. A Cursor path source starts at the
marketplace root with or without `./` (cursor/plugins lists
`third_party/attio`), under the same containment checks; the Claude rule
is unchanged.
- **Install service**: the listing reads both files. A broken file
beside a good one becomes a warning; a read error waits for the manifest
guard, so a root plugin still previews. The guard also covers
`cursor-plugin` (a root `.cursor-plugin/plugin.json` previews the
plugin, not a listing). Each build keeps its own status and skill count.
One `{file, entry}` value flows through read, stage, install and update.
- **Install methods**: `detectInstallMethods` returns `cursor-plugin`
for a Cursor-only folder (a Claude manifest still wins, and a
schema-less root `plugin.json` yields, D21). A Cursor entry whose folder
has no manifest is refused. `cursor-marketplace` is a preview selector
only; install never gets it back, and no install record stores a method.
- **Payloads** (`agentPlugins.ts`): per-file `builds` on listing rows,
`notApplied` on the preview, update review and list item, `ruleType` on
rule skills, `readonlyAgents` on the preview.
- **Renderer**: one row per name with per-build lines and actions; a
shared not-applied list in the preview, update review and plugin card;
rule-skill labels; "edit tools removed, shell still available" for
agents that Xum maps to Explore.

## Validation

- Dev-server sandbox, oRPC and agent-browser against
github.com/cursor/plugins at 4dd1d05818 (re-checked on this head after
merging `cursor-plugins/fast-agents`): 128 rows, 0 warnings; pstack and
origin-apps have two builds; all 128 Cursor folders have a manifest and
none is refused; attio (`third_party/attio`) and cursor-team-kit install
through their Cursor builds. cursor-team-kit's review lists 18 skills, 2
rule skills labeled "always-apply rule, loaded on request in Xum", 2
agents and 4 not-applied fields. At 390 px the Plugins tab and the
review have no horizontal scroll. Screenshots follow in a comment.
- `tests/bugbash/repros/cursorMarketplaceMerge.e2e.ts`
(`BUGBASH_AI=mock`) passes on web and phone, and fails with
`ASSERTION_FAILED` on "Preview Claude build" when the Cursor file is
ignored.
- New unit and service tests cover the merge order, caps, diagnostics,
Cursor path rule, install methods, update through the folder's own
manifest, collision refusal, notApplied, rule types, readonly labels and
invisible-character marks.

## Risks

- Behavior change for every user of the Plugins tab: a repository with
both marketplace files now lists both (release note below). Repositories
with only a Claude file list as before.
- The merged listing reads one more file per marketplace preview. A
broken Cursor file beside a good Claude file only adds a warning.
- Medium area of risk: install, preview and update of marketplace
entries. Claude marketplace behavior is unchanged and covered by the
existing marketplace tests.

## Release note

Adding a repository with both marketplace files shows one merged list.
`cursor/plugins` goes from 2 entries to 128. (Users of the Plugins tab,
D20.)

## Deviations from the RFC

1. `chooseUpdateMethod` changed although RFC 2.3 says it needs no change
(Codex RFC round 4 finding 3): with no marker, an update accepts
`claude-plugin` or `cursor-plugin`; with a `claude-marketplace` marker
it also accepts `cursor-plugin`, because this PR makes `cursor-plugin`
an own method.
2. RFC 2.5 asks for a per-agent readonly label but 2.4 adds no field:
the preview gains `readonlyAgents`. Only an agent that the Claude Code
or Cursor mapping runs on Explore for `readonly: true` gets the label; a
Xum-format agent never does.
3. A Cursor entry whose folder has only a Claude manifest installs as
`claude-plugin` (RFC 2.3 lists three own methods; 2.2's refusal text
names two). None of the 128 entries has this shape.
4. Cursor path sources resolve from the marketplace root without `./`,
and a Cursor file ignores `metadata.pluginRoot`. The RFC said the Cursor
file uses the Claude format; the real file needs Cursor's own path rule.
5. `parseClaudeMarketplace` takes the file kind instead of a relative
path, and `marketplaceListing` takes the parsed files; a read error of
one file counts like a parse error.

## Follow-ups

- The plugin card does not show component warnings (for example an MCP
server refused for a reason other than a not-applied one). The install
preview and the update review show them.
- Entries with `minClientVersions.cursor: "never"` are listed; Cursor
hides them.
- An update review with no capability change but a non-empty not-applied
list applies at once, as today; the parts then show only on the card.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking:
`xhigh` • Cost: `$28.91`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh
costs=28.91 -->
yermakoffivan pushed a commit to yermakoffivan/mux that referenced this pull request Nov 1, 2026
coder#7834)

## Summary

A Codex `PreToolUse` hook whose output is malformed or fails its schema
check now blocks the tool call instead of being ignored. The user sees
one notice that names the plugin and says how to turn the hook off.
Every other Codex hook failure keeps failing open: a timeout, an MCP
error result, a missing server, and broken output from `PostToolUse`,
`UserPromptSubmit` and `Stop`.

## Background

This is PR 6 of the Cursor plugin RFC, decision D8:
[`rfc/20261030_cursor-plugin-support.md`](https://github.com/coder/xum/blob/cursor-plugins/rfc/rfc/20261030_cursor-plugin-support.md)
(RFC PR coder#7829), section "PR 6", section 5.5 and the section 8 row. It
needs no other PR of the program.

Before this PR, a trusted `PreToolUse` guard with broken output let
every matching call through, silently. The owner chose the more secure
rule: a guard that cannot be read blocks. Codex itself fails such a hook
open, so this is a deliberate Xum difference.

## Implementation

- `codexHookRunner.ts`: `invoke` takes a `malformed` option beside
`inputTooLarge`. Only the `PreToolUse` call sets it. It returns the deny
`its output is malformed: <detail>` and emits one `plugin.hook.notice`.
`applyOutput` now runs `parse`. A parse error or an `invalid` output
goes through `rejectOutput`, which blocks when `malformed` is set and
warns and ignores otherwise.
- The block reason and the notice carry the parser's detail, so no
detail quotes the hook's own keys or values (a hook can put a secret
there). An invalid enum value reads `invalid <field> value`, an unknown
field `returned <where> with an unknown field`.
- An MCP tool error (`isError: true`) still fails open, although `parse`
throws for it. It is the hook failing, not its output (RFC 5.5, "an
error from the MCP call").
- `codexHookOutput.ts`: Codex's `looks_like_json` rule. Text that starts
with `{` or `[` must be a JSON object, so `[]` or a list of findings is
malformed. Other text, a bare JSON scalar such as `true` included, is
plain text and is ignored, as in Codex.
- `docs/hooks/plugins.mdx`: new "What blocks a `PreToolUse` call" list
and a rewritten "What fails open" list.
`builtInSkillContent.generated.ts` is regenerated from the page.

## Validation

- Unit tests cover every RFC 6.2 case. The changed tests fail on the
base runner.
- A real-instance proof (not committed) ran the real plugin files,
registry and trust store, the real `CodexPluginHookService` and
`EventSpine`, Xum's MCP client and a real stdio MCP server. At the base,
every malformed case lets `rm -rf build` run. At the head, each one
blocks with one notice. A tool error, a missing server, a timeout, valid
output and plain text still let the call through.
- An independent verifier ran its own 16-case and 5-case harnesses on
the same real path and returned CLEAN at 7c7a4eb.

## Risks

- A hook that relied on fail-open now blocks every matching call. The
notice names the plugin, the reason and how to turn the hook off, so the
block is visible. The model sees the same reason as the tool error.
- The most likely trigger is a hook ported from Claude Code that answers
a bare `permissionDecision: "allow"`. Codex reports that as unsupported
and runs the call. Xum now blocks it. See the release note.

## Release note

A Codex `PreToolUse` hook whose output is malformed or fails its schema
check now blocks the tool call instead of being ignored. A chat line
names the plugin and the hook, and says how to turn the hook off in
Settings > Plugins.

This includes eight outputs that Codex marks as a failed hook run and
then runs the call anyway. In Xum, each of them now blocks a matching
call (an explicit deny in the same output still applies with its own
reason):

1. A bare `permissionDecision: "allow"` (without `updatedInput`).
2. `permissionDecision: "ask"`.
3. The legacy `decision: "approve"`.
4. `continue: false`.
5. `stopReason`.
6. `suppressOutput: true`.
7. `updatedInput` without `permissionDecision: "allow"`.
8. A reason without a decision (`reason` or `permissionDecisionReason`).

Text that starts with `{` or `[` but is not a JSON object (for example
`[]` or a list of findings) and a result over 1 MiB block too. Text that
does not start with `{` or `[`, a bare JSON scalar such as `true`
included, stays plain text and is ignored, as in Codex.

A timeout, an MCP error result, a missing server and broken output from
`PostToolUse`, `UserPromptSubmit` and `Stop` still fail open.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking:
`xhigh`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
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