---
name: dictum-sdk-custom-adapters
description: Implement or review Dictum SDK custom adapters. Use when Codex needs to build custom insertion adapters for framework-owned text targets, native/mobile audio capture adapters that emit WAV chunks, or platform event adapters that bridge public Dictum events to non-browser hosts.
---

# Dictum SDK Custom Adapters

Use this skill when the default browser target or default browser microphone path is not the right boundary for the host application.

## Workflow

1. Identify which boundary is custom:
   - Text insertion: host owns text state or the editor is not a plain DOM field.
   - Audio capture: native/mobile/webview host owns recording.
   - Platform events: non-browser host needs public Dictum events bridged out.
2. Keep adapter objects small and explicit. Avoid hidden DOM queries, globals, and side-channel configuration.
3. For insertion, implement `kind: "custom"` and `insertText(text, context)`.
4. For audio capture, implement `kind: "audio-capture"` and emit valid `audio/wav` `Blob` chunks only.
5. Make lifecycle cleanup deterministic. `stop()` must release native/browser recording resources.
6. Treat `targetId` as trace metadata only. It is not a selector and must not be used to mutate the DOM.

## References

- Read `references/custom-insertion-adapter.md` for React, rich-editor, and host-owned text insertion patterns.
- Read `references/native-audio-capture.md` for custom microphone/native recorder requirements.

## Hard Rules

- Do not emit raw PCM, WebM, MP3, Opus, platform buffers, or base64 audio as SDK audio chunks.
- Do not log raw audio or signed identity tokens.
- Do not add language-unsupported logic. It is not a Dictum SDK public event, state, or adapter responsibility.
- Do not make SDK internals depend on `platformEvents`; the adapter is only a bridge.
