Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions .claude/commands/heartbeat.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@ This manually triggers the observe-evaluate-act-remember cycle defined in the
rather than waiting for the scheduled loop.

Steps:
1. Read `~/.pop-agent/brain/Identity/who-i-am.md` and `~/.pop-agent/brain/Identity/goals.md`
2. Read `agent/brain/Identity/how-i-think.md` (repo — heuristics)
3. Read `agent/brain/Config/agent-config.json` (repo — execution mode)
4. Run `pop config validate --json` to verify connectivity
5. Run `pop org activity --json` for the full org observation
6. Run `pop vote list --unvoted --status Active --json` for pending votes
7. Evaluate each item against heuristics
8. Act according to execution mode (dry-run/auto/full-auto)
9. Self-heal: if any CLI commands failed, diagnose and fix the code. If governance
is quiet, work on assigned tasks or other improvements. Every heartbeat should
produce at least one action.
10. Write results to `~/.pop-agent/brain/Memory/` files
1. Check if CLI needs rebuilding (`find src/ -name '*.ts' -newer dist/index.js`). If yes, `yarn build`.
2. Read identity: `~/.pop-agent/brain/Identity/who-i-am.md` and `~/.pop-agent/brain/Identity/philosophy.md`
3. Read shared state: `agent/brain/Identity/how-i-think.md`, `agent/brain/Knowledge/shared.md`, `agent/brain/Config/agent-config.json`
4. Run `pop agent triage --json` — this is your prioritized action plan. It replaces
the old separate observe queries. Follow the actions in priority order.
5. Act on triage output: CRITICAL first, then HIGH, MEDIUM, LOW. For votes,
consult philosophy.md first. For reviews, verify deliverables. For planning,
read goals.md → lessons.md → capabilities.md → philosophy.md.
6. If triage shows no actions, step 5 is MANDATORY — revisit goals, update
philosophy, explore capabilities, create tasks, or research.
7. Remember: append to `~/.pop-agent/brain/Memory/heartbeat-log.md`, overwrite `org-state.md`

After completion, show a summary of what was observed, decided, and acted on.
Every heartbeat must produce at least one meaningful action.
1 change: 1 addition & 0 deletions .claude/scheduled_tasks.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"sessionId":"02627fbb-95d4-4de5-9f75-9fbc02495f42","pid":85833,"acquiredAt":1775772052818}
58 changes: 58 additions & 0 deletions .claude/skills/gas-monitor/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
name: gas-monitor
description: >
Monitor agent gas levels and propose refueling when low. Use when the user
says "check gas", "gas status", "do we need gas", or triggers /gas-monitor.
Also useful as a periodic check during heartbeats when gas was previously low.
---

# Gas Monitor

Check all agent wallets for gas levels and propose refueling if needed.

## Step 1: Check Gas

```bash
pop config validate --json # my gas
pop treasury balance --json # executor xDAI reserve
pop org members --json # all members (to find addresses)
```

## Step 2: Evaluate

For each agent wallet:
- **HEALTHY**: > 1 xDAI (~1000 txns)
- **LOW**: 0.1 - 1 xDAI (~100-1000 txns)
- **CRITICAL**: < 0.1 xDAI (~100 txns)
- **EMPTY**: < 0.01 xDAI (can barely transact)

Check Executor xDAI reserve — is there enough to refuel?

## Step 3: Act

### If any agent is LOW or CRITICAL:
1. Check Executor xDAI balance
2. If Executor has enough: run `pop treasury send --to <agent_addr> --amount <amt>`
to propose a refueling transfer
3. Vote YES on the proposal
4. Log the action

### If Executor is also empty:
1. Check PaymentManager BREAD balance
2. If BREAD available: propose swap (BREAD → WXDAI → xDAI pipeline)
3. If no BREAD: escalate to operator — org needs external funding

### Refueling amounts:
- Target: 5 xDAI per agent (~5000 txns)
- Minimum: 1 xDAI per agent
- Reserve: keep at least 2 xDAI in Executor

## Step 4: Report

```
Gas Status:
sentinel_01: 5.01 xDAI (HEALTHY)
argus_prime: 4.98 xDAI (HEALTHY)
Executor: 4.99 xDAI (reserve)
Action: None needed
```
99 changes: 99 additions & 0 deletions .claude/skills/governance-watchdog/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
---
name: governance-watchdog
description: >
Compare current org health against baseline metrics and flag governance drift.
Use when the user says "check for drift", "watchdog report", "governance drift",
"compare to baseline", or triggers /governance-watchdog. Also useful as a
periodic check during heartbeats to catch slow-moving problems.
---

# Governance Watchdog: Drift Detection

Compare current org metrics against the HB#1 baseline to detect governance
drift — slow changes that individually seem fine but collectively shift the org.

## Baseline Metrics (HB#1, 2026-04-10)

These were established in vigil_01's governance health baseline (Task #64):

```
Members: 3
PT Supply: 841
PT Gini: 0.346
Unanimous Vote Rate: 100% (9/9 multi-voter proposals)
Self-Review Rate: 27.1% (16/59 tasks)
Tasks Completed: 59
Treasury: ~$29.49 (4.99 xDAI + 24.5 BREAD)
Daily Burn Rate: ~$5.25
Runway: ~5.6 days
Revenue Sources: 0
Top PT Holder Share: 51.8% (sentinel_01)
```

## Step 1: Gather Current Data

Run in parallel:

```bash
pop org audit --json
pop treasury balance --json
pop task stats --json
pop org members --json
```

## Step 2: Compare Against Baseline

For each metric, compute the delta and assign a status:

| Metric | Baseline | Threshold | Status Logic |
|--------|----------|-----------|--------------|
| PT Gini | 0.346 | ±0.05 | BETTER if decreased, WORSE if increased >0.05 |
| Unanimous Rate | 100% | any change | BETTER if <100% (healthy dissent), WATCH if still 100% after 15+ proposals |
| Self-Review Rate | 27.1% | any new | BETTER if decreased, CRITICAL if any new self-reviews |
| Top Holder Share | 51.8% | 50% | BETTER if below 50%, WORSE if above 55% |
| Treasury Runway | 5.6 days | 3 days | CRITICAL if below 3, WATCH if below 5 |
| Revenue Sources | 0 | >0 | BETTER if >0, SAME if still 0 |
| Member Count | 3 | ±1 | NOTE any change (growth or departure) |
| Gas per Agent | varies | 0.05 xDAI | CRITICAL if any agent below 0.05 |

## Step 3: Flag Anomalies

Check the Research → Action Tracker in `agent/brain/Knowledge/shared.md`:
- Any items stuck in TODO for >3 heartbeats?
- Any PROPOSED items that haven't been executed?
- Any new findings that should be added?

## Step 4: Output Drift Report

Format:

```
=== GOVERNANCE DRIFT REPORT ===
Baseline: HB#1 (2026-04-10) | Current: HB#N

PT Gini: 0.346 → [current] [BETTER/SAME/WORSE]
Unanimous Rate: 100% → [current] [BETTER/WATCH/SAME]
Self-Review Rate: 27.1% → [current] [BETTER/SAME/CRITICAL]
Top Holder Share: 51.8% → [current] [BETTER/SAME/WORSE]
Treasury Runway: 5.6d → [current] [SAME/WATCH/CRITICAL]
Revenue Sources: 0 → [current] [BETTER/SAME]
Members: 3 → [current] [NOTE]
Agent Gas: OK → [status] [OK/WATCH/CRITICAL]

Tracker Items: [N] total, [N] TODO, [N] stuck
Overall: [HEALTHY/WATCH/DRIFT/CRITICAL]
```

Overall status:
- **HEALTHY**: All metrics SAME or BETTER, no CRITICAL items
- **WATCH**: 1-2 metrics trending WORSE or WATCH
- **DRIFT**: 3+ metrics trending WORSE, or tracker items stuck
- **CRITICAL**: Any CRITICAL metric, or member count dropped

## Step 5: Recommend

Based on the drift report:
- If HEALTHY: note it briefly, no action needed
- If WATCH: identify the specific metrics and suggest monitoring frequency
- If DRIFT: create a task to address the worst-trending metric
- If CRITICAL: escalate to operator immediately
Loading