Pipeline: test → dev → main (ONE DIRECTION ONLY!)
- test: Primary development branch (where work happens)
- dev: Integration/staging (merged from test)
- main: Production-ready (merged from dev)
Agent must NOT proactively ask for or execute git write actions. The agent only runs git write actions when the user clearly requests them.
Git write actions include:
git addgit commitgit commit --amendgit reset(any mode)git rebasegit mergegit pushgit taggit checkout/git switchto another branch
Branch-promotion scripts include:
npm run ptestnpm run pdevnpm run pmain
Read-only git commands are always allowed (for example: git status, git diff, git log, git show).
Interpretation rules:
- If a user clearly asks for a git write action, execute it.
- Short approvals like "yes", "ok", "do it", or "go ahead" are valid confirmation when they clearly refer to the immediately previous proposed action.
- If wording is ambiguous, ask one clarifying question before running destructive actions.
git commit --amendis allowed when explicitly requested by the user.- Before a git write action, restate the user authorization in one short line.
See docs/WORKFLOW.md for detailed workflow guide.
When creating commits, prefer high-context commit messages for non-trivial fixes/features.
- Subject: concise conventional prefix (
fix:,feat:,docs:) with clear scope. - Body required for substantial changes: explain why, not only what changed.
- Structure:
- Short problem statement/context
- Per-fix sections with file path(s) and behavioral impact
- Risk/edge-case notes when relevant
- Validation/testing notes (commands or scenario checks)
- Formatting: use readable markdown headers/bullets in commit body for scanability.
- CLI formatting safety:
- Never use
/nor literal\\ntext as a newline placeholder in commit/PR bodies. - Always pass real newlines to Git/GitHub (multi-line body), not escaped newline text.
- Prefer heredocs for reliability when using
git commitandgh pr create.
- Never use
- Atomicity: keep unrelated edits out of the commit; document only included changes.
Recommended CLI patterns (newline-safe):
# Commit message with proper markdown/newlines
git commit -F- <<'EOF'
fix: <short summary>
<context>
## <Fix area>
- Problem:
- Impact:
- Solution:
## Testing Notes
- <test command>
EOF
# PR body with proper markdown/newlines
gh pr create --title "<title>" --body-file - <<'EOF'
## Summary
- <item>
## Testing
- <command>
EOFRecommended template:
fix: <short summary>
<1-2 line context>
## <Fix area 1>
File: <path>
- Problem:
- Impact:
- Solution:
## <Fix area 2>
File: <path>
- Problem:
- Impact:
- Solution:
## Testing Notes
- <test/verification>
dexbot.js- Main CLI entry pointbot.js- Alternative bot starterpm2.js- PM2 process managementunlock-start.js- Single-prompt starter (no PM2)credential-daemon.js- Credential daemon
modules/dexbot_class.js- Core bot class, lifecycle orchestration, and shared runtime wiringmodules/dexbot_fill_runtime.js- Fill processing runtime and replay-safe accounting helpersmodules/dexbot_maintenance_runtime.js- Maintenance runtime for sync loops and grid checksmodules/constants.js- Centralized configuration and tuning parametersmodules/bitshares_client.js- BitShares connection and node management integrationmodules/node_manager.js- Multi-node health checking and failovermodules/general_settings.js- General settings managementmodules/graceful_shutdown.js- Graceful shutdown handlingmodules/chain_keys.js- Key managementmodules/bots_file_lock.js- Bot config file lockingmodules/btsdex_event_patch.js- BitShares DEX event patching
manager.js- Order lifecycle and state managementgrid.js- Grid calculation, placement, and managementworking_grid.js- Copy-on-write working gridstrategy.js- Trading strategy (anchor & refill, consolidation)accounting.js- Fee accounting and fund trackingsync_engine.js- Blockchain synchronizationprocessed_fill_store.js- Processed fill dedupe persistence and batchingstartup_reconcile.js- Startup order reconciliationrunner.js- Order execution runnerasync_lock.js- Concurrency controllogger.js- Order logginglogger_state.js- Logger state trackingformat.js- Order formattingexport.js- Order data exportindex.js- Module exportsutils/- Utilities (math, order, system, validate)
price_adapter.js- AMA delta threshold, grid price offset persistence, and grid recalculation triggercore/price_adapter_service.js- Price adapter service core (offset calculation, bound clamping)ama_signal_runner.js- AMA signal processingblockchain_source.js- Blockchain data sourcekibana_source.js- Kibana data sourcekibana_api.js- Kibana API clientnative_api.js- Native API clientfetch_lp_data.js- Liquidity pool data fetchingmerge_lp_data.js- LP data mergingcandle_utils.js- Candlestick utilitieslp_chart_core.js- LP chart core logicchart_lp_prices.js- LP price charting
modules/chain_orders.js- Blockchain order operationsmodules/account_orders.js- Account order queriesmodules/account_bots.js- Account bot data management
profiles/ecosystem.config.js- PM2 ecosystem configurationprofiles/bots.json- Bot configurationprofiles/general.settings.json- Global settings (auto-generated on first run)profiles/ama_profiles.json- AMA configuration profiles
index.js- Main export combining all modulesmodules/claw_bridge.js- JSON bridge for runtime integrationmodules/zeroclaw_bridge.js- ZeroClaw runtime bridgemodules/bitshares_client.js- BitShares connection wrappermodules/chain_queries.js- Chain read helpersmodules/chain_broadcast.js- Chain write helpersmodules/chain_actions.js- High-level chain operationsmodules/position_manager.js- Position tracking and managementmodules/position_health.js- Position health monitoringmodules/dexbot_profiles.js- DEXBot2 profile readermodules/dexbot_credential_client.js- Credential daemon clientmodules/honest_ecosystem.js- HONEST asset helpersmodules/short_mpa_strategy.js- Short MPA workflowmodules/dynamic_weight_service.js- Dynamic weight policymodules/claw_infra.js- Shared runtime infrastructuredocs/AI_BOT_LIBRARY_API.md- API boundary and responsibility splitdocs/DEXBOT2_TUNING_CHEAT_SHEET.md- Grid tuning reference
tests/- Comprehensive test suite (unit, integration, scenario tests)
# Create feature
git checkout test && git pull
git checkout -b feature/my-feature test
# Merge to test
git checkout test && git pull && git merge --no-ff feature/my-feature && git push
# Integrate to dev
git checkout dev && git pull && git merge --no-ff test && git push
# Release to main
git checkout main && git pull && git merge --no-ff dev && git push