Skip to content

Comments

feat: harden Conway input sanitization, replication startup, and safety keys#166

Open
stackiesmash wants to merge 7 commits intoConway-Research:mainfrom
stackiesmash:feat/conway-hardening-input-adapter-replication-20260221
Open

feat: harden Conway input sanitization, replication startup, and safety keys#166
stackiesmash wants to merge 7 commits intoConway-Research:mainfrom
stackiesmash:feat/conway-hardening-input-adapter-replication-20260221

Conversation

@stackiesmash
Copy link

Summary

  • wire prompt-injection sanitization into live inbox input path
  • improve replication spawn/start flow reporting and robustness
  • add canonical KV safety keys module and migrate usages
  • harden skill install/remove command handling and validation
  • include architecture/audit/hardening docs

Verification

  • npm test
  • npm run build

Notes

  • Branch pushed from fork: stackiesmash/automaton

… multi-TF, TWAP

5 battle-tested patterns from Hummingbot research (2026-02-19):

1. Kill Switch / Max Drawdown Guard (loop.ts)
   - Halts trading 12h if session P&L hits -5% (-$50 virtual)
   - Code-level guard enforced before every LLM inference call

2. ATR-based Position Sizing (tools.ts — calculate_atr tool)
   - New tool: calculate_atr(symbol) → ATR14 from 1h candles
   - Formula: size = $100 × ($50 / ATR14), clamped $10-$500

3. Multi-Timeframe Confluence (tools.ts — fetch_market_context tool)
   - New tool: fetch_market_context(symbol) → 1h/4h/daily trend
   - Required call before any trade entry

4. Paper trade tracking (tools.ts — open/close/check_paper_position tools)
   - open_paper_position: records entry with all 3 barriers
   - close_paper_position: records exit, updates session P&L
   - check_paper_positions: checks all barriers, returns any expired

5. SOUL.md strategy upgrades
   - Full Triple Barrier rules documented
   - ATR sizing formula with examples
   - Kill switch rules
   - TWAP entry splitting guidance
   - Multi-TF confluence requirement

New files: src/trading/{atr.ts,drawdown.ts,market.ts}
The early sleep check in loop.ts was breaking out of the while loop
without calling db.setAgentState('sleeping'), causing index.ts outer
loop to immediately re-run the agent instead of sleeping properly.

Manifested as a rapid-fire restart loop after Pi's Hummingbot upgrades
introduced the outer while(running) loop in index.ts.
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