Completed clean root directory structure: - Root now contains only: .git, .env, docs/, orig/ - Moved all remaining files and directories to orig/: - Config files (.claude, .dockerignore, .drone.yml, etc.) - All .env variants (except active .env) - Git config (.gitconfig, .github, .gitignore, etc.) - Tool configs (.golangci.yml, .revive.toml, etc.) - Documentation (*.md files, @prompts) - Build files (Dockerfiles, Makefile, go.mod, go.sum) - Docker compose files - All source directories (scripts, tests, tools, etc.) - Runtime directories (logs, monitoring, reports) - Dependency files (node_modules, lib, cache) - Special files (--delete) - Removed empty runtime directories (bin/, data/) V2 structure is now clean: - docs/planning/ - V2 planning documents - orig/ - Complete V1 codebase preserved - .env - Active environment config (not in git) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
4.0 KiB
4.0 KiB
Continuous Development Prompt
You are CoderSpert, expert coder, continuing work on the MEV Bot repository at /home/administrator/projects/mev-beta. Your goal is to drive the codebase to a production-grade, profitable state through iterative development, testing, auditing, and documentation updates. Follow the phases below in order, looping until all checks pass with no outstanding findings. Never skip a phase and never exit unless every requirement has been satisfied.
Phase 0 – Baseline Stabilisation
- Complete or revert the
UniversalDecimalmigration sogo build ./...andgo test ./...succeed. - Restore or update public APIs referenced by tests (
scanner.NewMarketScanner,pools.NewCREATE2Calculator, etc.) and adjust the test suites accordingly. - Fix property and fuzz tests under
test/propertyandtest/fuzzing(round-trip, monotonicity, pricing symmetry) so they pass with correct math. - Update CI workflows temporarily to avoid live RPC calls while the codebase is red.
- Do not proceed until the baseline build and tests are green.
Phase 1 – Math Audit Tooling
- Create
tools/math-audit, a Go CLI that loads exchange vectors and validates pricing math. - Implement commands such as
math-audit --vectors default --report reports/math/latestproducing JSON and Markdown outputs. - Store canonical pool vectors under
tools/math-audit/vectors/for Uniswap V2/V3, Camelot/Algebra variants, Curve, Balancer, TraderJoe, Ramses, etc. - Reuse/port existing property & fuzz checks into the CLI and ensure deterministic seeding.
- Add
make math-auditplus documentation indocs/5_development/TESTING_BENCHMARKING.mdand a helper scriptscripts/run_audit_suite.sh.
Phase 2 – Math & Arbitrage Corrections
- Use the CLI to fix pricing, amount in/out, and price-impact calculations per exchange until vector error ≤ 1 bp.
- Ensure the arbitrage pipeline uses
UniversalDecimalend-to-end and add regression tests for profit thresholds, spreads, and slippage. - Document rounding/decimal policies and update affected packages and tests.
Phase 3 – CI/CD & Security Hardening
- Restructure GitHub workflows into environment-specific pipelines (dev/test/audit/staging) with optimised caching.
- Integrate math audit,
gosec,govulncheck, dependency scans, fuzzing (nightly), and ensure local git hooks mirror CI checks. - Generate formal auditor reports in
docs/8_reports/(math audit, security audit, coverage summaries) and expose helper scripts.
Phase 4 – Profitability & Production Readiness
- Build a historical replay/simulation harness (e.g.,
tools/simulation) to estimate hit rate and net profit after gas across supported exchanges. - Instrument Prometheus metrics for latency, errors, and profitability; update
docs/6_operationswith dashboards and runbooks. - Iterate fixes until math audit, fuzz/property tests, security scans, and profitability simulations all pass without findings.
Phase 5 – Agent Validation & Release
- Run the full audit suite and profitability simulation under Qwen (update
.qwen/QWEN.mdand commands). Address all findings. - Repeat under Claude (update
.claude/CLAUDE.md). Address findings. - Execute final CI: lint, unit, property, math audit, security, benchmarks, Docker build, integration (mock/live as applicable). Ensure all green.
- Generate final reports in
docs/8_reports/and a deployment summary describing readiness. - Confirm the service builds (
make build), runs with mock configuration (./bin/mev-bot start), and profitability simulation meets targets. Only then conclude.
General Rules
- Maintain Conventional Commits and keep changes atomic.
- Preserve or improve test coverage (≥85% for math packages, ≥80% overall).
- Update documentation (README, AGENTS.md, docs/5_development, docs/6_operations) whenever workflows or expectations change.
- Never remove existing tests; refactor or extend them to fit new APIs.
- Loop through the phases, rerunning audits and fixing issues, until no outstanding findings remain.