Skip to content

RFC/draft: add OpenClaw as a 5th provider#28

Draft
wook95 wants to merge 2 commits intoaroido:mainfrom
wook95:feat/openclaw-provider
Draft

RFC/draft: add OpenClaw as a 5th provider#28
wook95 wants to merge 2 commits intoaroido:mainfrom
wook95:feat/openclaw-provider

Conversation

@wook95
Copy link
Copy Markdown
Contributor

@wook95 wook95 commented May 4, 2026

First-time contributor. I have a separate PR (#27) opening for mise/asdf executable discovery; this one is bigger and I'm marking it draft because I'd like to confirm direction before asking for review.

I run openclaw (367k★, multi-channel AI assistant) locally as a daily-driver gateway in front of Anthropic, OpenAI, Gemini, and Bedrock. It writes JSONL session files under ~/.openclaw/agents/<name>/sessions/<session-id>.jsonl with token usage on each assistant message at message.usage.{input,output,cacheRead,cacheWrite}. Same shape as the Codex transcript adapter you already have, just a different on-disk layout — so I mirrored the Codex file-watch pattern exactly:

  • 4 new files under Sources/Tokenmon{Providers,Persistence}/Openclaw*.swift (storage locator, observer, backfill adapter, recovery service)
  • case .openclaw on ProviderCode plus the switch sites the compiler surfaces
  • en/ko Localizable.strings, mirroring the Codex translation conventions (including the existing ko/en key-count delta and the partial-translation phrasing — happy to normalize across both providers in a follow-up if you'd prefer)

swift build is clean. I have not added new unit tests; the new files mirror the Codex provider's coverage shape (which also has no dedicated unit tests in the public repo). Happy to add tests if you want — just let me know what level of coverage you'd accept.

A generic external-JSONL-provider plugin is the obvious alternative, but I'd rather not push schema knowledge onto users. Most people just want a zero-config experience for tools they already have installed.

If you accept this in principle, I'll commit to staying on top of bug reports filed against the openclaw paths. Issues are disabled on this repo so I'm using a draft PR as the RFC vehicle — please don't hesitate to close if this isn't a direction you want to take.

wook95 added 2 commits May 4, 2026 14:42
Mirrors the codex file-watch pattern. Watches
~/.openclaw/agents/<agent>/sessions/<session>.jsonl and ingests usage
events from message.usage.{input,output,cacheRead,cacheWrite}, with the
session id taken from the file basename.

  - 4 new files under Sources/Tokenmon{Providers,Persistence}/Openclaw*
    (storage locator, observer, backfill adapter, recovery service)
  - case .openclaw on ProviderCode and the switch sites the compiler
    surfaces (UI views, persistence, automation, presentation)
  - en/ko Localizable.strings for the new provider states
@wook95 wook95 force-pushed the feat/openclaw-provider branch from a5e9bc5 to a2e4fd7 Compare May 4, 2026 08:33
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