{"id":45512265,"url":"https://github.com/ishenli/investment-agent","last_synced_at":"2026-05-30T09:00:28.906Z","repository":{"id":331322590,"uuid":"1126167512","full_name":"ishenli/investment-agent","owner":"ishenli","description":"一个 简单的 AI 投资助理，管理股票（美股、港股）和基金（国内基金），同时具备自迭代学习的能力","archived":false,"fork":false,"pushed_at":"2026-05-29T16:14:54.000Z","size":6639,"stargazers_count":5,"open_issues_count":14,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-29T18:08:48.744Z","etag":null,"topics":["agent","ai","ant-design","claude-agent-sdk","election","gui","hermes-agent","investment","langchain","nextjs","skills"],"latest_commit_sha":null,"homepage":"https://ishenli.github.io/investment-agent/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ishenli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-01-01T09:33:12.000Z","updated_at":"2026-05-29T16:14:59.000Z","dependencies_parsed_at":"2026-03-01T17:02:01.578Z","dependency_job_id":null,"html_url":"https://github.com/ishenli/investment-agent","commit_stats":null,"previous_names":["ishenli/investment-agent"],"tags_count":40,"template":false,"template_full_name":null,"purl":"pkg:github/ishenli/investment-agent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishenli%2Finvestment-agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishenli%2Finvestment-agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishenli%2Finvestment-agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishenli%2Finvestment-agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ishenli","download_url":"https://codeload.github.com/ishenli/investment-agent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishenli%2Finvestment-agent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33686018,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-30T02:00:06.278Z","response_time":92,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","ai","ant-design","claude-agent-sdk","election","gui","hermes-agent","investment","langchain","nextjs","skills"],"created_at":"2026-02-22T19:36:46.789Z","updated_at":"2026-05-30T09:00:28.887Z","avatar_url":"https://github.com/ishenli.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Investment Agent\n\nAI-powered local investment analysis tool with multi-engine agent architecture for comprehensive stock market analysis, portfolio management, and intelligent investment recommendations.\n\nEnglish Version | [中文版本](./doc/zh/README.md)\n\n[![GitHub release (latest by date)](https://img.shields.io/github/v/release/ishenli/investment-agent)](https://github.com/ishenli/investment-agent/releases/latest)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![CI](https://github.com/ishenli/investment-agent/actions/workflows/ci.yml/badge.svg)](https://github.com/ishenli/investment-agent/actions/workflows/ci.yml)\n[![Documentation](https://img.shields.io/badge/docs-website-blue.svg)](https://ishenli.github.io/investment-agent/)\n\n## Product Prototype\n\n| Chat Interface (Light) | Chat Interface (Dark) |\n|:------------------------:|:---------------------:|\n| \u003cimg src=\"./website/public/asset/intro-light.png\" width=\"400\" alt=\"Chat Interface (Light)\"\u003e | \u003cimg src=\"./website/public/asset/intro-dark.png\" width=\"400\" alt=\"Dark Theme\"\u003e |\n\n| Agent Observability | Account Overview |\n|:-------------------:|:----------------:|\n| \u003cimg src=\"./website/public/asset/observability.png\" width=\"400\" alt=\"Observability Panel\"\u003e | \u003cimg src=\"./website/public/asset/account.png\" width=\"400\" alt=\"Account Overview\"\u003e |\n\n## Wechat Channel\n\n| Agent Observability | Account Overview |\n|:-------------------:|:----------------:|\n| \u003cimg src=\"./website/public/asset/wechat.jpg\" width=\"400\" alt=\"WeChat\"\u003e | \u003cimg src=\"./website/public/asset/wechat-tool.jpg\" width=\"400\" alt=\"WeChat\"\u003e |\n\n\n## Features\n\n### Multi-Engine AI Architecture\n- **DeepAgents Engine** - LangChain/LangGraph-based agent orchestration\n- **Claude Engine** - Anthropic Claude Agent SDK integration  \n- **Hermes Engine** - Lightweight agent framework with full observability (trace, metrics, cost tracking)\n- Unified engine interface for seamless switching\n\n### Multi-Channel Communication\n- **WeChat Integration** - Personal WeChat account via iLink long-poll\n- **Feishu Support** - Feishu bot integration (coming soon)\n- **Web Interface** - Chat-based AI interaction\n- Unified message router for multi-platform support\n\n### AI-Powered Analysis Tools\n- **Asset Information Query** - Real-time stock, fund, and gold prices via Finnhub\n- **Investment Note Search** - Semantic search through investment notes\n- **Database Query** - Natural language to SQL queries on portfolio data\n- **Web Search** - Tavily-powered market research\n- **Stock Analysis** - Technical indicators and market sentiment\n\n### Permission Mode Control\n- **Conversation-level permission switcher** - Toggle Hermes engine permission levels right next to the chat input box\n- **Four permission tiers**:\n  - **Safe** — Read/write operations only; system and finance tools are blocked entirely\n  - **Standard** — System and finance operations require user confirmation\n  - **Power** — Finance operations execute automatically; system operations still require confirmation\n  - **Unrestricted** — All operations execute automatically (ContentGuard still applies)\n- **Real-time effect** — Permission settings take effect immediately per conversation; each session can have its own level\n- **Content safety layer** — ContentGuard runs independently beneath the permission layer, catching dangerous commands and sensitive file access\n\n### Agent Observability\n- **Trace \u0026 Span System** - Hierarchical tracing for every agent execution with explicit context passing\n- **Real-time Metrics** - Token usage, latency, tool call counts, and iteration stats\n- **Cost Tracking** - Per-session cost breakdown based on model pricing tables\n- **Live Observability Panel** - In-chat sidebar showing trace timeline, span details, and aggregated metrics\n- **Persistent Storage** - Trace/span data saved to SQLite for historical analysis\n\n### Investment Management\n- **Portfolio Tracking** - Real-time position and P\u0026L monitoring\n- **Asset Management** - Multi-account support with performance analytics\n- **Market Research** - Aggregated news and market information\n- **Investment Notes** - Knowledge base with tag-based organization\n\n### Modern Interface\n- Clean dashboard with light/dark themes\n- Real-time data visualization\n- i18n support (English/Chinese)\n- Desktop app (Electron) support\n\n## Documentation\n\n📚 **Full documentation**: https://ishenli.github.io/investment-agent/\n\n## Quick Start\n\n### Prerequisites\n- Node.js 18+ \n- pnpm (recommended) or npm\n\n### Installation\n\n1. Clone and install:\n```bash\ngit clone https://github.com/ishenli/investment-agent.git\ncd investment-agent\npnpm install\n```\n\n2. Run development server:\n```bash\npnpm dev\n# Visit http://localhost:3000\n```\n\n### Global CLI (Optional)\n```bash\nnpm install -g investment-agent\ninvestment-agent [command]  # or: ig [command]\n```\n\n## Architecture\n\n### Multi-Engine Agent System\n```\n┌─────────────────────────────────────────────┐\n│           Unified Engine Interface           │\n├──────────────┬──────────────┬───────────────┤\n│  DeepAgents  │    Claude    │    Hermes     │\n│   (LangGraph)│  (Agent SDK) │   (Lightweight)│\n├──────────────┴──────────────┴───────────────┤\n│          AI Tools Layer                      │\n│  • Asset Query  • Note Search                │\n│  • DB Query     • Web Search                 │\n│  • Stock Analysis                            │\n├──────────────────────────────────────────────┤\n│     Observability Layer (Hermes)           │\n│  • Trace/Span   • Metrics   • Cost Tracking  │\n│  • Live Panel   • Persistent Storage          │\n├──────────────────────────────────────────────┤\n│     Multi-Channel Communication Layer        │\n│  • WeChat    • Feishu    • Web Interface     │\n├──────────────────────────────────────────────┤\n│     Business Logic \u0026 Data Persistence        │\n└──────────────────────────────────────────────┘\n```\n\n### Key Components\n- **Engine Registry** - Dynamically register and switch AI engines\n- **Tool System** - Standardized tool interface with LangChain/Claude SDK adapters\n- **Observability System** - Hierarchical tracing, metrics collection, and cost tracking for agent runs\n- **Channel Router** - Unified message routing across platforms\n- **Session Management** - Multi-turn conversation with context persistence\n- **Data Layer** - SQLite + Drizzle ORM for type-safe queries\n\n## WeChat Integration\n\nThe WeChat channel enables AI assistant access through personal WeChat accounts:\n\n### Setup\n1. Configure iLink API credentials in settings\n2. Scan QR code to login WeChat account\n3. Start receiving and responding to messages\n\n### Architecture\n- **Long-poll Mode** - No webhook required, uses background polling\n- **Context Tracking** - Maintains conversation context per peer\n- **Message Deduplication** - TTL-based dedup for reliability\n- **Auto Reconnect** - Built-in retry logic with exponential backoff\n\n### Features\n- Text message support\n- Session continuity across reconnects\n- Configurable chunked responses\n- Debug logging integration\n\n## Tech Stack (AI-Focused)\n\n### AI \u0026 LLM\n- **LangChain \u0026 LangGraph** - Agent orchestration and workflow\n- **Claude Agent SDK** - Anthropic's agent framework\n- **DeepAgents** - Multi-agent system framework\n- **AI SDK** - Vercel AI toolkit for streaming\n\n### Communication Channels\n- **WeChat (iLink)** - Personal account integration\n- **Feishu** - Enterprise messaging (planned)\n\n### Data \u0026 Storage  \n- **SQLite + Drizzle ORM** - Type-safe database operations\n- **Finnhub API** - Real-time market data\n- **Tavily API** - Web search capabilities\n\n### Backend \u0026 Observability\n- **Hermes Observability** - Trace/span lifecycle, metrics collection, cost tracking\n- **SQLite + Drizzle ORM** - Type-safe database operations\n- **Event Bus** - Fire-and-forget observability sink system\n\n### Frontend\n- **Next.js 16 + React 19** - Modern web framework\n- **Ant Design + Radix UI** - UI components\n- **TailwindCSS** - Styling\n\n## Available Scripts\n\n```bash\n# Development\npnpm dev              # Start dev server\n\n# Build \u0026 Production  \npnpm build            # Build for production\npnpm start            # Start production server\n\n# Database\npnpm db:generate      # Generate migrations\npnpm db:migrate       # Run migrations\npnpm db:studio        # Open Drizzle Studio\n\n# Code Quality\npnpm lint             # ESLint check\npnpm format           # Prettier format\npnpm test             # Run tests\n```\n\n## Project Structure\n\n```\nsrc/\n├── app/              # Next.js pages and routes\n│   └── api/channel/  # WeChat/Feishu webhook routes\n│   └── api/chat/     # Chat \u0026 observability APIs\n├── server/\n│   ├── core/\n│   │   ├── agents/   # AI agent implementations\n│   │   │   ├── langchain/  # DeepAgents engine\n│   │   │   ├── claude/     # Claude engine\n│   │   │   └── hermes/     # Hermes engine\n│   │   ├── engine/   # Engine registry and runner\n│   │   └── business/ # Core business logic\n│   ├── channel/      # Channel handlers\n│   ├── service/      # API services\n│   │   └── observabilityService.ts\n│   └── repository/   # Data access layer\n│       └── chat/     # Chat \u0026 observability repositories\n├── types/            # TypeScript definitions\n└── locales/          # i18n translations\npackages/\n├── agent-channel/    # Multi-platform messaging SDK\n│   └── src/weixin/   # WeChat channel implementation\n└── hermes-agent/\n    └── src/\n        └── observability/  # Trace, metrics, cost tracking\n```\n\n## Core Modules\n\n| Module | Path | Description |\n|--------|------|-------------|\n| Chat | `/chat` | AI-powered conversation interface |\n| Asset | `/asset` | Portfolio and position management |\n| Research | `/research` | Market research and analysis |\n| Notes | `/note` | Investment knowledge base |\n| Reports | `/report` | Analysis reports history |\n| Settings | `/setting` | Account, AI model, and channel config |\n\n## Deployment\n\nThe application runs locally as a desktop app (Electron) or web server. No cloud deployment required - all data stays on your machine.\n\n## Contributing\n\nContributions are welcome! Please:\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit changes following [Conventional Commits](https://www.conventionalcommits.org/)\n4. Push and open a Pull Request\n\n## License\n\nMIT License - see [LICENSE](LICENSE) for details.\n\n## Acknowledgments\n\n| Project | Contribution |\n|---------|-------------|\n| [TradingAgents](https://github.com/TauricResearch/TradingAgents) | Multi-agent architecture inspiration |\n| [LobsterAI](https://github.com/netease-youdao/LobsterAI) | Skill system reference |\n| [LobeUI](https://ui.lobehub.com/) | UI components |\n\n---\n\nMade with ❤️ by [ishenli](https://github.com/ishenli)\n\nQuestions? [Open an issue](https://github.com/ishenli/investment-agent/issues)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fishenli%2Finvestment-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fishenli%2Finvestment-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fishenli%2Finvestment-agent/lists"}