Skip to content

feat: SMARTS trading pipeline with Telegram notifications and Miro visualization - #13

Closed
AndriiPasternak31 wants to merge 14 commits into
Abilityai:mainfrom
AndriiPasternak31:feature/smarts-miro-diagram
Closed

AndriiPasternak31 wants to merge 14 commits into
Abilityai:mainfrom
AndriiPasternak31:feature/smarts-miro-diagram

Conversation

@AndriiPasternak31

@AndriiPasternak31 AndriiPasternak31 commented Feb 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR adds comprehensive SMARTS trading pipeline support:

SMARTS Agent Templates

  • Added 8 new agent templates: market-regime, news-sentiment, discovery, analysis, decision, execution, portfolio-manager, feedback
  • Support for config.yaml format (SMARTS-style agents)
  • System-wide template configuration (system.yaml)

Telegram Notifications

  • Added Telegram to NotificationConfig in process engine
  • New smarts_summary_service.py for generating trading summaries
  • Telegram notification handler integration

API & Scheduler

  • New SMARTS summary endpoints
  • Scheduler support for periodic summaries

Miro Visualization

  • Live flow visualization from Supabase to Miro boards
  • Auto-generated pipeline architecture diagrams
  • Proper HTML formatting (<br> tags) for card text
  • data/smarts-flows/ directory for JSON exports

Other

  • Refactored find_template_file usage across codebase
  • SMARTS cascade deployment script
  • Documentation updates

Test plan

  • Agent templates load correctly
  • Telegram notifications send successfully
  • Miro diagrams render with proper formatting
  • JSON exports contain complete pipeline data

🤖 Generated with Claude Code

AndriiPasternak31 and others added 14 commits February 6, 2026 01:03
- Add scripts/smarts_diagram/ package with:
  - parser.py: Extracts architecture from agent templates
  - miro_generator.py: Generates diagram layout
  - miro_client.py: Miro REST API v2 client
- Add scripts/update_smarts_diagram.py entry point
- Update .claude/commands/update-docs.md with diagram step
- Add MIRO_ACCESS_TOKEN and MIRO_BOARD_ID to .env.example

Usage: python3 scripts/update_smarts_diagram.py --dry-run

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add 8 SMARTS pipeline agents + supporting templates:
- market-regime: Market condition detection
- news-sentiment: News and sentiment analysis
- discovery: Trading opportunity scanner
- analysis: Deep technical analysis
- decision: Position sizing and decisions
- execution: Order execution via Alpaca
- portfolio-manager: Risk oversight
- feedback: Performance tracking

Also includes:
- analyst-agent variants (bull, bear, risk, quant)
- scanner-agent, executor-agent, synthesis-agent
- smarts-trading, smarts-trader-minimal bundles
- gcp-log-monitor utility agent
- system.yaml configuration

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add SMARTS summary service for daily trading reports:
- Pulls data from Supabase integration_context
- Formats comprehensive summaries per agent
- Sends to Telegram with deduplication
- Scheduler for automated daily reports

Add Telegram channel to notification handler:
- Support bot_token and chat_id configuration
- Environment variable fallback support
- Markdown formatting for messages

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add new endpoints in ops router:
- POST /api/ops/smarts/summary - Generate and send summary
- GET /api/ops/smarts/test-telegram - Test Telegram connection

Integrate summary scheduler in main.py:
- Start scheduler on app startup
- Stop scheduler on app shutdown

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add find_template_file() to check template.yaml then config.yaml
- Support both template formats for backwards compatibility
- Add default resources configuration
- Improve credential extraction for SMARTS agents

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Update all template loading code to use find_template_file()
for consistent config.yaml support:
- routers/credentials.py
- routers/templates.py
- services/agent_service/crud.py
- services/system_agent_service.py

Also use DEFAULT_RESOURCES constant for consistency.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add Telegram channel support to notification step configuration:
- bot_token: Telegram bot token (supports env var)
- chat_id: Telegram chat ID (supports env var)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add changelog entries for SMARTS features
- Update architecture documentation
- Update roadmap progress

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Script to deploy all SMARTS agents in cascade order.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add flow_visualizer.py to retrieve complete analysis flows from Supabase
- Create update_smarts_flow.py CLI entry point
- Extract and visualize full decision chain: market_regime → discovery → analysis → decision → execution
- Support symbol-specific and auto-select modes
- Add SUPABASE_URL/SUPABASE_ANON_KEY to .env.example

Usage:
  python scripts/update_smarts_flow.py --symbol AAPL
  python scripts/update_smarts_flow.py --dry-run

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add MiroClient.create_board() for creating new boards via API
- Flow visualizer now prefers MIRO_FLOW_BOARD_ID over MIRO_BOARD_ID
- Update .env.example with separate board IDs for architecture vs flows

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Remove all text truncation from flow cards (show full data)
- Reorganize flow layout:
  - Market Regime at top-left
  - News Sentiment cards stacked vertically (up to 3)
  - Main pipeline in horizontal row: Discovery → Analysis → Decision → Execution
  - PM Directive below pipeline with connectors
- Add visual separator line between architecture and flow sections
- Increase card sizes for better readability

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Replace \n with <br> tags for Miro sticky note compatibility
- Add <br> spacers between sections for visual grouping
- All format_*_content() functions now use HTML line breaks
- Cards display with proper section separation

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add changelog entry for flow visualization feature
- Create data/smarts-flows/ directory for JSON exports
- Add README with usage instructions
- Gitignore JSON files (contain live trading data)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@AndriiPasternak31 AndriiPasternak31 changed the title feat: SMARTS Miro flow visualization with improved formatting feat: SMARTS trading pipeline with Telegram notifications and Miro visualization Feb 6, 2026
vybe added a commit that referenced this pull request Apr 18, 2026
…idate-architecture

Backend: unregister 7 Process Engine routers (processes, executions, approvals,
triggers, alerts, process_templates, audit) plus the process-docs router; drop
startup hooks for execution recovery and the process-engine WebSocket publisher.
Services under services/process_engine/ remain in place as dormant code.

Frontend: remove 11 process-related routes (/processes, /processes/new,
/processes/docs, /processes/wizard, /processes/:id, /executions, /approvals,
/executions/:id, /process-dashboard) and the dead isProcessSection computed in
NavBar. Keep /alerts and /events legacy redirects to Operating Room.

Docs: correct stale count claims in architecture.md (main.py line count,
router count 45 -> 53, service count 23 -> 37, MCP tool modules 15 -> 16)
and expand database.py scope description to reflect 27 domain op classes.

Skill: expand validate-architecture to detect drift between arch.md and code:
count alignment (D1), scope coherence (D2), enforced MCP parity under #13
(tool module OR '# mcp: none' opt-out), and inline authorization sprawl
detection under #8. Output now includes suggested arch.md edits with line
numbers, not just pass/fail.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
vybe pushed a commit that referenced this pull request Sep 22, 2026
…n vocabulary, snapshot skip proven on a live engine, hosted compose + lint + three nits (abilityai/trinity-enterprise#479)

Per the /review findings recorded on #2951:

- metric_read_service._threshold_color judged direction as 'up' / 'down',
  which the registry never emits (DIRECTIONS = up_good / down_good /
  neutral). Every declared metric therefore fell into the 'up' arm, so an
  up_good revenue widget turned red for EXCEEDING its critical threshold and
  a neutral metric was judged at all — while the tile beside it, via
  utils/metricFormat.js::thresholdClasses, did the opposite. The backend now
  spells the tile's rule: down_good breaches at-or-above, up_good at-or-below,
  neutral declines. The pinning test used direction='up' and was green for
  the wrong reason; three tests now drive both arms and neutral.
- The snapshot-writer skip for a bound widget was pinned by
  inspect.getsource; it is now executed through the real engine
  (capture_dashboard_snapshot writes the plain widget and not the bound one).
- docker-compose.hosted.yml mirrors prod's METRICS_READ_RATE_LIMIT line
  (test_2280_hosted_compose_parity).
- test_ent479_freshness_rule: bare sys.modules.pop → monkeypatch.delitem.
- Nits: unused Optional import in agent_server/routers/info.py, the
  refreshMetricDefinitions JSDoc in client.ts sat above getAgentMetrics,
  routers/monitoring.py gains its '# mcp:' header (Invariant #13).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
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