@@ -4,6 +4,55 @@ Joel Hooks - co-founder of egghead.io, education at Vercel, builds badass course
44
55---
66
7+ ## CLI-FIRST COMMANDMENT (NON-NEGOTIABLE)
8+
9+ ```
10+ ┌─────────────────────────────────────────────────────────────┐
11+ │ USE CLI TOOLS TO SCAFFOLD - NEVER HAND-WRITE CONFIGS │
12+ │ │
13+ │ create-next-app, create-turbo, pnpm init, npx shadcn@latest│
14+ │ Let the tools generate correct configs. Edit after. │
15+ └─────────────────────────────────────────────────────────────┘
16+ ```
17+
18+ ** NEVER hand-write from scratch:**
19+
20+ - ` package.json ` → Use ` pnpm init ` , ` npm init ` , or scaffolding CLIs
21+ - ` tsconfig.json ` → Use ` tsc --init ` or framework CLIs that generate it
22+ - ` next.config.js ` → Use ` create-next-app ` to scaffold
23+ - ` turbo.json ` → Use ` create-turbo ` or ` npx turbo init `
24+ - Component libraries → Use ` npx shadcn@latest init ` , not hand-written components
25+ - Tailwind config → Use ` npx tailwindcss init ` or framework integration
26+
27+ ** WHY?** Hand-written configs are hallucination magnets. CLIs generate correct, version-appropriate configs.
28+
29+ ** The pattern:**
30+
31+ 1 . ** Scaffold** with official CLI tools
32+ 2 . ** Verify** it works (` pnpm install && pnpm build ` )
33+ 3 . ** Edit** only what needs customization
34+ 4 . ** Verify again** after edits
35+
36+ ** Examples:**
37+
38+ ``` bash
39+ # Monorepo setup
40+ pnpm dlx create-turbo@latest my-app --package-manager pnpm
41+
42+ # Next.js app
43+ pnpm create next-app@latest apps/web --typescript --tailwind --eslint --app --src-dir
44+
45+ # Add shadcn to existing project
46+ cd apps/web && pnpm dlx shadcn@latest init
47+
48+ # Add specific components
49+ pnpm dlx shadcn@latest add button card
50+ ```
51+
52+ ** If a CLI exists for the task, USE IT. No exceptions.**
53+
54+ ---
55+
756## TDD COMMANDMENT (NON-NEGOTIABLE)
857
958```
@@ -109,28 +158,31 @@ The `opencode-swarm-plugin` provides type-safe, context-preserving wrappers. Alw
109158** CASS** (cross-agent session search):
110159| Tool | Purpose |
111160| ------| ---------|
112- | ` cass_search ` | Search all AI agent histories (query, agent, days, limit) |
113- | ` cass_view ` | View specific session from search results |
114- | ` cass_expand ` | Expand context around a specific line |
115- | ` cass_health ` | Check if index is ready |
116- | ` cass_index ` | Build/rebuild search index |
161+ | ` hivemind_find ` | Search all AI agent histories (query, agent, days, limit) |
162+ | ` hivemind_get ` | View specific session from search results |
163+ | ` hivemind_get ` | Expand context around a specific line |
164+ | ` hivemind_stats ` | Check if index is ready |
165+ | ` hivemind_index ` | Build/rebuild search index |
117166
118167** Semantic Memory** (persistent learning):
119168| Tool | Purpose |
120169| ------| ---------|
121- | ` semantic-memory_find ` | Search memories by semantic similarity (use ` expand=true ` for full content) |
122- | ` semantic-memory_store ` | Store learnings with metadata and tags |
123- | ` semantic-memory_get ` | Get a specific memory by ID |
124- | ` semantic-memory_remove ` | Delete outdated/incorrect memories |
125- | ` semantic-memory_validate ` | Validate memory accuracy (resets decay) |
126- | ` semantic-memory_list ` | List stored memories |
127- | ` semantic-memory_stats ` | Show memory statistics |
128- | ` semantic-memory_migrate ` | Migrate database (PGlite 0.2.x → 0.3.x) |
170+ | ` hivemind_find ` | Search memories by semantic similarity (use ` expand=true ` for full content) |
171+ | ` hivemind_store ` | Store learnings with metadata and tags |
172+ | ` hivemind_get ` | Get a specific memory by ID |
173+ | ` hivemind_remove ` | Delete outdated/incorrect memories |
174+ | ` hivemind_validate ` | Validate memory accuracy (resets decay) |
175+ | ` hivemind_find ` | List stored memories |
176+ | ` hivemind_stats ` | Show memory statistics |
177+ | ` hivemind_stats ` | Migrate database (PGlite 0.2.x → 0.3.x) |
129178
130179### Other Custom Tools
131180
132- - ** swarm_review, swarm_review_feedback** - Coordinator reviews worker output (3-strike rule)
181+ - ** cass_search, cass_view, cass_expand** - Search past agent sessions
182+ - ** semantic-memory_find, semantic-memory_store, semantic-memory_validate** - Persistent learning across sessions
183+
133184
185+ - ** swarm_review, swarm_review_feedback** - Coordinator reviews worker output (3-strike rule)
134186
135187- ** typecheck** - TypeScript check with grouped errors
136188- ** git-context** - Branch, status, commits, ahead/behind in one call
@@ -909,22 +961,22 @@ Search across ALL your AI coding agent histories. Before solving a problem from
909961
910962```bash
911963# Search across all agents
912- cass_search (query="authentication error", limit=5)
964+ hivemind_find (query="authentication error", limit=5)
913965
914966# Filter by agent
915- cass_search (query="useEffect cleanup", agent="claude", days=7)
967+ hivemind_find (query="useEffect cleanup", agent="claude", days=7)
916968
917969# Check health first (exit 0 = ready)
918- cass_health ()
970+ hivemind_stats ()
919971
920972# Build/rebuild index (run if health fails)
921- cass_index (full=true)
973+ hivemind_index (full=true)
922974
923975# View specific result from search
924- cass_view (path="/path/to/session.jsonl", line=42)
976+ hivemind_get (path="/path/to/session.jsonl", line=42)
925977
926978# Expand context around a line
927- cass_expand (path="/path/to/session.jsonl", line=42, context=5)
979+ hivemind_get (path="/path/to/session.jsonl", line=42, context=5)
928980````
929981
930982### Token Budget
@@ -950,28 +1002,28 @@ Store and retrieve learnings across sessions. Memories persist and are searchabl
9501002
9511003``` bash
9521004# Store a learning (include WHY, not just WHAT)
953- semantic-memory_store (information=" OAuth refresh tokens need 5min buffer before expiry to avoid race conditions" , tags=" auth,tokens,oauth" )
1005+ hivemind_store (information=" OAuth refresh tokens need 5min buffer before expiry to avoid race conditions" , tags=" auth,tokens,oauth" )
9541006
9551007# Search for relevant memories (truncated preview by default)
956- semantic-memory_find (query=" token refresh" , limit=5)
1008+ hivemind_find (query=" token refresh" , limit=5)
9571009
9581010# Search with full content (when you need details)
959- semantic-memory_find (query=" token refresh" , limit=5, expand=true)
1011+ hivemind_find (query=" token refresh" , limit=5, expand=true)
9601012
9611013# Get a specific memory by ID
962- semantic-memory_get (id=" mem_123" )
1014+ hivemind_get (id=" mem_123" )
9631015
9641016# Delete outdated/incorrect memory
965- semantic-memory_remove (id=" mem_456" )
1017+ hivemind_remove (id=" mem_456" )
9661018
9671019# Validate a memory is still accurate (resets decay timer)
968- semantic-memory_validate (id=" mem_123" )
1020+ hivemind_validate (id=" mem_123" )
9691021
9701022# List all memories
971- semantic-memory_list ()
1023+ hivemind_find ()
9721024
9731025# Check stats
974- semantic-memory_stats ()
1026+ hivemind_stats ()
9751027```
9761028
9771029### Memory Decay
@@ -1013,11 +1065,11 @@ Agents MUST proactively store learnings. The rule is simple: if you learned it t
10131065
10141066| Situation | Action | Consequence of Non-Compliance |
10151067| -------------------------------- | ---------------------------------------------------- | --------------------------------------------- |
1016- | ** Debugging >30min** | ` semantic-memory_store ()` with root cause + solution | Next agent wastes another 30min on same issue |
1068+ | ** Debugging >30min** | ` hivemind_store ()` with root cause + solution | Next agent wastes another 30min on same issue |
10171069| ** Architectural decision** | Store reasoning, alternatives, tradeoffs | Future changes break assumptions, regression |
10181070| ** Project-specific pattern** | Store domain rule with examples | Inconsistent implementations across codebase |
10191071| ** Tool/library gotcha** | Store quirk + workaround | Repeated trial-and-error, wasted time |
1020- | ** Before starting complex work** | ` semantic-memory_find ()` to check for learnings | Reinventing wheels, ignoring past failures |
1072+ | ** Before starting complex work** | ` hivemind_find ()` to check for learnings | Reinventing wheels, ignoring past failures |
10211073| ** After /debug-plus success** | Store prevention pattern if one was created | Prevention patterns not reused, bugs recur |
10221074
10231075### Good vs Bad Usage
@@ -1026,19 +1078,19 @@ Agents MUST proactively store learnings. The rule is simple: if you learned it t
10261078
10271079```
10281080# Too generic - this is in React docs
1029- semantic-memory_store (
1081+ hivemind_store (
10301082 information="useEffect cleanup functions prevent memory leaks",
10311083 metadata="react, hooks"
10321084)
10331085
10341086# No context - WHAT but not WHY
1035- semantic-memory_store (
1087+ hivemind_store (
10361088 information="Changed auth timeout to 5 minutes",
10371089 metadata="auth"
10381090)
10391091
10401092# Symptom, not root cause
1041- semantic-memory_store (
1093+ hivemind_store (
10421094 information="Fixed the login bug by adding a null check",
10431095 metadata="bugs"
10441096)
@@ -1054,31 +1106,31 @@ semantic-memory_store(
10541106
10551107```
10561108# Root cause + reasoning
1057- semantic-memory_store (
1109+ hivemind_store (
10581110 information="OAuth refresh tokens need 5min buffer before expiry to avoid race conditions. Without buffer, token refresh can fail mid-request if expiry happens between check and use. Implemented with: if (expiresAt - Date.now() < 300000) refresh(). Affects all API clients using refresh tokens.",
10591111 metadata="auth, oauth, tokens, race-conditions, api-clients"
10601112)
10611113
10621114# Architectural decision with tradeoffs
1063- semantic-memory_store (
1115+ hivemind_store (
10641116 information="Chose event sourcing for audit log instead of snapshot model. Rationale: immutable event history required for compliance (SOC2). Tradeoff: slower queries (mitigated with materialized views), but guarantees we can reconstruct any historical state. Alternative considered: dual-write to events + snapshots (rejected due to consistency complexity).",
10651117 metadata="architecture, audit-log, event-sourcing, compliance"
10661118)
10671119
10681120# Project-specific domain rule
1069- semantic-memory_store (
1121+ hivemind_store (
10701122 information="In this project, User.role='admin' does NOT grant deletion rights. Deletion requires explicit User.permissions.canDelete=true. This is because admin role is granted to support staff who shouldn't delete production data. Tripped up 3 agents so far. Check User.permissions, not User.role.",
10711123 metadata="domain-rules, auth, permissions, gotcha"
10721124)
10731125
10741126# Failed approach (anti-pattern)
1075- semantic-memory_store (
1127+ hivemind_store (
10761128 information="AVOID: Using Zod refinements for async validation. Attempted to validate unique email constraint with .refine(async email => !await db.exists(email)). Problem: Zod runs refinements during parse, blocking the event loop. Solution: validate uniqueness in application layer after parse, return specific validation error. Save Zod for synchronous structural validation only.",
10771129 metadata="zod, validation, async, anti-pattern, performance"
10781130)
10791131
10801132# Tool-specific gotcha
1081- semantic-memory_store (
1133+ hivemind_store (
10821134 information="Next.js 16 Cache Components: useSearchParams() causes entire component to become dynamic, breaking 'use cache'. Workaround: destructure params in parent Server Component, pass as props to cached child. Example: <CachedChild query={searchParams.query} />. Affects all search/filter UIs.",
10831135 metadata="nextjs, cache-components, dynamic-rendering, searchparams"
10841136)
@@ -1098,16 +1150,16 @@ semantic-memory_store(
10981150
10991151``` bash
11001152# Specific error message
1101- semantic-memory_find (query=" cannot read property of undefined auth" , limit=3)
1153+ hivemind_find (query=" cannot read property of undefined auth" , limit=3)
11021154
11031155# Domain area
1104- semantic-memory_find (query=" authentication tokens refresh" , limit=5)
1156+ hivemind_find (query=" authentication tokens refresh" , limit=5)
11051157
11061158# Technology stack
1107- semantic-memory_find (query=" Next.js caching searchParams" , limit=3)
1159+ hivemind_find (query=" Next.js caching searchParams" , limit=3)
11081160
11091161# Pattern type
1110- semantic-memory_find (query=" event sourcing materialized views" , limit=5)
1162+ hivemind_find (query=" event sourcing materialized views" , limit=5)
11111163```
11121164
11131165### Memory Validation Workflow
@@ -1116,7 +1168,7 @@ When you encounter a memory from search results and confirm it's still accurate:
11161168
11171169``` bash
11181170# Found a memory that helped solve current problem
1119- semantic-memory_validate (id=" mem_xyz123" )
1171+ hivemind_validate (id=" mem_xyz123" )
11201172```
11211173
11221174** This resets the 90-day decay timer.** Memories that stay relevant get reinforced. Stale memories fade.
@@ -1127,7 +1179,7 @@ The `/debug-plus` command creates prevention patterns. **ALWAYS** store these in
11271179
11281180``` bash
11291181# After debug-plus creates a prevention pattern
1130- semantic-memory_store (
1182+ hivemind_store (
11311183 information=" Prevention pattern for 'headers already sent' error: root cause is async middleware calling next() before awaiting response write. Detection: grep for 'res.send|res.json' followed by 'next()' without await. Prevention: enforce middleware contract - await all async operations before next(). Automated via UBS scan." ,
11321184 metadata=" debug-plus, prevention-pattern, express, async, middleware"
11331185)
@@ -1254,10 +1306,10 @@ When coordinating a swarm, you MUST monitor workers and review their output.
12541306
12551307### Review Tools
12561308
1257- | Tool | Purpose |
1258- | ------| ---------|
1259- | ` swarm_review ` | Generate review prompt with epic context, dependencies, and git diff |
1260- | ` swarm_review_feedback ` | Send approval/rejection to worker (tracks 3-strike rule) |
1309+ | Tool | Purpose |
1310+ | ----------------------- | -------------------------------------------------------------------- |
1311+ | ` swarm_review ` | Generate review prompt with epic context, dependencies, and git diff |
1312+ | ` swarm_review_feedback ` | Send approval/rejection to worker (tracks 3-strike rule) |
12611313
12621314### Review Criteria
12631315
0 commit comments