Skip to main content

MEDRE SimpleX Chat adapter

Bridge allowlisted SimpleX Chat groups and direct conversations through the official Python client. Group chat is the primary workflow. The provider includes plain-text attribution, scoped native replies with readable fallback, durable admission, and an SDK-free fake for development.

Install

Keep core and adapters in one locked uv project:

uv init --bare medre-bridge
cd medre-bridge
uv add medre medre-adapter-simplexchat

Keep the project lock for reproducible deployments. For Git development sources, select immutable revisions. The provider pins the released official simplex-chat package at the manifest pin. Its native library is downloaded on first initialization; no separate CLI daemon or unofficial wrapper is needed. The SDK supports Linux, macOS and Windows on its published architectures; CI qualifies Linux x86-64. The new private-link export commands require POSIX file permissions; they reject non-POSIX platforms before native mutation. This restriction does not change the other commands. This adapter's code is MIT licensed. The official SDK and native library carry their own AGPL-3.0 license.

For a persistent MEDRE 0.1.1 or later tool installation:

uv tool install medre
medre adapters install simplexchat

Existing saved Git requests and catalogs retain their sources. On Windows, run the printed uv installation command after MEDRE exits. Use medre adapter simplexchat for profile commands. The standalone medre-simplexchat entry point remains available in activated project environments with the same arguments.

Setup guidance boundary

The commands in this journey use --adapter sx as an example instance. Replace that value consistently with the actual configured provider ID before running commands. medre config native displays instructions only; it does not substitute IDs, provision accounts, or create a bridge.

medre config native offers no SimpleX form and never provisions this transport. What it prints depends on the installed core revision:

  • Cores without a typed setup-guidance seam refuse the transport with "'simplexchat' has no provider-declared native setup prompts; use its native configuration guide", pointing at this provider-owned guide.
  • Cores with the seam render the provider's declared setup journey as an informational, offline listing of the same commands with per-step evidence notes, classified informational_only. The render exits without writing a configuration file, invokes nothing, and claims no provisioning: it is guidance, not setup.

Both behaviors route to the same journey below and to medre adapter simplexchat for actual profile provisioning; core does not invoke those commands automatically because they contact the native service, unlike config native.

Core's AdapterSpec carries provider-owned setup surfaces: cli_register, which exposes the provider's provisioning commands in the journey below; native_setup_fields, an offline form that prompts for provider-declared config values and writes a new YAML without contacting an SDK, account, or device; and, on cores with the typed seam, native_setup_instructions, the informational journey for form-less providers that this provider declares. SimpleX profile, contact, and group provisioning cannot happen offline: connection links and group membership require the native service. An offline form could reference an existing profile, but could not provision it or complete contact and group membership. The provider declares no such form; it declares its journey as typed instructions so medre config native can print exactly the commands below with evidence notes at their true levels. A linked contact or a created group is not independently witnessed delivery, and provisioning results are never relay acceptance, delivery, or read evidence; they grant no send authority. This document remains the configuration guide that older cores' refusal points to.

Provision a dedicated profile

Setup proceeds in stages: prerequisites, explicit provisioning commands, verification, and the configuration reference. Provisioning always contacts the native service; initialization is explicit and starting MEDRE does not silently create a SimpleX identity.

Stage 1: prerequisites

  • Stop MEDRE before profile commands. MEDRE commands exclusively lock the profile; unrelated SimpleX clients do not honor this lock and must not open it concurrently. The profile is dedicated to one MEDRE adapter and one active native user.
  • Pick one --adapter ID (the examples use sx) and, when overriding storage, one --database-prefix. Use the same selection for setup and runtime. Profiles default to MEDRE's private instance state directory under adapters/sx/simplexchat/profile; MEDRE_HOME and XDG paths are honored.
  • The pinned official simplex-chat SDK downloads its native library on first initialization; libs_dir selects an existing official native library directory instead.

Stage 2: explicit provisioning commands

Run the provider's own commands in order. In a uv deployment project, prefix each with uv run --locked; the standalone medre-simplexchat entry point takes the same arguments.

medre adapter simplexchat init --adapter sx --name 'MEDRE bridge'
medre adapter simplexchat join --adapter sx
medre adapter simplexchat groups --adapter sx --json

init creates the private bot profile and its active native user. join prompts for a private contact or group connection link without echoing it; use --link-stdin for automation. A requested connection is persisted, and the command keeps native networking active for up to --wait-seconds (60 by default). The remote peer may need to approve.

The profile can also originate connections. create-address --adapter sx --out PATH creates or retains the profile's contact address and sets auto-accept using the bot's normal profile (not a business address). This does not reject incognito remote peers. create-link --adapter sx --group-id ID --out PATH creates or exports the existing member-role invitation for a local group reported by groups. Existing links with another role are refused, not changed. The address_created and group_link_created result fields indicate whether a new native link was created, not whether export succeeded on a prior invocation.

Both export commands require POSIX owner-only file permissions. Use an operator-controlled output directory on a filesystem that enforces them. The command writes a fresh 0600 file and atomically replaces the destination entry, including a symlink entry without following its target. It does not modify an existing inode, even if it has other hard links or open readers. Link material is never printed. If export fails after native creation, correct --out and repeat the same command against the same profile and group; the existing link is retained. An interrupted process may leave an owner-only temporary file in the output directory. Treat it as private too. Peers complete the connection while connect --adapter sx keeps native networking active. Group-link joins may complete without a separate approval step. Configure and verify native admission policy separately if approval is required; these commands do not enforce it.

Provisioning completes with explicit actions. accept-group --adapter sx --group-id ID accepts an invited group, connect --adapter sx resumes pending native connections for a bounded interval, and create-group --adapter sx --name 'Bridge room' creates a bot-owned group. contacts --adapter sx lists direct chat IDs from the same profile.

Stage 3: verification

Read each result at its true evidence level:

  • groups and contacts print the profile's native listings. A connection observation does not establish group membership; the command output itself states that a connected contact does not prove group membership. Accept an invited group with accept-group --adapter sx --group-id ID before routing it, and use connect --adapter sx again when a request stays pending.
  • Group/member/contact IDs are local to this dedicated profile; they are not global SimpleX identities.
  • create-address and create-link prove local native state only. The written link is the capability to connect, so keep its owner-only file private. Inspect native membership and admission policy independently; a group-link join may be accepted automatically. Creating or exporting a link is not relay acceptance, delivery, or read evidence.
  • A linked contact is not an independently witnessed delivery. Nothing above proves a peer received a message: outbound acceptance confirms only the native local queue, and health describes the local native session, not peer reachability. See Delivery and recovery.

Stage 4: configuration reference

Use IDs from this profile's groups or contacts output:

adapters:
  simplexchat:
    sx:
      user_id: 1
      chats: [group:7, contact:3]
      origin_label: SimpleX Chat

When a runtime YAML exists, --config bridge.yaml --adapter sx selects its profile and honors MEDRE's environment overrides. Routes use explicit channel strings such as source_channel: "group:7" and dest_channel: "group:7". Both source and destination channels must be allowlisted. Ordinary active groups and accepted active contacts are supported; private group support conversations are excluded. This example configures only one provider; add a second adapter and explicit route legs with medre config bridge. Run medre config check and medre routes plan before starting; these offline checks do not prove native acceptance or recipient delivery.

Set an encrypted profile's key with MEDRE_ADAPTER__SX__DATABASE_KEY; keep it out of YAML and arguments. database_prefix and state_dir override private storage. On Linux, native_cache_dir controls the SDK cache through XDG; on other systems the SDK uses its platform cache. libs_dir selects an existing official native library directory on any supported platform.

Delivery and recovery

Text is rendered with MEDRE's relay attribution. When the official client supplies a peer's profile, the peer-declared display name (then full name) leads the attribution prefix; the local word-pair alias and the scoped sender identity remain the fallbacks, and missing or non-printable names degrade without invention. The codec also captures the SDK's native facts in the versioned namespace: the shared stable member ID (an additional identifier alongside the scoped sender identity) and role for group members, per-item signature-verification verdicts, and mention/link flags. The explicit public_facts allowlist (msg_verified, member_role) crosses into another transport's relay context; the rest of the namespace stays out of the off, minimal, and safe metadata export modes, but an operator-selected explicit full metadata export embeds the whole namespace and can disclose the member ID. Replies use destination-bound native quotes when the retained parent is verified in the active profile and conversation. Missing, deleted or mismatched parents retain readable fallback. Threads remain fallback; attachments, edits, deletions, reactions, typing, and puppeting are not advertised. Received control items, sent echoes, blocked members, file captions, live partial messages, and private support chats are excluded.

The first successful scan establishes a baseline without replaying existing history. Restart recovery walks every retained history page using native pagination and a local ledger of processed IDs. Group history is timestamp ordered: late messages can have higher IDs and earlier positions. Recovery admits missing items in oldest-page-first order without assuming increasing IDs. Each baseline page commits its IDs in one transaction. Recovery must not stop at a fully retained page: older pages can still contain unseen, backdated messages. Startup cost and retained ID storage grow with native history; for large profiles, allow additional startup time and monitor profile growth.

Live events use a native buffer bounded to 256 items and 1 MiB. Overflow stops the adapter; restart recovery reads retained messages from the native profile. Admission refusals retain the pending event for retry. Stable canonical IDs let core deduplicate an admission repeated across a crash. Native history deleted or expired before recovery cannot be reconstructed. Back up the profile, ownership sidecar, MEDRE state, and adapter ledgers together; do not reuse these ledgers for a reset native profile.

Outbound acceptance confirms only the native local queue, not remote delivery. An exact confirmed attempt can return its stored native reference without sending again. A conflicting attempt, uncertain native outcome, or different attempt for the same outbox requires inspection of the native profile; the adapter refuses a blind resubmission. If the session rejects a send before any command is written, the unsent reservation is released and core can retry. A native rejection after submission is not proof of no handoff and remains uncertain. Health describes the local native session, not peer reachability.

Develop and validate

Register arbitrary checkout paths with medre dev; sibling directories are not required:

medre dev sync --project /path/to/medre --sources /path/to/dev-sources.yaml \
  --editable simplexchat=/path/to/medre-adapter-simplexchat simplexchat

The explicit source catalog can contain:

adapters:
  simplexchat: medre-adapter-simplexchat @ git+https://github.com/jeremiah-k/medre-adapter-simplexchat.git@main

Add --sdk to install the native dependency. See medre dev --help for workspace selection and dependency options. CI checks this adapter against core main, resolved once per run, recording both revisions. Keep MEDRE_CORE_REF unset. Its manual core_ref input qualifies a candidate core revision without committing temporary branch pins.

Run tests from a development environment containing core and this provider:

python -m pytest -q
python -m simplex_chat install
python -m pytest -q -m "simplexchat_sdk and not local_integration and not soak and not live and not hardware and not docker"

The default suite uses deterministic SDK boundaries and real subprocess ownership tests. The opt-in SDK tier creates a disposable native profile and self-owned group and proves local queue acceptance. It does not prove remote message receipt. Independent-profile group routing and adding SimpleX to the native all-adapter campaign require a separate live qualification run.

The provider contract and configuration schema describe the runtime boundaries and versioned metadata projection.

Development tooling

See contributing for the shared Trunk quality gate and uv-based editable development workflow.

Native reply qualification is recorded in the boundary follow-up.

Metadata

Release files for medre-adapter-simplexchat 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for medre-adapter-simplexchat 0.2.0
File Size Uploaded Provenance Actions
medre_adapter_simplexchat-0.2.0.tar.gz 92.7 kB With provenance Details for medre_adapter_simplexchat-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for medre-adapter-simplexchat 0.2.0
File Interpreter ABI Platform Actions
medre_adapter_simplexchat-0.2.0-py3-none-any.whl Python 3 none any Details for medre_adapter_simplexchat-0.2.0-py3-none-any.whl

Total release size: 140.3 kB

Release files / medre_adapter_simplexchat-0.2.0.tar.gz

Download URL medre_adapter_simplexchat-0.2.0.tar.gz
Size 92.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d171e51bdd8870f138ec0086aa6d8f28d0d7ed737dee12a0a70c8ffc2e64f621
BLAKE2b-256 checksum
How to use checksums
c8229a127441a656709b5e91efec1bfd282e7b3527e974e860a1cac6d2e0d915
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / medre_adapter_simplexchat-0.2.0-py3-none-any.whl

Download URL medre_adapter_simplexchat-0.2.0-py3-none-any.whl
Size 47.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b2b0edaea8ea2839ebc531d75c63f9596cc4e72d29378eed5c89455608846bf
BLAKE2b-256 checksum
How to use checksums
fcdb6b27a9f412d5930f7e0c68101e03a367ccde68503790549a5d44290f03a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for medre-adapter-simplexchat 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for medre_adapter_simplexchat-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page