Skip to content

[plugin sdk] docs: plugin host hook RFC#71731

Closed
100yenadmin wants to merge 10 commits intoopenclaw:mainfrom
electricsheephq:rfc/plan-plugin-hooks
Closed

[plugin sdk] docs: plugin host hook RFC#71731
100yenadmin wants to merge 10 commits intoopenclaw:mainfrom
electricsheephq:rfc/plan-plugin-hooks

Conversation

@100yenadmin
Copy link
Copy Markdown
Contributor

@100yenadmin 100yenadmin commented Apr 25, 2026

Summary

This PR is the maintainer RFC/decision artifact for making Plan Mode a first-class bundled plugin without merging the large host patch from #71676.

  • Problem: Plan Mode rebased onto upstream/main + executing-state subsystem #71676 proves Plan Mode behavior, but it embeds the feature across session state, gateway patching, agent turn preparation, pending injections, tool policy, commands, Control UI, agent events, scheduler/cron, heartbeat prompts, docs, QA, and channel flows.
  • Why it matters: maintainers prefer a plugin path. Plan Mode cannot be packaged as a plugin with 100% parity until OpenClaw exposes the generic host seams defined here.
  • What changed: added the complete host-hook contract, six issue-sized RFC threads, current-SDK gap research, an “already implemented?” comparison, reusable plugin matrices, a Plan Mode rebased onto upstream/main + executing-state subsystem #71676 entry-point coverage map, and fixture-test expectations.
  • What did NOT change: this PR intentionally does not implement hooks, Plan Mode behavior, prompts, tools, UI cards, session fields, scheduler changes, or runtime SDK APIs.

RFC Status Warning

This is proposed SDK design, not implemented SDK reference. The docs include explicit warning callouts, and the public page has been moved out of SDK reference into a dedicated Plugin design RFCs nav group.

Decision This PR Asks Maintainers To Make

This RFC defines the complete host-hook contract. The follow-up implementation PR must implement all generic hooks needed before Plan Mode can be packaged as a bundled plugin and audited against #71676 for parity.

The implementation PR should be one focused host-hook PR with generic SDK contracts and fixture tests. It should not include Plan Mode product prompts, Plan Mode tools, Plan Mode command text, Plan Mode CSS, Telegram-specific Plan Mode behavior, local installer patch logic, or Smarter-Claw compatibility code.

RFC Decision Threads

Each issue body now includes: proposed/not-implemented status, current SDK surface, why that surface is adjacent but insufficient, proposed seam, Plan Mode parity use, reusable non-Plan plugin examples, decisions needed, and fixture acceptance criteria.

Already Implemented? Standard

Use the #71427 closure standard: an existing hook only resolves an RFC if it owns the same lifecycle boundary, payload shape, ordering, authorization, disablement, cleanup, and fixture-test semantics.

Current OpenClaw has useful adjacent surfaces (before_prompt_build, before_tool_call, plugin commands, plugin gateway RPCs, generic plugin approvals, raw runtime events, and gateway_start.getCron). These do not provide the exact SDK contracts required here.

RFC Contents

The full RFC packet covers:

  • current SDK research against existing hooks, using RFC: pi-embedded plugin tool-event subscription \u2014 stable seam for tool-call observation #71427 as the comparison bar
  • reusable SDK capability matrix across public SDK, trusted/bundled SDK, gateway protocol, UI descriptors, runner boundary, lifecycle cleanup, and fixture tests
  • plugin archetype matrix for approval workflows, deploy/release, budget guards, memory/context, review/CI, incidents/tickets, channel integrations, workspace policy, telemetry/exporters, and long-running jobs
  • Plan Mode rebased onto upstream/main + executing-state subsystem #71676 entry-point coverage map for Plan Mode parity
  • per-hook TypeScript-shaped API sketches
  • expected host files for each implementation slice
  • authorization, trust-tier, disablement, cleanup, and failure semantics
  • SDK contract fixture expectations for approval workflow, budget/policy gate, and background lifecycle plugin scenarios
  • Plan Mode migration sequence and parity checklist

Change Type

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

Verification

Verified locally:

  • pnpm format:docs:check
  • pnpm lint:docs
  • pnpm docs:check-mdx
  • pnpm docs:check-links

Human Verification

  • Confirmed the docs nav no longer places the proposal under stable SDK reference.
  • Confirmed both docs pages warn that the named APIs are proposed, not implemented.
  • Confirmed the RFC packet includes a Plan Mode rebased onto upstream/main + executing-state subsystem #71676 entry-point coverage map.
  • Confirmed all six live issue bodies are expanded beyond Plan Mode-only examples.
  • Did not run runtime Plan Mode behavior because this PR is docs/RFC-only and implements no hooks.

Compatibility / Migration

  • Backward compatible? Yes, docs-only.
  • Config/env changes? No.
  • Migration needed? No.

Risks and Mitigations

  • Risk: reviewers mistake the RFC for implemented SDK reference.
    • Mitigation: warning callouts plus Plugin design RFCs nav placement.
  • Risk: proposal appears Plan Mode-specific.
    • Mitigation: reusable SDK matrices, non-Plan plugin examples, expanded issue bodies, and generic SDK contract fixture scenarios.
  • Risk: proposal overclaims parity.

Next Step After This PR

Implement the generic host hooks described here in one focused follow-up PR with SDK types, gateway protocol support, runner integration, lifecycle cleanup, and a tiny SDK contract fixture. After that lands, Plan Mode can move into a bundled plugin and be audited against #71676 for 100% parity.

Copilot AI review requested due to automatic review settings April 25, 2026 19:51
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: XS labels Apr 25, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 25, 2026

Greptile Summary

This is a docs-only RFC PR that adds a full maintainer packet for the generic host hooks required to make Plan Mode a first-class bundled plugin, without merging any implementation. The public index page is correctly placed under a new "Plugin design RFCs" nav group (not "SDK reference"), both new pages carry <Warning> callouts flagging them as proposals rather than implemented API, and the internal RFC file (docs/plan/plan-mode-plugin-host-hooks-rfc.md) follows the established pattern for maintainer-only documents in docs/plan/ that are served directly but not registered in the nav.

Confidence Score: 5/5

Safe to merge — docs-only change with no runtime impact and no unresolved issues.

All three files are documentation only. The previous concern about RFC placement under SDK reference has been resolved: the page now lives under Plugin design RFCs. Both public-facing pages carry explicit Warning callouts, the internal RFC follows the same docs/plan/ pattern as existing maintainer documents, and the PR description confirms link and lint checks passed. No P1 or P0 findings.

No files require special attention.

Reviews (2): Last reviewed commit: "docs: clarify PR 71676 evidence paths" | Re-trigger Greptile

Comment thread docs/docs.json Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a tracked RFC doc describing the generic host seams needed to migrate Plan Mode into a first-class bundled plugin, and exposes that doc in the plugin SDK reference navigation so it can be reviewed as an upstream artifact.

Changes:

  • Added a new RFC bundle page outlining six host hook areas (session extensions, turn injections, tool policy/metadata, commands/continuation, Control UI slots, agent events/scheduler lifecycle).
  • Wired the new page into the “Plugins → SDK reference” navigation in docs/docs.json.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
docs/plugins/plan-mode-plugin-host-hooks.md New RFC doc capturing the proposed generic host hook surfaces and acceptance-test expectations for a future Plan Mode plugin port.
docs/docs.json Adds the new RFC page to the Plugins SDK reference navigation.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@100yenadmin
Copy link
Copy Markdown
Contributor Author

SDK research follow-up added in 7d660892d6.

Direct status:

Audit split:

Bottom line: current OpenClaw has useful adjacent hooks (before_prompt_build, before_tool_call, plugin commands, plugin gateway RPCs, generic plugin approvals, raw runtime events, gateway_start.getCron), but the six RFCs are still valid because those hooks do not provide the first-class plugin seams needed to port PR #71676 without host patches or parity regressions.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@100yenadmin
Copy link
Copy Markdown
Contributor Author

Cleanup pass pushed in e4709683a2.

Addressed the maintainer-readiness issues from the audit:

  • Moved the public RFC page out of SDK reference and into a new Plugin design RFCs nav group so readers do not mistake proposed APIs for stable implemented SDK reference.
  • Added warning callouts to both docs pages stating that the APIs/hooks are proposal targets for a future host-hook PR and are not available on current main.
  • Added a PR 71676 Entry-Point Coverage Map tying the hook families directly to the Plan Mode patch entry points and parity requirements.
  • Replaced the older compact copy-ready issue packet with a Filed RFC Issue Body Standard so the docs no longer preserve shorter, Plan Mode-biased issue text.
  • Edited all six live RFC issue bodies so each includes current SDK surface, why it is insufficient, proposed seam, Plan Mode use, reusable non-Plan plugin examples, decisions needed, and fixture acceptance criteria.
  • Updated the PR body to reflect the latest scope, warnings, nav placement, issue updates, and verification.

Local verification still passes:

  • pnpm format:docs:check
  • pnpm lint:docs
  • pnpm docs:check-mdx
  • pnpm docs:check-links

CI has restarted on the new head and is still running at the time of this comment.

@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented Apr 26, 2026

Codex automated review: keeping this open.

Keep open. Current main now has the generic host-hook foundation and stable SDK docs from merged #72287, but this PR is still paired with active same-author follow-up work and the open #71736 Control UI design thread. Closing this PR now would split an active RFC/docs stack rather than perform conservative cleanup.

Best possible solution:

Keep this PR open for maintainer handling. The best path is to let maintainers decide whether the RFC docs should be closed after #72287 as superseded, folded into #72333, or narrowed around the still-open Control UI/workflow follow-ups after #71736, #72383, and #72333 are resolved.

What I checked:

Remaining risk / open question:

Codex Review notes: model gpt-5.5, reasoning high; reviewed against bdba90a20b2b.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

…t shape

Address Copilot review pass on PR openclaw#71731:

- registerToolPolicy sketch: add trust: "bundled" so the bundled-only
  contract is visible at the index page.
- registerToolMetadata sketch: switch displayName/ui to title/display
  (plus keep category and safety) to match the RFC packet.
- Run-context API: replace api.setRunContextData/getRunContextData with
  ctx.runContext.set/get to match the RFC packet.
- ToolPolicyDecision: change { allow?: true } to { allow: true } so the
  union discriminates cleanly without an empty-object collision.
- Section headers: rename ## RFC 1..6 to ## RFC A..F so they align with
  the "Filed RFC issues" table earlier in the same page (openclaw#71732..openclaw#71737).
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread docs/plugins/plan-mode-plugin-host-hooks.md Outdated
Per copilot review on plan-mode-plugin-host-hooks.md:389-390 — the index page
sketch took an explicit `runId` parameter while the RFC packet itself
(docs/plan/plan-mode-plugin-host-hooks-rfc.md:1022-1027) defines the contract
as implicitly scoped to the current run via `set/get(key)`. Align the index
page with the packet so readers don't see two different shapes for the same
proposed contract.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

| C | Normal `before_tool_call`, core config filtering, basic plugin tool catalog fields. | Normal hooks share plugin ordering; there is no bundled/trusted pre-plugin policy tier, metadata/display registry, or core-tool decoration rule. | budget guards, workspace policy, deploy freezes, dangerous-action approvals |
| D | `api.registerCommand(...)`, `gatewayClientScopes` in context, scoped plugin gateway methods. | Plugins can inspect scopes manually, but commands cannot declare host-enforced scopes, trusted reserved-root ownership, or `continueAgent`. | deploy approvals, review commands, budget overrides, incident commands, channel commands |
| E | Remote slash commands and generic plugin approval cards. | Existing UI support covers discovery and one generic card class, not chat modes, input guards, status surfaces, event classifiers, or descriptor projection. | approval workflows, release dashboards, budget warnings, incident banners, memory panels |
| F | Raw `runtime.events.onAgentEvent`, internal run context, `gateway_start.getCron`, prompt hooks. | Plugins lack typed filtered event subscriptions, namespaced run context, session-owned scheduler cleanup, and heartbeat contribution ordering. | telemetry exporters, memory indexers, CI watchers, incident escalators, long-running jobs |
Comment on lines +1049 to +1050
Existing `gateway_start.getCron` can remain for low-level cron access, but Plan
Mode needs session lifecycle cleanup and consistent ownership.
- Provide run-scoped plugin data that is cleaned up when the run completes.
- Let session extension lifecycle clean up cron or heartbeat jobs.
- Let heartbeat prompt assembly ask enabled plugins for additive prompt text.
- Keep existing `gateway_start.getCron` behavior for lower-level cron access.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@100yenadmin
Copy link
Copy Markdown
Contributor Author

Closing to make space PR wise

@100yenadmin
Copy link
Copy Markdown
Contributor Author

Post-split status update for reviewers:

The RFC does not need to reopen, but it should point at the current replacement stack because #72082 is no longer the active implementation vehicle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants