baldart 3.6.2

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 (230) hide show
  1. package/CHANGELOG.md +599 -0
  2. package/README.md +566 -0
  3. package/VERSION +1 -0
  4. package/bin/baldart.js +143 -0
  5. package/framework/.claude/agents/REGISTRY.md +169 -0
  6. package/framework/.claude/agents/api-perf-cost-auditor.md +291 -0
  7. package/framework/.claude/agents/code-reviewer.md +350 -0
  8. package/framework/.claude/agents/codebase-architect.md +391 -0
  9. package/framework/.claude/agents/coder.md +291 -0
  10. package/framework/.claude/agents/deep-human-insight.md +198 -0
  11. package/framework/.claude/agents/doc-reviewer.md +440 -0
  12. package/framework/.claude/agents/email-deliverability-architect.md +193 -0
  13. package/framework/.claude/agents/hybrid-ml-architect.md +285 -0
  14. package/framework/.claude/agents/hyper-gamification-designer.md +149 -0
  15. package/framework/.claude/agents/legal-counsel-gdpr.md +179 -0
  16. package/framework/.claude/agents/marketing-conversion-strategist.md +162 -0
  17. package/framework/.claude/agents/motion-expert.md +108 -0
  18. package/framework/.claude/agents/onboarding-architect-lead.md +230 -0
  19. package/framework/.claude/agents/plan-auditor.md +546 -0
  20. package/framework/.claude/agents/prd-card-writer.md +372 -0
  21. package/framework/.claude/agents/prd.md +744 -0
  22. package/framework/.claude/agents/qa-sentinel.md +305 -0
  23. package/framework/.claude/agents/remotion-animator-orchestrator.md +218 -0
  24. package/framework/.claude/agents/security-reviewer.md +276 -0
  25. package/framework/.claude/agents/senior-researcher.md +175 -0
  26. package/framework/.claude/agents/seo-analytics-strategist.md +156 -0
  27. package/framework/.claude/agents/skill-improver.md +61 -0
  28. package/framework/.claude/agents/ui-expert.md +191 -0
  29. package/framework/.claude/agents/visual-designer.md +190 -0
  30. package/framework/.claude/agents/website-orchestrator.md +118 -0
  31. package/framework/.claude/agents/wiki-curator.md +145 -0
  32. package/framework/.claude/commands/baldart-push.md +15 -0
  33. package/framework/.claude/commands/check.md +237 -0
  34. package/framework/.claude/commands/codexreview.md +203 -0
  35. package/framework/.claude/commands/design-review.md +11 -0
  36. package/framework/.claude/commands/issue-review.md +34 -0
  37. package/framework/.claude/commands/new.md +331 -0
  38. package/framework/.claude/commands/qa.md +257 -0
  39. package/framework/.claude/hooks/framework-edit-gate.js +208 -0
  40. package/framework/.claude/hooks/lint-before-commit.sh.template +66 -0
  41. package/framework/.claude/settings.local.json.example +32 -0
  42. package/framework/.claude/skills/api-design-principles/SKILL.md +567 -0
  43. package/framework/.claude/skills/api-design-principles/assets/api-design-checklist.md +155 -0
  44. package/framework/.claude/skills/api-design-principles/assets/rest-api-template.py +182 -0
  45. package/framework/.claude/skills/api-design-principles/references/graphql-schema-design.md +583 -0
  46. package/framework/.claude/skills/api-design-principles/references/rest-best-practices.md +408 -0
  47. package/framework/.claude/skills/baldart-push/SKILL.md +222 -0
  48. package/framework/.claude/skills/bug/SKILL.md +200 -0
  49. package/framework/.claude/skills/bug/references/logging-patterns.md +174 -0
  50. package/framework/.claude/skills/capture/SKILL.md +125 -0
  51. package/framework/.claude/skills/capture/references/synthesis-template.md +42 -0
  52. package/framework/.claude/skills/context-primer/SKILL.md +189 -0
  53. package/framework/.claude/skills/copywriting/SKILL.md +273 -0
  54. package/framework/.claude/skills/copywriting/references/copy-frameworks.md +338 -0
  55. package/framework/.claude/skills/copywriting/references/natural-transitions.md +252 -0
  56. package/framework/.claude/skills/doc-writing-for-rag/SKILL.md +119 -0
  57. package/framework/.claude/skills/doc-writing-for-rag/references/before-after-examples.md +291 -0
  58. package/framework/.claude/skills/doc-writing-for-rag/references/compact-templates.md +183 -0
  59. package/framework/.claude/skills/doc-writing-for-rag/references/frontmatter-minimal.md +112 -0
  60. package/framework/.claude/skills/doc-writing-for-rag/references/line-count-targets.md +110 -0
  61. package/framework/.claude/skills/doc-writing-for-rag/references/schemas-and-errors.md +129 -0
  62. package/framework/.claude/skills/find-skills/SKILL.md +133 -0
  63. package/framework/.claude/skills/frontend-design/LICENSE.txt +177 -0
  64. package/framework/.claude/skills/frontend-design/SKILL.md +84 -0
  65. package/framework/.claude/skills/gamification-design/SKILL.md +130 -0
  66. package/framework/.claude/skills/issue-review/SKILL.md +45 -0
  67. package/framework/.claude/skills/kie-ai/SKILL.md +262 -0
  68. package/framework/.claude/skills/kie-ai/references/models-catalog.md +272 -0
  69. package/framework/.claude/skills/kie-ai/scripts/kie_api.sh +209 -0
  70. package/framework/.claude/skills/kie-ai/scripts/remove_greenscreen.py +69 -0
  71. package/framework/.claude/skills/kie-ai/scripts/setup_api_key.sh +77 -0
  72. package/framework/.claude/skills/motion-design/LICENSE +21 -0
  73. package/framework/.claude/skills/motion-design/README.md +82 -0
  74. package/framework/.claude/skills/motion-design/SKILL.md +336 -0
  75. package/framework/.claude/skills/motion-design/director/choreography.md +93 -0
  76. package/framework/.claude/skills/motion-design/director/context-adaptation.md +83 -0
  77. package/framework/.claude/skills/motion-design/director/core-philosophy.md +53 -0
  78. package/framework/.claude/skills/motion-design/director/decision-framework.md +91 -0
  79. package/framework/.claude/skills/motion-design/director/disney-principles.md +102 -0
  80. package/framework/.claude/skills/motion-design/director/emotion-mapping.md +71 -0
  81. package/framework/.claude/skills/motion-design/director/motion-personality.md +89 -0
  82. package/framework/.claude/skills/motion-design/director/narrative-structure.md +62 -0
  83. package/framework/.claude/skills/motion-design/patterns/ambient-continuous.md +81 -0
  84. package/framework/.claude/skills/motion-design/patterns/entrance-exit.md +82 -0
  85. package/framework/.claude/skills/motion-design/patterns/multi-element.md +69 -0
  86. package/framework/.claude/skills/motion-design/patterns/state-feedback.md +96 -0
  87. package/framework/.claude/skills/motion-design/reference/property-selection.md +95 -0
  88. package/framework/.claude/skills/motion-design/reference/quality-checklist.md +67 -0
  89. package/framework/.claude/skills/motion-design/reference/timing-easing-tables.md +106 -0
  90. package/framework/.claude/skills/motion-design/reference/troubleshooting.md +73 -0
  91. package/framework/.claude/skills/new/SKILL.md +1687 -0
  92. package/framework/.claude/skills/playwright-skill/API_REFERENCE.md +652 -0
  93. package/framework/.claude/skills/playwright-skill/SKILL.md +157 -0
  94. package/framework/.claude/skills/playwright-skill/package.json +26 -0
  95. package/framework/.claude/skills/prd/SKILL.md +228 -0
  96. package/framework/.claude/skills/prd/assets/card-template.yml +232 -0
  97. package/framework/.claude/skills/prd/assets/epic-template.yml +190 -0
  98. package/framework/.claude/skills/prd/assets/prd-template.md +230 -0
  99. package/framework/.claude/skills/prd/assets/state-template.md +78 -0
  100. package/framework/.claude/skills/prd/references/api-perf-gate.md +152 -0
  101. package/framework/.claude/skills/prd/references/audit-phase.md +478 -0
  102. package/framework/.claude/skills/prd/references/backlog-phase.md +145 -0
  103. package/framework/.claude/skills/prd/references/discovery-phase.md +359 -0
  104. package/framework/.claude/skills/prd/references/impact-analysis.md +233 -0
  105. package/framework/.claude/skills/prd/references/prd-add-phase.md +214 -0
  106. package/framework/.claude/skills/prd/references/prd-writing-phase.md +145 -0
  107. package/framework/.claude/skills/prd/references/research-phase.md +216 -0
  108. package/framework/.claude/skills/prd/references/ui-design-phase.md +61 -0
  109. package/framework/.claude/skills/prd/references/validation-phase.md +72 -0
  110. package/framework/.claude/skills/prd-add/SKILL.md +222 -0
  111. package/framework/.claude/skills/prd-add/references/impact-analysis.md +233 -0
  112. package/framework/.claude/skills/remotion-best-practices/SKILL.md +48 -0
  113. package/framework/.claude/skills/remotion-best-practices/rules/3d.md +86 -0
  114. package/framework/.claude/skills/remotion-best-practices/rules/animations.md +29 -0
  115. package/framework/.claude/skills/remotion-best-practices/rules/assets/charts-bar-chart.tsx +173 -0
  116. package/framework/.claude/skills/remotion-best-practices/rules/assets/text-animations-typewriter.tsx +100 -0
  117. package/framework/.claude/skills/remotion-best-practices/rules/assets/text-animations-word-highlight.tsx +108 -0
  118. package/framework/.claude/skills/remotion-best-practices/rules/assets.md +78 -0
  119. package/framework/.claude/skills/remotion-best-practices/rules/audio.md +169 -0
  120. package/framework/.claude/skills/remotion-best-practices/rules/calculate-metadata.md +104 -0
  121. package/framework/.claude/skills/remotion-best-practices/rules/can-decode.md +75 -0
  122. package/framework/.claude/skills/remotion-best-practices/rules/charts.md +58 -0
  123. package/framework/.claude/skills/remotion-best-practices/rules/compositions.md +141 -0
  124. package/framework/.claude/skills/remotion-best-practices/rules/display-captions.md +184 -0
  125. package/framework/.claude/skills/remotion-best-practices/rules/extract-frames.md +229 -0
  126. package/framework/.claude/skills/remotion-best-practices/rules/fonts.md +152 -0
  127. package/framework/.claude/skills/remotion-best-practices/rules/get-audio-duration.md +58 -0
  128. package/framework/.claude/skills/remotion-best-practices/rules/get-video-dimensions.md +68 -0
  129. package/framework/.claude/skills/remotion-best-practices/rules/get-video-duration.md +58 -0
  130. package/framework/.claude/skills/remotion-best-practices/rules/gifs.md +141 -0
  131. package/framework/.claude/skills/remotion-best-practices/rules/images.md +130 -0
  132. package/framework/.claude/skills/remotion-best-practices/rules/import-srt-captions.md +69 -0
  133. package/framework/.claude/skills/remotion-best-practices/rules/light-leaks.md +73 -0
  134. package/framework/.claude/skills/remotion-best-practices/rules/lottie.md +67 -0
  135. package/framework/.claude/skills/remotion-best-practices/rules/maps.md +401 -0
  136. package/framework/.claude/skills/remotion-best-practices/rules/measuring-dom-nodes.md +34 -0
  137. package/framework/.claude/skills/remotion-best-practices/rules/measuring-text.md +143 -0
  138. package/framework/.claude/skills/remotion-best-practices/rules/parameters.md +98 -0
  139. package/framework/.claude/skills/remotion-best-practices/rules/sequencing.md +118 -0
  140. package/framework/.claude/skills/remotion-best-practices/rules/subtitles.md +36 -0
  141. package/framework/.claude/skills/remotion-best-practices/rules/tailwind.md +11 -0
  142. package/framework/.claude/skills/remotion-best-practices/rules/text-animations.md +20 -0
  143. package/framework/.claude/skills/remotion-best-practices/rules/timing.md +179 -0
  144. package/framework/.claude/skills/remotion-best-practices/rules/transcribe-captions.md +70 -0
  145. package/framework/.claude/skills/remotion-best-practices/rules/transitions.md +197 -0
  146. package/framework/.claude/skills/remotion-best-practices/rules/transparent-videos.md +106 -0
  147. package/framework/.claude/skills/remotion-best-practices/rules/trimming.md +52 -0
  148. package/framework/.claude/skills/remotion-best-practices/rules/videos.md +171 -0
  149. package/framework/.claude/skills/seo-audit/SKILL.md +394 -0
  150. package/framework/.claude/skills/seo-audit/references/aeo-geo-patterns.md +279 -0
  151. package/framework/.claude/skills/seo-audit/references/ai-writing-detection.md +190 -0
  152. package/framework/.claude/skills/simplify/SKILL.md +137 -0
  153. package/framework/.claude/skills/skill-creator/LICENSE.txt +202 -0
  154. package/framework/.claude/skills/skill-creator/SKILL.md +356 -0
  155. package/framework/.claude/skills/skill-creator/references/output-patterns.md +82 -0
  156. package/framework/.claude/skills/skill-creator/references/workflows.md +28 -0
  157. package/framework/.claude/skills/skill-creator/scripts/init_skill.py +303 -0
  158. package/framework/.claude/skills/skill-creator/scripts/package_skill.py +110 -0
  159. package/framework/.claude/skills/skill-creator/scripts/quick_validate.py +95 -0
  160. package/framework/.claude/skills/ui-design/SKILL.md +199 -0
  161. package/framework/.claude/skills/ui-design/references/component-discovery.md +54 -0
  162. package/framework/.claude/skills/ui-design/references/evaluation.md +171 -0
  163. package/framework/.claude/skills/ui-design/references/generation.md +109 -0
  164. package/framework/.claude/skills/ui-design/references/inventory.md +59 -0
  165. package/framework/.claude/skills/webapp-testing/LICENSE.txt +202 -0
  166. package/framework/.claude/skills/webapp-testing/SKILL.md +123 -0
  167. package/framework/.claude/skills/webapp-testing/examples/console_logging.py +35 -0
  168. package/framework/.claude/skills/webapp-testing/examples/element_discovery.py +40 -0
  169. package/framework/.claude/skills/webapp-testing/examples/static_html_automation.py +33 -0
  170. package/framework/.claude/skills/webapp-testing/scripts/with_server.py +106 -0
  171. package/framework/.claude/skills/worktree-manager/SKILL.md +680 -0
  172. package/framework/AGENTS.md +240 -0
  173. package/framework/agents/api-contracts.md +137 -0
  174. package/framework/agents/architecture.md +145 -0
  175. package/framework/agents/coding-standards.md +148 -0
  176. package/framework/agents/data-model.md +110 -0
  177. package/framework/agents/deployment-protocol.md +232 -0
  178. package/framework/agents/design-review.md +172 -0
  179. package/framework/agents/env-reference.md +171 -0
  180. package/framework/agents/github-issue-subagent.md +252 -0
  181. package/framework/agents/index.md +261 -0
  182. package/framework/agents/llm-wiki-methodology.md +216 -0
  183. package/framework/agents/maintenance-protocol.md +305 -0
  184. package/framework/agents/observability.md +162 -0
  185. package/framework/agents/performance.md +155 -0
  186. package/framework/agents/project-context.md +145 -0
  187. package/framework/agents/runbook.md +208 -0
  188. package/framework/agents/security.md +168 -0
  189. package/framework/agents/skills-mapping.md +286 -0
  190. package/framework/agents/testing.md +111 -0
  191. package/framework/agents/workflows.md +215 -0
  192. package/framework/docs/PROJECT-CONFIGURATION.md +336 -0
  193. package/framework/docs/references/brand-guidelines.md +170 -0
  194. package/framework/docs/references/ui-guidelines.template.md +182 -0
  195. package/framework/routines/code-review.routine.yml +46 -0
  196. package/framework/routines/doc-review.routine.yml +45 -0
  197. package/framework/routines/ds-drift.routine.yml +52 -0
  198. package/framework/routines/full-sweep.routine.yml +51 -0
  199. package/framework/routines/index.yml +70 -0
  200. package/framework/routines/skill-improve.routine.yml +50 -0
  201. package/framework/routines/wiki-review.routine.yml +45 -0
  202. package/framework/templates/baldart.config.template.yml +113 -0
  203. package/framework/templates/breaking-change-checklist.md +484 -0
  204. package/framework/templates/feature-card.template.yml +125 -0
  205. package/framework/templates/overlays/README.md +44 -0
  206. package/framework/templates/overlays/copywriting.fidelity-example.md +62 -0
  207. package/framework/templates/overlays/ui-design.fidelity-example.md +75 -0
  208. package/framework/templates/skill-project-context.snippet.md +19 -0
  209. package/framework/templates/spec.template.md +208 -0
  210. package/package.json +51 -0
  211. package/src/commands/add.js +229 -0
  212. package/src/commands/configure.js +385 -0
  213. package/src/commands/doctor.js +486 -0
  214. package/src/commands/migrate.js +185 -0
  215. package/src/commands/push.js +0 -0
  216. package/src/commands/routines.js +269 -0
  217. package/src/commands/status.js +130 -0
  218. package/src/commands/update.js +419 -0
  219. package/src/commands/version.js +88 -0
  220. package/src/utils/contamination.js +400 -0
  221. package/src/utils/git.js +181 -0
  222. package/src/utils/hooks.js +152 -0
  223. package/src/utils/routine-adapters/claude-code-cloud.js +78 -0
  224. package/src/utils/routine-adapters/cron.js +138 -0
  225. package/src/utils/routine-adapters/github-actions.js +141 -0
  226. package/src/utils/routine-adapters/index.js +21 -0
  227. package/src/utils/routines.js +166 -0
  228. package/src/utils/state.js +143 -0
  229. package/src/utils/symlinks.js +425 -0
  230. package/src/utils/ui.js +133 -0
@@ -0,0 +1,216 @@
1
+ # LLM Wiki Overlay — Methodology
2
+
3
+ ## Purpose
4
+
5
+ Document the methodology for building a **derived LLM wiki** on top of
6
+ canonical SSOT docs. The overlay is a non-canonical, human-and-agent-friendly
7
+ layer of compiled pages (concepts, syntheses, dashboards, reading guides) that
8
+ makes retrieval cheaper and reasoning more stable, **without ever becoming
9
+ source-of-truth**.
10
+
11
+ This module describes the contract, file layout, lifecycle, and auto-learning
12
+ loop. The agent that maintains the overlay is `wiki-curator`. The skill that
13
+ captures synthesis pages from live conversations is `/capture`.
14
+
15
+ ## Layered Knowledge Stack
16
+
17
+ The wiki overlay sits on top of an existing retrieval stack. A typical layout:
18
+
19
+ | Layer | Role | Authority |
20
+ |-------|------|-----------|
21
+ | Canonical SSOT (`${paths.references_dir}/**`, `${paths.adrs_dir}/**`, code itself) | Source of truth | **Canonical** — never override from below |
22
+ | External human knowledge (Obsidian vault, Notion, Confluence) | Human-readable narrative; optional | Mirrors canonical with extra context |
23
+ | RAG / search layer (e.g. LightRAG, vector DB, full-text index) | Recall + cross-document discovery | Operational, not canonical |
24
+ | **Wiki overlay** (`${paths.wiki_dir}/**`) | Compiled, navigable, stable | **Derived** — always cites canonical refs |
25
+
26
+ Rules:
27
+
28
+ 1. The wiki never creates canonical truth.
29
+ 2. SSOT changes propagate down; wiki pages must be recompiled when canonicals
30
+ change.
31
+ 3. If a wiki page conflicts with SSOT, SSOT wins and the wiki page is rewritten.
32
+ 4. The RAG layer is fed both canonicals and wiki pages, but query verdicts
33
+ reveal **gaps** in the canonical layer, which become candidates for new
34
+ wiki syntheses (see § Auto-Learning Loop).
35
+
36
+ ## Page Types
37
+
38
+ A complete overlay typically contains five page types:
39
+
40
+ | Type | Folder | Purpose |
41
+ |------|--------|---------|
42
+ | **Concept** | `${paths.wiki_dir}/concepts/` | Explanatory pages that define a term, pattern, or system component |
43
+ | **Synthesis** | `${paths.wiki_dir}/syntheses/` | Multi-source distillation of cross-document reasoning (often captured via `/capture`) |
44
+ | **Dashboard** | `${paths.wiki_dir}/dashboards/` | Current-state snapshots (status of an epic, freshness of a SSOT, validator output) |
45
+ | **Reading Guide** | `${paths.wiki_dir}/reading-guides/` | Ordered paths into the corpus for specific tasks (onboarding, incident response) |
46
+ | **Index** | `${paths.wiki_dir}/index.md` | Single navigation entry point listing the other pages |
47
+
48
+ The `${paths.wiki_dir}/log.md` file is the **append-only event log** used by the
49
+ auto-learning loop (see below).
50
+
51
+ ## Frontmatter Discipline (MANDATORY)
52
+
53
+ Every wiki page MUST carry frontmatter so agents and validators can route and
54
+ trust the page:
55
+
56
+ ```yaml
57
+ ---
58
+ doc_type: synthesis | concept | dashboard | reading-guide | log | index
59
+ domain: <e.g. platform | booking | payments | …>
60
+ canonicality: derived # NEVER `canonical` — that's the SSOT layer's contract
61
+ owner: <agent or team>
62
+ status: active | draft | deprecated
63
+ freshness_status: fresh | stale | needs-rebuild
64
+ confidence: high | medium | low
65
+ source_refs: # explicit canonical doc paths the page synthesizes
66
+ - ${paths.adrs_dir}/<ADR>.md
67
+ - ${paths.references_dir}/<ref>.md
68
+ last_verified_from_code: YYYY-MM-DD
69
+ canonical_refs: # broader canonicals this page is consistent with
70
+ - ${paths.references_dir}/ssot-registry.md
71
+ - ${paths.references_dir}/project-status.md
72
+ ---
73
+ ```
74
+
75
+ Run a frontmatter validator (typically `npm run validate:frontmatter` or
76
+ equivalent) before committing wiki edits.
77
+
78
+ ## Anchor & Cross-Reference Discipline
79
+
80
+ - Markdown slugification: lowercase, spaces → dashes, strip punctuation except
81
+ dashes (GitHub-flavored).
82
+ - For every `[text](#some-anchor)` link, the corresponding heading must exist
83
+ with the slugified form `some-anchor`.
84
+ - For every `[text](../foo.md#anchor)` link, the heading must exist in
85
+ `foo.md`.
86
+ - The `wiki-curator` agent flags `WIKI_ANCHOR_BROKEN` on mismatch and fixes
87
+ it in the same invocation when possible.
88
+
89
+ ## Auto-Learning Loop (the core idea)
90
+
91
+ The overlay is not static. It feeds itself from agent activity, closing a loop
92
+ that surfaces documentation gaps and turns them into stable pages.
93
+
94
+ ```
95
+ ┌──────────────┐
96
+ │ Agents query │
97
+ │ RAG / search │
98
+ └──────┬───────┘
99
+ │ (instrumented: every search_docs call tags the invoker)
100
+
101
+ ┌──────────────┐
102
+ │ Telemetry log│ (${paths.wiki_dir}/log.md — append-only)
103
+ └──────┬───────┘
104
+ │ (verdicts: useful | weak | empty | fallback_degraded)
105
+
106
+ ┌────────────────────────────┐
107
+ │ Nightly wiki-review job │
108
+ │ runs `wiki-curator` agent │
109
+ └──────┬─────────────────────┘
110
+ │ (proposes synthesis candidates from weak/empty verdicts)
111
+
112
+ ┌────────────────────────────┐
113
+ │ /capture skill writes │
114
+ │ a new synthesis page after │
115
+ │ user approval │
116
+ └──────┬─────────────────────┘
117
+
118
+
119
+ New wiki page → next RAG query gets a strong verdict.
120
+ ```
121
+
122
+ ### Tap points (instrumentation)
123
+
124
+ Every agent that queries the RAG layer MUST pass an `invoker_agent` tag on its
125
+ search calls, so telemetry attributes the query to the right agent. After each
126
+ call, the agent inspects the telemetry verdict and — if it is `weak`, `empty`,
127
+ or `fallback_degraded` — appends one entry to `${paths.wiki_dir}/log.md` via the
128
+ project's log helper (e.g. `tools/<rag-impl>/wiki_log.py`).
129
+
130
+ ```python
131
+ from wiki_log import append_entry # project-specific helper
132
+ append_entry(
133
+ entry_type="query",
134
+ title=<query_short>,
135
+ agent=<invoker>,
136
+ context={"verdict": verdict, "top_score": top_score, "count": count},
137
+ refs=[],
138
+ outcome=verdict,
139
+ )
140
+ ```
141
+
142
+ **Graceful degrade**: if the helper fails or is missing, emit one stderr line
143
+ and continue. Telemetry must never block real work.
144
+
145
+ ### Synthesis candidates (nightly review)
146
+
147
+ The `wiki-curator` agent, running on a schedule (typically nightly), scans:
148
+
149
+ - ADRs and PRDs from the last 14 days with significant architectural impact
150
+ (touches >3 modules, provider swap, schema change, auth change, API
151
+ contract) → propose a synthesis page.
152
+ - PRD-led multi-card epics (≥4 cards in same parent epic) → propose an
153
+ overview synthesis.
154
+ - RAG queries with `verdict=weak|empty` repeated ≥3 times in
155
+ `${paths.wiki_dir}/log.md` → the topic is a documentation gap, propose synthesis.
156
+
157
+ Candidates are appended to `${paths.wiki_dir}/log.md` with
158
+ `entry_type: synthesis_candidate` and a small payload (title, source refs,
159
+ expected scope, triggering agent).
160
+
161
+ ### `/capture` skill (manual + proactive)
162
+
163
+ The `/capture` skill turns a recent multi-turn synthesis (cross-document
164
+ reasoning done in a conversation) into a durable synthesis page under
165
+ `${paths.wiki_dir}/syntheses/<slug>.md`. Two modes:
166
+
167
+ | Mode | When | How |
168
+ |------|------|-----|
169
+ | **Manual** | User runs `/capture` explicitly | Skill reads pending queue + recent turns, proposes a synthesis |
170
+ | **Proactive** | A `Stop`-event hook detected a synthesis-worthy turn and queued a candidate | Next `/capture` invocation surfaces the candidate first |
171
+
172
+ Manual mode always works. Proactive mode is a convenience layer the user can
173
+ disable with a kill-switch file (`touch .claude/capture-queue/.disabled`).
174
+
175
+ The skill requires explicit user approval before writing. Acceptance and
176
+ rejection are both logged.
177
+
178
+ ## Graph Community Synthesis (optional, advanced)
179
+
180
+ If the project's RAG layer ships a community-detection layer (e.g.
181
+ Leiden/Louvain) on top of the entity graph, cluster summaries can be produced
182
+ weekly and exposed via dedicated MCP tools. These cluster summaries are
183
+ candidate inputs to `concept` pages.
184
+
185
+ ## Roles & Responsibilities
186
+
187
+ | Role | Owns | Edits |
188
+ |------|------|-------|
189
+ | `wiki-curator` agent | Overlay quality, drift detection, candidate proposal | `${paths.wiki_dir}/**` |
190
+ | `/capture` skill | Synthesis page creation from live conversations | `${paths.wiki_dir}/syntheses/**` |
191
+ | `doc-reviewer` agent | Canonical SSOT integrity (downstream of the overlay) | `${paths.references_dir}/**`, `${paths.adrs_dir}/**` |
192
+ | Project-specific knowledge-sync agent (optional) | Mirror to external corpus (Obsidian/Notion/Confluence) | External corpus only |
193
+
194
+ ## Adoption Checklist (for a new project)
195
+
196
+ To install the LLM wiki overlay in a new project:
197
+
198
+ 1. Create `${paths.wiki_dir}/` with the five page-type folders and an `index.md`.
199
+ 2. Add the frontmatter validator (or adapt your existing one) to check
200
+ wiki frontmatter compliance.
201
+ 3. Decide on a RAG layer (LightRAG, vector DB, or full-text). If using one,
202
+ instrument every `search_docs` call with `invoker_agent` and a `wiki_log`
203
+ append helper.
204
+ 4. Schedule the `wiki-curator` agent to run on a nightly cadence
205
+ (cron / Claude Code remote agent / GitHub Action).
206
+ 5. Enable the `/capture` skill for users and (optionally) the proactive hook.
207
+ 6. Add `${paths.wiki_dir}/log.md` as an append-only log file under version control,
208
+ with rotation rules if it grows large.
209
+ 7. Document the overlay in your repo README so contributors know it exists
210
+ and is non-canonical.
211
+
212
+ ## Related
213
+
214
+ - Agent: [`.claude/agents/wiki-curator.md`](../.claude/agents/wiki-curator.md)
215
+ - Skill: [`.claude/skills/capture/SKILL.md`](../.claude/skills/capture/SKILL.md)
216
+ - Doc-writer agent: [`.claude/agents/doc-reviewer.md`](../.claude/agents/doc-reviewer.md)
@@ -0,0 +1,305 @@
1
+ # Maintenance Protocol
2
+
3
+ ## Purpose
4
+
5
+ Define routine maintenance tasks and procedures.
6
+
7
+ ## Scope
8
+
9
+ **In**: Dependency updates, database maintenance, cleanup tasks, health checks.
10
+ **Out**: Emergency procedures (see agents/deployment-protocol.md).
11
+
12
+ ## Do
13
+
14
+ - Schedule regular maintenance
15
+ - Test updates in staging first
16
+ - Document maintenance activities
17
+ - Keep dependencies up to date
18
+
19
+ ## Do Not
20
+
21
+ - Skip maintenance windows
22
+ - Update production directly
23
+ - Ignore security updates
24
+
25
+ ## Maintenance Schedule
26
+
27
+ ### Daily
28
+
29
+ - [ ] Check error logs
30
+ - [ ] Monitor system health
31
+ - [ ] Review performance metrics
32
+ - [ ] Check disk space
33
+
34
+ ### Weekly
35
+
36
+ - [ ] Review security advisories
37
+ - [ ] Check for dependency updates
38
+ - [ ] Analyze slow queries
39
+ - [ ] Review recent deployments
40
+
41
+ ### Monthly
42
+
43
+ - [ ] Update dependencies
44
+ - [ ] Database optimization
45
+ - [ ] Review access logs
46
+ - [ ] Clean up old data
47
+ - [ ] Review backup procedures
48
+ - [ ] Test disaster recovery
49
+
50
+ ### Quarterly
51
+
52
+ - [ ] Security audit
53
+ - [ ] Performance review
54
+ - [ ] Capacity planning
55
+ - [ ] Documentation review
56
+ - [ ] Dependency major version updates
57
+
58
+ ### Annually
59
+
60
+ - [ ] Comprehensive security review
61
+ - [ ] Architecture review
62
+ - [ ] Technology stack evaluation
63
+ - [ ] Disaster recovery drill
64
+ - [ ] SSL certificate renewal
65
+
66
+ ## Dependency Management
67
+
68
+ ### Checking for Updates
69
+
70
+ ```bash
71
+ # Check for outdated packages
72
+ [command - e.g., npm outdated, pip list --outdated]
73
+ ```
74
+
75
+ ### Update Strategy
76
+
77
+ 1. **Patch updates** (x.x.X): Apply immediately
78
+ 2. **Minor updates** (x.X.x): Test in staging, deploy within week
79
+ 3. **Major updates** (X.x.x): Plan, test thoroughly, may require code changes
80
+
81
+ ### Update Process
82
+
83
+ 1. Check changelog for breaking changes
84
+ 2. Update in development
85
+ 3. Run tests
86
+ 4. Deploy to staging
87
+ 5. Test critical flows
88
+ 6. Deploy to production
89
+ 7. Monitor for issues
90
+
91
+ ## Database Maintenance
92
+
93
+ ### Regular Tasks
94
+
95
+ ```bash
96
+ # Analyze tables (example for PostgreSQL)
97
+ ANALYZE;
98
+
99
+ # Vacuum database
100
+ VACUUM;
101
+
102
+ # Check database size
103
+ [command]
104
+
105
+ # Optimize tables (if applicable)
106
+ [command]
107
+ ```
108
+
109
+ ### Index Maintenance
110
+
111
+ - Review slow query log
112
+ - Identify missing indexes
113
+ - Remove unused indexes
114
+ - Rebuild fragmented indexes
115
+
116
+ ### Data Cleanup
117
+
118
+ - Archive old records
119
+ - Delete soft-deleted records
120
+ - Clean up orphaned data
121
+ - Purge expired sessions
122
+
123
+ ## Log Management
124
+
125
+ ### Log Rotation
126
+
127
+ - Rotate logs daily/weekly
128
+ - Compress old logs
129
+ - Delete logs older than retention period
130
+ - Archive important logs
131
+
132
+ ### Log Analysis
133
+
134
+ - Review error patterns
135
+ - Identify slow operations
136
+ - Check for security issues
137
+ - Monitor resource usage
138
+
139
+ ## Backup Verification
140
+
141
+ ### Regular Checks
142
+
143
+ ```bash
144
+ # List recent backups
145
+ [command]
146
+
147
+ # Test backup restoration
148
+ [command]
149
+
150
+ # Verify backup integrity
151
+ [command]
152
+ ```
153
+
154
+ ### Backup Schedule
155
+
156
+ - **Database**: Daily, keep 30 days
157
+ - **Files**: Weekly, keep 12 weeks
158
+ - **Full system**: Monthly, keep 12 months
159
+ - **Critical data**: Real-time replication
160
+
161
+ ## Security Maintenance
162
+
163
+ ### SSL Certificates
164
+
165
+ - Monitor expiration dates
166
+ - Renew 30 days before expiry
167
+ - Test after renewal
168
+ - Update certificate pinning if used
169
+
170
+ ### Access Review
171
+
172
+ - Review user accounts
173
+ - Remove inactive users
174
+ - Review permissions
175
+ - Rotate API keys/secrets
176
+
177
+ ### Security Patches
178
+
179
+ - Monitor security advisories
180
+ - Apply critical patches immediately
181
+ - Test non-critical patches in staging
182
+ - Document all security updates
183
+
184
+ ## Performance Optimization
185
+
186
+ ### Regular Reviews
187
+
188
+ - Analyze slow queries
189
+ - Review API response times
190
+ - Check resource usage trends
191
+ - Identify bottlenecks
192
+
193
+ ### Cache Management
194
+
195
+ ```bash
196
+ # Clear cache
197
+ [command]
198
+
199
+ # Warm cache
200
+ [command]
201
+
202
+ # Review cache hit rate
203
+ [command]
204
+ ```
205
+
206
+ ## Health Checks
207
+
208
+ ### System Health
209
+
210
+ ```bash
211
+ # Check service status
212
+ [command]
213
+
214
+ # Check disk space
215
+ [command]
216
+
217
+ # Check memory usage
218
+ [command]
219
+
220
+ # Check CPU usage
221
+ [command]
222
+ ```
223
+
224
+ ### Application Health
225
+
226
+ ```bash
227
+ # Health endpoint
228
+ curl [health-check-url]
229
+
230
+ # Database connection
231
+ [command]
232
+
233
+ # External service status
234
+ [command]
235
+ ```
236
+
237
+ ## Incident Prevention
238
+
239
+ ### Monitoring
240
+
241
+ - Set up alerts for:
242
+ - High error rates
243
+ - Slow response times
244
+ - High resource usage
245
+ - Failed health checks
246
+ - Security events
247
+
248
+ ### Proactive Actions
249
+
250
+ - Scale before reaching capacity
251
+ - Fix issues before they become critical
252
+ - Update before forced by security issues
253
+ - Document before knowledge is lost
254
+
255
+ ## Maintenance Windows
256
+
257
+ ### Planning
258
+
259
+ 1. Announce maintenance window
260
+ 2. Schedule during low-traffic period
261
+ 3. Prepare rollback plan
262
+ 4. Test procedures in staging
263
+
264
+ ### During Maintenance
265
+
266
+ 1. Put site in maintenance mode (if applicable)
267
+ 2. Perform maintenance tasks
268
+ 3. Run health checks
269
+ 4. Verify functionality
270
+ 5. Return to normal operation
271
+
272
+ ### After Maintenance
273
+
274
+ 1. Monitor for issues
275
+ 2. Document what was done
276
+ 3. Review if maintenance was successful
277
+ 4. Schedule next maintenance
278
+
279
+ ## Documentation
280
+
281
+ Maintain maintenance log:
282
+
283
+ ```markdown
284
+ ## YYYY-MM-DD: [Maintenance Type]
285
+
286
+ **Performed by**: [Name]
287
+ **Duration**: [Time]
288
+ **Tasks completed**:
289
+ - [Task 1]
290
+ - [Task 2]
291
+
292
+ **Issues encountered**: [None or description]
293
+ **Follow-up actions**: [Any actions needed]
294
+ ```
295
+
296
+ ## Emergency Maintenance
297
+
298
+ For critical issues requiring immediate maintenance:
299
+
300
+ 1. Notify team
301
+ 2. Document issue
302
+ 3. Perform fix
303
+ 4. Test immediately
304
+ 5. Monitor closely
305
+ 6. Post-mortem after resolution
@@ -0,0 +1,162 @@
1
+ # Observability
2
+
3
+ ## Purpose
4
+
5
+ Define logging, monitoring, and alerting strategies.
6
+
7
+ ## Scope
8
+
9
+ **In**: Logging standards, metrics, tracing, alerting.
10
+ **Out**: Performance optimization (see agents/performance.md).
11
+
12
+ ## Do
13
+
14
+ - Log important events with context
15
+ - Monitor key metrics
16
+ - Set up alerts for critical issues
17
+ - Implement distributed tracing if applicable
18
+
19
+ ## Do Not
20
+
21
+ - Log sensitive data (passwords, tokens, PII)
22
+ - Over-log (creates noise)
23
+ - Ignore warning signs
24
+
25
+ ## Logging
26
+
27
+ ### Log Levels
28
+
29
+ - **ERROR**: Application errors requiring immediate attention
30
+ - **WARN**: Warning conditions that should be reviewed
31
+ - **INFO**: Important business events
32
+ - **DEBUG**: Detailed diagnostic information
33
+
34
+ ### Log Format
35
+
36
+ Use structured logging:
37
+
38
+ ```json
39
+ {
40
+ "timestamp": "2026-02-13T10:00:00Z",
41
+ "level": "INFO",
42
+ "message": "User logged in",
43
+ "userId": "123",
44
+ "context": {
45
+ "ip": "192.168.1.1",
46
+ "userAgent": "..."
47
+ }
48
+ }
49
+ ```
50
+
51
+ ### What to Log
52
+
53
+ - Authentication attempts
54
+ - Authorization failures
55
+ - API requests/responses (sanitized)
56
+ - Database errors
57
+ - External service calls
58
+ - Business-critical events
59
+ - Performance anomalies
60
+
61
+ ### What NOT to Log
62
+
63
+ - Passwords
64
+ - API keys/tokens
65
+ - Credit card numbers
66
+ - PII (unless required and encrypted)
67
+ - Large payloads
68
+
69
+ ## Metrics
70
+
71
+ ### Application Metrics
72
+
73
+ - Request count
74
+ - Response times
75
+ - Error rates
76
+ - Active users
77
+ - Business metrics (signups, conversions, etc.)
78
+
79
+ ### Infrastructure Metrics
80
+
81
+ - CPU usage
82
+ - Memory usage
83
+ - Disk I/O
84
+ - Network I/O
85
+ - Database connections
86
+
87
+ ### Custom Metrics
88
+
89
+ Define project-specific metrics:
90
+
91
+ - [Business metric 1]
92
+ - [Business metric 2]
93
+ - [Technical metric 1]
94
+
95
+ ## Tracing (if applicable)
96
+
97
+ - Implement distributed tracing for microservices
98
+ - Trace IDs through request lifecycle
99
+ - Track latency across services
100
+ - Identify bottlenecks
101
+
102
+ ## Alerting
103
+
104
+ ### Alert Levels
105
+
106
+ - **Critical**: Immediate action required (page on-call)
107
+ - **High**: Requires attention within hours
108
+ - **Medium**: Review during business hours
109
+ - **Low**: Informational
110
+
111
+ ### Alert Criteria
112
+
113
+ Define when to alert:
114
+
115
+ | Metric | Threshold | Level |
116
+ |--------|-----------|-------|
117
+ | Error rate | > 5% | Critical |
118
+ | Response time (p95) | > 2s | High |
119
+ | CPU usage | > 80% | High |
120
+ | Disk space | < 10% | Critical |
121
+ | [Custom metric] | [Threshold] | [Level] |
122
+
123
+ ### Alert Channels
124
+
125
+ - [On-call system - e.g., PagerDuty]
126
+ - [Team chat - e.g., Slack]
127
+ - [Email]
128
+ - [SMS for critical]
129
+
130
+ ## Dashboards
131
+
132
+ Create dashboards for:
133
+
134
+ - System health overview
135
+ - Application performance
136
+ - Business metrics
137
+ - Error tracking
138
+ - User activity
139
+
140
+ ## Incident Response
141
+
142
+ 1. Alert fires
143
+ 2. On-call acknowledges
144
+ 3. Investigate using logs/metrics
145
+ 4. Mitigate issue
146
+ 5. Create post-mortem
147
+ 6. Implement preventive measures
148
+
149
+ ## Tools
150
+
151
+ - **Logging**: [e.g., ELK, Loki, CloudWatch]
152
+ - **Metrics**: [e.g., Prometheus, Datadog, CloudWatch]
153
+ - **Tracing**: [e.g., Jaeger, Zipkin, X-Ray]
154
+ - **Alerting**: [e.g., PagerDuty, Opsgenie, Grafana]
155
+ - **Dashboards**: [e.g., Grafana, Kibana, Datadog]
156
+
157
+ ## Log Retention
158
+
159
+ - [Production logs retention - e.g., 30 days]
160
+ - [Error logs retention - e.g., 90 days]
161
+ - [Audit logs retention - e.g., 1 year]
162
+ - [Archive policy]