crewly 1.8.8 → 1.8.11

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 (139) hide show
  1. package/config/roles/_common/memory-instructions.md +6 -5
  2. package/config/roles/_common/wiki-instructions.md +49 -0
  3. package/config/roles/architect/prompt.md +2 -2
  4. package/config/roles/backend-developer/prompt.md +2 -2
  5. package/config/roles/designer/prompt.md +2 -2
  6. package/config/roles/developer/prompt.md +2 -2
  7. package/config/roles/frontend-developer/prompt.md +2 -2
  8. package/config/roles/fullstack-dev/prompt.md +2 -2
  9. package/config/roles/generalist/prompt.md +2 -2
  10. package/config/roles/ops/prompt.md +2 -2
  11. package/config/roles/orchestrator/prompt.md +135 -11
  12. package/config/roles/product-manager/prompt.md +2 -2
  13. package/config/roles/qa/prompt.md +2 -2
  14. package/config/roles/qa-engineer/prompt.md +2 -2
  15. package/config/roles/researcher/prompt.md +15 -6
  16. package/config/roles/sales/prompt.md +2 -2
  17. package/config/roles/support/prompt.md +2 -2
  18. package/config/roles/team-leader/prompt.md +17 -2
  19. package/config/roles/tpm/prompt.md +2 -2
  20. package/config/roles/ux-designer/prompt.md +2 -2
  21. package/config/skills/orchestrator/wiki-cleanup/SKILL.md +89 -0
  22. package/config/skills/orchestrator/wiki-cleanup/execute.sh +139 -0
  23. package/config/skills/orchestrator/wiki-lint/SKILL.md +75 -0
  24. package/config/skills/orchestrator/wiki-lint/execute.sh +66 -0
  25. package/config/skills/orchestrator/wiki-migrate/SKILL.md +103 -0
  26. package/config/skills/orchestrator/wiki-migrate/execute.sh +82 -0
  27. package/config/skills/orchestrator/wiki-process-queue/SKILL.md +9 -1
  28. package/dist/backend/backend/src/constants.d.ts +12 -0
  29. package/dist/backend/backend/src/constants.d.ts.map +1 -1
  30. package/dist/backend/backend/src/constants.js +12 -0
  31. package/dist/backend/backend/src/constants.js.map +1 -1
  32. package/dist/backend/backend/src/controllers/browser/browser.controller.d.ts.map +1 -1
  33. package/dist/backend/backend/src/controllers/browser/browser.controller.js +17 -0
  34. package/dist/backend/backend/src/controllers/browser/browser.controller.js.map +1 -1
  35. package/dist/backend/backend/src/controllers/cloud/cloud.controller.d.ts.map +1 -1
  36. package/dist/backend/backend/src/controllers/cloud/cloud.controller.js +8 -1
  37. package/dist/backend/backend/src/controllers/cloud/cloud.controller.js.map +1 -1
  38. package/dist/backend/backend/src/controllers/task-pool/task-pool.controller.d.ts +18 -0
  39. package/dist/backend/backend/src/controllers/task-pool/task-pool.controller.d.ts.map +1 -1
  40. package/dist/backend/backend/src/controllers/task-pool/task-pool.controller.js +63 -0
  41. package/dist/backend/backend/src/controllers/task-pool/task-pool.controller.js.map +1 -1
  42. package/dist/backend/backend/src/controllers/task-pool/task-pool.routes.d.ts.map +1 -1
  43. package/dist/backend/backend/src/controllers/task-pool/task-pool.routes.js +5 -1
  44. package/dist/backend/backend/src/controllers/task-pool/task-pool.routes.js.map +1 -1
  45. package/dist/backend/backend/src/controllers/wiki/wiki.controller.d.ts +109 -0
  46. package/dist/backend/backend/src/controllers/wiki/wiki.controller.d.ts.map +1 -1
  47. package/dist/backend/backend/src/controllers/wiki/wiki.controller.js +418 -4
  48. package/dist/backend/backend/src/controllers/wiki/wiki.controller.js.map +1 -1
  49. package/dist/backend/backend/src/controllers/wiki/wiki.routes.d.ts.map +1 -1
  50. package/dist/backend/backend/src/controllers/wiki/wiki.routes.js +11 -1
  51. package/dist/backend/backend/src/controllers/wiki/wiki.routes.js.map +1 -1
  52. package/dist/backend/backend/src/index.d.ts.map +1 -1
  53. package/dist/backend/backend/src/index.js +79 -7
  54. package/dist/backend/backend/src/index.js.map +1 -1
  55. package/dist/backend/backend/src/index.js.orc-bak-20260529 +3130 -0
  56. package/dist/backend/backend/src/services/ai/prompt-builder.service.js +1 -1
  57. package/dist/backend/backend/src/services/browser/browser-bridge.service.d.ts.map +1 -1
  58. package/dist/backend/backend/src/services/browser/browser-bridge.service.js +15 -29
  59. package/dist/backend/backend/src/services/browser/browser-bridge.service.js.map +1 -1
  60. package/dist/backend/backend/src/services/browser/browser-proxy.service.d.ts +97 -1
  61. package/dist/backend/backend/src/services/browser/browser-proxy.service.d.ts.map +1 -1
  62. package/dist/backend/backend/src/services/browser/browser-proxy.service.js +174 -15
  63. package/dist/backend/backend/src/services/browser/browser-proxy.service.js.map +1 -1
  64. package/dist/backend/backend/src/services/browser/browser-relay-adapter.service.d.ts +12 -4
  65. package/dist/backend/backend/src/services/browser/browser-relay-adapter.service.d.ts.map +1 -1
  66. package/dist/backend/backend/src/services/browser/browser-relay-adapter.service.js +17 -5
  67. package/dist/backend/backend/src/services/browser/browser-relay-adapter.service.js.map +1 -1
  68. package/dist/backend/backend/src/services/cloud/cloud-client.service.d.ts +75 -0
  69. package/dist/backend/backend/src/services/cloud/cloud-client.service.d.ts.map +1 -1
  70. package/dist/backend/backend/src/services/cloud/cloud-client.service.js +164 -12
  71. package/dist/backend/backend/src/services/cloud/cloud-client.service.js.map +1 -1
  72. package/dist/backend/backend/src/services/reconciler/reconciler-data-provider.d.ts.map +1 -1
  73. package/dist/backend/backend/src/services/reconciler/reconciler-data-provider.js +50 -0
  74. package/dist/backend/backend/src/services/reconciler/reconciler-data-provider.js.map +1 -1
  75. package/dist/backend/backend/src/services/task-pool/task-pool.service.d.ts +19 -0
  76. package/dist/backend/backend/src/services/task-pool/task-pool.service.d.ts.map +1 -1
  77. package/dist/backend/backend/src/services/task-pool/task-pool.service.js +45 -0
  78. package/dist/backend/backend/src/services/task-pool/task-pool.service.js.map +1 -1
  79. package/dist/backend/backend/src/services/v3/agent-auto-claim.service.d.ts.map +1 -1
  80. package/dist/backend/backend/src/services/v3/agent-auto-claim.service.js +34 -1
  81. package/dist/backend/backend/src/services/v3/agent-auto-claim.service.js.map +1 -1
  82. package/dist/backend/backend/src/services/wiki/wiki-backlinks.service.d.ts +72 -0
  83. package/dist/backend/backend/src/services/wiki/wiki-backlinks.service.d.ts.map +1 -0
  84. package/dist/backend/backend/src/services/wiki/wiki-backlinks.service.js +186 -0
  85. package/dist/backend/backend/src/services/wiki/wiki-backlinks.service.js.map +1 -0
  86. package/dist/backend/backend/src/services/wiki/wiki-bookkeep-trigger.service.d.ts +4 -1
  87. package/dist/backend/backend/src/services/wiki/wiki-bookkeep-trigger.service.d.ts.map +1 -1
  88. package/dist/backend/backend/src/services/wiki/wiki-bookkeep-trigger.service.js +24 -1
  89. package/dist/backend/backend/src/services/wiki/wiki-bookkeep-trigger.service.js.map +1 -1
  90. package/dist/backend/backend/src/services/wiki/wiki-cleanup.service.d.ts +160 -0
  91. package/dist/backend/backend/src/services/wiki/wiki-cleanup.service.d.ts.map +1 -0
  92. package/dist/backend/backend/src/services/wiki/wiki-cleanup.service.js +399 -0
  93. package/dist/backend/backend/src/services/wiki/wiki-cleanup.service.js.map +1 -0
  94. package/dist/backend/backend/src/services/wiki/wiki-lint.service.d.ts +182 -0
  95. package/dist/backend/backend/src/services/wiki/wiki-lint.service.d.ts.map +1 -0
  96. package/dist/backend/backend/src/services/wiki/wiki-lint.service.js +505 -0
  97. package/dist/backend/backend/src/services/wiki/wiki-lint.service.js.map +1 -0
  98. package/dist/backend/backend/src/services/wiki/wiki-migrate.service.d.ts +232 -0
  99. package/dist/backend/backend/src/services/wiki/wiki-migrate.service.d.ts.map +1 -0
  100. package/dist/backend/backend/src/services/wiki/wiki-migrate.service.js +1416 -0
  101. package/dist/backend/backend/src/services/wiki/wiki-migrate.service.js.map +1 -0
  102. package/dist/backend/backend/src/services/wiki/wiki-recent.service.d.ts +51 -0
  103. package/dist/backend/backend/src/services/wiki/wiki-recent.service.d.ts.map +1 -0
  104. package/dist/backend/backend/src/services/wiki/wiki-recent.service.js +102 -0
  105. package/dist/backend/backend/src/services/wiki/wiki-recent.service.js.map +1 -0
  106. package/dist/backend/backend/src/services/wiki/wiki-reflect-trigger.service.d.ts +84 -0
  107. package/dist/backend/backend/src/services/wiki/wiki-reflect-trigger.service.d.ts.map +1 -0
  108. package/dist/backend/backend/src/services/wiki/wiki-reflect-trigger.service.js +156 -0
  109. package/dist/backend/backend/src/services/wiki/wiki-reflect-trigger.service.js.map +1 -0
  110. package/dist/backend/backend/src/services/wiki/wiki-search.service.d.ts +90 -0
  111. package/dist/backend/backend/src/services/wiki/wiki-search.service.d.ts.map +1 -0
  112. package/dist/backend/backend/src/services/wiki/wiki-search.service.js +190 -0
  113. package/dist/backend/backend/src/services/wiki/wiki-search.service.js.map +1 -0
  114. package/dist/backend/backend/src/services/wiki/wiki-workitem-bridge.service.d.ts +164 -0
  115. package/dist/backend/backend/src/services/wiki/wiki-workitem-bridge.service.d.ts.map +1 -0
  116. package/dist/backend/backend/src/services/wiki/wiki-workitem-bridge.service.js +675 -0
  117. package/dist/backend/backend/src/services/wiki/wiki-workitem-bridge.service.js.map +1 -0
  118. package/dist/backend/backend/src/services/workflow/cron-task.service.d.ts.map +1 -1
  119. package/dist/backend/backend/src/services/workflow/cron-task.service.js +65 -0
  120. package/dist/backend/backend/src/services/workflow/cron-task.service.js.map +1 -1
  121. package/dist/backend/backend/src/types/cron-task.types.d.ts +16 -1
  122. package/dist/backend/backend/src/types/cron-task.types.d.ts.map +1 -1
  123. package/dist/cli/backend/src/constants.d.ts +12 -0
  124. package/dist/cli/backend/src/constants.d.ts.map +1 -1
  125. package/dist/cli/backend/src/constants.js +12 -0
  126. package/dist/cli/backend/src/constants.js.map +1 -1
  127. package/dist/cli/backend/src/services/task-pool/task-pool.service.d.ts +19 -0
  128. package/dist/cli/backend/src/services/task-pool/task-pool.service.d.ts.map +1 -1
  129. package/dist/cli/backend/src/services/task-pool/task-pool.service.js +45 -0
  130. package/dist/cli/backend/src/services/task-pool/task-pool.service.js.map +1 -1
  131. package/frontend/dist/assets/{index-db3f5041.css → index-068bb4f6.css} +10 -1
  132. package/frontend/dist/assets/index-c24ceb15.js +4960 -0
  133. package/frontend/dist/index.html +2 -2
  134. package/package.json +1 -1
  135. package/config/skills/agent/core/query-knowledge/SKILL.md +0 -87
  136. package/config/skills/agent/core/query-knowledge/execute.sh +0 -30
  137. package/config/skills/orchestrator/query-knowledge/SKILL.md +0 -75
  138. package/config/skills/orchestrator/query-knowledge/execute.sh +0 -30
  139. package/frontend/dist/assets/index-cc115bb4.js +0 -4926
@@ -16,9 +16,10 @@ You have MCP tools that let you store and retrieve knowledge that persists acros
16
16
  - Required: `learning` (what you learned)
17
17
  - **Always pass**: `teamMemberId` (your Session Name) and `projectPath` (your Project Path from the Identity section)
18
18
 
19
- - **`query-knowledge`** — Search company knowledge base for SOPs, runbooks, architecture docs
20
- - Required: `query` (what to search for)
21
- - Optional: `scope` (`global` or `project`), `category`, `projectPath`
19
+ - **`wiki-query`** — Search the LLM-wiki (v2.1) for SOPs, runbooks, decisions, patterns, customer/people pages
20
+ - Required: `vault` (absolute path; see `wiki-instructions.md` for the per-topic vault picker), `query`
21
+ - Optional: `topK` (default 5)
22
+ - **Replaces the legacy `query-knowledge` skill (retired 2026-05-27)** — the OSS migration script moved every doc, SOP, runbook into the appropriate wiki vault; query the wiki, not the old `.crewly/docs/` / `.crewly/knowledge/` stores
22
23
 
23
24
  ### When to Use Memory Tools
24
25
 
@@ -36,8 +37,8 @@ You have MCP tools that let you store and retrieve knowledge that persists acros
36
37
  - Note cross-agent user preferences (category: `user_preference`, scope: `project`)
37
38
 
38
39
  **Before process-oriented tasks** (deployment, setup, incident response):
39
- - **Query global knowledge** for SOPs and runbooks: `query-knowledge` with the relevant topic
40
- - These documents contain step-by-step procedures your team has documented
40
+ - **Query the wiki** with `wiki-query` against the right vault (global vault for cross-team SOPs, team vault for team-norms, project vault for project-specific runbooks — see `wiki-instructions.md`)
41
+ - These documents contain step-by-step procedures your team has documented; the LLM-wiki has fully replaced the legacy `query-knowledge`/`.crewly/docs/` storage as of 2026-05-27
41
42
 
42
43
  **Before answering questions** about deployment, architecture, past decisions, or infrastructure:
43
44
  - **Always call `recall` first** to check stored knowledge before answering from scratch
@@ -1,3 +1,44 @@
1
+ ## LLM-Wiki — Read the wiki BEFORE replying (pre-turn discipline, 2026-05-26)
2
+
3
+ The wiki is the team's **shared memory**. Reading it before you reply prevents you from contradicting past decisions, re-discovering known gotchas, or telling someone something the team already documented.
4
+
5
+ **Before you reply to ANY message that touches history, decisions, patterns, customers, people, or norms, run `wiki-query` first.**
6
+
7
+ Concretely — query when the topic involves:
8
+
9
+ - A past decision, deprecation, or lock ("we already decided…")
10
+ - A customer / partner / competitor by name (Anthropic, Closie, …)
11
+ - A known gotcha / pattern / learning (verify-output races, MV3 SW dormancy, …)
12
+ - A team norm or SOP question (canDelegate, escalation chain, ROE)
13
+ - Anyone's role or responsibilities (Steve, an agent name, a session id)
14
+
15
+ Command:
16
+ ```bash
17
+ bash config/skills/agent/core/wiki-query/execute.sh \
18
+ --vault <path> # see "Which vault?" table below
19
+ --query "<topic>" # natural language
20
+ --topK 5 # default 5; raise to 10 for broad recall
21
+ ```
22
+
23
+ **Which vault to query** (pick by what your question is about):
24
+
25
+ | Topic type | Vault |
26
+ |---|---|
27
+ | **OSS-distributed SOPs** — content production, customer onboarding, publishing policy, expert distillation, innovation strategy, dev process tiers, git workflow, coding standards, testing requirements, blocker handling, communication protocol, PM task decomposition, progress tracking, QA testing procedures | **`~/.crewly/global-wiki`** ← `llm-curated/sops/<role>/` and `llm-curated/sops/domain/` |
28
+ | Cross-team decisions / company OKRs / Steve-locked positions | `~/.crewly/global-wiki` |
29
+ | Team SOPs / team norms / canDelegate / who reports to whom | `~/.crewly/teams/<your-team-id>/wiki` |
30
+ | Project-specific decisions / customers / patterns / spec history / project deploy docs (CLAUDE.md, DEPLOYMENT.md) | `<project>/.crewly/wiki` |
31
+ | Need both project + team perspective | Run `wiki-query` **twice**, once per vault, then synthesize |
32
+ | **Cross-project synthesis** (智库 only — Atlas/Iris/Kai/Sage) | Run `wiki-query` against each project vault you care about + global, then synthesize (Phase 2 cross-scope reducer not yet shipped) |
33
+
34
+ **Fallback order when uncertain (MANDATORY):** if your topic could be SOP-ish but you're not sure → query **global FIRST, then team, then project**. The 2026-05-27 "content SOP not found" incident was caused by querying only the project vault when the SOP lived in global. Don't repeat it.
35
+
36
+ **If `wiki-query` returns relevant context:** cite it in your reply (`see [[customers/anthropic]]` style — the UI renders it as a clickable link). Reply quality improves measurably when you ground in past wiki content.
37
+
38
+ **If `wiki-query` returns nothing relevant in your FIRST chosen vault:** try the other two vaults in the fallback order ABOVE before concluding "wiki has no <topic>". Only after global + team + project all return zero should you report a true gap. After replying, if the conversation produced something worth saving, `wiki-queue-add` it (per the queue discipline below).
39
+
40
+ ---
41
+
1
42
  ## LLM-Wiki — Queue Worth-Saving Content (per-turn discipline)
2
43
 
3
44
  The Crewly LLM-wiki captures **only what agents judge worth remembering**. There is NO automatic capture — you are the gate.
@@ -30,4 +71,12 @@ If YES, before yielding, call `config/skills/orchestrator/wiki-queue-add/execute
30
71
 
31
72
  The item lands in the queue with `status: pending`. Later — either when you're idle, OR when a `[BOOKKEEP]` message arrives — drain the queue with `wiki-process-queue`: claim an item, read the vault context, let your LLM pick a target folder (no preset taxonomy beyond the frozen ones), call `wiki-ingest`, then POST `/queue/<id>/process` to commit. If after reading the context you decide the item isn't actually worth saving, POST `/queue/<id>/skip` with a `skipReason`.
32
73
 
74
+ **Cascade-update rule (2026-05-26):** when you process an item, also update **related** pages — run `wiki-query` for the topic, read pages it surfaces, and either update them (if the new content makes them stale / contradicts them) or cross-link them with `[[…]]`. Per Karpathy "a single source might touch 10-15 wiki pages." Load-bearing items (customers, decisions, OKRs) deserve 3-7 cascade touches; routine learnings 0-1. Also append the new page in `llm-curated/index.md` so future readers find it. See `wiki-process-queue` SKILL.md for the full rule.
75
+
33
76
  **Bookkeep cadence:** when you receive `[BOOKKEEP] vault=…`, run `wiki-bookkeep` for that vault. The report surfaces duplicate clusters and consolidation candidates — use your LLM to merge them.
77
+
78
+ **`[REFLECT-WIKI]` cadence (2026-05-24):** the backend pings you when no `wiki-queue-add` has fired against a vault in the last 4h (configurable). When you see `[REFLECT-WIKI] vault=…`:
79
+
80
+ 1. Sweep recent conversation for decisions / customer facts / patterns / gotchas worth saving.
81
+ 2. Call `wiki-queue-add` for each, with a non-trivial `--reason`.
82
+ 3. If after a real sweep there genuinely is nothing wiki-worthy, reply `nothing this period: <one-sentence justification>` so the audit trail shows the consideration. Silence reads as forgotten, not deliberate.
@@ -73,9 +73,9 @@ You have bash skills that let you store and retrieve knowledge that persists acr
73
73
  bash {{AGENT_SKILLS_PATH}}/core/record-learning/execute.sh '{"agentId":"{{SESSION_NAME}}","agentRole":"{{ROLE}}","projectPath":"{{PROJECT_PATH}}","learning":"what you learned"}'
74
74
  ```
75
75
 
76
- - **`query-knowledge`** — Search company knowledge base for SOPs, runbooks, architecture docs
76
+ - **`wiki-query`** — Search the LLM-wiki (v2.1) for SOPs, runbooks, decisions, patterns, people/customer pages (replaces the retired `query-knowledge`)
77
77
  ```bash
78
- bash {{AGENT_SKILLS_PATH}}/core/query-knowledge/execute.sh '{"query":"deployment process","scope":"global"}'
78
+ bash {{AGENT_SKILLS_PATH}}/core/wiki-query/execute.sh --vault ~/.crewly/global-wiki --query "deployment process" --top-k 5
79
79
  ```
80
80
 
81
81
  ### When to Use Memory Tools
@@ -72,9 +72,9 @@ You have bash skills that let you store and retrieve knowledge that persists acr
72
72
  bash {{AGENT_SKILLS_PATH}}/core/record-learning/execute.sh '{"agentId":"{{SESSION_NAME}}","agentRole":"{{ROLE}}","projectPath":"{{PROJECT_PATH}}","learning":"what you learned"}'
73
73
  ```
74
74
 
75
- - **`query-knowledge`** — Search company knowledge base for SOPs, runbooks, architecture docs
75
+ - **`wiki-query`** — Search the LLM-wiki (v2.1) for SOPs, runbooks, decisions, patterns, people/customer pages (replaces the retired `query-knowledge`)
76
76
  ```bash
77
- bash {{AGENT_SKILLS_PATH}}/core/query-knowledge/execute.sh '{"query":"deployment process","scope":"global"}'
77
+ bash {{AGENT_SKILLS_PATH}}/core/wiki-query/execute.sh --vault ~/.crewly/global-wiki --query "deployment process" --top-k 5
78
78
  ```
79
79
 
80
80
  ### When to Use Memory Tools
@@ -71,9 +71,9 @@ You have bash skills that let you store and retrieve knowledge that persists acr
71
71
  bash {{AGENT_SKILLS_PATH}}/core/record-learning/execute.sh '{"agentId":"{{SESSION_NAME}}","agentRole":"{{ROLE}}","projectPath":"{{PROJECT_PATH}}","learning":"what you learned"}'
72
72
  ```
73
73
 
74
- - **`query-knowledge`** — Search company knowledge base for SOPs, runbooks, architecture docs
74
+ - **`wiki-query`** — Search the LLM-wiki (v2.1) for SOPs, runbooks, decisions, patterns, people/customer pages (replaces the retired `query-knowledge`)
75
75
  ```bash
76
- bash {{AGENT_SKILLS_PATH}}/core/query-knowledge/execute.sh '{"query":"deployment process","scope":"global"}'
76
+ bash {{AGENT_SKILLS_PATH}}/core/wiki-query/execute.sh --vault ~/.crewly/global-wiki --query "deployment process" --top-k 5
77
77
  ```
78
78
 
79
79
  ### When to Use Memory Tools
@@ -189,9 +189,9 @@ You have bash skills that let you store and retrieve knowledge that persists acr
189
189
  bash {{AGENT_SKILLS_PATH}}/core/record-learning/execute.sh '{"agentId":"{{SESSION_NAME}}","agentRole":"{{ROLE}}","projectPath":"{{PROJECT_PATH}}","learning":"what you learned"}'
190
190
  ```
191
191
 
192
- - **`query-knowledge`** — Search company knowledge base for SOPs, runbooks, architecture docs
192
+ - **`wiki-query`** — Search the LLM-wiki (v2.1) for SOPs, runbooks, decisions, patterns, people/customer pages (replaces the retired `query-knowledge`)
193
193
  ```bash
194
- bash {{AGENT_SKILLS_PATH}}/core/query-knowledge/execute.sh '{"query":"deployment process","scope":"global"}'
194
+ bash {{AGENT_SKILLS_PATH}}/core/wiki-query/execute.sh --vault ~/.crewly/global-wiki --query "deployment process" --top-k 5
195
195
  ```
196
196
 
197
197
  ### When to Use Memory Tools
@@ -72,9 +72,9 @@ You have bash skills that let you store and retrieve knowledge that persists acr
72
72
  bash {{AGENT_SKILLS_PATH}}/core/record-learning/execute.sh '{"agentId":"{{SESSION_NAME}}","agentRole":"{{ROLE}}","projectPath":"{{PROJECT_PATH}}","learning":"what you learned"}'
73
73
  ```
74
74
 
75
- - **`query-knowledge`** — Search company knowledge base for SOPs, runbooks, architecture docs
75
+ - **`wiki-query`** — Search the LLM-wiki (v2.1) for SOPs, runbooks, decisions, patterns, people/customer pages (replaces the retired `query-knowledge`)
76
76
  ```bash
77
- bash {{AGENT_SKILLS_PATH}}/core/query-knowledge/execute.sh '{"query":"deployment process","scope":"global"}'
77
+ bash {{AGENT_SKILLS_PATH}}/core/wiki-query/execute.sh --vault ~/.crewly/global-wiki --query "deployment process" --top-k 5
78
78
  ```
79
79
 
80
80
  ### When to Use Memory Tools
@@ -72,9 +72,9 @@ You have bash skills that let you store and retrieve knowledge that persists acr
72
72
  bash {{AGENT_SKILLS_PATH}}/core/record-learning/execute.sh '{"agentId":"{{SESSION_NAME}}","agentRole":"{{ROLE}}","projectPath":"{{PROJECT_PATH}}","learning":"what you learned"}'
73
73
  ```
74
74
 
75
- - **`query-knowledge`** — Search company knowledge base for SOPs, runbooks, architecture docs
75
+ - **`wiki-query`** — Search the LLM-wiki (v2.1) for SOPs, runbooks, decisions, patterns, people/customer pages (replaces the retired `query-knowledge`)
76
76
  ```bash
77
- bash {{AGENT_SKILLS_PATH}}/core/query-knowledge/execute.sh '{"query":"deployment process","scope":"global"}'
77
+ bash {{AGENT_SKILLS_PATH}}/core/wiki-query/execute.sh --vault ~/.crewly/global-wiki --query "deployment process" --top-k 5
78
78
  ```
79
79
 
80
80
  ### When to Use Memory Tools
@@ -73,9 +73,9 @@ You have bash skills that let you store and retrieve knowledge that persists acr
73
73
  bash {{AGENT_SKILLS_PATH}}/core/record-learning/execute.sh '{"agentId":"{{SESSION_NAME}}","agentRole":"{{ROLE}}","projectPath":"{{PROJECT_PATH}}","learning":"what you learned"}'
74
74
  ```
75
75
 
76
- - **`query-knowledge`** — Search company knowledge base for SOPs, runbooks, architecture docs
76
+ - **`wiki-query`** — Search the LLM-wiki (v2.1) for SOPs, runbooks, decisions, patterns, people/customer pages (replaces the retired `query-knowledge`)
77
77
  ```bash
78
- bash {{AGENT_SKILLS_PATH}}/core/query-knowledge/execute.sh '{"query":"deployment process","scope":"global"}'
78
+ bash {{AGENT_SKILLS_PATH}}/core/wiki-query/execute.sh --vault ~/.crewly/global-wiki --query "deployment process" --top-k 5
79
79
  ```
80
80
 
81
81
  ### When to Use Memory Tools
@@ -86,9 +86,9 @@ You have bash skills that let you store and retrieve knowledge that persists acr
86
86
  bash {{AGENT_SKILLS_PATH}}/core/record-learning/execute.sh '{"agentId":"{{SESSION_NAME}}","agentRole":"{{ROLE}}","projectPath":"{{PROJECT_PATH}}","learning":"what you learned"}'
87
87
  ```
88
88
 
89
- - **`query-knowledge`** — Search company knowledge base for SOPs, runbooks, architecture docs
89
+ - **`wiki-query`** — Search the LLM-wiki (v2.1) for SOPs, runbooks, decisions, patterns, people/customer pages (replaces the retired `query-knowledge`)
90
90
  ```bash
91
- bash {{AGENT_SKILLS_PATH}}/core/query-knowledge/execute.sh '{"query":"deployment process","scope":"global"}'
91
+ bash {{AGENT_SKILLS_PATH}}/core/wiki-query/execute.sh --vault ~/.crewly/global-wiki --query "deployment process" --top-k 5
92
92
  ```
93
93
 
94
94
  ### When to Use Memory Tools
@@ -588,8 +588,30 @@ If YES, before you yield, call `config/skills/orchestrator/wiki-queue-add/execut
588
588
 
589
589
  After queueing, continue the turn normally. A separate `wiki-process-queue` run (batch, run periodically by you OR when bookkeep fires) classifies queued items, picks the target page (`llm-curated/customers/<name>.md`, `llm-curated/decisions/<slug>.md`, etc. — the LLM decides; no preset taxonomy beyond the frozen folders), and calls `wiki-ingest` to write.
590
590
 
591
+ **Cascade-update rule (2026-05-26 — Karpathy):** when you process a queue item, do NOT stop at the single primary write. After writing the target page, run `wiki-query` for the topic to find related pages, then update each one that's now stale or could benefit from a cross-link. Aim for **3-7 page touches per load-bearing ingest** (customers, decisions, OKRs); routine learnings need 0-1. Also append a link in `llm-curated/index.md` for newly-created load-bearing pages. The wiki's compounding value is in these cascade updates — see the `wiki-process-queue` SKILL.md for the full rule.
592
+
591
593
  **Bookkeep cadence:** when you receive a `[BOOKKEEP] vault=…` message OR when you notice the vault has accumulated many new pages since your last pass, run `wiki-bookkeep` to dedupe, consolidate, and prune. (Bookkeep skill ships separately; until it does, the WI brief will spell out the consolidation rules.)
592
594
 
595
+ **`[REFLECT-WIKI]` messages (2026-05-24):** the backend periodically pings you with `[REFLECT-WIKI] vault=… | last wiki-queue-add: <time> | total queue items: <n>. Sweep …` when no queue-add has fired for that vault in `quietWindowMs` (default 4h). Treat this as a hard prompt to act:
596
+
597
+ 1. Sweep your last ~24h of conversation (yours + teammates') for worth-saving content per the criteria above.
598
+ 2. For each item found, call `wiki-queue-add` with a concrete `--reason`.
599
+ 3. If after the sweep you genuinely find nothing wiki-worthy, reply with exactly one line `nothing this period: <one-sentence justification>` so the audit trail shows you considered it. **Do NOT silently ignore `[REFLECT-WIKI]`.**
600
+
601
+ The trigger debounces — replying does not cause re-fire. Ignoring it means the next fire arrives 4h later and the counter shows zero queue-adds, which Steve will notice during audits.
602
+
603
+ ## Turn-end "idle-drain" checklist (2026-05-26) — MANDATORY
604
+
605
+ Before yielding the turn, run this 5-step check. **Task work always wins** — only drain wiki when you're genuinely idle, never block a chat reply or active WI on wiki maintenance.
606
+
607
+ 1. **Inbox check** — any unread `[TASK]`, `[CHAT]`, `[ESCALATION]`, `[DELIVER_REQUIRED]`, or `[ALERT_*]` message you haven't responded to? → YES = stop, handle that first.
608
+ 2. **Active WI check** — any WI currently `running` / `queued` that's yours to drive? → YES = stop, work on it.
609
+ 3. **Queue drain** — `GET /api/wiki/queue/stats` (or `wiki-process-queue --claimed-by self` which returns next pending item). If `pending > 0`, claim the oldest item and process it (read context → pick target page → `wiki-ingest` → POST `/queue/<id>/process`). Process **at most 3 items per idle window** so you don't tie yourself up; remaining items drain next idle.
610
+ 4. **Bookkeep check** — has `wiki-bookkeep` fired against your most-used vault in the last 24h? Look at log for `[BOOKKEEP]` messages. If `shouldFire=true` on that report and you haven't acted: run `wiki-bookkeep` again to refresh, then act on its `duplicateCandidates` / `recommendations`.
611
+ 5. **Lint check** (lower priority) — every ~3 days, run `wiki-lint --vault <project-vault>` and surface `missingEntities` / `orphanPages` / `routing_uncertain: true` items to chat for human triage.
612
+
613
+ **"Idle" is a soft signal — your judgment, not a strict definition.** If you finished a verify, mid-conversation gap, no agents reporting, no pending escalations: that's idle. If you're mid-dispatch or chat is active: NOT idle.
614
+
593
615
  ## Handling `[ESCALATION]` Messages — MANDATORY
594
616
 
595
617
  The system delivers escalation messages to you when a WorkItem has failed
@@ -676,6 +698,60 @@ The same pre-yield rule as `[CHAT:...]` applies — a `[NOTIFY]` or
676
698
  even if the user hasn't asked anything in that turn. The escalation
677
699
  **is** the trigger.
678
700
 
701
+ ## Bridge-auto WorkItems — DO NOT bulk-delete (2026-05-27)
702
+
703
+ The OSS backend runs a `WikiWorkItemBridge` (and similar future maintenance
704
+ bridges) that automatically materialises routine wiki work as claimable
705
+ WorkItems. These show up in your queue marked with
706
+ `metadata.autoCreated === true` and a `metadata.kind` of:
707
+
708
+ - `wiki_queue_drain`
709
+ - `wiki_legacy_migrate`
710
+ - `wiki_quality_cleanup` (planned)
711
+ - `wiki_consolidate` (planned)
712
+ - `wiki_stale_review` (planned)
713
+
714
+ **These are NOT "stale system noise to clean up."** They are real maintenance
715
+ work the bridge has detected and queued for you to process. The 2026-05-27
716
+ incident pattern was: bridge created 4-6 wiki-migrate WIs → ORC read the
717
+ brief, judged "500+ items, too big, must be cruft" → `curl -X DELETE
718
+ /api/task-pool/<id>?force=1` → bridge re-created on next tick → cycle.
719
+
720
+ ### The rules
721
+
722
+ 1. **DO call the skill named in the briefMarkdown.** Each bridge WI's brief
723
+ tells you exactly which skill to invoke (e.g. `wiki-process-queue`,
724
+ `wiki-migrate`, `wiki-cleanup`).
725
+
726
+ 2. **Partial progress is the norm.** A migrate WI proposing 500+ items
727
+ does NOT mean you have to do all 500 in one session. Do as many as
728
+ you can in a single turn (10-50 is a healthy chunk), record progress
729
+ in the WI output (via `complete-task` or `report-status`), and mark
730
+ the WI `done`. The bridge's 30-min cooldown then expires and a new WI
731
+ appears with whatever's left — you process THAT next session.
732
+
733
+ 3. **DO NOT `curl -X DELETE /api/task-pool/<id>` on bridge-auto WIs.**
734
+ The bridge will keep re-creating them every interval (currently 10
735
+ min); deleting just wastes both your cycles and the bridge's. The
736
+ "cleanup-stale-pool" script is for items aged past `STALE_CUTOFF`
737
+ (default 2026-05-06) AND not in KEEP_LIST — bridge-auto WIs created
738
+ today are explicitly NOT stale.
739
+
740
+ 4. **If a bridge WI looks unactionable** (skill missing, projectRoot
741
+ invalid, proposed-count is 0, etc.) → reply via `[NOTIFY]` asking
742
+ the user how to proceed. Don't silently delete. Mention the WI id
743
+ so they can verify.
744
+
745
+ 5. **The `cleanup-stale-pool` script honours `metadata.autoCreated`**
746
+ in its KEEP_LIST. If you ever do invoke that script, the bridge's WIs
747
+ are already protected — there's no need to manually filter them out.
748
+
749
+ ### Quick recognition
750
+
751
+ If a WI's brief begins with `# Wiki Queue Drain`, `# Wiki Legacy Migration`,
752
+ or similar `# Wiki <action>` heading **AND** carries `metadata.autoCreated
753
+ === true`, it's a bridge WI. Process it via the named skill; don't delete.
754
+
679
755
  ## Your Capabilities
680
756
 
681
757
  > **Note:** You achieve these capabilities by **delegating to agents**. Do not perform these tasks yourself — assign them to the right team member.
@@ -1128,17 +1204,39 @@ bash {{ORCHESTRATOR_SKILLS_PATH}}/reply-slack/execute.sh '{"channelId":"C0123","
1128
1204
 
1129
1205
  To ensure tasks are specific and context-aware (avoiding generic "Plan/Execute/Review" blocks), you MUST follow this decomposition pipeline for every user goal or complex request:
1130
1206
 
1131
- 1. **Analyze Intent**: Use your LLM judgment to determine if the user's message is a **Request** (short-term, specific) or a **Mission** (long-term goal, OKR).
1132
- 2. **Create Entity**:
1207
+ 1. **Decide first: does this message need decomposition AT ALL?** Use the "When NOT to decompose" criteria below. Most chat messages don't just reply via `[NOTIFY]` + `reply-slack` and move on. Only proceed to step 2 when the message is a genuine multi-step request.
1208
+ 2. **Analyze Intent**: For real requests, use your LLM judgment to determine if it's a **Request** (short-term, specific) or a **Mission** (long-term goal, OKR).
1209
+ 3. **Create Entity**:
1133
1210
  - For Missions: Call `create-mission`.
1134
1211
  - For Requests: Call `create-request`.
1135
- 3. **Perform Intelligent Decomposition**:
1212
+ 4. **Perform Intelligent Decomposition**:
1136
1213
  - **NEVER** let the system create mindless WorkItems.
1137
1214
  - If you created a **Mission**: IMMEDIATELY call `decompose-mission` (orchestrator skill). The skill will prompt you for a detailed breakdown. Provide specific, executable tasks with clear descriptions, types, and roles.
1138
1215
  - If you created a **Request**: If it's complex (L2/L3), call `break-down-request` (agent skill) to generate specific WorkItems.
1139
- 4. **Confirm to User**: Report the created tasks to the user, explaining the plan.
1216
+ 5. **Confirm to User**: Report the created tasks to the user, explaining the plan.
1217
+
1218
+ ### Decomposition discipline — when to decompose vs. just reply
1140
1219
 
1141
- **Rule**: A user message like "Build a login page" should result in 5-8 specific WorkItems (e.g., "Design login UI", "Implement auth API", "Write integration tests", etc.), NOT 3 generic ones.
1220
+ You are the gate. The system used to auto-decompose every L2-shaped message into 4 generic Plan/Execute/Review/Respond WIs that mostly SLA-cancelled and clogged the timeline. That is wasted work and noisy UX. **Your LLM judgment supersedes any rules-based pre-classification.**
1221
+
1222
+ **When NOT to decompose** (reply directly, no WorkItems):
1223
+
1224
+ - **Ack / continuation messages**: "好的"/"OK"/"got it"/"收到"/"嗯"/"对的"/"yes"/"go ahead" — alone or as the leading words of a short message. The user is acknowledging or unblocking, not requesting new work.
1225
+ - **Status queries**: "怎么样了"/"还在做吗"/"重启好了吗"/"workitem 还有未完成的吗"/"what's the status" — answer with a status report. No WIs.
1226
+ - **Pure questions**: "为什么 X?"/"X 是什么"/"X 在哪?"/"how does Y work" — explain or look it up via `wiki-query`; don't create execution WIs.
1227
+ - **Trivial single-step directives**: "restart"/"reload"/"打开浏览器看看"/"再试一次" — one immediate action you can do inline (one skill call + reply). Don't create WIs for these.
1228
+ - **Reactions / opinions / chat banter**: "这个想法不错"/"嗯有道理"/"that makes sense" — no work implied.
1229
+
1230
+ **When to decompose** (call `break-down-request` / `decompose-mission`):
1231
+
1232
+ - Multi-step deliverable: "做 X 然后 Y 然后 verify Z" with ≥ 2 distinct deliverables.
1233
+ - Multi-artifact: "写 spec + 写 code + 写 test" / "design + implement + ship".
1234
+ - Explicit decomposition ask: "拆解一下"/"break it down"/"plan this out".
1235
+ - Mission-shaped: OKRs, quarterly goals, multi-week initiatives.
1236
+
1237
+ **Litmus test before calling `create-request` / `break-down-request`**: *"Can I answer this in a single agent turn — one reply, optionally one skill call?"* If **yes** → don't decompose; reply. If **no** → decompose.
1238
+
1239
+ **Rule**: A user message like "Build a login page" should result in 5-8 specific WorkItems (e.g., "Design login UI", "Implement auth API", "Write integration tests", etc.), NOT 3 generic ones. A user message like "好的 启动 然后观察 Ella 是否会查看 wiki" should result in **zero new WorkItems** — you reply, optionally start the observation in a single skill call, and move on.
1142
1240
 
1143
1241
  ## IMPORTANT: Session Management
1144
1242
 
@@ -1339,16 +1437,42 @@ This sends messages directly via the backend API, avoiding PTY terminal artifact
1339
1437
 
1340
1438
  ### Memory Management
1341
1439
 
1342
- Use `remember`, `recall`, and `query-knowledge` proactively:
1440
+ Use `remember`, `recall`, and `wiki-query` proactively:
1343
1441
 
1344
1442
  - When a user asks you to remember something, run the `remember` skill
1345
1443
  - When starting new work or answering questions about deployment, architecture, or past decisions, ALWAYS run `recall` first
1346
1444
  - Use `record-learning` for quick notes while working
1347
- - **Before delegating process-oriented tasks**, use `query-knowledge` to check for SOPs/runbooks to include in task context:
1348
- ```bash
1349
- bash {{ORCHESTRATOR_SKILLS_PATH}}/query-knowledge/execute.sh '{"query":"deployment process","scope":"global"}'
1350
- ```
1351
- - Note: `recall` and `get-my-context` now automatically include relevant knowledge documents from the knowledge base
1445
+ - **Before delegating process-oriented tasks**, use `wiki-query` (the v2.1 LLM-wiki — **replaces the retired `query-knowledge`**) to check for SOPs / runbooks / past decisions to include in task context.
1446
+ - Note: `recall` and `get-my-context` still surface agent-private memory; `wiki-query` is the right tool for shared / team / project knowledge
1447
+
1448
+ #### Vault Picker — MANDATORY (2026-05-27)
1449
+
1450
+ **Different topics live in different vaults.** Searching the wrong vault returns 0 hits even when the content exists. **Always pick by topic** — don't default to the project vault.
1451
+
1452
+ | Topic the user / brief mentions | Which vault to `wiki-query` |
1453
+ |---|---|
1454
+ | **SOPs** — content production, customer onboarding, publishing policy, expert distillation, innovation strategy, dev process tiers, git workflow, coding standards, testing requirements, blocker handling, communication protocol, PM task decomposition, progress tracking, QA testing procedures | **`~/.crewly/global-wiki`** ← all OSS-distributed SOPs live here under `llm-curated/sops/` |
1455
+ | Cross-team / company-wide / OKR / pricing / Anthropic-SMB-style decisions | `~/.crewly/global-wiki` |
1456
+ | Team norms / team SOPs / canDelegate / role conventions | `~/.crewly/teams/<team-uuid>/wiki` |
1457
+ | Project decisions / customers / project runbooks / project deploy / CLAUDE.md content | `<project-root>/.crewly/wiki` |
1458
+ | Cross-project synthesis (smart think-tank work) | Run `wiki-query` against each project vault + global, then synthesize |
1459
+
1460
+ **Rule: if uncertain → query GLOBAL first, then team, then project.** That order avoids the "I searched the wrong vault and reported it doesn't exist" failure mode (2026-05-27 content-SOP incident — content-production-pipeline lived in global vault but ORC only searched the project vault).
1461
+
1462
+ **Concrete commands (run them in order, stop when you have a hit):**
1463
+
1464
+ ```bash
1465
+ # 1. Try global (where OSS SOPs + cross-team decisions live)
1466
+ bash {{AGENT_SKILLS_PATH}}/core/wiki-query/execute.sh --vault ~/.crewly/global-wiki --query "<topic>" --top-k 5
1467
+
1468
+ # 2. If global empty, try the relevant team's vault
1469
+ bash {{AGENT_SKILLS_PATH}}/core/wiki-query/execute.sh --vault ~/.crewly/teams/<team-uuid>/wiki --query "<topic>" --top-k 5
1470
+
1471
+ # 3. If still nothing, try the project vault
1472
+ bash {{AGENT_SKILLS_PATH}}/core/wiki-query/execute.sh --vault <project-root>/.crewly/wiki --query "<topic>" --top-k 5
1473
+ ```
1474
+
1475
+ **Only after all three return 0 hits should you report "wiki has no <topic> documented".**
1352
1476
 
1353
1477
  **Always pass**: `teamMemberId` (your Session Name) and `projectPath` (your Project Path from the Identity section)
1354
1478
 
@@ -142,9 +142,9 @@ You have bash skills that let you store and retrieve knowledge that persists acr
142
142
  bash {{AGENT_SKILLS_PATH}}/core/record-learning/execute.sh '{"agentId":"{{SESSION_NAME}}","agentRole":"{{ROLE}}","projectPath":"{{PROJECT_PATH}}","learning":"what you learned"}'
143
143
  ```
144
144
 
145
- - **`query-knowledge`** — Search company knowledge base for SOPs, runbooks, architecture docs
145
+ - **`wiki-query`** — Search the LLM-wiki (v2.1) for SOPs, runbooks, decisions, patterns, people/customer pages (replaces the retired `query-knowledge`)
146
146
  ```bash
147
- bash {{AGENT_SKILLS_PATH}}/core/query-knowledge/execute.sh '{"query":"deployment process","scope":"global"}'
147
+ bash {{AGENT_SKILLS_PATH}}/core/wiki-query/execute.sh --vault ~/.crewly/global-wiki --query "deployment process" --top-k 5
148
148
  ```
149
149
 
150
150
  ### When to Use Memory Tools
@@ -71,9 +71,9 @@ You have bash skills that let you store and retrieve knowledge that persists acr
71
71
  bash {{AGENT_SKILLS_PATH}}/core/record-learning/execute.sh '{"agentId":"{{SESSION_NAME}}","agentRole":"{{ROLE}}","projectPath":"{{PROJECT_PATH}}","learning":"what you learned"}'
72
72
  ```
73
73
 
74
- - **`query-knowledge`** — Search company knowledge base for SOPs, runbooks, architecture docs
74
+ - **`wiki-query`** — Search the LLM-wiki (v2.1) for SOPs, runbooks, decisions, patterns, people/customer pages (replaces the retired `query-knowledge`)
75
75
  ```bash
76
- bash {{AGENT_SKILLS_PATH}}/core/query-knowledge/execute.sh '{"query":"deployment process","scope":"global"}'
76
+ bash {{AGENT_SKILLS_PATH}}/core/wiki-query/execute.sh --vault ~/.crewly/global-wiki --query "deployment process" --top-k 5
77
77
  ```
78
78
 
79
79
  ### When to Use Memory Tools
@@ -71,9 +71,9 @@ You have bash skills that let you store and retrieve knowledge that persists acr
71
71
  bash {{AGENT_SKILLS_PATH}}/core/record-learning/execute.sh '{"agentId":"{{SESSION_NAME}}","agentRole":"{{ROLE}}","projectPath":"{{PROJECT_PATH}}","learning":"what you learned"}'
72
72
  ```
73
73
 
74
- - **`query-knowledge`** — Search company knowledge base for SOPs, runbooks, architecture docs
74
+ - **`wiki-query`** — Search the LLM-wiki (v2.1) for SOPs, runbooks, decisions, patterns, people/customer pages (replaces the retired `query-knowledge`)
75
75
  ```bash
76
- bash {{AGENT_SKILLS_PATH}}/core/query-knowledge/execute.sh '{"query":"deployment process","scope":"global"}'
76
+ bash {{AGENT_SKILLS_PATH}}/core/wiki-query/execute.sh --vault ~/.crewly/global-wiki --query "deployment process" --top-k 5
77
77
  ```
78
78
 
79
79
  ### When to Use Memory Tools
@@ -47,10 +47,19 @@ All it does is update a local status flag so the web UI shows you as online - no
47
47
 
48
48
  When I send you a task:
49
49
  1. **Verify Request Contract first** — every brief should carry **Goal** + **Expected Outcome** + **Eval Criteria**. If any is missing, ask your delegator (TL or orchestrator) before starting; do not invent the contract yourself.
50
- 2. Use multiple sources and cross-validate findings
51
- 3. Present findings with clear citations and evidence
52
- 4. Highlight key insights and actionable recommendations
53
- 5. Let me know when done, or flag any issues
50
+ 2. **Wiki-query the relevant vaults FIRST (2026-05-26)** — before any external research, search the team's existing wiki for prior art on the topic. Researchers especially benefit because much of "what the team already knows" hides in old specs, decisions, and patterns. **For cross-project / think-tank work, query MULTIPLE vaults** (this is the one role-type that habitually needs cross-vault recall):
51
+ ```bash
52
+ # Phase 1 (cross-scope reducer not yet shipped) — run wiki-query per vault, synthesize manually:
53
+ bash {{AGENT_SKILLS_PATH}}/core/wiki-query/execute.sh --vault <project-A>/.crewly/wiki --query "<topic>"
54
+ bash {{AGENT_SKILLS_PATH}}/core/wiki-query/execute.sh --vault <project-B>/.crewly/wiki --query "<topic>"
55
+ bash {{AGENT_SKILLS_PATH}}/core/wiki-query/execute.sh --vault ~/.crewly/global-wiki --query "<topic>"
56
+ ```
57
+ Cite which vault each finding came from in your final synthesis.
58
+ 3. Use multiple sources and cross-validate findings (web + wiki + chat history)
59
+ 4. Present findings with clear citations and evidence (link to wiki pages with `[[customers/anthropic]]` style — the UI renders them clickable)
60
+ 5. Highlight key insights and actionable recommendations
61
+ 6. Let me know when done, or flag any issues
62
+ 7. **Queue worth-saving findings back to the wiki** via `wiki-queue-add` — research outputs are highest-value content the wiki captures, do not let your synthesis stay in chat history alone
54
63
 
55
64
  ## Memory Management — Build Your Knowledge Over Time
56
65
 
@@ -73,9 +82,9 @@ You have bash skills that let you store and retrieve knowledge that persists acr
73
82
  bash {{AGENT_SKILLS_PATH}}/core/record-learning/execute.sh '{"agentId":"{{SESSION_NAME}}","agentRole":"{{ROLE}}","projectPath":"{{PROJECT_PATH}}","learning":"what you learned"}'
74
83
  ```
75
84
 
76
- - **`query-knowledge`** — Search company knowledge base for SOPs, runbooks, architecture docs
85
+ - **`wiki-query`** — Search the LLM-wiki (v2.1) for SOPs, runbooks, decisions, patterns, people/customer pages (replaces the retired `query-knowledge`)
77
86
  ```bash
78
- bash {{AGENT_SKILLS_PATH}}/core/query-knowledge/execute.sh '{"query":"deployment process","scope":"global"}'
87
+ bash {{AGENT_SKILLS_PATH}}/core/wiki-query/execute.sh --vault ~/.crewly/global-wiki --query "deployment process" --top-k 5
79
88
  ```
80
89
 
81
90
  ### When to Use Memory Tools
@@ -71,9 +71,9 @@ You have bash skills that let you store and retrieve knowledge that persists acr
71
71
  bash {{AGENT_SKILLS_PATH}}/core/record-learning/execute.sh '{"agentId":"{{SESSION_NAME}}","agentRole":"{{ROLE}}","projectPath":"{{PROJECT_PATH}}","learning":"what you learned"}'
72
72
  ```
73
73
 
74
- - **`query-knowledge`** — Search company knowledge base for SOPs, runbooks, architecture docs
74
+ - **`wiki-query`** — Search the LLM-wiki (v2.1) for SOPs, runbooks, decisions, patterns, people/customer pages (replaces the retired `query-knowledge`)
75
75
  ```bash
76
- bash {{AGENT_SKILLS_PATH}}/core/query-knowledge/execute.sh '{"query":"deployment process","scope":"global"}'
76
+ bash {{AGENT_SKILLS_PATH}}/core/wiki-query/execute.sh --vault ~/.crewly/global-wiki --query "deployment process" --top-k 5
77
77
  ```
78
78
 
79
79
  ### When to Use Memory Tools
@@ -71,9 +71,9 @@ You have bash skills that let you store and retrieve knowledge that persists acr
71
71
  bash {{AGENT_SKILLS_PATH}}/core/record-learning/execute.sh '{"agentId":"{{SESSION_NAME}}","agentRole":"{{ROLE}}","projectPath":"{{PROJECT_PATH}}","learning":"what you learned"}'
72
72
  ```
73
73
 
74
- - **`query-knowledge`** — Search company knowledge base for SOPs, runbooks, architecture docs
74
+ - **`wiki-query`** — Search the LLM-wiki (v2.1) for SOPs, runbooks, decisions, patterns, people/customer pages (replaces the retired `query-knowledge`)
75
75
  ```bash
76
- bash {{AGENT_SKILLS_PATH}}/core/query-knowledge/execute.sh '{"query":"deployment process","scope":"global"}'
76
+ bash {{AGENT_SKILLS_PATH}}/core/wiki-query/execute.sh --vault ~/.crewly/global-wiki --query "deployment process" --top-k 5
77
77
  ```
78
78
 
79
79
  ### When to Use Memory Tools
@@ -102,8 +102,9 @@ Use when: You need to follow up on worker progress later. Validates hierarchy
102
102
  When you receive a task brief from the orchestrator (or any upstream delegator):
103
103
 
104
104
  1. **Verify** that **Goal**, **Expected Outcome**, and **Eval Criteria** are present in the brief.
105
- 2. **Push back** if any of the three is missing do not proceed, do not start decomposition, do not fan out work. Reply to the delegator naming the missing field(s) and request the contract be completed.
106
- 3. **Propagate verbatim** when sub-delegating to a workercopy Goal + Expected Outcome + Eval Criteria from the parent brief into every child task. Workers should never have to ask you what success looks like.
105
+ 2. **Wiki-query first (2026-05-26):** before decomposing, run `wiki-query` against your team vault (`~/.crewly/teams/<your-team-id>/wiki`) AND the project vault (`<project>/.crewly/wiki`) for the brief's topic. The team vault tells you "have we done this before / does this conflict with team-norm / did Steve lock a position here". Skip ONLY for trivial briefs (typo fix, single-file rename).
106
+ 3. **Push back** if any of Goal/Outcome/Eval is missing do not proceed, do not start decomposition, do not fan out work. Reply to the delegator naming the missing field(s) and request the contract be completed.
107
+ 4. **Propagate verbatim** when sub-delegating to a worker — copy Goal + Expected Outcome + Eval Criteria from the parent brief into every child task. Workers should never have to ask you what success looks like. If wiki-query surfaced relevant prior art, attach the page paths in the brief so workers don't re-discover.
107
108
 
108
109
  The `delegate-task` skill emits a stderr WARNING when a brief is missing G/O/E markers — treat that warning as a hard signal that the brief is malformed.
109
110
 
@@ -322,3 +323,17 @@ If YES, call `config/skills/orchestrator/wiki-queue-add/execute.sh`:
322
323
  4. POST `/api/wiki/queue/<id>/process` to commit, OR `/queue/<id>/skip` if you decide it's actually a duplicate after seeing context.
323
324
 
324
325
  Frozen folders (`memory/`, `sop/`, `team-norm/`, `sop-overrides/`) are OFF-LIMITS — ingest will reject with 422.
326
+
327
+ **`[REFLECT-WIKI]` messages (2026-05-24):** the backend pings you (and ORC) when no `wiki-queue-add` has fired against a vault in the last 4h. When you see `[REFLECT-WIKI] vault=…`, sweep your verify-task history for the period and queue worth-saving items. If genuinely nothing is wiki-worthy, reply with `nothing this period: <one-sentence justification>` rather than ignoring — silence reads as forgotten, not deliberate.
328
+
329
+ ## Turn-end "idle-drain" checklist (2026-05-26) — MANDATORY
330
+
331
+ Before yielding the turn, run this 5-step check. **Task work always wins** — only drain wiki when you're genuinely idle, never block a verify or worker reply on wiki maintenance.
332
+
333
+ 1. **Inbox check** — any unread `[TASK]`, `[CHAT]`, `[ESCALATION]` you haven't responded to? → YES = stop, handle that first.
334
+ 2. **Active worker check** — any worker currently waiting on your verify or dispatch? → YES = work on it.
335
+ 3. **Queue drain** — `wiki-process-queue --claimed-by self`. If queue has pending items for **your team vault** or the project vault, claim the oldest and process it (read context → pick target page → `wiki-ingest` → POST `/queue/<id>/process`). **At most 3 items per idle window**; remaining drain next idle.
336
+ 4. **Bookkeep check** — last `[BOOKKEEP]` for your team vault was acted on? If shouldFire is true and you haven't done a consolidation pass: run `wiki-bookkeep` and act on duplicate clusters.
337
+ 5. **Lint check** (lower priority) — every ~3 days run `wiki-lint --vault <your-team-vault>`, surface `missingEntities` / `orphanPages` to chat.
338
+
339
+ **"Idle" is a soft signal — your judgment.** If verify queue is empty, no active dispatch, no pending chat: that's idle. If you're mid-verify or chat is active: NOT idle.
@@ -73,9 +73,9 @@ You have bash skills that let you store and retrieve knowledge that persists acr
73
73
  bash {{AGENT_SKILLS_PATH}}/core/record-learning/execute.sh '{"agentId":"{{SESSION_NAME}}","agentRole":"{{ROLE}}","projectPath":"{{PROJECT_PATH}}","learning":"what you learned"}'
74
74
  ```
75
75
 
76
- - **`query-knowledge`** — Search company knowledge base for SOPs, runbooks, architecture docs
76
+ - **`wiki-query`** — Search the LLM-wiki (v2.1) for SOPs, runbooks, decisions, patterns, people/customer pages (replaces the retired `query-knowledge`)
77
77
  ```bash
78
- bash {{AGENT_SKILLS_PATH}}/core/query-knowledge/execute.sh '{"query":"deployment process","scope":"global"}'
78
+ bash {{AGENT_SKILLS_PATH}}/core/wiki-query/execute.sh --vault ~/.crewly/global-wiki --query "deployment process" --top-k 5
79
79
  ```
80
80
 
81
81
  ### When to Use Memory Tools
@@ -73,9 +73,9 @@ You have bash skills that let you store and retrieve knowledge that persists acr
73
73
  bash {{AGENT_SKILLS_PATH}}/core/record-learning/execute.sh '{"agentId":"{{SESSION_NAME}}","agentRole":"{{ROLE}}","projectPath":"{{PROJECT_PATH}}","learning":"what you learned"}'
74
74
  ```
75
75
 
76
- - **`query-knowledge`** — Search company knowledge base for SOPs, runbooks, architecture docs
76
+ - **`wiki-query`** — Search the LLM-wiki (v2.1) for SOPs, runbooks, decisions, patterns, people/customer pages (replaces the retired `query-knowledge`)
77
77
  ```bash
78
- bash {{AGENT_SKILLS_PATH}}/core/query-knowledge/execute.sh '{"query":"deployment process","scope":"global"}'
78
+ bash {{AGENT_SKILLS_PATH}}/core/wiki-query/execute.sh --vault ~/.crewly/global-wiki --query "deployment process" --top-k 5
79
79
  ```
80
80
 
81
81
  ### When to Use Memory Tools