ofiere-openclaw-plugin 4.19.1 → 4.20.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.1",
3
+ "version": "4.20.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
@@ -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: {
@@ -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
@@ -4715,16 +4715,16 @@ async function handleSOPGet(supabase: SupabaseClient, userId: string, params: Re
4715
4715
  .from("agent_sops")
4716
4716
  .select("*")
4717
4717
  .eq("id", params.sop_id as string)
4718
- .eq("user_id", userId)
4719
- .maybeSingle();
4718
+ .eq("user_id", userId);
4720
4719
  if (error) return err(error.message);
4721
- if (!data) return err("SOP not found");
4720
+ if (!data || data.length === 0) return err("SOP not found");
4722
4721
 
4722
+ const sop = data[0];
4723
4723
  // Parse the content to return structured data
4724
4724
  let parsedContent: any = {};
4725
- try { parsedContent = JSON.parse(data.content || "{}"); } catch { /* leave empty */ }
4725
+ try { parsedContent = JSON.parse(sop.content || "{}"); } catch { /* leave empty */ }
4726
4726
 
4727
- return ok({ sop: { ...data, content: parsedContent } });
4727
+ return ok({ sop: { ...sop, content: parsedContent } });
4728
4728
  } catch (e) { return err(e instanceof Error ? e.message : String(e)); }
4729
4729
  }
4730
4730