Skip to content

Update: bot improvements and documentation#100

Open
yudison23 wants to merge 6 commits into
yunus-0x:mainfrom
yudison23:main
Open

Update: bot improvements and documentation#100
yudison23 wants to merge 6 commits into
yunus-0x:mainfrom
yudison23:main

Conversation

@yudison23

Copy link
Copy Markdown

This PR includes 5 commits with critical fixes and improvements:

  1. Real-time PnL polling (3s interval, faster exits)
  2. Three critical fixes:
    • Swap retries (3x backoff on Jupiter failures)
    • Smarter solo deploys (narrative/degen score override)
    • Fixed stuck positions (PnL sanity check fix)
  3. Documentation updates in CLAUDE.md
  4. Alert formatting improvements
  5. Telegram UI redesign

root and others added 6 commits June 25, 2026 14:15
…egram UI overhaul

- agent.js: point default OpenAI-compatible client at Featherless
  (meta-llama/Llama-3.3-70B-Instruct) instead of OpenRouter; simplify
  per-step retry to status-code based (429/500/502/503/529) and drop the
  provider-specific system-role/tool_choice/thinking-mode fallbacks
- tools/wallet.js: read SOL + SPL/Token-2022 balances directly via RPC_URL
  (getBalance/getParsedTokenAccountsByOwner) instead of the Helius wallet
  API; price via Jupiter assets-search
- tools/dlmm.js: chunk getMultipleAccountsInfoAndContext calls for RPC plans
  with a low per-call account cap (RPC_MAX_MULTI_ACCOUNTS)
- tools/executor.js: add dryRun as a live-toggleable config key, synced to
  process.env.DRY_RUN
- index.js, telegram.js: HTML-formatted Telegram messages (escapeHtml,
  candidate/position cards, boxed tool-status table, /start quick-menu)
- setup.js, README.md, CLAUDE.md: drop HELIUS_API_KEY requirement, document
  provider-agnostic RPC balance lookups
- package.json: add @solana/spl-token (Token-2022 support) and
  @anthropic-ai/sdk (unused so far)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Redesigned all Telegram bot features for better visual hierarchy and readability:

**Key changes:**
- Added emoji section headers (💰 Wallet, 📈 Positions, 📊 Status, etc.) for quick scanning
- Converted multi-line stacked format to compact inline format using pipes (|) and arrows (↓↑→)
- Simplified notifications: /deploy, /close, /swap, /OOR now single/dual line with emoji prefix
- Updated /status, /positions, /pool, /config, /help with new visual structure
- Morning briefing: compact 3-line format replacing previous 5-section layout
- Removed decorative emoji (☀️📥📤💎📂), kept only functional section markers
- All command helpers and menu buttons use consistent formatting

**Result:**
Cleaner, more professional look. Information scans faster. Still maintains all data.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Major improvements:

1. Enhanced state.json recovery (agent.js + state.js)
   - Add atomic writes (temp file → backup → rename)
   - Auto-recover from corrupted state via .backup file
   - Better error logging for diagnostics

2. Beautified Telegram alert formatting (index.js)
   - Add formatManagementAlert() & formatScreeningAlert() helpers
   - Use emojis for quick visual scanning (🟢🔴💰🔴⏸️✅)
   - Clean, simple, informative layout
   - Separate display alerts from internal logging

3. Fixed double alert issue (index.js)
   - Remove early sends in pre-check conditions
   - Use throw/catch pattern instead of early return
   - Consolidate all alerts to single finally block
   - Prevent race conditions with proper _busy flag ordering

4. Improved error context (agent.js)
   - Wrap agentLoop initialization in try-catch
   - Capture and log specific failures during setup
   - Add sessionHistory validation

Result: Cleaner Telegram UX, single alert per cycle, better error recovery

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Root cause: createLiveMessage() was sending two messages:
  1. Initial message during creation ("Scanning candidates...")
  2. Final message during finalize (formatted alert)

Solution: Comment out initial flushNow() and only send the complete
formatted alert on finalize(). This ensures single, clean alert per cycle.

Result: Telegram alerts now display only once per screening/management cycle,
with proper emoji formatting and information density.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Update CLAUDE.md to document the fast PnL polling system:
- Added `pnl` section to config system table
  - pollIntervalSec: 3 (default) - configurable poll interval
  - confirmTicks: 1 or 2 - confirmation window (3-6 seconds)
- Updated PnL poller description to clarify real-time exit detection
- Exits (trailing-TP, stop-loss, OOR, low-yield) trigger directly
  when rule is met, no waiting for next management cycle

Note: user-config.json not committed (gitignored) but should contain:
  "pnl": {
    "pollIntervalSec": 3,
    "confirmTicks": 1
  }

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
1. Swap retries (auto-swap on close/claim)
   - Jupiter failures now retry 3x with exponential backoff
   - Prevents stranded tokens when swap temporarily fails
   - Documented in position lifecycle section

2. Smarter solo deploys
   - Lone candidates now pass with strong narrative OR high Degen Score (≥50)
   - Smart wallets demoted from hard gate to confidence boost
   - PVP conflicts still block unless degen score is strong
   - More nuanced conviction evaluation for standalone pools

3. Fixed: stuck positions
   - PnL sanity check was wrongly blocking exit rules on volatile pools
   - Positions could sit past stop-loss/trailing-TP triggers
   - Now correctly limited to warning only; exits always execute
   - Documented in known issues section with fix details

All changes are documentation-only, reflecting behavior already in code.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant