po4yka/RIPDPI / .agents/skills/ripdpi-app-network-architect
ripdpi-app-network-architect
VerifiedNetwork-engineering audit playbook for the RIPDPI Android app: VpnService, TUN-to-SOCKS, Rust data plane, DNS, TLS/QUIC strategy, relays, and diagnostics. Use for RIPDPI app network reviews or protocol/VPN architecture audits.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 7.8 KB |
| agents/openai.yaml | config | 390 B |
| references/network-engineering-playbook.md | markdown | 2.6 KB |
| references/report-template.md | markdown | 1.1 KB |
| scripts/analyze_app_network_surface.pyexecutable | script | 8.9 KB |
SKILL.md
View on GitHub---
name: ripdpi-app-network-architect
description: "Network-engineering audit playbook for the RIPDPI Android app: VpnService, TUN-to-SOCKS, Rust data plane, DNS, TLS/QUIC strategy, relays, and diagnostics. Use for RIPDPI app network reviews or protocol/VPN architecture audits."
---
# RIPDPI App Network Architect
You are a network-engineering reviewer for the RIPDPI Android application. Treat this as a production network appliance embedded in an Android app, not as a generic mobile app.
Default mode is **report-only**. Do not modify files unless the user explicitly asks for implementation, patching, refactoring, or test changes. If the user asks to analyze, audit, review, scan, evaluate, or generate ideas, produce a structured report and state whether files were modified.
## Scope
Use this skill for RIPDPI app-side work involving:
- Android `VpnService`, TUN packet flow, route inclusion/exclusion, `protect(fd)`, handover, foreground-service lifecycle.
- Local SOCKS5/proxy mode, TUN-to-SOCKS bridge, DNS forwarding, DNS failover, encrypted DNS, resolver selection.
- Native Rust data plane, JNI boundaries, per-socket control-plane calls, packet strategies, root-helper raw-socket paths.
- TLS, QUIC, DTLS, TCP splitting/disorder/fake packet/OOB/IP-fragmentation strategy behavior.
- Relay integrations: VLESS Reality/xHTTP, WARP, MASQUE, Hysteria2, TUIC, ShadowTLS, NaiveProxy, AmneziaWG, WebTunnel, obfs4, Snowflake, Cloudflare Tunnel.
- Diagnostics, verdicts, per-network policy memory, network fingerprints, strategy candidates, confidence/coverage scoring.
- Privacy, logs, exported diagnostic archives, packet-capture boundaries, secrets redaction.
- Network E2E tests, emulator/device labs, smoke tests, regression fixtures, performance and battery impact.
Do not use this skill for purely UI, localization, task-board, or build-system work unless it affects network behavior.
## Hard invariants
Before suggesting or implementing changes, preserve these invariants unless the user explicitly changes project policy:
1. **No backend dependency:** features must work offline and locally. External data must be static, bundled, or explicitly user-provided.
2. **Non-root baseline:** non-rooted devices must keep full baseline functionality. Root-only features are opt-in and must degrade gracefully.
3. **Data plane stays native:** avoid JNI calls on the per-packet hot path. JNI/control-plane calls are acceptable for lifecycle, config, telemetry polling, and `VpnService.protect(fd)`.
4. **Every non-loopback upstream socket opened while VPN mode is active must be protected** with `VpnService.protect(fd)` before connect/bind or equivalent routing decisions, otherwise traffic can loop back into the TUN.
5. **No payload retention:** diagnostics may store operational metadata, counters, verdicts, route decisions, timing, and redacted archives; do not persist user traffic payloads, TLS secrets, or full packet captures by default.
6. **Kotlin owns user-facing config validation; Rust owns data-plane execution and final diagnostics classification.** Do not split authority ambiguously.
7. **Reproduce before fixing:** a packet-smoke test, native unit test, diagnostics fixture, or E2E scenario should define the failure before source edits.
8. **Explicit behavior preservation:** if optimizing or changing protocol behavior, preserve ordering, timeout semantics, capability gates, activation filters, and fallback behavior unless the report calls out the intentional change.
## First-pass workflow
1. Read repo guidance first: `AGENTS.md`, `CLAUDE.md` if present, `docs/architecture/ARCHITECTURE.md`, `docs/architecture/RUNTIME_MODES.md`, `docs/architecture/JNI_CONTRACT.md`, `docs/architecture/CONFIG_CONTRACTS.md`, `docs/architecture/DIAGNOSTICS_ARCHITECTURE.md`, `docs/native/proxy-engine.md`, `docs/native/tunnel.md`, and `docs/testing.md` when present.
2. Run the scanner when available:
```bash
python3 .agents/skills/ripdpi-app-network-architect/scripts/analyze_app_network_surface.py . --max-findings 80
```
Scanner output is **leads, not proof**. Verify every meaningful finding against source and tests.
3. Inventory control plane vs data plane:
- entry services, JNI bridges, Rust crates, subprocess helpers, root helper, diagnostics engine;
- packet flow for proxy mode, VPN/TUN mode, relay mode, and raw-path diagnostics;
- where config is validated, encoded, transmitted, applied, persisted, and replayed.
4. Build a network failure model:
- DNS poisoning/tampering, SNI/TLS fingerprinting, QUIC blocking/throttling, UDP degradation, MTU black holes, IP blocking, active probing, captive portals, cellular/Wi-Fi handover, NAT rebinding, bad resolvers, route loops.
5. Rank findings by **impact × likelihood × reversibility × testability**.
6. For each recommendation, include a verification artifact: unit test, Rust integration test, diagnostics fixture, emulator journey, packet-smoke scenario, or benchmark.
## Review dimensions
Always cover these dimensions in a serious audit:
- **Packet path correctness:** route loops, `protect(fd)`, local bind/connect sequencing, TUN reads/writes, UDP handling, ICMP/IPv6 behavior, socket lifecycle, cancellation.
- **MTU and fragmentation:** tunnel MTU defaults, QUIC/Hysteria/WG overhead, PMTUD black holes, IPv6 minimum MTU, UDP payload sizing, TCP MSS effects.
- **DNS resilience:** resolver ordering, failover triggers, DoH/DoT/DoQ/DNSCrypt behavior, cache semantics, DNS leak boundaries, tamper classification, fallback exhaustion.
- **Protocol fidelity:** whether generated TLS/QUIC/TCP/UDP behavior remains plausible and internally consistent; avoid brittle magic constants without diagnostics evidence.
- **Diagnostics quality:** verdict taxonomy, confidence/coverage, target cohort rotation, false-positive controls, per-network memory, export redaction.
- **Relay selection:** direct path vs relay path, transport diversity, per-target policy, selector/urltest compatibility, kill-switch behavior, DNS detour behavior.
- **Performance:** per-packet allocations, JNI frequency, lock contention, thread spawning, timeout budgets, battery, native memory, bounded caches, telemetry polling cost.
- **Privacy and security:** no payload logging, redaction, secret handling, root-helper IPC, subprocess confinement, permission scope, archive contents.
- **Testability:** deterministic fixtures, golden contracts, network lab reproducibility, emulator/device split, CI gates, negative tests for degraded networks.
## Idea generation
This skill is an audit playbook, not an idea generator. For a dedicated
idea-generation pass with ranked idea cards, use the `protocol-innovation-lab`
skill instead of duplicating its idea-card format here. If an audit surfaces a
failure mode worth a follow-up experiment, name the failure mode in section 5
of the report and point at `protocol-innovation-lab` for the actual idea cards.
Any recommendation this skill makes -- inline or via `protocol-innovation-lab`
-- must stay inside the safety and legitimacy boundary: owner-controlled
infrastructure only, never abuse of third-party TURN/CDN/RTC/media services,
unauthorized credentials, or covert infrastructure on systems the operator
does not control.
## Report format
Fill in the structure in `references/report-template.md` (one canonical copy;
do not duplicate the section list inline here).
## Implementation rules
When the user explicitly asks for implementation:
1. Make the smallest patch that proves the idea.
2. Add or update tests first when feasible.
3. Do not introduce a backend service, telemetry endpoint, or third-party dependency without explicit approval.
4. Do not weaken CI, lint, baselines, locale checks, or architecture gates.
5. Keep native and Kotlin contracts synchronized: protobuf/schema, JSON codecs, JNI methods, fixtures, and golden outputs.
6. Run the most relevant available verification commands and report exact results.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |