heyspex 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 (104) hide show
  1. package/README.md +157 -0
  2. package/bin/hs.mjs +1028 -0
  3. package/bin/postinstall.mjs +88 -0
  4. package/dev-factory/lib/fleet-readiness.mjs +274 -0
  5. package/dev-factory/lib/fleet-state.mjs +250 -0
  6. package/dev-factory/lib/sufficiency-score.mjs +441 -0
  7. package/dist/cli/hs-check.mjs +747 -0
  8. package/dist/cli/hs-claim.mjs +541 -0
  9. package/dist/cli/hs-connect.mjs +3436 -0
  10. package/dist/cli/hs-defer.mjs +8455 -0
  11. package/dist/cli/hs-env.mjs +36845 -0
  12. package/dist/cli/hs-init.mjs +1145 -0
  13. package/dist/cli/hs-install.mjs +1390 -0
  14. package/dist/cli/hs-join.mjs +38553 -0
  15. package/dist/cli/hs-vault-pull.mjs +7782 -0
  16. package/dist/cli/hs-vault.mjs +4166 -0
  17. package/dist/cli/hs-workspace.mjs +2898 -0
  18. package/dist/cli-templates/customer-vault/specs/entity-model.md +1735 -0
  19. package/dist/cli-templates/customer-vault/specs/protocols/canonical-frontmatter-templates.md +531 -0
  20. package/dist/cli-templates/customer-vault/specs/protocols/memory-protocol.md +48 -0
  21. package/dist/cli-templates/customer-vault/specs/protocols/spec-hierarchy.md +548 -0
  22. package/docs/mcp-client-config.md +200 -0
  23. package/package.json +124 -0
  24. package/scripts/check-mcp-freshness.mjs +379 -0
  25. package/scripts/dev-server-status.mjs +722 -0
  26. package/scripts/gateway-skills-lib.mjs +421 -0
  27. package/scripts/lib/console-url-resolver.mjs +152 -0
  28. package/scripts/lib/dev-mode.mjs +369 -0
  29. package/scripts/lib/hs-link.mjs +154 -0
  30. package/scripts/lib/hs-source-commit.mjs +207 -0
  31. package/scripts/lib/hs-source-log.mjs +366 -0
  32. package/scripts/lib/hs-source-preflight.mjs +402 -0
  33. package/scripts/lib/hs-source-push.mjs +307 -0
  34. package/scripts/lib/hs-source-secret-scan.mjs +263 -0
  35. package/scripts/lib/standalone-doctor.mjs +89 -0
  36. package/scripts/vault-id-lib.mjs +173 -0
  37. package/vendor/heyspex-mcp/alignment-gate.mjs +1347 -0
  38. package/vendor/heyspex-mcp/blocker-resolver.mjs +891 -0
  39. package/vendor/heyspex-mcp/breakdown-ladder.mjs +309 -0
  40. package/vendor/heyspex-mcp/breakdown-source.mjs +236 -0
  41. package/vendor/heyspex-mcp/breakdown-writer.mjs +524 -0
  42. package/vendor/heyspex-mcp/brief-observability.mjs +67 -0
  43. package/vendor/heyspex-mcp/canvas-inbox.mjs +130 -0
  44. package/vendor/heyspex-mcp/capture-active-rehydrate.mjs +76 -0
  45. package/vendor/heyspex-mcp/capture-buffer-patches.mjs +147 -0
  46. package/vendor/heyspex-mcp/capture-channel.mjs +577 -0
  47. package/vendor/heyspex-mcp/capture-console-client.mjs +290 -0
  48. package/vendor/heyspex-mcp/capture-focus.mjs +1366 -0
  49. package/vendor/heyspex-mcp/capture-kind-suggest.mjs +121 -0
  50. package/vendor/heyspex-mcp/capture-outbox.mjs +239 -0
  51. package/vendor/heyspex-mcp/capture-stage-gate.mjs +160 -0
  52. package/vendor/heyspex-mcp/cli.mjs +15754 -0
  53. package/vendor/heyspex-mcp/config-settings.mjs +419 -0
  54. package/vendor/heyspex-mcp/console-fetch.mjs +342 -0
  55. package/vendor/heyspex-mcp/defer-spec.mjs +527 -0
  56. package/vendor/heyspex-mcp/deferred-reclaim.mjs +284 -0
  57. package/vendor/heyspex-mcp/design-tools.mjs +449 -0
  58. package/vendor/heyspex-mcp/dev-factory-bridge.mjs +66 -0
  59. package/vendor/heyspex-mcp/diagnose-skeleton.mjs +114 -0
  60. package/vendor/heyspex-mcp/fleet-queue-tools.mjs +241 -0
  61. package/vendor/heyspex-mcp/hooks-engine.mjs +399 -0
  62. package/vendor/heyspex-mcp/login-handoff.mjs +438 -0
  63. package/vendor/heyspex-mcp/mcp-subprocess.mjs +136 -0
  64. package/vendor/heyspex-mcp/mvp-mode.mjs +101 -0
  65. package/vendor/heyspex-mcp/next-resolution.mjs +240 -0
  66. package/vendor/heyspex-mcp/next-review.mjs +548 -0
  67. package/vendor/heyspex-mcp/peer-presence.mjs +430 -0
  68. package/vendor/heyspex-mcp/plan-ground-conflicts.mjs +321 -0
  69. package/vendor/heyspex-mcp/plan-ground.mjs +2001 -0
  70. package/vendor/heyspex-mcp/plan-ingest.mjs +476 -0
  71. package/vendor/heyspex-mcp/plan-push.mjs +1826 -0
  72. package/vendor/heyspex-mcp/plan-review.mjs +1419 -0
  73. package/vendor/heyspex-mcp/preflight-gate.mjs +0 -0
  74. package/vendor/heyspex-mcp/procedure-tools.mjs +970 -0
  75. package/vendor/heyspex-mcp/promote-capture.mjs +1280 -0
  76. package/vendor/heyspex-mcp/promote-diagnose.mjs +187 -0
  77. package/vendor/heyspex-mcp/promote-research-to-diagnose.mjs +338 -0
  78. package/vendor/heyspex-mcp/promote-research.mjs +1553 -0
  79. package/vendor/heyspex-mcp/promotion-helpers.mjs +280 -0
  80. package/vendor/heyspex-mcp/read-path.mjs +138 -0
  81. package/vendor/heyspex-mcp/recipe-tools.mjs +258 -0
  82. package/vendor/heyspex-mcp/regen-tasks.mjs +326 -0
  83. package/vendor/heyspex-mcp/register-spec.mjs +417 -0
  84. package/vendor/heyspex-mcp/research-focus.mjs +476 -0
  85. package/vendor/heyspex-mcp/research-tools.mjs +109 -0
  86. package/vendor/heyspex-mcp/research-type-suggest.mjs +112 -0
  87. package/vendor/heyspex-mcp/resolution-focus.mjs +45 -0
  88. package/vendor/heyspex-mcp/review-focus.mjs +55 -0
  89. package/vendor/heyspex-mcp/review-rollup.mjs +47 -0
  90. package/vendor/heyspex-mcp/run-front.mjs +60 -0
  91. package/vendor/heyspex-mcp/scheduler.mjs +813 -0
  92. package/vendor/heyspex-mcp/seat-identity.mjs +281 -0
  93. package/vendor/heyspex-mcp/settings-tools.mjs +119 -0
  94. package/vendor/heyspex-mcp/spec-id-lib.mjs +790 -0
  95. package/vendor/heyspex-mcp/split-research.mjs +832 -0
  96. package/vendor/heyspex-mcp/submit-for-review.mjs +190 -0
  97. package/vendor/heyspex-mcp/summary-contract.mjs +162 -0
  98. package/vendor/heyspex-mcp/test-helpers.mjs +43 -0
  99. package/vendor/heyspex-mcp/validate-linkage.mjs +574 -0
  100. package/vendor/heyspex-mcp/vault-resolve.mjs +297 -0
  101. package/vendor/heyspex-mcp/vault-settings.mjs +87 -0
  102. package/vendor/heyspex-mcp/verify-reproduction.mjs +314 -0
  103. package/vendor/heyspex-mcp/why-now.mjs +64 -0
  104. package/vendor/heyspex-mcp/yaml-scalar.mjs +34 -0
package/README.md ADDED
@@ -0,0 +1,157 @@
1
+ # HeySpex
2
+
3
+ > **Deterministic SDLC engine for AI dev, idea to ship.**
4
+
5
+ HeySpex sits between "I have an idea" and "an AI agent writes code" - it distills ideas into context-window-sized plans that agents build correctly the first time. This page is the team-member onboarding walk-through: it takes you from an empty computer to your first claimed spec, and links the authoritative doc for every step instead of duplicating it.
6
+
7
+ ## Machine setup
8
+
9
+ Prerequisites: Node.js `>=20 <25` (tested on 22.x), npm 10.x, git. No local database - HeySpex uses a cloud Postgres (Neon). Only if you will work on the Windows Companion tray app: the [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0) and [PowerShell 7](https://learn.microsoft.com/powershell/scripting/install/installing-powershell-on-windows) (`pwsh`).
10
+
11
+ ```bash
12
+ # 1. Clone
13
+ git clone https://github.com/pwhermanson/workflow-protocol.git
14
+ cd workflow-protocol
15
+
16
+ # 2. Install - this is an npm workspace; one install covers the root
17
+ # CLI/scripts, the Console app, and the companion extension.
18
+ npm install
19
+
20
+ # 3. Wire up the agent tooling - MCP server, lifecycle hooks, skills,
21
+ # slash commands, statusline, git hooks. Idempotent: run it any time,
22
+ # including after a git pull.
23
+ npm run setup
24
+
25
+ # 4. Verify every surface. Exits non-zero if something is missing and
26
+ # names the exact command that fixes it.
27
+ npm run doctor
28
+ ```
29
+
30
+ Notes that save people time:
31
+
32
+ - `npm run setup` is the same as `npm run doctor -- --fix`.
33
+ - The agent's `heyspex_*` MCP tools appear only after the agent session restarts - Claude Code and Cursor read MCP config once at startup, so restart or reconnect after the first setup. Then confirm: `/mcp` lists `heyspex` as connected and `/hs-next` returns on-deck work.
34
+ - `.git/hooks/` is never cloned, so the pre-commit hook is the step people miss on a new machine - `doctor` checks for it explicitly (`npm run hooks:install` covers git hooks alone).
35
+ - Editor wiring in full detail, including turning the whole layer off with `npm run heyspex:off` / back on with `npm run heyspex:on`: [docs/claude-code-setup.md](docs/claude-code-setup.md) for Claude Code, [docs/cursor-setup.md](docs/cursor-setup.md) for Cursor, [docs/driving-heyspex-from-copilot.md](docs/driving-heyspex-from-copilot.md) for Copilot.
36
+
37
+ Which installer is this? Three scopes, do not mix them up:
38
+
39
+ - This page / `npm run setup` is the **platform admin setup** - it only makes sense inside a full checkout of this monorepo.
40
+ - `node bin/hs.mjs install` bootstraps a **separate** project or vault to point at an existing platform checkout. It is not yet standalone - the target's MCP config still points into this repo's `vendor/heyspex-mcp/cli.mjs`.
41
+ - A true public customer package does not exist yet - tracked in the vault under `HS-OFUB` and `HS-RMU3`.
42
+
43
+ ## Credentials and secrets
44
+
45
+ The minimum to run the Console:
46
+
47
+ ```bash
48
+ cp spex-console/.env.example spex-console/.env.local
49
+ ```
50
+
51
+ Then fill in the four required keys: `DATABASE_URL` and `DATABASE_URL_UNPOOLED` (Neon Postgres), `CLERK_SECRET_KEY` and `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` (auth). Ask the project owner or a teammate for real values - never paste keys into chat, and never commit `.env.local` (it is gitignored). The remaining keys (AI providers, GitHub App, Figma sync, Sentry) are feature-specific; the app runs without them and those features just no-op.
52
+
53
+ How secrets move around the team, and why they are encrypted even in a private repo:
54
+
55
+ - [docs/sharing-secrets-with-your-team.md](docs/sharing-secrets-with-your-team.md) - the grant model: repo access and decrypt access are separate grants, and you need both.
56
+ - [docs/why-heyspex-secrets.md](docs/why-heyspex-secrets.md) - the problem this solves, in plain terms.
57
+ - [docs/agent-access-posture.md](docs/agent-access-posture.md) - what an AI coding agent can and cannot see.
58
+
59
+ Companion pairing and fleet-machine credentials only matter if your role needs them - see [docs/fleet/](docs/fleet/README.md).
60
+
61
+ Local credential layout and pairing mechanics: [specs/protocols/local-dev-credentials.md](specs/protocols/local-dev-credentials.md).
62
+
63
+ ## Dev server rules
64
+
65
+ The Console dev server connects to the shared Neon database at runtime, so a few rules keep it and the database from breaking each other.
66
+
67
+ - Start the Console with `npm run console:log` - it runs the same dev server but captures the log so agents can watch it instead of asking you to paste terminal output. Use `npm run console:log:lan` for anything involving the Companion's cloud relay, which is inert against a loopback console. Plain `npm run console` also works when no agent needs the log.
68
+ - Never run these while the server is live: a database migration, a Neon reset, a dependency install, deleting `.next`, or a second `next dev`.
69
+ - Check ground truth first: `hs server status` (or `npm run console:status`) probes what is actually listening, not a lockfile. Stop a live server before server-impacting work.
70
+
71
+ | Command | What it does |
72
+ |---|---|
73
+ | `npm run console` | Start the spex-console Next.js dev server (`localhost:3000`) |
74
+ | `npm run console:log` / `console:log:lan` | Same, with the log captured (LAN variant for Companion relay work) |
75
+ | `npm run console:stop` | Stop the console (works from any terminal) |
76
+ | `npm run console:status` | Is the console running, and on which port |
77
+ | `npm run companion` | Start the Windows tray companion (builds on first run if needed) |
78
+ | `npm run companion:stop` / `companion:status` | Quit the companion / is it running |
79
+
80
+ Both commands preflight their deps: the console fails fast if `npm install` is needed, the companion fails fast if the .NET 8 SDK is missing. Full procedure: [specs/protocols/dev-server-lifecycle-and-db-safety.md](specs/protocols/dev-server-lifecycle-and-db-safety.md).
81
+
82
+ ## How work happens
83
+
84
+ The vault under `specs/` is the system of record. It is git-tracked markdown - specs, tasks, epics, research, memory, protocols - cross-linked with `[[wikilinks]]`. There is no separate tracker or planning database; the files are the data, and full history is `git log`.
85
+
86
+ Work flows through gates: an idea is **captured**, grounded into **research**, then broken down into **milestone, epic, and task** specs, each task sized to fit one AI context window. Agents **claim** a spec, work its acceptance criteria, report progress, and **submit it for review**. Agents never commit - a dirty tree is the expected hand-off, and the human commits on review Pass. Spec ids are server-minted, never hand-picked ([specs/protocols/vault-id-assignment-protocol.md](specs/protocols/vault-id-assignment-protocol.md)).
87
+
88
+ The seat model in one paragraph: the owner makes the judgment calls, reviews, and commits. The coding agent you drive in this repo holds the COO seat - it orchestrates, gates quality, and talks to the owner. Mechanical work (build, breakdown, critique, research) is routed by `dev-factory/` to a local model fleet, escalating to a cloud model only when a task genuinely needs it. [CLAUDE.md](CLAUDE.md) is the always-loaded agent contract that makes agents follow all of this without being asked.
89
+
90
+ Where things live:
91
+
92
+ | Path | What it is |
93
+ |---|---|
94
+ | `specs/` | The vault - the system of record |
95
+ | `spex-console/` | The Console, a Next.js app for browsing and planning the vault |
96
+ | `companion/` | Windows tray companion plus the browser extension |
97
+ | `vendor/heyspex-mcp/` | The MCP server that exposes vault operations as agent tools |
98
+ | `bin/hs.mjs` | The `hs` CLI - the same operations from a terminal |
99
+ | `dev-factory/` | Multi-agent routing config for the model fleet |
100
+
101
+ ## Dev and prod mode
102
+
103
+ Every machine points somewhere: a console (local or cloud), a read tier, and a write mode. `hs dev` shows what your machine currently points at, and `/hs-dev mode:local|cloud|prod` (or `hs dev mode <target>`) flips it. The choice is machine-local - it lives under `.heyspex/`, is gitignored, and never lands in a commit, so switching your own machine cannot affect a teammate's.
104
+
105
+ ## Your first claimed spec
106
+
107
+ 1. In your agent session, run `/hs-next`. It returns the on-deck work as a ready-to-execute prompt.
108
+ 2. The agent asks once to confirm the claim. Say yes, and it claims the spec and starts - no second ask.
109
+ 3. Work the acceptance criteria. The agent reports progress after each one.
110
+ 4. When every criterion is met, the agent submits the spec for review. Nobody hand-edits `status:` in frontmatter - the status API handles it.
111
+ 5. Leave the working tree dirty. The owner reviews and commits on Pass. How a session ends properly: [specs/protocols/session-close-protocol.md](specs/protocols/session-close-protocol.md).
112
+
113
+ If `/hs-next` or the `heyspex_*` tools are missing, run `npm run doctor` and restart the agent session.
114
+
115
+ ## Reference shelf
116
+
117
+ Look-up material, not required reading. Start with the [glossary](specs/glossary.md) when a term is unfamiliar.
118
+
119
+ ### Day-one protocols
120
+
121
+ The seven protocols that are mandatory early reading:
122
+
123
+ | Protocol | Why day one |
124
+ |---|---|
125
+ | [session-close-protocol](specs/protocols/session-close-protocol.md) | How every working session ends - what gets recorded, what never gets committed. |
126
+ | [dev-server-lifecycle-and-db-safety](specs/protocols/dev-server-lifecycle-and-db-safety.md) | The rules that keep the shared Neon database and a live dev server from breaking each other. |
127
+ | [local-dev-credentials](specs/protocols/local-dev-credentials.md) | Where local credentials live and how pairing works. |
128
+ | [memory-protocol](specs/protocols/memory-protocol.md) | When and how durable lessons and decisions get filed. |
129
+ | [research-capture-protocol](specs/protocols/research-capture-protocol.md) | The capture to research road every idea travels. |
130
+ | [vault-id-assignment-protocol](specs/protocols/vault-id-assignment-protocol.md) | Why ids are server-minted and never hand-picked. |
131
+ | [mcp-slash-surface-protocol](specs/protocols/mcp-slash-surface-protocol.md) | How the MCP tools and slash commands relate across Claude Code and Cursor. |
132
+
133
+ The full folder (`specs/protocols/`, about 70 protocols) is reference material - agents fetch them on demand via `heyspex_get_procedure`.
134
+
135
+ ### Which docs apply to you
136
+
137
+ | Your role | Read these |
138
+ |---|---|
139
+ | Everyone | [docs/claude-code-setup.md](docs/claude-code-setup.md) or [docs/cursor-setup.md](docs/cursor-setup.md) (whichever editor you drive), [docs/sharing-secrets-with-your-team.md](docs/sharing-secrets-with-your-team.md) |
140
+ | Console work | [dev-server-lifecycle-and-db-safety](specs/protocols/dev-server-lifecycle-and-db-safety.md), the design-system registry under `spex-console/public/design-system/` |
141
+ | Companion work | .NET 8 SDK plus `pwsh` prerequisites above, [docs/fleet/companion-app-distribution.md](docs/fleet/companion-app-distribution.md), [docs/fleet/cloud-relay-add-machine.md](docs/fleet/cloud-relay-add-machine.md), [docs/fleet/chrome-extension-distribution.md](docs/fleet/chrome-extension-distribution.md) |
142
+ | Fleet machines | [docs/fleet/README.md](docs/fleet/README.md), [docs/fleet/release-runbook.md](docs/fleet/release-runbook.md), [scripts/public-install/README.md](scripts/public-install/README.md) |
143
+
144
+ ### Deeper reading
145
+
146
+ - [specs/heyspex-north-star.md](specs/heyspex-north-star.md) - the vision and constitution.
147
+ - [specs/HS-DOC-architecture-foundations.md](specs/HS-DOC-architecture-foundations.md) - the architecture map and milestones.
148
+ - [specs/entity-model.md](specs/entity-model.md) - entity kinds, frontmatter, folder layout.
149
+ - [plugins/heyspex/README.md](plugins/heyspex/README.md) - the plugin packaging prototype for bootstrapping other repos.
150
+
151
+ ### Legacy tooling
152
+
153
+ This repo also contains `workflow-pm`, an earlier standalone PM tool built on beads (`bd`), which was retired as the system of record when the vault replaced it (see [specs/migration-from-bd.md](specs/migration-from-bd.md)). Its reference docs live in [MULTI_AGENT_PM_PROTOCOL.md](MULTI_AGENT_PM_PROTOCOL.md), [SETUP.md](SETUP.md), [IMPLEMENTATION_ROADMAP_PROTOCOL.md](IMPLEMENTATION_ROADMAP_PROTOCOL.md), and [pm-control-center/README.md](pm-control-center/README.md). None of it is needed for day-to-day HeySpex work.
154
+
155
+ ## License
156
+
157
+ MIT - use freely, modify as needed, no attribution required.