Skip to content

feat: Sub-Issue 13 — Living Agent Dashboard#8

Merged
kingassune merged 2 commits intomainfrom
copilot/add-living-agent-dashboard
Feb 24, 2026
Merged

feat: Sub-Issue 13 — Living Agent Dashboard#8
kingassune merged 2 commits intomainfrom
copilot/add-living-agent-dashboard

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 24, 2026

📝 Description

Implements the final sub-issue of the Living Agent epic: a CLI/web dashboard that exposes the agent's internal life-state (metabolism, trading, family tree, telepathy, swarm) in real-time.

pkg/dashboard/ — new package

  • dashboard.go: Callback-based DashboardOptions keeps the package import-free from heavy deps. Dashboard.GetData() aggregates all sources with full graceful degradation (nil sources → omitted sections).
  • cli.go: FormatCLI() renders a Unicode box-drawing terminal view across all sections.
  • web.go: RegisterHandlers() mounts:
    • GET /dashboard — dark-themed, mobile-responsive HTML; JS setTimeout auto-refresh every 10s
    • GET /dashboard/api — full DashboardData JSON
    • GET /dashboard/api/{metabolism,family,telepathy,swarm} — section-scoped JSON
  • dashboard_test.go: 11 tests — nil-source degradation, mock sources, uptime formatting, CLI output, JSON round-trip.

pkg/tools/dashboard_tool.go

dashboard tool with section enum (all|metabolism|trading|family|telepathy|swarm|system); returns FormatCLI output as a SilentResult.

Config + integration

  • DashboardConfig{Enabled, WebEnabled, RefreshInterval} added to Config struct and config.example.json.
  • registerSharedTools() in loop.go registers the dashboard tool when cfg.Dashboard.Enabled, wiring metabolism state via the agent's existing ToolRegistry.GetMetabolism().

🗣️ Type of Change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 📖 Documentation update
  • ⚡ Code refactoring (no functional changes, no api changes)

🤖 AI Code Generation

  • 🤖 Fully AI-generated (100% AI, 0% Human)
  • 🛠️ Mostly AI-generated (AI draft, Human verified/modified)
  • 👨‍💻 Mostly Human-written (Human lead, AI assisted or none)

🔗 Related Issue

Part of #3 — Living Agent epic, Sub-Issue 13.

📚 Technical Context (Skip for Docs)

  • Reference URL: N/A
  • Reasoning: Dashboard uses a callback/options pattern so pkg/dashboard has zero imports from metabolism/replication/swarm — callers in loop.go bridge the types. This keeps the package testable in isolation and avoids import cycles.

🧪 Test Environment

  • Hardware: N/A
  • OS: Linux (CI)
  • Model/Provider: N/A
  • Channels: N/A

📸 Evidence (Optional)

Click to view Logs/Screenshots
ok  github.com/GemachDAO/Gclaw/pkg/dashboard    0.006s  (11 tests)
ok  github.com/GemachDAO/Gclaw/pkg/agent        0.034s
ok  github.com/GemachDAO/Gclaw/pkg/tools        0.707s
ok  github.com/GemachDAO/Gclaw/pkg/config       0.010s

☑️ Checklist

  • My code/docs follow the style of this project.
  • I have performed a self-review of my own changes.
  • I have updated the documentation accordingly.
Original prompt

Parent Epic: #3 — Living Agent — GMAC Metabolism, GDEX SDK Trading, Self-Replication, Telepathy

This PR implements Sub-Issue 13: Living Agent Dashboard — the final sub-issue of the epic. This is a CLI/web dashboard showing the agent's life-state, trades, agent family tree, and telepathy activity.

Context: Sub-issues 1–12 are all merged. The codebase now has:

  • pkg/metabolism/Metabolism with GetStatus() returning MetabolismStatus{Balance, Goodwill, Generation, SurvivalMode, Abilities}, GetLedger(), GetBalance(), GetGoodwill(), persistence via SaveToFile/LoadFromFile
  • pkg/metabolism/goodwill.goGoodwillTracker with GetAbilities()
  • pkg/replication/Replicator with ListChildren() returning []*ChildAgent, TelepathyBus with GetHistory(limit), file-based telepathy
  • pkg/swarm/SwarmCoordinator with GetMembers(), GetSignals(), consensus engine, persistence
  • pkg/recode/Recoder with GetHistory() returning []RecodeAction
  • pkg/tools/ — Full GDEX trading tool suite (gdex_buy, gdex_sell, etc.), replicate, self_recode, telepathy, swarm tools
  • pkg/config/config.goMetabolismConfig, GDEXConfig, SwarmConfig
  • pkg/agent/loop.goAgentLoop with GetStartupInfo(), registerSharedTools()
  • pkg/heartbeat/service.goHeartbeatService with IsRunning()
  • Existing gateway: pkg/gateway/ with HTTP server pattern (if it exists)

Sub-Issue 13: Living Agent Dashboard

Build a dashboard that exposes the agent's internal life-state — making the "living agent" concept visible and interactive. The dashboard should work both as CLI output and as a simple web UI served from the existing gateway.

1. New Package: pkg/dashboard/

File: pkg/dashboard/dashboard.go

Core dashboard data aggregator:

package dashboard

type DashboardData struct {
    // Agent Identity
    AgentID    string `json:"agent_id"`
    Generation int    `json:"generation"`
    Uptime     string `json:"uptime"`
    StartedAt  int64  `json:"started_at"`

    // Metabolism
    Metabolism *MetabolismSnapshot `json:"metabolism"`

    // Trading
    Trading *TradingSnapshot `json:"trading"`

    // Family Tree
    Family *FamilySnapshot `json:"family"`

    // Telepathy
    Telepathy *TelepathySnapshot `json:"telepathy"`

    // Swarm
    Swarm *SwarmSnapshot `json:"swarm,omitempty"`

    // Recode History
    RecodeHistory []RecodeEntry `json:"recode_history,omitempty"`

    // System
    System *SystemSnapshot `json:"system"`
}

type MetabolismSnapshot struct {
    Balance      float64  `json:"balance"`
    Goodwill     int      `json:"goodwill"`
    SurvivalMode bool     `json:"survival_mode"`
    Abilities    []string `json:"abilities"`
    RecentLedger []LedgerEntry `json:"recent_ledger"` // last 20 entries
}

type TradingSnapshot struct {
    TotalTrades    int     `json:"total_trades"`
    ProfitablePct  float64 `json:"profitable_pct"`
    TotalPnL       float64 `json:"total_pnl"`
    ActivePositions int    `json:"active_positions"`
    RecentTrades   []TradeEntry `json:"recent_trades"` // last 10
}

type TradeEntry struct {
    Timestamp    int64   `json:"timestamp"`
    Action       string  `json:"action"`      // "buy", "sell"
    TokenAddress string  `json:"token_address"`
    Amount       string  `json:"amount"`
    PnL          float64 `json:"pnl,omitempty"`
    ChainID      int     `json:"chain_id"`
}

type FamilySnapshot struct {
    ParentID  string        `json:"parent_id,omitempty"`
    Children  []ChildInfo   `json:"children"`
    TotalFamily int         `json:"total_family"` // including self
}

type ChildInfo struct {
    ID         string  `json:"id"`
    Generation int     `json:"generation"`
    Status     string  `json:"status"`
    GMAC       float64 `json:"gmac"`
    Goodwill   int     `json:"goodwill"`
    Mutations  []string `json:"mutations"`
    CreatedAt  int64   `json:"created_at"`
}

type TelepathySnapshot struct {
    TotalMessages   int               `json:"total_messages"`
    RecentMessages  []TelepathyEntry  `json:"recent_messages"` // last 20
    ActiveChannels  int               `json:"active_channels"`
}

type TelepathyEntry struct {
    From      string `json:"from"`
    To        string `json:"to"`
    Type      string `json:"type"`
    Content   string `json:"content"`
    Timestamp int64  `json:"timestamp"`
    Priority  int    `json:"priority"`
}

type SwarmSnapshot struct {
    IsLeader     bool           `json:"is_leader"`
    MemberCount  int            `json:"member_count"`
    Members      []SwarmMemberInfo `json:"members"`
    ActiveSignals int           `json:"active_signals"`
    ConsensusMode string        `json:"consensus_mode"`
}

type SwarmMemberInfo struct {
    AgentID     string  `json:"agent_id"`
    Role        string  `json:"role"`
    Strategy    string  `json:"strategy"`
    Performance float64 `json:"performance"`
    Status      string  `json:"status"`
}

type Recod...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

*This pull request was created from Copilot chat.*
>

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey).

… dashboard tool, config, agent loop integration)

Co-authored-by: kingassune <[email protected]>
Copilot AI changed the title [WIP] Implement Living Agent Dashboard for monitoring agent performance feat: Sub-Issue 13 — Living Agent Dashboard Feb 24, 2026
Copilot AI requested a review from kingassune February 24, 2026 23:25
@kingassune kingassune marked this pull request as ready for review February 24, 2026 23:26
@kingassune kingassune merged commit a1b3b44 into main Feb 24, 2026
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.

2 participants