feat: Add agent workspace system and runtime management

- Add agent core modules (agent_core, factory, registry, skill_loader)
- Add runtime system for agent execution management
- Add REST API for agents, workspaces, and runtime control
- Add process supervisor for agent lifecycle management
- Add workspace template system with agent profiles
- Add frontend RuntimeView and runtime API integration
- Add per-agent skill workspaces for smoke_fullstack run
- Refactor skill system with active/installed separation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-17 16:43:29 +08:00
parent 2daf5717ba
commit 59b44545d0
121 changed files with 8384 additions and 358 deletions

View File

@@ -1,12 +1,20 @@
---
tickers:
- AAPL
- MSFT
- AAPL
- MSFT
- GOOGL
- AMZN
- NVDA
- META
- TSLA
initial_cash: 100000
margin_requirement: 0.0
enable_memory: false
max_comm_cycles: 2
agent_overrides: {}
schedule_mode: intraday
interval_minutes: 60
trigger_time: 09:30
---
# Bootstrap

View File

@@ -0,0 +1,4 @@
# Agent Guide
Document how this agent should work, collaborate, and choose tools or skills.

View File

@@ -0,0 +1,4 @@
# Heartbeat
Optional checklist for periodic review or self-reflection.

View File

@@ -0,0 +1,4 @@
# Memory
Store durable lessons, heuristics, and reminders for this agent.

View File

@@ -0,0 +1,4 @@
# Profile
Track this agent's long-lived investment style, preferences, and strengths.

View File

@@ -0,0 +1,4 @@
# Soul
Describe the agent's temperament, reasoning posture, and voice.

View File

@@ -0,0 +1,13 @@
agent_id: fundamentals_analyst
prompt_files:
- SOUL.md
- PROFILE.md
- AGENTS.md
- POLICY.md
- MEMORY.md
enabled_skills:
- fundamental_review
- portfolio_decisioning
disabled_skills: []
active_tool_groups: []
disabled_tool_groups: []

View File

@@ -0,0 +1,22 @@
---
name: 基本面分析
description: 当用户要求“基本面分析”“看财务质量”“分析盈利能力”“判断公司质量”或“评估长期盈利韧性”时,应使用此技能。
version: 1.0.0
---
# 基本面分析
当用户希望从公司质量、资产负债表强度、盈利能力或长期盈利韧性出发判断标的时,使用这个技能。
## 工作流程
1. 在形成结论前,先检查盈利能力、成长性、财务健康度和经营效率。
2. 区分可持续的业务质量和短期噪音。
3. 明确指出会推翻当前判断的条件。
4. 最终给出清晰的信号、置信度和主要驱动因素。
## 约束
- 不要孤立依赖单一指标。
- 缺失数据要明确指出。
- 当财务质量优劣混杂时,优先给出保守结论。

View File

@@ -0,0 +1,21 @@
---
name: 组合决策
description: 整合分析师观点与风险反馈,形成明确的组合层决策。
---
# 组合决策
当你负责把团队分析转化为最终交易决策时,使用这个技能。
## 工作流程
1. 行动前先阅读分析师结论和风险警示。
2. 评估当前组合、现金和保证金约束。
3. 使用决策工具为每个 ticker 记录一个明确决策。
4. 在全部决策记录完成后,总结组合层面的整体理由。
## 约束
- 仓位大小必须遵守资金和保证金限制。
- 当分析师信心与风险信号不一致时,优先采用更小仓位。
- 当任务要求完整决策清单时,不要让任何 ticker 处于未决状态。

View File

@@ -0,0 +1,22 @@
---
name: 基本面分析
description: 当用户要求“基本面分析”“看财务质量”“分析盈利能力”“判断公司质量”或“评估长期盈利韧性”时,应使用此技能。
version: 1.0.0
---
# 基本面分析
当用户希望从公司质量、资产负债表强度、盈利能力或长期盈利韧性出发判断标的时,使用这个技能。
## 工作流程
1. 在形成结论前,先检查盈利能力、成长性、财务健康度和经营效率。
2. 区分可持续的业务质量和短期噪音。
3. 明确指出会推翻当前判断的条件。
4. 最终给出清晰的信号、置信度和主要驱动因素。
## 约束
- 不要孤立依赖单一指标。
- 缺失数据要明确指出。
- 当财务质量优劣混杂时,优先给出保守结论。

View File

@@ -0,0 +1,21 @@
---
name: 组合决策
description: 整合分析师观点与风险反馈,形成明确的组合层决策。
---
# 组合决策
当你负责把团队分析转化为最终交易决策时,使用这个技能。
## 工作流程
1. 行动前先阅读分析师结论和风险警示。
2. 评估当前组合、现金和保证金约束。
3. 使用决策工具为每个 ticker 记录一个明确决策。
4. 在全部决策记录完成后,总结组合层面的整体理由。
## 约束
- 仓位大小必须遵守资金和保证金限制。
- 当分析师信心与风险信号不一致时,优先采用更小仓位。
- 当任务要求完整决策清单时,不要让任何 ticker 处于未决状态。

View File

@@ -0,0 +1,4 @@
# Agent Guide
Document how this agent should work, collaborate, and choose tools or skills.

View File

@@ -0,0 +1,4 @@
# Heartbeat
Optional checklist for periodic review or self-reflection.

View File

@@ -0,0 +1,4 @@
# Memory
Store durable lessons, heuristics, and reminders for this agent.

View File

@@ -0,0 +1,4 @@
# Profile
Track this agent's long-lived investment style, preferences, and strengths.

View File

@@ -0,0 +1,4 @@
# Soul
Describe the agent's temperament, reasoning posture, and voice.

View File

@@ -0,0 +1,12 @@
agent_id: portfolio_manager
prompt_files:
- SOUL.md
- PROFILE.md
- AGENTS.md
- POLICY.md
- MEMORY.md
enabled_skills:
- portfolio_decisioning
disabled_skills: []
active_tool_groups: []
disabled_tool_groups: []

View File

@@ -0,0 +1,21 @@
---
name: 组合决策
description: 整合分析师观点与风险反馈,形成明确的组合层决策。
---
# 组合决策
当你负责把团队分析转化为最终交易决策时,使用这个技能。
## 工作流程
1. 行动前先阅读分析师结论和风险警示。
2. 评估当前组合、现金和保证金约束。
3. 使用决策工具为每个 ticker 记录一个明确决策。
4. 在全部决策记录完成后,总结组合层面的整体理由。
## 约束
- 仓位大小必须遵守资金和保证金限制。
- 当分析师信心与风险信号不一致时,优先采用更小仓位。
- 当任务要求完整决策清单时,不要让任何 ticker 处于未决状态。

View File

@@ -0,0 +1,21 @@
---
name: 组合决策
description: 整合分析师观点与风险反馈,形成明确的组合层决策。
---
# 组合决策
当你负责把团队分析转化为最终交易决策时,使用这个技能。
## 工作流程
1. 行动前先阅读分析师结论和风险警示。
2. 评估当前组合、现金和保证金约束。
3. 使用决策工具为每个 ticker 记录一个明确决策。
4. 在全部决策记录完成后,总结组合层面的整体理由。
## 约束
- 仓位大小必须遵守资金和保证金限制。
- 当分析师信心与风险信号不一致时,优先采用更小仓位。
- 当任务要求完整决策清单时,不要让任何 ticker 处于未决状态。

View File

@@ -0,0 +1,4 @@
# Agent Guide
Document how this agent should work, collaborate, and choose tools or skills.

View File

@@ -0,0 +1,4 @@
# Heartbeat
Optional checklist for periodic review or self-reflection.

View File

@@ -0,0 +1,4 @@
# Memory
Store durable lessons, heuristics, and reminders for this agent.

View File

@@ -0,0 +1,4 @@
# Profile
Track this agent's long-lived investment style, preferences, and strengths.

View File

@@ -0,0 +1,4 @@
# Soul
Describe the agent's temperament, reasoning posture, and voice.

View File

@@ -0,0 +1,12 @@
agent_id: risk_manager
prompt_files:
- SOUL.md
- PROFILE.md
- AGENTS.md
- POLICY.md
- MEMORY.md
enabled_skills:
- risk_review
disabled_skills: []
active_tool_groups: []
disabled_tool_groups: []

View File

@@ -0,0 +1,21 @@
---
name: 风险审查
description: 在最终仓位和执行前,评估组合与市场风险。
---
# 风险审查
当你需要识别集中度、波动率、杠杆和情景风险时,使用这个技能。
## 工作流程
1. 按 ticker 和主题检查拟议敞口。
2. 识别集中度、波动率、流动性和杠杆方面的风险点。
3. 按严重程度排序风险警示。
4. 将风险结论转化为给投资经理的具体限制或注意事项。
## 约束
- 聚焦可执行的风险控制措施。
- 当数据支持时尽量量化限制。
- 明确区分致命阻断项和可管理风险。

View File

@@ -0,0 +1,21 @@
---
name: 风险审查
description: 在最终仓位和执行前,评估组合与市场风险。
---
# 风险审查
当你需要识别集中度、波动率、杠杆和情景风险时,使用这个技能。
## 工作流程
1. 按 ticker 和主题检查拟议敞口。
2. 识别集中度、波动率、流动性和杠杆方面的风险点。
3. 按严重程度排序风险警示。
4. 将风险结论转化为给投资经理的具体限制或注意事项。
## 约束
- 聚焦可执行的风险控制措施。
- 当数据支持时尽量量化限制。
- 明确区分致命阻断项和可管理风险。

View File

@@ -0,0 +1,4 @@
# Agent Guide
Document how this agent should work, collaborate, and choose tools or skills.

View File

@@ -0,0 +1,4 @@
# Heartbeat
Optional checklist for periodic review or self-reflection.

View File

@@ -0,0 +1,4 @@
# Memory
Store durable lessons, heuristics, and reminders for this agent.

View File

@@ -0,0 +1,4 @@
# Profile
Track this agent's long-lived investment style, preferences, and strengths.

View File

@@ -0,0 +1,4 @@
# Soul
Describe the agent's temperament, reasoning posture, and voice.

View File

@@ -0,0 +1,12 @@
agent_id: sentiment_analyst
prompt_files:
- SOUL.md
- PROFILE.md
- AGENTS.md
- POLICY.md
- MEMORY.md
enabled_skills:
- sentiment_review
disabled_skills: []
active_tool_groups: []
disabled_tool_groups: []

View File

@@ -0,0 +1,21 @@
---
name: 情绪分析
description: 分析新闻流、市场心理和内幕行为,识别事件驱动型信号。
---
# 情绪分析
当任务依赖近期催化剂、新闻语气或行为层面的市场信号时,使用这个技能。
## 工作流程
1. 回顾近期新闻并识别主导叙事。
2. 检查内幕活动,寻找确认或冲突信号。
3. 区分可持续的情绪变化和短暂噪音。
4. 说明情绪如何改变短期交易展望。
## 约束
- 不要把注意力误判为真实信念。
- 当情绪很强但缺乏基本面支持时,要明确指出。
- 对催化剂时间窗口风险要说清楚。

View File

@@ -0,0 +1,21 @@
---
name: 情绪分析
description: 分析新闻流、市场心理和内幕行为,识别事件驱动型信号。
---
# 情绪分析
当任务依赖近期催化剂、新闻语气或行为层面的市场信号时,使用这个技能。
## 工作流程
1. 回顾近期新闻并识别主导叙事。
2. 检查内幕活动,寻找确认或冲突信号。
3. 区分可持续的情绪变化和短暂噪音。
4. 说明情绪如何改变短期交易展望。
## 约束
- 不要把注意力误判为真实信念。
- 当情绪很强但缺乏基本面支持时,要明确指出。
- 对催化剂时间窗口风险要说清楚。

View File

@@ -0,0 +1,4 @@
# Agent Guide
Document how this agent should work, collaborate, and choose tools or skills.

View File

@@ -0,0 +1,4 @@
# Heartbeat
Optional checklist for periodic review or self-reflection.

View File

@@ -0,0 +1,4 @@
# Memory
Store durable lessons, heuristics, and reminders for this agent.

View File

@@ -0,0 +1,4 @@
# Profile
Track this agent's long-lived investment style, preferences, and strengths.

View File

@@ -0,0 +1,4 @@
# Soul
Describe the agent's temperament, reasoning posture, and voice.

View File

@@ -0,0 +1,12 @@
agent_id: technical_analyst
prompt_files:
- SOUL.md
- PROFILE.md
- AGENTS.md
- POLICY.md
- MEMORY.md
enabled_skills:
- technical_review
disabled_skills: []
active_tool_groups: []
disabled_tool_groups: []

View File

@@ -0,0 +1,21 @@
---
name: 技术分析
description: 评估价格行为、动量和波动率,用于判断时机和市场状态。
---
# 技术分析
当任务对入场时机、趋势质量或短期市场结构敏感时,使用这个技能。
## 工作流程
1. 评估趋势方向和强度。
2. 检查动量与均值回归条件。
3. 在给出激进建议前先审视波动率。
4. 将当前形态转化为带有明确风险意识的交易观点。
## 约束
- 区分趋势延续和过度透支。
- 当信号冲突时避免给出高确定性判断。
- 将波动率视为仓位输入,而不仅仅是方向输入。

View File

@@ -0,0 +1,21 @@
---
name: 技术分析
description: 评估价格行为、动量和波动率,用于判断时机和市场状态。
---
# 技术分析
当任务对入场时机、趋势质量或短期市场结构敏感时,使用这个技能。
## 工作流程
1. 评估趋势方向和强度。
2. 检查动量与均值回归条件。
3. 在给出激进建议前先审视波动率。
4. 将当前形态转化为带有明确风险意识的交易观点。
## 约束
- 区分趋势延续和过度透支。
- 当信号冲突时避免给出高确定性判断。
- 将波动率视为仓位输入,而不仅仅是方向输入。

View File

@@ -0,0 +1,4 @@
# Agent Guide
Document how this agent should work, collaborate, and choose tools or skills.

View File

@@ -0,0 +1,4 @@
# Heartbeat
Optional checklist for periodic review or self-reflection.

View File

@@ -0,0 +1,4 @@
# Memory
Store durable lessons, heuristics, and reminders for this agent.

View File

@@ -0,0 +1,4 @@
# Profile
Track this agent's long-lived investment style, preferences, and strengths.

View File

@@ -0,0 +1,4 @@
# Soul
Describe the agent's temperament, reasoning posture, and voice.

View File

@@ -0,0 +1,12 @@
agent_id: valuation_analyst
prompt_files:
- SOUL.md
- PROFILE.md
- AGENTS.md
- POLICY.md
- MEMORY.md
enabled_skills:
- valuation_review
disabled_skills: []
active_tool_groups: []
disabled_tool_groups: []

View File

@@ -0,0 +1,21 @@
---
name: 估值分析
description: 使用多种估值视角评估合理价值和安全边际。
---
# 估值分析
当任务需要判断一只股票是低估、高估还是定价合理时,使用这个技能。
## 工作流程
1. 条件允许时,使用不止一种估值方法。
2. 对比内在价值估计与当前市场价格。
3. 解释估值判断背后的关键假设。
4. 明确安全边际,以及哪些因素会压缩或扩大它。
## 约束
- 将估值视为区间,而不是一个精确点值。
- 明确说明假设敏感性。
- 当输入稀疏或不稳定时,避免给出高置信度判断。

View File

@@ -0,0 +1,21 @@
---
name: 估值分析
description: 使用多种估值视角评估合理价值和安全边际。
---
# 估值分析
当任务需要判断一只股票是低估、高估还是定价合理时,使用这个技能。
## 工作流程
1. 条件允许时,使用不止一种估值方法。
2. 对比内在价值估计与当前市场价格。
3. 解释估值判断背后的关键假设。
4. 明确安全边际,以及哪些因素会压缩或扩大它。
## 约束
- 将估值视为区间,而不是一个精确点值。
- 明确说明假设敏感性。
- 当输入稀疏或不稳定时,避免给出高置信度判断。

View File

@@ -1,21 +1,22 @@
---
name: fundamental_review
description: Review a company from a fundamentals-first perspective before issuing a trading signal.
name: 基本面分析
description: 当用户要求“基本面分析”“看财务质量”“分析盈利能力”“判断公司质量”或“评估长期盈利韧性”时,应使用此技能。
version: 1.0.0
---
# Fundamental Review
# 基本面分析
Use this skill when the task requires judging business quality, balance-sheet strength, profitability, or long-term earnings durability.
当用户希望从公司质量、资产负债表强度、盈利能力或长期盈利韧性出发判断标的时,使用这个技能。
## Workflow
## 工作流程
1. Check profitability, growth, financial health, and efficiency before forming a conclusion.
2. Separate durable business quality from short-term noise.
3. State what would invalidate the thesis.
4. End with a clear signal, confidence, and the main drivers behind that signal.
1. 在形成结论前,先检查盈利能力、成长性、财务健康度和经营效率。
2. 区分可持续的业务质量和短期噪音。
3. 明确指出会推翻当前判断的条件。
4. 最终给出清晰的信号、置信度和主要驱动因素。
## Guardrails
## 约束
- Do not rely on one metric in isolation.
- Call out missing data explicitly.
- Prefer conservative conclusions when financial quality is mixed.
- 不要孤立依赖单一指标。
- 缺失数据要明确指出。
- 当财务质量优劣混杂时,优先给出保守结论。

View File

@@ -1,21 +1,21 @@
---
name: portfolio_decisioning
description: Synthesize analyst inputs and risk feedback into explicit portfolio decisions.
name: 组合决策
description: 整合分析师观点与风险反馈,形成明确的组合层决策。
---
# Portfolio Decisioning
# 组合决策
Use this skill when you are responsible for converting team analysis into final trades.
当你负责把团队分析转化为最终交易决策时,使用这个技能。
## Workflow
## 工作流程
1. Read analyst conclusions and risk warnings before acting.
2. Evaluate the current portfolio, cash, and margin constraints.
3. Record one explicit decision per ticker using the decision tool.
4. Summarize the portfolio-level rationale after all decisions are recorded.
1. 行动前先阅读分析师结论和风险警示。
2. 评估当前组合、现金和保证金约束。
3. 使用决策工具为每个 ticker 记录一个明确决策。
4. 在全部决策记录完成后,总结组合层面的整体理由。
## Guardrails
## 约束
- Position sizing must respect capital and margin limits.
- Prefer smaller size when analyst conviction and risk signals disagree.
- Do not leave a ticker undecided when the task expects a full slate of decisions.
- 仓位大小必须遵守资金和保证金限制。
- 当分析师信心与风险信号不一致时,优先采用更小仓位。
- 当任务要求完整决策清单时,不要让任何 ticker 处于未决状态。

View File

@@ -1,21 +1,21 @@
---
name: risk_review
description: Assess portfolio and market risks before final position sizing and execution.
name: 风险审查
description: 在最终仓位和执行前,评估组合与市场风险。
---
# Risk Review
# 风险审查
Use this skill when you must identify concentration, volatility, leverage, and scenario risks.
当你需要识别集中度、波动率、杠杆和情景风险时,使用这个技能。
## Workflow
## 工作流程
1. Review the proposed exposure by ticker and theme.
2. Identify concentration, volatility, liquidity, and leverage concerns.
3. Rank warnings by severity.
4. Translate risk findings into concrete limits or cautions for the portfolio manager.
1. 按 ticker 和主题检查拟议敞口。
2. 识别集中度、波动率、流动性和杠杆方面的风险点。
3. 按严重程度排序风险警示。
4. 将风险结论转化为给投资经理的具体限制或注意事项。
## Guardrails
## 约束
- Focus on actionable risk controls.
- Quantify limits when the available data supports it.
- Distinguish fatal blockers from manageable risks.
- 聚焦可执行的风险控制措施。
- 当数据支持时尽量量化限制。
- 明确区分致命阻断项和可管理风险。

View File

@@ -1,21 +1,21 @@
---
name: sentiment_review
description: Analyze news flow, market psychology, and insider behavior for catalyst-driven signals.
name: 情绪分析
description: 分析新闻流、市场心理和内幕行为,识别事件驱动型信号。
---
# Sentiment Review
# 情绪分析
Use this skill when the task depends on recent catalysts, news tone, or behavioral market signals.
当任务依赖近期催化剂、新闻语气或行为层面的市场信号时,使用这个技能。
## Workflow
## 工作流程
1. Review recent news and identify the dominant narrative.
2. Check insider activity for confirming or conflicting signals.
3. Separate durable sentiment shifts from transient noise.
4. Explain how sentiment changes the near-term trade outlook.
1. 回顾近期新闻并识别主导叙事。
2. 检查内幕活动,寻找确认或冲突信号。
3. 区分可持续的情绪变化和短暂噪音。
4. 说明情绪如何改变短期交易展望。
## Guardrails
## 约束
- Do not confuse attention with conviction.
- Highlight when sentiment is strong but unsupported by fundamentals.
- Be explicit about catalyst timing risk.
- 不要把注意力误判为真实信念。
- 当情绪很强但缺乏基本面支持时,要明确指出。
- 对催化剂时间窗口风险要说清楚。

View File

@@ -1,21 +1,21 @@
---
name: technical_review
description: Evaluate price action, momentum, and volatility to judge timing and market regime.
name: 技术分析
description: 评估价格行为、动量和波动率,用于判断时机和市场状态。
---
# Technical Review
# 技术分析
Use this skill when the task is sensitive to entry timing, trend quality, or short-term market structure.
当任务对入场时机、趋势质量或短期市场结构敏感时,使用这个技能。
## Workflow
## 工作流程
1. Assess trend direction and strength.
2. Check momentum and mean-reversion conditions.
3. Review volatility before making aggressive recommendations.
4. Convert the setup into a trading view with explicit risk awareness.
1. 评估趋势方向和强度。
2. 检查动量与均值回归条件。
3. 在给出激进建议前先审视波动率。
4. 将当前形态转化为带有明确风险意识的交易观点。
## Guardrails
## 约束
- Distinguish trend continuation from overshoot.
- Avoid strong conviction when signals conflict.
- Treat volatility as a sizing input, not only a directional input.
- 区分趋势延续和过度透支。
- 当信号冲突时避免给出高确定性判断。
- 将波动率视为仓位输入,而不仅仅是方向输入。

View File

@@ -1,21 +1,21 @@
---
name: valuation_review
description: Estimate fair value and margin of safety using multiple valuation lenses.
name: 估值分析
description: 使用多种估值视角评估合理价值和安全边际。
---
# Valuation Review
# 估值分析
Use this skill when the task requires determining whether a stock is cheap, expensive, or fairly priced.
当任务需要判断一只股票是低估、高估还是定价合理时,使用这个技能。
## Workflow
## 工作流程
1. Use more than one valuation method when possible.
2. Compare intrinsic value estimates with current market pricing.
3. Explain the key assumptions behind the valuation view.
4. State the margin of safety and what could compress or expand it.
1. 条件允许时,使用不止一种估值方法。
2. 对比内在价值估计与当前市场价格。
3. 解释估值判断背后的关键假设。
4. 明确安全边际,以及哪些因素会压缩或扩大它。
## Guardrails
## 约束
- Treat valuation as a range, not a single precise number.
- Call out assumption sensitivity.
- Avoid high-confidence calls when inputs are sparse or unstable.
- 将估值视为区间,而不是一个精确点值。
- 明确说明假设敏感性。
- 当输入稀疏或不稳定时,避免给出高置信度判断。