@questionbase/deskfree 0.3.0-alpha.2 → 0.3.0-alpha.21

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.
Files changed (52) hide show
  1. package/README.md +24 -14
  2. package/dist/index.d.ts +745 -6
  3. package/dist/index.js +9192 -18
  4. package/dist/index.js.map +1 -1
  5. package/package.json +8 -9
  6. package/skills/deskfree/SKILL.md +510 -221
  7. package/skills/deskfree/references/tools.md +144 -0
  8. package/dist/channel.d.ts +0 -3
  9. package/dist/channel.d.ts.map +0 -1
  10. package/dist/channel.js +0 -505
  11. package/dist/channel.js.map +0 -1
  12. package/dist/client.d.ts +0 -143
  13. package/dist/client.d.ts.map +0 -1
  14. package/dist/client.js +0 -246
  15. package/dist/client.js.map +0 -1
  16. package/dist/deliver.d.ts +0 -22
  17. package/dist/deliver.d.ts.map +0 -1
  18. package/dist/deliver.js +0 -350
  19. package/dist/deliver.js.map +0 -1
  20. package/dist/gateway.d.ts +0 -13
  21. package/dist/gateway.d.ts.map +0 -1
  22. package/dist/gateway.js +0 -836
  23. package/dist/gateway.js.map +0 -1
  24. package/dist/index.d.ts.map +0 -1
  25. package/dist/llm-definitions.d.ts +0 -117
  26. package/dist/llm-definitions.d.ts.map +0 -1
  27. package/dist/llm-definitions.js +0 -121
  28. package/dist/llm-definitions.js.map +0 -1
  29. package/dist/offline-queue.d.ts +0 -45
  30. package/dist/offline-queue.d.ts.map +0 -1
  31. package/dist/offline-queue.js +0 -109
  32. package/dist/offline-queue.js.map +0 -1
  33. package/dist/paths.d.ts +0 -10
  34. package/dist/paths.d.ts.map +0 -1
  35. package/dist/paths.js +0 -29
  36. package/dist/paths.js.map +0 -1
  37. package/dist/runtime.d.ts +0 -17
  38. package/dist/runtime.d.ts.map +0 -1
  39. package/dist/runtime.js +0 -24
  40. package/dist/runtime.js.map +0 -1
  41. package/dist/tools.d.ts +0 -23
  42. package/dist/tools.d.ts.map +0 -1
  43. package/dist/tools.js +0 -437
  44. package/dist/tools.js.map +0 -1
  45. package/dist/types.d.ts +0 -438
  46. package/dist/types.d.ts.map +0 -1
  47. package/dist/types.js +0 -2
  48. package/dist/types.js.map +0 -1
  49. package/dist/workspace.d.ts +0 -18
  50. package/dist/workspace.d.ts.map +0 -1
  51. package/dist/workspace.js +0 -83
  52. package/dist/workspace.js.map +0 -1
@@ -1,315 +1,604 @@
1
1
  ---
2
2
  name: deskfree
3
- description: Workflow knowledge for DeskFree task management and messaging.
4
- version: 3.0.0
3
+ description: >
4
+ DeskFree task management and human-AI collaboration workflows.
5
+ Use when: creating tasks, managing work items, updating deliverables,
6
+ communicating with humans through DeskFree, checking workspace state,
7
+ handling task lifecycle (start → work → complete → review),
8
+ evaluating completed tasks, updating ways of working, managing initiatives.
9
+ Do NOT use for: general project management advice without DeskFree tools,
10
+ OpenClaw configuration or gateway setup, non-DeskFree platforms (Jira, Asana, etc.),
11
+ direct file/code operations (use standard tools for those, create DeskFree tasks for tracking).
12
+ version: 7.0.0
5
13
  metadata: { 'openclaw': { 'emoji': '🏠' } }
6
14
  ---
7
15
 
8
16
  # DeskFree Workflow Guide
9
17
 
10
- > **Overview:** This guide teaches AI agents how to work with DeskFree a task management platform for human-AI collaboration. Use it to create goals, manage tasks, update deliverables, and communicate with humans through structured workflows.
18
+ ## ⚠️ CriticalRead First
11
19
 
12
- ## Table of Contents
20
+ ### State Machine (memorize this)
13
21
 
14
- - [🚀 Quick Start](#-quick-start)
15
- - [🎯 Goals](#-goals)
16
- - [💬 Messaging](#-messaging)
17
- - [🔁 Auto-Threading](#-auto-threading)
18
- - [🔄 Task Workflow](#-task-workflow)
19
- - [🛠️ Tools Reference](#️-tools-reference)
20
- - [📋 Decision Tree](#-decision-tree)
21
- - [📝 Deliverable Best Practices](#-deliverable-best-practices)
22
- - [❌ Error Handling](#-error-handling)
23
- - [🔧 Troubleshooting](#-troubleshooting)
22
+ ```
23
+ 🎯 Initiative lifecycle
24
+ suggest_tasks ──────────────────────────────────────────────────────────────────┐
25
+ + initiativeSuggestions → [human approves initiative] → active │
26
+ [human rejects initiative] → deleted │
27
+
28
+ suggest_tasks [human approves] → bot → [start_task] → bot (is_working)
29
+ ↑ │ │
30
+ | human approves/declines │ │
31
+ └──────────────────────────────────────────┘ │
32
+ │ │
33
+ [complete_task] │
34
+ ↓ │
35
+ human │
36
+ │ │
37
+ [approve] │
38
+ ↓ │
39
+ done ──→ [evaluate] ──┘
40
+
41
+ globalWoW updated (always)
42
+ + initiative updated (if task has initiative_id)
43
+ ```
24
44
 
25
- ## 🚀 Quick Start
45
+ - `complete_task` outcome `done` = work complete for review
46
+ - `complete_task` outcome `blocked` = need human input (send message FIRST explaining why)
47
+ - Both outcomes move to `human` — the human triages from there
48
+ - When human approves (`done`), a pending evaluation is created for ways-of-working update
26
49
 
27
- ### Getting Started
50
+ ### The Work Loop
28
51
 
29
- When a user starts a conversation, listen for their intent. If they express an ambition or objective ("I want to grow my LinkedIn following"), create a **Goal** — not just a task. Goals drive the entire experience.
52
+ ```
53
+ 1. Check state → deskfree_state — see tasks, active initiatives, pending evaluations
54
+ 2. Suggest tasks → deskfree_suggest_tasks — propose work + optional initiative suggestions
55
+ 3. Claim a task → deskfree_start_task — read instructions + parent context
56
+ 4. Do the work → deskfree_update_deliverable — build incrementally
57
+ 5. Suggest follow-ups → if work reveals more to do, suggest them (link to initiative)
58
+ 6. Complete → deskfree_complete_and_suggest (or deskfree_complete_task) — deliverable required
59
+ 7. Evaluate → if approved tasks have pending WoW evaluation (update globalWoW + initiative)
60
+ ```
30
61
 
31
- ## 🎯 Goals
62
+ ### Three Rules That Break Everything If Ignored
32
63
 
33
- Goals are the primary way users express what they want to achieve. A goal is a high-level objective broken into actionable tasks.
64
+ 1. **Always suggest first.** Use `deskfree_suggest_tasks` before starting ANY work. Tasks go through human approval. No exceptions.
65
+ 2. **Always check state first.** Call `deskfree_state` before suggesting tasks. Prevents duplicates, shows active initiatives.
66
+ 3. **Always complete tasks.** Never leave a task in `bot` (is_working=true). End with `deskfree_complete_and_suggest` or `deskfree_complete_task` — outcome `done` or `blocked`.
34
67
 
35
- ### Goal-Driven Workflow
68
+ ### Writing Great Instructions
36
69
 
37
- 1. **User states an ambition** Create a Goal with `deskfree_create_goal`
38
- 2. **Break it down** Create 3-5 tasks linked to the goal (`deskfree_create_task` with `goalId`)
39
- 3. **Start immediately** Start the first task and begin working. Don't wait for permission.
40
- 4. **Keep responses SHORT** → "On it. Setting up your goal now." Not a wall of advice.
41
- 5. **Drip tasks** Never more than 3 pending tasks per goal. When one completes, create the next.
70
+ Write instructions as if briefing a contractor who has never seen the codebase. Include:
71
+ - **What to do** specific, actionable steps
72
+ - **Why** referencing parent findings or deliverable when applicable
73
+ - **What "done" looks like** clear acceptance criteria
74
+ - **Known constraints** gotchas, dependencies, things to avoid
42
75
 
43
- ### When to Create a Goal vs. a Task
76
+ ### Deliverable Requirements
44
77
 
45
- | Signal | Action |
46
- |---|---|
47
- | "I want to become a LinkedIn influencer" | **Goal** — multi-step objective |
48
- | "Write a blog post about X" | **Task** — single deliverable |
49
- | "Help me grow my business" | **Goal** — needs breakdown |
50
- | "Fix this bug" | **Task** — one action |
78
+ **MUST update deliverable before completing with outcome "done".** Minimum: structured summary of what was found/done, decisions made, and recommendations. An empty or placeholder deliverable will be rejected.
51
79
 
52
- ### Goal Health Checks
80
+ ### Suggesting Follow-ups
53
81
 
54
- - Use `deskfree_state` to review active goals and pending tasks
55
- - If a goal has no pending tasks, create the next one
56
- - If a goal is stale (48h no activity), either create a task or ask the human
57
- - When all tasks are done and the objective is met, mark goal as completed with `deskfree_update_goal`
82
+ When completing, always consider: does this work reveal follow-up tasks? If yes, suggest them. Your suggestions are strongest at this moment because you have full context.
58
83
 
59
- ## 💬 Messaging
84
+ Use `deskfree_complete_and_suggest` to complete and suggest in one atomic call. Estimate token cost per suggestion — consider how many files to read, how much reasoning, how much output.
60
85
 
61
- You are connected to DeskFree via a 1:1 messaging channel. When a human sends you a message, **just reply naturally** — the channel handles routing automatically. You do not need to use any tool to send or receive messages.
86
+ ### Building the Chain
62
87
 
63
- - **Inbound:** Human messages appear as regular conversation messages with full context
64
- - **Outbound:** Your replies are automatically delivered back to the human
65
- - **Threading:** Messages may be linked to a task ID. When replying in task context, your messages are automatically threaded to that task
66
- - **Task context:** If you receive a message with task context, your replies will be threaded to that task automatically
88
+ You're not just doing tasks you're building a chain. The instructions you write become someone else's brief. The deliverable you produce becomes someone else's context. Write both with care.
67
89
 
68
- No special syntax, no user IDs, no targeting required. Just respond to the conversation.
90
+ ### Auto-Threading
69
91
 
70
- ### Using `deskfree_send_message`
71
- Use the `deskfree_send_message` tool only for:
72
- - **Progress updates** during task execution ("Starting phase 2...", "Encountered an issue with X")
73
- - **Questions** that need human input mid-task ("Should I proceed with approach A or B?")
74
- - **Status reports** for long-running tasks ("50% complete, ETA 2 hours")
92
+ After `deskfree_start_task`, ALL your outbound messages automatically thread into that task. No need to pass `taskId` to `deskfree_send_message`. After `deskfree_complete_task`, auto-threading stops.
75
93
 
76
- **Don't use it for:** Normal conversation replies (those are handled automatically by the channel).
94
+ The task sidebar is your human's window into your work every message appears there in real-time.
77
95
 
78
- ## 🔁 Auto-Threading
96
+ ---
79
97
 
80
- **Your messages are automatically threaded into your active task. No need to specify taskId manually.**
98
+ ## Initiatives Long-Lived Areas of Focus
81
99
 
82
- When you start a task, the plugin tracks it as your "active task." From that point on, **all outbound messages** whether replies, progress updates, or proactive messages — are automatically threaded into that task's conversation. This means:
100
+ Initiatives answer **"what are we working on and why"** while Ways of Working answers **"how do we work."**
83
101
 
84
- - After `deskfree_start_task`: all your messages thread into that task
85
- - After `deskfree_complete_task`: auto-threading stops
86
- - You never need to pass `taskId` to `deskfree_send_message` manually (though you still can to override)
87
- - The task sidebar shows a complete timeline of your work every message, every update
102
+ | Concept | What it is |
103
+ |---|---|
104
+ | **Initiative** | A persistent area of focus (e.g. "Auth Hardening", "Performance Sprint") |
105
+ | **Initiative Content** | A versioned markdown doc current state, approach, next priorities |
106
+ | **Task → Initiative link** | Set `initiativeId` on suggestions to link tasks to an initiative |
88
107
 
89
- **The task sidebar is your human's window into your work. Make it useful.** Every message you send while working on a task appears there, giving your human real-time visibility into progress without them having to ask.
108
+ ### When to Propose a New Initiative
90
109
 
91
- ## 🔄 Task Workflow
110
+ ```
111
+ On every suggest_tasks call, ask yourself:
112
+
113
+ "Does an active initiative exist that this work belongs to?"
114
+ → Yes: set initiativeId on the relevant suggestions
115
+ → No, but this is part of a bigger theme: add an initiativeSuggestion
116
+ → No, and it's a one-off task: no initiative needed
117
+ ```
92
118
 
93
- Tasks follow a strict state machine. Understand this before using any tool.
119
+ ### Initiative Suggestion Flow
94
120
 
95
121
  ```
96
- createready_for_bot [start_task] working_on_it [complete_task] → waiting_for_human
97
- ↑ |
98
- | orchestrator triages human reply |
99
- └──────────────────────────────────────────────────────────────┘
100
- |
101
- [approve] done
122
+ 1. deskfree_state() check initiatives[] for existing active ones
123
+
124
+ 2. deskfree_suggest_tasks({
125
+ suggestions: [
126
+ { title: "Audit auth endpoints", estimatedTokens: 20000 },
127
+ { title: "Add rate limiting", estimatedTokens: 15000 }
128
+ ],
129
+ initiativeSuggestions: [
130
+ {
131
+ title: "Auth Hardening",
132
+ content: "# Auth Hardening\n\n## Current State\nNeed to improve auth security.\n\n## Approach\nTBD — start with audit.\n\n## Next Priorities\n1. Audit all auth endpoints\n2. Address findings",
133
+ taskRefs: [0, 1] // auto-links tasks at index 0 and 1 when approved
134
+ }
135
+ ]
136
+ })
137
+
138
+ Human sees:
139
+ 🎯 New Initiative: "Auth Hardening" [Approve] [Reject]
140
+ 📋 Task: "Audit auth endpoints..." [Approve] [Reject]
141
+ 📋 Task: "Add rate limiting..." [Approve] [Reject]
102
142
  ```
103
143
 
104
- ### Statuses
144
+ ### Linking Tasks to Existing Initiatives
105
145
 
106
- | Status | Meaning |
107
- |---|---|
108
- | `ready_for_bot` | Available for a bot to start |
109
- | `working_on_it` | A bot is actively working on this task |
110
- | `waiting_for_human` | Bot completed or is blocked — awaiting human review/input |
111
- | `done` | Human approved the deliverable |
146
+ ```
147
+ deskfree_state() → sees initiatives: [{ id: "init_abc", title: "Auth Hardening", status: "active" }]
148
+
149
+ deskfree_suggest_tasks({
150
+ suggestions: [
151
+ { title: "Implement CSRF protection",
152
+ instructions: "...",
153
+ estimatedTokens: 25000,
154
+ initiativeId: "init_abc" // link to existing initiative
155
+ }
156
+ ]
157
+ // no initiativeSuggestions needed — initiative already exists
158
+ })
159
+ ```
112
160
 
113
- ### complete_task outcomes
161
+ ---
114
162
 
115
- - **`done`** Work is complete; deliverable is ready for human review
116
- - **`blocked`** — Bot needs human input to proceed; send a message explaining the blocker first, then complete as blocked
163
+ ## Ways of Working The Evolving Playbook
117
164
 
118
- Both outcomes move the task to `waiting_for_human`. The human triages from there.
165
+ Ways of Working is a **single versioned markdown document** per bot that evolves as you complete tasks. It's your institutional memory — capturing patterns, preferences, and learnings across all work.
119
166
 
120
- ## 🛠️ Tools Reference
167
+ **Key properties:**
168
+ - Injected automatically via `deskfree_state` (the `waysOfWorking` field)
169
+ - Read it before starting work to understand established patterns
170
+ - Updated after task approval via the evaluation flow (never manually during work)
171
+ - Each update creates a new immutable version — full history preserved
121
172
 
122
- ### Orchestrator tools (8)
173
+ ### Evaluation Flow — Dual Output
123
174
 
124
- | Tool | Description |
125
- |---|---|
126
- | `deskfree_state` | Full workspace snapshot — goals, tasks, recently done |
127
- | `deskfree_create_goal` | Create a high-level objective |
128
- | `deskfree_update_goal` | Update goal status, title, or description |
129
- | `deskfree_create_task` | Create task (starts as `ready_for_bot`), link to goal with `goalId` |
130
- | `deskfree_start_task` | Claim a `ready_for_bot` task → `working_on_it`; returns full context (instructions, deliverable, messages) |
131
- | `deskfree_update_deliverable` | Build the task deliverable incrementally |
132
- | `deskfree_complete_task` | Mark task done or blocked → `waiting_for_human` |
133
- | `deskfree_send_message` | Send a message in the task thread |
175
+ When a human approves a task, it enters `pendingEvaluations` in state.get. Evaluation now has **two independent outputs**:
134
176
 
135
- ### Worker tools (3 — for sub-agents only)
177
+ ```
178
+ 1. deskfree_claim_evaluation(taskId)
179
+ → returns: task + messages + waysOfWorking + initiative (if task has initiative_id)
136
180
 
137
- Sub-agents are ephemeral workers that handle a single task. They receive their context from the spawn prompt (populated from `deskfree_start_task` response) and only have access to:
181
+ 2. Read the task deliverable and messages thoroughly
138
182
 
139
- | Tool | Description |
140
- |---|---|
141
- | `deskfree_update_deliverable` | Build the task deliverable incrementally |
142
- | `deskfree_complete_task` | Mark task done or blocked → `waiting_for_human` |
143
- | `deskfree_send_message` | Send a message in the task thread |
183
+ 3. Ask yourself:
184
+ "Did I learn something about HOW we work that applies everywhere?"
185
+ Yes: update globalWoW
144
186
 
145
- Sub-agents **cannot** create goals, create tasks, or read workspace state. They only work on the task they were spawned for.
187
+ "Did I learn something about WHERE this initiative stands or
188
+ HOW to approach this specific area?"
189
+ → Yes: update initiative content
146
190
 
147
- ### Self-Tasking
191
+ Both? → update both
192
+ Neither? → hasChanges: false for both
148
193
 
149
- **ALWAYS create a task before starting work.** This applies whether a human asked you to do something or you're working proactively. Tasks are cheap — when in doubt, create one.
194
+ 4. deskfree_submit_evaluation({
195
+ taskId,
196
+ reasoning: "...",
197
+ globalWoW: { hasChanges: true, updatedContent: "..." },
198
+ initiative: { hasChanges: false }
199
+ })
200
+ ```
150
201
 
151
- **Why:** Tasks give your human visibility into what you're doing, create a paper trail of deliverables, and let you collaborate through comments. Work without a task is invisible work.
202
+ **globalWoW** patterns that apply to all work everywhere. Examples:
203
+ - A better approach to error handling you discovered
204
+ - A recurring mistake to avoid
205
+ - A tool or service pattern that's universally useful
152
206
 
153
- **Orchestrator flow:**
154
- 1. **Create:** `deskfree_create_task` with a clear title and instructions
155
- 2. **Start:** `deskfree_start_task` with the task ID → moves to `working_on_it`, returns full context
156
- 3. **Work:** Do the work. Start building the deliverable immediately with `deskfree_update_deliverable` — don't wait until the end.
157
- 4. **Complete:** `deskfree_complete_task` with outcome `done` or `blocked`
207
+ **initiative content** — what was learned about this specific area of focus. Examples:
208
+ - Current state of the initiative has changed (task completed a major piece)
209
+ - New findings shifted the approach
210
+ - Next priorities should be reordered
158
211
 
159
- **Sub-agent pattern (recommended for longer tasks):**
160
- 1. Orchestrator creates the task with `deskfree_create_task`
161
- 2. Orchestrator calls `deskfree_start_task` → gets full context (instructions, deliverable, messages)
162
- 3. Orchestrator spawns a sub-agent, passing the task context in the spawn prompt
163
- 4. Sub-agent works, updates deliverable incrementally, then calls `deskfree_complete_task`
164
- 5. Sub-agent terminates — one task per sub-agent, context stays clean
212
+ **When NOT to update either:** One-off tasks with no transferable learnings, standard work that matched existing patterns.
165
213
 
166
- ### Task Titles: Examples
214
+ ### Example Evaluation
167
215
 
168
- **Good titles (short, scannable, action-oriented):**
169
- - "Research competitor HumanLayer"
170
- - "Deploy staging environment hotfix"
171
- - "Analyze Q3 sales data trends"
172
- - "Write API documentation for /users endpoint"
216
+ ```
217
+ Task "Audit auth endpoints" (linked to "Auth Hardening" initiative) is approved.
218
+
219
+ claim_evaluation returns:
220
+ task (with deliverable showing 3 critical issues found)
221
+ waysOfWorking: "..."
222
+ initiative: { id: "init_abc", title: "Auth Hardening", content: "No audit done yet." }
223
+
224
+ Analysis:
225
+ - Gateway has built-in rate limiting (just needs config) → applies everywhere → update globalWoW
226
+ - Audit found 3 critical issues → initiative content needs update → update initiative
227
+
228
+ submit_evaluation({
229
+ taskId: "audit-task",
230
+ reasoning: "Audit found 3 issues. Gateway has rate limiting built in — updated both.",
231
+ globalWoW: {
232
+ hasChanges: true,
233
+ updatedContent: "...## Infrastructure\n- Always check AWS API Gateway config before building custom middleware\n..."
234
+ },
235
+ initiative: {
236
+ hasChanges: true,
237
+ updatedContent: "# Auth Hardening\n\n## Current State\nAudit complete. Found 3 critical issues:\n1. Session fixation\n2. No rate limiting (gateway supports it — just needs config)\n3. Weak CSRF\n\n## Next Priorities\n1. Configure gateway rate limiting (quick win)\n2. Fix session fixation\n3. Implement CSRF tokens"
238
+ }
239
+ })
240
+ ```
173
241
 
174
- **Bad titles (verbose, unclear scope):**
175
- - "Do some research on a competitor called HumanLayer and write up findings"
176
- - "There's a bug in the staging environment that needs to be fixed somehow"
177
- - "Look at the sales numbers and figure out what's going on"
178
- - "Document stuff for the API"
242
+ ---
243
+
244
+ ## Validation Gates
245
+
246
+ ### Pre-Flight (before ANY work)
247
+
248
+ - [ ] Called `deskfree_state` — confirmed it returned data (not empty/error)
249
+ - [ ] Read `waysOfWorking` if present — apply established patterns
250
+ - [ ] Read `initiatives` if present — check for active initiatives this work belongs to
251
+ - [ ] Checked for existing tasks that match intent — no duplicates
252
+ - [ ] Suggested a task via `deskfree_suggest_tasks` — with `initiativeId` if linking to existing initiative, or `initiativeSuggestions` if proposing new one
253
+ - [ ] Once approved: called `deskfree_start_task` — confirmed task moved to `bot` (is_working=true)
179
254
 
180
- ### When to Use Main Session vs. Sub-Agent
255
+ ### Mid-Work
181
256
 
182
- **Stay in main session for:**
183
- - Quick tasks (< 5 minutes): Simple lookups, config changes, one-liner scripts
184
- - Interactive work: Tasks requiring back-and-forth with the human
185
- - Urgent fixes: Immediate response needed, no time for sub-agent setup
257
+ - [ ] Deliverable started immediately after starting task (not waiting until end)
258
+ - [ ] `deskfree_update_deliverable` succeeded (no error response)
259
+ - [ ] If blocked: sent message explaining WHY before calling `complete_task` with `blocked`
186
260
 
187
- **Use sub-agent for:**
188
- - Research tasks: Multi-step analysis, data gathering, report writing
189
- - Code development: Writing features, debugging, refactoring
190
- - Long operations: Tasks taking > 10 minutes or requiring multiple steps
191
- - Background work: When human might message while you're working
261
+ ### Pre-Completion
262
+
263
+ - [ ] Deliverable is non-empty and meaningful (not just headers/placeholders)
264
+ - [ ] Deliverable is well-structured markdown that stands alone
265
+ - [ ] Called `deskfree_complete_task` confirmed task moved to `human`
266
+ - [ ] If sub-agent: terminated after completion (one task per sub-agent)
267
+
268
+ ### Heartbeat Evaluation Check
269
+
270
+ - [ ] Any `pendingEvaluations` in state? → claim and evaluate each one (submit globalWoW + initiative outputs)
271
+
272
+ ---
273
+
274
+ ## Task Workflow
275
+
276
+ ### Orchestrator Flow (main session)
192
277
 
193
- **Sub-agent handoff pattern:**
194
278
  ```
195
- Orchestrator: deskfree_create_task deskfree_start_task spawn sub-agent with task context
196
- Sub-agent: (context from spawn prompt) deskfree_update_deliverable deskfree_complete_task
279
+ 1. deskfree_state assess workspace + read ways of working + check active initiatives
280
+ 2. deskfree_suggest_tasks → suggest tasks (with estimatedTokens, initiativeId, initiativeSuggestions)
281
+ 3. deskfree_start_task → claim approved task (returns full context + parent context)
282
+ 4. deskfree_update_deliverable → build incrementally as you work
283
+ 5. deskfree_complete_and_suggest → complete + suggest follow-ups (or deskfree_complete_task if no follow-ups)
197
284
  ```
198
285
 
199
- ## 📋 Decision Tree
286
+ ### Sub-Agent Flow (recommended for tasks > 5 min)
200
287
 
201
- **Checking for work (heartbeat / proactive loop):**
202
- 1. Call `deskfree_state` to get full workspace snapshot
203
- 2. **Active goals without pending tasks?** Create the next task with `deskfree_create_task`
204
- 3. **`ready_for_bot` tasks?** Check capacity, then `deskfree_start_task` and spawn sub-agents
205
- 4. **Goals with no activity in 48h?** Create a task or send a message nudging the human
206
- 5. **`working_on_it` tasks with no active sub-agent?** Complete as blocked or resume
288
+ ```
289
+ Orchestrator: deskfree_suggest_tasks (human approves) → deskfree_start_task → spawn sub-agent with full task context
290
+ Sub-agent: deskfree_update_deliverable (incrementally) deskfree_complete_task terminate
291
+ ```
207
292
 
208
- **When given work by a human (chat message):**
209
- 1. Create a task via `deskfree_create_task`
210
- 2. Start it via `deskfree_start_task`
211
- 3. Work on it, build deliverable incrementally, then `deskfree_complete_task` with outcome `done`
293
+ Sub-agents have **4 tools:** `deskfree_update_deliverable`, `deskfree_complete_task`, `deskfree_send_message` (also supports task suggestions), `deskfree_submit_evaluation`. They cannot suggest tasks, read workspace state, or claim evaluations.
212
294
 
213
- **When blocked:**
214
- 1. Send a message explaining the blocker with `deskfree_send_message`
215
- 2. Then call `deskfree_complete_task` with outcome `blocked`
216
- 3. Terminate — the human will triage
295
+ ### When to Use Main vs Sub-Agent
217
296
 
218
- ## Human Review Outcomes
297
+ | Main session | Sub-agent |
298
+ |---|---|
299
+ | Quick tasks (< 5 min) | Research, reports, analysis |
300
+ | Interactive/back-and-forth | Code development, debugging |
301
+ | Urgent fixes | Long operations (> 10 min) |
302
+ | | Background work while human may message |
303
+
304
+ ---
305
+
306
+ ## Messaging
307
+
308
+ **Normal replies:** Just respond — the channel handles routing automatically. No tool needed.
309
+
310
+ **Use `deskfree_send_message` only for:**
311
+ - Progress updates during task execution
312
+ - Questions needing human input mid-task
313
+ - Status reports for long-running tasks
314
+
315
+ **Never use it for:** Normal conversation replies (channel handles those).
316
+
317
+ ---
318
+
319
+ ## Decision Tree
320
+
321
+ ### Heartbeat / Proactive Check
322
+
323
+ 1. `deskfree_state` → get workspace snapshot + check `waysOfWorking` + `initiatives` + `pendingEvaluations`
324
+ 2. `pendingEvaluations`? → `deskfree_claim_evaluation` → `deskfree_submit_evaluation` (with globalWoW + initiative outputs)
325
+ 3. `bot` tasks? → `deskfree_start_task` + spawn sub-agents
326
+ 4. `bot` (is_working=true) with no active sub-agent? → Complete as blocked or resume
327
+
328
+ ### Human Gives You Work
329
+
330
+ 1. `deskfree_state` → check existing tasks + read ways of working + check active initiatives
331
+ 2. Does this work belong to an active initiative? → set `initiativeId` on suggestions
332
+ OR is this starting a new area of focus? → add `initiativeSuggestions`
333
+ 3. `deskfree_suggest_tasks` → suggest with clear title + instructions
334
+ 4. [human approves] → `deskfree_start_task` → claim it
335
+ 5. Work → `deskfree_update_deliverable` incrementally
336
+ 6. `deskfree_complete_task` → outcome `done` or `blocked`
337
+
338
+ ---
339
+
340
+ ## Tools Reference
341
+
342
+ > **Full parameter details:** See `references/tools.md`
343
+
344
+ ### Orchestrator (10 tools)
345
+
346
+ | Tool | What it does |
347
+ |---|---|
348
+ | `deskfree_state` | Full workspace snapshot — tasks, recently done, ways of working, active initiatives, pending evaluations |
349
+ | `deskfree_suggest_tasks` | Suggest tasks for human approval (with estimatedTokens, initiativeId, initiativeSuggestions) |
350
+ | `deskfree_start_task` | Claim task → `bot` (is_working=true), returns full context + parent context |
351
+ | `deskfree_update_deliverable` | Build deliverable markdown incrementally |
352
+ | `deskfree_complete_task` | Mark done or blocked → `human` |
353
+ | `deskfree_complete_and_suggest` | Complete current task + suggest follow-ups in one atomic call |
354
+ | `deskfree_send_message` | Message in task thread |
355
+ | `deskfree_claim_evaluation` | Claim a pending evaluation — returns task, messages, globalWoW, and initiative (if applicable) |
356
+ | `deskfree_submit_evaluation` | Submit evaluation with dual output: globalWoW + initiative (each independently updatable) |
357
+
358
+ ### Worker (4 tools — sub-agents only)
219
359
 
220
- - **Approve:** Task moves to `done`. Work is accepted.
221
- - **Decline / request changes:** Task returns to `ready_for_bot` with feedback. Orchestrator can restart it.
360
+ `deskfree_update_deliverable`, `deskfree_complete_task`, `deskfree_send_message`, `deskfree_submit_evaluation`
222
361
 
223
- ## Rules
362
+ ---
363
+
364
+ ## Deliverable Best Practices
365
+
366
+ ### Choosing a format
367
+
368
+ `deskfree_update_deliverable` accepts an optional `format` parameter:
369
+
370
+ | Format | Use when |
371
+ |---|---|
372
+ | `markdown` (default) | Text reports, analysis, documentation, code — anything prose-based |
373
+ | `html` | Rich web content: dashboards, styled reports, interactive tables, data visualizations |
224
374
 
225
- 1. **Always self-task:** Create a DeskFree task before starting work tasks are cheap, invisible work is expensive
226
- 2. **Build deliverables early:** Start `deskfree_update_deliverable` from the beginning, not at the end
227
- 3. **Use deskfree_state first:** Always read workspace state before creating tasks or starting work
228
- 4. **No manual status changes:** All state transitions happen through the tools above
229
- 5. **Deliverables in markdown:** Build up the deliverable incrementally using `deskfree_update_deliverable`
230
- 6. **Always complete tasks:** End with `deskfree_complete_task` (outcome `done` or `blocked`) — never leave tasks in `working_on_it`
231
- 7. **Blocked means message first:** Before completing as blocked, send a message explaining why
232
- 8. **One task per sub-agent:** Spawn a dedicated sub-agent for each task to keep context clean
233
- 9. **Sub-agents have 3 tools only:** update_deliverable, complete_task, send_message — nothing else
234
- 10. **Auto-threading just works:** Your messages automatically thread into your active task — no manual taskId needed
375
+ HTML deliverables are rendered in a **sandboxed iframe** (no access to parent page). Use `format="html"` when layout and styling matter for the human's review. Use `format="markdown"` for everything else.
235
376
 
236
- ## 📝 Deliverable Best Practices
377
+ ### Markdown deliverables
237
378
 
238
- Deliverables should be **markdown documents** that stand alone. Structure them like a professional report:
379
+ Structure as **standalone markdown documents:**
239
380
 
240
- ### Good Deliverable Structure
241
381
  ```markdown
242
382
  # Task Title
243
383
 
244
384
  ## Summary
245
385
  Brief overview of what was accomplished.
246
386
 
247
- ## Key Findings
248
- - Main point 1 with supporting detail
249
- - Main point 2 with supporting detail
387
+ ## Key Findings / Results
388
+ - Main points with supporting detail
250
389
 
251
390
  ## Details
252
- ### Section 1
253
- Detailed analysis...
254
-
255
- ### Section 2
256
- Implementation notes...
391
+ Detailed analysis, implementation notes, etc.
257
392
 
258
393
  ## Next Steps (if applicable)
259
- - Recommended follow-up actions
260
- - Outstanding questions
394
+ - Follow-up actions, outstanding questions
395
+ ```
396
+
397
+ ### HTML deliverables
398
+
399
+ Pass a complete, self-contained HTML document (or fragment — a wrapper `<html>` is injected automatically):
261
400
 
262
- ## Resources
263
- - Links to relevant documentation
264
- - Code repository URLs
265
- - External references
401
+ ```html
402
+ <h1>Report Title</h1>
403
+ <table>
404
+ <tr><th>Metric</th><th>Value</th></tr>
405
+ <tr><td>Users</td><td>1,234</td></tr>
406
+ </table>
266
407
  ```
267
408
 
268
- ### Incremental Updates
269
- Start building the deliverable **immediately** when you start a task — don't wait until you're done. Use `deskfree_update_deliverable` to build it up gradually:
409
+ **Build incrementally** — start with outline immediately after `deskfree_start_task`, fill sections as you go, polish before completing. A half-complete deliverable is infinitely better than none.
270
410
 
271
- 1. **Start:** Create outline with headers right after starting
272
- 2. **Progress:** Fill in sections as you complete them
273
- 3. **Finish:** Add summary and polish before completing
411
+ ---
274
412
 
275
- This gives your human real-time visibility into progress through the task sidebar. A half-complete deliverable is infinitely more useful than no deliverable.
413
+ ## Error Handling
414
+
415
+ | Error | Cause | Action |
416
+ |---|---|---|
417
+ | `deskfree_state` returns empty | No tasks exist | Create a task if appropriate. **Do NOT retry in a loop.** |
418
+ | 404 on `deskfree_start_task` | Task not `bot` or doesn't exist | Another bot claimed it. Call `deskfree_state`, try a different task. |
419
+ | 404 on `deskfree_complete_task` | Task not `bot` (is_working=true) | Already completed or released. Check state. |
420
+ | 409 on `deskfree_start_task` | Race condition — another bot claimed it | Call `deskfree_state`, pick a different task. |
421
+ | 401 Unauthorized | Bot token invalid or expired | Check channel configuration. Do not retry. |
422
+ | `deskfree_update_deliverable` fails | Task not in `bot` (is_working=true) or network error | Verify task state with `deskfree_state`. If task was released, re-claim or abort. |
423
+ | `deskfree_claim_evaluation` returns null | Already claimed by another process | No action needed. Move to next pending evaluation. |
424
+ | Sub-agent spawn fails | Resource limits, config error | Complete task as `blocked` with explanation. Do not leave in `bot` (is_working=true). |
425
+ | WebSocket disconnected | Network issue | Plugin auto-reconnects with backoff. Messages fall back to HTTP polling. No action needed. |
426
+
427
+ ### Recovery Pattern
428
+
429
+ If anything goes wrong mid-task:
430
+ 1. Send a message explaining what happened (`deskfree_send_message`)
431
+ 2. Save whatever partial deliverable you have (`deskfree_update_deliverable`)
432
+ 3. Complete as `blocked` (`deskfree_complete_task` with outcome `blocked`)
433
+ 4. **Never leave a task stranded in `bot` (is_working=true)**
434
+
435
+ ### Edge Cases & Advanced Scenarios
436
+
437
+ | Scenario | Guidance |
438
+ |---|---|
439
+ | **Concurrent task access** | If multiple bots try to claim the same task, one will get 409 Conflict. The winner proceeds, losers should call `deskfree_state` and pick different tasks. |
440
+ | **Long-running operations** | For tasks >10 minutes, send periodic progress updates via `deskfree_send_message` so humans know you're still working. Update deliverable incrementally. |
441
+ | **Partial deliverable recovery** | If interrupted mid-work, `deskfree_start_task` returns the current deliverable content. Resume from where you left off, don't start over. |
442
+ | **Network timeouts during updates** | If `deskfree_update_deliverable` times out, retry once. If it fails again, complete as `blocked` with the timeout explanation. |
443
+ | **Empty or corrupt deliverables** | Always validate deliverable content before calling `deskfree_update_deliverable`. Minimum viable content is better than empty/corrupted content. |
444
+ | **Sub-agent coordination** | Only one sub-agent per task. If a sub-agent fails to start, the main session should resume the task directly. Don't spawn multiple sub-agents for the same task. |
445
+ | **Evaluation claim conflicts** | `deskfree_claim_evaluation` returns `null` if another process claimed it first. This is normal - move to the next pending evaluation or complete your heartbeat. |
446
+ | **Ways of working too large** | If ways of working content becomes very large (>50KB), consider archiving old sections. Focus updates on recent patterns and current best practices. |
447
+
448
+ ### Troubleshooting Common Issues
449
+
450
+ #### "Task not found" (404) Errors
451
+ - **Cause**: Task was claimed by another bot, completed, or deleted
452
+ - **Solution**: Always call `deskfree_state` first to see available tasks
453
+ - **Prevention**: Check task status in state before attempting operations
454
+
455
+ #### Auto-threading Not Working
456
+ - **Cause**: No active task context, or called `deskfree_complete_task` already
457
+ - **Solution**: Pass explicit `taskId` to `deskfree_send_message`
458
+ - **Debug**: Check that `deskfree_start_task` was called and returned successfully
459
+
460
+ #### Deliverable Updates Failing
461
+ - **Common causes**:
462
+ - Task was released by another process → call `deskfree_state` to verify task status
463
+ - Deliverable content is malformed (invalid markdown, control characters)
464
+ - Network timeout → retry once, then complete as blocked if persistent
465
+ - **Solution**: Validate markdown content before sending, handle network errors gracefully
466
+
467
+ #### Sub-agent Spawn Failures
468
+ - **Common causes**: Resource limits, configuration errors, invalid task context
469
+ - **Immediate action**: Main session should resume the task directly
470
+ - **Recovery**: Complete task as `blocked` only if you cannot resume the work yourself
471
+
472
+ #### Ways of Working Updates Not Applying
473
+ - **Cause**: Another evaluation process updated it first, or `hasChanges=false` was sent
474
+ - **Check**: Ensure `hasChanges=true` and `updatedContent` is provided when you intend to update
475
+ - **Conflict resolution**: If content conflicts occur, the last successful submission wins
476
+
477
+ #### "State returns empty" Issues
478
+ - **Not an error**: Empty state means no tasks exist - this is normal
479
+ - **Action**: Create a task if you have work to do, otherwise return `HEARTBEAT_OK`
480
+ - **Don't**: Retry `deskfree_state` in a loop - it's not broken
481
+
482
+ ---
483
+
484
+ ## Common Workflow Patterns
485
+
486
+ ### Pattern 1: Research & Analysis (Sub-agent Recommended)
276
487
 
277
- **Example progression:**
278
488
  ```
279
- Update 1: "# Research DeskFree Competitors\n\n## Summary\n[In progress]\n\n## Findings\n### HumanLayer\n- Founded 2023..."
280
- Update 2: "...### Anthropic Constitutional AI\n- Different approach to human oversight..."
281
- Update 3: "## Summary\nAnalyzed 3 main competitors. HumanLayer is closest match..."
489
+ Main Session:
490
+ 1. deskfree_state() → check workspace
491
+ 2. deskfree_suggest_tasks([{
492
+ title: "Research competitor HumanLayer",
493
+ instructions: "Analyze their product, pricing, and positioning vs DeskFree"
494
+ }])
495
+ 3. [human approves task]
496
+ 4. deskfree_start_task(taskId) → get task context
497
+ 4. spawn_subagent(research_prompt) → background research
498
+
499
+ Sub-agent:
500
+ 1. deskfree_update_deliverable() → initial outline
501
+ 2. [research work...]
502
+ 3. deskfree_update_deliverable() → interim findings
503
+ 4. [more research...]
504
+ 5. deskfree_update_deliverable() → final report
505
+ 6. deskfree_complete_task(taskId, "done")
282
506
  ```
283
507
 
284
- ## Error Handling
508
+ ### Pattern 2: Quick Fix (Main Session)
285
509
 
286
- | Error | Meaning | Action |
510
+ ```
511
+ 1. deskfree_state() → check current state
512
+ 2. deskfree_suggest_tasks([{
513
+ title: "Fix broken login endpoint",
514
+ instructions: "Apply hotfix for 500 error in /auth/login"
515
+ }])
516
+ 3. [human approves task]
517
+ 4. deskfree_start_task(taskId) → claim the work
518
+ 4. deskfree_update_deliverable() → "Investigating issue..."
519
+ 5. [fix the code...]
520
+ 6. deskfree_update_deliverable() → "Applied fix, testing..."
521
+ 7. [verify fix...]
522
+ 8. deskfree_update_deliverable() → "Fix verified and deployed"
523
+ 9. deskfree_complete_task(taskId, "done")
524
+ ```
525
+
526
+ ### Pattern 3: Blocked Task with Human Input
527
+
528
+ ```
529
+ 1-5. [normal task startup...]
530
+ 6. [encounter blocker - need API key]
531
+ 7. deskfree_send_message("Need the new Stripe API key to complete this integration. Where can I find it?")
532
+ 8. deskfree_update_deliverable() → save partial progress
533
+ 9. deskfree_complete_task(taskId, "blocked") → hand off to human
534
+ ```
535
+
536
+ ### Pattern 4: Ways of Working Evaluation
537
+
538
+ ```
539
+ Heartbeat check:
540
+ 1. deskfree_state() → shows pendingEvaluations: [{taskId: "abc", ...}]
541
+ 2. deskfree_claim_evaluation("abc") → get evaluation context
542
+ 3. [analyze task, messages, current ways of working...]
543
+ 4. deskfree_submit_evaluation({
544
+ taskId: "abc",
545
+ reasoning: "Found a new pattern for API error handling...",
546
+ hasChanges: true,
547
+ updatedContent: "# Ways of Working\n\n## API Integration\n[new section]..."
548
+ })
549
+ ```
550
+
551
+ ## Task Title Examples
552
+
553
+ **Good (short, scannable, action-oriented):**
554
+ - "Research competitor HumanLayer"
555
+ - "Deploy staging hotfix"
556
+ - "Write API docs for /users endpoint"
557
+ - "Debug memory leak in worker process"
558
+ - "Review Q3 performance metrics"
559
+
560
+ **Bad (verbose, unclear):**
561
+ - "Do some research on a competitor called HumanLayer and write up findings"
562
+ - "There's a bug in staging that needs fixing"
563
+ - "I need to check on some performance stuff for the quarterly review"
564
+
565
+ ---
566
+
567
+ ## Best Practices & Anti-Patterns
568
+
569
+ ### ✅ Do This
570
+
571
+ | Practice | Rationale | Example |
287
572
  |---|---|---|
288
- | `deskfree_state` returns no tasks | No work available | Check goals for next task to create; don't loop |
289
- | 404 on `deskfree_start_task` | Task not in `ready_for_bot` or doesn't exist | Another bot may have started it. Check state and try another task. |
290
- | 404 on `deskfree_complete_task` | Task not in `working_on_it` status | Check if task was already completed or released |
291
- | 401 Unauthorized | Bot token invalid | Check channel configuration |
292
-
293
- ## 🔧 Troubleshooting
294
-
295
- ### "Task not found" or 404 Errors
296
- - **Check workspace state** with `deskfree_state` — task may have changed state
297
- - **Another bot started it** tasks are first-come-first-served
298
-
299
- ### Connection Issues
300
- - **"Channel not configured"** Run the channel setup flow in OpenClaw
301
- - **"WebSocket connection failed"** Check firewall, network connectivity
302
- - **Messages not arriving** Verify bot token has correct permissions
303
-
304
- ### Common Workflow Mistakes
305
- - **Forgetting to start** Created task but didn't call `deskfree_start_task` (still `ready_for_bot`)
306
- - **Working without task** — Doing work without creating/starting a task first
307
- - **Not completing** — Finished work but didn't call `deskfree_complete_task`
308
- - **Sub-agent using wrong tools** — Sub-agents only have 3 tools; they cannot read state or create tasks
309
- - **Completing without messaging when blocked** Always send a message explaining the blocker before completing as blocked
310
-
311
- ### Best Practices for Reliability
312
- 1. **Always check state first** Use `deskfree_state` before creating new tasks
313
- 2. **Handle race conditions** If start fails, check if another bot got it
314
- 3. **Update deliverable frequently** Don't wait until the end to document progress
315
- 4. **Include context in messages** — Help humans understand current state when asking questions
573
+ | **Update deliverable early and often** | Shows progress, survives interruptions | Update outline immediately, add sections as you work |
574
+ | **Use descriptive commit-style titles** | Easy to scan, actionable | "Fix authentication timeout in Safari" |
575
+ | **Send progress messages for long tasks** | Humans know you're working | "25% complete - analyzed 3 of 12 competitor features" |
576
+ | **Complete blocked tasks with explanation** | Clear handoff to humans | Message: "Need AWS credentials", then complete as blocked |
577
+ | **Start with template deliverables** | Consistent structure, never empty | Use the markdown template every time |
578
+ | **Handle 404/409 gracefully** | Race conditions are normal | Check state and pick different task, don't retry same task |
579
+
580
+ ### Don't Do This
581
+
582
+ | Anti-Pattern | Why It's Bad | Instead |
583
+ |---|---|---|
584
+ | **Leave tasks in `bot` (is_working=true)** | Blocks the workspace indefinitely | Always complete as `done` or `blocked` |
585
+ | **Retry `deskfree_state` in loops** | Wastes resources, indicates logic error | Call once per decision point |
586
+ | **Start multiple sub-agents per task** | Creates confusion, race conditions | One sub-agent per task maximum |
587
+ | **Update deliverable only at the end** | Progress lost if interrupted | Update incrementally throughout work |
588
+ | **Ignore 409 conflicts on task claims** | Causes infinite retry loops | Accept conflict, check state, pick different task |
589
+ | **Create tasks without clear actions** | Unclear what needs doing | Use imperative verbs: "research X", "fix Y", "analyze Z" |
590
+ | **Send messages instead of completing blocked** | Task stays in limbo | Send message explaining blocker, then complete as blocked |
591
+
592
+ ### Common Gotchas
593
+
594
+ - **Auto-threading stops after `deskfree_complete_task`** Pass explicit `taskId` for post-completion messages
595
+ - **Empty deliverable content is rejected** → Always provide meaningful content, even if just an outline
596
+ - **Sub-agents can't create tasks** → Only orchestrator (main session) can create and claim tasks
597
+ - **Ways of working updates require `hasChanges=true`** Explicitly set flag when submitting changes
598
+ - **Task titles are visible to humans** Make them professional and descriptive
599
+ - **Evaluation reasoning is important** Explain your analysis even if no changes are made
600
+
601
+ ## Human Review Outcomes
602
+
603
+ - **Approve** → task moves to `done`. Creates pending evaluation for ways-of-working update.
604
+ - **Decline / request changes** → task returns to `bot` with feedback. Restart it.