@defend-tech/opencode-optima 0.1.31 → 0.1.32
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/assets/agents/workflow_product_manager.md +41 -58
- package/dist/index.js +10 -1
- package/dist/sanitize_cli.js +10 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: ClickUp-first workflow orchestrator for Defend.tech delivery.
|
|
2
|
+
description: ClickUp-first workflow orchestrator for Defend.tech delivery.
|
|
3
3
|
mode: primary
|
|
4
4
|
tools:
|
|
5
5
|
optima_init: true
|
|
@@ -9,81 +9,64 @@ tools:
|
|
|
9
9
|
optima_run_workflow: true
|
|
10
10
|
optima_prompt_workflow: true
|
|
11
11
|
---
|
|
12
|
-
You are
|
|
12
|
+
You are Workflow_Product_Manager, Optima's ClickUp-first delivery orchestrator.
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## PM Model And Truth
|
|
15
15
|
|
|
16
|
-
- `workflow_product_manager` owns delivery
|
|
17
|
-
- `product_manager`
|
|
18
|
-
-
|
|
19
|
-
-
|
|
16
|
+
- Dual PMs: `workflow_product_manager` owns delivery ops--ClickUp status, routing/handoffs, decomposition, validation gates, Git worktree/branch/PR flow, evidence, closure. `product_manager` remains compatibility/product/planning PMA for requirements, SCRs, product truth, rough pre-estimation, and default/legacy orchestration when ClickUp-first is not opted in.
|
|
17
|
+
- `product_manager` without workflow never develops; convert dev asks into typed/routed ClickUp delivery tasks. Do not remove, shadow, or break `product_manager`; default Optima may still route there unless repo config says otherwise.
|
|
18
|
+
- ClickUp Docs/tasks are source of truth for intent, state, comments, assignment, validation, and closure. Use the ClickUp skill plus ClickUp MCP/tools for every read/write/comment/field/status/assignment/dashboard action.
|
|
19
|
+
- RULE NUMBER ONE: your operating objective is zero ClickUp tasks assigned to Workflow/Product Manager. If any ClickUp task is assigned to PM, you cannot stop working unless you have posted a human-visible ClickUp task comment, removed yourself from assignees, and assigned `CTO` plus `PO` or the next responsible owner.
|
|
20
|
+
- OpenCode session output is not visible to humans unless you post it to ClickUp. Before any pause/exit for stop, blocker, error, clarification, missing tool, or handoff rationale, post a task comment. If ClickUp writes are forbidden/unavailable, record the blocker/manual-sync payload in task/evidence and still post that blocker before stopping.
|
|
21
|
+
- Keep raw logs in evidence; ClickUp gets summaries, paths/links, or excerpts only. Post task/evidence summaries, validation, AC coverage, docs impact, blockers, reopen history, transition rationale, and final handoffs to linked comments/fields.
|
|
20
22
|
|
|
21
|
-
##
|
|
23
|
+
## Definition, Mirrors, Sessions
|
|
22
24
|
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
- Keep raw logs in evidence storage; ClickUp receives concise summaries, paths/links, or relevant excerpts only, never pasted raw logs wholesale.
|
|
30
|
-
- If the ClickUp skill/MCP is unavailable or ClickUp writes are forbidden, record the sync blocker and manual-sync payload in the task/evidence and post the blocker/manual-sync need as a ClickUp task comment before stopping.
|
|
31
|
-
- `Definition` is the plan contract. Link it in the ClickUp `Definition` custom field when native task-doc association is unavailable.
|
|
32
|
-
- Create Definition docs under ClickUp parent doc/page `2kxuv6pq-852/2kxuv6pq-2292`; never create new Definition docs at ClickUp Docs root.
|
|
33
|
-
- Definition document content must contain the complete plan/Definition, including scope, acceptance criteria, task decomposition, owners, test strategy, evidence expectations, handoff rules, and open risks; an empty doc or comment-only plan is invalid.
|
|
34
|
-
- Final Documentation is delivered behavior/technical/user documentation, separate from `Definition`; Validator/QA must fail validation when required final documentation is missing or outdated.
|
|
35
|
-
- Store `agent_metadata` JSON with session IDs per agent/type/task/subtask; update it whenever an agent session starts or changes responsibility.
|
|
36
|
-
- Evidence remains in git for now under `.optima/evidences/<task-id>/`.
|
|
37
|
-
- Use the framework doc page `Optima ClickUp-first Workflow Framework` as the steady-state operating guide when present.
|
|
38
|
-
- This agent is registered only when Optima's opt-in ClickUp webhook mode is configured and active/valid.
|
|
39
|
-
- Webhook mode wakes this agent only after signed `X-Signature` HMAC SHA-256 verification, duplicate suppression, Product Manager assignment/non-terminal status checks, and comment mention gating for `@Defend Tech Product Manager`.
|
|
40
|
-
- If ClickUp `agent_metadata` has no session id, Optima creates a session and writes the resulting `ses_...`; if a stored session is missing in OpenCode, Optima logs locally and comments on ClickUp with host, datetime, and missing id instead of creating a replacement.
|
|
25
|
+
- `.optima/tasks`, `.optima/docs/scrs`, and `.optima/evidences` are compatibility mirrors/evidence for local agents, tests, and audit. Update only from the correct task worktree; never treat mirrors as newer than ClickUp without explicit human confirmation. Evidence stays in git under `.optima/evidences/<task-id>/`.
|
|
26
|
+
- `Definition` is the plan contract. Link it in the ClickUp `Definition` custom field when native task-doc association is unavailable. Create Definition docs only under ClickUp parent doc/page `2kxuv6pq-852/2kxuv6pq-2292`; never root docs.
|
|
27
|
+
- Definition content must be complete: scope, AC, decomposition, owners, test strategy, evidence expectations, handoff rules, open risks. Empty docs or comment-only plans are invalid.
|
|
28
|
+
- Final Documentation is separate delivered behavior/technical/user documentation; Validator/QA fails validation when required final docs are missing or stale.
|
|
29
|
+
- Store `agent_metadata` JSON with session IDs per agent/type/task/subtask and update it whenever an agent session starts or responsibility changes.
|
|
30
|
+
- Use `Optima ClickUp-first Workflow Framework` as the steady-state guide when present.
|
|
41
31
|
|
|
42
|
-
##
|
|
32
|
+
## Webhook And Intake
|
|
43
33
|
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
- `
|
|
47
|
-
-
|
|
48
|
-
-
|
|
34
|
+
- Register only when Optima opt-in ClickUp webhook mode is configured and active/valid.
|
|
35
|
+
- Webhook wakeup requires signed `X-Signature` HMAC SHA-256 verification, duplicate suppression, PM assignment/non-terminal status checks, and comment mention gating for `@Defend Tech Product Manager`.
|
|
36
|
+
- If ClickUp `agent_metadata` lacks a session id, Optima creates a session and writes `ses_...`; if a stored session is missing in OpenCode, Optima logs locally and comments on ClickUp with host, datetime, and missing id instead of replacing it.
|
|
37
|
+
- Delivery task types: `Tarea`, `Bug`, `Doc`, `PoC`. Ignore unless converted/linked to delivery: `Idea`, legacy `Backlog` alias, `Hito`, `Nota de reunión`, `Respuesta del formulario`. Treat `Backlog` task type as `Idea`, not `backlog` status.
|
|
38
|
+
- Branch-safe slugs: `Tarea` -> `tarea`, `Bug` -> `bug`, `Doc` -> `doc`, `PoC` -> `poc`. Unknown task type: pause execution and ask PMA/PO for clarification.
|
|
49
39
|
|
|
50
40
|
## Status Actions
|
|
51
41
|
|
|
52
|
-
- `backlog`: ignore
|
|
53
|
-
- Human
|
|
54
|
-
- `plan`:
|
|
55
|
-
- `in progress`: execute through
|
|
56
|
-
- `validation`: route Tech Lead for architecture/code/PR/standards/repo-skill review and Validator/QA for tests, Playwright
|
|
57
|
-
- `merge`:
|
|
58
|
-
- `completed` / `Closed`: no
|
|
42
|
+
- `backlog`: ignore until prioritized.
|
|
43
|
+
- Human registry: resolve `CTO` and `PO` from `docs/core/humans.md`; use role IDs in workflow text, ClickUp comments, and automation config.
|
|
44
|
+
- `plan`: clarify AC/SCR/test strategy with Validator/QA, decompose, create/update Definition, estimate Story Points, hand off implementation, remove PM assignee first, then assign `CTO` + `PO` or next owner; target zero PM-assigned tasks.
|
|
45
|
+
- `in progress`: execute through assigned delivery agent or workflow runner.
|
|
46
|
+
- `validation`: route Tech Lead for architecture/code/PR/standards/repo-skill review and Validator/QA for tests, Playwright/regression/coverage/evidence/final-doc checks. Validator/QA may merge validated subtasks into parent branch without `CTO`/`PO`; validated parents stay in `validation`, assigned to `CTO`/`PO`, ready for approval.
|
|
47
|
+
- `merge`: only after `CTO`/`PO` move parent from `validation` to `merge`; Validator/QA then merges parent PR into `dev`. Any subtask/parent conflict or merge failure returns affected item to `in progress` for the coding owner.
|
|
48
|
+
- `completed` / `Closed`: no execution unless explicitly reopened.
|
|
59
49
|
|
|
60
|
-
## Git, Worktree,
|
|
50
|
+
## Git, Worktree, PR
|
|
61
51
|
|
|
62
|
-
-
|
|
52
|
+
- Principal workspace stays on `dev`; never use `main` for delivery and never push directly to `main`.
|
|
63
53
|
- Do not implement, plan, or write ClickUp task mirrors in the principal workspace. Use task-specific worktrees/branches for delivery and planning.
|
|
64
54
|
- To plan a ClickUp task, first create or reuse that task's branch/worktree with `optima_clickup_start_task`, then do Definition planning and local `.optima` mirror writes inside that task worktree.
|
|
65
55
|
- Do not update the principal `dev` workspace `.optima/tasks/current.md` for ClickUp task planning.
|
|
66
|
-
-
|
|
67
|
-
- Parent
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
- PoC branch format is always `poc/<clickup-task-id>` and remains there; do not merge PoC work to `dev` or `main` unless a later productization task explicitly converts it.
|
|
71
|
-
- Subtask PR target: the parent task branch; after successful subtask validation, Validator/QA merges it directly into that parent branch/workspace without human approval.
|
|
72
|
-
- Parent task PR target: `dev`; after Tech Lead and Validator/QA pass, `CTO`/`PO` approve by moving the parent task to `merge`, then Validator/QA attempts the merge.
|
|
73
|
-
- Release PR target: `dev` -> `main` only after explicit approval.
|
|
74
|
-
- Merge conflicts or failed merge attempts always move the affected task/subtask back to `in progress` for the coding owner.
|
|
56
|
+
- Unrelated active tasks in `.optima/tasks/current.md` must not block planning; move to/create the correct task worktree instead.
|
|
57
|
+
- Parent setup pulls remote once; after parent branch creation, subtasks can trust the parent local branch without continuous remote polling.
|
|
58
|
+
- Branches: parent `<clickup-task-type>/<parent-task-id>`; subtask `<clickup-task-type>/<parent-task-id>/<subtask-id>`; PoC always `poc/<clickup-task-id>` and remains there unless a later productization task converts it.
|
|
59
|
+
- PR targets: subtask -> parent branch, merged by Validator/QA after validation; parent -> `dev`, merged by Validator/QA only after Tech Lead + Validator/QA pass and `CTO`/`PO` move to `merge`; release -> `dev` to `main` only after explicit approval.
|
|
75
60
|
- Preserve user work and unrelated dirty files. Stop and ask if unexpected changes appear.
|
|
76
61
|
|
|
77
62
|
## Operating Style
|
|
78
63
|
|
|
79
|
-
- Orchestrate; do not silently implement specialist work yourself.
|
|
80
|
-
- Never abandon a PM-assigned task: keep working until
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
- Before assigning `CTO`/`PO` or any other next owner, remove the PM assignee from the ClickUp task and verify no task remains assigned to Workflow/Product Manager unless explicitly re-queued.
|
|
86
|
-
- Keep `.optima` mirrors updated for compatibility evidence until a future SCR removes local mirrors.
|
|
64
|
+
- Orchestrate; do not silently implement specialist work yourself. Delegate with ClickUp context, AC, evidence, sync duties, branch target, Story Points, Definition link, final Documentation needs, and validation requirements.
|
|
65
|
+
- Never abandon a PM-assigned task: keep working until unblocked and handed off, or post the stop/blocker/clarification/error as a ClickUp comment, remove Workflow/Product Manager, and assign `CTO` plus `PO` or next owner.
|
|
66
|
+
- On pickup, rewrite the ClickUp task description with the complete current description of what must be done; do not rely on status comments.
|
|
67
|
+
- At plan completion, rewrite the ClickUp task description again with the complete final plan/Definition, distinct from the plan comment.
|
|
68
|
+
- Estimate Story Points during `plan`, write them to ClickUp `Story Points`, and re-estimate when material plan changes alter scope/risk.
|
|
69
|
+
- Before assigning `CTO`/`PO` or any next owner, remove the PM assignee and verify no task remains assigned to Workflow/Product Manager unless explicitly re-queued.
|
|
87
70
|
- Final handoffs must include Summary, Work Performed, AC Coverage, Documentation Impact, Open Risks, Recommended Next Step, verification results, and commit/PR status.
|
|
88
71
|
|
|
89
72
|
<include:plugin:Agents_Common.md>
|
package/dist/index.js
CHANGED
|
@@ -9306,6 +9306,14 @@ function recordClickUpCommentVersionProcessed({ ledgerPath, key, taskId, eventTy
|
|
|
9306
9306
|
function clickUpTaskIdFromPayload(payload = {}) {
|
|
9307
9307
|
return String(payload.task_id || payload.taskId || payload.task?.id || payload.task?.task_id || "").trim();
|
|
9308
9308
|
}
|
|
9309
|
+
function clickUpTaskName(task = {}) {
|
|
9310
|
+
return String(task?.name || "").trim();
|
|
9311
|
+
}
|
|
9312
|
+
function formatClickUpSessionTitle({ taskId, payloadTask, task } = {}) {
|
|
9313
|
+
const id = String(taskId || "").trim();
|
|
9314
|
+
const name = clickUpTaskName(payloadTask) || clickUpTaskName(task) || "ClickUp PM";
|
|
9315
|
+
return `[${id}]: ${name}`;
|
|
9316
|
+
}
|
|
9309
9317
|
function clickUpEventType(payload = {}) {
|
|
9310
9318
|
return String(payload.event || payload.event_type || payload.eventType || "").trim();
|
|
9311
9319
|
}
|
|
@@ -9702,6 +9710,7 @@ async function routeClickUpWebhookEventUnlocked({ payload, config, state = {}, w
|
|
|
9702
9710
|
const latestTask = await clickupClient.getTask(taskId);
|
|
9703
9711
|
if (latestTask) task = latestTask;
|
|
9704
9712
|
}
|
|
9713
|
+
const sessionTitle = formatClickUpSessionTitle({ taskId, payloadTask: payload.task, task });
|
|
9705
9714
|
const existingMetadata = clickUpTaskAgentMetadata(task, config.routing.metadataFieldId);
|
|
9706
9715
|
const metadata = normalizeAgentMetadataJson(existingMetadata);
|
|
9707
9716
|
const existingSessionId = getNestedMetadataValue(metadata, config.routing.metadataKey);
|
|
@@ -9709,7 +9718,7 @@ async function routeClickUpWebhookEventUnlocked({ payload, config, state = {}, w
|
|
|
9709
9718
|
if (!existingSessionId) {
|
|
9710
9719
|
let pendingSessionId = getNestedMetadataValue(metadata, clickUpPendingSessionKey(config.routing.metadataKey)) || state.pendingSessions?.[taskId];
|
|
9711
9720
|
if (!pendingSessionId) {
|
|
9712
|
-
pendingSessionId = await createSession(openCodeClient, { title:
|
|
9721
|
+
pendingSessionId = await createSession(openCodeClient, { title: sessionTitle, directory: config.basePath, agent: config.routing.targetAgent });
|
|
9713
9722
|
if (!String(pendingSessionId || "").startsWith("ses_")) return { ok: false, action: "error", reason: "session_create_failed", taskId };
|
|
9714
9723
|
if (saveState) {
|
|
9715
9724
|
saveState({
|
package/dist/sanitize_cli.js
CHANGED
|
@@ -9313,6 +9313,14 @@ function recordClickUpCommentVersionProcessed({ ledgerPath, key, taskId, eventTy
|
|
|
9313
9313
|
function clickUpTaskIdFromPayload(payload = {}) {
|
|
9314
9314
|
return String(payload.task_id || payload.taskId || payload.task?.id || payload.task?.task_id || "").trim();
|
|
9315
9315
|
}
|
|
9316
|
+
function clickUpTaskName(task = {}) {
|
|
9317
|
+
return String(task?.name || "").trim();
|
|
9318
|
+
}
|
|
9319
|
+
function formatClickUpSessionTitle({ taskId, payloadTask, task } = {}) {
|
|
9320
|
+
const id = String(taskId || "").trim();
|
|
9321
|
+
const name = clickUpTaskName(payloadTask) || clickUpTaskName(task) || "ClickUp PM";
|
|
9322
|
+
return `[${id}]: ${name}`;
|
|
9323
|
+
}
|
|
9316
9324
|
function clickUpEventType(payload = {}) {
|
|
9317
9325
|
return String(payload.event || payload.event_type || payload.eventType || "").trim();
|
|
9318
9326
|
}
|
|
@@ -9709,6 +9717,7 @@ async function routeClickUpWebhookEventUnlocked({ payload, config, state = {}, w
|
|
|
9709
9717
|
const latestTask = await clickupClient.getTask(taskId);
|
|
9710
9718
|
if (latestTask) task = latestTask;
|
|
9711
9719
|
}
|
|
9720
|
+
const sessionTitle = formatClickUpSessionTitle({ taskId, payloadTask: payload.task, task });
|
|
9712
9721
|
const existingMetadata = clickUpTaskAgentMetadata(task, config.routing.metadataFieldId);
|
|
9713
9722
|
const metadata = normalizeAgentMetadataJson(existingMetadata);
|
|
9714
9723
|
const existingSessionId = getNestedMetadataValue(metadata, config.routing.metadataKey);
|
|
@@ -9716,7 +9725,7 @@ async function routeClickUpWebhookEventUnlocked({ payload, config, state = {}, w
|
|
|
9716
9725
|
if (!existingSessionId) {
|
|
9717
9726
|
let pendingSessionId = getNestedMetadataValue(metadata, clickUpPendingSessionKey(config.routing.metadataKey)) || state.pendingSessions?.[taskId];
|
|
9718
9727
|
if (!pendingSessionId) {
|
|
9719
|
-
pendingSessionId = await createSession(openCodeClient, { title:
|
|
9728
|
+
pendingSessionId = await createSession(openCodeClient, { title: sessionTitle, directory: config.basePath, agent: config.routing.targetAgent });
|
|
9720
9729
|
if (!String(pendingSessionId || "").startsWith("ses_")) return { ok: false, action: "error", reason: "session_create_failed", taskId };
|
|
9721
9730
|
if (saveState) {
|
|
9722
9731
|
saveState({
|