Skip to content

feat: add AGENT-003 Market Monitor and AGENT-004 Validator Monitor character definitions#64

Open
brawlaphant wants to merge 3 commits intoregen-network:mainfrom
brawlaphant:pr/agent-character-definitions
Open

feat: add AGENT-003 Market Monitor and AGENT-004 Validator Monitor character definitions#64
brawlaphant wants to merge 3 commits intoregen-network:mainfrom
brawlaphant:pr/agent-character-definitions

Conversation

@brawlaphant
Copy link
Copy Markdown
Contributor

Summary

  • Add AGENT-003 Market Monitor character definition (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)
  • Add AGENT-004 Validator Monitor character definition (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)
  • Register both new characters in agents/packages/agents/src/index.ts CHARACTERS map
  • Add start:market and start:validator scripts to agents/package.json

Completes 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

  • Verify TypeScript compilation passes (npm run lint in agents/)
  • Verify AGENT_CHARACTER=market-monitor selects the correct character at runtime
  • Verify AGENT_CHARACTER=validator-monitor selects the correct character at runtime
  • Review system prompts against phase-2/2.4 and 2.2 specs for completeness
  • Confirm message examples demonstrate representative workflow outputs

🤖 Generated with Claude Code

…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>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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

  • New Agent Definitions: Added the character definition for AGENT-003 Market Monitor, a fully automated Layer 1 agent for credit price monitoring, marketplace liquidity tracking, retirement pattern analysis, fee revenue reporting, and anomaly detection.
  • New Agent Definitions: Added the character definition for AGENT-004 Validator Monitor, a fully automated Layer 1 agent for validator performance scoring, delegation flow analysis, governance participation tracking, and PoA transition readiness assessment.
  • Agent Registration: Registered both the new Market Monitor and Validator Monitor characters within the main CHARACTERS map in agents/packages/agents/src/index.ts.
  • New Start Scripts: Introduced new start:market and start:validator scripts in agents/package.json to easily launch the respective new agents.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +28 to +30
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 ?? "",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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.

Suggested change
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,

Comment on lines +29 to +31
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 ?? "",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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.

Suggested change
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,

Comment on lines +44 to +51
- 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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Comment on lines +49 to +52
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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

brawlaphant and others added 2 commits March 25, 2026 11:59
…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>
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