ofiere-openclaw-plugin 4.19.2 → 4.21.0

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": "ofiere-openclaw-plugin",
3
- "version": "4.19.2",
3
+ "version": "4.21.0",
4
4
  "type": "module",
5
5
  "description": "OpenClaw plugin for Ofiere PM - 13 meta-tools covering tasks, agents, projects, scheduling, knowledge, workflows, notifications, memory, prompts, constellation, space file management, execution plan builder, and SOP management",
6
6
  "keywords": ["openclaw", "ofiere", "project-management", "agents", "plugin"],
package/src/prompt.ts CHANGED
@@ -67,11 +67,11 @@ const TOOL_DOCS: Record<string, string> = {
67
67
  - mark_read: Mark one notification read by ID
68
68
  - mark_all_read: Mark all as read
69
69
  - send_report: Send a PM progress report to YOUR connected channels (Telegram, Discord, Slack, etc.)
70
- - Required: scope_type (space|folder|project|task|all)
70
+ - Required: scope_type (space|folder|project|task|all), agent_id (YOUR name, e.g. "thalia")
71
71
  - Optional: scope_id, channel_types[] (filter to specific channels), include_completed
72
72
  - The report is automatically generated from current PM data and sent through YOUR channel bindings ONLY
73
73
  - schedule_report: Create a recurring/scheduled report
74
- - Required: scope_type, recurrence_type (hourly|daily|weekly|monthly)
74
+ - Required: scope_type, recurrence_type (hourly|daily|weekly|monthly), agent_id (YOUR name)
75
75
  - Optional: scope_id, scope_label, channel_types[], recurrence_time (HH:MM UTC, default 09:00), recurrence_interval, recurrence_days_of_week (e.g. "mon,wed,fri"), include_completed
76
76
  - list_schedules: View all your active report schedules
77
77
  - delete_schedule: Remove a scheduled report by schedule_id`,
@@ -134,15 +134,16 @@ const TOOL_DOCS: Record<string, string> = {
134
134
  OFIERE_SOP_OPS: `- **OFIERE_SOP_OPS** — Standard Operating Procedures for department chiefs (action: "list_templates", "create", "list", "get", "update", "delete", "list_subagents", "apply_template")
135
135
  - list_templates: See available SOP templates (built-in + user-created)
136
136
  - create: Create a new SOP. Required: agent_id, title, sop_data. Optional: department, status
137
- - list: List SOPs. Optional: agent_id to filter by department chief
138
- - get: Full SOP details with structured content. Required: sop_id
137
+ - list: List SOPs. Optional: agent_id to filter by department chief. RUNTIME READ PATH: use this to discover your active SOPs when complexity is 🔴 COMPLEX
138
+ - get: Full SOP details with structured content. Required: sop_id. RUNTIME READ PATH: use this after "list" to load full SOP content for execution guidance
139
139
  - update: Modify SOP content/status. Required: sop_id. Optional: title, sop_data, status, department
140
140
  - delete: Remove an SOP. Required: sop_id
141
141
  - list_subagents: View staff under a chief. Required: chief_agent_id
142
142
  - apply_template: Create SOP from a saved template. Required: agent_id, template_id
143
143
  - sop_data is a JSON object: { title, objective, scope, prerequisites[{text,checked}], steps[{name,action,owner,output}], deliverables[], escalationRules[{trigger,escalateTo,priority}], successCriteria[{text,checked}], notes }
144
144
  - Status values: draft, active, archived
145
- - SOPs appear in the SOP Manager page immediately via real-time sync`,
145
+ - SOPs appear in the SOP Manager page immediately via real-time sync
146
+ - ADAPTIVE PROTOCOL: Do NOT always load SOPs. See the SOP PROTOCOL section in Rules for when to load vs skip`,
146
147
  };
147
148
 
148
149
  export function getSystemPrompt(state: {
@@ -201,8 +202,8 @@ ${toolDocs}
201
202
  - When task instructions or system prompts contain file references like @[filename](file:FILE_ID), use OFIERE_FILE_OPS action:"read_text_file" file_id:"FILE_ID" to read the file content. Do NOT ask the user for the file — retrieve it yourself.
202
203
  - Use OFIERE_FILE_OPS to create output files (reports, data, configs) in the Space Files explorer. Prefer create_text_file for text-based outputs.
203
204
  - To save task output as a file, call OFIERE_FILE_OPS action:"create_text_file" with the space_id from the task context.
204
- - CHANNEL REPORTS: When the user asks you to "send a report", "send progress", "update me on Telegram/Discord/Slack/WhatsApp", use OFIERE_NOTIFY_OPS action:"send_report". The report is generated from live PM data and sent through YOUR connected channels ONLY — not other agents' channels.
205
- - To set up recurring reports (e.g. "send me a daily report at 9am"), use OFIERE_NOTIFY_OPS action:"schedule_report" with scope_type and recurrence_type.
205
+ - CHANNEL REPORTS: When the user asks you to "send a report", "send progress", "update me on Telegram/Discord/Slack/WhatsApp", use OFIERE_NOTIFY_OPS action:"send_report" with agent_id set to YOUR name. ALWAYS include agent_id — without it the report will fail. The report is generated from live PM data and sent through YOUR connected channels ONLY — not other agents' channels.
206
+ - To set up recurring reports (e.g. "send me a daily report at 9am"), use OFIERE_NOTIFY_OPS action:"schedule_report" with scope_type, recurrence_type, and agent_id set to YOUR name.
206
207
  - If a report is too long for the channel's message limit, save the full report as a markdown file using OFIERE_FILE_OPS action:"create_text_file" and send a summary to the channel instead.
207
208
  - PLANNING WORKFLOW: Use OFIERE_PLAN_OPS to build complex multi-step execution flows BEFORE creating individual tasks. Build the plan → let the user review in the Planning Tab → execute when approved.
208
209
  - When creating a plan with nodes, nest children inside each node's children[] array. Sequential children execute in order; set parallel: true on a parent node to fork its children into parallel branches.
@@ -214,6 +215,50 @@ ${toolDocs}
214
215
  - When creating SOPs for department chiefs (Thalia=CMO, Ivy=COO, Daisy=CTO-Intel, Celia=CTO-Eng), tailor content to their domain expertise.
215
216
  - Prerequisites should be actionable checklist items. Success criteria should be measurable outcomes.
216
217
  - After creating an SOP, suggest the agent set it to "active" status when ready for execution.
218
+
219
+ ## SOP PROTOCOL — Adaptive Complexity Assessment
220
+
221
+ Before executing any user request, classify its complexity to decide whether to load your SOPs:
222
+
223
+ ### User Override (HIGHEST PRIORITY — always check first)
224
+ - If user says "apply full SOP", "use SOP", "follow the SOP", "full protocol" → treat as 🔴 COMPLEX regardless of your classification
225
+ - If user says "no SOP", "skip SOP", "just do it", "keep it simple", "quick" → treat as 🟢 SIMPLE regardless of your classification
226
+ - User explicit intent ALWAYS overrides your classification
227
+
228
+ ### 🟢 SIMPLE (Skip SOPs — zero overhead)
229
+ Single tool call, direct data retrieval, simple CRUD, status checks, quick answers.
230
+ Criteria: Can be completed with ≤2 tool calls, no cross-agent coordination, no multi-phase execution.
231
+ Examples: "Check my email", "List tasks", "Create a quick task", "What's the project status?", "Tell me about X"
232
+ Action: Execute directly. Do NOT call OFIERE_SOP_OPS. Do NOT mention SOPs.
233
+
234
+ ### 🟡 MODERATE (Ask User)
235
+ Multi-step work but clear execution path, no subagent delegation required, single-department scope.
236
+ Criteria: 3-5 tool calls, single department, no escalation risk, no staff/subagent coordination needed.
237
+ Examples: "Draft a marketing plan", "Set up a new workflow", "Analyze this report"
238
+ Action: Ask the user briefly: "This task has moderate complexity. Do we need to apply full SOPs for this?"
239
+ - If user says yes → escalate to 🔴 COMPLEX behavior
240
+ - If user says no → proceed without SOPs
241
+
242
+ ### 🔴 COMPLEX (Auto-Load SOPs)
243
+ Multi-phase execution, cross-department coordination, subagent delegation, production impact, escalation risk.
244
+ Criteria: 5+ tool calls, multiple departments involved, needs staff/subagent coordination, or has escalation risk.
245
+ Examples: "Launch full marketing campaign", "Execute deployment pipeline", "Restructure operations", "Full audit"
246
+ Action:
247
+ 1. Call OFIERE_SOP_OPS action:"list" agent_id:"YOUR_NAME" to discover your active SOPs (returns titles + IDs)
248
+ 2. Review the SOP titles — select ONLY the SOPs relevant to the current task. Skip unrelated SOPs entirely. Do NOT load all SOPs blindly.
249
+ 3. For each RELEVANT SOP only: call OFIERE_SOP_OPS action:"get" sop_id:"..." to load full content
250
+ 4. Follow loaded SOPs as your execution framework:
251
+ - Prerequisites → validate ALL are met before starting (gate check)
252
+ - Steps → use as your execution plan (follow in order, each step has name/action/owner/output)
253
+ - Escalation Rules → apply when blockers arise or scope changes (P1=critical, P2=scope, P3=advisory)
254
+ - Success Criteria → verify ALL are met before marking task DONE
255
+ 5. If an SOP step assigns an "owner" that maps to one of your subagents, coordinate with that subagent
256
+ 6. Announce: "Applying [SOP_TITLE] protocol for this execution." (only name the SOPs you actually loaded)
257
+
258
+ ### Classification Transparency
259
+ - When you load SOPs (🔴): state which SOP(s) you're following
260
+ - When you ask about SOPs (🟡): keep the question brief and direct
261
+ - When you skip SOPs (🟢): do NOT mention SOPs at all — just execute silently
217
262
  </ofiere-pm>`;
218
263
  }
219
264
 
package/src/tools.ts CHANGED
@@ -2143,14 +2143,8 @@ function registerNotifyOps(
2143
2143
  api: any,
2144
2144
  supabase: SupabaseClient,
2145
2145
  userId: string,
2146
+ resolveAgent: (explicitId?: string) => Promise<string | null>,
2146
2147
  ): void {
2147
- // Helper: resolve the agent's own ID for agent-scoped operations
2148
- const resolveAgentId = (): string => {
2149
- try {
2150
- const state = api.getState?.() || {};
2151
- return state.agentId || process.env.OFIERE_AGENT_ID || "";
2152
- } catch { return process.env.OFIERE_AGENT_ID || ""; }
2153
- };
2154
2148
 
2155
2149
  api.registerTool({
2156
2150
  name: "OFIERE_NOTIFY_OPS",
@@ -2163,10 +2157,10 @@ function registerNotifyOps(
2163
2157
  `- "mark_all_read": Mark all as read\n` +
2164
2158
  `- "delete": Delete a notification. Required: id\n` +
2165
2159
  `- "send_report": Send a PM progress report to YOUR connected channels (Telegram, Discord, etc.)\n` +
2166
- ` Required: scope_type (space|folder|project|task|all)\n` +
2160
+ ` Required: scope_type (space|folder|project|task|all), agent_id (YOUR name e.g. "thalia")\n` +
2167
2161
  ` Optional: scope_id, channel_types[] (filter specific channels), include_completed (default true)\n` +
2168
2162
  `- "schedule_report": Create a recurring/scheduled report\n` +
2169
- ` Required: scope_type, recurrence_type (hourly|daily|weekly|monthly)\n` +
2163
+ ` Required: scope_type, recurrence_type (hourly|daily|weekly|monthly), agent_id (YOUR name)\n` +
2170
2164
  ` Optional: scope_id, scope_label, channel_types[], recurrence_time (HH:MM UTC, default 09:00),\n` +
2171
2165
  ` recurrence_interval (default 1), recurrence_days_of_week (e.g. "mon,wed,fri"), include_completed\n` +
2172
2166
  `- "list_schedules": List your active report schedules\n` +
@@ -2176,6 +2170,7 @@ function registerNotifyOps(
2176
2170
  required: ["action"],
2177
2171
  properties: {
2178
2172
  action: { type: "string", enum: ["list", "mark_read", "mark_all_read", "delete", "send_report", "schedule_report", "list_schedules", "delete_schedule"] },
2173
+ agent_id: { type: "string", description: "Your agent name or ID (required for send_report/schedule_report)" },
2179
2174
  id: { type: "string", description: "Notification ID" },
2180
2175
  schedule_id: { type: "string", description: "Schedule ID (for delete_schedule)" },
2181
2176
  unread_only: { type: "boolean", description: "Only show unread" },
@@ -2228,8 +2223,8 @@ function registerNotifyOps(
2228
2223
  const scopeId = params.scope_id as string | undefined;
2229
2224
  const channelTypes = (params.channel_types as string[]) || [];
2230
2225
  const includeCompleted = params.include_completed !== false;
2231
- const agentId = resolveAgentId();
2232
- if (!agentId) return err("Cannot resolve your agent ID. Ensure OFIERE_AGENT_ID is configured.");
2226
+ const agentId = await resolveAgent(params.agent_id as string | undefined);
2227
+ if (!agentId) return err("Cannot resolve your agent ID. Pass agent_id with your name (e.g. 'thalia', 'ivy').");
2233
2228
 
2234
2229
  // Call the dashboard API to generate + dispatch
2235
2230
  const supabaseUrl = (supabase as any).supabaseUrl || process.env.OFIERE_SUPABASE_URL || process.env.SUPABASE_URL || "";
@@ -2266,8 +2261,8 @@ function registerNotifyOps(
2266
2261
  case "schedule_report": {
2267
2262
  const scopeType = (params.scope_type as string) || "all";
2268
2263
  const recurrenceType = (params.recurrence_type as string) || "daily";
2269
- const agentId = resolveAgentId();
2270
- if (!agentId) return err("Cannot resolve your agent ID.");
2264
+ const agentId = await resolveAgent(params.agent_id as string | undefined);
2265
+ if (!agentId) return err("Cannot resolve your agent ID. Pass agent_id with your name (e.g. 'thalia', 'ivy').");
2271
2266
 
2272
2267
  const recurrenceTime = (params.recurrence_time as string) || "09:00";
2273
2268
  const recurrenceInterval = (params.recurrence_interval as number) || 1;
@@ -4869,7 +4864,7 @@ export function registerTools(
4869
4864
  registerScheduleOps(api, supabase, userId); // 4
4870
4865
  registerKnowledgeOps(api, supabase, userId); // 5
4871
4866
  registerWorkflowOps(api, supabase, userId); // 6
4872
- registerNotifyOps(api, supabase, userId); // 7
4867
+ registerNotifyOps(api, supabase, userId, resolveAgent); // 7
4873
4868
  registerMemoryOps(api, supabase, userId); // 8
4874
4869
  registerPromptOps(api, supabase, userId); // 9
4875
4870
  registerConstellationOps(api, supabase, userId); // 10