ticlawk 0.1.17-dev.5 → 0.1.17-dev.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ticlawk",
3
- "version": "0.1.17-dev.5",
3
+ "version": "0.1.17-dev.7",
4
4
  "description": "Local connector that links agent harnesses (Claude Code, Codex, OpenClaw, opencode, Pi) to the Ticlawk mobile app.",
5
5
  "type": "module",
6
6
  "main": "ticlawk.mjs",
@@ -375,7 +375,7 @@ export async function getAgentServerInfo({ actingAgentId }) {
375
375
  // ── Reminders ──
376
376
 
377
377
  export async function scheduleAgentReminder({
378
- actingAgentId, title, fireAt, anchorConversationId, anchorMessageId,
378
+ actingAgentId, title, fireAt, anchorConversationId, anchorMessageId, recurrence,
379
379
  }) {
380
380
  return apiFetch('/api/agent/reminders', {
381
381
  method: 'POST',
@@ -385,6 +385,7 @@ export async function scheduleAgentReminder({
385
385
  fire_at: fireAt,
386
386
  anchor_conversation_id: anchorConversationId,
387
387
  anchor_message_id: anchorMessageId ?? null,
388
+ recurrence: recurrence ?? null,
388
389
  }),
389
390
  });
390
391
  }
@@ -557,6 +557,18 @@ export async function runReminderScheduleCommand(args) {
557
557
  console.error('--target or --anchor-conversation-id is required');
558
558
  return 2;
559
559
  }
560
+ // Optional recurrence: --recur-at HH:MM [--recur-tz <IANA>] [--recur-weekday 1,2,3].
561
+ // --fire-at remains the FIRST occurrence; the rule advances it after each fire.
562
+ let recurrence = null;
563
+ const recurAt = getArg(args, 'recur-at');
564
+ if (recurAt) {
565
+ const tz = getArg(args, 'recur-tz') || 'UTC';
566
+ const wdRaw = getArg(args, 'recur-weekday');
567
+ const byWeekday = wdRaw
568
+ ? String(wdRaw).split(',').map((s) => parseInt(s.trim(), 10)).filter((n) => n >= 1 && n <= 7)
569
+ : [];
570
+ recurrence = { at: recurAt, tz, ...(byWeekday.length ? { by_weekday: byWeekday } : {}) };
571
+ }
560
572
  const res = await daemonRequest({
561
573
  method: 'POST',
562
574
  path: '/agent/reminder/schedule',
@@ -567,6 +579,7 @@ export async function runReminderScheduleCommand(args) {
567
579
  target,
568
580
  anchor_conversation_id: anchorConversationId,
569
581
  anchor_message_id: anchorMessageId,
582
+ recurrence,
570
583
  },
571
584
  });
572
585
  printJson(res.body);
@@ -1425,7 +1438,7 @@ export const AGENT_COMMAND_HELP = {
1425
1438
  to a user, use \`ticlawk message send --attach <file>\` instead.
1426
1439
  `,
1427
1440
  reminder: `ticlawk reminder <schedule|list|snooze|update|cancel|log>
1428
- ticlawk reminder schedule --title <t> (--fire-at <iso> | --in-seconds N | --in-minutes N) (--target "<target>" | --anchor-conversation-id <id>) [--anchor-message-id <id>]
1441
+ ticlawk reminder schedule --title <t> (--fire-at <iso> | --in-seconds N | --in-minutes N) (--target "<target>" | --anchor-conversation-id <id>) [--anchor-message-id <id>] [--recur-at HH:MM [--recur-tz <IANA>] [--recur-weekday 1,2,3]]
1429
1442
  ticlawk reminder list [--status active|fired|canceled]
1430
1443
  ticlawk reminder snooze <reminder-id> (--fire-at <iso> | --in-seconds N | --in-minutes N)
1431
1444
  ticlawk reminder update <reminder-id> [--title <t>] [--fire-at <iso>]
@@ -1435,6 +1448,17 @@ export const AGENT_COMMAND_HELP = {
1435
1448
  Use reminders for follow-up that depends on future state you cannot resolve
1436
1449
  now. A reminder fires by posting a system message into the anchor
1437
1450
  conversation and waking the owner agent via an explicit delivery.
1451
+
1452
+ RECURRING: for a fixed cadence (e.g. a daily/weekly meal-time check-in), use
1453
+ ONE recurring reminder instead of enumerating many one-shots. Pass --recur-at
1454
+ (local HH:MM), --recur-tz (the owner's IANA timezone), and optionally
1455
+ --recur-weekday (ISO 1=Mon..7=Sun, comma-separated; omit for every day).
1456
+ --fire-at is still the FIRST occurrence; on each fire the reminder
1457
+ auto-advances to the next occurrence and stays active. Example — weekday
1458
+ 18:30 Beijing dinner check-in:
1459
+ ticlawk reminder schedule --title "晚餐" --anchor-conversation-id <id> \\
1460
+ --fire-at <next 18:30 Beijing as ISO> \\
1461
+ --recur-at 18:30 --recur-tz Asia/Shanghai --recur-weekday 1,2,3,4,5
1438
1462
  `,
1439
1463
  task: `ticlawk task <create|claim|unclaim|update|list>
1440
1464
  ticlawk task create --target "<target>" [--title <t>] [--assign-agent <agent-id>]
@@ -590,6 +590,7 @@ export async function handleReminderSchedule(req, body, ctx) {
590
590
  fireAt: body.fire_at,
591
591
  anchorConversationId,
592
592
  anchorMessageId: body?.anchor_message_id || null,
593
+ recurrence: body?.recurrence ?? null,
593
594
  });
594
595
  debugLog('agent-cli', 'reminder.schedule', {
595
596
  actingAgentId,
@@ -15,10 +15,10 @@ import { buildEnvelopeTarget, buildCharterBlock } from './wake-prompt.mjs';
15
15
  const STEP_GUIDES = {
16
16
  gap_analysis: {
17
17
  title: 'GAP ANALYSIS',
18
- body: `Compare the current state of the work against the goal and success criteria. Read whatever you need (charter, dashboard, task board, repo, prior messages) to judge where things actually stand. The dashboard is the owner's at-a-glance visualization of how far this goal has progressed — this step owns keeping it true to reality: if a durable goal has no dashboard yet, create it (\`ticlawk dashboard set\`); if overall progress has moved materially, refresh its content/data. See SURFACES.md.
19
- - If there is concrete executable work toward the goal, first make sure the next unit exists as a task (create/assign it with \`ticlawk task ...\` when a task fits), then report outcome=gap.
20
- - If the goal/milestone is fully met with no meaningful gap, make sure the dashboard reflects the completed state, then report outcome=no_gap. (The completed result is something the owner is waiting on surface it per the briefing rule below.)
21
- - If closing the gap depends on a future or external state that nobody can act on right now, schedule a reminder for the resume condition, then report outcome=wait.`,
18
+ body: `Compare the current state against the goal and success criteria. The [goal_context] block above gives you the open tasks, active reminders, and dashboard state — judge from it; read the charter/repo/prior messages only for what it doesn't cover. The dashboard is the owner's at-a-glance visualization of how far this goal has progressed — this step owns keeping it true to reality: create it if a durable goal has none, refresh it when progress moved materially (\`ticlawk dashboard set\`; see SURFACES.md).
19
+ - If there is concrete work to do NOW, make sure the next unit exists as a task (\`ticlawk task ...\`), then report outcome=gap.
20
+ - If nothing needs doing this instant but the goal is ONGOING/STANDING — its job is to keep something maintained and work recurs (e.g. an active recurring reminder above already covers the next occurrence) report outcome=wait. Do NOT report no_gap for a standing goal: it has no "done", and parking on no_gap would stop it from waking at the next occurrence. If nothing is scheduled to resume it yet, schedule a reminder first, then report wait.
21
+ - Report outcome=no_gap ONLY if the goal is genuinely, permanently met and will never need action again (an achievement goal that is finished). The completed result is something the owner is waiting on — surface it per the briefing rule below.`,
22
22
  outcomes: ['gap', 'no_gap', 'wait'],
23
23
  },
24
24
  execute: {
@@ -48,6 +48,31 @@ function readPayload(msg) {
48
48
  };
49
49
  }
50
50
 
51
+ // Per-step context: the claim attaches msg.goal_context (open tasks, active
52
+ // reminders, current task, dashboard) for transition deliveries. Render the
53
+ // slice THIS step needs so each step decides on facts, not guesses.
54
+ function buildGoalContextBlock(msg, step) {
55
+ const gc = msg && msg.goal_context && typeof msg.goal_context === 'object' ? msg.goal_context : null;
56
+ if (!gc) return '';
57
+ const lines = ['[goal_context] Current state for this goal (given to you — use it, do not re-derive):'];
58
+ if (step === 'gap_analysis' || !STEP_GUIDES[step]) {
59
+ const tasks = Array.isArray(gc.open_tasks) ? gc.open_tasks : [];
60
+ const rems = Array.isArray(gc.active_reminders) ? gc.active_reminders : [];
61
+ lines.push(`- open tasks (${tasks.length}): ${tasks.length
62
+ ? tasks.map((t) => `#${t.number} ${t.title} [${t.status}]`).join('; ')
63
+ : 'none'}`);
64
+ lines.push(`- active reminders (${rems.length}): ${rems.length
65
+ ? rems.map((r) => `"${r.title}" @ ${r.fire_at}${r.recurrence ? ' (recurring)' : ''}`).join('; ')
66
+ : 'none'}`);
67
+ lines.push(`- dashboard: ${gc.dashboard ? 'exists' : 'none yet'}`);
68
+ } else {
69
+ const ct = gc.current_task;
70
+ lines.push(ct ? `- current task: #${ct.number} ${ct.title} [${ct.status}]` : '- current task: (none set)');
71
+ }
72
+ lines.push('[/goal_context]');
73
+ return lines.join('\n');
74
+ }
75
+
51
76
  function buildGoalStepHeader(msg, { step, transitionId, goalVersion, kind }) {
52
77
  const target = buildEnvelopeTarget(msg);
53
78
  const time = msg.created_at || new Date().toISOString();
@@ -66,6 +91,8 @@ export function buildGoalStepPrompt(msg) {
66
91
 
67
92
  const sections = [];
68
93
  if (charterBlock) sections.push(charterBlock);
94
+ const goalContextBlock = buildGoalContextBlock(msg, step);
95
+ if (goalContextBlock) sections.push(goalContextBlock);
69
96
 
70
97
  if (guide) {
71
98
  sections.push([
@@ -39,3 +39,5 @@ Use `ticlawk credential request --name <ENV_VAR>` to create the credential slot.
39
39
  ## Reminders
40
40
 
41
41
  Use reminders only for external/time-based future follow-up or visible, persistent resume conditions. Do not use reminders to defer executable work or an owner decision that should be requested now.
42
+
43
+ For a fixed cadence (a daily or weekly check-in, e.g. meal-time reminders), use ONE recurring reminder, not many enumerated one-shots: `ticlawk reminder schedule ... --recur-at HH:MM --recur-tz <owner IANA tz> [--recur-weekday 1,2,3]`. It auto-advances to the next occurrence on each fire and stays active, so the cadence never runs out.