hyperstack-core 1.3.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,110 +1,110 @@
1
- /**
2
- * example-before-after.js
3
- *
4
- * Side-by-side: markdown files vs HyperStack
5
- *
6
- * THE PROBLEM:
7
- * Your 3 OpenClaw agents coordinate via shared markdown files.
8
- * Agent A appends to DECISIONS.md. Agent B reads it. Agent C greps for blockers.
9
- *
10
- * Question: "What blocks the production deploy?"
11
- * Old way: grep -r "blocks.*deploy" *.md → fragile, returns text blobs
12
- * New way: hs.blockers("deploy-prod") → exact typed cards
13
- */
14
-
15
- import { HyperStackClient } from "hyperstack-core";
16
-
17
- const hs = new HyperStackClient({ workspace: "demo" });
18
-
19
- async function main() {
20
- // ─── What agents used to write in DECISIONS.md ────────
21
- //
22
- // # DECISIONS.md
23
- // - 2026-02-15: Use Clerk for auth (coder-agent)
24
- // Rationale: Better DX, lower cost, native Next.js support
25
- //
26
- // - 2026-02-15: Deploy needs auth migration first (deploy-agent)
27
- // Migration to Clerk must complete before we can deploy v2
28
- //
29
- // - 2026-02-16: Staging tests failing, blocks deploy (ops-agent)
30
- // 3 integration tests broken after Clerk middleware change
31
-
32
- // ─── Same info, structured as typed cards ─────────────
33
-
34
- await hs.store({
35
- slug: "decision-use-clerk",
36
- title: "Use Clerk for auth",
37
- body: "Better DX, lower cost, native Next.js support. Chose over Auth0 and NextAuth.",
38
- cardType: "decision",
39
- keywords: ["clerk", "auth", "auth0"],
40
- links: [
41
- { target: "agent-coder", relation: "decided" },
42
- { target: "auth-api", relation: "triggers" },
43
- ],
44
- });
45
-
46
- await hs.store({
47
- slug: "migration-clerk",
48
- title: "Auth migration to Clerk",
49
- body: "Migration to Clerk must complete before v2 deploy. Estimated 2 days.",
50
- cardType: "workflow",
51
- keywords: ["migration", "clerk", "deploy"],
52
- links: [
53
- { target: "deploy-prod", relation: "blocks" },
54
- { target: "decision-use-clerk", relation: "depends_on" },
55
- ],
56
- });
57
-
58
- await hs.store({
59
- slug: "staging-tests-broken",
60
- title: "3 integration tests failing after Clerk middleware",
61
- body: "Tests auth-flow-1, auth-flow-2, session-persist broken. Clerk middleware changed req.auth shape.",
62
- cardType: "event",
63
- keywords: ["tests", "staging", "broken", "clerk"],
64
- links: [
65
- { target: "deploy-prod", relation: "blocks" },
66
- { target: "migration-clerk", relation: "related" },
67
- ],
68
- });
69
-
70
- await hs.store({
71
- slug: "deploy-prod",
72
- title: "Deploy v2 to production",
73
- body: "Production deploy of v2 with new auth system.",
74
- cardType: "workflow",
75
- keywords: ["deploy", "production", "v2"],
76
- });
77
-
78
- // ─── Now ask: "What blocks the production deploy?" ────
79
-
80
- console.log('Question: "What blocks the production deploy?"\n');
81
-
82
- console.log("Old way (grep DECISIONS.md):");
83
- console.log(' $ grep -r "blocks.*deploy" *.md');
84
- console.log(' DECISIONS.md:- Deploy needs auth migration first');
85
- console.log(' DECISIONS.md:- Staging tests failing, blocks deploy');
86
- console.log(" → Text blobs. No structure. Which is resolved? Who owns it?\n");
87
-
88
- console.log("New way (HyperStack):");
89
- const result = await hs.blockers("deploy-prod");
90
- console.log(` ${result.blockers?.length || 0} typed blockers:`);
91
- for (const b of result.blockers || []) {
92
- console.log(` [${b.slug}] ${b.title} (${b.cardType})`);
93
- }
94
- console.log(" → Exact cards. Typed relations. Queryable.\n");
95
-
96
- // ─── Bonus: follow the decision trail ─────────────────
97
-
98
- console.log('Bonus: "Why did we choose Clerk?"');
99
- const search = await hs.search("clerk decision rationale");
100
- const decision = search.results?.[0];
101
- if (decision) {
102
- console.log(` [${decision.slug}] ${decision.title}`);
103
- console.log(` ${decision.body}`);
104
- if (decision.links?.length) {
105
- console.log(` Links: ${decision.links.map(l => `${l.relation}→${l.target}`).join(", ")}`);
106
- }
107
- }
108
- }
109
-
110
- main().catch(err => console.error(err.message));
1
+ /**
2
+ * example-before-after.js
3
+ *
4
+ * Side-by-side: markdown files vs HyperStack
5
+ *
6
+ * THE PROBLEM:
7
+ * Your 3 OpenClaw agents coordinate via shared markdown files.
8
+ * Agent A appends to DECISIONS.md. Agent B reads it. Agent C greps for blockers.
9
+ *
10
+ * Question: "What blocks the production deploy?"
11
+ * Old way: grep -r "blocks.*deploy" *.md → fragile, returns text blobs
12
+ * New way: hs.blockers("deploy-prod") → exact typed cards
13
+ */
14
+
15
+ import { HyperStackClient } from "hyperstack-core";
16
+
17
+ const hs = new HyperStackClient({ workspace: "demo" });
18
+
19
+ async function main() {
20
+ // ─── What agents used to write in DECISIONS.md ────────
21
+ //
22
+ // # DECISIONS.md
23
+ // - 2026-02-15: Use Clerk for auth (coder-agent)
24
+ // Rationale: Better DX, lower cost, native Next.js support
25
+ //
26
+ // - 2026-02-15: Deploy needs auth migration first (deploy-agent)
27
+ // Migration to Clerk must complete before we can deploy v2
28
+ //
29
+ // - 2026-02-16: Staging tests failing, blocks deploy (ops-agent)
30
+ // 3 integration tests broken after Clerk middleware change
31
+
32
+ // ─── Same info, structured as typed cards ─────────────
33
+
34
+ await hs.store({
35
+ slug: "decision-use-clerk",
36
+ title: "Use Clerk for auth",
37
+ body: "Better DX, lower cost, native Next.js support. Chose over Auth0 and NextAuth.",
38
+ cardType: "decision",
39
+ keywords: ["clerk", "auth", "auth0"],
40
+ links: [
41
+ { target: "agent-coder", relation: "decided" },
42
+ { target: "auth-api", relation: "triggers" },
43
+ ],
44
+ });
45
+
46
+ await hs.store({
47
+ slug: "migration-clerk",
48
+ title: "Auth migration to Clerk",
49
+ body: "Migration to Clerk must complete before v2 deploy. Estimated 2 days.",
50
+ cardType: "workflow",
51
+ keywords: ["migration", "clerk", "deploy"],
52
+ links: [
53
+ { target: "deploy-prod", relation: "blocks" },
54
+ { target: "decision-use-clerk", relation: "depends_on" },
55
+ ],
56
+ });
57
+
58
+ await hs.store({
59
+ slug: "staging-tests-broken",
60
+ title: "3 integration tests failing after Clerk middleware",
61
+ body: "Tests auth-flow-1, auth-flow-2, session-persist broken. Clerk middleware changed req.auth shape.",
62
+ cardType: "event",
63
+ keywords: ["tests", "staging", "broken", "clerk"],
64
+ links: [
65
+ { target: "deploy-prod", relation: "blocks" },
66
+ { target: "migration-clerk", relation: "related" },
67
+ ],
68
+ });
69
+
70
+ await hs.store({
71
+ slug: "deploy-prod",
72
+ title: "Deploy v2 to production",
73
+ body: "Production deploy of v2 with new auth system.",
74
+ cardType: "workflow",
75
+ keywords: ["deploy", "production", "v2"],
76
+ });
77
+
78
+ // ─── Now ask: "What blocks the production deploy?" ────
79
+
80
+ console.log('Question: "What blocks the production deploy?"\n');
81
+
82
+ console.log("Old way (grep DECISIONS.md):");
83
+ console.log(' $ grep -r "blocks.*deploy" *.md');
84
+ console.log(' DECISIONS.md:- Deploy needs auth migration first');
85
+ console.log(' DECISIONS.md:- Staging tests failing, blocks deploy');
86
+ console.log(" → Text blobs. No structure. Which is resolved? Who owns it?\n");
87
+
88
+ console.log("New way (HyperStack):");
89
+ const result = await hs.blockers("deploy-prod");
90
+ console.log(` ${result.blockers?.length || 0} typed blockers:`);
91
+ for (const b of result.blockers || []) {
92
+ console.log(` [${b.slug}] ${b.title} (${b.cardType})`);
93
+ }
94
+ console.log(" → Exact cards. Typed relations. Queryable.\n");
95
+
96
+ // ─── Bonus: follow the decision trail ─────────────────
97
+
98
+ console.log('Bonus: "Why did we choose Clerk?"');
99
+ const search = await hs.search("clerk decision rationale");
100
+ const decision = search.results?.[0];
101
+ if (decision) {
102
+ console.log(` [${decision.slug}] ${decision.title}`);
103
+ console.log(` ${decision.body}`);
104
+ if (decision.links?.length) {
105
+ console.log(` Links: ${decision.links.map(l => `${l.relation}→${l.target}`).join(", ")}`);
106
+ }
107
+ }
108
+ }
109
+
110
+ main().catch(err => console.error(err.message));
@@ -1,214 +1,214 @@
1
- /**
2
- * example-openclaw-multiagent.js
3
- *
4
- * Complete example: 3 OpenClaw agents coordinating via HyperStack
5
- * instead of GOALS.md + DECISIONS.md files.
6
- *
7
- * Run: HYPERSTACK_API_KEY=hs_your_key node example-openclaw-multiagent.js
8
- */
9
-
10
- import { HyperStackClient } from "hyperstack-core";
11
-
12
- const hs = new HyperStackClient({ workspace: "my-project" });
13
-
14
- // ─── Step 1: Register your agents ──────────────────────
15
-
16
- async function setup() {
17
- // Register each agent as a card in the graph
18
- await hs.registerAgent({
19
- id: "coordinator",
20
- name: "Coordinator",
21
- role: "Routes tasks, monitors blockers, prevents duplicate work",
22
- });
23
-
24
- await hs.registerAgent({
25
- id: "researcher",
26
- name: "Research Agent",
27
- role: "Investigates technical questions, stores findings",
28
- owns: ["project-root"],
29
- });
30
-
31
- await hs.registerAgent({
32
- id: "builder",
33
- name: "Builder Agent",
34
- role: "Implements code, records architecture decisions",
35
- });
36
-
37
- // Create project root
38
- await hs.store({
39
- slug: "project-root",
40
- title: "SaaS Dashboard Project",
41
- body: "Next.js 14 + Clerk auth + Neon PostgreSQL. Deploying to Vercel.",
42
- cardType: "project",
43
- stack: "projects",
44
- keywords: ["project", "saas", "dashboard", "nextjs"],
45
- });
46
-
47
- console.log("✅ Setup complete: 3 agents + project root");
48
- }
49
-
50
- // ─── Step 2: Researcher investigates auth options ──────
51
-
52
- async function researcherFlow() {
53
- const researcher = new HyperStackClient({
54
- workspace: "my-project",
55
- agentId: "researcher",
56
- });
57
-
58
- // Check if someone already researched this
59
- const existing = await researcher.search("authentication options");
60
- if (existing.results?.length) {
61
- console.log("📋 Already researched:", existing.results[0].title);
62
- return; // No duplicate work!
63
- }
64
-
65
- // Store findings
66
- await researcher.store({
67
- slug: "finding-clerk-pricing",
68
- title: "Clerk pricing: free to 10K MAU",
69
- body: "Clerk offers free tier up to 10,000 monthly active users. After that $0.02/MAU. Auth0 starts charging at 7,500 MAU at $23/mo. For our expected 5K users, Clerk is free vs Auth0 $23/mo.",
70
- cardType: "event",
71
- stack: "general",
72
- keywords: ["clerk", "auth0", "pricing", "authentication"],
73
- links: [{ target: "project-root", relation: "related" }],
74
- });
75
-
76
- await researcher.store({
77
- slug: "finding-nextauth-deprecated",
78
- title: "NextAuth.js → Auth.js migration ongoing",
79
- body: "NextAuth.js is being renamed to Auth.js. Migration guide exists but community reports rough edges with App Router. Not recommended for new projects right now.",
80
- cardType: "event",
81
- stack: "general",
82
- keywords: ["nextauth", "authjs", "migration", "risk"],
83
- links: [{ target: "project-root", relation: "related" }],
84
- });
85
-
86
- console.log("✅ Researcher stored 2 findings");
87
- }
88
-
89
- // ─── Step 3: Builder makes a decision based on research ─
90
-
91
- async function builderFlow() {
92
- const builder = new HyperStackClient({
93
- workspace: "my-project",
94
- agentId: "builder",
95
- });
96
-
97
- // Search for research findings before deciding
98
- const research = await builder.search("authentication pricing comparison");
99
- console.log(`📋 Builder found ${research.results?.length || 0} relevant cards`);
100
-
101
- // Make and record a decision
102
- await builder.decide({
103
- slug: "decision-use-clerk",
104
- title: "Use Clerk for authentication",
105
- body: "Based on research: Clerk free at our scale (<10K MAU), better Next.js integration than Auth0, and NextAuth.js has migration risks. Clerk is the clear choice.",
106
- decidedBy: "agent-builder",
107
- affects: ["project-root"],
108
- keywords: ["clerk", "auth", "decision"],
109
- });
110
-
111
- // Record the implementation task
112
- await builder.store({
113
- slug: "task-clerk-integration",
114
- title: "Integrate Clerk with Next.js App Router",
115
- body: "Install @clerk/nextjs, configure middleware, add sign-in/sign-up pages, protect API routes.",
116
- cardType: "workflow",
117
- stack: "workflows",
118
- keywords: ["clerk", "integration", "nextjs", "task"],
119
- links: [
120
- { target: "decision-use-clerk", relation: "depends_on" },
121
- { target: "agent-builder", relation: "assigned_to" },
122
- ],
123
- });
124
-
125
- // Record a blocker
126
- await builder.store({
127
- slug: "blocker-env-vars",
128
- title: "Need Clerk API keys from team lead",
129
- body: "Cannot proceed with Clerk integration until CLERK_SECRET_KEY and NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY are provided.",
130
- cardType: "event",
131
- stack: "general",
132
- keywords: ["blocker", "clerk", "env", "keys"],
133
- links: [
134
- { target: "task-clerk-integration", relation: "blocks" },
135
- ],
136
- });
137
-
138
- console.log("✅ Builder: decision recorded, task created, blocker flagged");
139
- }
140
-
141
- // ─── Step 4: Coordinator checks status ─────────────────
142
-
143
- async function coordinatorFlow() {
144
- const coordinator = new HyperStackClient({
145
- workspace: "my-project",
146
- agentId: "coordinator",
147
- });
148
-
149
- // What blocks the Clerk integration?
150
- const blockers = await coordinator.blockers("task-clerk-integration");
151
- console.log(`\n🚧 Blockers for Clerk integration: ${blockers.blockers?.length || 0}`);
152
- for (const b of blockers.blockers || []) {
153
- console.log(` [${b.slug}] ${b.title}`);
154
- }
155
-
156
- // Full graph from project root
157
- try {
158
- const graph = await coordinator.graph("project-root", { depth: 2 });
159
- console.log(`\n📊 Project graph: ${graph.nodes?.length || 0} nodes, ${graph.edges?.length || 0} edges`);
160
- for (const e of graph.edges || []) {
161
- console.log(` ${e.from} --${e.relation}--> ${e.to}`);
162
- }
163
- } catch (err) {
164
- // Graph traversal needs Pro plan
165
- if (err.status === 403) {
166
- console.log("\n📊 Graph traversal requires Pro plan. Using search fallback.");
167
- const all = await coordinator.list();
168
- console.log(` Total cards: ${all.count}`);
169
- }
170
- }
171
-
172
- // Check: has anyone already done research on databases?
173
- const dbResearch = await coordinator.search("database postgresql selection");
174
- if (!dbResearch.results?.length) {
175
- console.log("\n⚠️ No database research found. Assigning to researcher.");
176
- await coordinator.store({
177
- slug: "task-research-database",
178
- title: "Research database options (Neon vs Supabase vs PlanetScale)",
179
- body: "Need comparison of managed PostgreSQL options for our Next.js project. Consider: pricing, connection pooling, branching, edge compatibility.",
180
- cardType: "workflow",
181
- stack: "workflows",
182
- keywords: ["database", "research", "neon", "supabase", "planetscale"],
183
- links: [
184
- { target: "agent-researcher", relation: "assigned_to" },
185
- { target: "project-root", relation: "related" },
186
- ],
187
- });
188
- }
189
- }
190
-
191
- // ─── Run the full flow ─────────────────────────────────
192
-
193
- async function main() {
194
- console.log("🃏 HyperStack Multi-Agent Demo\n");
195
-
196
- await setup();
197
- console.log();
198
-
199
- await researcherFlow();
200
- console.log();
201
-
202
- await builderFlow();
203
- console.log();
204
-
205
- await coordinatorFlow();
206
-
207
- console.log("\n✅ Demo complete. All agents share one typed graph.");
208
- console.log(" No DECISIONS.md. No GOALS.md. Just queryable cards + relations.");
209
- }
210
-
211
- main().catch(err => {
212
- console.error("Error:", err.message);
213
- process.exit(1);
214
- });
1
+ /**
2
+ * example-openclaw-multiagent.js
3
+ *
4
+ * Complete example: 3 OpenClaw agents coordinating via HyperStack
5
+ * instead of GOALS.md + DECISIONS.md files.
6
+ *
7
+ * Run: HYPERSTACK_API_KEY=hs_your_key node example-openclaw-multiagent.js
8
+ */
9
+
10
+ import { HyperStackClient } from "hyperstack-core";
11
+
12
+ const hs = new HyperStackClient({ workspace: "my-project" });
13
+
14
+ // ─── Step 1: Register your agents ──────────────────────
15
+
16
+ async function setup() {
17
+ // Register each agent as a card in the graph
18
+ await hs.registerAgent({
19
+ id: "coordinator",
20
+ name: "Coordinator",
21
+ role: "Routes tasks, monitors blockers, prevents duplicate work",
22
+ });
23
+
24
+ await hs.registerAgent({
25
+ id: "researcher",
26
+ name: "Research Agent",
27
+ role: "Investigates technical questions, stores findings",
28
+ owns: ["project-root"],
29
+ });
30
+
31
+ await hs.registerAgent({
32
+ id: "builder",
33
+ name: "Builder Agent",
34
+ role: "Implements code, records architecture decisions",
35
+ });
36
+
37
+ // Create project root
38
+ await hs.store({
39
+ slug: "project-root",
40
+ title: "SaaS Dashboard Project",
41
+ body: "Next.js 14 + Clerk auth + Neon PostgreSQL. Deploying to Vercel.",
42
+ cardType: "project",
43
+ stack: "projects",
44
+ keywords: ["project", "saas", "dashboard", "nextjs"],
45
+ });
46
+
47
+ console.log("✅ Setup complete: 3 agents + project root");
48
+ }
49
+
50
+ // ─── Step 2: Researcher investigates auth options ──────
51
+
52
+ async function researcherFlow() {
53
+ const researcher = new HyperStackClient({
54
+ workspace: "my-project",
55
+ agentId: "researcher",
56
+ });
57
+
58
+ // Check if someone already researched this
59
+ const existing = await researcher.search("authentication options");
60
+ if (existing.results?.length) {
61
+ console.log("📋 Already researched:", existing.results[0].title);
62
+ return; // No duplicate work!
63
+ }
64
+
65
+ // Store findings
66
+ await researcher.store({
67
+ slug: "finding-clerk-pricing",
68
+ title: "Clerk pricing: free to 10K MAU",
69
+ body: "Clerk offers free tier up to 10,000 monthly active users. After that $0.02/MAU. Auth0 starts charging at 7,500 MAU at $23/mo. For our expected 5K users, Clerk is free vs Auth0 $23/mo.",
70
+ cardType: "event",
71
+ stack: "general",
72
+ keywords: ["clerk", "auth0", "pricing", "authentication"],
73
+ links: [{ target: "project-root", relation: "related" }],
74
+ });
75
+
76
+ await researcher.store({
77
+ slug: "finding-nextauth-deprecated",
78
+ title: "NextAuth.js → Auth.js migration ongoing",
79
+ body: "NextAuth.js is being renamed to Auth.js. Migration guide exists but community reports rough edges with App Router. Not recommended for new projects right now.",
80
+ cardType: "event",
81
+ stack: "general",
82
+ keywords: ["nextauth", "authjs", "migration", "risk"],
83
+ links: [{ target: "project-root", relation: "related" }],
84
+ });
85
+
86
+ console.log("✅ Researcher stored 2 findings");
87
+ }
88
+
89
+ // ─── Step 3: Builder makes a decision based on research ─
90
+
91
+ async function builderFlow() {
92
+ const builder = new HyperStackClient({
93
+ workspace: "my-project",
94
+ agentId: "builder",
95
+ });
96
+
97
+ // Search for research findings before deciding
98
+ const research = await builder.search("authentication pricing comparison");
99
+ console.log(`📋 Builder found ${research.results?.length || 0} relevant cards`);
100
+
101
+ // Make and record a decision
102
+ await builder.decide({
103
+ slug: "decision-use-clerk",
104
+ title: "Use Clerk for authentication",
105
+ body: "Based on research: Clerk free at our scale (<10K MAU), better Next.js integration than Auth0, and NextAuth.js has migration risks. Clerk is the clear choice.",
106
+ decidedBy: "agent-builder",
107
+ affects: ["project-root"],
108
+ keywords: ["clerk", "auth", "decision"],
109
+ });
110
+
111
+ // Record the implementation task
112
+ await builder.store({
113
+ slug: "task-clerk-integration",
114
+ title: "Integrate Clerk with Next.js App Router",
115
+ body: "Install @clerk/nextjs, configure middleware, add sign-in/sign-up pages, protect API routes.",
116
+ cardType: "workflow",
117
+ stack: "workflows",
118
+ keywords: ["clerk", "integration", "nextjs", "task"],
119
+ links: [
120
+ { target: "decision-use-clerk", relation: "depends_on" },
121
+ { target: "agent-builder", relation: "assigned_to" },
122
+ ],
123
+ });
124
+
125
+ // Record a blocker
126
+ await builder.store({
127
+ slug: "blocker-env-vars",
128
+ title: "Need Clerk API keys from team lead",
129
+ body: "Cannot proceed with Clerk integration until CLERK_SECRET_KEY and NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY are provided.",
130
+ cardType: "event",
131
+ stack: "general",
132
+ keywords: ["blocker", "clerk", "env", "keys"],
133
+ links: [
134
+ { target: "task-clerk-integration", relation: "blocks" },
135
+ ],
136
+ });
137
+
138
+ console.log("✅ Builder: decision recorded, task created, blocker flagged");
139
+ }
140
+
141
+ // ─── Step 4: Coordinator checks status ─────────────────
142
+
143
+ async function coordinatorFlow() {
144
+ const coordinator = new HyperStackClient({
145
+ workspace: "my-project",
146
+ agentId: "coordinator",
147
+ });
148
+
149
+ // What blocks the Clerk integration?
150
+ const blockers = await coordinator.blockers("task-clerk-integration");
151
+ console.log(`\n🚧 Blockers for Clerk integration: ${blockers.blockers?.length || 0}`);
152
+ for (const b of blockers.blockers || []) {
153
+ console.log(` [${b.slug}] ${b.title}`);
154
+ }
155
+
156
+ // Full graph from project root
157
+ try {
158
+ const graph = await coordinator.graph("project-root", { depth: 2 });
159
+ console.log(`\n📊 Project graph: ${graph.nodes?.length || 0} nodes, ${graph.edges?.length || 0} edges`);
160
+ for (const e of graph.edges || []) {
161
+ console.log(` ${e.from} --${e.relation}--> ${e.to}`);
162
+ }
163
+ } catch (err) {
164
+ // Graph traversal needs Pro plan
165
+ if (err.status === 403) {
166
+ console.log("\n📊 Graph traversal requires Pro plan. Using search fallback.");
167
+ const all = await coordinator.list();
168
+ console.log(` Total cards: ${all.count}`);
169
+ }
170
+ }
171
+
172
+ // Check: has anyone already done research on databases?
173
+ const dbResearch = await coordinator.search("database postgresql selection");
174
+ if (!dbResearch.results?.length) {
175
+ console.log("\n⚠️ No database research found. Assigning to researcher.");
176
+ await coordinator.store({
177
+ slug: "task-research-database",
178
+ title: "Research database options (Neon vs Supabase vs PlanetScale)",
179
+ body: "Need comparison of managed PostgreSQL options for our Next.js project. Consider: pricing, connection pooling, branching, edge compatibility.",
180
+ cardType: "workflow",
181
+ stack: "workflows",
182
+ keywords: ["database", "research", "neon", "supabase", "planetscale"],
183
+ links: [
184
+ { target: "agent-researcher", relation: "assigned_to" },
185
+ { target: "project-root", relation: "related" },
186
+ ],
187
+ });
188
+ }
189
+ }
190
+
191
+ // ─── Run the full flow ─────────────────────────────────
192
+
193
+ async function main() {
194
+ console.log("🃏 HyperStack Multi-Agent Demo\n");
195
+
196
+ await setup();
197
+ console.log();
198
+
199
+ await researcherFlow();
200
+ console.log();
201
+
202
+ await builderFlow();
203
+ console.log();
204
+
205
+ await coordinatorFlow();
206
+
207
+ console.log("\n✅ Demo complete. All agents share one typed graph.");
208
+ console.log(" No DECISIONS.md. No GOALS.md. Just queryable cards + relations.");
209
+ }
210
+
211
+ main().catch(err => {
212
+ console.error("Error:", err.message);
213
+ process.exit(1);
214
+ });