ticlawk 0.1.17-dev.6 → 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.6",
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",
@@ -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([