hstack 0.3.0 → 0.5.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +56 -14
  3. package/VERSION +1 -1
  4. package/dist/lib/wire.js +18 -0
  5. package/dist/lib/wire.js.map +1 -1
  6. package/package.json +1 -1
  7. package/template/.claude/agents/app-architect.md +154 -0
  8. package/template/.claude/agents/data-architect.md +147 -0
  9. package/template/.claude/agents/kernel-fit-analyst.md +53 -0
  10. package/template/.claude/agents/product-discovery.md +165 -0
  11. package/template/.claude/agents/stack-architect.md +137 -0
  12. package/template/.claude/skills/hstack-app-architecture/SKILL.md +109 -0
  13. package/template/.claude/skills/{hstack-init → hstack-brownfield-init}/SKILL.md +17 -11
  14. package/template/.claude/skills/hstack-data-architecture/SKILL.md +100 -0
  15. package/template/.claude/skills/hstack-flag/SKILL.md +138 -0
  16. package/template/.claude/skills/hstack-greenfield-init/SKILL.md +150 -0
  17. package/template/.claude/skills/hstack-kernel-fit-scan/SKILL.md +31 -14
  18. package/template/.claude/skills/hstack-product-discovery/SKILL.md +101 -0
  19. package/template/.claude/skills/hstack-scaffold/SKILL.md +140 -0
  20. package/template/.claude/skills/hstack-stack-decide/SKILL.md +108 -0
  21. package/template/CLAUDE.md +23 -7
  22. package/template/templates/app-architecture.md +102 -0
  23. package/template/templates/bootstrap.md +105 -0
  24. package/template/templates/data-architecture.md +147 -13
  25. package/template/templates/discovery/brainstorm.md +69 -0
  26. package/template/templates/discovery/forcing-questions.md +76 -0
  27. package/template/templates/discovery/project-brief.md +53 -0
  28. package/template/templates/kernel-fit-finding.md +1 -0
  29. package/template/templates/kernel-fit-flag.md +52 -0
  30. package/template/templates/product-brief.md +56 -0
@@ -1,35 +1,169 @@
1
1
  ---
2
2
  id: data-architecture
3
3
  type: data-architecture
4
- status: drafted # drafted | current | needs-refresh | archived
4
+ status: draft # draft | current | needs-refresh | archived
5
5
  owner: <git-handle>
6
+ assumes-database: postgres # explicit so Phase 4 stack-decide can flag drift
6
7
  schema-snapshot-date: <YYYY-MM-DD>
7
8
  rag-architecture-version: 1
9
+ derived-from: [product-brief]
10
+ downstream: [app-architecture, threat-model, hardening-checklist, module-spec/*]
8
11
  created: <YYYY-MM-DD>
9
12
  updated: <YYYY-MM-DD>
10
13
  schema-version: 1
11
14
  ---
12
15
 
13
- ## Tables and relationships
16
+ ## 1. Tenancy Model
14
17
 
15
- _ER diagram in mermaid or prose. The canonical tables, columns of interest, and foreign-key relationships._
18
+ _The load-bearing question. The data-architect refuses to advance past this section until the tenant definition is concrete and ties to a persona in the brief._
16
19
 
17
- ## RLS model
20
+ **Pattern** one of:
18
21
 
19
- _The universal pattern + per-table deviations. Validator rule DA-01: this section must contain the word "RLS" in a heading._
22
+ - **A. Tenant = the customer organization** single workspace per paying customer; users inside share visibility.
23
+ - **B. Tenant = a sub-team within the customer organization** — multi-workspace per customer.
24
+ - **C. Tenant = the individual user** — workspace-per-user.
25
+ - **D. Custom** — document the pattern explicitly and explain why none of A/B/C fit.
20
26
 
21
- ## RAG and embeddings
27
+ **Rationale**
22
28
 
23
- _Where embeddings live, how retrieval is scoped, what the cache looks like, how tenant_id is enforced on every RPC._
29
+ _One sentence tying the chosen pattern to the persona in `product-brief.md`. Example: "Pattern A because Maya (Director of CS) shares visibility with her 6 reps; sub-team isolation isn't requested by any v1 persona."_
24
30
 
25
- ## Data lifecycle
31
+ **Tenant identifier**
26
32
 
27
- _Retention, archival, deletion. Per-table policies._
33
+ _The column name and type used to scope every tenant-scoped table (`workspace_id uuid`, `org_id text`, etc.). All downstream RLS predicates reference this column._
28
34
 
29
- ## External data sources
35
+ ## 2. Entity Graph
30
36
 
31
- _Third-party integrations that write to our store. Webhook signature verification posture._
37
+ _The set of entities and their relationships. Each entity must trace to either a persona-named action in `product-brief.md` or to the tenancy model from Section 1. Orphan entities halt with the drift challenge._
32
38
 
33
- ## Conventions
39
+ **Entities**
34
40
 
35
- _Naming, soft-deletes vs hard-deletes, audit fields, timestamp conventions, UUID vs serial._
41
+ | Entity | Owns | Traces to | Relationships |
42
+ | --- | --- | --- | --- |
43
+ | <entity-name> | <one-line statement> | <persona-action OR tenancy-derived> | <FK refs> |
44
+
45
+ **Conventions** (subsumed from prior template)
46
+
47
+ _Naming (snake_case, plural tables), timestamps (`created_at`, `updated_at` on every table, ISO 8601), soft-deletes vs hard-deletes per entity, UUID vs serial choice with rationale, audit fields if any._
48
+
49
+ **Drift challenge answered**
50
+
51
+ _"Does any entity here have no trace to a persona or feature in the brief? Name it."_
52
+
53
+ ## 3. RLS Posture
54
+
55
+ _Per-table policy sketch. Every entity from Section 2 falls into one of two categories — no third._
56
+
57
+ **Tenant-scoped tables**
58
+
59
+ | Table | Policy predicate sketch | Notes |
60
+ | --- | --- | --- |
61
+ | <table> | `<tenant-column> = current_setting('app.<tenant-column>')::uuid` | <e.g., RPC-only writes, no direct INSERT> |
62
+
63
+ **Intentionally global tables**
64
+
65
+ | Table | Why no RLS | Rationale |
66
+ | --- | --- | --- |
67
+ | <table> | <lookup data \| public reference \| ...> | <one sentence> |
68
+
69
+ **Drift challenge answered**
70
+
71
+ _"Does any tenant-scoped entity have an RLS policy that the chosen tenancy model wouldn't enforce? Name it."_
72
+
73
+ ## 4. RAG / pgvector
74
+
75
+ _Whether v1 uses embeddings, what entity carries them, which embedding model, the tenant-scoped retrieval RPC signature. If v1 does not use RAG, mark this section `not-in-v1` with rationale and skip ahead._
76
+
77
+ **Use in v1**
78
+
79
+ _`yes` or `not-in-v1`. If not-in-v1, justify in one sentence (e.g., "v1 ships change-awareness without semantic retrieval; pgvector is a v2 layer")._
80
+
81
+ **Embedding-bearing entities**
82
+
83
+ | Entity | Embedding column | Model | Dimensions | Tenant-scoped retrieval RPC |
84
+ | --- | --- | --- | --- | --- |
85
+ | <entity> | <column name> | <e.g., openai:text-embedding-3-small> | <e.g., 1536> | <RPC signature with tenant predicate> |
86
+
87
+ **Tenant-scoping requirement**
88
+
89
+ _Every retrieval RPC MUST filter by the Section 1 tenant identifier. The drift challenge verifies this._
90
+
91
+ **Drift challenge answered**
92
+
93
+ _"Does any embedding-bearing entity have a retrieval RPC that bypasses tenant scoping? Name it."_
94
+
95
+ ## 5. Migration Sketches
96
+
97
+ _Postgres-dialect DDL sketches for the initial migrations, with `-- TODO: confirm` markers on uncertain parts. The implementer reads these during bootstrap and writes the actual `.sql` files; the sketches are intent, not executable. Typical ordering: schema → RLS → pgvector. Data must never land before RLS._
98
+
99
+ **Migration sequence**
100
+
101
+ ```
102
+ m_0001_initial_schema.sql -- Section 2 entities, tables + FKs, no policies yet
103
+ m_0002_rls_policies.sql -- Section 3 policies, applied per tenant-scoped table
104
+ m_0003_pgvector_setup.sql -- Section 4 RPCs and indexes (skip if not-in-v1)
105
+ m_0004_seed_global_data.sql -- Section 3 intentionally-global table seeds (optional)
106
+ ```
107
+
108
+ **Sketch — m_0001_initial_schema.sql**
109
+
110
+ ```sql
111
+ -- TODO: confirm UUID extension is enabled
112
+ create extension if not exists "uuid-ossp";
113
+
114
+ -- TODO: confirm column types and FK ON DELETE behaviors per entity
115
+ create table <entity> (
116
+ id uuid primary key default uuid_generate_v4(),
117
+ <tenant-column> uuid not null references <tenant-table>(id) on delete cascade,
118
+ -- entity-specific columns
119
+ created_at timestamptz not null default now(),
120
+ updated_at timestamptz not null default now()
121
+ );
122
+ ```
123
+
124
+ **Sketch — m_0002_rls_policies.sql**
125
+
126
+ ```sql
127
+ -- TODO: confirm session-variable name matches app convention
128
+ alter table <entity> enable row level security;
129
+
130
+ create policy <entity>_tenant_isolation on <entity>
131
+ for all
132
+ using (<tenant-column> = current_setting('app.<tenant-column>')::uuid);
133
+ ```
134
+
135
+ **Sketch — m_0003_pgvector_setup.sql** (skip if Section 4 is `not-in-v1`)
136
+
137
+ ```sql
138
+ -- TODO: confirm pgvector version compatible with embedding model dimensions
139
+ create extension if not exists vector;
140
+
141
+ alter table <embedding-bearing-entity>
142
+ add column embedding vector(<dimensions>);
143
+
144
+ create index on <embedding-bearing-entity> using ivfflat (embedding vector_cosine_ops);
145
+
146
+ -- TODO: confirm RPC signature and tenant predicate
147
+ create or replace function nearest_<entity>(query_embedding vector, k int, p_<tenant-column> uuid)
148
+ returns table (id uuid, score float4)
149
+ language sql stable
150
+ as $$
151
+ select id, embedding <=> query_embedding as score
152
+ from <embedding-bearing-entity>
153
+ where <tenant-column> = p_<tenant-column>
154
+ order by score
155
+ limit k;
156
+ $$;
157
+ ```
158
+
159
+ **Data lifecycle** (subsumed from prior template)
160
+
161
+ _Retention windows per entity (e.g., "interactions: 18 months hot, archived after"), archival path, deletion guarantees (hard-delete vs soft-delete vs anonymize-and-retain). Lifecycle differences per tenant tier (free vs paid) noted here._
162
+
163
+ **Drift challenge answered**
164
+
165
+ _"Does any migration in the sketch sequence land data before its RLS policy? Name it."_
166
+
167
+ ## Coherence check (end-of-atom)
168
+
169
+ _When the atom reaches terminal state, the agent re-runs all five drift challenges. Any unanswered challenge halts the commit._
@@ -0,0 +1,69 @@
1
+ ---
2
+ id: discovery-brainstorm
3
+ type: discovery-technique
4
+ technique: brainstorm
5
+ applies-to: product-brief
6
+ schema-version: 1
7
+ ---
8
+
9
+ # Brainstorm — technique script
10
+
11
+ This is the prompt sequence `product-discovery` runs in Brainstorm mode. Use this when the engineer has a problem domain but no concrete concept. The mode is **facilitated ideation** — the agent acts as coach pulling ideas out via structured exercises, not generating ideas for the engineer.
12
+
13
+ ## Pre-flight check
14
+
15
+ Before entering the script, the agent confirms:
16
+
17
+ - The engineer can name the problem domain in one sentence ("CS teams losing follow-up context") even if the solution is undefined.
18
+ - The engineer has 60+ minutes available. Brainstorm runs multi-round; cutting it short produces shallow output.
19
+
20
+ ## Round 1 — SCAMPER pass on the problem statement
21
+
22
+ For each SCAMPER lens, ask the engineer one question and write their answer:
23
+
24
+ - **Substitute** — "What current workflow could be substituted away?"
25
+ - **Combine** — "What two things, combined, would create new value here?"
26
+ - **Adapt** — "What other industry has solved a similar pain — what did they do?"
27
+ - **Modify** — "What single behavior, if amplified, would solve most of the pain?"
28
+ - **Put to another use** — "What's a non-obvious user who has this same pain?"
29
+ - **Eliminate** — "What part of the current workflow could disappear entirely?"
30
+ - **Reverse** — "What if the user did the opposite of what they do today?"
31
+
32
+ Answers land as raw text in a scratch section. Do NOT synthesize yet.
33
+
34
+ ## Round 2 — Reverse brainstorming
35
+
36
+ Ask: "How would you make this problem **worse** for the user? List five ways."
37
+
38
+ The engineer's answers reveal the load-bearing failure modes — the things the product must NOT do. These directly seed the **Explicitly NOT** section of the brief.
39
+
40
+ ## Round 3 — Six Thinking Hats on the strongest thread
41
+
42
+ The agent picks the strongest 1–2 threads from Rounds 1 and 2 (the threads with the most concrete user actions named) and proposes them back. For each thread, walk the hats:
43
+
44
+ - **White hat (facts)** — "What do we observably know about this user's workflow today?"
45
+ - **Red hat (intuition)** — "What feels right or wrong about this thread, gut-check?"
46
+ - **Black hat (caution)** — "What's the strongest case against this thread?"
47
+ - **Yellow hat (optimism)** — "What's the strongest case for this thread?"
48
+ - **Green hat (creativity)** — "What's the wildest version of this thread?"
49
+ - **Blue hat (process)** — "Is this the right thread to deepen, or should we drop it?"
50
+
51
+ After the Six Hats run, the engineer either commits to a thread or returns to Round 1 with a sharper problem statement.
52
+
53
+ ## Round 4 — Synthesis
54
+
55
+ The agent proposes a one-paragraph synthesis of the strongest thread, framed as: "Here is what I heard you converge on. Concept: X. Underlying pain: Y. Target user: Z." The engineer confirms or revises.
56
+
57
+ On confirmation, the agent transitions to the **product-brief.md** template and walks the sections, using the synthesis as the seed for Underlying Pain, Target User, and Value Proposition.
58
+
59
+ ## Required reframes (mandatory before brief lands)
60
+
61
+ These run during the section walk of `product-brief.md`, regardless of which Brainstorm round produced the synthesis:
62
+
63
+ - "Who specifically pays for this?" — concrete persona required.
64
+ - "What's the smallest useful wedge?" — minimum shippable surface required.
65
+ - "What would you have to believe to be wrong about this?" — falsifiability required.
66
+
67
+ ## Park-and-resume
68
+
69
+ The agent surfaces a parking offer after each Round commits. If the engineer parks, the round's output is persisted in `hstack/.session-state/<session-id>.yaml`. Resume picks up at the next round.
@@ -0,0 +1,76 @@
1
+ ---
2
+ id: discovery-forcing-questions
3
+ type: discovery-technique
4
+ technique: forcing-questions
5
+ applies-to: product-brief
6
+ schema-version: 1
7
+ ---
8
+
9
+ # Forcing-questions — technique script
10
+
11
+ This is the prompt sequence `product-discovery` runs in Forcing-Questions mode. Use this when the engineer has a concept but it's vague or oversold — the technique probes claims and reframes the underlying pain. Pattern derived from YC-partner forcing questions and the Gstack approach.
12
+
13
+ The agent's operating mode in this technique is **reframe-driven probing**: every claim the engineer makes triggers a reframe. The engineer's job is to defend the claim or accept the reframe. The brief converges only when the claims survive the probes.
14
+
15
+ ## Pre-flight check
16
+
17
+ Before entering the script, the agent confirms:
18
+
19
+ - The engineer has a concept they can state in one or two sentences.
20
+ - The engineer is open to being wrong about their concept. The technique surfaces reframes that may invalidate the founder's first articulation; founders who can't tolerate that should pick Project-Brief mode instead.
21
+
22
+ ## Probe 1 — The 10-star reframe
23
+
24
+ Ask: "What's the 10-star product hiding inside this request? What you described is 5-star; what's the 10-star version that solves the actual underlying pain?"
25
+
26
+ The engineer's first answer is often a feature embellishment ("...with AI"). Re-ask: "That's a feature. What's the **underlying** pain — what does the user fail to do today that the 10-star product would make trivial?"
27
+
28
+ The reframe sticks when the engineer names a pain that is one level deeper than the original concept. The brief's **Underlying Pain** section seeds from this answer.
29
+
30
+ ## Probe 2 — The smallest useful wedge
31
+
32
+ Ask: "What's the smallest useful wedge? If you shipped one slice of the 10-star product and nothing else, what's the one slice that would still get a real user to pay?"
33
+
34
+ The engineer's first answer is usually too large. Re-ask: "Cut it in half. What's left when you remove every feature that isn't load-bearing for the slice you just described?"
35
+
36
+ The reframe sticks when the engineer names a wedge that can be built by one engineer in a quarter and that, alone, would justify a real user's payment. The brief's **Smallest Useful Wedge** section seeds from this answer.
37
+
38
+ ## Probe 3 — The named user
39
+
40
+ Ask: "Who specifically pays for this? Name a real person — first name, role, company-size band, and the workflow this product enters on a Tuesday morning."
41
+
42
+ The engineer's first answer is often a role abstraction ("Directors of CS"). Re-ask: "Pick one specific Director of CS you've talked to. What's her name, what's her company's name, and what does she do on a Tuesday morning that this product changes?"
43
+
44
+ If the engineer cannot name a specific person, halt and surface: "The named-user constraint isn't met. We can either (a) park here and you go talk to three real users this week, or (b) acknowledge in the brief that this is anchored on a hypothetical user, which makes everything downstream a gamble." Founders sometimes choose (b); the brief records the choice in **Open Risks**.
45
+
46
+ The brief's **Target User** section seeds from this answer.
47
+
48
+ ## Probe 4 — The falsification probe
49
+
50
+ Ask: "What would you have to believe to be wrong about this concept? Name the belief and the evidence that would falsify it."
51
+
52
+ The engineer's first answer is often "users won't like it" — too vague. Re-ask: "Be specific. What's a load-bearing assumption about the user, the market, or the technology that, if wrong, kills the product? And what experiment would tell you if it's wrong?"
53
+
54
+ The reframe sticks when the engineer names a falsifiable belief plus an experiment that would resolve it within weeks. The brief's **Open Risks** section seeds from this answer.
55
+
56
+ ## Probe 5 — The scope-reduction question
57
+
58
+ Ask: "If you had to ship in 8 weeks with one engineer, what would you cut? Walk me through the cut list."
59
+
60
+ The engineer's cuts reveal what they think is load-bearing vs. embellishment. The brief's **Explicitly NOT** section seeds from the cut list — the things the engineer would cut are exactly the things v1 explicitly does NOT do.
61
+
62
+ ## Probe 6 — The reframe-staleness check
63
+
64
+ After Probes 1–5, the agent surfaces: "The brief is converging on [X]. Your starting concept was [Y]. Any external documents (Notion pages, pitch deck, README) still naming [Y]? Those are now stale. Cleanup checklist:"
65
+
66
+ The engineer either confirms the docs are stale and lists them for cleanup, or pushes back ("no, Y is still the framing") — in which case the agent re-runs Probe 1 to reconcile.
67
+
68
+ ## Synthesis
69
+
70
+ After all six probes, the agent proposes a one-paragraph synthesis: "Here is what survived the probes. Concept: [refined X]. Underlying pain: [Probe 1 answer]. Smallest wedge: [Probe 2 answer]. Named user: [Probe 3 answer]. Falsification: [Probe 4 answer]." The engineer confirms or revises.
71
+
72
+ On confirmation, the agent transitions to the **product-brief.md** template and walks the sections. The probe answers seed the corresponding brief sections; the Forcing-Prompt Answers section records the probes verbatim as evidence the technique ran.
73
+
74
+ ## Park-and-resume
75
+
76
+ The agent surfaces a parking offer after each probe commits. If the engineer parks, the probe's output is persisted in `hstack/.session-state/<session-id>.yaml`. Resume picks up at the next probe.
@@ -0,0 +1,53 @@
1
+ ---
2
+ id: discovery-project-brief
3
+ type: discovery-technique
4
+ technique: project-brief
5
+ applies-to: product-brief
6
+ schema-version: 1
7
+ ---
8
+
9
+ # Project-brief — technique script
10
+
11
+ This is the prompt sequence `product-discovery` runs in Project-Brief mode. Use this when the engineer is already concrete about the product and just needs structure to land the brief artifact. This is the **lightest-touch** technique — collaborative, structured, no heavy reframes — but the three required forcing prompts still fire.
12
+
13
+ The agent's operating mode in this technique is **structured walk**: the engineer's existing thinking is the proposal layer; the agent prompts section by section, confirms or revises, lands the brief.
14
+
15
+ ## Pre-flight check
16
+
17
+ Before entering the script, the agent confirms:
18
+
19
+ - The engineer can state the concept in two or three sentences without hedging.
20
+ - The engineer can name a specific real user (not a role abstraction).
21
+ - The engineer can name a concrete success metric.
22
+
23
+ If any of the three fails the concreteness floor, the agent halts and suggests switching to Forcing-Questions mode — the engineer's thinking is too vague for Project-Brief mode, which assumes concreteness.
24
+
25
+ ## Section walk
26
+
27
+ The agent walks `product-brief.md` section by section. For each section, the agent asks one open question, accepts the engineer's answer, surfaces one clarifying re-ask if the answer is vague, then commits the section.
28
+
29
+ 1. **Underlying Pain** — "Describe what the user struggles with today, in concrete terms. A Tuesday-morning workflow vignette is the unit of clarity."
30
+ 2. **Target User** — "Name a specific real user. First name, role, company-size band, the tools they use, the workflow this product enters."
31
+ 3. **Value Proposition** — "What outcome does this product deliver to the named user? Outcome, not features."
32
+ 4. **Smallest Useful Wedge** — "What's the minimum shippable surface that delivers real value? Would the named user still pay for the wedge alone?"
33
+ 5. **Success Criteria** — "What measurable, time-bound outcome tells you v1 worked? Concrete number, concrete window."
34
+ 6. **Explicitly NOT** — "What is this product NOT? Two bullets minimum. What population it does NOT serve, what workflows it does NOT enter, what features it does NOT include."
35
+ 7. **Open Risks** — "What could make this product fail? Name at least one belief that, if wrong, kills the product."
36
+
37
+ ## Required forcing prompts
38
+
39
+ Even in this lightest-touch mode, the three required forcing prompts MUST run before the brief can land. They run after the section walk completes:
40
+
41
+ - "Who specifically pays for this?" — re-prompt the engineer to defend the Target User against the buyer question. The Target User and the buyer may be different (Maya the Director of CS uses it; her CFO pays for it). Both must be named.
42
+ - "What's the smallest useful wedge?" — re-prompt the engineer to defend the wedge against the "would the user pay for the wedge alone?" question. Yes required.
43
+ - "What would you have to believe to be wrong about this?" — re-prompt for a falsifiable belief + experiment to resolve it. Names the load-bearing risk.
44
+
45
+ These three answers are logged in the brief's **Forcing-Prompt Answers** section as evidence the probes ran. The engineer cannot skip them; the technique downgrades to Forcing-Questions mode mid-session if the engineer refuses any of the three.
46
+
47
+ ## Synthesis
48
+
49
+ There is no explicit synthesis step in Project-Brief mode — the section walk IS the synthesis. The brief lands at `status: current` when the last section commits and the three forcing prompts are answered.
50
+
51
+ ## Park-and-resume
52
+
53
+ The agent surfaces a parking offer after each section commits. If the engineer parks, the section's output is on disk and `hstack/.session-state/<session-id>.yaml` records the next-section pointer. Resume picks up at the next section.
@@ -6,6 +6,7 @@ owner: null # git-handle of the triager; null until f
6
6
  pattern: <KF-P1 | KF-P2 | KF-P3 | …> # detector pattern that fired; enumerated in scripts/telemetry/insights/kernel_fit.py
7
7
  confidence: medium # high | medium | low
8
8
  detected-by: kernel-fit-analyst
9
+ detected-via: detector # detector | flag — `detector` (default) when the finding came from kernel_fit.py pattern matching; `flag` when the finding originated from a /hstack:flag pin (ADR-0005). For folded-in findings (flag signal merged into an existing detector-finding), `detected-via` remains `detector` because the originating signal was the detector pattern.
9
10
  detected-at: <ISO-8601 timestamp>
10
11
  evidence-row-count: 0 # integer; must equal len(evidence-rows) per KF-01
11
12
  evidence-rows: [] # YAML array of {change|adr|td, signal} dicts; one entry per row counted above
@@ -0,0 +1,52 @@
1
+ ---
2
+ id: flag-<YYYYMMDD>T<HHMMSS>-<session-id-short>
3
+ type: kernel-fit-flag
4
+ status: pending # pending | processed
5
+ session-id: <claude-code-session-uuid> # FL-01: non-null at pin-time
6
+ session-transcript-path: <abs-path-to-jsonl> # FL-01: non-null at pin-time
7
+ branch: <current-branch> # FL-01: non-null at pin-time
8
+ head: <current-HEAD-sha> # FL-01: non-null at pin-time
9
+ workspace: <abs-path-to-cwd> # FL-01: non-null at pin-time
10
+ timestamp: <ISO-8601 timestamp at pin> # FL-01: non-null at pin-time
11
+ pre-compaction-message-count: <integer> # FL-01: non-null at pin-time; analyst uses this to detect truncation between pin and scan
12
+ hint: null # one-word string from --hint arg; null when no arg given
13
+ classification: null # FL-02: non-null when status: processed; one of friction | missing-guardrail | kernel-vs-practice-mismatch | not-actionable | transcript-truncated
14
+ classification-rationale: null # FL-02: non-null when status: processed; one-line analyst note
15
+ folded-into: null # KF-NNNN-<slug> when the analyst folded the signal into an existing finding
16
+ emitted-as: null # KF-NNNN-<slug> when the analyst emitted a fresh finding from this pin
17
+ created: <YYYY-MM-DD>
18
+ updated: <YYYY-MM-DD>
19
+ schema-version: 1
20
+ ---
21
+
22
+ <!--
23
+ A kernel-fit-flag is a frontmatter-only pin. There is no body. Engineer
24
+ interpretation of the friction is deliberately excluded — the analyst reads
25
+ the transcript window and forms its own classification at processing time.
26
+
27
+ Validator rules (enforced by the proposed-diff preview in v1; validate-spec.ts
28
+ is still a {{TODO-SCRIPT}} placeholder):
29
+
30
+ - FL-01: at pin-time (status: pending) every field marked above as
31
+ "non-null at pin-time" must be populated. `hint` may be null; the four
32
+ analyst-owned fields (classification, classification-rationale,
33
+ folded-into, emitted-as) must remain null until processing.
34
+
35
+ - FL-02: at processing-time (status: processed) `classification` and
36
+ `classification-rationale` must both be non-null. When the classification
37
+ produced a finding, exactly one of `folded-into` or `emitted-as` is non-null
38
+ (never both). When the classification did not produce a finding (closed as
39
+ `not-actionable` or `transcript-truncated`), both remain null.
40
+
41
+ Pins are immutable from the engineer's perspective. The only legal writes
42
+ after creation are by the kernel-fit-analyst at processing time, setting the
43
+ four analyst-owned fields and flipping status to processed. The engineer
44
+ cannot edit a pin to add commentary — that would re-open the contamination
45
+ surface the analyst guards against. To add context, re-flag in a follow-up
46
+ turn (a new pin with a different timestamp).
47
+
48
+ Pins live at hstack/kernel-fit/flags/pending/ before processing and at
49
+ hstack/kernel-fit/flags/processed/ after. The directory is gitignored in
50
+ the consuming repo — see ADR-0005 for the rationale and the trade-off
51
+ (provenance gap unique to this artifact type).
52
+ -->
@@ -0,0 +1,56 @@
1
+ ---
2
+ id: product-brief
3
+ type: product-brief
4
+ status: draft # draft | current | needs-refresh | archived
5
+ owner: <git-handle>
6
+ technique-used: <brainstorm | forcing-questions | project-brief>
7
+ derived-from: [] # always empty — product-brief is Phase 1, no upstream
8
+ downstream: [vision, mvp-scope, personas, glossary]
9
+ created: <YYYY-MM-DD>
10
+ updated: <YYYY-MM-DD>
11
+ schema-version: 1
12
+ ---
13
+
14
+ ## Underlying Pain
15
+
16
+ _What the user actually struggles with on a Tuesday morning, in concrete terms. Not "users want X" — "this specific person spends 20 minutes doing Y and misses Z." One paragraph, 4–8 sentences. The forcing-prompt reframes should have moved this away from the founder's first articulation; the result lands here._
17
+
18
+ ## Target User
19
+
20
+ _A named, specific user (not "users", not "customers") with a workday vignette. Includes role, company-size band, tools they use today, the workflow this product enters. If multiple personas matter for v1, name them all — but each must pass the concreteness floor._
21
+
22
+ ## Value Proposition
23
+
24
+ _What this product delivers to the named user, in their language. One paragraph. Distinct from features — this is the outcome they buy._
25
+
26
+ ## Smallest Useful Wedge
27
+
28
+ _The minimum shippable surface that delivers real value to the named user. Forcing-prompt answer: "Would the named user still pay for this if you shipped only the wedge and nothing else?" Yes required; if no, the wedge is too large or the user is wrong._
29
+
30
+ ## Success Criteria
31
+
32
+ _Concrete, measurable, time-bound. "Maya saves 10 minutes per QBR prep within 4 weeks of activation" not "users love it." At least one criterion; more is better._
33
+
34
+ ## Explicitly NOT
35
+
36
+ _Two-bullet minimum. The boundaries of the product. What this is NOT, what it does NOT do, what populations it does NOT serve. Required, never optional — over-broad scoping is the #1 product failure mode._
37
+
38
+ -
39
+ -
40
+
41
+ ## Open Risks
42
+
43
+ _The things that could make this product fail. The forcing-prompt "What would you have to believe to be wrong about this?" answer lands here. At least one risk; more is better._
44
+
45
+ ## Forcing-Prompt Answers
46
+
47
+ _Evidence that the three required reframes ran. Logged inline as confirmation the probes were not skipped._
48
+
49
+ **Who specifically pays for this?**
50
+ _The named user / buyer plus the rationale ("Director of CS, because retention is their KPI")._
51
+
52
+ **What's the smallest useful wedge?**
53
+ _The wedge plus the rationale ("Change-awareness alone, because the rest of the workflow is downstream of it")._
54
+
55
+ **What would you have to believe to be wrong about this?**
56
+ _The belief plus the falsifiability angle ("That CS reps will trust LLM-generated summaries — wrong if they require human-curated context")._