Skip to main content

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/) (v0.1.4). Requires Python >= 3.11.

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

# With optional extras:
pip install "swallo[mcp]==0.1.4"     # FastMCP server integration
pip install "swallo[sign]==0.1.4"    # Ed25519 passphrase signing via cryptography
pip install "swallo[tokens]==0.1.4"  # Token counting via tiktoken
pip install "swallo[dev]==0.1.4"     # 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 Invariants & Audit Status

  • Status: v0.1 release, not independently audited. Not a replacement for dedicated secret scanners or organizational credential management.
  • Automated Scanning: Clean CI runs with no open findings from CodeQL, Bandit (AST security linter), and pip-audit at release (2026-11-15).
  • Zero-Network Runtime: Core package strictly enforces zero outbound network egress.
  • Mandatory Human Approval: Approval requires an interactive controlling terminal (CONIN$ or /dev/tty). The approval gate cannot be bypassed through MCP tools or CLI flags.
  • Trojan Source Sanitization: Bidirectional overrides, zero-width characters, and Unicode tag characters (CVE-2021-42574) are stripped or neutralized.

Known Limitations

  • Redaction Bounds: The redaction engine scans decoded variants (base64, hex, rot13, URL) and high-entropy sequences, but cannot detect arbitrary custom steganography, non-standard cipher implementations, or secrets split across multiple discontinuous items. Always review context on terminal before approval.
  • Semantic Prompt Injection: Swallo fences delivered context with cryptographic nonces and immutable Markdown headers to instruct consuming agents to treat context as inert data. However, Swallo does not perform natural language prompt injection classification on payload text.
  • High Entropy False Positives: Long base64-encoded binary assets, image blobs, or cryptographic digests may trigger high-entropy redaction warnings. Use --warn mode or denylist exclusions in config.toml where appropriate.
  • Windows Application Control: On enterprise Windows systems enforcing strict Application Control or AppLocker policies, entrypoint .exe binaries may require administrative execution policy exemptions. In such environments, invoke Swallo via python -m swallo instead.
  • Experimental Python Versions: Python 3.11, 3.12, and 3.13 are fully tested and supported in production. Python 3.14 and 3.15 are tested experimentally in CI (continue-on-error).

Troubleshooting

  • Diagnose Store State: Run swallo doctor to verify SQLite WAL mode, key permissions, workspace root registrations, and hash chain integrity.
  • Uninitialized Store: If subcommands report Store at '...' is not initialized, run swallo init to generate a local cryptographic key and database.
  • Custom Store Directory: Configure SWALLO_HOME (or SWALLO_STORAGE_DIR) in your shell environment to relocate the store outside default user directories.
  • MCP Server Stdio Debugging: Verify MCP server operation by running python -m swallo mcp in your terminal. For IDE integration, ensure the python interpreter running Swallo matches the environment with swallo[mcp] installed.

Reporting Bugs & Vulnerabilities


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.4

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.4
File Size Uploaded Provenance Actions
swallo-0.1.4.tar.gz 323.7 kB With provenance Details for swallo-0.1.4.tar.gz

Built distribution (wheel)

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

Total release size: 484.3 kB

Release files / swallo-0.1.4.tar.gz

Download URL swallo-0.1.4.tar.gz
Size 323.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ebe551ce3d6d00d1e2bff8d6e3c66f7a5e9988de36ddf776e2fd17ee0a7be08b
BLAKE2b-256 checksum
How to use checksums
a6e63418c205348a986dc73882c88e895f499577cd2c22f44b9a8eb434a4c46b
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 15, 2026.

Transparency log

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

Download URL swallo-0.1.4-py3-none-any.whl
Size 160.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70e0bd3749e2760dd846e5829b987df24748ae524ff3c71d3c093d973afb85e1
BLAKE2b-256 checksum
How to use checksums
df1828160c824c82ad5e956876088cd0f50c6e189c147837dce4215b8fd877ea
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 15, 2026.

Transparency log

Security for swallo 0.1.4

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.4.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 15, 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.4 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