Skip to content

doc: add contract doc for rfc 1299 - #1361

Open
Alanxtl wants to merge 3 commits into
oceanbase:masterfrom
Alanxtl:adddoc
Open

doc: add contract doc for rfc 1299#1361
Alanxtl wants to merge 3 commits into
oceanbase:masterfrom
Alanxtl:adddoc

Conversation

@Alanxtl

@Alanxtl Alanxtl commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Which issue or RFC does this PR close?

This PR does not close #1298. It documents the contract from RFC PR #1299, which tracks issue #1298.

Rationale for this change

The host-visible integration diagnostics contract needs a single documented reference so plugin implementations and reviews use the same failure classifications, output format, privacy rules, fail-open behavior, and deduplication expectations.

What changes are included in this PR?

  • Add the English contract:
    • docs/en/development/plugin-contract.md
  • Add the Chinese contract:
    • docs/zh/development/plugin-contract.md
  • Add both documents to the Development navigation in zensical.toml.
  • Document:
    • authentication_failed, version_mismatch, server_unavailable, and invalid_response
    • Diagnostic JSON fields and examples
    • Host-specific output channels
    • Fail-open and privacy requirements
    • Bounded/deduplicated presentation
    • Plugin implementation conventions for this RFC
    • Required test matrix and out-of-scope items

Are there any user-facing changes?

Documentation-only change. There are no runtime, API, persistence-format, or migration changes.

How was this change tested?

make docs-test

The strict documentation build completed successfully with no issues.

AI usage statement

This documentation was prepared with OpenAI Codex using the GPT-5 model. The final scope, wording, links, and documentation build were reviewed in the repository.

Comment thread docs/en/development/plugin-contract.md Outdated
| Outcome | Classification |
| --- | --- |
| `authentication_failed` | HTTP 401. |
| `version_mismatch` | HTTP 404, normally an incompatible or missing endpoint. |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[P1] This status-only mapping is not valid for every operation listed above. Direct tools can legitimately receive 404 NotFound for a missing Memory entry or citation, while 409 and 422 are valid conflict and validation responses; classifying them as version_mismatch or invalid_response would emit a misleading diagnostic alongside the correct tool error. Please scope version_mismatch to a missing compatibility or availability endpoint (or define operation-specific domain-error precedence), preserve not_found/conflict/invalid_request for direct operations, and cover those cases in the contract tests.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

fixed

Comment thread docs/en/development/plugin-contract.md Outdated
| Plugin | Channel | Component prefix |
| --- | --- | --- |
| Codex | Hook `stderr` | `powercontext.codex.recall` |
| Claude Code | Hook `stderr` | `powercontext.claude_code.recall` |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[P1] A successful Claude Code UserPromptSubmit hook does not render stderr to the user. The implementation in #1360 exits 0 and writes this event only to stderr, so the documented warning remains silent. Please emit the content-free event via the top-level systemMessage in the hook stdout JSON (keeping stderr only for debugging if useful), and add a host-level test that verifies the warning is actually rendered.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

fixed

Comment thread docs/en/development/plugin-contract.md Outdated
captured text, recalled text, response bodies, or stack traces.

Repeated failures MUST have bounded presentation. Long-lived plugins SHOULD deduplicate by `outcome` for 60 seconds.
Short-lived hooks MAY deduplicate within one invocation, but MUST NOT emit an unbounded stream for one failure. The

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[P2] Deduplicating only within one short-lived hook invocation still allows one identical warning on every prompt forever, which is exactly the unbounded behavior this requirement rules out. Codex and Claude start a fresh hook process per prompt, so invocation-local state cannot enforce a cooldown across turns. Please require a cross-invocation or host-level throttle (or another persistent bounded presentation mechanism) and test two separate hook invocations inside the documented cooldown window.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

fixed

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.

Tracking Issue: local Server availability and service installation

2 participants