计时器:防篡改的时间与事件追踪 - Openclaw Skills

作者:互联网

2026-04-17

AI教程

什么是 计时器?

计时器是一款专为 Openclaw Skills 设计的强大时间追踪工具,其功能类似于数字霍布斯表。它允许开发者和用户监控从特定时间点开始经过的时间、追踪未来事件的倒计时或衡量旅程进度。无论是追踪服务器运行时间、项目持续时间,还是戒断等个人里程碑,计时器都能提供可靠、持久的记录。

该技能在 Openclaw Skills 生态系统中的脱颖而出之处在于其对防篡改持久性的关注。通过生成唯一的纸质代码和校验和,用户可以验证其追踪数据的完整性。与 SendGrid 的集成进一步增强了其效用,实现了直接从智能体工作流中自动发送电子邮件通知和里程碑警报。

下载入口:https://github.com/openclaw/skills/tree/main/skills/rm289/hour-meter

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install hour-meter

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 hour-meter。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

计时器 应用场景

  • 使用正计时模式追踪戒断天数或习惯改进行为。
  • 使用倒计时功能监控产品发布或重大生活事件的倒计时。
  • 通过 80,000 小时概念可视化长期职业进展和收入潜力。
  • 记录设备运行时间或服务器运行时间以进行维护调度。
  • 设置由特定时间里程碑触发的自动化智能体操作。
计时器 工作原理
  1. 通过定义开始日期、可选的结束日期和追踪模式(正计、倒计或区间)来创建计时器。
  2. 根据经过的小时数或完成百分比设置里程碑以触发通知。
  3. 锁定计时器以生成防篡改的纸质代码和用于验证的校验和。
  4. 通过命令行或处理触发里程碑的自动化心跳检查来监控进度。
  5. 稍后使用存储的纸质代码或仅追加的见证文件验证计时器的完整性。
  6. 可选通过 SendGrid 网络钩子在达到里程碑或打开电子邮件时接收实时更新。

计时器 配置指南

要在 Openclaw Skills 中开始使用此工具,请遵循以下设置步骤:

# 为新项目创建一个正计时器
meter.py create project-alpha --start "2025-01-01T08:00:00Z" -d "开发阶段"

# 配置电子邮件通知(可选)
export SENDGRID_API_KEY=SG.your_api_key
export SENDGRID_FROM_EMAIL=verified@yourdomain.com

# 锁定计时器以生成纸质代码
meter.py lock project-alpha

计时器 数据架构与分类体系

计时器组织其数据和验证日志,以确保 Openclaw Skills 用户的高完整性和可访问性:

组件 描述
见证文件 位于 ~/.openclaw/meter-witness.txt 的仅追加日志,包含所有锁定的计时器。
纸质代码 一个 20 字符的带校验和字符串(例如:318B-3229-C523-2F9C-V),用于捕捉拼写错误并防止篡改。
JSON 导出 所有计时器的标准化数据结构,便于备份和迁移。
元数据 包括开始/结束时间戳、描述、里程碑触发器和通知设置。
name: hour-meter
description: Track elapsed time from a set epoch with tamper-evident locking. Like an analog Hobbs meter but digital. Use for tracking uptime, service hours, time since events, sobriety counters, project duration, equipment runtime. Supports create, lock (seal), check, verify against external hash, list, and export operations.

Hour Meter

Life event tracker with three modes, milestone notifications, and tamper-evident verification.

Three Modes

COUNT UP — Time since an event

# Quit smoking tracker
meter.py create smoke-free --start "2025-06-15T08:00:00Z" -d "Last cigarette"
meter.py milestone smoke-free -t hours -v 720 -m "?? 30 days smoke-free!"
meter.py lock smoke-free  # → Gives you paper code to save

COUNT DOWN — Time until an event

# Baby due date
meter.py create baby --start "2026-01-15" --end "2026-10-15" --mode down -d "Baby arriving!"
meter.py milestone baby -t percent -v 33 -m "?? First trimester complete!"

COUNT BETWEEN — Journey from start to end

# Career span
meter.py create career --start "1998-05-15" --end "2038-05-15" -d "40-year career"
meter.py milestone career -t percent -v 50 -m "?? Halfway through career!"
meter.py career --meter career --rate 85 --raise-pct 2.5

Tamper-Evident Persistence

When you lock a meter, you get a paper code — a short, checksummed code you can write on paper:

╔══════════════════════════════════════════════════════════════╗
║  PAPER CODE (write this down):                               ║
║     318B-3229-C523-2F9C-V                                    ║
╚══════════════════════════════════════════════════════════════╝

Four Ways to Save (Non-Technical)

1?? PAPER — Write the code on paper/sticky note

  • 20 characters with dashes, easy to copy
  • Built-in checksum catches typos when verifying
  • Keep in wallet, safe, or taped to equipment

2?? PHOTO — Screenshot or photograph the lock screen

  • Store in camera roll, cloud photos
  • Visual backup, no typing required

3?? WITNESS FILE — Auto-saved to ~/.openclaw/meter-witness.txt

  • Append-only log of all locked meters
  • Sync folder to Dropbox/iCloud/Google Drive for cloud backup
  • Contains paper code + full hash + timestamp

4?? EMAIL TO SELF — Click the mailto: link or copy the one-liner

  • Opens your email client with pre-filled subject and body
  • Or copy the compact message: ?? my-meter | Code: XXXX-XXXX-XXXX-XXXX-C | Locked: 2026-02-02
  • Send to yourself, search inbox later to verify

5?? SENDGRID EMAIL — Auto-send verification email on lock

# Set your SendGrid API key
export SENDGRID_API_KEY=SG.xxxxx
export SENDGRID_FROM_EMAIL=verified@yourdomain.com

# Lock and email in one command
meter.py lock my-meter --email you@example.com
  • Sends a beautifully formatted HTML email with paper code
  • Requires a verified sender in SendGrid (see SendGrid docs)
  • Great for automated workflows

Verifying Later

# With paper code (catches typos!)
meter.py verify my-meter "318B-3229-C523-2F9C-V"

# → ? VERIFIED! Paper code matches.
# → ?? CHECKSUM ERROR! (if you have a typo)
# → ? MISMATCH! (if tampered)

Milestones

meter.py milestone  --type hours --value 1000 --message "1000 hours!"
meter.py milestone  --type percent --value 50 --message "Halfway!"
meter.py check-milestones  # JSON output for automation

Email Milestone Notifications (v1.3.0)

Get milestone notifications sent directly to your email:

# Create meter with email notifications
meter.py create my-meter r
  --notify-email you@example.com r
  --from-email verified@yourdomain.com r
  -d "My tracked event"

# Add milestones as usual
meter.py milestone my-meter -t hours -v 24 -m "?? 24 hours complete!"

# When check-milestones runs and a milestone fires, email is sent automatically
meter.py check-milestones
# → Triggers milestone AND sends email notification

Email includes:

  • ?? Milestone message
  • ?? Current elapsed time
  • ?? Meter description

Requires SENDGRID_API_KEY environment variable.

Milestone Notifications: Heartbeat vs Cron

Recommended: HEARTBEAT (~30 min resolution)

  • Add to HEARTBEAT.md: Run meter.py check-milestones and notify triggered
  • Batches with other periodic checks
  • Cost-efficient: shares token usage with other heartbeat tasks
  • Good for most use cases (quit tracking, career milestones, etc.)

ACTION: Triggers (Agent Automation)

Prefix milestone messages with ACTION: to trigger agent execution instead of just posting:

# Just posts the message
meter.py milestone my-meter -t hours -v 24 -m "?? 24 hours complete!"

# Triggers agent to EXECUTE the instruction
meter.py milestone my-meter -t hours -v 24 -m "ACTION: Check the weather and post a summary"

Configure in HEARTBEAT.md:

- If message starts with "ACTION:", execute it as an instruction
- Otherwise, post the message to the configured channel

Alternative: CRON (precise timing)

  • Use when exact timing matters (e.g., countdown to event)
  • ?? Cost warning: Cron at 1-minute intervals = 1,440 API calls/day = expensive!
  • If using cron, keep intervals ≥15 minutes to manage costs
  • Best for one-shot reminders, not continuous monitoring

Rule of thumb: If 30-minute resolution is acceptable, use heartbeat. Save cron for precision timing.

Quick Reference

meter.py create  [--start T] [--end T] [--mode up|down|between] [-d DESC]
meter.py lock                 # Seal + get paper code
meter.py verify         # Verify paper code
meter.py check                # Status + progress
meter.py milestone  -t hours|percent -v N -m "..."
meter.py check-milestones           # All milestones (JSON)
meter.py witness [--show] [--path]  # Witness file
meter.py list                       # All meters
meter.py career [--meter M] [--rate R] [--raise-pct P]
meter.py export [name]              # JSON export

SendGrid Email Webhook Server

Receive real-time notifications when recipients open, click, bounce, or unsubscribe from your meter verification emails.

Setup

# Start webhook server with Discord webhook (recommended)
python sendgrid_webhook.py --port 8089 --discord-webhook https://discord.com/api/webhooks/xxx/yyy

# Or process events manually (for agent to post)
python sendgrid_webhook.py --process-events
python sendgrid_webhook.py --process-events --json
  1. In your Discord channel, go to Settings > Integrations > Webhooks
  2. Click New Webhook, copy the URL
  3. Pass to --discord-webhook or set DISCORD_WEBHOOK_URL env var

SendGrid Setup

  1. Go to SendGrid > Settings > Mail Settings > Event Webhook
  2. Click "Create new webhook" (or edit existing)
  3. Set HTTP POST URL to: https://your-domain.com/webhooks/sendgrid
  4. Select all event types under Actions to be posted:
    • Engagement data: Opened, Clicked, Unsubscribed, Spam Reports, Group Unsubscribes, Group Resubscribes
    • Deliverability Data: Processed, Dropped, Deferred, Bounced, Delivered
    • Account Data: Account Status Change
  5. Click "Test Integration" to verify - this fires all event types to your webhook
  6. Important: Click Save to enable the webhook!
  7. (Optional) Enable Signed Event Webhook for security and set SENDGRID_WEBHOOK_PUBLIC_KEY

SendGrid Webhook Setup

Event Types

Event Emoji Description
delivered ? Email reached recipient
open ?? Recipient opened email
click ?? Recipient clicked a link
bounce ?? Email bounced
unsubscribe ?? Recipient unsubscribed
spamreport ?? Marked as spam

Environment Variables

SENDGRID_WEBHOOK_PUBLIC_KEY    # For signature verification (optional)
SENDGRID_WEBHOOK_MAX_AGE_SECONDS  # Max timestamp age (default: 300)
WEBHOOK_PORT                   # Server port (default: 8089)
DISCORD_WEBHOOK_URL            # Discord webhook URL
WEBHOOK_LOG_FILE               # Log file path

The 80,000 Hours Concept

Career as finite inventory: 40 years × 2,000 hrs/year = 80,000 hours.

meter.py career --hours-worked 56000 --rate 85 --raise-pct 2.5
# → 12.3 years remaining, $2.4M earning potential