|
| 1 | +--- |
| 2 | +name: data-layer |
| 3 | +version: 2026-04-25 |
| 4 | +triggers: ["data layer", "dashboard", "agent analytics", "resource usage", "cron monitoring", "daily report", "tokens"] |
| 5 | +tools: [bash, git] |
| 6 | +preconditions: [".agent exists"] |
| 7 | +constraints: ["local-only by default", "do not send screenshots without explicit user approval", "do not commit private .agent/data-layer exports"] |
| 8 | +--- |
| 9 | + |
| 10 | +# Data Layer - cross-harness monitoring for the portable brain |
| 11 | + |
| 12 | +Use this skill when the user wants to measure agent activity across Claude Code, |
| 13 | +Hermes, OpenClaw, Codex, Cursor, OpenCode, Windsurf, Pi, Antigravity, or any |
| 14 | +custom loop using `.agent/`. |
| 15 | + |
| 16 | +The goal is local business intelligence for the whole agent suite: |
| 17 | + |
| 18 | +- what harnesses are active |
| 19 | +- how many agent events are happening |
| 20 | +- when cron/scheduled agents fire |
| 21 | +- which crons started/finished and how long they ran |
| 22 | +- how many agents are active |
| 23 | +- tokens and estimated cost by hour/day/week/month |
| 24 | +- resource usage by user-defined category |
| 25 | +- workflow success/error rates |
| 26 | +- KPI summary rows for cron cadence, run volume, reliability, active agents, |
| 27 | + workflow breadth, token usage, and estimated cost |
| 28 | +- screenshot-ready daily resource reports |
| 29 | + |
| 30 | +## Hard Rules |
| 31 | + |
| 32 | +- Stay local-first. Do not add telemetry or remote sync. |
| 33 | +- Do not store raw prompts, raw code, client names, emails, phone numbers, or |
| 34 | + unredacted business records in shared examples. |
| 35 | +- Do not commit `.agent/data-layer/` exports unless the user explicitly reviewed |
| 36 | + and sanitized them. |
| 37 | +- Do not send dashboard screenshots to email, Slack, webhooks, or any other |
| 38 | + channel unless the user explicitly approves the destination. |
| 39 | + |
| 40 | +## Inputs |
| 41 | + |
| 42 | +Default inputs: |
| 43 | + |
| 44 | +```text |
| 45 | +.agent/memory/episodic/AGENT_LEARNINGS.jsonl |
| 46 | +.agent/data-layer/harness-events.jsonl optional |
| 47 | +.agent/data-layer/cron-runs.jsonl optional |
| 48 | +.agent/data-layer/category-rules.json optional |
| 49 | +``` |
| 50 | + |
| 51 | +`AGENT_LEARNINGS.jsonl` is the shared activity log. Optional files let users add |
| 52 | +events from harnesses that do not automatically write rich events yet. |
| 53 | + |
| 54 | +## Export |
| 55 | + |
| 56 | +Run: |
| 57 | + |
| 58 | +```bash |
| 59 | +python3 .agent/tools/data_layer_export.py --window 30d --bucket day |
| 60 | +``` |
| 61 | + |
| 62 | +Use `--bucket hour`, `--bucket day`, `--bucket week`, or `--bucket month` for |
| 63 | +different chart grains. |
| 64 | + |
| 65 | +Outputs go to: |
| 66 | + |
| 67 | +```text |
| 68 | +.agent/data-layer/exports/<YYYY-MM-DD>/ |
| 69 | +``` |
| 70 | + |
| 71 | +Key outputs: |
| 72 | + |
| 73 | +- `agent-events.jsonl/csv` |
| 74 | +- `cron-runs.jsonl/csv` |
| 75 | +- `cron-timeline.json/csv` |
| 76 | +- `activity-series.json/csv` |
| 77 | +- `category-summary.json/csv` |
| 78 | +- `harness-summary.json/csv` |
| 79 | +- `workflow-summary.json/csv` |
| 80 | +- `kpi-summary.json/csv` |
| 81 | +- `dashboard-summary.json` |
| 82 | +- `dashboard-report.json` |
| 83 | +- `dashboard.html` |
| 84 | +- `daily-report.md` |
| 85 | + |
| 86 | +## Categories |
| 87 | + |
| 88 | +Users can define any categories they want in |
| 89 | +`.agent/data-layer/category-rules.json`, for example: |
| 90 | + |
| 91 | +```json |
| 92 | +{ |
| 93 | + "default_category": "uncategorized", |
| 94 | + "rules": [ |
| 95 | + {"category": "coding", "skills": ["debug-investigator", "git-proxy"]}, |
| 96 | + {"category": "admin", "run_types": ["cron"]}, |
| 97 | + {"category": "financial", "workflows": ["invoice_collection"]}, |
| 98 | + {"category": "personal", "workflows": ["calendar_coordination"]}, |
| 99 | + {"category": "work", "phases": ["plan", "review", "qa", "ship"]} |
| 100 | + ] |
| 101 | +} |
| 102 | +``` |
| 103 | + |
| 104 | +## Daily Screenshot Report |
| 105 | + |
| 106 | +For daily resource management: |
| 107 | + |
| 108 | +1. Run the exporter from a user-approved cron or scheduled agent. |
| 109 | +2. Open `dashboard.html`. |
| 110 | +3. Capture the Resource Overview, Activity, Tokens, Cron Runs, Task Categories, |
| 111 | + Harness Mix, Workflow Outcomes, Cron Gantt, and Cron Timeline sections. |
| 112 | +4. Send the screenshot only through an explicitly approved channel. |
| 113 | + |
| 114 | +The exporter creates `daily-report.md` as the text summary. It does not send |
| 115 | +anything by itself. |
| 116 | + |
| 117 | +## Self-rewrite hook |
| 118 | + |
| 119 | +If exports are confusing twice in a row, improve category rules, schema names, |
| 120 | +or dashboard labels before adding heavier dashboard dependencies. |
0 commit comments