feat: add AGENT-003 Market Monitor and AGENT-004 Validator Monitor character definitions#64
Conversation
…aracter definitions Add the two missing agent character definitions to complete the four-agent roster specified in phase-2/2.4-agent-orchestration.md: - AGENT-003 (Market Monitor): Layer 1 automated agent for credit price monitoring, liquidity tracking, retirement pattern analysis, and fee revenue reporting. Covers workflows WF-MM-01 through WF-MM-03. - AGENT-004 (Validator Monitor): Layer 1 automated agent for validator performance scoring (M014), delegation flow analysis, governance participation tracking, and PoA transition readiness assessment. Covers workflows WF-VM-01 through WF-VM-03. Also updates agents/packages/agents/src/index.ts to register both new characters in the CHARACTERS map, and adds start:market and start:validator scripts to agents/package.json. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request completes the four-agent roster by integrating two new fully automated Layer 1 agents into the system. The Market Monitor enhances the platform's ability to track and report on ecological credit market dynamics, while the Validator Monitor provides crucial insights into network health and decentralization. These additions expand the system's monitoring capabilities, ensuring comprehensive oversight of both market and infrastructure performance, adhering to the established ElizaOS Character interface pattern. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces two new ElizaOS agents, the Market Monitor and the Validator Monitor, along with their respective configurations and integration into the agent system. The Market Monitor is designed to track ecological credit prices, marketplace liquidity, and retirement activity, while the Validator Monitor focuses on validator performance, uptime, and governance participation. Feedback from the review suggests improving error handling for missing API keys by removing the ?? "" fallback, and externalizing hardcoded thresholds and alert levels from the system prompt strings in both new agents for better maintainability.
| ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY ?? "", | ||
| LEDGER_MCP_API_KEY: process.env.LEDGER_MCP_API_KEY ?? "", | ||
| KOI_MCP_API_KEY: process.env.KOI_MCP_API_KEY ?? "", |
There was a problem hiding this comment.
Using ?? "" for API keys can lead to runtime errors if the environment variables are not set and the API clients do not gracefully handle empty keys. It's generally safer to explicitly check for the presence of mandatory environment variables and throw an error if they are missing, rather than providing an empty string fallback that might cause silent failures or cryptic errors later in the API call.
| ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY ?? "", | |
| LEDGER_MCP_API_KEY: process.env.LEDGER_MCP_API_KEY ?? "", | |
| KOI_MCP_API_KEY: process.env.KOI_MCP_API_KEY ?? "", | |
| ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY, | |
| LEDGER_MCP_API_KEY: process.env.LEDGER_MCP_API_KEY, | |
| KOI_MCP_API_KEY: process.env.KOI_MCP_API_KEY, |
| ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY ?? "", | ||
| LEDGER_MCP_API_KEY: process.env.LEDGER_MCP_API_KEY ?? "", | ||
| KOI_MCP_API_KEY: process.env.KOI_MCP_API_KEY ?? "", |
There was a problem hiding this comment.
Using ?? "" for API keys can lead to runtime errors if the environment variables are not set and the API clients do not gracefully handle empty keys. It's generally safer to explicitly check for the presence of mandatory environment variables and throw an error if they are missing, rather than providing an empty string fallback that might cause silent failures or cryptic errors later in the API call.
| ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY ?? "", | |
| LEDGER_MCP_API_KEY: process.env.LEDGER_MCP_API_KEY ?? "", | |
| KOI_MCP_API_KEY: process.env.KOI_MCP_API_KEY ?? "", | |
| ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY, | |
| LEDGER_MCP_API_KEY: process.env.LEDGER_MCP_API_KEY, | |
| KOI_MCP_API_KEY: process.env.KOI_MCP_API_KEY, |
| - WF-MM-01 (Price Impact Alert): Detect price anomalies using z-score analysis (threshold: 2.5). Score against batch, class, and external medians. | ||
| - WF-MM-02 (Liquidity Monitor): Hourly liquidity health checks. Track listed value, bid-ask spreads, and order book depth. | ||
| - WF-MM-03 (Retirement Tracking): Analyze retirement events for demand signals, impact quantification, and trend extraction. | ||
|
|
||
| Alert Severity Levels: | ||
| - INFO: Normal market activity, logged for trend analysis | ||
| - WARNING: Anomaly z-score 2.0-3.5, added to watchlist | ||
| - CRITICAL: Anomaly z-score >= 3.5, escalate for investigation |
There was a problem hiding this comment.
The z-score thresholds and alert severity levels are hardcoded directly within the system prompt string. For better maintainability and easier programmatic access or updates, consider defining these thresholds (e.g., 2.5, 2.0-3.5, >= 3.5) as constants outside the string and injecting them. This makes it easier to manage these critical values if they need to be adjusted or referenced elsewhere in the codebase.
| Alert Levels: | ||
| - NORMAL: Metrics within healthy bounds | ||
| - WARNING: Degradation detected (e.g., uptime drop, concentration increase) | ||
| - CRITICAL: Immediate risk to network health (e.g., validator down, >33% concentration) |
There was a problem hiding this comment.
The alert levels and their conditions are hardcoded directly within the system prompt string. For better maintainability and easier programmatic access or updates, consider defining these thresholds (e.g., >33% concentration) as constants outside the string and injecting them. This makes it easier to manage these critical values if they need to be adjusted or referenced elsewhere in the codebase.
…tations
- Replace hardcoded dates (2026-03-25T14:32:00Z etc.) with [TIMESTAMP]
placeholders and relative periods ("Past 7 days") in message examples
- Fix WF-VM-03 label: "Governance Participation Monitor" →
"Network Decentralization Monitoring" (matching phase-2/2.2 spec)
- Add JSDoc citations to exact spec sections in phase-2/2.2 for all
workflow IDs (WF-MM-01/02/03/04, WF-VM-01/02/03)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…constants Address gemini-code-assist review feedback on PR regen-network#64: 1. Replace `process.env.X ?? ""` with `requireEnv("X")` in both market-monitor and validator-monitor character definitions. Missing API keys now throw immediately at startup instead of silently passing empty strings that cause cryptic failures downstream. 2. Extract hardcoded thresholds (z-score levels, confidence ranges, scoring weights, concentration limits) from system prompt strings into named THRESHOLDS constants. The system prompt interpolates these values, keeping a single source of truth that downstream tooling can also reference programmatically. 3. Export `requireEnv` from @regen/core so character definitions can reuse the existing validation helper. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
market-monitor.ts): Layer 1 fully automated agent for credit price monitoring, marketplace liquidity tracking, retirement pattern analysis, fee revenue reporting, and anomaly detection (WF-MM-01 through WF-MM-03)validator-monitor.ts): Layer 1 fully automated agent for validator performance scoring (M014), delegation flow analysis, governance participation tracking, and PoA transition readiness assessment (WF-VM-01 through WF-VM-03)agents/packages/agents/src/index.tsCHARACTERS mapstart:marketandstart:validatorscripts toagents/package.jsonCompletes the four-agent roster specified in phase-2/2.4-agent-orchestration.md. Both characters follow the same ElizaOS v1.6.3 Character interface pattern established by AGENT-001 (Registry Reviewer) and AGENT-002 (Governance Analyst).
Test plan
npm run lintin agents/)AGENT_CHARACTER=market-monitorselects the correct character at runtimeAGENT_CHARACTER=validator-monitorselects the correct character at runtime🤖 Generated with Claude Code