Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.1.4 instead.
Reason given by maintainers: Superseded by 0.1.4: tamper-mutation preconditions, new-user validation, security docs

swallo — Agent Context Handoff

CI Clean Install CodeQL PyPI Python 3.11+ License OpenSSF Scorecard

Portable, reviewable handoff between any AI chat agent and any IDE with zero-network runtime isolation.

swallo is a local-first, zero-network Python package and security CLI tool designed to transport structured conversational and debugging context between AI chat agents (ChatGPT, Claude, Gemini) and agentic IDE environments (Claude Code, Cursor, Antigravity).

Context travels as an integrity-checked, schema-validated JSON "context packet" with cryptographic content addressing, deterministic canonicalization, explicit redaction bounds, Trojan Source sanitization, and zero network calls in the core runtime.


Architecture Overview

flowchart TD
    subgraph Capture["1. Ingest & Capture"]
        Chat["Chat Session / Export"] --> Prompt["swallo prompt / paste"]
        Vendor["Vendor JSON / Markdown"] --> Import["swallo import"]
    end

    subgraph SecuritySpine["2. Security & Redaction Spine"]
        Prompt --> Redact["Redaction Engine<br/>(Decoded Variants & Caps)"]
        Import --> Redact
        Redact --> Sanitize["Trojan Source Sanitizer<br/>(CVE-2021-42574 BiDi Neutralization)"]
        Sanitize --> Canonical["Swallo Canonical JSON v1<br/>(Float-Free, NFC-Normalized)"]
    end

    subgraph Storage["3. Content-Addressed Local Store"]
        Canonical --> SQLite["SQLite Store + WAL<br/>(%LOCALAPPDATA% / XDG)"]
        Canonical --> EventLog["HMAC / Ed25519 Signed Ledger<br/>& Event Log Chain"]
    end

    subgraph Consumption["4. Human Review & Delivery"]
        SQLite --> CLIReview["swallo approve / send<br/>(Interactive TTY Required)"]
        SQLite --> MCPServer["swallo mcp<br/>(Draft Quota + Token Bucket)"]
        CLIReview --> IDE["Target IDEs:<br/>Claude Code / Cursor / Antigravity"]
        MCPServer --> IDE
    end

Installation

swallo is available on PyPI (pypi.org/project/swallo/). Requires Python >= 3.11.

# Install swallo from PyPI (zero third-party runtime dependencies beyond Pydantic)
pip install swallo

# With optional extras:
pip install "swallo[mcp]"     # FastMCP server integration
pip install "swallo[sign]"    # Ed25519 passphrase signing via cryptography
pip install "swallo[tokens]"  # Token counting via tiktoken
pip install "swallo[dev]"     # Development, testing, and benchmark suite

Dependency Isolation Guarantee

The core runtime strictly requires only pydantic>=2.0.0 and the Python standard library. Optional dependencies (mcp, cryptography, tiktoken) are imported lazily on demand. Importing swallo emits zero warnings under python -W error and will never load optional modules into sys.modules.


Quick Start

For a complete 3-minute setup walkthrough for Claude Code, Cursor, and Antigravity IDEs, see the Quickstart Guide.

  1. Initialize the local store:
    swallo init
    
  2. Verify environment health:
    swallo doctor
    
  3. Capture context via structured paste:
    swallo prompt --instructions > prompt.txt
    # Paste context into prompt.txt, then save:
    swallo save --file prompt.txt --target antigravity
    
  4. Inspect and approve the packet:
    swallo show pkt_latest
    swallo approve pkt_latest --target antigravity
    
  5. Deliver to target IDE:
    swallo send pkt_latest --target antigravity
    

CLI Command Reference

swallo provides 23 structured subcommands:

Command Synopsis Description
swallo init swallo init [--force] Initialize local store directory, database, HMAC key, and default config.
swallo doctor swallo doctor [--json] Diagnose environment, permissions, key health, and workspace roots.
swallo prompt swallo prompt [--instructions] Generate capture prompt template for chat assistants.
swallo save swallo save [--file F] [--target T] Ingest, redact, canonicalize, and store a new context packet.
swallo import swallo import <path> [--format FMT] Import vendor chat exports (ChatGPT, Claude, Gemini) securely.
swallo merge swallo merge <base> <incoming> Three-way merge two packets against a common base.
swallo resolve swallo resolve <pkt> [--accept OURS|THEIRS] Resolve merge conflicts in a packet.
swallo show swallo show <pkt_id> [--raw] [--json] Inspect packet details, decisions, constraints, and provenance.
swallo edit swallo edit <pkt_id> Interactively edit packet fields with schema re-validation.
swallo approve `swallo approve <pkt_id> [--target claude-code cursor
swallo send `swallo send <pkt_id> [--to claude-code cursor
swallo load swallo load <pkt_id> Load packet into memory or inspect delivered state.
swallo diff swallo diff <pkt_a> <pkt_b> Show structural and field-level diff between two packets.
swallo list swallo list [--limit N] [--project P] List packets, drafts, approval status, and timestamps.
swallo status swallo status [--limit N] [--project P] Inspect store status and list stored context packets.
swallo log swallo log [--verify] Inspect audit event log and verify cryptographic hash chain.
swallo staleness swallo staleness <pkt_id> [--ack] Check git drift against HEAD; acknowledge critical drift.
swallo drafts swallo drafts [--clean] [--quota] Inspect and clean pending unapproved MCP draft packets.
swallo breaker swallo breaker [--reset] Inspect or reset the MCP save circuit breaker.
swallo bench swallo bench <run|verify> Execute or verify deterministic benchmark suite.
swallo mcp swallo mcp [--transport stdio] Start the Model Context Protocol (MCP) server.
swallo help swallo help [command] Display detailed command help and argument descriptions.
swallo version swallo version [--json] Print tool version, supported schema versions, and runtime info.

Exit Codes

  • 0: Success.
  • 1: General application error.
  • 2: UsageError (invalid arguments, flags, or unknown command).
  • 3: ValidationError (schema or boundary violation).
  • 4: RedactionBlockedError (unredacted secret detected in fail-closed mode).
  • 5: ConflictError (unresolved merge conflict).
  • 6: NotApprovedError (attempting to consume unapproved context).
  • 7: StaleContextError (packet blocked by staleness drift policy).
  • 8: IntegrityError (corrupt database or broken event-log hash chain).
  • 9: SecurityError (path traversal, symlink escape, or forged approval).
  • 10: RateLimitedError (MCP session token bucket exhausted).
  • 11: SessionPausedError (MCP circuit breaker tripped after repeated blocked saves).
  • 12: DraftQuotaExceededError (draft count or storage quota exceeded).
  • 13: UnregisteredProjectError (workspace not registered in global store).

Configuration Reference

Configuration is stored in <store>/config.toml (e.g. %LOCALAPPDATA%\swallo\config.toml on Windows, ~/.local/share/swallo/config.toml on Linux).

[storage]
busy_timeout_ms = 5000     # SQLite WAL busy handler timeout
max_packet_bytes = 10485760 # 10MB packet payload limit
max_json_depth = 64        # Maximum nested JSON parsing depth

[redaction]
mode = "mask"              # "mask", "remove", or "fail_closed"
scan_decoded_variants = true
max_decode_depth = 3
max_decode_bytes = 65536
decode_timeout_ms = 200

[mcp]
enabled = true
token_bucket_rate = 30     # 30 requests per minute
token_bucket_burst = 10    # Burst allowance
draft_quota = 50           # Maximum unapproved drafts per project
circuit_breaker_threshold = 5 # Consecutive blocks before session pause

[approve]
signing = "hmac"           # "hmac" (default) or "passphrase" (Ed25519)
require_tty = true         # Invariant: agents cannot approve context

MCP Integration

swallo provides standard Model Context Protocol (MCP) support over stdio via python -m swallo mcp. The server exposes:

  • save_context: Store an unapproved draft packet (tier T1).
  • load_context (and get_context alias): Retrieve approved context fenced against prompt injection.
  • verify_context: Read-only verification of hash integrity, event-log HMAC chain, and ledger status.
  • list_contexts: List summary metadata for stored packets.
  • merge_contexts: Merge 1..N packets with conflict tracking.
  • diff: Compare packets item-by-item.

In accordance with security invariant ADR-007, no approve tool is exposed via MCP. Human review and approval strictly requires the interactive CLI terminal.

Environment variables:

  • SWALLO_HOME (primary): Set the local storage directory (defaults to %LOCALAPPDATA%\swallo on Windows, ~/.local/share/swallo on Linux).
  • SWALLO_STORAGE_DIR: Supported alias for SWALLO_HOME.

Claude Code

Add to your project's .mcp.json or user-level config:

{
  "mcpServers": {
    "swallo": {
      "command": "swallo",
      "args": ["mcp"]
    }
  }
}

Cursor

Add to Cursor's MCP Settings (Settings > Features > MCP):

  • Name: swallo
  • Type: command
  • Command: swallo mcp

Antigravity

Add to .gemini/antigravity/mcp/swallo.json or your MCP server configuration:

{
  "name": "swallo",
  "command": "swallo",
  "args": ["mcp"]
}

Security Model & Structural Invariants

  1. Two-File Delivery: Chat-derived context is written to isolated data files under .swallo/handoff/, leaving only a short pointer stub in rules files.
  2. Mandatory Interactive Approval: Approval requires an interactive TTY. Agents cannot approve context.
  3. Deterministic Content Addressing: All packets and items are addressed by SHA-256 hashes of their canonical JSON representations.
  4. Trojan Source Sanitization: Bidirectional overrides, zero-width characters, and Unicode tag characters (CVE-2021-42574) are strictly stripped or neutralized.
  5. Circuit Breaker: 5 consecutive blocked saves trip the MCP circuit breaker, pausing agent activity until reset by the human operator.

Community & Code of Conduct

Swallo is an open, welcoming community. All participants are expected to adhere to our Code of Conduct (Contributor Covenant v2.1).


License

This project is dual-licensed under:

at your option. See LICENSE for details.

Metadata

Release files for swallo 0.1.3

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

Source distribution (sdist)

Source distribution for swallo 0.1.3
File Size Uploaded Provenance Actions
swallo-0.1.3.tar.gz 310.4 kB With provenance Details for swallo-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for swallo 0.1.3
File Interpreter ABI Platform Actions
swallo-0.1.3-py3-none-any.whl Python 3 none any Details for swallo-0.1.3-py3-none-any.whl

Total release size: 469.6 kB

Release files / swallo-0.1.3.tar.gz

Download URL swallo-0.1.3.tar.gz
Size 310.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d55d54bafa600c536389eb013a5e5c636566aad8f2ad95cedcee0e9973231edd
BLAKE2b-256 checksum
How to use checksums
01f8d04045c6a468e13df56490933ecdae418ff44b99a286d0ab07f6a59721cb
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 14, 2026.

Transparency log

Release files / swallo-0.1.3-py3-none-any.whl

Download URL swallo-0.1.3-py3-none-any.whl
Size 159.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a1fbe2b3de0e69d7645d5c545050b3204622f133d5f63051feb51ace650c25a
BLAKE2b-256 checksum
How to use checksums
04ddc255496a7e6a6f3281a6f394b8a147d30f346f97364bfcfa1ad7db024f56
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 14, 2026.

Transparency log

Security for swallo 0.1.3

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 swallo-0.1.3.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 14, 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.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files Full provenance

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