Skip to content

adapter: tested xAI/Grok x.klickd context bridge#110

Merged
Davincc77 merged 2 commits into
mainfrom
add-xai-grok-bridge-tests
Jun 1, 2026
Merged

adapter: tested xAI/Grok x.klickd context bridge#110
Davincc77 merged 2 commits into
mainfrom
add-xai-grok-bridge-tests

Conversation

@Davincc77
Copy link
Copy Markdown
Owner

Summary

Implements issue #109 — a compatible xAI/Grok ↔ .klickd context bridge with tests, building on the existing examples/v4/integrations/xai_grok/klickd_xai.py adapter.

  • Bridge: adds klickd_to_messages(payload, user_message) — a pure, network-free function returning the OpenAI-compatible [{system}, {user}] list chat.completions accepts. chat() now shares this code path, and the missing-key check runs before the openai import so the error path is robust without openai installed.
  • Starter packs: adds load_starter_skill("coding.klickd") (public get_starter_skill_bytes accessor) and surfaces pack verification_gates / human_authority / memory_scope in the system prompt.
  • Runnable example: resume_chat_example.py with --check (hermetic dry-run: no openai, no network, no key) and --live (real Grok turn via XAI_API_KEY, base_url=https://api.x.ai/v1).
  • Tests: tests/test_xai_grok_adapter.py — 15 hermetic tests covering load (persona / starter pack / encrypted roundtrip), bridge (message shape, gate surfacing, underscore stripping, injection guard), and error paths (path traversal, non-object JSON, bad JSON, empty prompt, missing API key).
  • Docs: docs/integrations/xai_grok.md gains a check/live example section and a Limitations & guardrails block (compatible-bridge-not-native, no GDPR/EU AI Act claim, no universal-standard wording, optional compressed memory, prompt-injection trust boundary, encrypted files, host-enforced gates, provider-specific limits).

The README integration table already links the xAI Grok guide, so no table change was needed.

Guardrails honored: workflow bridge over xAI's OpenAI-compatible API (not native support beyond this adapter); no automatic compliance claim; compressed memory optional; trust boundary, encrypted files, prompt-injection risk, and provider limits documented.

Testing

PYTHONPATH=packages/pypi/klickd/src pytest tests/test_xai_grok_adapter.py -q
# 15 passed

# regression sweep across sibling adapters
PYTHONPATH=packages/pypi/klickd/src pytest \
  tests/test_llamaindex_adapter.py tests/test_xai_grok_adapter.py \
  examples/v4/integrations/langchain/tests -q
# 43 passed

PYTHONPATH=packages/pypi/klickd/src \
  python examples/v4/integrations/xai_grok/resume_chat_example.py --check
PYTHONPATH=packages/pypi/klickd/src \
  python examples/v4/integrations/xai_grok/resume_chat_example.py --check --starter coding.klickd

Closes #109


🤖 Generated by Computer

Add a hermetic, OpenAI-compatible chat-message bridge and a two-mode
(--check dry-run / --live) resume example over the existing xAI/Grok
adapter, plus load/bridge/error tests. Document guardrails, trust
boundary, and provider-specific limits.
@Davincc77 Davincc77 marked this pull request as ready for review June 1, 2026 07:45
@Davincc77 Davincc77 merged commit 35c4488 into main Jun 1, 2026
3 checks passed
@Davincc77 Davincc77 deleted the add-xai-grok-bridge-tests branch June 1, 2026 07:49
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.

adapter: xAI Grok x.klickd context bridge

1 participant