Skip to main content

Consent-gated, operator-driven clipboard bridge between AI sessions. Includes versioned clipboard history daemon: every copy timestamped and queryable by both operator and AI.

Project description

clipboard-relay

Consent-gated, operator-driven clipboard bridge between AI sessions.

The lightweight middle between single-agent and multi-agent paradigms.

What it does

When you run two AI sessions in parallel — say, Codex on one repo and Claude Code on another — and you want the second to see what the first just produced, the conventional answers are heavy: MCP integration, agent-to-agent protocols, shared message buses, agent registries.

clipboard-relay is the lightweight middle: the operator's clipboard becomes a single-slot, last-write-wins event bus, and the operator's hands are the trigger.

[ Source AI session ] -- emits content -->
[ Operator hits ctrl+c ]
[ Receiving AI calls clipboard_relay.read(consent=...) ]
[ Receiving AI now has full context, no infrastructure ]

Boundary

The agent must not auto-poll. The agent must not read without an explicit operator request. The agent must surface what it read. The agent must flag credential-shaped content before processing further.

These are not omissions; they are refusals. The package's only public function refuses to run without a consent token.

See docs/doctrine.md for the full brotology contract.

Install

pip install clipboard-relay

With cascade-lattice receipt support:

pip install "clipboard-relay[provenance]"

Two surfaces

1. One-shot readclipboard_relay.read(consent=...). Returns the current clipboard once, with credential-shape detection. Single-slot, last-write-wins.

2. Versioned historyclipboard_relay.daemon watches the clipboard and appends every distinct copy to ~/.clipboard-relay/history.jsonl. The history is queryable by both the operator (CLI) and any consenting AI session (clipboard_relay.history.read(consent=...)).

The history surface upgrades the clipboard from single-slot to versioned timeline: every copy timestamped, no copy lost, no manual paste needed.

One-shot

from clipboard_relay import read

# The AI must NOT fabricate the consent token. It must trace to operator intent.
result = read(consent="user said: read what I just copied from codex")

print(result.platform)               # "windows" / "macos" / "linux"
print(result.byte_count)             # int
print(result.content_sha256)         # for receipts
print(result.preview)                # first 500 chars (safe for logging)

# Flag credentials BEFORE processing further:
if result.has_credential_warnings:
    for w in result.credential_warnings:
        print(f"WARNING: {w.kind} (confidence {w.confidence}): {w.note}")
    # Stop and confirm with operator before using `result.content`.
else:
    process(result.content)

Versioned history

Start the daemon (foreground; Ctrl-C to stop):

clipboard-relay daemon                    # default 1000ms poll
clipboard-relay daemon --interval-ms 500  # tighter polling

Inspect history (operator-side notepad):

clipboard-relay show                # last 20 entries, preview only
clipboard-relay show --limit 100    # last 100
clipboard-relay show --full         # full content of each entry
clipboard-relay where               # print path to ~/.clipboard-relay/history.jsonl

Read history programmatically (AI-side, consent-gated):

from clipboard_relay import history

entries = history.read(
    consent="user said: read clipboard history from the codex session",
    limit=20,
)
for e in entries:
    print(e.timestamp, e.byte_count, e.sha256[:12])
    if e.credential_warnings:
        print("  CREDENTIAL DETECTED — flag to operator before processing")
    else:
        print("  preview:", e.preview[:80])

Each entry on disk is one JSON line at ~/.clipboard-relay/history.jsonl. Format is stable; codex / cascade-lattice can ingest directly.

Platform support

OS Tool used Required
Windows powershell.exe Get-Clipboard -Raw bundled
macOS pbpaste bundled
Linux (X11) xclip -selection clipboard -o install xclip
Linux (Wayland) wl-paste --no-newline install wl-clipboard

Failure modes the package surfaces

  • ConsentRequiredErrorread() was called with empty / whitespace consent. The agent failed the consent gate.
  • ClipboardTooLargeError — clipboard exceeded max_bytes (default 1 MB).
  • UnsupportedPlatformError — no clipboard tool found on host.
  • Stale clipboard — operator copied something else after the source AI's emit. Not raised; up to the caller to confirm with the operator.

Lineage

Part of the Ouroboros ecosystem:

  • brotology-field-guide — the operator contract this package embodies.
  • cascade-lattice — optional receipt emission for relay events (anonymized; content hash only).
  • quinesmith — sibling primitive with the same agent prepares, operator runs boundary.

License

Apache-2.0. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clipboard_relay-0.2.0.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clipboard_relay-0.2.0-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file clipboard_relay-0.2.0.tar.gz.

File metadata

  • Download URL: clipboard_relay-0.2.0.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for clipboard_relay-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6b5aca98a46ffa0a19846a52700d0fcb48b53a9dd273d319b2b46279f0e39259
MD5 f612b1b28ee643ed5d852f9f980518d2
BLAKE2b-256 43373a9dc6228d865346eb7fbba9df9167505a21274570c04c7e1cf48ef8988c

See more details on using hashes here.

File details

Details for the file clipboard_relay-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for clipboard_relay-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fcfe087d8afdf235e9b0401d0289d93a3d4663df267e076022185c2ba40d8151
MD5 3f496bb85fd6c3bdb327b04f27e92573
BLAKE2b-256 68c6bd7be7c4c15529dbfd8caf7b1143351c4e538c9a0414c00a8306450731c5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page