@jeiemgi/cckit 0.1.6

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 (191) hide show
  1. package/.claude-plugin/plugin.json +22 -0
  2. package/AGENTS.md +101 -0
  3. package/LICENSE-APACHE +202 -0
  4. package/LICENSE-MIT +21 -0
  5. package/README.md +143 -0
  6. package/SECURITY.md +22 -0
  7. package/bin/cckit +215 -0
  8. package/cckit.config.json +34 -0
  9. package/commands/kit-add.md +42 -0
  10. package/commands/kit-docs.md +45 -0
  11. package/commands/kit-doctor.md +52 -0
  12. package/commands/kit-export-project.md +58 -0
  13. package/commands/kit-export-training.md +49 -0
  14. package/commands/kit-init.md +126 -0
  15. package/commands/kit-routines.md +59 -0
  16. package/commands/kit-update.md +132 -0
  17. package/docs/kit-annotate/01-explainer.html +225 -0
  18. package/docs/kit-annotate/02-implementation-plan.html +196 -0
  19. package/docs/media/.onboarding-capture.cast +5 -0
  20. package/docs/media/README.md +43 -0
  21. package/docs/media/build-demo.sh +63 -0
  22. package/docs/media/build-kit-init.sh +51 -0
  23. package/docs/media/build-onboarding.sh +51 -0
  24. package/docs/media/kit-dry-run.cast +107 -0
  25. package/docs/media/kit-dry-run.gif +0 -0
  26. package/docs/media/kit-init.cast +56 -0
  27. package/docs/media/kit-init.gif +0 -0
  28. package/docs/media/kit-onboarding.cast +148 -0
  29. package/docs/media/kit-onboarding.gif +0 -0
  30. package/githooks/pre-commit +18 -0
  31. package/kit.config.schema.json +105 -0
  32. package/package.json +54 -0
  33. package/privacy-denylist.example +8 -0
  34. package/profiles/automation.json +36 -0
  35. package/profiles/content.json +41 -0
  36. package/profiles/minimal.json +31 -0
  37. package/profiles/research.json +37 -0
  38. package/profiles/software.json +32 -0
  39. package/scripts/annotate-setup.sh +149 -0
  40. package/scripts/autopilot.sh +50 -0
  41. package/scripts/capture-project-ids.sh +53 -0
  42. package/scripts/check.sh +66 -0
  43. package/scripts/contribute.sh +48 -0
  44. package/scripts/debug.sh +54 -0
  45. package/scripts/init-upgrade-test.sh +99 -0
  46. package/scripts/init.sh +827 -0
  47. package/scripts/install.sh +24 -0
  48. package/scripts/kit-add-test.sh +62 -0
  49. package/scripts/kit-add.sh +115 -0
  50. package/scripts/kit-adopt-test.sh +61 -0
  51. package/scripts/kit-adopt.sh +122 -0
  52. package/scripts/kit-bump-version.sh +79 -0
  53. package/scripts/kit-digest.sh +126 -0
  54. package/scripts/kit-doctor.sh +663 -0
  55. package/scripts/kit-export-project-test.sh +82 -0
  56. package/scripts/kit-export-project.sh +245 -0
  57. package/scripts/kit-export-training-test.sh +51 -0
  58. package/scripts/kit-export-training.sh +175 -0
  59. package/scripts/kit-migrate-test.sh +80 -0
  60. package/scripts/kit-migrate.sh +190 -0
  61. package/scripts/kit-onboard-test.sh +63 -0
  62. package/scripts/kit-onboard.sh +69 -0
  63. package/scripts/kit-promote-test.sh +54 -0
  64. package/scripts/kit-promote.sh +102 -0
  65. package/scripts/kit-remove-test.sh +61 -0
  66. package/scripts/kit-remove.sh +84 -0
  67. package/scripts/kit-routines.sh +322 -0
  68. package/scripts/kit-version-check.sh +91 -0
  69. package/scripts/kit-wire-test.sh +54 -0
  70. package/scripts/kit-wire.sh +132 -0
  71. package/scripts/knowledge-lint.sh +96 -0
  72. package/scripts/lib/cckit-output.sh +36 -0
  73. package/scripts/lib/effort-metrics.sh +452 -0
  74. package/scripts/lib/effort-ops-test.sh +83 -0
  75. package/scripts/lib/effort-ops.sh +132 -0
  76. package/scripts/lib/effort-plan.sh +104 -0
  77. package/scripts/lib/effort.sh +191 -0
  78. package/scripts/lib/engine-adapter.sh +92 -0
  79. package/scripts/lib/gh-log.sh +58 -0
  80. package/scripts/lib/gh-project.sh +212 -0
  81. package/scripts/lib/handoff.sh +35 -0
  82. package/scripts/lib/kit-cli-test.sh +42 -0
  83. package/scripts/lib/kit-cli.sh +32 -0
  84. package/scripts/lib/kit-config-resolve.sh +145 -0
  85. package/scripts/lib/kit-config.sh +88 -0
  86. package/scripts/lib/kit-engine-test.sh +107 -0
  87. package/scripts/lib/kit-events.sh +62 -0
  88. package/scripts/lib/kit-gc.sh +117 -0
  89. package/scripts/lib/kit-interview-test.sh +77 -0
  90. package/scripts/lib/kit-interview.sh +203 -0
  91. package/scripts/lib/kit-local.sh +79 -0
  92. package/scripts/lib/kit-manifest.sh +127 -0
  93. package/scripts/lib/kit-mode-test.sh +49 -0
  94. package/scripts/lib/kit-mode.sh +67 -0
  95. package/scripts/lib/kit-operate.sh +105 -0
  96. package/scripts/lib/kit-profile-test.sh +62 -0
  97. package/scripts/lib/kit-profile.sh +115 -0
  98. package/scripts/lib/kit-task-ops-test.sh +63 -0
  99. package/scripts/lib/kit-task-ops.sh +341 -0
  100. package/scripts/lib/pr-evidence.sh +173 -0
  101. package/scripts/lib/project-scan.sh +16 -0
  102. package/scripts/lib/react-detect.sh +78 -0
  103. package/scripts/lib/role-identity.sh +47 -0
  104. package/scripts/lib/secret-guard.sh +96 -0
  105. package/scripts/lib/toon.sh +35 -0
  106. package/scripts/lib/ui.sh +42 -0
  107. package/scripts/lib/version-bump.sh +59 -0
  108. package/scripts/lib/worktree-issue-test.sh +45 -0
  109. package/scripts/lib/worktree-issue.sh +73 -0
  110. package/scripts/lib/worktree-start.sh +280 -0
  111. package/scripts/orchestrate.sh +160 -0
  112. package/scripts/portable-test.sh +53 -0
  113. package/scripts/publish.sh +94 -0
  114. package/scripts/setup-labels.sh +25 -0
  115. package/scripts/setup-milestones.sh +17 -0
  116. package/scripts/showcase.sh +64 -0
  117. package/scripts/status.sh +44 -0
  118. package/scripts/task-sync.sh +59 -0
  119. package/scripts/test.sh +48 -0
  120. package/scripts/web-install.sh +22 -0
  121. package/skills/kit-annotate/SKILL.md +107 -0
  122. package/skills/kit-autopilot/SKILL.md +108 -0
  123. package/skills/kit-contribute/SKILL.md +134 -0
  124. package/skills/kit-customize/SKILL.md +134 -0
  125. package/skills/kit-dev/SKILL.md +67 -0
  126. package/skills/kit-digest/SKILL.md +41 -0
  127. package/skills/kit-effort-close/SKILL.md +156 -0
  128. package/skills/kit-effort-new/SKILL.md +173 -0
  129. package/skills/kit-effort-pr/SKILL.md +139 -0
  130. package/skills/kit-effort-start/SKILL.md +85 -0
  131. package/skills/kit-gc/SKILL.md +80 -0
  132. package/skills/kit-onboard/SKILL.md +50 -0
  133. package/skills/kit-security-sweep/SKILL.md +57 -0
  134. package/skills/kit-ship/SKILL.md +43 -0
  135. package/skills/kit-task-close/SKILL.md +66 -0
  136. package/skills/kit-task-new/SKILL.md +51 -0
  137. package/skills/kit-task-pr/SKILL.md +43 -0
  138. package/skills/kit-task-pr-auto/SKILL.md +27 -0
  139. package/skills/kit-task-pr-merge/SKILL.md +53 -0
  140. package/skills/kit-task-start/SKILL.md +76 -0
  141. package/skills/kit-task-sync/SKILL.md +37 -0
  142. package/templates/CLAUDE.md.tmpl +106 -0
  143. package/templates/agents/analyst.md +55 -0
  144. package/templates/agents/auto-dev.md +93 -0
  145. package/templates/agents/backend.md +59 -0
  146. package/templates/agents/designer.md +73 -0
  147. package/templates/agents/devops.md +57 -0
  148. package/templates/agents/editor.md +48 -0
  149. package/templates/agents/frontend.md +81 -0
  150. package/templates/agents/generalist.md +46 -0
  151. package/templates/agents/local-delegate.md +70 -0
  152. package/templates/agents/n8n.md +65 -0
  153. package/templates/agents/pm.md +69 -0
  154. package/templates/agents/qa.md +66 -0
  155. package/templates/agents/researcher.md +57 -0
  156. package/templates/agents/security.md +65 -0
  157. package/templates/agents/tech-lead.md +75 -0
  158. package/templates/hooks/guard-base-branch-commit.sh.tmpl +45 -0
  159. package/templates/hooks/kit-local-status.sh.tmpl +34 -0
  160. package/templates/hooks/kit_version_check.sh.tmpl +6 -0
  161. package/templates/hooks/mempal_followup.sh.tmpl +97 -0
  162. package/templates/hooks/mempal_precompact.sh.tmpl +4 -0
  163. package/templates/hooks/mempal_save.sh.tmpl +4 -0
  164. package/templates/hooks/mempal_session_start.sh.tmpl +8 -0
  165. package/templates/hooks/prepush_gate.sh.tmpl +36 -0
  166. package/templates/hooks/repo-hygiene.sh.tmpl +72 -0
  167. package/templates/kit.config.json.tmpl +32 -0
  168. package/templates/knowledge-INDEX.md.tmpl +12 -0
  169. package/templates/lib/kit-sigil.sh.tmpl +124 -0
  170. package/templates/rules/branch-naming.md +104 -0
  171. package/templates/rules/communication-style.md +22 -0
  172. package/templates/rules/delegation-brief.md +40 -0
  173. package/templates/rules/design-routing.md +35 -0
  174. package/templates/rules/effort-model.md +122 -0
  175. package/templates/rules/knowledge-base.md +41 -0
  176. package/templates/rules/mempalace.md +110 -0
  177. package/templates/rules/plan-output-format.md +58 -0
  178. package/templates/rules/react-annotate.md +69 -0
  179. package/templates/rules/risk-tiered-review.md +62 -0
  180. package/templates/rules/skill-gaps.md +48 -0
  181. package/templates/rules/task-management.md +42 -0
  182. package/templates/settings/settings.local.json.tmpl +27 -0
  183. package/templates/skills/NAMESPACED +13 -0
  184. package/templates/skills/copywriting/SKILL.md +252 -0
  185. package/templates/skills/copywriting/references/copy-frameworks.md +344 -0
  186. package/templates/skills/copywriting/references/natural-transitions.md +272 -0
  187. package/templates/skills/feature-build-refine/SKILL.md +367 -0
  188. package/templates/skills/karpathy-guidelines/SKILL.md +69 -0
  189. package/templates/skills/morning-briefing/SKILL.md +46 -0
  190. package/templates/skills/speckit/SKILL.md +239 -0
  191. package/templates/skills/supabase-patterns/SKILL.md +88 -0
@@ -0,0 +1,32 @@
1
+ {
2
+ "$schema": "https://github.com/tuempresadigital/claude-kit/kit.config.schema.json",
3
+ "kitVersion": "0.1.0",
4
+ "mode": "guided",
5
+ "project": {
6
+ "name": "{{PROJECT_NAME}}",
7
+ "slug": "{{PROJECT_SLUG}}",
8
+ "owner": "{{OWNER_NAME}}",
9
+ "language": "{{COMMS_LANG}}",
10
+ "path": "{{PROJECT_PATH}}"
11
+ },
12
+ "profile": "{{PROFILE}}",
13
+ "roles": [{{ROLES_JSON}}],
14
+ "github": {
15
+ "repo": "{{GH_REPO}}",
16
+ "owner": "{{GH_OWNER}}",
17
+ "projectsV2": {{PROJECTS_V2}},
18
+ "projectNumber": {{PROJECT_NUMBER}},
19
+ "projectTitle": "{{PROJECT_BOARD_TITLE}}"
20
+ },
21
+ "milestones": [{{MILESTONES_JSON}}],
22
+ "plans": {
23
+ "format": "{{PLANS_FORMAT}}",
24
+ "dir": "{{PLANS_DIR}}"
25
+ },
26
+ "memory": {
27
+ "enabled": {{MEMORY_ENABLED}},
28
+ "provider": "mempalace",
29
+ "wing": "{{WING}}",
30
+ "claudeProjectSlug": "{{CLAUDE_PROJECT_SLUG}}"
31
+ }
32
+ }
@@ -0,0 +1,12 @@
1
+ # Knowledge Index — {{PROJECT_NAME}}
2
+
3
+ Manifest of the knowledge base. Rules (`.claude/rules/knowledge-base.md`):
4
+
5
+ - **If a file exists in `knowledge/`, it is current.** Superseded docs get DELETED — git is the archive.
6
+ - **The latest decision wins.** Conflicts resolve by decision log + `updated` date.
7
+ - Every doc carries frontmatter `status / owner / updated`. `canonical` = source of truth ·
8
+ `reference` = consultable, not normative · `historical` = context only.
9
+ - New doc → add a row here in the same PR (`scripts/knowledge-lint.sh` enforces it).
10
+
11
+ | File | Topic | Status | Owner | Updated |
12
+ | ---- | ----- | ------ | ----- | ------- |
@@ -0,0 +1,124 @@
1
+ #!/usr/bin/env bash
2
+ # claude-kit terminal identity — the seed-head sigil, brand palette, glyph vocabulary.
3
+ # Canonical brief: claude-kit terminal identity (kit docs; see cckit.vercel.app:
4
+ # apps/admin/src/plans/terminal-identity brief) #
5
+ # The line-leader is the LOCKED seed-head: ⡶ (U+2876) in Azafrán — the n=13 Vogel
6
+ # seed-head reduced to one Braille cell. One Azafrán per line: the seed only;
7
+ # the slash + wordmark are ink-dim; the note is Polvo. ASCII fallback: o.
8
+ #
9
+ # Public API (source this file, then call):
10
+ # kit_sigil [skill] [note] -> the "⡶ / claude-kit" line-leader lockup (footer)
11
+ # kit_seed -> just the leader glyph in Azafrán (⡶ / o)
12
+ # kit_glyph <name> -> one state glyph (unicode, or its ASCII fallback)
13
+ # kit_paint <token> <text…> -> text wrapped in a brand color (no-op when color is off)
14
+ #
15
+ # After the first call, mode + palette are exposed as KIT_* variables.
16
+
17
+ # ---- color / glyph mode detection ---------------------------------------
18
+ # Two INDEPENDENT axes — the brand glyph is not gated on the TTY (Claude Code
19
+ # and most pipes render UTF-8 fine; only color is unsafe down a pipe):
20
+ # Color : on when FORCE_COLOR=1, or (stdout is a TTY and NO_COLOR is unset).
21
+ # Unicode: on whenever the locale can render it (UTF-8), off only on an
22
+ # explicit KIT_ASCII=1 opt-out or a non-UTF-8 locale (braille needs UTF-8).
23
+ #
24
+ # surface | glyph | color
25
+ # ------------------------------- | ----- | -----
26
+ # TTY, NO_COLOR unset | ⡶ | Azafrán
27
+ # FORCE_COLOR=1 (piped) | ⡶ | Azafrán (previews)
28
+ # piped/redirect (e.g. Claude Code)| ⡶ | none ← seed-head kept, color stripped
29
+ # NO_COLOR set | ⡶ | none
30
+ # KIT_ASCII=1 or non-UTF-8 locale | o | none
31
+ kit_color_mode() {
32
+ # Unicode axis — capable unless explicitly opted out or the locale isn't UTF-8.
33
+ local loc="${LC_ALL:-${LC_CTYPE:-${LANG:-}}}"
34
+ if [ "${KIT_ASCII:-}" = "1" ]; then
35
+ KIT_UNICODE=0
36
+ elif printf '%s' "$loc" | grep -qiE 'utf-?8'; then
37
+ KIT_UNICODE=1
38
+ else
39
+ KIT_UNICODE=0
40
+ fi
41
+
42
+ # Color axis — forced, or a TTY without NO_COLOR. Never down a plain pipe.
43
+ if [ "${FORCE_COLOR:-}" = "1" ]; then
44
+ KIT_COLOR=1
45
+ elif [ -t 1 ] && [ -z "${NO_COLOR+x}" ]; then
46
+ KIT_COLOR=1
47
+ else
48
+ KIT_COLOR=0
49
+ fi
50
+
51
+ if [ "$KIT_COLOR" = 1 ]; then
52
+ KIT_AZAFRAN=$'\033[38;2;201;122;44m' # #C97A2C — THE accent (the seed / destello)
53
+ KIT_AZAFRAN_DEEP=$'\033[38;2;168;100;38m' # #A86426 — inner band depth (hero only)
54
+ KIT_INK=$'\033[2m' # terminal default-fg, dimmed — inverts with theme
55
+ KIT_POLVO=$'\033[38;2;168;160;151m' # #A8A097 — meta · captions · table rules
56
+ KIT_VERDE=$'\033[38;2;52;101;56m' # #346538 — success
57
+ KIT_AMBAR=$'\033[38;2;149;100;0m' # #956400 — warning
58
+ KIT_ROJO=$'\033[38;2;159;47;45m' # #9F2F2D — danger / error
59
+ KIT_AZUL=$'\033[38;2;31;108;159m' # #1F6C9F — info
60
+ KIT_RESET=$'\033[0m'
61
+ else
62
+ KIT_AZAFRAN=''; KIT_AZAFRAN_DEEP=''; KIT_INK=''; KIT_POLVO=''
63
+ KIT_VERDE=''; KIT_AMBAR=''; KIT_ROJO=''; KIT_AZUL=''; KIT_RESET=''
64
+ fi
65
+ }
66
+
67
+ # ---- color wrapper -------------------------------------------------------
68
+ # kit_paint <token> <text…> — token ∈ azafran|azafran-deep|ink|polvo|verde|ambar|rojo|azul
69
+ # (success|warn|danger|info aliases accepted).
70
+ kit_paint() {
71
+ kit_color_mode
72
+ local token="$1"; shift
73
+ local code=""
74
+ case "$token" in
75
+ azafran) code="$KIT_AZAFRAN" ;;
76
+ azafran-deep) code="$KIT_AZAFRAN_DEEP" ;;
77
+ ink) code="$KIT_INK" ;;
78
+ polvo) code="$KIT_POLVO" ;;
79
+ verde|success) code="$KIT_VERDE" ;;
80
+ ambar|warn) code="$KIT_AMBAR" ;;
81
+ rojo|danger) code="$KIT_ROJO" ;;
82
+ azul|info) code="$KIT_AZUL" ;;
83
+ esac
84
+ printf '%s%s%s' "$code" "$*" "${code:+$KIT_RESET}"
85
+ }
86
+
87
+ # ---- glyph vocabulary ----------------------------------------------------
88
+ # kit_glyph <name> — emits the brand glyph, or its 7-bit ASCII fallback off-TTY.
89
+ # Grammar: solid seeds (●) + lines and points (▸ › ·). No rings, no AI sparkle.
90
+ kit_glyph() {
91
+ kit_color_mode
92
+ case "$1" in
93
+ leader) [ "$KIT_UNICODE" = 1 ] && printf '⡶' || printf 'o' ;; # U+2876 — the seed-head
94
+ agent) [ "$KIT_UNICODE" = 1 ] && printf '●' || printf '*' ;; # U+25CF
95
+ workflow|run) [ "$KIT_UNICODE" = 1 ] && printf '▸' || printf '>' ;; # U+25B8
96
+ skill) [ "$KIT_UNICODE" = 1 ] && printf '›' || printf '>' ;; # U+203A
97
+ task|sep) [ "$KIT_UNICODE" = 1 ] && printf '·' || printf '-' ;; # U+00B7
98
+ success) [ "$KIT_UNICODE" = 1 ] && printf '●' || printf 'ok' ;; # U+25CF (verde)
99
+ warning) [ "$KIT_UNICODE" = 1 ] && printf '◆' || printf '!' ;; # U+25C6 (ámbar)
100
+ danger|error) [ "$KIT_UNICODE" = 1 ] && printf '▪' || printf 'x' ;; # U+25AA (rojo)
101
+ info) [ "$KIT_UNICODE" = 1 ] && printf '·' || printf 'i' ;; # U+00B7 (azul)
102
+ progress|pr) [ "$KIT_UNICODE" = 1 ] && printf '▸' || printf '~' ;; # U+25B8 (azafrán)
103
+ memory|save) [ "$KIT_UNICODE" = 1 ] && printf '●' || printf '+' ;; # U+25CF (azafrán)
104
+ version) printf '+' ;; # U+002B (azafrán)
105
+ *) printf '%s' "$1" ;;
106
+ esac
107
+ }
108
+
109
+ # ---- the seed (leader glyph, Azafrán) ------------------------------------
110
+ kit_seed() { kit_paint azafran "$(kit_glyph leader)"; }
111
+
112
+ # ---- the line-leader lockup ----------------------------------------------
113
+ # kit_sigil -> ⡶ / claude-kit
114
+ # kit_sigil "kit-task-pr" -> ⡶ / claude-kit · kit-task-pr
115
+ # kit_sigil "" "memoria guardada" -> ⡶ / claude-kit memoria guardada
116
+ # One Azafrán per line (the seed); slash + wordmark ink-dim; separator + note Polvo.
117
+ kit_sigil() {
118
+ kit_color_mode
119
+ local skill="$1" note="$2" line
120
+ line="$(kit_seed)$(kit_paint ink ' / claude-kit')"
121
+ [ -n "$skill" ] && line+="$(kit_paint polvo ' · ')$(kit_paint ink "$skill")"
122
+ [ -n "$note" ] && line+="$(kit_paint polvo " ${note}")"
123
+ printf '\n%s\n' "$line"
124
+ }
@@ -0,0 +1,104 @@
1
+ # Branch & Merge Conventions
2
+
3
+ Canonical naming + merge-order rules so you're never confused about *what a branch is*, *what order PRs merge in*, or *which agent is touching what*.
4
+
5
+ ## Branch name format
6
+
7
+ ```
8
+ <kind>/<issue-number>-<slug>
9
+ ```
10
+
11
+ - `<kind>` — one of the closed set below. No other prefixes.
12
+ - `<issue-number>` — the issue this branch closes. **Always required** for human work.
13
+ - `<slug>` — short kebab-case description (≤ 5 words).
14
+
15
+ ### Closed set of kinds
16
+
17
+ | Kind | For | Typical risk |
18
+ | ---------- | -------------------------------------------------- | ------------ |
19
+ | `feat` | New user-facing feature | med |
20
+ | `fix` | Bug fix | low–med |
21
+ | `task` | Concrete chunk of work (no feature/bug label fits) | low–med |
22
+ | `chore` | Tooling, deps, config, housekeeping | low–med |
23
+ | `security` | Vulnerability fix or hardening | **high** |
24
+ | `scaffold` | Repo/infra scaffolding | med |
25
+ | `ci` | CI/CD, workflows, automation | med |
26
+ | `adr` | Architecture Decision Record | low |
27
+ | `spike` | Time-boxed research (may be thrown away) | low |
28
+ | `plan` | Plan/report deliverable | low |
29
+
30
+ ### Bot branches (do not create by hand)
31
+
32
+ | Pattern | Who | Notes |
33
+ | ---------- | -------------------- | ------------------------------------------------------------ |
34
+ | `agent/*` | Auto-Dev CI agent | Label an issue `agent:auto` → it branches + opens a PR. Never merges. |
35
+ | `claude/*` | Claude GitHub Action | Created when an issue/PR mentions `@claude`. |
36
+
37
+ ## Merge order
38
+
39
+ The integration branch is decided by, in priority:
40
+
41
+ 1. **Declared dependencies first.** If PR B needs PR A, put `Depends on #A` in B's body. Land A before B.
42
+ 2. **`risk:low` before `risk:high`.** Land cheap, safe, reviewed PRs first to shrink the conflict surface.
43
+ 3. **Lockfile-touching PRs last, one at a time** (see below).
44
+ 4. **Smaller before larger.** Big diffs rebase cleaner onto a moving target than the reverse.
45
+
46
+ **Effort relations & session-fit.** At the **effort** level (above PRs), cross-effort dependencies
47
+ are declared as a native GitHub `blocked_by` edge + a `## Relations` line (the board-visible chain) —
48
+ the analogue of the PR-level `Depends on #N` above. A `[Flow]` title tag + `flow:<flow>` label group
49
+ an effort's thread, and a `ctx:*` label drives `kit effort plan`'s session batching. Full spec:
50
+ `rules/effort-model.md` § *Title rule, flow tags, relations, session-fit*.
51
+
52
+ ## The lockfile rule
53
+
54
+ Lockfiles (`pnpm-lock.yaml`, `package-lock.json`, …) and manifest config conflict on almost every parallel merge. So:
55
+
56
+ - **Merge at most one dependency-changing PR at a time**, then rebase the others.
57
+ - On a lockfile conflict: take the **base** branch's lockfile, then regenerate (`pnpm install` / `npm install`). Never hand-merge lockfile hunks.
58
+ - Keep a single block per config key (e.g. one `overrides:` in `pnpm-workspace.yaml`). A duplicate key is invalid YAML and breaks CI — a real, recurring incident.
59
+
60
+ ## Parallel work — one worktree per agent (hard rule)
61
+
62
+ **Two agents in the same git checkout corrupt each other.** The working tree, index, and `HEAD` are a single unguarded shared resource: one agent's `mv`/`add`/`stage` is silently clobbered by another's `reset`/`checkout`/`stash`/`rebase`. Git has no locking for this.
63
+
64
+ - **One agent = one git worktree** (or a separate clone). Never two agents in the same directory.
65
+ - Prefer giving local sub-agents their own worktree.
66
+ - Remote CI agents (Auto-Dev) are isolated per runner — favor them for parallel fixes.
67
+ - Before editing shared files, check whether another agent is active.
68
+ - One PR per issue. No monster PRs (a `size:XL` label is a smell — split it).
69
+
70
+ ## Optional: PR automation labels
71
+
72
+ If the project adopts the kit's PR-automation workflows, these labels are applied automatically:
73
+
74
+ | Label group | Applied by | Meaning |
75
+ | ----------- | ------------ | -------------------------------------------------------- |
76
+ | `size:*` | pr-labeler | XS/S/M/L/XL by changed lines |
77
+ | `risk:*` | pr-labeler | low/med/high by diff (sensitive paths, deps, size) |
78
+ | `blocked` | pr-deps | has an open `Depends on #N` |
79
+ | `hold` | human | opt-out — never auto-merge even if it qualifies |
80
+
81
+ **GitHub gotcha:** `pull_request_target` / `workflow_run` / label-event workflows are read from the **default branch only**. If your automation lives on a non-default integration branch, trigger on `pull_request` (read from the PR base) instead — otherwise it silently never fires.
82
+
83
+ ## Branch lifecycle & cleanup
84
+
85
+ One branch = one issue = one PR = **deleted on merge**. A branch is a short-lived container, not a place work lives.
86
+
87
+ - **No long-lived uncommitted work.** Don't let a working tree sit dirty across sessions. Commit + PR, or discard. A branch sitting many commits behind the base with uncommitted work can silently revert merged work on a bad rebase — exactly the class of problem this section exists to prevent.
88
+ - **Never work directly on the base branch (`main`/`develop`).** The `guard-base-branch-commit.sh` hook blocks commits there; start every change with `/kit-task-start <issue>` (it branches from a *fresh* base).
89
+ - **Delete on merge.** `/kit-task-pr-merge` removes the worktree and deletes the local + remote branch automatically. Never leave a merged branch or its worktree lingering.
90
+ - **One worktree per branch; remove it when its PR merges.** Parallel agents must use worktrees (never share a checkout).
91
+ - **Sweep on demand.** `/kit-task-gc` prunes merged branches + worktrees, surfaces orphan/unpushed commits and stale stashes, and flags issues whose PR merged but stayed open. Dry-run + confirm.
92
+ - The **SessionStart hygiene hook** (`.claude/hooks/repo-hygiene.sh`) surfaces all of the above at the start of every session so it never accumulates silently.
93
+
94
+ ## Leverage GitHub automations (the enforced layer)
95
+
96
+ Local hooks + skills are **fast feedback**; the **durable, everyone-applies enforcement** belongs on GitHub. Move guardrails there as they mature — they then enforce for humans, CI agents (Auto-Dev), and the Claude Action alike, regardless of anyone's local setup.
97
+
98
+ - **Do first (1 toggle):** repo Settings → **"Automatically delete head branches"** — eliminates remote-branch buildup entirely.
99
+ - **Branch protection** on the base branch: require PR, required CI checks, linear history, no direct pushes.
100
+ - **Stale-branch / stale-PR Action** (scheduled) to flag/close abandoned branches + PRs.
101
+ - **Scheduled sweep** that flags "PR merged but issue still open" and "branch merged but not deleted".
102
+ - Extend any adopted `pr-labeler` / `pr-deps` / `pr-automerge` workflows as the enforcement surface.
103
+
104
+ Principle: **prefer migrating enforcement to GitHub** as it matures; keep only the genuinely local concerns (worktrees, stale base, dirty tree) in hooks.
@@ -0,0 +1,22 @@
1
+ # Communication Style
2
+
3
+ ## Preferences
4
+
5
+ - **Format:** Bullet points and tables preferred over prose blocks
6
+ - **Length:** Short and direct — no long intros, no padding
7
+ - **Language:** {{COMMS_LANG}} — match the language {{OWNER_NAME}} uses
8
+ - **Tone:** Practical, no fluff
9
+
10
+ ## What to Avoid
11
+
12
+ - Long introductory sentences before getting to the point
13
+ - Restating what was just said
14
+ - Over-explaining obvious things
15
+ - Excessive caveats
16
+
17
+ ## What to Do
18
+
19
+ - Lead with the answer or action
20
+ - Use tables for comparisons and status
21
+ - Use bullets for lists and steps
22
+ - If something needs explanation, keep it tight
@@ -0,0 +1,40 @@
1
+ # Delegation brief — what every delegated agent gets up front
2
+
3
+ When spawning a sub-agent (Agent tool, orchestrate, CI agent), **prepend this**. It encodes the
4
+ environment knowns so agents don't burn turns rediscovering "how do I get X". Keep it current —
5
+ when an agent rediscovers something it should have been handed, add it here.
6
+
7
+ ## Project specifics (fill these in for {{PROJECT_NAME}})
8
+
9
+ - Repo `<owner>/<repo>` · base branch **`main`** · owner **`<owner>`** · project board number **`<N>`**.
10
+ - Build/dep tooling (e.g. pnpm + turbo monorepo, workspaces, package scope).
11
+ - **Secrets by NAME, never value** — the GitHub API token env var (some apps use a custom name like
12
+ `GH_PAT`, **not** `GITHUB_TOKEN` — state which), model/API env vars, auth keys. Say which file/code
13
+ path reads each.
14
+
15
+ ## Standing gotchas (transferable — these bite on most projects)
16
+
17
+ - **Refresh the base first.** An isolation worktree can seed from a **stale commit**. Start with
18
+ `git fetch origin <base> && git reset --hard origin/<base>` on a fresh branch; confirm
19
+ `git rev-parse --short HEAD` == `origin/<base>`.
20
+ - **Commit so the guard sees the right branch.** A base-branch commit guard inspects the command's
21
+ named directory — a `$VAR` path can resolve to the main checkout and false-block. Commit via
22
+ `git -C <literal-worktree-path>` or `cd <literal-path>` (never a variable).
23
+ - **zsh quirks:** `${VAR:+--flag "$VAR"}` word-splits — pass flags explicitly. `status` and `path`
24
+ are read-only vars — don't use them as loop variables.
25
+ - **Board finder paginates the full board.** `project_find_item_by_issue` (gh-project.sh) pages the
26
+ whole board — use it; don't hand-roll a `first:100` query that misses recent issues. Owner/project
27
+ number resolve from `.claude/kit.config.json` (`.github.owner`, `.github.projectNumber`).
28
+ - **Project IDs are worktree-durable.** `source scripts/lib/gh-project.sh; load_project_ids` reads
29
+ the captured IDs from the shared git-common-dir, so worktrees see them too.
30
+
31
+ ## Gate commands (fill in for {{PROJECT_NAME}})
32
+
33
+ - Build / typecheck / lint commands; shell scripts: `bash -n`; any knowledge/plan lint. A green
34
+ build/typecheck is the bar. State whether CI exists or the gate is local + deploy-provider build.
35
+
36
+ ## Effort flow (the unit of work)
37
+
38
+ - 1 effort = parent issue + native sub-issues + `effort/<N>` branch + **1 PR** (+ a `## For agents`
39
+ section listing touched files). See `effort-model.md`. Sub-agents **don't merge** — implement,
40
+ push, open the PR, and report the PR URL + a short summary + risks.
@@ -0,0 +1,35 @@
1
+ # Design Routing
2
+
3
+ ## Hard rule
4
+
5
+ **ALL design and adjustment questions must be routed to the Designer agent.**
6
+
7
+ Includes (not limited to):
8
+
9
+ - Visual decisions: color, typography, spacing, layout, hierarchy
10
+ - Component design: primitives, variants, states (hover/active/disabled/loading/error/empty)
11
+ - Motion, animation, easing, durations
12
+ - Iconography, illustration, imagery
13
+ - Brand: logo, palette, tone, identity
14
+ - Information architecture, flow, navigation
15
+ - Microcopy and UX writing decisions
16
+ - Accessibility decisions that affect UI (contrast, focus states, tap targets)
17
+ - Responsive behavior and breakpoints
18
+ - "Adjustments" — any tweak to an existing visual/UX surface, however small
19
+
20
+ ## How to route
21
+
22
+ 1. Do **not** answer from the orchestrator level
23
+ 2. Spawn the Designer agent (`.claude/agents/designer/AGENT.md`)
24
+ 3. Pass the question verbatim plus relevant context (screen name, token name, current state)
25
+ 4. Return the Designer's answer to {{OWNER_NAME}}
26
+
27
+ ## Why
28
+
29
+ The Designer is the canonical voice for craft. Centralizing design decisions there keeps the
30
+ system coherent and prevents ad-hoc visual calls that contradict the established direction.
31
+
32
+ ## Exception
33
+
34
+ Purely informational questions (e.g. "where is the design system saved?") can be answered directly.
35
+ The rule applies to _decisions_ and _adjustments_, not file lookups.
@@ -0,0 +1,122 @@
1
+ # Effort model — the unit of work (and of the work record)
2
+
3
+ **GitHub is the single source of truth.** An *effort* is the kit's larger unit of work: bigger than
4
+ a single task, with its own decomposition. The same structure that organizes the work also produces
5
+ a clean, per-unit **record** of it (goal → plan → patch → verify) — useful for review, audit, and as
6
+ a dataset if you train on your own development history.
7
+
8
+ > Two flows coexist in the kit. Use **tasks** (`task-*`) for a single self-contained change; use
9
+ > **efforts** (`effort-*`) when one goal decomposes into several sub-tasks that build toward one PR.
10
+
11
+ ## The unit
12
+
13
+ **1 effort = 1 parent issue · 1 branch · 1 worktree · 1 PR.** No forced tiny PRs — a big effort-PR
14
+ is fine while building. 1 effort decomposes into **N native GitHub sub-issues** (parallel or
15
+ sequential, decided at scoping).
16
+
17
+ ```
18
+ parent issue #N ──► effort/<N> branch + worktree (from main)
19
+ ├─ sub #a ─► sub/<N>a worktree (from effort/<N>) ─┐
20
+ ├─ sub #b ─► sub/<N>b worktree ├─ merge into effort/<N>
21
+ └─ sub #c ─► sub/<N>c worktree ┘
22
+ effort/<N> ──► ONE PR ──► main ──► effort-close
23
+ ```
24
+
25
+ Solo/sequential efforts may commit sub-issues directly on `effort/<N>` (one commit per sub-issue —
26
+ the commit diff is that sub-issue's patch). Parallel sub-issues use their own worktrees
27
+ (file-disjoint) and merge in.
28
+
29
+ ## Parent-issue template
30
+
31
+ Every parent issue body uses these four sections (they double as the columns of the work record):
32
+
33
+ ```markdown
34
+ ## Goal → problem statement
35
+ What outcome, in one or two lines.
36
+
37
+ ## Scope → plan (the sub-issue DAG; mark each parallel | sequential / dependsOn)
38
+ The decomposition. Sub-issues are linked natively (GitHub parent/child).
39
+
40
+ ## For agents → retrieval context
41
+ Exact file paths / entry points a future agent needs to find the code fast.
42
+
43
+ ## Verification → label / acceptance
44
+ How we know it's done (commands, checks, acceptance).
45
+ ```
46
+
47
+ **Effort + sub-issue titles must be recognizable on the board:**
48
+
49
+ - **Umbrella / parent issue:** **`[Effort] <number> · <Name>`** — the literal `[Effort]` tag, the
50
+ issue's own number, then the human name. e.g. `[Effort] 42 · Auth hardening`.
51
+ - **Sub-issue:** **`[Effort <parent>] <N> · <Title>`** — the parent's number in the tag, then a
52
+ **numeric** sequence index `N` (1, 2, 3 — **never letters** like A/B/C), then the title.
53
+ e.g. `[Effort 42] 1 · Add rate limiting to /login`.
54
+
55
+ The parent ref is mandatory; `N` is a plain number so subs sort and read predictably. `effort-new`
56
+ applies both formats when it creates the parent + native sub-issues, so a sub is identifiable by
57
+ name alone in any flat list.
58
+
59
+ ### Title rule, flow tags, relations, session-fit
60
+
61
+ The board should be **legible at a glance** — a title says *what* an effort delivers and *which
62
+ flow* it belongs to; the *chain* (who blocks whom) and the *session weight* are machine-readable.
63
+
64
+ **Concise, jargon-free titles (lint-enforced).** The `<Name>` part of an effort/sub title is a short
65
+ plain-language **outcome** with an optional leading `[Flow]` tag:
66
+
67
+ - **Format:** `[Effort] N · [Flow] short name` (parent) · `[Effort N] M · short name` (sub).
68
+ - **Banned in the name:** glyphs (`— ▾ ▸ → ✓ ✗ … •`), parentheses, ` — ` / ` · ` / ` / ` sub-clauses,
69
+ code identifiers (file names, paths, `snake_case`), internal jargon (`chrome`, `seam`, `contract`,
70
+ `rescue stash`, `refactor`, `wiring`, …), and **> 6 words**. Detail goes in the body.
71
+ - **`effort_title_lint`** (`scripts/lib/effort.sh`) is the check; `effort-new` refuses a failing
72
+ title. Bad→good: `operator chrome — Settings ▾ dropdown + fixes` → **`[UI] operator navigation`**.
73
+
74
+ **Flow tag (`[Flow]` + `flow:<flow>` label).** A **flow** is a named thread of efforts toward one
75
+ outcome. Controlled vocabulary (`EFFORT_FLOWS` in `effort.sh`; a project overrides it). The title
76
+ carries `[Flow]` so membership reads off the board; the `flow:<flow>` label makes it filterable.
77
+
78
+ **Relations (the chain) — native edge + `## Relations` mirror.** Cross-effort dependencies are
79
+ **both** a native GitHub dependency (`blocked_by` — the edge GitHub renders on the issue/board, set
80
+ by `effort_set_blocked_by`) **and** a `## Relations` section in the parent body (the human-readable
81
+ mirror): `Depends on #N` / `Blocks #N` / `Extends #N` / `Parallel-safe with #N`. This is the
82
+ effort-level analogue of the PR-level `Depends on` in `branch-naming.md`.
83
+
84
+ **Session-fit (`ctx:*` + `kit effort plan`).** Every effort carries a **`ctx:S|M|L|XL`** label —
85
+ how much of one working session it consumes before the context window fills. Derived by
86
+ `effort_ctx_bucket` (`scripts/lib/effort-metrics.sh`) from difficulty + sub count: S=1 · M=2 · L=4 ·
87
+ XL=8 weight. **`kit effort plan`** (`scripts/lib/effort-plan.sh`) reads the open efforts, groups by
88
+ flow, orders each flow by the `blocked_by` edges, and packs them into **session-sized batches** under
89
+ a budget (`KIT_SESSION_BUDGET`, default 4). L/XL efforts are flagged **"→ delegate subs"**:
90
+ delegating an effort's sub-issues to **sub-agents in their own worktrees** keeps the main session
91
+ light (a sub-agent reads/writes in its own context; only a summary returns) — the lever that lets
92
+ more efforts fit one session (`rules/agent-execution-routing.md`).
93
+
94
+ Sub-issue bodies: a one-line description is enough (title is for humans, short desc not required).
95
+ The parent carries the rich narrative; the **PR** carries the human-facing review write-up + a
96
+ `## For agents` section.
97
+
98
+ ## Lifecycle (the commands — see the effort-* skills)
99
+
100
+ | Step | What |
101
+ |------|------|
102
+ | `effort-new` | parent issue (template) + native sub-issues |
103
+ | `effort-start <N>` | `effort/<N>` branch + worktree; board → In Progress |
104
+ | orchestrate | sub-issues in own worktrees (file-disjoint) → merge into `effort/<N>`; each closes + board Done as it lands |
105
+ | `effort-pr <N>` | ONE PR `effort/<N>` → main (rich body + `## For agents`) |
106
+ | `effort-close <N>` | **snapshot sub-diffs pre-squash** → merge → close parent + subs → board Done(all) → GC prune → kit-sync drift check |
107
+
108
+ Board + record state are correct **by construction** — the close op owns them. Never rely on a
109
+ separate, skippable "mark done" step.
110
+
111
+ ## Plans are issues, not files
112
+
113
+ The parent issue **is** the plan. Strategy / roadmap narrative lives in your knowledge base; the
114
+ "where we stand" view is generated from GitHub issue data, never hand-authored. → `plan-output-format.md`.
115
+
116
+ ## Trace hard rules
117
+
118
+ - Snapshot each sub-branch diff **before squash** (squash destroys per-sub-issue pairs) — `effort-close`
119
+ step (a) does this automatically, to a durable dir under the shared git-common-dir.
120
+ - Scrub secrets from diffs/bodies before they enter an issue or any exported record.
121
+ - Keep client/tenant data out of the dev-workflow record (it is not your development history).
122
+ - Outcome labels: merged-clean = positive · abandoned/reverted = negative · a manual flag for exemplars.
@@ -0,0 +1,41 @@
1
+ # Knowledge base — governance
2
+
3
+ The project's knowledge base lives in `knowledge/` (config: `knowledge.dir` in
4
+ `.claude/kit.config.json`). It is the durable, agent-readable source of truth for product and
5
+ project knowledge: brand, design system, decisions, research, reference docs.
6
+
7
+ ## Hard rules
8
+
9
+ 1. **If a file exists in `knowledge/`, it is current.** Superseded docs are **deleted** — git
10
+ history is the archive. Never keep a dead doc around "for reference"; never create an
11
+ `archive/` folder.
12
+ 2. **The latest decision wins.** When two docs conflict, the decision log + the `updated`
13
+ frontmatter date resolve it. Fix the loser in the same PR you notice it.
14
+ 3. **Every doc carries frontmatter** — required, lint-enforced:
15
+
16
+ ```yaml
17
+ ---
18
+ status: canonical | reference | historical
19
+ owner: <role> # which agent/role maintains it
20
+ updated: YYYY-MM-DD # last substantive change
21
+ ---
22
+ ```
23
+
24
+ `canonical` = source of truth for its topic · `reference` = consultable, not normative ·
25
+ `historical` = context only, decisions inside may be superseded.
26
+ 4. **`knowledge/INDEX.md` is the manifest** — one row per doc (file, topic, status, owner,
27
+ updated). Agents read INDEX first to find the canonical doc per topic. A new doc lands in
28
+ INDEX **in the same PR**, or the lint fails.
29
+ 5. **Research becomes knowledge or it evaporates.** A research session's durable output is a
30
+ `reference` doc in `knowledge/` + an INDEX row — not a chat transcript.
31
+ 6. **Plans are not knowledge.** Plans (deliverable contracts) live in the plans dir and complete
32
+ via `status:` flip — see `plan-output-format.md`. Knowledge docs describe what IS; plans
33
+ describe what's BEING BUILT.
34
+
35
+ ## Enforcement
36
+
37
+ - `scripts/knowledge-lint.sh` validates all of the above (frontmatter, INDEX completeness, live
38
+ refs, plan Deliverables contract). Run it locally before a knowledge PR; wire it into CI on
39
+ PRs touching `knowledge/**` or the plans dir.
40
+ - Project-specific extra checks go in `scripts/knowledge-lint.local.sh` (sourced by the kit
41
+ script; survives `/kit-update` refreshes).
@@ -0,0 +1,110 @@
1
+ # MemPalace — Persistent Memory Protocol
2
+
3
+ > Optional. Active only because this project enabled memory at `/kit-init`.
4
+ > Requires the MemPalace MCP server + `mempalace` CLI. If you don't use MemPalace,
5
+ > delete this file and the `SessionStart`/`Stop`/`PreCompact`/`SessionEnd` hooks in `.claude/settings.local.json`.
6
+
7
+ ## Wing architecture
8
+
9
+ One wing per project. This project uses **`{{WING}}`**. Never write to another project's wing.
10
+
11
+ ## Room map ({{WING}} wing)
12
+
13
+ | Room | What goes there |
14
+ | -------------- | ------------------------------------------- |
15
+ | `decisions` | ADRs, product decisions, decision log |
16
+ | `architecture` | Design system, brand, screens, design brief |
17
+ | `planning` | Implementation plans, ops plans |
18
+ | `technical` | API routes, schema, engineering sessions |
19
+ | `problems` | Bug investigations, incident notes |
20
+ | `general` | Everything else |
21
+
22
+ ## On session start
23
+
24
+ 1. Call `mempalace_status` — loads the overview
25
+ 2. Working on a topic: `mempalace_search "<topic>" wing={{WING}}` for past context
26
+
27
+ ## Before answering about past decisions / prior sessions / existing work
28
+
29
+ - Call `mempalace_search` first — do not rely solely on the context window
30
+
31
+ ## After meaningful work (decisions, discoveries, conclusions)
32
+
33
+ - `mempalace_add_drawer` — verbatim content, `wing={{WING}}`, pick a room above
34
+ - `mempalace_kg_add` — entity triples (subject / predicate / object)
35
+
36
+ ## On session close
37
+
38
+ When the user says to close or end the session ("close session", "cierra la sesión", "we're done"),
39
+ write the session to memory **before** the closing summary — every time:
40
+
41
+ 1. `mempalace_diary_write` (own wing `agent-<name>`, topic = the session) — an AAAK summary: what was
42
+ done, the decisions, and what's still open.
43
+ 2. `mempalace_add_drawer` (`wing={{WING}}`, room `decisions`) — verbatim record of the key decisions.
44
+ 3. `mempalace_kg_add` — triples for any notable new entities/facts.
45
+ 4. **If there is unsynced local work** (dirty tree, unpushed commits, stashes), write a terse
46
+ "resume here" follow-up: `mempalace_add_drawer` (`wing={{WING}}`, room `planning`) with the branch,
47
+ what's uncommitted/unpushed, the next step, and any open PR/issue refs — so the next session resumes
48
+ cheaply instead of re-deriving context. Prefer committing/pushing the work; the drawer is for what
49
+ genuinely can't land yet.
50
+
51
+ (The `Stop` hook files the raw transcript; the `SessionEnd` hook is the safety net that captures
52
+ unsynced work if you forgot step 4 — this is the curated, decision-level summary.)
53
+
54
+ ## Specialist agent protocol
55
+
56
+ Each agent has its own diary wing (`agent-<name>`) for session notes; all project content saves to `wing={{WING}}`.
57
+
58
+ ### On wake-up (every specialist agent)
59
+
60
+ 1. `mempalace_diary_read` (own wing) — recall last session
61
+ 2. `mempalace_search "<topic>"` in its room — pull relevant context
62
+
63
+ ### After significant work
64
+
65
+ - `mempalace_diary_write` (own wing, topic = what was done)
66
+ - `mempalace_add_drawer` (`wing={{WING}}`, relevant room)
67
+
68
+ ## CLI commands (`mempalace` 3.3.5)
69
+
70
+ The MCP tools above are for in-session reads/writes. Use the **CLI** for bulk ingest, maintenance, and automation. Always preview destructive ops with `--dry-run` before `--apply`.
71
+
72
+ | Task | Command |
73
+ | ---------------------------------------------------------- | ---------------------------------------------------------------- |
74
+ | Ingest this project's code/docs | `mempalace mine <dir> --wing {{WING}}` |
75
+ | Ingest chat exports (Claude Code / ChatGPT / Slack) | `mempalace mine <dir> --mode convos --wing {{WING}}` |
76
+ | Split concatenated transcript mega-files (before `mine`) | `mempalace split <dir>` |
77
+ | Search from the shell | `mempalace search "query" --wing {{WING}} --room <room> --results N` |
78
+ | Load wake-up context (~600–900 tokens) | `mempalace wake-up --wing {{WING}}` |
79
+ | Palace overview | `mempalace status` |
80
+ | Prune drawers for deleted/moved/gitignored sources | `mempalace sync --wing {{WING}} --dry-run` → `--apply` |
81
+ | Compress drawers via AAAK (~30×) | `mempalace compress --wing {{WING}} --dry-run` |
82
+ | Show MCP setup command | `mempalace mcp` |
83
+
84
+ Correct-option notes:
85
+
86
+ - `mine` defaults to `--mode projects`; pass `--mode convos` for chat exports. `--extract exchange` (default) or `--extract general` controls convo extraction. `--wing` defaults to the directory name — **always pass `--wing {{WING}}`** so this project's memory stays in one wing.
87
+ - `search` (CLI) uses `--wing` / `--room` / `--results`; the MCP `mempalace_search` tool uses `wing` / `room` / `limit` instead.
88
+ - `sync` is dry-run by default; `--apply` requires `--wing` (or a project root) as a guard against mass deletion.
89
+
90
+ ## MCP vs CLI — which to use
91
+
92
+ | Case | Use |
93
+ | --------------------------------------------- | ---------------------------------------------------------- |
94
+ | In-session granular **read** | MCP `mempalace_search` / `kg_query` / `traverse` |
95
+ | In-session granular **write** | MCP `mempalace_add_drawer` / `kg_add` / `diary_write` |
96
+ | Bulk ingest a directory or chat export | CLI `mempalace mine` |
97
+ | Maintenance (prune, compress) | CLI `mempalace sync` / `compress` |
98
+ | Automation (session start / stop / compaction)| Hooks → CLI (below) |
99
+
100
+ ## Hooks (scaffolded into `.claude/settings.local.json`)
101
+
102
+ - **SessionStart** → `mempalace wake-up --wing {{WING}}` — injects palace context at session start. Uses `wake-up --wing` (explicit) rather than `mempalace hook run --hook session-start`, which derives the wing implicitly and could file into the wrong wing.
103
+ - **Stop** → files the finished session into `wing={{WING}}` (`mempalace mine … --mode convos`).
104
+ - **PreCompact** → safety-net sweep before context compression.
105
+ - **SessionEnd** → `mempal_followup.sh`: if the current branch has **unsynced work** (dirty tree or
106
+ unpushed commits), writes a terse "resume here" note and mines it into `wing={{WING}}` so an abrupt
107
+ close doesn't lose it. Silent no-op when the tree is fully synced. This is the safety net for the
108
+ agent-driven step 4 above.
109
+
110
+ All four are safe no-ops when the `mempalace` CLI is not installed.