QQ is one of the stronger donors in this task set because PicoClaw uses the official bot platform rather than a purely community bridge.
Status
gormes/docs/content/building-gormes/architecture_plan/subsystem-inventory.md marks QQ Bot as planned for Phase 2.B.16. Gormes has upstream Hermes operator docs for QQ Bot, but no Go QQ adapter yet.
Evidence level:
- Donor code for this dossier was verified against the external sibling repo at
/home/xel/git/sages-openclaw/workspace-mineru/picoclaw. - The donor commit inspected for this research was
6421f146a99df1bebcd4b1ca8de2a289dfca3622. - The upstream donor repo is
https://github.com/sipeed/picoclaw. - Any
pkg/...ordocs/...path listed below is relative to that donor root, not relative to the Gormes repo. - Current Gormes status and operator-facing behavior were verified in-tree against
gormes/docs/content/building-gormes/architecture_plan/subsystem-inventory.mdandgormes/docs/content/upstream-hermes/user-guide/messaging/qqbot.md.
Keep the boundary explicit: PicoClaw contributes official QQ Bot transport mechanics only. Gormes architecture remains authoritative for platform event shape, session mapping, and runtime ownership.
Why This Adapter Is Reusable
QQ is reusable because the donor already covers the official transport split that Gormes will also need:
- token source creation and refresh
- botgo SDK initialization
- WebSocket session startup and event registration
- separate handling for C2C and group
@messages - explicit group-vs-direct routing state
- passive-reply metadata using last inbound message IDs and
msg_seq - attachment download and media normalization
- rich media upload through the official
/filesAPI
This is not just shape reference. Much of the donor logic is platform-specific and can transfer with relatively small structural changes.
Picoclaw Donor Files
- Provenance note: the following
pkg/...anddocs/...paths are relative to the external donor root/home/xel/git/sages-openclaw/workspace-mineru/picoclawat commit6421f146a99df1bebcd4b1ca8de2a289dfca3622, not relative to the Gormes repo. picoclaw/pkg/channels/qq/qq.gopicoclaw/pkg/channels/qq/audio_duration.gopicoclaw/pkg/channels/qq/botgo_logger.gopicoclaw/pkg/channels/qq/qq_test.gopicoclaw/docs/channels/qq/README.mdgormes/docs/content/upstream-hermes/user-guide/messaging/qqbot.mdgormes/docs/content/building-gormes/architecture_plan/subsystem-inventory.md
What To Copy vs What To Rebuild
Copy candidates:
- official SDK bootstrap in
Start: token refresh, OpenAPI client, handler registration, websocket info lookup, and session-manager startup - inbound split between
handleC2CMessageandhandleGroupATMessage chatType,lastMsgID, andmsgSeqCountersas adapter-local routing stateSendwith separate group and direct message paths plus markdown toggleSendMedia,uploadMedia, andsendUploadedMediafor official QQ rich media flow- attachment download helpers and attachment-note synthesis
sanitizeURLsfor QQ group-message URL filteringqqAudioDurationandoutboundMediaTypeto decide when audio can be sent as voice vs filebotGoLoggerto demote noisy heartbeat traffic
Rebuild in Gormes-native form:
- config and credential ownership. Gormes should decide how App ID, secret, sandbox controls, and home-channel policy live in its config surface.
- platform event identity. PicoClaw records
account_id,group_id, and direct sender IDs inRaw; Gormes should normalize these through its own event contracts. - voice transcription policy. Upstream Hermes docs describe richer STT behavior than PicoClaw’s Go donor currently implements.
- retry, backoff, and health reporting should match Gormes runtime conventions instead of PicoClaw’s local adapter choices.
Gormes Mapping
Startmaps directly to a futureinternal/qqadapter bootstrap.handleC2CMessageandhandleGroupATMessagemap to two primary ingress pipelines Gormes will need from day one.chatTypeis a practical donor because outbound QQ sends need to know whether a chat ID is direct or group.applyPassiveReplyMetadatais important: QQ reply behavior is tied to last inbound message ID plusmsg_seq, so Gormes should preserve that state machine.SendMediaandaudio_duration.goare especially valuable because the official QQ media flow is nontrivial and platform-specific.
Implementation Notes
- Start with the official bot flow, not OneBot compatibility. The subsystem inventory already points Gormes toward QQ Bot as the planned target.
- Preserve the donor’s distinction between C2C and group
@ingress. Group delivery semantics are not the same as direct chat semantics on QQ. - Keep media upload logic adapter-local. The
/filespre-upload step andfile_infohandoff are specific to QQ. - Port the tests around attachment-only messages and base64 media upload early. They capture real edge cases rather than superficial wiring.
- Reuse
botGoLoggeror an equivalent so heartbeat noise does not overwhelm operator logs.
Risks / Mismatches
- PicoClaw is already opinionated about the
botgoSDK. If Gormes chooses a different official SDK surface later, the control flow should transfer but the code will not copy verbatim. - URL sanitization is an API workaround, not a universal messaging behavior. Keep it local to QQ.
- Audio send behavior depends on local file inspection and QQ voice limits; that logic must be tested carefully around codecs and file sizes.
- Upstream Hermes docs include guild and richer STT expectations that are not fully represented in the PicoClaw donor.
Port Order Recommendation
- Port official auth, token refresh, WebSocket startup, and C2C or group text ingress first.
- Add passive-reply metadata and correct group-vs-direct outbound routing.
- Add attachment ingest and text send parity.
- Add rich media upload and audio-duration-based voice/file selection.
- Layer in markdown, STT, or richer delivery variants only after the base official bot path is stable.
Code References
picoclaw/pkg/channels/qq/qq.go:NewQQChannel,Start,Stop,Send,StartTyping,SendMedia,uploadMedia,buildMediaUpload,outboundMediaType,sendUploadedMedia,applyPassiveReplyMetadata,handleC2CMessage,handleGroupATMessage,extractInboundAttachments,downloadAttachment,sanitizeURLs,VoiceCapabilities.picoclaw/pkg/channels/qq/audio_duration.go:qqAudioDuration,qqWAVDuration,qqOggDuration.picoclaw/pkg/channels/qq/botgo_logger.gopicoclaw/pkg/channels/qq/qq_test.gopicoclaw/docs/channels/qq/README.mdgormes/docs/content/upstream-hermes/user-guide/messaging/qqbot.mdgormes/docs/content/building-gormes/architecture_plan/subsystem-inventory.md
Recommendation: copy candidate.