polar-bear-rig-onchain/
│
│ ── Root tooling & meta ────────────────────────────────────────────
├── Cargo.toml Rust 2024 edition; all dependencies; lint + metadata tables
├── Cargo.lock Committed (binary crate); delete + regenerate on dep changes
├── rustfmt.toml Code-style rules (100 cols, 2024 edition, crate-level imports)
├── .clippy.toml Clippy config (MSRV 1.85.0, complexity thresholds)
├── .gitignore Focused Rust-only ignore file
├── .env.example Template for ANTHROPIC_API_KEY and other env vars
├── LICENSE-PBS Polar Bear Systems proprietary licence
├── README.md Project overview and quick-start
├── CHANGELOG.md Version history (all bug fixes documented)
├── CONTRIBUTING.md Dev setup, workflow, code-style, test instructions
├── FILE_STRUCTURE.md This file
│
│ ── Zed IDE config ─────────────────────────────────────────────────
├── .zed/
│ ├── tasks.json Task runner (build, run, test, clippy, fmt, examples)
│ └── debug.json LLDB debugger launch configurations
│
│ ── Documentation ──────────────────────────────────────────────────
├── docs/
│ ├── architecture.md System architecture; module map; task-local vs thread-local
│ ├── star_story.md STAR story
│ └── screen_capture_guide.md Demo run instructions for screen capture
│
│ ── Standalone runnable examples ───────────────────────────────────
│ (cargo run --example <name>; no API key needed except full-pipeline)
├── examples/
│ ├── signer_demo.rs SignerContext task-local isolation across 3 tasks
│ ├── balance_demo.rs Solana devnet balance query
│ └── jupiter_dry_run.rs Jupiter V6 dry-run quote + IsolationReport
│
│ ── Library source ─────────────────────────────────────────────────
├── src/
│ ├── lib.rs Crate root; re-exports agent, config, onchain
│ ├── main.rs Binary entry point; clap CLI arg parsing; mode dispatch
│ ├── config.rs Config::from_env(); reads ANTHROPIC_API_KEY etc.
│ │
│ ├── agent/ rig-core agent layer
│ │ ├── mod.rs build() → impl Prompt; AGENT_PREAMBLE; rig-core 0.36 imports
│ │ └── tools.rs SolanaBalanceTool, JupiterQuoteTool, SignerIsolationTool
│ │
│ └── onchain/ On-chain execution layer
│ ├── mod.rs execute_pipeline(), demo_signer() - public entry points
│ ├── signer.rs tokio::task_local! SignerContext; with_signer; IsolationReport
│ ├── balance.rs SolanaClient::devnet(); query_balance; BalanceResult
│ ├── jupiter.rs JupiterClient::dry_run(); get_quote; JupiterQuote
│ └── types.rs Lamports newtype; conversion helpers
│
│ ── Integration tests (no API key required) ─────────────────────────
├── tests/
│ ├── test_signer_context.rs task-local isolation, snapshot_active, IsolationReport
│ ├── test_balance.rs Lamports conversion, display
│ ├── test_jupiter.rs mint address constants, dry_run constructor
│ │
│ └── providers/ Live provider tests - gated behind #[ignore]
│ └── anthropic.rs Requires ANTHROPIC_API_KEY; run with --ignored