10.3 Cursor Agent SDK Importer & Sanitizer
chinwag agent import-cursor ./cursor-project --name MY-AGENTPRD-0036 & CHWG-0204: 1-command migration from Cursor Agent SDK & Projects folders to Chinwag multi-engine agent bundles with 5-gate static RCE and secret quarantine.
10.3 Cursor Agent SDK Importer & Sanitizer
chinwag agent import-cursor ./cursor-project --name MY-AGENT
PRD Metadata (
PRD-0036/CHWG-0204):
- Status:
RATIFIED — SCHEDULED ON BOARD (02 · 📐 SCOPED & BENCHMARKED)- Live Board Ticket:
CHWG-0204on GitHub Projects v2 (github.com/orgs/emunlabs/projects/1)- Invariants Enforced:
INV-CURSOR-IMPORT-SAFE-01(a–e) ·INV-DESIGN-TYPE-ONLY-01- Author & Assignee: Brian Spector (
Emun Labs, Inc., 1401 Lavaca St STE 81335, Austin, TX 78701) ·@RUST·@DELIVERY·@QA
1. Deterministic 1:1 Artifact Translation (<500ms)
Cursor's Agent SDK and Projects format defines agents using five local file artifacts (instructions.md, tools/, skills/, mcp-connections/, channels/), but locks deployment to metered cloud hosting. Running chinwag agent import-cursor <src-dir> --name <NAME> deterministically translates any Cursor agent directory into a local Chinwag SOP-BOOT-01 agent bundle (SOUL.md, AGENT.md, TOOL.md, skills/**/SKILL.md) that runs across all supported frontier and local engines on BYO-Mac hardware at $0/minute:
Cursor Agent SDK Source Artifact | Chinwag Target Artifact (~/fleet-skills/agents/<NAME>/) | Security & Schema Transformation Rule |
|---|---|---|
instructions.md (Persona & voice) | SOUL.md | Extracts temperament, signature questions, and craft rules into SOP-BOOT-01 schema for human sign-off. |
instructions.md (Workflow & routing) | AGENT.md | Maps into AGENT.md with SOP-BOOT-01 startup verification and Chinwag Dual-Layer Native Memory (INV-MEM-01). |
tools/*.ts & .cursor/mcp.json | TOOL.md + .chinwag/mcp-allowlist.json | Translates tool descriptors into TOOL.md, enforces INV-CURSOR-IMPORT-SAFE-01 sanitization, and binds secrets into PhantomVault (chwg_phantom_*). |
skills/<slug>/ | skills/<slug>/SKILL.md | Copies modular skill directories into ~/fleet-skills/agents/<NAME>/skills/ for startup loading. |
channels/*.ts | .chinwag/dags/chinwag-sop-<name>.yaml | Converts webhook triggers into local declarative SOP DAGs and Slack /chinwag routes. |
2. Five-Gate Untrusted Cursor Import Sanitizer (INV-CURSOR-IMPORT-SAFE-01)
Because .cursor/mcp.json, mcp-connections/*.json, and .cursor/rules/*.mdc files are frequently cloned from untrusted third-party repositories where malicious MCP command/args/env entries attempt remote code execution (RCE) or credential exfiltration on first boot, chinwag agent import-cursor enforces five mandatory static security gates:
- Zero Execution During Import (
INV-CURSOR-IMPORT-SAFE-01a): Parsesagent.json,instructions.md,.cursor/mcp.json, and.mdcfiles strictly as inert AST data; never invokesnode,bun,npx,uvx,sh, orbashduring import. - MCP Command & Shell-Metacharacter Quarantine (
INV-CURSOR-IMPORT-SAFE-01b): Validates every MCP server executable against a strict allowlist (npx,uvx,docker, or/nix/storepaths with zero..traversal). Anycommandorargscontaining shell interpreters (sh -c,bash -c,eval,curl | sh), command substitution (`,$(,;,&&,|), or remote URL package specifiers is hard-rejected with exit code78(EX_CONFIG). - Dynamic Linker & Runtime Environment Scrubbing (
INV-CURSOR-IMPORT-SAFE-01c): Strips code-injection environment variables (DYLD_INSERT_LIBRARIES,DYLD_LIBRARY_PATH,LD_PRELOAD,NODE_OPTIONS,PYTHONSTARTUP,PYTHONPATH,BASH_ENV,GIT_SSH_COMMAND,CARGO_BUILD_RUSTC_WRAPPER) from any importedenvblock. - Automatic Secret Scrubbing & PhantomVault Conversion (
INV-CURSOR-IMPORT-SAFE-01d): Replaces any inline high-entropy credential (sk-*,ghp_*,github_pat_*,xoxb-*,AKIA*,Bearer *) with achwg_phantom_<sha256_prefix>handle backed by the macOS Keychain. - Prompt-Injection & Exfiltration Directive Scanner (
INV-CURSOR-IMPORT-SAFE-01e): Scans.cursor/rules/*.mdcandinstructions.mdfor hidden Unicode bidi/tag characters (U+202A–U+202E,U+2066–U+2069,U+E0000–U+E007F), base64 shell payloads, and forbidden credential paths (~/.ssh,~/.aws,/etc/passwd), aborting import on any match.
- Ready to ship verified code at autonomous speed? Reserve Your Organization Credit Pack →
10.2 Executable Delivery Boards & Proof-of-Green
PRD-0038 & CHWG-0192: Chinwag Delivery-2 autonomous kanban state machine, 4-surface Proof-of-Green verification, 200ms snap-back, and native GitHub/Linear Insights telemetry.
10.4 Chinwag Local Web App & Command Center
PRD-0039 & CHWG-0203: Customer-first local web application compiled into the chinwag CLI for active tasks, self-healing CI runs, code diff and visual previews, credit usage, and zero-knowledge Slack/GitHub/Linear notifications.