@hegemonart/get-design-done 1.50.0 → 1.51.0

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.
@@ -0,0 +1,120 @@
1
+ ---
2
+ name: instinct-format
3
+ type: meta-rules
4
+ version: 1.0.0
5
+ phase: 51
6
+ tags: [instinct, learning, confidence, beta-prior, promotion-gate, ttl-decay]
7
+ last_updated: 2026-06-03
8
+ ---
9
+
10
+ # Instinct Unit Format
11
+
12
+ An instinct is an atomic, confidence-weighted lesson the pipeline learns across design
13
+ cycles. Where an ADR records a deliberate, hard-to-reverse decision (see `./adr-format.md`)
14
+ and `CONTEXT.md` records agreed vocabulary (see `./context-md-format.md`), an instinct
15
+ records a softer signal: a recurring "when X, prefer Y" reflex that earns trust by being
16
+ seen again and again. Each unit is one trigger sentence plus a short body, stored as a YAML
17
+ document and validated by `./schemas/instinct.schema.json`. The store
18
+ (`scripts/lib/instinct-store.cjs`) persists, queries, promotes, and decays them.
19
+
20
+ Instincts are always advisory, never directive. A fresh instinct carries low confidence and
21
+ is offered as a suggestion; only repeated cross-project observation raises that confidence,
22
+ and even then it is capped well below certainty.
23
+
24
+ ## Unit shape
25
+
26
+ A unit is a YAML frontmatter block followed by a 1 to 3 paragraph body. The body explains
27
+ the reflex in plain language: what situation fires it, what to reach for, and why.
28
+
29
+ ```yaml
30
+ ---
31
+ id: prefer-token-over-hex # kebab-case stable identifier
32
+ trigger: When a raw color literal appears in a component, reach for a design token first.
33
+ confidence: 0.5 # float in [0.3, 0.9]
34
+ domain: build # intake|explore|decide|build|verify|operate|utility
35
+ scope: project # project|global
36
+ project_id: abcd1234 # sha8 of the normalized git origin (project scope)
37
+ source: reflection # reflection|extract-learnings|user
38
+ cycles_seen: 1 # distinct cycles that surfaced this instinct
39
+ project_ids: [abcd1234] # distinct origins that surfaced it (promotion gate)
40
+ first_seen: 2026-06-01 # ISO date the unit was recorded
41
+ last_seen: 2026-06-01 # ISO date it was last surfaced (resets decay)
42
+ ---
43
+ Hardcoded hex values drift away from the system palette over time. Routing the value
44
+ through a token keeps one source of truth and lets a theme change land everywhere at once.
45
+ ```
46
+
47
+ ### Field reference
48
+
49
+ - **id** (required). Kebab-case, lowercase letters and digits with single hyphens, 3 to 80
50
+ characters. The id is stable: touching or promoting a unit never changes it.
51
+ - **trigger** (required). One sentence naming the situation that fires the instinct. Keep it
52
+ concrete enough that a reader knows when it applies.
53
+ - **confidence** (required). A float between 0.3 and 0.9. The floor of 0.3 says a brand-new
54
+ instinct is a hint, not a rule. The ceiling of 0.9 says no instinct is ever certain.
55
+ - **domain** (required). One of `intake`, `explore`, `decide`, `build`, `verify`, `operate`,
56
+ `utility`. These map to the Phase 50 lifecycle stages so an instinct surfaces at the right
57
+ moment in a cycle.
58
+ - **scope** (required). `project` for a lesson learned in one repository, `global` for one
59
+ promoted after it clears the cross-project gate below.
60
+ - **project_id** (required for project scope). The 8-character hex sha of the normalized git
61
+ origin, produced by `deriveProjectId`. A global unit may omit it, since a promoted instinct
62
+ is no longer tied to a single origin.
63
+ - **source** (required). Which producer minted the unit: a `reflection` pass, the
64
+ `extract-learnings` step, or a direct `user` assertion.
65
+ - **cycles_seen** (optional, defaults to 1). How many distinct cycles have surfaced the unit.
66
+ - **project_ids** (optional). The set of distinct origins that surfaced it. Its size feeds the
67
+ promotion gate.
68
+ - **first_seen** / **last_seen** (optional, stamped on write). ISO dates for recording and last
69
+ surfacing. `last_seen` resets the decay window.
70
+
71
+ ## The Beta(2,8) prior
72
+
73
+ When an instinct is promoted to the global store it is seeded with a Beta(2,8) posterior, the
74
+ same conservative prior the Phase 38 `design_arms` store uses. Its posterior mean is 0.2, so a
75
+ promoted pattern still has to earn standing from real outcomes rather than starting trusted.
76
+ The store exposes this as `INSTINCT_PRIOR = {alpha: 2, beta: 8}`. Successful outcomes add to
77
+ `alpha`, disappointing ones add to `beta`, and the mean moves accordingly.
78
+
79
+ ## Promotion gate (K=2 cycles across M=2 projects)
80
+
81
+ A project instinct may move to the global store only when both halves of the gate hold:
82
+
83
+ 1. **K = 2 cycles.** `cycles_seen` is at least 2, so the lesson repeated rather than firing once.
84
+ 2. **M = 2 projects.** The unit appears in at least 2 distinct `project_ids`, so the lesson
85
+ generalized beyond the repository that first taught it.
86
+
87
+ `promote(id)` throws a clear error when either half is unmet, so a one-off observation in a
88
+ single project can never leak into global advice. On a passing gate the unit is re-scoped to
89
+ `global`, the single-origin `project_id` is dropped, the Beta(2,8) prior is applied, and the
90
+ unit is removed from the project store. `touch(id)` is how a unit accumulates toward the gate:
91
+ each call bumps `last_seen` and `cycles_seen` and adds the current origin to `project_ids`.
92
+
93
+ ## TTL decay
94
+
95
+ Instincts that stop showing up should fade rather than linger as stale advice. `decay()` walks
96
+ a scope and, for any unit not surfaced within the decay window of 6 cycles, multiplies its
97
+ confidence by 0.9. Once a unit's confidence falls below 0.2 it is archived: the store writes it
98
+ to `<root>/instincts/archive/<id>.json` with an `archived_at` stamp and removes it from the live
99
+ set. Archiving is reversible by hand, so the audit trail survives. Calling `touch(id)` resets the
100
+ window, so an instinct that keeps proving useful never decays.
101
+
102
+ ## Storage and recall
103
+
104
+ Project units live at `<root>/instincts/instincts.json`, resolved through the worktree-aware
105
+ root so writes land in the main checkout rather than a throwaway worktree. Global units live at
106
+ `~/.claude/gdd/global-instincts.json`. Both files are written atomically (a temp file plus a
107
+ rename), and JSON is always the source of truth.
108
+
109
+ `query(keyword)` ranks units by how well the keyword matches their trigger, body, and domain,
110
+ returning the best few. When `better-sqlite3` is present with its FTS5 extension the query runs
111
+ over a small full-text index for speed; otherwise an in-memory scan answers the same query with
112
+ the same shape. `better-sqlite3` stays a runtime probe and is never a hard dependency, so recall
113
+ degrades gracefully wherever the native module is absent. `backendName()` reports which path is
114
+ active.
115
+
116
+ ## Cross-references
117
+
118
+ - Hard-to-reverse decisions belong in an ADR, not an instinct. See `./adr-format.md`.
119
+ - Agreed domain vocabulary belongs in `CONTEXT.md`. See `./context-md-format.md`.
120
+ - The frontmatter schema is `./schemas/instinct.schema.json`, validated under Ajv.
@@ -94,7 +94,7 @@
94
94
  "name": "audit-scoring",
95
95
  "path": "reference/audit-scoring.md",
96
96
  "type": "output-contract",
97
- "description": "6-pillar + 7-category audit score rubric and output schema"
97
+ "description": "7-pillar + 7-category audit score rubric and output schema"
98
98
  },
99
99
  {
100
100
  "name": "authority-feeds",
@@ -1149,6 +1149,13 @@
1149
1149
  "type": "meta-rules",
1150
1150
  "phase": 50,
1151
1151
  "description": "Phase 50 auto-generated skill composition graph (mermaid): skills grouped by lifecycle stage with composes_with and next_skills edges; regenerated by scripts/generate-skill-graph.cjs and drift-gated in CI."
1152
+ },
1153
+ {
1154
+ "name": "instinct-format",
1155
+ "path": "reference/instinct-format.md",
1156
+ "type": "meta-rules",
1157
+ "phase": 51,
1158
+ "description": "Phase 51 instinct unit format: YAML frontmatter (id, trigger, confidence 0.3-0.9, domain, scope, project_id, source, cycles_seen, first/last_seen) + body; promotion gate K=2/M=2; Beta(2,8) prior; TTL decay. Stored via scripts/lib/instinct-store.cjs."
1152
1159
  }
1153
1160
  ]
1154
1161
  }
@@ -10,7 +10,7 @@
10
10
  "type": {
11
11
  "type": "string",
12
12
  "minLength": 1,
13
- "description": "Free-form event type identifier. Pre-registered seeds: state.mutation, state.transition, stage.entered, stage.exited, hook.fired, error, capability_gap, kfm-candidate, router_pick, verify_outcome, rollout_started, rollout_advanced, rollout_stuck, budget_forecast, project_cap_warning, project_cap_halt, live_session_start, live_pick, live_generate, live_accept, live_discard, live_session_end."
13
+ "description": "Free-form event type identifier. Pre-registered seeds: state.mutation, state.transition, stage.entered, stage.exited, hook.fired, error, capability_gap, kfm-candidate, router_pick, verify_outcome, rollout_started, rollout_advanced, rollout_stuck, budget_forecast, project_cap_warning, project_cap_halt, live_session_start, live_pick, live_generate, live_accept, live_discard, live_session_end, instinct_emitted, instinct_promoted, instinct_decayed."
14
14
  },
15
15
  "timestamp": {
16
16
  "type": "string",
@@ -0,0 +1,91 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://github.com/hegemonart/get-design-done/reference/schemas/instinct.schema.json",
4
+ "title": "Instinct Unit",
5
+ "description": "An atomic, confidence-weighted design instinct learned across cycles. Validates the YAML frontmatter object of an instinct unit (see reference/instinct-format.md). Project-scoped units live at <root>/instincts/instincts.json; promoted global units live at ~/.claude/gdd/global-instincts.json. Persisted + queried by scripts/lib/instinct-store.cjs.",
6
+ "type": "object",
7
+ "required": ["id", "trigger", "confidence", "domain", "scope", "source"],
8
+ "properties": {
9
+ "id": {
10
+ "type": "string",
11
+ "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
12
+ "minLength": 3,
13
+ "maxLength": 80,
14
+ "description": "Kebab-case stable identifier, e.g. \"prefer-token-over-hex\". Lowercase letters, digits, single hyphens."
15
+ },
16
+ "trigger": {
17
+ "type": "string",
18
+ "minLength": 8,
19
+ "maxLength": 280,
20
+ "description": "One sentence naming the situation that fires the instinct, e.g. \"When a color literal appears in a component, reach for a design token first.\""
21
+ },
22
+ "confidence": {
23
+ "type": "number",
24
+ "minimum": 0.3,
25
+ "maximum": 0.9,
26
+ "description": "Posterior trust in the instinct. Floor 0.3 (a fresh instinct is advisory, never directive); ceiling 0.9 (no instinct is ever certain). TTL decay multiplies this by 0.9 when the instinct goes unsurfaced."
27
+ },
28
+ "domain": {
29
+ "type": "string",
30
+ "enum": ["intake", "explore", "decide", "build", "verify", "operate", "utility"],
31
+ "description": "Lifecycle stage the instinct applies to, aligned to the Phase 50 lifecycle stages."
32
+ },
33
+ "scope": {
34
+ "type": "string",
35
+ "enum": ["project", "global"],
36
+ "description": "project = learned from one repository; global = promoted after the K/M gate across distinct projects."
37
+ },
38
+ "project_id": {
39
+ "type": "string",
40
+ "pattern": "^[0-9a-f]{8}$",
41
+ "description": "8-char hex sha of the normalized git origin the instinct was first learned from. Required for project scope; optional for global (a promoted instinct is no longer tied to one origin)."
42
+ },
43
+ "source": {
44
+ "type": "string",
45
+ "enum": ["reflection", "extract-learnings", "user"],
46
+ "description": "Which producer minted the instinct: a reflection pass, the extract-learnings step, or a direct user assertion."
47
+ },
48
+ "cycles_seen": {
49
+ "type": "integer",
50
+ "minimum": 0,
51
+ "description": "How many distinct design cycles have surfaced this instinct. Feeds the K=2 half of the promotion gate."
52
+ },
53
+ "project_ids": {
54
+ "type": "array",
55
+ "items": { "type": "string", "pattern": "^[0-9a-f]{8}$" },
56
+ "uniqueItems": true,
57
+ "description": "Set of distinct project ids that have surfaced this instinct. Its length feeds the M=2 half of the promotion gate."
58
+ },
59
+ "first_seen": {
60
+ "type": "string",
61
+ "format": "date",
62
+ "description": "ISO date (YYYY-MM-DD) the instinct was first recorded."
63
+ },
64
+ "last_seen": {
65
+ "type": "string",
66
+ "format": "date",
67
+ "description": "ISO date (YYYY-MM-DD) the instinct was last surfaced. Resets the TTL decay window."
68
+ },
69
+ "alpha": {
70
+ "type": "number",
71
+ "minimum": 0,
72
+ "description": "Beta posterior success weight. Seeded from the Beta(2,8) prior on promotion."
73
+ },
74
+ "beta": {
75
+ "type": "number",
76
+ "minimum": 0,
77
+ "description": "Beta posterior failure weight. Seeded from the Beta(2,8) prior on promotion."
78
+ },
79
+ "prior_class": {
80
+ "type": "string",
81
+ "description": "Tag recording which prior class seeded the posterior, e.g. \"instinct\"."
82
+ }
83
+ },
84
+ "additionalProperties": false,
85
+ "allOf": [
86
+ {
87
+ "if": { "properties": { "scope": { "const": "project" } } },
88
+ "then": { "required": ["project_id"] }
89
+ }
90
+ ]
91
+ }
@@ -161,7 +161,7 @@ lifecycle stage; CI drift-gates that file with `--check`.
161
161
  ```yaml
162
162
  ---
163
163
  name: audit
164
- description: "Runs a design audit and prints a 6-pillar score. Use when the user wants to score the current design. Activates for requests involving audit, score, design review."
164
+ description: "Runs a design audit and prints a 7-pillar score. Use when the user wants to score the current design. Activates for requests involving audit, score, design review."
165
165
  tools: Read, Write, Task, Glob, Bash
166
166
  composes_with: [scan]
167
167
  next_skills: [reflect]
@@ -9,7 +9,7 @@ is a `composes_with` edge (the source calls the target as sub-orchestration); a
9
9
  a `next_skills` edge (a pipeline hint for what runs next). Stage grouping is best-effort and
10
10
  inferred from the skill name; skills with no stage keyword fall under Utility.
11
11
 
12
- Skills: 88. Composition edges: 0 composes_with, 0 next_skills.
12
+ Skills: 89. Composition edges: 0 composes_with, 6 next_skills.
13
13
 
14
14
  ```mermaid
15
15
  flowchart TD
@@ -80,6 +80,7 @@ flowchart TD
80
80
  n_graphify["graphify"]
81
81
  n_health["health"]
82
82
  n_help["help"]
83
+ n_instinct["instinct"]
83
84
  n_list_pins["list-pins"]
84
85
  n_locale["locale"]
85
86
  n_new_skill["new-skill"]
@@ -115,4 +116,11 @@ flowchart TD
115
116
  n_warm_cache["warm-cache"]
116
117
  n_zoom_out["zoom-out"]
117
118
  end
119
+
120
+ n_brief -.-> n_explore
121
+ n_design -.-> n_verify
122
+ n_explore -.-> n_plan
123
+ n_new_project -.-> n_brief
124
+ n_plan -.-> n_design
125
+ n_verify -.-> n_ship
118
126
  ```