An evidence-first Copilot agent that ports codebases to Rust. Built on Anvil patterns.
port2rust systematically ports a source repository to Rust with proof, not promises:
- SQL Verification Ledger — Every build, test, and lint result is
INSERTed into SQLite. Evidence bundles areSELECTs, not prose. - Adversarial Multi-Model Review — Up to 3 AI models (GPT, Gemini, Claude) attack every change, each trying to find bugs the others missed.
- Baseline Snapshots — System state captured before every change. Regressions are caught before you see the code.
- Risk Classification — Tasks are tagged 🟢/🟡/🔴. High-risk porting (auth, crypto, parsing) gets 3 adversarial reviewers.
# Port a repository
python scripts/orchestrate.py https://github.com/example/some-tool
# With explicit name
python scripts/orchestrate.py https://github.com/example/some-tool --name some-tool
# Resume after interruption
python scripts/orchestrate.py --resume
# Run specific phase
python scripts/orchestrate.py --phase porting --resume@port2rust port https://github.com/example/some-tool
port2rust/
├── agents/
│ └── port2rust.agent.md # Main agent (Anvil-style prompt)
├── .github/agents/ # Sub-agent prompts
│ ├── planner.md # Planning agent (risk-aware)
│ ├── coder.md # Coding agent (evidence-first)
│ └── reviewer.md # Adversarial reviewer
├── scripts/
│ └── orchestrate.py # Orchestration engine
├── plugin.json # Plugin metadata
├── agent.yaml # Agent configuration
└── mcp.json # Context7 MCP server
├── code2port/ # Source repo submodule
├── src/ # Ported Rust code
├── test/
│ ├── port_harness/ # Test harness for original code
│ ├── project_harness/ # Test harness for Rust port
│ └── test_cases/ # Shared test cases
├── .port2rust_ledger.db # SQL verification ledger
└── .port2rust_state.json # Orchestrator state
| Phase | Steps | What Happens |
|---|---|---|
| Setup | 1–4 | Branch → folders → submodule → build detect → baseline capture |
| Test Harness | 5–7 | Planner analyzes code → Anvil implements harness+tests → sync |
| Porting | 8–11 | Strategy → Anvil ports with adversarial review → completeness check |
| Validation | 12–16 | Rust test harness → run tests → fix failures → evidence bundles |
| Review | 17–19 | 3-model adversarial review → fix → re-validate → converge |
1. 📸 Baseline — snapshot build/test state into SQL
2. 🔨 Implement — Anvil agent writes code with built-in verification
3. ✓ Verify — build, test, diagnostics → INSERT results
4. ⚔️ Adversarial — 1-3 models attack the code (risk-driven)
5. ⚠️ Regress? — compare baseline vs after, fix if degraded
6. 📋 Evidence — bundle generated from SELECT, not prose
7. ✅ Commit — auto-commit with rollback command
────────────────────────────────────────────────────────────
🔨 Port2Rust Evidence Bundle
Phase: porting | Task: port-3 | Risk: 🔴
────────────────────────────────────────────────────────────
Baseline (before):
[✓] build: cargo build succeeded
[✓] tests: 12 passed
Verification (after):
[✓] build: cargo build succeeded
[✓] tests: 14 passed (+2 new)
Adversarial Review:
[✓] review-gpt-5.3-codex: No issues
[✓] review-gemini-3-pro: No issues
[✓] review-claude-opus-4.6: No issues
Regressions: None
Confidence: High
────────────────────────────────────────────────────────────
- Python 3.10+
- Git
- Rust toolchain (rustup, cargo)
- GitHub Copilot CLI with agent support
MIT — see LICENSE.