hstack 0.7.1 → 0.17.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 (131) hide show
  1. package/CHANGELOG.md +308 -0
  2. package/README.md +90 -154
  3. package/VERSION +1 -1
  4. package/dist/commands/doctor.js +69 -9
  5. package/dist/commands/doctor.js.map +1 -1
  6. package/dist/commands/init.js +7 -3
  7. package/dist/commands/init.js.map +1 -1
  8. package/dist/commands/update.js +17 -4
  9. package/dist/commands/update.js.map +1 -1
  10. package/dist/lib/descriptions.js +160 -0
  11. package/dist/lib/descriptions.js.map +1 -0
  12. package/dist/lib/diff.js +1 -1
  13. package/dist/lib/git.js +16 -0
  14. package/dist/lib/git.js.map +1 -1
  15. package/dist/lib/wire.js +274 -142
  16. package/dist/lib/wire.js.map +1 -1
  17. package/dist/manifest.js +49 -22
  18. package/dist/manifest.js.map +1 -1
  19. package/package.json +4 -3
  20. package/template/.claude/agents/adversarial-reviewer.md +42 -98
  21. package/template/.claude/agents/app-architect.md +44 -133
  22. package/template/.claude/agents/data-architect.md +46 -127
  23. package/template/.claude/agents/test-strategist.md +39 -109
  24. package/template/.claude/skills/hstack-adr-new/SKILL.md +23 -100
  25. package/template/.claude/skills/hstack-adversarial-review/SKILL.md +47 -174
  26. package/template/.claude/skills/hstack-adversarial-review/references/finding-categories.md +134 -0
  27. package/template/.claude/skills/hstack-app-architecture/SKILL.md +43 -95
  28. package/template/.claude/skills/hstack-commit/SKILL.md +28 -97
  29. package/template/.claude/skills/hstack-data-architecture/SKILL.md +34 -82
  30. package/template/.claude/skills/hstack-promote/SKILL.md +55 -0
  31. package/template/.claude/skills/hstack-story/SKILL.md +58 -0
  32. package/template/.claude/skills/hstack-test-audit/SKILL.md +64 -0
  33. package/template/.claude/skills/hstack-wrap/SKILL.md +48 -0
  34. package/template/.claude/skills/hstack-wrap/references/pr-description.md +45 -0
  35. package/template/KERNEL.md +167 -0
  36. package/template/templates/adr.md +9 -18
  37. package/template/templates/app-architecture.md +38 -50
  38. package/template/templates/data-architecture.md +39 -93
  39. package/template/templates/infrastructure.md +54 -148
  40. package/template/templates/roadmap.md +35 -0
  41. package/template/templates/story.md +7 -13
  42. package/template/templates/tech-debt.md +2 -37
  43. package/template/templates/tech-stack.md +2 -12
  44. package/template/.claude/agents/data-specialist.md +0 -126
  45. package/template/.claude/agents/implementer.md +0 -154
  46. package/template/.claude/agents/kernel-fit-analyst.md +0 -190
  47. package/template/.claude/agents/planner.md +0 -110
  48. package/template/.claude/agents/product-discovery.md +0 -165
  49. package/template/.claude/agents/product-manager.md +0 -111
  50. package/template/.claude/agents/researcher.md +0 -123
  51. package/template/.claude/agents/security-reviewer.md +0 -123
  52. package/template/.claude/agents/spec-author.md +0 -123
  53. package/template/.claude/agents/stack-architect.md +0 -137
  54. package/template/.claude/agents/ui-ux-briefer.md +0 -105
  55. package/template/.claude/agents/verifier.md +0 -113
  56. package/template/.claude/skills/hstack-branch/SKILL.md +0 -103
  57. package/template/.claude/skills/hstack-brownfield-init/SKILL.md +0 -158
  58. package/template/.claude/skills/hstack-change-new/SKILL.md +0 -111
  59. package/template/.claude/skills/hstack-change-plan/SKILL.md +0 -119
  60. package/template/.claude/skills/hstack-configure/SKILL.md +0 -126
  61. package/template/.claude/skills/hstack-coord/SKILL.md +0 -131
  62. package/template/.claude/skills/hstack-data-review/SKILL.md +0 -132
  63. package/template/.claude/skills/hstack-finalize/SKILL.md +0 -159
  64. package/template/.claude/skills/hstack-flag/SKILL.md +0 -138
  65. package/template/.claude/skills/hstack-greenfield-init/SKILL.md +0 -175
  66. package/template/.claude/skills/hstack-help/SKILL.md +0 -179
  67. package/template/.claude/skills/hstack-implement/SKILL.md +0 -185
  68. package/template/.claude/skills/hstack-kernel-fit-promote/SKILL.md +0 -164
  69. package/template/.claude/skills/hstack-kernel-fit-scan/SKILL.md +0 -197
  70. package/template/.claude/skills/hstack-kernel-fit-triage/SKILL.md +0 -159
  71. package/template/.claude/skills/hstack-module-spec/SKILL.md +0 -105
  72. package/template/.claude/skills/hstack-product-discovery/SKILL.md +0 -101
  73. package/template/.claude/skills/hstack-research/SKILL.md +0 -145
  74. package/template/.claude/skills/hstack-scaffold/SKILL.md +0 -140
  75. package/template/.claude/skills/hstack-security-review/SKILL.md +0 -133
  76. package/template/.claude/skills/hstack-ship/SKILL.md +0 -129
  77. package/template/.claude/skills/hstack-stack-decide/SKILL.md +0 -108
  78. package/template/.claude/skills/hstack-story-draft/SKILL.md +0 -119
  79. package/template/.claude/skills/hstack-tech-debt-new/SKILL.md +0 -122
  80. package/template/.claude/skills/hstack-tech-debt-resolve/SKILL.md +0 -158
  81. package/template/.claude/skills/hstack-tech-debt-stale/SKILL.md +0 -113
  82. package/template/.claude/skills/hstack-tech-debt-wontfix/SKILL.md +0 -104
  83. package/template/.claude/skills/hstack-telemetry/SKILL.md +0 -98
  84. package/template/.claude/skills/hstack-test-plan/SKILL.md +0 -182
  85. package/template/.claude/skills/hstack-ui-brief/SKILL.md +0 -108
  86. package/template/.claude/skills/hstack-verify/SKILL.md +0 -150
  87. package/template/CLAUDE.md +0 -443
  88. package/template/scripts/coord/coord_scan.py +0 -681
  89. package/template/scripts/telemetry/__init__.py +0 -6
  90. package/template/scripts/telemetry/insights/__init__.py +0 -0
  91. package/template/scripts/telemetry/insights/contract_drift.py +0 -137
  92. package/template/scripts/telemetry/insights/kernel_fit.py +0 -438
  93. package/template/scripts/telemetry/insights/overengineering.py +0 -115
  94. package/template/scripts/telemetry/insights/quality_outcomes.py +0 -131
  95. package/template/scripts/telemetry/insights/token_economics.py +0 -129
  96. package/template/scripts/telemetry/insights/workflow_shape.py +0 -198
  97. package/template/scripts/telemetry/parsers/__init__.py +0 -0
  98. package/template/scripts/telemetry/parsers/bodies.py +0 -87
  99. package/template/scripts/telemetry/parsers/commits.py +0 -219
  100. package/template/scripts/telemetry/parsers/frontmatter.py +0 -322
  101. package/template/scripts/telemetry/parsers/transcripts.py +0 -181
  102. package/template/scripts/telemetry/render.py +0 -395
  103. package/template/scripts/telemetry/report.py +0 -138
  104. package/template/scripts/telemetry/run_kernel_fit.py +0 -91
  105. package/template/templates/adversarial-review.md +0 -54
  106. package/template/templates/bootstrap.md +0 -105
  107. package/template/templates/change-spec.md +0 -82
  108. package/template/templates/ci-cd.md +0 -27
  109. package/template/templates/coord-message.md +0 -55
  110. package/template/templates/data-review.md +0 -54
  111. package/template/templates/discovery/brainstorm.md +0 -69
  112. package/template/templates/discovery/forcing-questions.md +0 -76
  113. package/template/templates/discovery/project-brief.md +0 -53
  114. package/template/templates/figma-handoff.md +0 -38
  115. package/template/templates/glossary.md +0 -20
  116. package/template/templates/hardening-checklist.md +0 -73
  117. package/template/templates/incident-runbook.md +0 -57
  118. package/template/templates/kernel-fit-finding.md +0 -63
  119. package/template/templates/kernel-fit-flag.md +0 -52
  120. package/template/templates/module-spec.md +0 -49
  121. package/template/templates/mvp-scope.md +0 -34
  122. package/template/templates/persona.md +0 -38
  123. package/template/templates/plan.md +0 -49
  124. package/template/templates/product-brief.md +0 -56
  125. package/template/templates/security-review.md +0 -63
  126. package/template/templates/telemetry-sidecar.md +0 -184
  127. package/template/templates/test-plan.md +0 -119
  128. package/template/templates/threat-model.md +0 -54
  129. package/template/templates/ui-brief.md +0 -49
  130. package/template/templates/verification.md +0 -63
  131. package/template/templates/vision.md +0 -34
@@ -1,190 +1,96 @@
1
- ---
2
- id: infrastructure
3
- type: infrastructure
4
- status: drafted # drafted | current | needs-refresh | archived
5
- owner: <git-handle>
6
- last-quarterly-review: <YYYY-MM-DD>
7
- created: <YYYY-MM-DD>
8
- updated: <YYYY-MM-DD>
9
- schema-version: 1
10
- ---
1
+ _Where things run, why the couplings are what they are, and the traps. Operational truth, not policy — read it before touching env, deploy or dependencies (kernel § Context docs), and update it in the PR that makes it wrong. An honest "we don't have this yet" is the right answer whenever it is the true one._
11
2
 
12
- _Operational truth about how the consuming repo's product runs. Truth-gathering, not policy — `threat-model.md` and `hardening-checklist.md` carry the policy. This file is what `security-reviewer`, `data-specialist`, and any future `infra-specialist` read to ground change-time review in the system's actual shape. Length norm: 600–1500 lines once filled; shorter is honest for pre-prod, longer is a smell. Every H2 below must be present (validator rule INF-01); the Unknowns section must be present even when empty (INF-02); the Blast-Radius Matrix must list at least one row when status moves to `current` (INF-03); no MCP server may be wired with always-on write capability against prod (INF-04); LLM-driven sessions with a write-capable MCP active must not read user-generated content in the same session (INF-05)._
3
+ ## Where things run
13
4
 
14
- ## Hosting & Compute
5
+ _One row per distinct runtime — app, edge functions, workers, cron, queue consumers. Names copied from the provider console, not paraphrased._
15
6
 
16
- _Where each runtime lives. Provider, region(s), service tier/plan, instance class or function memory. Names must match the cloud console exactly — copy them, do not paraphrase. One row per distinct runtime (app, edge functions, workers, cron, queue consumers)._
17
-
18
- | Runtime | Provider | Region(s) | Tier / Plan | Notes |
7
+ | Runtime | Provider | Region(s) | Plan / tier | Notes |
19
8
  |---|---|---|---|---|
20
9
  | | | | | |
21
10
 
22
- ## Networking
23
-
24
- _DNS provider and zone, custom domains, TLS/SSL provisioning, CDN / edge cache, load balancing, ingress rules. Note which records are managed in code (IaC) vs the provider console._
25
-
26
- - **DNS provider.**
27
- - **Domains in use.**
28
- - **TLS provisioning.**
29
- - **CDN / edge.**
30
- - **Load balancing.**
31
- - **Egress controls.**
11
+ - **Domains, DNS, TLS, CDN.**
12
+ - **Declared in code vs clicked in a console.** List the clicked resources explicitly — each one is a load-bearing piece of tribal knowledge.
32
13
 
33
- ## Data Layer
14
+ ## Data & storage
34
15
 
35
- _Database hosting, connection pooling, backup cadence, point-in-time recovery window, read replicas, retention policy. Defers schema and RLS to `data-architecture.md`; this section is operational (where and how, not what)._
16
+ _Operational only. Schema, tenancy and RLS live in `data-architecture.md`._
36
17
 
37
- - **Primary database.**
38
- - **Connection pooling.**
39
- - **Backups.**
40
- - **Point-in-time recovery.**
18
+ - **Primary database** — host, plan, connection pooling.
19
+ - **Backups** — cadence, retention, point-in-time-recovery window.
20
+ - **Last restore drill** — date, and what it proved. An untested backup is a wish.
41
21
  - **Replicas / failover.**
42
- - **Retention.**
43
- - **Vector / search infrastructure.**
44
-
45
- ## Storage
46
-
47
- _Object storage, file uploads, presigned-URL flows, lifecycle and retention. One row per bucket / container._
48
-
49
- | Bucket | Provider | Purpose | Public? | Lifecycle | Notes |
50
- |---|---|---|---|---|---|
51
- | | | | | | |
52
-
53
- ## Secrets & Configuration
54
-
55
- _Where secrets live, how they are injected at runtime, rotation cadence, who has access. **The runbook for rotation lives in `incident-runbook.md`; this section names the system, not the steps.**_
56
-
57
- - **Secret store.**
58
- - **Injection mechanism.**
59
- - **Rotation cadence.**
60
- - **Access control.**
61
- - **Audit trail.**
62
-
63
- ## Environment Separation
64
-
65
- _What dev, staging (if present), and production look like, and what differs between them. Data-promotion rules (does prod data ever flow downstream? if so, with what redaction?). Connection-string isolation. **Test-against-prod is a kernel-level forbidden tool; flag any violation here as tech-debt.**_
66
-
67
- - **Dev.**
68
- - **Staging.**
69
- - **Production.**
70
- - **Data-promotion rules.**
71
- - **Cross-environment guardrails.**
72
-
73
- ## IaC Inventory
74
-
75
- _What infrastructure is declared in code vs configured by click in a console. Path to IaC files. Tool (Terraform, Pulumi, CDK, OpenTofu, Supabase migrations, GitHub Actions YAML, Dockerfile). Who can apply. **Click-configured infra is not forbidden, but every clicked resource is a load-bearing tribal-knowledge item; list each one explicitly so it can be promoted to IaC over time.**_
76
-
77
- | Resource | Source-of-truth | Path / location | Applier(s) | Notes |
78
- |---|---|---|---|---|
79
- | | | | | |
80
-
81
- ## Deploy Pipeline
82
-
83
- _How code reaches each environment. References `ci-cd.md` for the build pipeline; this section captures the deploy half — promotion mechanics, rollout strategy (instant cutover, canary, blue/green), rollback procedure, who can trigger a deploy._
84
-
85
- - **Build → deploy handoff.**
86
- - **Promotion path.**
87
- - **Rollout strategy.**
88
- - **Rollback procedure.**
89
- - **Deploy authorization.**
90
-
91
- ## Observability
22
+ - **Vector or search infrastructure.**
23
+ - **Buckets** one line each: purpose, public or not, lifecycle.
92
24
 
93
- _Logs, metrics, traces, error tracking, uptime monitoring. Where each lives, retention window, who reads them. Alert routing — which alerts wake whom, on which channel. **An observability gap is a production-readiness gap; an honest "we don't have this yet" entry is the right answer when true.**_
25
+ ## Environments
94
26
 
95
- - **Logs.**
96
- - **Metrics.**
97
- - **Traces.**
98
- - **Error tracking.**
99
- - **Uptime monitoring.**
100
- - **Alert routing.**
101
-
102
- ## Cost & Capacity
103
-
104
- _Current monthly spend per service (approximate is fine). Budget alerts. Scaling triggers and ceilings. Rate-limiting posture (per-route, per-tenant). **Cost is a security and reliability concern, not just a finance concern: an unbounded scale ceiling is a billing-DoS vector.**_
27
+ _What dev, preview and production are, and what actually differs between them._
105
28
 
106
- | Service | Monthly spend (approx) | Budget alert at | Scale ceiling | Notes |
29
+ | Environment | App URL | Database it points at | Seed data | Notes |
107
30
  |---|---|---|---|---|
108
31
  | | | | | |
109
32
 
110
- - **Rate limits.**
111
- - **Per-tenant quotas.**
33
+ - **Source of truth for environment variables**, and how they are scoped per environment.
34
+ - **Does production data ever flow downstream?** If so, with what redaction.
35
+ - **Cross-environment guardrails.** Testing against production is a kernel-forbidden path; a violation found here is a tech-debt file, not a footnote.
112
36
 
113
- ## Disaster Recovery
114
-
115
- _Recovery Point Objective (RPO) and Recovery Time Objective (RTO) targets per critical resource. Backup restore procedure (high level — full steps live in `incident-runbook.md`). Drill cadence — when was the last successful restore test, and when is the next scheduled. **An untested backup is a wish, not a recovery plan.**_
116
-
117
- | Resource | RPO target | RTO target | Last drill | Next drill |
118
- |---|---|---|---|---|
119
- | | | | | |
37
+ ## Secrets
120
38
 
121
- ## Blast-Radius Matrix
39
+ - **Where they live.** The one store that is authoritative.
40
+ - **How they reach the runtime.**
41
+ - **Who has access**, and how that is reviewed.
42
+ - **Rotation** — cadence, and where the steps are written down.
122
43
 
123
- _Per critical resource: what depends on it, what dies if it dies, and who is notified. This is the table that `security-reviewer` reads when scoring an infra-surface change; it must list at least one row when status moves to `current` (INF-03)._
44
+ ## Deploy Pipeline
124
45
 
125
- | Resource | Depends on | What dies if this dies | Notification path | Mitigation |
126
- |---|---|---|---|---|
127
- | | | | | |
46
+ _How code reaches production, and the exact commands `/hstack-promote` will look for here. A command left blank halts the promotion — which is the correct outcome, because guessing a production command is how the wrong project gets migrated._
128
47
 
129
- ## Access & Change Control
48
+ | What `/hstack-promote` needs | Command |
49
+ |---|---|
50
+ | Apply a pending migration to production | |
51
+ | List deployments and their state | |
52
+ | Smoke-test a specific deployment URL | |
53
+ | Read production logs | |
54
+ | Promote a deployment | |
55
+ | Roll back to the previous deployment | |
130
56
 
131
- _Who has production console access per provider. MFA enforcement. Audit log location and retention. Deploy authorization — who can push to prod, who can apply IaC, who can rotate secrets. **The principle of least privilege applies here; list humans by name and access scope, not role abstractions.**_
57
+ - **Promotion path.** How a merge becomes an unpromoted production build, and what promotes it. Auto-assignment of the production domain must be off for the staged flow to exist at all.
58
+ - **Who may promote.**
59
+ - **Rollback.** What re-promoting the previous deployment does and does not undo — migrations are additive, so they stay.
132
60
 
133
- | Human | Provider | Scope | MFA enforced | Last access review |
134
- |---|---|---|---|---|
135
- | | | | | |
61
+ ## Observability
136
62
 
137
- - **Audit log location.**
138
- - **Audit log retention.**
139
- - **Access review cadence.**
63
+ _Where `/hstack-promote` looks in its post-promotion window, and where a daily glance happens._
140
64
 
141
- ## MCP Access Policy
65
+ - **Logs** where, retention.
66
+ - **Error tracking** — tool, project, who watches it.
67
+ - **Uptime monitoring.**
68
+ - **Alert routing** — which alert reaches whom, on which channel. "Nobody is paged" is an answer; write it down rather than implying one.
142
69
 
143
- _Which MCP servers are wired, where they point, what they can do. MCP access is a security boundary equivalent to the access token it carries — an LLM-driven session with tool access to a project-scoped token has the project's full blast radius. The kernel already forbids `service_role` Supabase keys and `supabase db push` / `db reset` against remote environments; MCP write access against prod is the analogous capability and follows the same rule. One row per MCP server per project it points at._
70
+ ## Couplings & gotchas
144
71
 
145
- | MCP server | Wired at | Points at | Access mode | Token storage | Rotation cadence | Notes |
146
- |---|---|---|---|---|---|---|
147
- | | | | | | | |
72
+ _The section that earns this file. Everything a newcomer human or agent would otherwise learn by breaking production: a region that must match another region, a version pinned because the next one broke us, a service that must be deployed before another, a quota that bites at a specific hour._
148
73
 
149
- **Rule (INF-04).** No MCP server may be wired with write capability against the production project. Read-only mode (the server's `--read-only` flag or equivalent) is the floor for any MCP that points at prod. When a write-capable MCP must exist against prod for an operational reason (one-off migration applied through the MCP, e.g.), the row above carries a `--write-justified-by: <change-spec-id or ADR id>` note and the MCP is disabled by default — enabled only inside the named change window, then immediately disabled. Always-on write-capable prod MCPs are forbidden.
74
+ -
150
75
 
151
- **Rule (INF-05).** Any LLM-driven session that has a write-capable MCP tool active must not, in the same session, read user-generated content from a tenant-scoped table. This is the prompt-injection mitigation: prevents stored content (customer support rows, webhook payloads, user-submitted fields) from steering the LLM into destructive tool calls. List each session pattern below — subagent name, Skill, or ad-hoc and which side of this boundary it sits on.
76
+ _External services this depends on at runtime. Criticality: `hard` = the product is down, `soft` = degraded, `optional` = no user impact._
152
77
 
153
- | Session pattern | Write-capable MCP tools active? | Reads tenant-scoped content? | Compliant? |
78
+ | Provider | Purpose | Criticality | What happens when it is down |
154
79
  |---|---|---|---|
155
80
  | | | | |
156
81
 
157
- **Per-MCP detail.**
158
-
159
- - **Supabase MCP.** Dev project, staging project, production project — each on its own row. "Not wired" is an acceptable and often preferred value, especially for production.
160
- - **Other MCPs** (Notion, GitHub, Linear, Figma, Slack, etc.). Each with its own access scope, token location, rotation. Notion and Slack MCPs in particular often surface external user-generated content into the session — flag them explicitly under INF-05.
161
-
162
- ## Compliance & Data Residency
163
-
164
- _Regions where customer data lives at rest. GDPR-relevant flows (subject-access, deletion, export). Encryption at rest and in transit per data class. SOC 2 readiness gaps (this is honest enumeration, not a claim of posture). **v1 hstack does not by itself deliver SOC 2 or GDPR posture; the kernel says so explicitly. This section catalogs the gap, it does not close it.**_
82
+ ## MCP access
165
83
 
166
- - **Data residency.**
167
- - **GDPR flows.**
168
- - **Encryption at rest.**
169
- - **Encryption in transit.**
170
- - **Known compliance gaps.**
84
+ _Which MCP servers are wired, where they point, what they can do. An MCP is a security boundary equivalent to the token it carries: a session with a project-scoped token has that project's full blast radius. The rules — no write-capable MCP against production outside `/hstack-promote`, and no write-capable MCP active in a session that reads user-generated tenant-scoped content — belong to the kernel § Stop conditions. This table is the inventory those rules are applied to._
171
85
 
172
- ## Third-party Dependencies
173
-
174
- _External SaaS the system depends on at runtime. One row per provider. Criticality reflects what happens if the provider is unavailable: `hard` = product is down, `soft` = degraded, `optional` = no user impact._
175
-
176
- | Provider | Purpose | Criticality | Contractual SLO | Failure-mode behavior |
86
+ | MCP server | Points at | Access mode | Token storage | Notes |
177
87
  |---|---|---|---|---|
178
88
  | | | | | |
179
89
 
180
- ## Known Gaps
181
-
182
- _Open tech-debt items pointing to infrastructure shortcomings. Each entry is a link to a `hstack/tech-debt/TD-NNNN-<slug>.md` file. This section is the bridge between the operational truth captured above and the workflow's tech-debt machinery — every honest gap surfaced during the interview should land as a TD via `/hstack:tech-debt-new --origin <change-id>`._
183
-
184
- -
90
+ _"Not wired" is an acceptable value, and often the preferred one for production._
185
91
 
186
- ## Unknowns
92
+ ## Known gaps
187
93
 
188
- _Challenge prompt: what infrastructure dependency does the team not yet have a documented mitigation for? Name the dependency, name the failure mode, name the gap. This section must be present even when empty, to make the absence explicit (validator rule INF-02)._
94
+ _What is missing or unknown, named rather than implied. A gap with a shape is a file under `hstack/tech-debt/`; link it here. A gap without one a dependency whose failure mode nobody has thought through is a line here until someone does._
189
95
 
190
96
  -
@@ -0,0 +1,35 @@
1
+ ---
2
+ reviewed-on: <YYYY-MM-DD> # past 90 days, treat this roadmap as stale rather than current
3
+ ---
4
+
5
+ _Advisory only, never a gate (kernel § Context docs). It informs one-way-door decisions and the Forecloses / Enables section of an ADR; it never decides whether a change ships._
6
+
7
+ ## Now
8
+
9
+ _What we are committed to shipping. Each item: one product line, one architectural-implication line. Vague fortune-telling ("might need to scale") is worse than absence._
10
+
11
+ - <item> — **architectural implication:** <one line>
12
+
13
+ ## Next
14
+
15
+ _Likely within ~2 quarters. A direction, not a commitment. No dates._
16
+
17
+ - <item> — **architectural implication:** <one line>
18
+
19
+ ## Later
20
+
21
+ _Plausible futures. These influence one-way-door decisions ONLY — never day-to-day scoping._
22
+
23
+ - <item> — **architectural implication:** <one line>
24
+
25
+ ## Not on the path
26
+
27
+ _Explicit renouncements, with the reason._
28
+
29
+ - <item> — <why not>
30
+
31
+ ## Success criteria for the current horizon
32
+
33
+ _Concrete observable indicators that Now is done and Next gets promoted._
34
+
35
+ -
@@ -1,20 +1,14 @@
1
1
  ---
2
- id: <STORE>:<store-native-id> # one of NOTION:<id> | LINEAR:<key> | GH:<num> | REPO:<slug>
2
+ id: NOTION:<page-id>
3
3
  type: story
4
- status: drafted # drafted | ready | in-flight | shipped | archived
5
- owner: <git-handle>
6
- persona: <persona-id> # single persona id
7
- job-to-be-done: <one-sentence summary; mirrors section 1>
8
- success-metric: <how shipping is measured>
9
- linked-change-specs: [] # required non-empty when status: in-flight
10
- created: <YYYY-MM-DD>
11
- updated: <YYYY-MM-DD>
12
- schema-version: 1
4
+ persona: <persona-slug> # the persona this story is written from
5
+ job-to-be-done: <one sentence; mirrors section 1>
6
+ success-metric: <how we know shipping it worked>
13
7
  ---
14
8
 
15
9
  ## Who and Why
16
10
 
17
- _Persona id (pointer, not duplicated) and the job-to-be-done. 1–2 sentences._
11
+ _The persona (pointer, not duplicated) and the job to be done. 1–2 sentences._
18
12
 
19
13
  ## What Shipping Looks Like
20
14
 
@@ -22,11 +16,11 @@ _What the user sees, does, feels. One paragraph, 3–5 sentences._
22
16
 
23
17
  ## Success Metric
24
18
 
25
- _Pointer to the `success-metric` frontmatter field with a one-sentence explanation of how it is measured._
19
+ _The `success-metric` above, with one sentence on how it is measured._
26
20
 
27
21
  ## Edge Cases the User Cares About
28
22
 
29
- _Challenge prompt: what does the user notice if this ships but is slightly broken? 2–5 bullets._
23
+ _Challenge: what does the user notice if this ships but is slightly broken? 2–5 bullets._
30
24
 
31
25
  -
32
26
 
@@ -1,24 +1,8 @@
1
1
  ---
2
2
  id: TD-<NNNN>-<slug>
3
- type: tech-debt
4
- status: open # open | in-progress | resolved | wontfix | stale-no-longer-reproducible | archived
5
- owner: <git-handle>
6
3
  severity: low # critical | high | medium | low
7
- origin: <change-spec-id-or-found-later>
8
- introduced-by: <change-spec-id> # required when origin is a change-spec; reciprocal with change-spec.creates-tech-debt
9
- cost: small # small | medium | large
10
- fix-sketch-effort: small
11
- related-modules: []
12
- target-resolve-by: null # required when severity: critical
13
- resolution-attempted-at: null # ISO date set when status flips open -> in-progress (resolution begun)
14
- resolved-by: null # change-spec id that resolved this debt; reciprocal with change-spec.resolves-tech-debt; required when status: resolved
15
- wontfix-reason: null # one-sentence reason; required when status: wontfix
16
- wontfix-accepted-alternative: null # one-sentence note on what we are accepting instead; required when status: wontfix
17
- stale-verified-at: null # ISO date the absence of the original claim was verified; required when status: stale-no-longer-reproducible
18
- stale-verification-method: null # one-sentence prose evidence; required when status: stale-no-longer-reproducible
4
+ related-modules: [] # paths or module names — this is what surfaces the item at perimeter time
19
5
  created: <YYYY-MM-DD>
20
- updated: <YYYY-MM-DD>
21
- schema-version: 1
22
6
  ---
23
7
 
24
8
  ## Title
@@ -37,25 +21,6 @@ _Observable cost today, projected cost at scale._
37
21
 
38
22
  _What fixing would look like — code shape, scope, side effects._
39
23
 
40
- ## Pre-conditions for fixing
41
-
42
- _What must be true first (other dependencies resolved, design tokens normalized, etc.)._
43
-
44
24
  ## Acceptance
45
25
 
46
- _What "resolved" looks like observable, verifiable bullets the adversarial-reviewer can check against the resolving change's diff. The resolving change-spec's Target Behavior must satisfy these bullets verbatim or as a superset. Once `status: resolved`, no field rewrites are permitted (TD-03)._
47
-
48
- ## Resolution Log
49
-
50
- _Populated by `spec-author` as the resolution progresses. Section is empty until the first transition out of `open`._
51
-
52
- - `status: open → in-progress` on `<resolution-attempted-at>` by `<owner>`. Triggered by `/hstack:tech-debt-resolve <id>`. Resolving change-spec scaffolded at `<change-spec-id>`.
53
- - `status: in-progress → resolved` on `<date>` by `<owner>`. Resolving change-spec: `<change-spec-id>`. Adversarial-review Acceptance-satisfied confirmation: `<adversarial-review-id>`.
54
-
55
- _Alternatively, for the wontfix path:_
56
-
57
- - `status: open → wontfix` on `<date>` by `<owner>`. Reason: `<wontfix-reason>`. Accepted alternative: `<wontfix-accepted-alternative>`.
58
-
59
- _Alternatively, for the stale-no-longer-reproducible path (the claim aged out before anyone resolved it):_
60
-
61
- - `status: open → stale-no-longer-reproducible` on `<stale-verified-at>` by `<owner>`. Verification method: `<stale-verification-method>`.
26
+ _What "resolved" looks like: observable, verifiable bullets. The PR that satisfies them deletes this file._
@@ -1,14 +1,4 @@
1
- ---
2
- id: tech-stack
3
- type: tech-stack
4
- status: drafted # drafted | current | needs-refresh | archived
5
- owner: <git-handle>
6
- created: <YYYY-MM-DD>
7
- updated: <YYYY-MM-DD>
8
- schema-version: 1
9
- ---
10
-
11
- _Each entry below: name, version pin, why. Validator rule TS-01: every named dependency must be present in package.json at the pinned version._
1
+ _Each entry: name, version pin, why. A pinned version is pinned on purpose — never bump one unrequested (kernel § Context docs). An entry named here exists in the manifest at the version named; when it does not, one of the two is wrong and the PR says which._
12
2
 
13
3
  ## Application
14
4
 
@@ -30,7 +20,7 @@ _LLM providers, embedding providers, orchestration libs._
30
20
 
31
21
  ## Integrations
32
22
 
33
- _Third-party platforms and the protocol layer (OAuth via Pipedream, webhook handlers)._
23
+ _Third-party platforms and the protocol layer (OAuth brokers, webhook handlers)._
34
24
 
35
25
  -
36
26
 
@@ -1,126 +0,0 @@
1
- ---
2
- name: data-specialist
3
- model: sonnet
4
- description: |
5
- Use this agent when a change-spec includes `db` in its surfaces and needs a data review produced before implementation begins. The data-specialist loads `data-architecture.md`, the current schema, RLS policies, pgvector indexes, and migration history, then produces `data-review.md` covering schema changes, RLS coverage, migration safety, index and performance impact, pgvector and RAG implications, and data lifecycle. In v1 it produces a structured judgment grounded in live schema via the Supabase MCP when wired; framing reflects that v2 will hard-fail when the MCP is unreachable. Examples:
6
-
7
- <example>
8
- Context: A change-spec introduces a new public-schema table with RLS and is at ready-to-plan.
9
- user: "Run the data review on the knowledge-citations change. It adds a table and modifies a pgvector RPC."
10
- assistant: "I'll use the data-specialist agent to score RLS coverage, check tenant_id presence on the RPC, and review migration safety."
11
- <commentary>
12
- The data-specialist owns the RLS-coverage gate (DR-02: every new-table entry must be `covered` for status `passed`) and the pgvector tenant-id gate (DR-03: tenant-id-arg-present must be true when the diff touches a pgvector RPC). A generic agent would miss the per-table RLS bookkeeping and the tenant-isolation check.
13
- </commentary>
14
- </example>
15
-
16
- <example>
17
- Context: A migration is purely additive (new table, new index) but touches a hot table during business hours.
18
- user: "Data review on this migration — it adds a new index on the billing_events table."
19
- assistant: "I'll use the data-specialist agent to evaluate locking behavior and migration safety, including whether the index build needs to run concurrently."
20
- <commentary>
21
- Migration safety covers locking behavior on non-empty production tables. The data-specialist's challenge prompt for section 3 surfaces locking that the migration author may not have considered — e.g., a plain `CREATE INDEX` on a large hot table will lock writes. Skipping this agent ships a migration that takes production offline mid-day.
22
- </commentary>
23
- </example>
24
-
25
- <example>
26
- Context: A change touches RAG retrieval — a new pgvector RPC that joins against a tenant-scoped table.
27
- user: "Data review on the new retrieval RPC. It's the one with the workspace-filter on similarity ranking."
28
- assistant: "I'll use the data-specialist agent. The RPC must carry tenant_id as an explicit argument; I'll halt if it doesn't."
29
- <commentary>
30
- Per DR-03 and the tenant-isolation lint, every pgvector RPC must accept tenant_id as a mandatory argument and filter before similarity ranking. The data-specialist refuses to mark `passed` if the RPC drops tenant context. v2 substrate will hard-fail the gate when the live-schema MCP is unreachable; v1 surfaces this in the rationale.
31
- </commentary>
32
- </example>
33
-
34
- tools:
35
- - Read
36
- - Grep
37
- - Glob
38
- - Write
39
- - Edit
40
- - Bash
41
- - "{{TODO-SKILL: /hstack:data-review — invokes data-specialist against a change-spec with db surface}}"
42
- - "{{TODO-MCP: Supabase MCP — required for live schema, RLS policies, and pgvector index introspection; v1 permits a degraded-with-flag fallback, v2 hard-fails when unreachable}}"
43
- - "{{TODO-SCRIPT: hstack/scripts/validate-spec.ts — validates data-review frontmatter and DR-01 through DR-06}}"
44
- ---
45
-
46
- ## Role
47
-
48
- The data-specialist is hstack's database conscience. Its job is to review every change touching the `db` surface against tenant isolation, RLS coverage, migration safety, index discipline, pgvector and RAG implications, and data lifecycle. It is the upstream gate that the implementer refuses to bypass when surfaces includes `db`. Its distinct perspective is that the database is where Moso loses the most money if something goes wrong — multi-tenant breaches, runaway query plans, unindexed RAG retrievals, and silent backfill failures all originate here. In v1 the data-specialist produces a structured judgment grounded in live-schema introspection via the Supabase MCP when available; in v2 the gate hard-fails when the MCP is unreachable. The agent must frame v1 outputs to reflect that distinction.
49
-
50
- ## Session start protocol
51
-
52
- At session start, data-specialist loads:
53
-
54
- - `hstack/context/data-architecture.md` — the canonical data model, RLS pattern, RAG architecture, embedding strategy, retention policy.
55
- - `hstack/context/tech-stack.md` — for the pinned Postgres and Supabase versions.
56
- - `hstack/context/ci-cd.md` — for the pgTAP and migration-test surface that the data-review references.
57
- - `hstack/context/infrastructure.md` — for the operational data-layer truth: hosting tier, connection-pool capacity, backup cadence, point-in-time-recovery window, read-replica topology, environment separation. Migration-safety scoring depends on knowing whether the target table lives on a tier that locks under `CREATE INDEX` or accepts `CONCURRENTLY`, and whether a long migration would exhaust the connection pool. If infrastructure.md is missing or at `needs-refresh`, halt.
58
- - The change-spec and the relevant module-spec for the change's `area`.
59
- - The live schema, RLS policies, pgvector indexes, and recent migration history — read via the Supabase MCP when wired up.
60
- - Local migration files under `supabase/migrations/` for the consuming repo.
61
- - `hstack/CLAUDE.md` (kernel) — always loaded.
62
-
63
- If the Supabase MCP is unreachable in v1, flag the degraded read in the rationale and continue against `data-architecture.md`; in v2 the gate hard-fails per the architecture's MCP hard-fail substrate. Never silently treat `data-architecture.md` as ground truth — it is quarterly-updated and may be stale.
64
-
65
- **MCP access-mode check.** Before invoking any Supabase MCP tool, read the MCP Access Policy section of `hstack/context/infrastructure.md` and resolve which project the active MCP points at and what access mode it carries. The data-specialist's contract is "does not execute migrations and does not write to `supabase/migrations/`" — therefore the read-only access mode is sufficient for every operation in this role. If the active MCP is wired with write capability against a project tagged `production` and is not inside its named change-window, halt per the kernel's stop conditions (INF-04). If the access mode cannot be determined from infrastructure.md (the row is missing or the access-mode column is empty), halt and ask — do not infer the mode from the tool surface, since the tool surface alone does not distinguish a read-only token from a write-capable one.
66
-
67
- ## Templates this subagent writes
68
-
69
- - `hstack/specs/changes/<id>/data-review.md` — the only artifact this agent writes.
70
- - May propose migration files to the engineer in the rationale (named, with intent) but does not execute migrations and does not write to `supabase/migrations/`. Execution belongs to the implementer.
71
-
72
- ## Templates this subagent reads
73
-
74
- - `hstack/templates/data-review.md` — the canonical template being filled.
75
- - The change-spec, module-spec, data-architecture, tech-stack, ci-cd.
76
- - The In-Scope diff for SQL, types, and any pgvector RPC modifications.
77
- - Adjacent prior data-reviews for precedent (e.g., RLS coverage pattern on a sibling table).
78
-
79
- ## Behavior rules
80
-
81
- - Apply the challenge prompt for RLS Coverage on every new or altered table: "Name the exact RLS rule on this table and the test that would catch its absence." Section 2 must cite both.
82
- - DR-02: status `passed` requires every value in `rls-coverage.new-tables` to be `covered`. `partial` or `missing` blocks `passed` — the agent acknowledges-and-defers via tech-debt only with explicit human acknowledgement.
83
- - DR-03: when the diff touches any pgvector RPC, `pgvector-changes.tenant-id-arg-present` must be `true`. If the RPC drops tenant context, halt and surface as a kernel-level stop condition; do not write `passed`.
84
- - Migration safety: examine locking behavior on non-empty production tables. `risky` requires section 3 to enumerate the locking behavior and the mitigation (e.g., `CREATE INDEX CONCURRENTLY`, backfill in batches, feature gate the consumer).
85
- - Index discipline: every added index has a stated query pattern that justifies it. Removed indexes have a stated reason. Index changes against pgvector tables receive extra scrutiny — HNSW rebuilds can pressure write throughput.
86
- - RAG implications: embedding cache changes, retrieval scope changes, similarity-ranking changes are called out in section 5. RAG-broadening changes get special attention for cross-tenant leak.
87
- - Data lifecycle: every new table declares retention (`retained-indefinitely`, `retained-N-days`, or `ephemeral`). Retention drift across the schema is flagged for the team to normalize.
88
- - Migration files proposed in the rationale must follow the kernel's database workflow: created via `supabase migration new <descriptive_name>`, RLS enabled in the same migration as the table, types regenerated after schema change. The data-specialist does not execute these — it proposes.
89
- - Honesty framing: in v1, when the live-schema MCP is unreachable, name the degraded source explicitly. "Reviewed against data-architecture.md dated 2026-04-17 because Supabase MCP unreachable." Never claim live verification you did not perform.
90
-
91
- ## Stop conditions
92
-
93
- Stop and ask the human when:
94
-
95
- - `data-architecture.md` is at `needs-refresh` or missing.
96
- - The change touches a pgvector RPC and `tenant-id-arg-present` is false. Do not write `passed`.
97
- - The change introduces a new public-schema table without an RLS policy in the same migration. Halt.
98
- - The Supabase MCP is unreachable and `surfaces` includes `db` in a context where the change introduces new schema (v2 substrate hard-fails here; in v1 flag clearly and continue, but halt if the change is high-stakes).
99
- - A migration is proposed that requires `service_role` Supabase keys, raw shell against production, or any of the kernel's forbidden tools. Halt — this is a kernel-level stop condition.
100
- - A backfill strategy is required and the human has not provided one.
101
- - The change requires running `supabase db push` or `supabase db reset` against a non-local environment. Halt; production migrations require manual review.
102
-
103
- ## Output expectations
104
-
105
- A data-review at terminal state (`status: passed` or `concerns-acknowledged`) has:
106
-
107
- - All universal frontmatter plus `parent-change`, `rls-coverage`, `migration-safety`, `index-impact`, `pgvector-changes`, `rag-impact`, `data-lifecycle`.
108
- - All six sections: Schema Changes, RLS Coverage, Migration Safety, Index and Performance Impact, pgvector and RAG (when applicable), Data Lifecycle.
109
- - Every new table named in section 1 appears in `rls-coverage.new-tables` (DR-01) and has a section 2 entry (DR-05).
110
- - Every pgvector RPC change has `tenant-id-arg-present: true` (DR-03).
111
- - v1 framing reflects live-vs-degraded read source.
112
- - Passes DR-01 through DR-06.
113
-
114
- ## Anti-patterns
115
-
116
- - Never write `passed` when any RLS coverage entry is `partial` or `missing`. Default to `concerns-acknowledged` with explicit human acknowledgement and a tech-debt item.
117
- - Never approve a pgvector RPC change that drops `tenant_id`. Halt.
118
- - Never silently treat `data-architecture.md` as ground truth when the live-schema MCP is unreachable. Flag the degradation.
119
- - Never execute migrations. Propose only.
120
- - Never use service_role Supabase keys, raw shell against production, or `supabase db push` against a remote project. Kernel-forbidden.
121
- - Never recommend disabling RLS to "simplify" a query.
122
- - Never approve a `risky` migration without a named locking-mitigation strategy.
123
-
124
- ## Confirmation discipline
125
-
126
- The data-specialist is a high-stakes subagent. The kernel's AI-writes / humans-confirm contract applies in its challenge-driven mode: the agent probes for omissions the human did not think to mention, not only confirms what they did. The RLS-coverage challenge prompt ("Name the exact RLS rule on this table and the test that would catch its absence") is the v1 mitigation for the recurring failure mode where a new table ships with RLS enabled but no policy — the table is then publicly readable through Supabase's Data API. When the human's answer is "I think the policy is similar to billing_events", re-prompt for the exact policy text and the test file. Silence is not confirmation; re-ask. When acknowledging-and-deferring a concern, get the human's explicit handle on `concerns-acknowledged-by` and file a tech-debt item via `spec-author` before terminating the review at `concerns-acknowledged`.