hstack 0.1.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 (99) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/LICENSE +21 -0
  3. package/README.md +169 -0
  4. package/VERSION +1 -0
  5. package/dist/cli.js +55 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/commands/doctor.js +155 -0
  8. package/dist/commands/doctor.js.map +1 -0
  9. package/dist/commands/init.js +87 -0
  10. package/dist/commands/init.js.map +1 -0
  11. package/dist/commands/update.js +118 -0
  12. package/dist/commands/update.js.map +1 -0
  13. package/dist/lib/diff.js +120 -0
  14. package/dist/lib/diff.js.map +1 -0
  15. package/dist/lib/git.js +26 -0
  16. package/dist/lib/git.js.map +1 -0
  17. package/dist/lib/paths.js +35 -0
  18. package/dist/lib/paths.js.map +1 -0
  19. package/dist/lib/wire.js +314 -0
  20. package/dist/lib/wire.js.map +1 -0
  21. package/dist/manifest.js +53 -0
  22. package/dist/manifest.js.map +1 -0
  23. package/package.json +54 -0
  24. package/template/.claude/agents/adversarial-reviewer.md +123 -0
  25. package/template/.claude/agents/data-specialist.md +126 -0
  26. package/template/.claude/agents/implementer.md +154 -0
  27. package/template/.claude/agents/planner.md +110 -0
  28. package/template/.claude/agents/product-manager.md +111 -0
  29. package/template/.claude/agents/researcher.md +123 -0
  30. package/template/.claude/agents/security-reviewer.md +123 -0
  31. package/template/.claude/agents/spec-author.md +118 -0
  32. package/template/.claude/agents/test-strategist.md +129 -0
  33. package/template/.claude/agents/ui-ux-briefer.md +105 -0
  34. package/template/.claude/agents/verifier.md +109 -0
  35. package/template/.claude/skills/hstack-adr-new/SKILL.md +118 -0
  36. package/template/.claude/skills/hstack-adversarial-review/SKILL.md +187 -0
  37. package/template/.claude/skills/hstack-branch/SKILL.md +103 -0
  38. package/template/.claude/skills/hstack-change-new/SKILL.md +109 -0
  39. package/template/.claude/skills/hstack-change-plan/SKILL.md +119 -0
  40. package/template/.claude/skills/hstack-commit/SKILL.md +122 -0
  41. package/template/.claude/skills/hstack-configure/SKILL.md +126 -0
  42. package/template/.claude/skills/hstack-data-review/SKILL.md +132 -0
  43. package/template/.claude/skills/hstack-finalize/SKILL.md +159 -0
  44. package/template/.claude/skills/hstack-help/SKILL.md +174 -0
  45. package/template/.claude/skills/hstack-implement/SKILL.md +185 -0
  46. package/template/.claude/skills/hstack-init/SKILL.md +152 -0
  47. package/template/.claude/skills/hstack-module-spec/SKILL.md +105 -0
  48. package/template/.claude/skills/hstack-research/SKILL.md +145 -0
  49. package/template/.claude/skills/hstack-security-review/SKILL.md +133 -0
  50. package/template/.claude/skills/hstack-ship/SKILL.md +128 -0
  51. package/template/.claude/skills/hstack-story-draft/SKILL.md +117 -0
  52. package/template/.claude/skills/hstack-tech-debt-new/SKILL.md +122 -0
  53. package/template/.claude/skills/hstack-tech-debt-resolve/SKILL.md +158 -0
  54. package/template/.claude/skills/hstack-tech-debt-stale/SKILL.md +113 -0
  55. package/template/.claude/skills/hstack-tech-debt-wontfix/SKILL.md +104 -0
  56. package/template/.claude/skills/hstack-telemetry/SKILL.md +96 -0
  57. package/template/.claude/skills/hstack-test-plan/SKILL.md +182 -0
  58. package/template/.claude/skills/hstack-ui-brief/SKILL.md +108 -0
  59. package/template/.claude/skills/hstack-verify/SKILL.md +139 -0
  60. package/template/CLAUDE.md +390 -0
  61. package/template/scripts/telemetry/__init__.py +6 -0
  62. package/template/scripts/telemetry/insights/__init__.py +0 -0
  63. package/template/scripts/telemetry/insights/contract_drift.py +137 -0
  64. package/template/scripts/telemetry/insights/overengineering.py +115 -0
  65. package/template/scripts/telemetry/insights/quality_outcomes.py +131 -0
  66. package/template/scripts/telemetry/insights/token_economics.py +129 -0
  67. package/template/scripts/telemetry/insights/workflow_shape.py +198 -0
  68. package/template/scripts/telemetry/parsers/__init__.py +0 -0
  69. package/template/scripts/telemetry/parsers/bodies.py +87 -0
  70. package/template/scripts/telemetry/parsers/commits.py +219 -0
  71. package/template/scripts/telemetry/parsers/frontmatter.py +322 -0
  72. package/template/scripts/telemetry/parsers/transcripts.py +181 -0
  73. package/template/scripts/telemetry/render.py +311 -0
  74. package/template/scripts/telemetry/report.py +112 -0
  75. package/template/templates/adr.md +38 -0
  76. package/template/templates/adversarial-review.md +54 -0
  77. package/template/templates/change-spec.md +80 -0
  78. package/template/templates/ci-cd.md +27 -0
  79. package/template/templates/data-architecture.md +35 -0
  80. package/template/templates/data-review.md +54 -0
  81. package/template/templates/figma-handoff.md +38 -0
  82. package/template/templates/glossary.md +20 -0
  83. package/template/templates/hardening-checklist.md +73 -0
  84. package/template/templates/incident-runbook.md +57 -0
  85. package/template/templates/infrastructure.md +190 -0
  86. package/template/templates/module-spec.md +49 -0
  87. package/template/templates/mvp-scope.md +34 -0
  88. package/template/templates/persona.md +38 -0
  89. package/template/templates/plan.md +49 -0
  90. package/template/templates/security-review.md +63 -0
  91. package/template/templates/story.md +37 -0
  92. package/template/templates/tech-debt.md +61 -0
  93. package/template/templates/tech-stack.md +41 -0
  94. package/template/templates/telemetry-sidecar.md +184 -0
  95. package/template/templates/test-plan.md +119 -0
  96. package/template/templates/threat-model.md +54 -0
  97. package/template/templates/ui-brief.md +49 -0
  98. package/template/templates/verification.md +63 -0
  99. package/template/templates/vision.md +34 -0
@@ -0,0 +1,54 @@
1
+ ---
2
+ id: <parent-change-id>-adversarial-review
3
+ type: adversarial-review
4
+ status: draft # draft | in-progress | findings-open | findings-resolved | superseded
5
+ owner: <git-handle>
6
+ parent-change: <change-spec-id>
7
+ findings-floor: 3 # 3 default; 5 when change-spec.area in {agent, auth, billing}
8
+ findings: [] # array of finding records; see below
9
+ findings-fewer-than-floor: false
10
+ justification-when-fewer: null # required when findings-fewer-than-floor: true
11
+ fresh-session-attestation: <session-id; opened <ISO-8601>; no implementer transcript loaded>
12
+ created: <YYYY-MM-DD>
13
+ updated: <YYYY-MM-DD>
14
+ schema-version: 1
15
+ ---
16
+
17
+ <!--
18
+ Finding record shape:
19
+ - id: F-NN
20
+ category: security | scope-drift | invariant-breach | spec-compliance | data-integrity | code-quality
21
+ severity: critical | high | medium | low
22
+ status: open | resolved
23
+ resolution: commit:<hash> | tech-debt:<id> | justified-in-prose
24
+ -->
25
+
26
+ ## Methodology
27
+
28
+ _Fresh-session attestation; what artifacts were loaded; how findings were generated. v1 honor system; v2 verifies via session-id._
29
+
30
+ ## Findings
31
+
32
+ _One subsection per finding (F-01..F-N). Mandate: at least `findings-floor` findings across categories, or `findings-fewer-than-floor: true` with justification._
33
+
34
+ ### F-01
35
+
36
+ **Category.**
37
+
38
+ **What.** _The observation. 1–3 sentences._
39
+
40
+ **Why it matters.** _The consequence if left unaddressed._
41
+
42
+ **Severity rationale.**
43
+
44
+ **Recommendation.**
45
+
46
+ **Resolution.** _Commit hash, tech-debt id, or in-prose justification — must mirror the `resolution` value in frontmatter._
47
+
48
+ ## Resolution Log
49
+
50
+ _Append-only record of how each finding was resolved. Written by `owner` in response to findings._
51
+
52
+ ## Findings Floor Justification
53
+
54
+ _Populated only when `findings-fewer-than-floor: true`. Explain why fewer than the floor is the honest answer._
@@ -0,0 +1,80 @@
1
+ ---
2
+ id: <YYYY-MM-area-slug>
3
+ type: change-spec
4
+ status: draft
5
+ owner: <git-handle>
6
+ area: <module-spec-id>
7
+ surfaces: [] # subset of [ui, api, db, infra, agent]
8
+ user-stories: []
9
+ related-spec: <module-spec-id> # must equal `area`
10
+ related-adrs: []
11
+ creates-tech-debt: []
12
+ resolves-tech-debt: [] # tech-debt ids this change is intended to fully resolve; reciprocal with tech-debt.resolved-by
13
+ parent-change: null
14
+ children: []
15
+ revisits-change: [] # change-spec ids this change is filed to repair (defects, regressions, missed findings). Informational, not gating.
16
+ internal-tooling: false
17
+ trivial: false
18
+ in-scope: [] # repo-relative globs; must be non-empty
19
+ out-of-scope: [] # required, may be empty
20
+ threat-model-delta: false # set true when surfaces touches agent | auth | api | db
21
+ created: <YYYY-MM-DD>
22
+ updated: <YYYY-MM-DD>
23
+ schema-version: 1
24
+ ---
25
+
26
+ ## Problem
27
+
28
+ _What is broken or missing today, in user terms. One paragraph, 4–6 sentences._
29
+
30
+ ## Current Behavior
31
+
32
+ _Observable behavior as it stands, including known gotchas. You may grep the In-Scope files to verify. 2–4 bullets._
33
+
34
+ -
35
+
36
+ ## Target Behavior
37
+
38
+ _What shipping looks like, observably. 2–4 bullets._
39
+
40
+ -
41
+
42
+ ## Acceptance Criteria
43
+
44
+ _GIVEN / WHEN / THEN form. At least one block per surface declared. Reviewed by product-manager when `surfaces` includes `ui`._
45
+
46
+ GIVEN
47
+ WHEN
48
+ THEN
49
+
50
+ ## Invariants
51
+
52
+ _Name at least three things that look like they could change but must not. If you cannot name three, why is the change so narrow? (Validator rule SP-04.)_
53
+
54
+ -
55
+ -
56
+ -
57
+
58
+ ## Scope Boundaries
59
+
60
+ _Pointer to `in-scope` and `out-of-scope` frontmatter arrays. One-sentence justification per excluded sibling directory._
61
+
62
+ ## Surfaces
63
+
64
+ _Pointer to `surfaces` frontmatter. One sentence per surface explaining what is touched._
65
+
66
+ ## Linked Stories and Personas
67
+
68
+ _Pointers, not duplicated content._
69
+
70
+ ## Related ADRs and Tech-Debt
71
+
72
+ _Pointers with one-sentence justification each._
73
+
74
+ ## Resolves Tech-Debt
75
+
76
+ _Required and non-empty when `resolves-tech-debt` frontmatter is non-empty. For each TD-NNNN referenced: a pointer to the tech-debt artifact and a verbatim quote of its Acceptance section. The change-spec's Target Behavior must be a superset of (or exactly) the quoted Acceptance — the adversarial-reviewer checks that the diff actually satisfies it. Partial resolution is not supported in v1: list a TD here only when this change fully closes it; otherwise leave it off and let the next change pick it up._
77
+
78
+ ## Open Questions
79
+
80
+ _Populated when status moves from draft to ready-to-plan. Every question must be resolved or explicitly punted before ready-for-implementation._
@@ -0,0 +1,27 @@
1
+ ---
2
+ id: ci-cd
3
+ type: ci-cd
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
+ ## Branch model
12
+
13
+ _main, integrations, change/* — what each branch is for. Branch naming convention mirrors change-spec id._
14
+
15
+ ## Gates
16
+
17
+ _Every check in `.github/workflows/hstack-gates.yml` plus pre-existing CI checks. Validator rule CI-01: every gate named in the workflow file must appear here._
18
+
19
+ -
20
+
21
+ ## Deploy targets
22
+
23
+ _Preview, staging, production. What promotes to what. Manual vs automatic._
24
+
25
+ ## Rollback
26
+
27
+ _How to revert a bad deploy. Feature flags vs git revert vs DB migration rollback. Reference incident-runbook for production paths._
@@ -0,0 +1,35 @@
1
+ ---
2
+ id: data-architecture
3
+ type: data-architecture
4
+ status: drafted # drafted | current | needs-refresh | archived
5
+ owner: <git-handle>
6
+ schema-snapshot-date: <YYYY-MM-DD>
7
+ rag-architecture-version: 1
8
+ created: <YYYY-MM-DD>
9
+ updated: <YYYY-MM-DD>
10
+ schema-version: 1
11
+ ---
12
+
13
+ ## Tables and relationships
14
+
15
+ _ER diagram in mermaid or prose. The canonical tables, columns of interest, and foreign-key relationships._
16
+
17
+ ## RLS model
18
+
19
+ _The universal pattern + per-table deviations. Validator rule DA-01: this section must contain the word "RLS" in a heading._
20
+
21
+ ## RAG and embeddings
22
+
23
+ _Where embeddings live, how retrieval is scoped, what the cache looks like, how tenant_id is enforced on every RPC._
24
+
25
+ ## Data lifecycle
26
+
27
+ _Retention, archival, deletion. Per-table policies._
28
+
29
+ ## External data sources
30
+
31
+ _Third-party integrations that write to our store. Webhook signature verification posture._
32
+
33
+ ## Conventions
34
+
35
+ _Naming, soft-deletes vs hard-deletes, audit fields, timestamp conventions, UUID vs serial._
@@ -0,0 +1,54 @@
1
+ ---
2
+ id: <parent-change-id>-data-review
3
+ type: data-review
4
+ status: draft # draft | in-progress | passed | concerns-acknowledged | failed | superseded
5
+ owner: <git-handle>
6
+ parent-change: <change-spec-id>
7
+ rls-coverage:
8
+ new-tables: {} # { <table_name>: covered | partial | missing }
9
+ migration-safety: safe # safe | needs-backfill | risky
10
+ index-impact:
11
+ added: []
12
+ removed: []
13
+ pgvector-changes:
14
+ rpcs-modified: []
15
+ tenant-id-arg-present: true # required true when any pgvector RPC is in the diff
16
+ rag-impact: none # scoped | broadened | narrowed | none
17
+ data-lifecycle: retained-indefinitely # retained-indefinitely | retained-N-days | ephemeral
18
+ created: <YYYY-MM-DD>
19
+ updated: <YYYY-MM-DD>
20
+ schema-version: 1
21
+ ---
22
+
23
+ ## Schema Changes
24
+
25
+ _Every table created, altered, or dropped; every column added, renamed, or dropped._
26
+
27
+ ## RLS Coverage
28
+
29
+ _For every new or altered table: the policy and the test that verifies it. Challenge prompt: name the exact RLS rule on this table and the test that would catch its absence._
30
+
31
+ ### <table-name>
32
+
33
+ **Policy.**
34
+
35
+ ```sql
36
+ ```
37
+
38
+ **Test.**
39
+
40
+ ## Migration Safety
41
+
42
+ _What the migration does on a non-empty production table. Locking behavior. Backfill plan if any. When `migration-safety: risky`, this section must enumerate locking and mitigation (DR-04)._
43
+
44
+ ## Index and Performance Impact
45
+
46
+ _Indexes added or removed. Expected query patterns. Expected row counts at 1 month, 1 year._
47
+
48
+ ## pgvector and RAG
49
+
50
+ _Required when any pgvector RPC is in the diff. RPCs touched, tenant_id presence, embedding cache implications._
51
+
52
+ ## Data Lifecycle
53
+
54
+ _Retention, expiry, archival. Pointer to `data-lifecycle` frontmatter with rationale._
@@ -0,0 +1,38 @@
1
+ ---
2
+ id: <parent-change-id>-figma
3
+ type: figma-handoff
4
+ status: draft # draft | ready | superseded
5
+ owner: <cofounder-handle>
6
+ parent-change: <change-spec-id>
7
+ figma-frame-urls: [] # list of Figma frame URLs
8
+ design-system-version: <version> # must match parent ui-brief.design-system-version
9
+ created: <YYYY-MM-DD>
10
+ updated: <YYYY-MM-DD>
11
+ schema-version: 1
12
+ ---
13
+
14
+ ## Frame Index
15
+
16
+ _Table of frame URLs with state descriptions. Three columns max._
17
+
18
+ | state | frame URL | notes |
19
+ | --- | --- | --- |
20
+ | | | |
21
+
22
+ ## Implementation Notes
23
+
24
+ _Anything the engineer needs to know that Figma cannot encode: animation timings, conditional rendering, copy fallbacks._
25
+
26
+ ## Open Questions
27
+
28
+ _Anything the cofounder is uncertain about. Resolve before status: ready._
29
+
30
+ ## Tokens Used
31
+
32
+ _Design tokens consumed. Flag any new tokens introduced — they belong in the design system, not in this change._
33
+
34
+ -
35
+
36
+ ## Sign-off
37
+
38
+ _Cofounder confirms screens are final. Initials + date._
@@ -0,0 +1,20 @@
1
+ ---
2
+ id: glossary
3
+ type: glossary
4
+ status: drafted # drafted | current | needs-refresh | archived
5
+ owner: <git-handle>
6
+ term-count: 0 # must match the number of term subsections in the body
7
+ created: <YYYY-MM-DD>
8
+ updated: <YYYY-MM-DD>
9
+ schema-version: 1
10
+ ---
11
+
12
+ _Terms with non-obvious meaning in the product. One subsection per term, alphabetical order. Each term: one-paragraph definition, one or more examples, cross-references to other terms or modules. Length cap: two paragraphs per term. Update `term-count` whenever a term is added or removed (validator rule GL-01)._
13
+
14
+ ## <Term>
15
+
16
+ **Definition.**
17
+
18
+ **Example.**
19
+
20
+ **See also.**
@@ -0,0 +1,73 @@
1
+ ---
2
+ id: hardening-checklist
3
+ type: hardening-checklist
4
+ status: drafted # drafted | current | needs-refresh | archived
5
+ owner: <git-handle>
6
+ last-quarterly-review: <YYYY-MM-DD>
7
+ layer-count: 10
8
+ created: <YYYY-MM-DD>
9
+ updated: <YYYY-MM-DD>
10
+ schema-version: 1
11
+ ---
12
+
13
+ _One section per layer. Each layer enumerates items with: item id, what it asserts, evidence required, not-applicable conditions. This is the artifact `security-review.md` scores against item-by-item. Validator rule HC-01: every layer that appears in a security-review `scores` map must exist as a section here._
14
+
15
+ ## data-at-rest
16
+
17
+ ### Item HC-DAR-01: <assertion>
18
+ **Evidence required.**
19
+ **Not-applicable when.**
20
+
21
+ ## data-in-transit
22
+
23
+ ### Item HC-DIT-01: <assertion>
24
+ **Evidence required.**
25
+ **Not-applicable when.**
26
+
27
+ ## authn
28
+
29
+ ### Item HC-AN-01: <assertion>
30
+ **Evidence required.**
31
+ **Not-applicable when.**
32
+
33
+ ## authz-rls
34
+
35
+ ### Item HC-AZ-01: <assertion>
36
+ **Evidence required.**
37
+ **Not-applicable when.**
38
+
39
+ ## tenant-isolation
40
+
41
+ ### Item HC-TI-01: <assertion>
42
+ **Evidence required.**
43
+ **Not-applicable when.**
44
+
45
+ ## input-validation
46
+
47
+ ### Item HC-IV-01: <assertion>
48
+ **Evidence required.**
49
+ **Not-applicable when.**
50
+
51
+ ## output-encoding
52
+
53
+ ### Item HC-OE-01: <assertion>
54
+ **Evidence required.**
55
+ **Not-applicable when.**
56
+
57
+ ## secrets-handling
58
+
59
+ ### Item HC-SH-01: <assertion>
60
+ **Evidence required.**
61
+ **Not-applicable when.**
62
+
63
+ ## agent-prompt-injection
64
+
65
+ ### Item HC-API-01: <assertion>
66
+ **Evidence required.**
67
+ **Not-applicable when.**
68
+
69
+ ## audit-logging
70
+
71
+ ### Item HC-AL-01: <assertion>
72
+ **Evidence required.**
73
+ **Not-applicable when.**
@@ -0,0 +1,57 @@
1
+ ---
2
+ id: incident-runbook
3
+ type: incident-runbook
4
+ status: drafted # drafted | current | needs-refresh | archived
5
+ owner: <git-handle>
6
+ git-ignored: true # this file MUST be gitignored; sensitive content
7
+ last-quarterly-review: <YYYY-MM-DD>
8
+ created: <YYYY-MM-DD>
9
+ updated: <YYYY-MM-DD>
10
+ schema-version: 1
11
+ ---
12
+
13
+ <!--
14
+ WARNING: This file contains sensitive operational content (auth provider details, revocation endpoints,
15
+ customer communication templates, phone tree). It MUST be gitignored. Per architecture amendment A7,
16
+ the file lives locally and is synced to an out-of-band destination configured in hstack/config.yaml as
17
+ `incident-runbook.sync-target`. Auto-commit does not apply to this file. The init Skill must add the
18
+ entry to .gitignore as part of bootstrap.
19
+ -->
20
+
21
+ ## Kill switches
22
+
23
+ _Feature flags and how to flip them, ordered by blast radius. Most-dangerous-first._
24
+
25
+ -
26
+
27
+ ## Revocation flows
28
+
29
+ _Per third-party: Stripe, Supabase, Pipedream, MCPs. Steps to revoke a session, an OAuth token, an API key._
30
+
31
+ ### Stripe
32
+
33
+ ### Supabase
34
+
35
+ ### Pipedream
36
+
37
+ ### MCPs
38
+
39
+ ## Customer communication
40
+
41
+ _Copy templates per severity (P0 / P1 / P2). Channels (in-app, email, status page)._
42
+
43
+ ### P0 template
44
+
45
+ ### P1 template
46
+
47
+ ### P2 template
48
+
49
+ ## Escalation contacts
50
+
51
+ _Owner phone tree. Mark each entry with privacy boundary (work-hours OK / 24-7 OK)._
52
+
53
+ -
54
+
55
+ ## Post-incident
56
+
57
+ _Runbook for the followup ADR or tech-debt write-up. Pointer to ADR template._
@@ -0,0 +1,190 @@
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
+ ---
11
+
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)._
13
+
14
+ ## Hosting & Compute
15
+
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 |
19
+ |---|---|---|---|---|
20
+ | | | | | |
21
+
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.**
32
+
33
+ ## Data Layer
34
+
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)._
36
+
37
+ - **Primary database.**
38
+ - **Connection pooling.**
39
+ - **Backups.**
40
+ - **Point-in-time recovery.**
41
+ - **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
92
+
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.**_
94
+
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.**_
105
+
106
+ | Service | Monthly spend (approx) | Budget alert at | Scale ceiling | Notes |
107
+ |---|---|---|---|---|
108
+ | | | | | |
109
+
110
+ - **Rate limits.**
111
+ - **Per-tenant quotas.**
112
+
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
+ | | | | | |
120
+
121
+ ## Blast-Radius Matrix
122
+
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)._
124
+
125
+ | Resource | Depends on | What dies if this dies | Notification path | Mitigation |
126
+ |---|---|---|---|---|
127
+ | | | | | |
128
+
129
+ ## Access & Change Control
130
+
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.**_
132
+
133
+ | Human | Provider | Scope | MFA enforced | Last access review |
134
+ |---|---|---|---|---|
135
+ | | | | | |
136
+
137
+ - **Audit log location.**
138
+ - **Audit log retention.**
139
+ - **Access review cadence.**
140
+
141
+ ## MCP Access Policy
142
+
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._
144
+
145
+ | MCP server | Wired at | Points at | Access mode | Token storage | Rotation cadence | Notes |
146
+ |---|---|---|---|---|---|---|
147
+ | | | | | | | |
148
+
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.
150
+
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.
152
+
153
+ | Session pattern | Write-capable MCP tools active? | Reads tenant-scoped content? | Compliant? |
154
+ |---|---|---|---|
155
+ | | | | |
156
+
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.**_
165
+
166
+ - **Data residency.**
167
+ - **GDPR flows.**
168
+ - **Encryption at rest.**
169
+ - **Encryption in transit.**
170
+ - **Known compliance gaps.**
171
+
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 |
177
+ |---|---|---|---|---|
178
+ | | | | | |
179
+
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
+ -
185
+
186
+ ## Unknowns
187
+
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)._
189
+
190
+ -
@@ -0,0 +1,49 @@
1
+ ---
2
+ id: <module-key> # equals the module key in hstack/config.yaml
3
+ type: module-spec
4
+ status: drafted # drafted | current | needs-refresh | archived
5
+ owner: <git-handle>
6
+ paths: [] # required; canonical module-to-paths mapping (globs)
7
+ last-refreshed: <YYYY-MM-DD>
8
+ created: <YYYY-MM-DD>
9
+ updated: <YYYY-MM-DD>
10
+ schema-version: 1
11
+ ---
12
+
13
+ ## Purpose
14
+
15
+ _What this module is responsible for. 2–4 sentences. Author may grep `paths` to verify._
16
+
17
+ ## Public Surface
18
+
19
+ _Exports, routes, RPCs the module exposes outward. Bullets._
20
+
21
+ -
22
+
23
+ ## Data Owned
24
+
25
+ _Tables, columns, and indexes this module is the canonical owner of. Bullets._
26
+
27
+ -
28
+
29
+ ## External Dependencies
30
+
31
+ _Other modules, third-party services, MCPs this module depends on. Bullets._
32
+
33
+ -
34
+
35
+ ## Invariants
36
+
37
+ _Challenge prompt: what would a careless refactor in this module break that the tests would not catch? Minimum 3 bullets (validator rule MS-03)._
38
+
39
+ -
40
+ -
41
+ -
42
+
43
+ ## Known Tech-Debt and ADRs
44
+
45
+ _Pointers._
46
+
47
+ ## Refresh Policy
48
+
49
+ _What triggers a refresh and what the refresh entails. One paragraph. The 60-day `needs-refresh` cron flags this spec if untouched._