Skip to content

Commit 84eb93b

Browse files
authored
Merge pull request #5 from clawdbot/feat/heartbeat-cron
feat(cron): add hourly heartbeat job
2 parents b812c7f + dde572e commit 84eb93b

File tree

5 files changed

+109
-34
lines changed

5 files changed

+109
-34
lines changed

clawdinator/cron-jobs.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": 1,
3+
"jobs": [
4+
{
5+
"id": "heartbeat",
6+
"name": "heartbeat",
7+
"enabled": true,
8+
"schedule": {
9+
"kind": "cron",
10+
"expr": "0 * * * *"
11+
},
12+
"sessionTarget": "main",
13+
"wakeMode": "next-heartbeat",
14+
"payload": {
15+
"kind": "systemEvent",
16+
"text": "Read HEARTBEAT.md if exists. Consider outstanding tasks. Checkup sometimes on your human during (user local) day time."
17+
}
18+
}
19+
]
20+
}

clawdinator/workspace/HEARTBEAT.md

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,30 @@
1-
---
2-
summary: "Workspace template for HEARTBEAT.md"
3-
read_when:
4-
- Bootstrapping a workspace manually
5-
---
61
# HEARTBEAT.md
72

8-
Keep this file empty unless you want a tiny checklist. Keep it small.
3+
Hourly SITREP checklist:
94

10-
Checklist (CLAWDINATORS):
11-
- Run a SITREP using the triage skill (Now/Next/Later).
12-
- If nothing needs attention, reply HEARTBEAT_OK.
5+
1. Read AGENTS.md comms rules (terse chat, details to files)
6+
2. Read `/memory/index.md` and `/memory/sitrep-latest.md` for context
7+
3. Persist any relevant channel updates to today's daily memory file
8+
4. Run triage skill (`skills/triage/SKILL.md`):
9+
- Read `/memory/github/prs.md` and `/memory/github/issues.md`
10+
- Compare against previous sitrep for changes
11+
5. Write SITREP to `/memory/sitrep-latest.md` (overwrite):
12+
```markdown
13+
# SITREP YYYY-MM-DDTHH:MMZ
14+
15+
## 🔥 Fires
16+
- Active issues needing immediate attention
17+
18+
## ⚡ NOW
19+
- Single most important action to take
20+
21+
## 📊 Dashboard
22+
- PRs: X open (Y approved waiting)
23+
- Issues: X open (Y bugs, Z features)
24+
25+
## 🔄 Changes since last SITREP
26+
- NEW/CLOSED/UPDATED items
27+
```
28+
6. Append summary to today's daily file (`/memory/daily/YYYY-MM-DD.md`)
29+
7. Post terse summary to chat (3-5 lines, link to sitrep-latest.md)
30+
8. If nothing needs attention, reply HEARTBEAT_OK

clawdinator/workspace/skills/triage/SKILL.md

Lines changed: 46 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ You are a maintainer triage agent for the clawdbot org. Your job is to read the
1212
Trigger on:
1313
- "triage", "priorities", "what's hot", "what needs attention"
1414
- "status", "what's happening", "project health"
15-
- "what should I work on", "where do I start"
15+
- Hourly heartbeat SITREP
1616

1717
## Context Sources
1818

@@ -22,20 +22,24 @@ Read these files to understand current state:
2222
- `/memory/github/prs.md` — all open PRs across clawdbot org
2323
- `/memory/github/issues.md` — all open issues across clawdbot org
2424

25-
2. **Project context**:
25+
2. **Previous SITREP** (for delta):
26+
- `/memory/sitrep-latest.md` — last hourly sitrep
27+
28+
3. **Project context**:
2629
- `/memory/project.md` — project goals and priorities
2730
- `/memory/architecture.md` — architecture decisions
2831

29-
3. **Discord signals**:
30-
- Recent messages are already in your conversation context from lurk channels
32+
4. **Discord signals**:
33+
- Recent messages in conversation context from lurk channels
3134
- Cross-reference with GitHub issues where relevant
3235

3336
## Your Task
3437

35-
1. **Read AGENTS.md communication rules first** — they govern how you deliver output
38+
1. **Read AGENTS.md communication rules first** — they govern output delivery
3639
2. Read the raw data from memory files
37-
3. Reason about what's urgent, ready, blocked, or stale
38-
4. Produce a prioritized summary with clear recommendations
40+
3. Compare against previous sitrep for changes (new/closed/updated)
41+
4. Reason about what's urgent, ready, blocked, or stale
42+
5. Produce SITREP in the format below
3943

4044
## Priority Guidance
4145

@@ -45,34 +49,51 @@ Read these files to understand current state:
4549
- PRs with approvals waiting to merge = quick wins
4650
- Issues with no activity = potential neglect
4751

48-
## Output Format
52+
## Output Format (SITREP)
53+
54+
Write to `/memory/sitrep-latest.md`:
55+
56+
```markdown
57+
# SITREP YYYY-MM-DDTHH:MMZ
58+
59+
## 🔥 Fires
60+
- [#NNN](<url>) brief description (age, comment count)
61+
62+
## ⚡ NOW
63+
Single most important action: [describe with link]
4964

50-
Produce a concise Now/Next/Later summary:
65+
## 📊 Dashboard
66+
- PRs: X open (Y approved waiting, Z draft)
67+
- Issues: X open (Y bugs, Z features)
68+
- Sync: [timestamp from prs.md]
5169

52-
### NOW (needs attention today)
53-
- What: [item with link]
54-
- Why: [reason it's urgent]
55-
- Action: [recommended next step]
70+
## 🔄 Changes since last SITREP
71+
- NEW: #NNN description
72+
- CLOSED: #NNN description
73+
- UPDATED: #NNN significant update
5674

57-
### NEXT (this week)
58-
- What: [item with link]
59-
- Why: [reason it's important]
60-
- Action: [recommended next step]
75+
## 📋 Queue
76+
- **NOW:** [#NNN](<url>) — action needed
77+
- **NEXT:** [#NNN](<url>) — description
78+
- **LATER:** [#NNN](<url>) — description
79+
```
6180

62-
### LATER (backlog)
63-
- What: [item]
64-
- Notes: [any context]
81+
## Chat Output
6582

66-
### Quick Wins
67-
- [Approved PRs ready to merge, easy fixes, etc.]
83+
After writing sitrep-latest.md, post terse summary to chat (3-5 lines):
84+
```
85+
🔥 1 fire: #531 config bug
86+
⚡ NOW: Review #530 (macOS keychain)
87+
📊 6 PRs, 8 issues | Details: /memory/sitrep-latest.md
88+
```
6889

69-
### Signals
70-
- [Notable Discord mentions, patterns, community concerns]
90+
If nothing needs attention: `HEARTBEAT_OK`
7191

7292
## Constraints
7393

7494
- Be concise. Maintainers are busy.
75-
- Always include links to issues/PRs.
95+
- Always use masked links: `[#NNN](<url>)`
96+
- No markdown tables (use bullet lists).
7697
- If data is stale (>1hr old sync), note it.
7798
- If something is unclear, say so — don't guess.
7899
- Advisory only: don't take actions, just recommend.

nix/hosts/clawdinator-1-common.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ in
8888
};
8989
identity.name = "CLAWDINATOR-1";
9090
skills.allowBundled = [ "github" "clawdhub" ];
91+
cron = {
92+
enabled = true;
93+
store = "/etc/clawd/cron-jobs.json";
94+
};
9195
discord = {
9296
enabled = true;
9397
dm.enabled = false;
@@ -133,6 +137,8 @@ in
133137
selfUpdate.flakeHost = "clawdinator-1";
134138

135139
githubSync.enable = true;
140+
141+
cronJobsFile = ../../clawdinator/cron-jobs.json;
136142
};
137143
};
138144
}

nix/modules/clawdinator.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,12 @@ in
239239
description = "Optional path to a clawdbot.json file. Overrides config attr.";
240240
};
241241

242+
cronJobsFile = mkOption {
243+
type = types.nullOr types.path;
244+
default = null;
245+
description = "Optional path to a cron jobs JSON file (deployed to /etc/clawd/cron-jobs.json).";
246+
};
247+
242248
anthropicApiKeyFile = mkOption {
243249
type = types.nullOr types.str;
244250
default = null;
@@ -383,6 +389,10 @@ in
383389
];
384390

385391
environment.etc."clawd/clawdbot.json".source = configSource;
392+
environment.etc."clawd/cron-jobs.json" = lib.mkIf (cfg.cronJobsFile != null) {
393+
source = cfg.cronJobsFile;
394+
mode = "0644";
395+
};
386396
environment.etc."clawdinator/bin/memory-read" = {
387397
source = ../../scripts/memory-read.sh;
388398
mode = "0755";

0 commit comments

Comments
 (0)