crewly 1.20.393 → 1.20.394

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 (128) hide show
  1. package/config/constants.ts +16 -0
  2. package/config/index.ts +2 -0
  3. package/config/skills/agent/core/complete-task/SKILL.md +18 -0
  4. package/config/skills/agent/core/complete-task/execute.sh +16 -2
  5. package/config/skills/agent/core/complete-task/execute.test.sh +18 -0
  6. package/config/skills/agent/core/get-my-active-work/execute.sh +1 -1
  7. package/config/skills/agent/core/get-my-context/SKILL.md +5 -0
  8. package/config/skills/agent/core/get-my-context/execute.sh +11 -1
  9. package/config/skills/agent/core/get-my-tasks/SKILL.md +2 -1
  10. package/config/skills/agent/core/get-my-tasks/execute.sh +18 -4
  11. package/config/skills/team-leader/verify-output/execute.sh +6 -0
  12. package/config/skills/team-leader/verify-output/execute.test.sh +9 -0
  13. package/config/sops/common/blocker-handling.md +5 -0
  14. package/config/sops/common/communication-protocol.md +5 -0
  15. package/config/sops/common/dev-process-tiers.md +5 -0
  16. package/config/sops/common/mid-flight-milestone-surface.md +5 -0
  17. package/config/sops/common/owner-facing-communication.md +5 -0
  18. package/config/sops/common/writing-for-agents.md +5 -0
  19. package/config/sops/developer/coding-standards.md +5 -0
  20. package/config/sops/developer/debugging.md +5 -0
  21. package/config/sops/developer/git-workflow.md +5 -0
  22. package/config/sops/developer/testing-requirements.md +5 -0
  23. package/config/sops/pm/progress-tracking.md +5 -0
  24. package/config/sops/pm/task-decomposition.md +5 -0
  25. package/config/sops/qa/testing-procedures.md +5 -0
  26. package/dist/backend/backend/src/constants.d.ts +35 -0
  27. package/dist/backend/backend/src/constants.d.ts.map +1 -1
  28. package/dist/backend/backend/src/constants.js +39 -0
  29. package/dist/backend/backend/src/constants.js.map +1 -1
  30. package/dist/backend/backend/src/controllers/active-work/active-work.controller.d.ts +1 -1
  31. package/dist/backend/backend/src/controllers/active-work/active-work.controller.js +1 -1
  32. package/dist/backend/backend/src/controllers/memory/memory.controller.d.ts.map +1 -1
  33. package/dist/backend/backend/src/controllers/memory/memory.controller.js +11 -2
  34. package/dist/backend/backend/src/controllers/memory/memory.controller.js.map +1 -1
  35. package/dist/backend/backend/src/controllers/project-tickets/project-tickets.controller.d.ts.map +1 -1
  36. package/dist/backend/backend/src/controllers/project-tickets/project-tickets.controller.js +5 -0
  37. package/dist/backend/backend/src/controllers/project-tickets/project-tickets.controller.js.map +1 -1
  38. package/dist/backend/backend/src/index.d.ts.map +1 -1
  39. package/dist/backend/backend/src/index.js +21 -1
  40. package/dist/backend/backend/src/index.js.map +1 -1
  41. package/dist/backend/backend/src/scripts/check-rule-metadata.d.ts +91 -0
  42. package/dist/backend/backend/src/scripts/check-rule-metadata.d.ts.map +1 -0
  43. package/dist/backend/backend/src/scripts/check-rule-metadata.js +214 -0
  44. package/dist/backend/backend/src/scripts/check-rule-metadata.js.map +1 -0
  45. package/dist/backend/backend/src/services/ai/prompt-builder.service.d.ts.map +1 -1
  46. package/dist/backend/backend/src/services/ai/prompt-builder.service.js +14 -9
  47. package/dist/backend/backend/src/services/ai/prompt-builder.service.js.map +1 -1
  48. package/dist/backend/backend/src/services/ai/prompt-modules/lazy-anti-patterns.module.d.ts +4 -0
  49. package/dist/backend/backend/src/services/ai/prompt-modules/lazy-anti-patterns.module.d.ts.map +1 -1
  50. package/dist/backend/backend/src/services/ai/prompt-modules/lazy-anti-patterns.module.js +13 -1
  51. package/dist/backend/backend/src/services/ai/prompt-modules/lazy-anti-patterns.module.js.map +1 -1
  52. package/dist/backend/backend/src/services/ai/prompt-modules/recovery.module.d.ts +1 -1
  53. package/dist/backend/backend/src/services/ai/prompt-modules/recovery.module.d.ts.map +1 -1
  54. package/dist/backend/backend/src/services/ai/prompt-modules/recovery.module.js +17 -22
  55. package/dist/backend/backend/src/services/ai/prompt-modules/recovery.module.js.map +1 -1
  56. package/dist/backend/backend/src/services/event-bus/event-to-workitem-bridge.service.d.ts.map +1 -1
  57. package/dist/backend/backend/src/services/event-bus/event-to-workitem-bridge.service.js +3 -1
  58. package/dist/backend/backend/src/services/event-bus/event-to-workitem-bridge.service.js.map +1 -1
  59. package/dist/backend/backend/src/services/messaging/sub-agent-message-queue.service.d.ts +4 -0
  60. package/dist/backend/backend/src/services/messaging/sub-agent-message-queue.service.d.ts.map +1 -1
  61. package/dist/backend/backend/src/services/messaging/sub-agent-message-queue.service.js +6 -1
  62. package/dist/backend/backend/src/services/messaging/sub-agent-message-queue.service.js.map +1 -1
  63. package/dist/backend/backend/src/services/project-tickets/ticket-autopilot.service.d.ts +6 -0
  64. package/dist/backend/backend/src/services/project-tickets/ticket-autopilot.service.d.ts.map +1 -1
  65. package/dist/backend/backend/src/services/project-tickets/ticket-autopilot.service.js +3 -1
  66. package/dist/backend/backend/src/services/project-tickets/ticket-autopilot.service.js.map +1 -1
  67. package/dist/backend/backend/src/services/task-pool/completion-evidence.service.d.ts +27 -0
  68. package/dist/backend/backend/src/services/task-pool/completion-evidence.service.d.ts.map +1 -1
  69. package/dist/backend/backend/src/services/task-pool/completion-evidence.service.js +54 -0
  70. package/dist/backend/backend/src/services/task-pool/completion-evidence.service.js.map +1 -1
  71. package/dist/backend/backend/src/services/task-pool/verified-spot-check.service.d.ts +145 -0
  72. package/dist/backend/backend/src/services/task-pool/verified-spot-check.service.d.ts.map +1 -0
  73. package/dist/backend/backend/src/services/task-pool/verified-spot-check.service.js +254 -0
  74. package/dist/backend/backend/src/services/task-pool/verified-spot-check.service.js.map +1 -0
  75. package/dist/backend/backend/src/services/trace/turn-origin.d.ts +16 -4
  76. package/dist/backend/backend/src/services/trace/turn-origin.d.ts.map +1 -1
  77. package/dist/backend/backend/src/services/trace/turn-origin.js +27 -9
  78. package/dist/backend/backend/src/services/trace/turn-origin.js.map +1 -1
  79. package/dist/backend/backend/src/services/v3/workitem-dispatch.subscriber.d.ts.map +1 -1
  80. package/dist/backend/backend/src/services/v3/workitem-dispatch.subscriber.js +7 -2
  81. package/dist/backend/backend/src/services/v3/workitem-dispatch.subscriber.js.map +1 -1
  82. package/dist/backend/backend/src/types/sop.types.d.ts +11 -0
  83. package/dist/backend/backend/src/types/sop.types.d.ts.map +1 -1
  84. package/dist/backend/backend/src/types/sop.types.js.map +1 -1
  85. package/dist/backend/build-info.json +2 -2
  86. package/dist/backend/config/constants.d.ts +20 -0
  87. package/dist/backend/config/constants.d.ts.map +1 -1
  88. package/dist/backend/config/constants.js +15 -0
  89. package/dist/backend/config/constants.js.map +1 -1
  90. package/dist/backend/config/index.d.ts +2 -2
  91. package/dist/backend/config/index.d.ts.map +1 -1
  92. package/dist/backend/config/index.js +2 -2
  93. package/dist/backend/config/index.js.map +1 -1
  94. package/dist/cli/backend/src/constants.d.ts +35 -0
  95. package/dist/cli/backend/src/constants.d.ts.map +1 -1
  96. package/dist/cli/backend/src/constants.js +39 -0
  97. package/dist/cli/backend/src/constants.js.map +1 -1
  98. package/dist/cli/backend/src/services/ai/prompt-builder.service.d.ts.map +1 -1
  99. package/dist/cli/backend/src/services/ai/prompt-builder.service.js +14 -9
  100. package/dist/cli/backend/src/services/ai/prompt-builder.service.js.map +1 -1
  101. package/dist/cli/backend/src/services/ai/prompt-modules/lazy-anti-patterns.module.d.ts +4 -0
  102. package/dist/cli/backend/src/services/ai/prompt-modules/lazy-anti-patterns.module.d.ts.map +1 -1
  103. package/dist/cli/backend/src/services/ai/prompt-modules/lazy-anti-patterns.module.js +13 -1
  104. package/dist/cli/backend/src/services/ai/prompt-modules/lazy-anti-patterns.module.js.map +1 -1
  105. package/dist/cli/backend/src/services/ai/prompt-modules/recovery.module.d.ts +1 -1
  106. package/dist/cli/backend/src/services/ai/prompt-modules/recovery.module.d.ts.map +1 -1
  107. package/dist/cli/backend/src/services/ai/prompt-modules/recovery.module.js +17 -22
  108. package/dist/cli/backend/src/services/ai/prompt-modules/recovery.module.js.map +1 -1
  109. package/dist/cli/backend/src/services/messaging/sub-agent-message-queue.service.d.ts +4 -0
  110. package/dist/cli/backend/src/services/messaging/sub-agent-message-queue.service.d.ts.map +1 -1
  111. package/dist/cli/backend/src/services/messaging/sub-agent-message-queue.service.js +6 -1
  112. package/dist/cli/backend/src/services/messaging/sub-agent-message-queue.service.js.map +1 -1
  113. package/dist/cli/backend/src/services/trace/turn-origin.d.ts +16 -4
  114. package/dist/cli/backend/src/services/trace/turn-origin.d.ts.map +1 -1
  115. package/dist/cli/backend/src/services/trace/turn-origin.js +27 -9
  116. package/dist/cli/backend/src/services/trace/turn-origin.js.map +1 -1
  117. package/dist/cli/backend/src/types/sop.types.d.ts +11 -0
  118. package/dist/cli/backend/src/types/sop.types.d.ts.map +1 -1
  119. package/dist/cli/backend/src/types/sop.types.js.map +1 -1
  120. package/dist/cli/config/constants.d.ts +20 -0
  121. package/dist/cli/config/constants.d.ts.map +1 -1
  122. package/dist/cli/config/constants.js +15 -0
  123. package/dist/cli/config/constants.js.map +1 -1
  124. package/dist/cli/config/index.d.ts +2 -2
  125. package/dist/cli/config/index.d.ts.map +1 -1
  126. package/dist/cli/config/index.js +2 -2
  127. package/dist/cli/config/index.js.map +1 -1
  128. package/package.json +2 -1
@@ -1666,6 +1666,22 @@ export const PROJECT_TICKET_CONSTANTS = {
1666
1666
  * runs in CI (`.github/workflows/oss-boundary.yml`) and inside the jest suite.
1667
1667
  * Every path here is relative to the repository root.
1668
1668
  */
1669
+ /**
1670
+ * Rule metadata (issue #877): every SOP records the failure it prevents, the
1671
+ * model where that was seen, and a review date — so rules can be re-tested
1672
+ * and deleted when they stop making a difference.
1673
+ */
1674
+ export const RULE_METADATA_CONSTANTS = {
1675
+ /** Directory of SOP files whose frontmatter is audited */
1676
+ SOPS_DIR: 'config/sops',
1677
+ /** The three frontmatter fields (plus the optional `source` link) */
1678
+ FIELDS: { PREVENTS: 'prevents', SEEN_ON: 'seenOn', REVIEW_BY: 'reviewBy', SOURCE: 'source' } as const,
1679
+ /** Share of SOPs that must carry all three fields for the check to pass */
1680
+ MIN_COVERAGE: 0.8,
1681
+ /** `prevents` starts with this when no failure was ever recorded for the rule */
1682
+ NO_RECORDED_FAILURE: 'none recorded',
1683
+ } as const;
1684
+
1669
1685
  export const OSS_BOUNDARY_CONSTANTS = {
1670
1686
  /** Allowlist of explicit exceptions; every entry carries a one-line reason */
1671
1687
  ALLOWLIST_FILE: 'config/oss-boundary-allowlist.json',
package/config/index.ts CHANGED
@@ -43,6 +43,7 @@ import {
43
43
  EVENT_DEBOUNCE_MS,
44
44
  CLOUD_DEVICE_PAIRING_CONSTANTS,
45
45
  OSS_BOUNDARY_CONSTANTS,
46
+ RULE_METADATA_CONSTANTS,
46
47
 
47
48
  // Type helpers
48
49
  type AgentStatus,
@@ -75,6 +76,7 @@ export {
75
76
  EVENT_DEBOUNCE_MS,
76
77
  CLOUD_DEVICE_PAIRING_CONSTANTS,
77
78
  OSS_BOUNDARY_CONSTANTS,
79
+ RULE_METADATA_CONSTANTS,
78
80
 
79
81
  // Type helpers
80
82
  type AgentStatus,
@@ -49,6 +49,9 @@ Mark a task as complete with a summary of the work done. If the task has an outp
49
49
  | `evidence` | Yes* | Array of evidence entries — see **Evidence contract** below. *Required: refused without it (400 `evidence_required`), except a review `verdict` |
50
50
  | `absoluteTaskPath` | No | **Legacy (V1).** Still accepted so older callers keep working, but it does NOT identify a WorkItem |
51
51
  | `output` | No | Structured output object (required if task has an output schema) |
52
+ | `decisions` | No | Array of short strings: the key decisions you made — see **Decision record** below |
53
+ | `notTaken` | No | Array of short strings: options you considered and did not take, each with the reason |
54
+ | `assumptions` | No | Array of short strings: what you relied on without checking |
52
55
  | `taskKind` | No | What kind of task this was (`revision`, `new-build`, `new-capability`, `research`, `review`, or your own kebab-case word). Used for task timing; without it the kind named in `report-progress`, then the title, decides |
53
56
  | ~~`skipGates`~~ | **Rejected** | **Not supported.** This endpoint runs no quality gates, so there is nothing to skip. Passing it is a hard error. Use the `check-quality-gates` skill for gates. |
54
57
 
@@ -92,6 +95,21 @@ naming the bad entry. A completion with no evidence is refused with 400
92
95
  `evidence_required` and nothing is completed (#1312).
93
96
  A review verdict (`verdict` set) needs no evidence.
94
97
 
98
+ ## Decision record (#875)
99
+
100
+ Evidence shows the work exists; the record shows how you got there. Send any
101
+ of `decisions`, `notTaken`, `assumptions` as arrays of short strings (one
102
+ sentence each). The reviewer sees them in the Verify item under "Worker's
103
+ record" and checks that they hold — a wrong assumption or a road not taken
104
+ for a bad reason is a reason to send the work back, even when every test
105
+ passes. Leave a field out when there is nothing to say; an empty list is fine.
106
+
107
+ ```json
108
+ "decisions":["Kept the v1 schema; the new field goes in metadata"],
109
+ "notTaken":["A new table — needs a migration the owner has not approved"],
110
+ "assumptions":["The relay runs 1.5.24 in production (checked the compose file, not the container)"]
111
+ ```
112
+
95
113
  ## Example
96
114
 
97
115
  ```bash
@@ -35,7 +35,7 @@ SUMMARY=$(printf '%s' "$INPUT" | jq -r '.summary // empty')
35
35
  # ignoring a field is the worst disposition: the caller believes it did
36
36
  # something, and nothing ever fails. So every field this skill does not use
37
37
  # fails loudly, with its name, before any request is sent.
38
- ALLOWED_FIELDS='["workItemId","absoluteTaskPath","sessionName","summary","output","evidence","verdict","feedback","checks","taskId","artifacts","testResults","structured","taskKind"]'
38
+ ALLOWED_FIELDS='["workItemId","absoluteTaskPath","sessionName","summary","output","evidence","verdict","feedback","checks","taskId","artifacts","testResults","structured","taskKind","decisions","notTaken","assumptions"]'
39
39
  SKIP_GATES=$(printf '%s' "$INPUT" | jq -r 'has("skipGates")')
40
40
  if [ "$SKIP_GATES" = "true" ]; then
41
41
  error_exit "skipGates is not supported by complete-task and never was — it was accepted and silently discarded. POST /task-pool/complete runs no quality gates, so there is nothing here to skip. Quality gates live behind the 'check-quality-gates' skill (POST /quality-gates/check); run or skip them there. Remove skipGates from this call."
@@ -59,6 +59,18 @@ EVIDENCE_JSON=$(printf '%s' "$INPUT" | jq -c '.evidence // empty')
59
59
  if [ -n "$EVIDENCE_JSON" ] && [ "$(printf '%s' "$EVIDENCE_JSON" | jq -r 'type')" != "array" ]; then
60
60
  error_exit "evidence must be a JSON array of entries, e.g. [{\"type\":\"artifact\",\"path\":\"/abs/file\"},{\"type\":\"command\",\"command\":\"npm test\",\"exitCode\":0}] — or [{\"type\":\"blocked\",\"step\":\"...\",\"reason\":\"...\"}] if you could not finish"
61
61
  fi
62
+ # Decision record (#875): the key decisions made, the options considered and
63
+ # not taken (with the reason), the assumptions relied on. Each is optional, a
64
+ # JSON array of short strings (a lone string is accepted as one entry). The
65
+ # reviewer reads them beside the evidence in the Verify item.
66
+ DECISIONS_JSON=$(printf '%s' "$INPUT" | jq -c '
67
+ def list(k): if has(k) then (if (.[k] | type) == "string" then [.[k]] elif (.[k] | type) == "array" then .[k] else "bad" end) else null end;
68
+ {decisions: list("decisions"), notTaken: list("notTaken"), assumptions: list("assumptions")}
69
+ | with_entries(select(.value != null))')
70
+ BAD_DECISION_FIELD=$(printf '%s' "$DECISIONS_JSON" | jq -r 'to_entries[] | select(.value == "bad" or (.value | type) == "array" and ([.value[] | select(type != "string")] | length) > 0) | .key' | head -1)
71
+ if [ -n "$BAD_DECISION_FIELD" ]; then
72
+ error_exit "${BAD_DECISION_FIELD} must be a JSON array of strings, e.g. \"${BAD_DECISION_FIELD}\":[\"Kept the v1 schema; a new table needs a migration\"]. Nothing was completed."
73
+ fi
62
74
  # Reviewing someone's work (a "Verify: …" item): `verdict: "rejected"` plus
63
75
  # `feedback` sends it back — the worker gets a retry carrying the feedback.
64
76
  # Anything else (or nothing) accepts it.
@@ -187,6 +199,7 @@ BODY=$(jq -n \
187
199
  --argjson evidence "${EVIDENCE_JSON:-null}" \
188
200
  --argjson checks "${CHECKS_JSON:-null}" \
189
201
  --arg taskKind "$TASK_KIND" \
202
+ --argjson decisions "${DECISIONS_JSON:-{\}}" \
190
203
  '{
191
204
  agentId: $agentId,
192
205
  result: ({summary: $summary}
@@ -197,7 +210,8 @@ BODY=$(jq -n \
197
210
  + (if $feedback != "" then {feedback: $feedback} else {} end)
198
211
  + (if $evidence != null then {evidence: $evidence} else {} end)
199
212
  + (if $checks != null then {checks: $checks} else {} end)
200
- + (if $taskKind != "" then {taskKind: $taskKind} else {} end))
213
+ + (if $taskKind != "" then {taskKind: $taskKind} else {} end)
214
+ + $decisions)
201
215
  }')
202
216
 
203
217
  COMPLETE_RESPONSE=$(api_call POST "/task-pool/complete/${WORK_ITEM_ID}" "$BODY")
@@ -328,6 +328,24 @@ KIND_BODY="$(printf '%s' "$BODIES" | grep 'agentId' | head -1 || true)"
328
328
  assert_contains "taskKind rides inside result" "revision" "$(printf '%s' "$KIND_BODY" | jq -r '.result.taskKind // empty')"
329
329
  assert_contains "the timing line reaches the agent" '"timing":"This was a revision. It took 18 min."' "$(printf '%s' "$OUT" | tail -1)"
330
330
 
331
+ echo ""
332
+ echo "--- Decision record (#875): decisions / notTaken / assumptions ride inside result ---"
333
+
334
+ run_skill '{"workItemId":"wi-rec","sessionName":"dev-1","summary":"done","decisions":["Kept the v1 schema"],"notTaken":"A new table — needs a migration","assumptions":["Relay is on 1.5.24"]}'
335
+ assert_not_contains "the decision fields are accepted" "does not accept" "$OUT"
336
+ REC_BODY="$(printf '%s' "$BODIES" | grep 'agentId' | head -1 || true)"
337
+ assert_contains "decisions ride inside result" "Kept the v1 schema" "$(printf '%s' "$REC_BODY" | jq -r '.result.decisions[0] // empty')"
338
+ assert_contains "a lone string becomes a one-entry list" "A new table" "$(printf '%s' "$REC_BODY" | jq -r '.result.notTaken | if type == "array" then .[0] else "NOT_A_LIST" end')"
339
+ assert_contains "assumptions ride inside result" "Relay is on 1.5.24" "$(printf '%s' "$REC_BODY" | jq -r '.result.assumptions[0] // empty')"
340
+
341
+ run_skill '{"workItemId":"wi-rec2","sessionName":"dev-1","summary":"done"}'
342
+ PLAIN_BODY="$(printf '%s' "$BODIES" | grep 'agentId' | head -1 || true)"
343
+ assert_not_contains "no record sent -> no record fields in the body" "decisions" "$PLAIN_BODY"
344
+
345
+ run_skill '{"workItemId":"wi-rec3","sessionName":"dev-1","summary":"done","decisions":[{"what":"object"}]}'
346
+ assert_contains "a non-string entry is refused by name" "decisions must be a JSON array of strings" "$OUT"
347
+ assert_not_contains "a refused record completes nothing" "agentId" "$BODIES"
348
+
331
349
  rm -rf "$STUB_DIR"
332
350
 
333
351
  echo ""
@@ -1,6 +1,6 @@
1
1
  #!/bin/bash
2
2
  # get-my-active-work — fetch the live Request + WorkItem briefing for this
3
- # agent. Backs the recovery protocol's Step 1.5 freshness escape hatch:
3
+ # agent. Backs the recovery protocol's Step 2 freshness escape hatch:
4
4
  # the startup briefing is already injected at registration time, but a
5
5
  # long-running session can call this skill to refresh after the snapshot
6
6
  # ages out (e.g. >5min after registration).
@@ -47,6 +47,11 @@ Retrieve your accumulated context including memories, learnings, and project kno
47
47
  | `agentId` | Yes | Your agent ID |
48
48
  | `agentRole` | Yes | Your role (e.g., `"developer"`, `"qa"`) |
49
49
  | `projectPath` | Yes | Absolute path to the current project |
50
+ | `context` | No | What to recall for (`--context`). Default: `"<role> agent context for current work"`. At startup pass `"<role> session startup, recent tasks, unfinished work, blockers, key decisions"` |
51
+
52
+ This skill **includes your memory recall** (plus goals, focus, today's log, learnings
53
+ and your task timings). Do not run `recall` as well at startup — that is the same
54
+ search twice (#857).
50
55
 
51
56
  ## Example
52
57
 
@@ -18,6 +18,8 @@ Options:
18
18
  --agent | -a Agent session name/ID (required)
19
19
  --role | -r Agent role: product-manager, developer, etc. (required)
20
20
  --project | -p Project root path (required)
21
+ --context | -c What to recall for (optional; default: "<role> agent context for current work").
22
+ This is your ONE memory search at startup — do not run recall as well (#857)
21
23
  --json | -j Raw JSON payload (same as legacy)
22
24
  --help | -h Show this help
23
25
  EOF_USAGE
@@ -27,6 +29,7 @@ INPUT_JSON=""
27
29
  AGENT_ID=""
28
30
  AGENT_ROLE=""
29
31
  PROJECT_PATH=""
32
+ RECALL_CONTEXT=""
30
33
 
31
34
  # Detect legacy JSON argument as the first parameter
32
35
  if [[ $# -gt 0 && ${1:0:1} == '{' ]]; then
@@ -48,6 +51,10 @@ while [[ $# -gt 0 ]]; do
48
51
  PROJECT_PATH="$2"
49
52
  shift 2
50
53
  ;;
54
+ --context|-c)
55
+ RECALL_CONTEXT="$2"
56
+ shift 2
57
+ ;;
51
58
  --json|-j)
52
59
  INPUT_JSON="$2"
53
60
  shift 2
@@ -85,6 +92,7 @@ if [ -n "$INPUT_JSON" ]; then
85
92
  [ -z "$AGENT_ID" ] && AGENT_ID=$(printf '%s' "$INPUT" | jq -r '.agentId // empty')
86
93
  [ -z "$AGENT_ROLE" ] && AGENT_ROLE=$(printf '%s' "$INPUT" | jq -r '.agentRole // empty')
87
94
  [ -z "$PROJECT_PATH" ] && PROJECT_PATH=$(printf '%s' "$INPUT" | jq -r '.projectPath // empty')
95
+ [ -z "$RECALL_CONTEXT" ] && RECALL_CONTEXT=$(printf '%s' "$INPUT" | jq -r '.context // empty')
88
96
  fi
89
97
 
90
98
  require_param "agentId (--agent)" "$AGENT_ID"
@@ -95,6 +103,8 @@ BODY=$(jq -n \
95
103
  --arg agentId "$AGENT_ID" \
96
104
  --arg agentRole "$AGENT_ROLE" \
97
105
  --arg projectPath "$PROJECT_PATH" \
98
- '{agentId: $agentId, agentRole: $agentRole, projectPath: $projectPath}')
106
+ --arg context "$RECALL_CONTEXT" \
107
+ '{agentId: $agentId, agentRole: $agentRole, projectPath: $projectPath}
108
+ + (if $context != "" then {context: $context} else {} end)')
99
109
 
100
110
  api_call POST "/memory/my-context" "$BODY"
@@ -38,7 +38,7 @@ execution:
38
38
 
39
39
  # Get My Tasks
40
40
 
41
- Retrieve all tasks assigned to your current agent session for a specific project. This includes tasks in `open`, `in_progress`, and `done` states.
41
+ Retrieve the tasks assigned to your current agent session. By default only **open** work comes back (queued, scheduled, proposed, accepted, running, blocked, escalated, done_by_worker, rejected); pass `--all` for finished tasks too. At startup your `## Your Active Work` section already has this — don't call it on top (#857).
42
42
 
43
43
  ## Parameters
44
44
 
@@ -46,6 +46,7 @@ Retrieve all tasks assigned to your current agent session for a specific project
46
46
  |------|-----------|----------|-------------|
47
47
  | `--session` / `-s` | `sessionName` | Yes | Your agent session name |
48
48
  | `--project` / `-p` | `projectPath` | Yes | Absolute path to the current project |
49
+ | `--all` | `all` | No | Include finished tasks (verified / done / failed / cancelled) |
49
50
 
50
51
  ## Examples — CLI Flags (preferred)
51
52
 
@@ -17,6 +17,7 @@ Usage:
17
17
  Options:
18
18
  --session | -s Agent session name (required)
19
19
  --project | -p Project root path (required)
20
+ --all Include finished tasks (verified/done/failed/cancelled). Default: open work only (#857)
20
21
  --json | -j Raw JSON payload (same as legacy)
21
22
  --help | -h Show this help
22
23
  EOF_USAGE
@@ -25,6 +26,7 @@ EOF_USAGE
25
26
  INPUT_JSON=""
26
27
  SESSION_NAME=""
27
28
  PROJECT_PATH=""
29
+ INCLUDE_ALL="false"
28
30
 
29
31
  # Detect legacy JSON argument as the first parameter
30
32
  if [[ $# -gt 0 && ${1:0:1} == '{' ]]; then
@@ -42,6 +44,10 @@ while [[ $# -gt 0 ]]; do
42
44
  PROJECT_PATH="$2"
43
45
  shift 2
44
46
  ;;
47
+ --all)
48
+ INCLUDE_ALL="true"
49
+ shift
50
+ ;;
45
51
  --json|-j)
46
52
  INPUT_JSON="$2"
47
53
  shift 2
@@ -78,6 +84,7 @@ if [ -n "$INPUT_JSON" ]; then
78
84
  INPUT=$(read_json_input "$INPUT_JSON")
79
85
  [ -z "$SESSION_NAME" ] && SESSION_NAME=$(printf '%s' "$INPUT" | jq -r '.sessionName // empty')
80
86
  [ -z "$PROJECT_PATH" ] && PROJECT_PATH=$(printf '%s' "$INPUT" | jq -r '.projectPath // empty')
87
+ [ "$INCLUDE_ALL" = "false" ] && INCLUDE_ALL=$(printf '%s' "$INPUT" | jq -r 'if .all == true then "true" else "false" end')
81
88
  fi
82
89
 
83
90
  require_param "sessionName (--session)" "$SESSION_NAME"
@@ -85,8 +92,15 @@ require_param "sessionName (--session)" "$SESSION_NAME"
85
92
  # for backwards compat with callers who pass it.
86
93
 
87
94
  # Per spec 2026-05-06-task-management-v1-deprecation.md, this skill now
88
- # queries the V3 task-pool. Returns all WorkItems targeted at this agent
89
- # session that are still in a non-terminal status. Callers wanting only
90
- # the running one can filter on `.workItems[] | select(.status=="running")`.
95
+ # queries the V3 task-pool. By default it returns the WorkItems targeted at
96
+ # this agent session that are still open (#857: one startup pulled 472 items /
97
+ # 194 KB, mostly long-verified); `--all` adds the finished ones. Callers
98
+ # wanting only the running one can filter on
99
+ # `.workItems[] | select(.status=="running")`.
100
+ OPEN_STATUSES="queued,scheduled,proposed,accepted,running,blocked,escalated,done_by_worker,rejected"
91
101
  ENCODED_SESSION=$(printf '%s' "$SESSION_NAME" | jq -sRr @uri)
92
- api_call GET "/task-pool/items?target=${ENCODED_SESSION}"
102
+ if [ "$INCLUDE_ALL" = "true" ]; then
103
+ api_call GET "/task-pool/items?target=${ENCODED_SESSION}"
104
+ else
105
+ api_call GET "/task-pool/items?target=${ENCODED_SESSION}&status=${OPEN_STATUSES}"
106
+ fi
@@ -43,6 +43,10 @@ WI_OUTPUT_RAW=$(echo "$WI_DATA" | jq -c '.data.output // empty' 2>/dev/null || t
43
43
  # or on an item completed before #1312 — so it is not verified on its summary alone.
44
44
  WI_FOUND=$(echo "$WI_DATA" | jq -r 'if (.data // null) != null then "yes" else "no" end' 2>/dev/null || echo "no")
45
45
  WI_EVIDENCE=$(echo "$WI_DATA" | jq -c 'if (.data.output.evidence | type) == "array" then .data.output.evidence else [] end' 2>/dev/null || echo '[]')
46
+ # The worker's decision record (#875): decisions, options not taken, assumptions.
47
+ # Shown to the reviewer as `record`; null when the worker sent none.
48
+ WI_RECORD=$(echo "$WI_DATA" | jq -c '.data.output | {decisions, notTaken, assumptions} | with_entries(select(.value != null)) | if length == 0 then null else . end' 2>/dev/null || echo 'null')
49
+ [ -z "$WI_RECORD" ] && WI_RECORD=null
46
50
  EVIDENCE_WARNING=""
47
51
  if [ "$WI_FOUND" = "yes" ]; then
48
52
  if [ "$(printf '%s' "$WI_EVIDENCE" | jq 'length')" = "0" ]; then
@@ -349,6 +353,7 @@ fi
349
353
  jq -n \
350
354
  --argjson evidence "$WI_EVIDENCE" \
351
355
  --arg evidenceWarning "$EVIDENCE_WARNING" \
356
+ --argjson record "$WI_RECORD" \
352
357
  --arg passed "$PASSED" \
353
358
  --arg score "$SCORE" \
354
359
  --arg feedback "$FEEDBACK" \
@@ -362,6 +367,7 @@ jq -n \
362
367
  evidence: ($evidence | to_entries | map(.value + {index: .key})),
363
368
  acceptWith: "complete-task with \"verdict\":\"verified\" and \"checks\":[{\"entry\":<evidence index, or null for a direct look>,\"did\":\"<what you did and saw>\",\"outcome\":\"pass\"}] (#1314)",
364
369
  evidenceWarning: (if $evidenceWarning != "" then $evidenceWarning else null end),
370
+ record: $record,
365
371
  passed: ($passed == "true"),
366
372
  score: ($score | tonumber),
367
373
  feedback: $feedback,
@@ -28,6 +28,9 @@ case "$url" in
28
28
  */api/task-pool/items/wi-ev)
29
29
  printf '%s\n200' '{"success":true,"data":{"id":"wi-ev","status":"done_by_worker","output":{"summary":"Report written","evidence":[{"type":"artifact","path":"/proj/report.md"},{"type":"command","command":"npm test","exitCode":0}]}}}'
30
30
  ;;
31
+ */api/task-pool/items/wi-rec)
32
+ printf '%s\n200' '{"success":true,"data":{"id":"wi-rec","status":"done_by_worker","output":{"summary":"Done","evidence":[{"type":"artifact","path":"/proj/a.md"}],"decisions":["Kept the v1 schema"],"assumptions":["Relay is on 1.5.24"]}}}'
33
+ ;;
31
34
  */api/task-pool/items/wi-noev)
32
35
  printf '%s\n200' '{"success":true,"data":{"id":"wi-noev","status":"done_by_worker","output":{"summary":"Trust me"}}}'
33
36
  ;;
@@ -128,6 +131,12 @@ assert_json_field "evidence is the first key of the verdict" \
128
131
  '{"workItemId":"wi-ev"}' 'keys_unsorted[0]' 'evidence'
129
132
  assert_json_field "each evidence entry carries its index for the checks (#1314)" \
130
133
  '{"workItemId":"wi-ev"}' '.evidence[1].index' '1'
134
+ assert_json_field "the worker's decision record is surfaced as record (#875)" \
135
+ '{"workItemId":"wi-rec"}' '.record.decisions[0]' 'Kept the v1 schema'
136
+ assert_json_field "record omits fields the worker did not send (#875)" \
137
+ '{"workItemId":"wi-rec"}' '.record | has("notTaken")' 'false'
138
+ assert_json_field "no record -> record is null (#875)" \
139
+ '{"workItemId":"wi-ev"}' '.record' 'null'
131
140
  assert_json_field "evidence block is surfaced from output.evidence" \
132
141
  '{"workItemId":"wi-ev"}' '[.evidence[].type] | join(",")' 'artifact,command'
133
142
  assert_json_field "no evidence warning when evidence is present" \
@@ -19,6 +19,11 @@ tags:
19
19
  - escalation
20
20
  - blockers
21
21
  - help
22
+ # Rule metadata (#877): what this rule prevents, where seen, when to re-test
23
+ prevents: "none recorded — part of the original default SOP library (2026-01-29); re-test before keeping"
24
+ seenOn: "unknown"
25
+ reviewBy: 2026-12-31
26
+ source: https://github.com/stevehuang0115/crewly/commit/77d504515
22
27
  ---
23
28
 
24
29
  # Blocker Handling
@@ -19,6 +19,11 @@ tags:
19
19
  - communication
20
20
  - team
21
21
  - protocol
22
+ # Rule metadata (#877): what this rule prevents, where seen, when to re-test
23
+ prevents: "none recorded — part of the original default SOP library (2026-01-29); re-test before keeping"
24
+ seenOn: "unknown"
25
+ reviewBy: 2026-12-31
26
+ source: https://github.com/stevehuang0115/crewly/commit/77d504515
22
27
  ---
23
28
 
24
29
  # Communication Protocol
@@ -24,6 +24,11 @@ tags:
24
24
  - delivery
25
25
  - quality
26
26
  - tiering
27
+ # Rule metadata (#877): what this rule prevents, where seen, when to re-test
28
+ prevents: "Every change ran the full 9-step, 3-review process regardless of risk, so an internal one-line fix cost as much as a customer-facing release (P0 plan 2026-05-03, decision 3)"
29
+ seenOn: "claude-code, model not recorded (2026-05)"
30
+ reviewBy: 2027-01-31
31
+ source: https://github.com/stevehuang0115/crewly/pull/411
27
32
  ---
28
33
 
29
34
  # Development Process Tiers
@@ -22,6 +22,11 @@ tags:
22
22
  - proactive
23
23
  - milestone
24
24
  - silent-shipping
25
+ # Rule metadata (#877): what this rule prevents, where seen, when to re-test
26
+ prevents: "Workers and team leads shipped milestones silently: 21 role prompts had 0–1 mentions of 'milestone', so progress surfaced only when someone asked (RC1, QW-1)"
27
+ seenOn: "claude-code, model not recorded (2026-05)"
28
+ reviewBy: 2027-01-31
29
+ source: https://github.com/stevehuang0115/crewly/issues/427
25
30
  ---
26
31
 
27
32
  # Mid-Flight Milestone Surface
@@ -22,6 +22,11 @@ tags:
22
22
  - owner
23
23
  - external
24
24
  - tone
25
+ # Rule metadata (#877): what this rule prevents, where seen, when to re-test
26
+ prevents: "Owner-facing messages leaked task ids, session names and tier codes, gave a status with no decision/reason/impact, and asked the owner questions the agent could decide (P0 plan 2026-05-03, decision 6)"
27
+ seenOn: "claude-code, model not recorded (2026-05)"
28
+ reviewBy: 2027-01-31
29
+ source: https://github.com/stevehuang0115/crewly/pull/413
25
30
  ---
26
31
 
27
32
  # Owner-Facing Communication Standard
@@ -21,6 +21,11 @@ tags:
21
21
  - authoring
22
22
  - prompts
23
23
  - skills
24
+ # Rule metadata (#877): what this rule prevents, where seen, when to re-test
25
+ prevents: "none recorded as an incident — skills and norms were written for human readers (long prose, vague verbs, no examples); borrowed from mattpocock/skills, enforced by the skill lint"
26
+ seenOn: "unknown (2026-10)"
27
+ reviewBy: 2027-01-31
28
+ source: https://github.com/stevehuang0115/crewly/pull/1277
24
29
  ---
25
30
 
26
31
  # Writing for Agents
@@ -19,6 +19,11 @@ tags:
19
19
  - standards
20
20
  - quality
21
21
  - typescript
22
+ # Rule metadata (#877): what this rule prevents, where seen, when to re-test
23
+ prevents: "none recorded — part of the original default SOP library (2026-01-29); re-test before keeping"
24
+ seenOn: "unknown"
25
+ reviewBy: 2026-12-31
26
+ source: https://github.com/stevehuang0115/crewly/commit/77d504515
22
27
  ---
23
28
 
24
29
  # Coding Standards
@@ -22,6 +22,11 @@ tags:
22
22
  - debugging
23
23
  - testing
24
24
  - quality
25
+ # Rule metadata (#877): what this rule prevents, where seen, when to re-test
26
+ prevents: "none recorded as an incident — no debugging SOP existed; added with a pre-commit scan for leftover [DEBUG- markers, borrowed from mattpocock/skills"
27
+ seenOn: "unknown (2026-10)"
28
+ reviewBy: 2027-01-31
29
+ source: https://github.com/stevehuang0115/crewly/pull/1277
25
30
  ---
26
31
 
27
32
  # Debugging
@@ -22,6 +22,11 @@ tags:
22
22
  - workflow
23
23
  - version-control
24
24
  - worktree
25
+ # Rule metadata (#877): what this rule prevents, where seen, when to re-test
26
+ prevents: "none recorded — part of the original default SOP library (2026-01-29); re-test before keeping"
27
+ seenOn: "unknown"
28
+ reviewBy: 2026-12-31
29
+ source: https://github.com/stevehuang0115/crewly/commit/77d504515
25
30
  ---
26
31
 
27
32
  # Git Workflow
@@ -19,6 +19,11 @@ tags:
19
19
  - testing
20
20
  - quality
21
21
  - coverage
22
+ # Rule metadata (#877): what this rule prevents, where seen, when to re-test
23
+ prevents: "none recorded — part of the original default SOP library (2026-01-29); re-test before keeping"
24
+ seenOn: "unknown"
25
+ reviewBy: 2026-12-31
26
+ source: https://github.com/stevehuang0115/crewly/commit/77d504515
22
27
  ---
23
28
 
24
29
  # Testing Requirements
@@ -19,6 +19,11 @@ tags:
19
19
  - tracking
20
20
  - reporting
21
21
  - status
22
+ # Rule metadata (#877): what this rule prevents, where seen, when to re-test
23
+ prevents: "none recorded — part of the original default SOP library (2026-01-29); re-test before keeping"
24
+ seenOn: "unknown"
25
+ reviewBy: 2026-12-31
26
+ source: https://github.com/stevehuang0115/crewly/commit/77d504515
22
27
  ---
23
28
 
24
29
  # Progress Tracking
@@ -19,6 +19,11 @@ tags:
19
19
  - planning
20
20
  - workflow
21
21
  - tasks
22
+ # Rule metadata (#877): what this rule prevents, where seen, when to re-test
23
+ prevents: "none recorded — part of the original default SOP library (2026-01-29); re-test before keeping"
24
+ seenOn: "unknown"
25
+ reviewBy: 2026-12-31
26
+ source: https://github.com/stevehuang0115/crewly/commit/77d504515
22
27
  ---
23
28
 
24
29
  # Task Decomposition
@@ -19,6 +19,11 @@ tags:
19
19
  - testing
20
20
  - quality
21
21
  - qa
22
+ # Rule metadata (#877): what this rule prevents, where seen, when to re-test
23
+ prevents: "none recorded — part of the original default SOP library (2026-01-29); re-test before keeping"
24
+ seenOn: "unknown"
25
+ reviewBy: 2026-12-31
26
+ source: https://github.com/stevehuang0115/crewly/commit/77d504515
22
27
  ---
23
28
 
24
29
  # Testing Procedures
@@ -1826,6 +1826,17 @@ export declare const COMPLETION_EVIDENCE_CONSTANTS: {
1826
1826
  };
1827
1827
  /** Worker evidence entries listed, numbered, in a review item's description (#1314). */
1828
1828
  readonly REVIEW_LISTED_ENTRIES: 10;
1829
+ /**
1830
+ * The worker's decision record (#875): optional completion fields the
1831
+ * reviewer reads beside the evidence. Each is a list of short strings.
1832
+ */
1833
+ readonly DECISION_FIELDS: readonly ["decisions", "notTaken", "assumptions"];
1834
+ /** Heading the review brief gives each decision field (#875). */
1835
+ readonly DECISION_LABELS: Record<string, string>;
1836
+ /** Entries of one decision field shown in a review brief (#875). */
1837
+ readonly REVIEW_LISTED_DECISIONS: 5;
1838
+ /** Max characters of one decision entry in a review brief (#875). */
1839
+ readonly DECISION_ENTRY_MAX_CHARS: 300;
1829
1840
  /** Outcomes a reviewer records for one check (#1314). */
1830
1841
  readonly CHECK_OUTCOMES: readonly string[];
1831
1842
  /** The shape of a reviewer's check record, quoted in every refusal (#1314). */
@@ -8056,6 +8067,30 @@ export declare const TRACE_CONSTANTS: {
8056
8067
  * one ladder: the agent once, then its lead once, then one plain line to the
8057
8068
  * owner. The owner is never the retry loop.
8058
8069
  */
8070
+ /**
8071
+ * Daily spot check of verified work (crewly#1315): a few verified WorkItems
8072
+ * from the last day are re-checked for their artifacts still existing.
8073
+ */
8074
+ export declare const VERIFIED_SPOT_CHECK_CONSTANTS: {
8075
+ /** `=0` switches the sampler off */
8076
+ readonly ENV_SWITCH: "CREWLY_VERIFIED_SPOT_CHECK";
8077
+ /** Verified items completed within this window are candidates */
8078
+ readonly WINDOW_MS: number;
8079
+ /** Most WorkItems re-checked per run */
8080
+ readonly SAMPLE_SIZE: 10;
8081
+ /** How often the service asks whether today's run is still owed */
8082
+ readonly CHECK_INTERVAL_MS: number;
8083
+ /** Delay before the first check after boot */
8084
+ readonly BOOT_DELAY_MS: number;
8085
+ /** State file under CREWLY_HOME: the last run's day and result */
8086
+ readonly STATE_FILE: "verified-spot-check.json";
8087
+ /** Title of the owner alert when a sampled artifact is gone */
8088
+ readonly OWNER_ALERT_TITLE: "Verified work spot check";
8089
+ /** Discrepancies listed under the digest line (the rest are counted) */
8090
+ readonly MAX_LISTED_DISCREPANCIES: 5;
8091
+ /** Longest WorkItem title quoted in a discrepancy row */
8092
+ readonly TITLE_MAX_CHARS: 60;
8093
+ };
8059
8094
  export declare const STALL_WATCHER_CONSTANTS: {
8060
8095
  /** `=false` switches the watcher off entirely */
8061
8096
  readonly ENV_KILL_SWITCH: "CREWLY_STALL_WATCHER";