qualia-framework 2.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 (261) hide show
  1. package/README.md +50 -0
  2. package/bin/cli.js +519 -0
  3. package/framework/agents/architecture-strategist.md +53 -0
  4. package/framework/agents/backend-agent.md +150 -0
  5. package/framework/agents/code-simplicity-reviewer.md +86 -0
  6. package/framework/agents/frontend-agent.md +111 -0
  7. package/framework/agents/kieran-typescript-reviewer.md +96 -0
  8. package/framework/agents/performance-oracle.md +111 -0
  9. package/framework/agents/qualia-codebase-mapper.md +760 -0
  10. package/framework/agents/qualia-debugger.md +1203 -0
  11. package/framework/agents/qualia-executor.md +881 -0
  12. package/framework/agents/qualia-integration-checker.md +423 -0
  13. package/framework/agents/qualia-phase-researcher.md +453 -0
  14. package/framework/agents/qualia-plan-checker.md +699 -0
  15. package/framework/agents/qualia-planner.md +1241 -0
  16. package/framework/agents/qualia-project-researcher.md +602 -0
  17. package/framework/agents/qualia-research-synthesizer.md +236 -0
  18. package/framework/agents/qualia-roadmapper.md +605 -0
  19. package/framework/agents/qualia-verifier.md +685 -0
  20. package/framework/agents/team-orchestrator.md +228 -0
  21. package/framework/agents/teams/full-stack-team.md +48 -0
  22. package/framework/agents/teams/optimize-team.md +53 -0
  23. package/framework/agents/teams/review-team.md +62 -0
  24. package/framework/agents/teams/ship-team.md +86 -0
  25. package/framework/agents/test-agent.md +182 -0
  26. package/framework/askpass.sh +2 -0
  27. package/framework/commands/design.md +53 -0
  28. package/framework/commands/quick-db.md +22 -0
  29. package/framework/config/retention.json +35 -0
  30. package/framework/core/PRINCIPLES.md +77 -0
  31. package/framework/hooks/auto-format.sh +45 -0
  32. package/framework/hooks/block-env-edit.sh +42 -0
  33. package/framework/hooks/branch-guard.sh +46 -0
  34. package/framework/hooks/confirm-delete.sh +56 -0
  35. package/framework/hooks/migration-validate.sh +68 -0
  36. package/framework/hooks/notification-speak.sh +15 -0
  37. package/framework/hooks/pre-commit.sh +80 -0
  38. package/framework/hooks/pre-compact.sh +55 -0
  39. package/framework/hooks/pre-deploy-gate.sh +151 -0
  40. package/framework/hooks/qualia-colors.sh +32 -0
  41. package/framework/hooks/retention-cleanup.sh +43 -0
  42. package/framework/hooks/save-session-state.sh +153 -0
  43. package/framework/hooks/session-context-loader.sh +28 -0
  44. package/framework/hooks/session-learn.sh +30 -0
  45. package/framework/knowledge/claudecode-bible.md +1384 -0
  46. package/framework/knowledge/client-prefs.md +22 -0
  47. package/framework/knowledge/common-fixes.md +25 -0
  48. package/framework/knowledge/deployment-map.md +35 -0
  49. package/framework/knowledge/email-signature.html +1 -0
  50. package/framework/knowledge/employees.md +8 -0
  51. package/framework/knowledge/learned-patterns.md +51 -0
  52. package/framework/knowledge/optimization-research-2026.md +137 -0
  53. package/framework/knowledge/qualia-context.md +67 -0
  54. package/framework/knowledge/supabase-patterns.md +50 -0
  55. package/framework/knowledge/voice-agent-patterns.md +46 -0
  56. package/framework/qualia-engine/VERSION +1 -0
  57. package/framework/qualia-engine/bin/qualia-tools.js +2160 -0
  58. package/framework/qualia-engine/bin/qualia-tools.test.js +1054 -0
  59. package/framework/qualia-engine/references/checkpoints.md +775 -0
  60. package/framework/qualia-engine/references/continuation-format.md +249 -0
  61. package/framework/qualia-engine/references/decimal-phase-calculation.md +65 -0
  62. package/framework/qualia-engine/references/design-quality.md +56 -0
  63. package/framework/qualia-engine/references/git-integration.md +254 -0
  64. package/framework/qualia-engine/references/git-planning-commit.md +50 -0
  65. package/framework/qualia-engine/references/model-profile-resolution.md +32 -0
  66. package/framework/qualia-engine/references/model-profiles.md +73 -0
  67. package/framework/qualia-engine/references/phase-argument-parsing.md +61 -0
  68. package/framework/qualia-engine/references/planning-config.md +195 -0
  69. package/framework/qualia-engine/references/questioning.md +141 -0
  70. package/framework/qualia-engine/references/tdd.md +263 -0
  71. package/framework/qualia-engine/references/ui-brand.md +160 -0
  72. package/framework/qualia-engine/references/verification-patterns.md +612 -0
  73. package/framework/qualia-engine/templates/DEBUG.md +159 -0
  74. package/framework/qualia-engine/templates/DESIGN.md +81 -0
  75. package/framework/qualia-engine/templates/UAT.md +247 -0
  76. package/framework/qualia-engine/templates/codebase/architecture.md +255 -0
  77. package/framework/qualia-engine/templates/codebase/concerns.md +310 -0
  78. package/framework/qualia-engine/templates/codebase/conventions.md +307 -0
  79. package/framework/qualia-engine/templates/codebase/integrations.md +280 -0
  80. package/framework/qualia-engine/templates/codebase/stack.md +186 -0
  81. package/framework/qualia-engine/templates/codebase/structure.md +285 -0
  82. package/framework/qualia-engine/templates/codebase/testing.md +480 -0
  83. package/framework/qualia-engine/templates/config.json +35 -0
  84. package/framework/qualia-engine/templates/context.md +283 -0
  85. package/framework/qualia-engine/templates/continue-here.md +78 -0
  86. package/framework/qualia-engine/templates/debug-subagent-prompt.md +91 -0
  87. package/framework/qualia-engine/templates/discovery.md +146 -0
  88. package/framework/qualia-engine/templates/milestone-archive.md +123 -0
  89. package/framework/qualia-engine/templates/milestone.md +115 -0
  90. package/framework/qualia-engine/templates/phase-prompt.md +567 -0
  91. package/framework/qualia-engine/templates/planner-subagent-prompt.md +117 -0
  92. package/framework/qualia-engine/templates/project.md +184 -0
  93. package/framework/qualia-engine/templates/projects/ai-agent.md +156 -0
  94. package/framework/qualia-engine/templates/projects/mobile-app.md +181 -0
  95. package/framework/qualia-engine/templates/projects/voice-agent.md +134 -0
  96. package/framework/qualia-engine/templates/projects/website.md +137 -0
  97. package/framework/qualia-engine/templates/requirements.md +231 -0
  98. package/framework/qualia-engine/templates/research-project/ARCHITECTURE.md +204 -0
  99. package/framework/qualia-engine/templates/research-project/FEATURES.md +147 -0
  100. package/framework/qualia-engine/templates/research-project/PITFALLS.md +200 -0
  101. package/framework/qualia-engine/templates/research-project/STACK.md +120 -0
  102. package/framework/qualia-engine/templates/research-project/SUMMARY.md +170 -0
  103. package/framework/qualia-engine/templates/research.md +552 -0
  104. package/framework/qualia-engine/templates/roadmap.md +202 -0
  105. package/framework/qualia-engine/templates/state.md +176 -0
  106. package/framework/qualia-engine/templates/summary-complex.md +59 -0
  107. package/framework/qualia-engine/templates/summary-minimal.md +41 -0
  108. package/framework/qualia-engine/templates/summary-standard.md +48 -0
  109. package/framework/qualia-engine/templates/summary.md +246 -0
  110. package/framework/qualia-engine/templates/user-setup.md +311 -0
  111. package/framework/qualia-engine/templates/verification-report.md +322 -0
  112. package/framework/qualia-engine/workflows/add-phase.md +179 -0
  113. package/framework/qualia-engine/workflows/add-todo.md +157 -0
  114. package/framework/qualia-engine/workflows/audit-milestone.md +241 -0
  115. package/framework/qualia-engine/workflows/check-todos.md +176 -0
  116. package/framework/qualia-engine/workflows/complete-milestone.md +858 -0
  117. package/framework/qualia-engine/workflows/diagnose-issues.md +219 -0
  118. package/framework/qualia-engine/workflows/discovery-phase.md +289 -0
  119. package/framework/qualia-engine/workflows/discuss-phase.md +534 -0
  120. package/framework/qualia-engine/workflows/execute-phase.md +559 -0
  121. package/framework/qualia-engine/workflows/execute-plan.md +438 -0
  122. package/framework/qualia-engine/workflows/help.md +470 -0
  123. package/framework/qualia-engine/workflows/insert-phase.md +220 -0
  124. package/framework/qualia-engine/workflows/list-phase-assumptions.md +178 -0
  125. package/framework/qualia-engine/workflows/map-codebase.md +327 -0
  126. package/framework/qualia-engine/workflows/new-milestone.md +363 -0
  127. package/framework/qualia-engine/workflows/new-project.md +1037 -0
  128. package/framework/qualia-engine/workflows/pause-work.md +122 -0
  129. package/framework/qualia-engine/workflows/plan-milestone-gaps.md +256 -0
  130. package/framework/qualia-engine/workflows/plan-phase.md +422 -0
  131. package/framework/qualia-engine/workflows/progress.md +354 -0
  132. package/framework/qualia-engine/workflows/quick.md +252 -0
  133. package/framework/qualia-engine/workflows/remove-phase.md +326 -0
  134. package/framework/qualia-engine/workflows/research-phase.md +74 -0
  135. package/framework/qualia-engine/workflows/resume-project.md +306 -0
  136. package/framework/qualia-engine/workflows/set-profile.md +80 -0
  137. package/framework/qualia-engine/workflows/settings.md +145 -0
  138. package/framework/qualia-engine/workflows/transition.md +556 -0
  139. package/framework/qualia-engine/workflows/update.md +197 -0
  140. package/framework/qualia-engine/workflows/verify-phase.md +195 -0
  141. package/framework/qualia-engine/workflows/verify-work.md +625 -0
  142. package/framework/rules/context7.md +11 -0
  143. package/framework/rules/deployment.md +29 -0
  144. package/framework/rules/frontend.md +33 -0
  145. package/framework/rules/security.md +12 -0
  146. package/framework/rules/speed.md +20 -0
  147. package/framework/scripts/__pycache__/say.cpython-314.pyc +0 -0
  148. package/framework/scripts/apply-retention.sh +120 -0
  149. package/framework/scripts/bootstrap-pop-os.sh +354 -0
  150. package/framework/scripts/claude-voice +13 -0
  151. package/framework/scripts/cleanup.sh +131 -0
  152. package/framework/scripts/cowork-mode.sh +141 -0
  153. package/framework/scripts/generate-project-claude-md.sh +153 -0
  154. package/framework/scripts/load-test-webhook.js +172 -0
  155. package/framework/scripts/say.py +236 -0
  156. package/framework/scripts/showcase-video-recorder/ffmpeg-builder.js +167 -0
  157. package/framework/scripts/showcase-video-recorder/playwright-helpers.js +216 -0
  158. package/framework/scripts/speak.py +55 -0
  159. package/framework/scripts/speak.sh +18 -0
  160. package/framework/scripts/status.sh +138 -0
  161. package/framework/scripts/sync-to-framework.sh +65 -0
  162. package/framework/scripts/voice-hotkey.py +227 -0
  163. package/framework/scripts/voice-input.sh +51 -0
  164. package/framework/skills/animate/SKILL.md +202 -0
  165. package/framework/skills/bolder/SKILL.md +144 -0
  166. package/framework/skills/browser-qa/SKILL.md +536 -0
  167. package/framework/skills/clarify/SKILL.md +179 -0
  168. package/framework/skills/colorize/SKILL.md +170 -0
  169. package/framework/skills/critique/SKILL.md +126 -0
  170. package/framework/skills/deep-research/SKILL.md +271 -0
  171. package/framework/skills/delight/SKILL.md +329 -0
  172. package/framework/skills/deploy/SKILL.md +261 -0
  173. package/framework/skills/deploy-verify/SKILL.md +377 -0
  174. package/framework/skills/deploy-verify/scripts/canary-check.sh +206 -0
  175. package/framework/skills/deploy-verify/scripts/check-console-errors.js +147 -0
  176. package/framework/skills/deploy-verify/scripts/check-cwv.js +139 -0
  177. package/framework/skills/deploy-verify/scripts/project-detect.sh +84 -0
  178. package/framework/skills/deploy-verify/scripts/verify.sh +548 -0
  179. package/framework/skills/design-quieter/SKILL.md +130 -0
  180. package/framework/skills/distill/SKILL.md +149 -0
  181. package/framework/skills/docs-lookup/SKILL.md +78 -0
  182. package/framework/skills/fcm-notifications/SKILL.md +125 -0
  183. package/framework/skills/financial-ledger/SKILL.md +1039 -0
  184. package/framework/skills/frontend-master/NOTICE.md +4 -0
  185. package/framework/skills/frontend-master/SKILL.md +127 -0
  186. package/framework/skills/frontend-master/reference/color-and-contrast.md +132 -0
  187. package/framework/skills/frontend-master/reference/interaction-design.md +123 -0
  188. package/framework/skills/frontend-master/reference/motion-design.md +99 -0
  189. package/framework/skills/frontend-master/reference/responsive-design.md +114 -0
  190. package/framework/skills/frontend-master/reference/spatial-design.md +100 -0
  191. package/framework/skills/frontend-master/reference/typography.md +131 -0
  192. package/framework/skills/frontend-master/reference/ux-writing.md +107 -0
  193. package/framework/skills/harden/SKILL.md +357 -0
  194. package/framework/skills/i18n-rtl/SKILL.md +752 -0
  195. package/framework/skills/learn/SKILL.md +71 -0
  196. package/framework/skills/memory/SKILL.md +50 -0
  197. package/framework/skills/mobile-expo/SKILL.md +864 -0
  198. package/framework/skills/mobile-expo/references/store-checklist.md +550 -0
  199. package/framework/skills/nestjs-backend/README.md +73 -0
  200. package/framework/skills/nestjs-backend/SKILL.md +446 -0
  201. package/framework/skills/nestjs-backend/references/templates.md +1173 -0
  202. package/framework/skills/normalize/SKILL.md +79 -0
  203. package/framework/skills/onboard/SKILL.md +242 -0
  204. package/framework/skills/polish/SKILL.md +209 -0
  205. package/framework/skills/pr/SKILL.md +66 -0
  206. package/framework/skills/qualia/SKILL.md +153 -0
  207. package/framework/skills/qualia-add-todo/SKILL.md +68 -0
  208. package/framework/skills/qualia-audit-milestone/SKILL.md +92 -0
  209. package/framework/skills/qualia-check-todos/SKILL.md +55 -0
  210. package/framework/skills/qualia-complete-milestone/SKILL.md +108 -0
  211. package/framework/skills/qualia-debug/SKILL.md +149 -0
  212. package/framework/skills/qualia-design/SKILL.md +203 -0
  213. package/framework/skills/qualia-discuss-phase/SKILL.md +72 -0
  214. package/framework/skills/qualia-execute-phase/SKILL.md +86 -0
  215. package/framework/skills/qualia-help/SKILL.md +67 -0
  216. package/framework/skills/qualia-idk/SKILL.md +352 -0
  217. package/framework/skills/qualia-list-phase-assumptions/SKILL.md +67 -0
  218. package/framework/skills/qualia-new-milestone/SKILL.md +72 -0
  219. package/framework/skills/qualia-new-project/SKILL.md +92 -0
  220. package/framework/skills/qualia-optimize/SKILL.md +417 -0
  221. package/framework/skills/qualia-pause-work/SKILL.md +96 -0
  222. package/framework/skills/qualia-plan-milestone-gaps/SKILL.md +57 -0
  223. package/framework/skills/qualia-plan-phase/SKILL.md +101 -0
  224. package/framework/skills/qualia-progress/SKILL.md +53 -0
  225. package/framework/skills/qualia-quick/SKILL.md +89 -0
  226. package/framework/skills/qualia-research-phase/SKILL.md +88 -0
  227. package/framework/skills/qualia-resume-work/SKILL.md +62 -0
  228. package/framework/skills/qualia-review/SKILL.md +263 -0
  229. package/framework/skills/qualia-start/SKILL.md +182 -0
  230. package/framework/skills/qualia-verify-work/SKILL.md +105 -0
  231. package/framework/skills/qualia-workflow/SKILL.md +130 -0
  232. package/framework/skills/rag/SKILL.md +750 -0
  233. package/framework/skills/responsive/SKILL.md +231 -0
  234. package/framework/skills/retro/SKILL.md +284 -0
  235. package/framework/skills/sakani-conventions/SKILL.md +136 -0
  236. package/framework/skills/sakani-conventions/evals/evals.json +23 -0
  237. package/framework/skills/sakani-conventions/references/entities.md +365 -0
  238. package/framework/skills/sakani-conventions/references/error-codes.md +95 -0
  239. package/framework/skills/seo-master/SKILL.md +490 -0
  240. package/framework/skills/seo-master/references/checklist.md +199 -0
  241. package/framework/skills/seo-master/references/structured-data.md +609 -0
  242. package/framework/skills/ship/SKILL.md +202 -0
  243. package/framework/skills/stack-researcher/SKILL.md +215 -0
  244. package/framework/skills/status/SKILL.md +154 -0
  245. package/framework/skills/status/scripts/health-check.sh +562 -0
  246. package/framework/skills/subscription-payments/SKILL.md +250 -0
  247. package/framework/skills/supabase/SKILL.md +973 -0
  248. package/framework/skills/supabase/references/templates.md +159 -0
  249. package/framework/skills/team/SKILL.md +67 -0
  250. package/framework/skills/test-runner/SKILL.md +202 -0
  251. package/framework/skills/voice-agent/SKILL.md +407 -0
  252. package/framework/skills/zoho-workflow/SKILL.md +51 -0
  253. package/framework/statusline-command.sh +117 -0
  254. package/package.json +24 -0
  255. package/profiles/fawzi.json +16 -0
  256. package/profiles/hasan.json +16 -0
  257. package/profiles/moayad.json +16 -0
  258. package/templates/CLAUDE-owner.md +52 -0
  259. package/templates/CLAUDE.md.hbs +58 -0
  260. package/templates/env.claude.template +12 -0
  261. package/templates/settings.json +141 -0
@@ -0,0 +1,407 @@
1
+ ---
2
+ name: voice-agent
3
+ description: Build complete voice AI agents - design conversational flow, create VAPI assistant, integrate Supabase, deploy. Full voice agent development.
4
+ tags: [voice, vapi, ai-agent, supabase, elevenlabs]
5
+ ---
6
+
7
+ # Voice Agent Builder
8
+
9
+ Build complete voice AI agents from design to deployment.
10
+
11
+ ## Pipeline
12
+
13
+ ```
14
+ 1. Design Conversation Flow
15
+
16
+ 2. Create VAPI Assistant
17
+
18
+ 3. Setup Supabase Backend
19
+
20
+ 4. Configure Webhooks
21
+
22
+ 5. Deploy & Test
23
+ ```
24
+
25
+ ## Quick Start
26
+
27
+ Say: "build voice agent for [use case]"
28
+
29
+ Example: "build voice agent for appointment scheduling"
30
+
31
+ I will:
32
+ 1. Design the conversation flow
33
+ 2. Create VAPI assistant configuration
34
+ 3. Set up Supabase tables for state
35
+ 4. Configure webhooks
36
+ 5. Deploy and test
37
+
38
+ ## Stage 1: Design Conversation Flow
39
+
40
+ ### Flow Diagram
41
+ ```
42
+ ┌──────────────────┐
43
+ │ Call Starts │
44
+ └────────┬─────────┘
45
+
46
+ ┌──────────────────┐
47
+ │ Greeting │
48
+ │ "Hello, how can │
49
+ │ I help you?" │
50
+ └────────┬─────────┘
51
+
52
+ ┌──────────────────┐
53
+ │ Intent Detection │
54
+ │ - Book appointment│
55
+ │ - Check status │
56
+ │ - Other inquiry │
57
+ └────────┬─────────┘
58
+
59
+ ┌─────┴─────┐
60
+ ↓ ↓
61
+ ┌──────┐ ┌──────┐
62
+ │ Book │ │ Help │
63
+ └──────┘ └──────┘
64
+ ```
65
+
66
+ ### State Machine
67
+ ```typescript
68
+ const conversationStates = {
69
+ GREETING: {
70
+ next: ['INTENT_DETECTION'],
71
+ actions: ['playGreeting']
72
+ },
73
+ INTENT_DETECTION: {
74
+ next: ['BOOKING', 'STATUS_CHECK', 'TRANSFER'],
75
+ actions: ['detectIntent']
76
+ },
77
+ BOOKING: {
78
+ next: ['COLLECT_DATE', 'COLLECT_TIME', 'CONFIRM'],
79
+ actions: ['startBooking']
80
+ },
81
+ // ...
82
+ };
83
+ ```
84
+
85
+ ## Stage 2: Create VAPI Assistant
86
+
87
+ ### Assistant Configuration
88
+ ```typescript
89
+ const assistant = {
90
+ name: "Appointment Scheduler",
91
+ model: {
92
+ provider: "anthropic",
93
+ model: "claude-3-5-sonnet-20241022",
94
+ temperature: 0.7,
95
+ systemPrompt: `You are a friendly appointment scheduling assistant.
96
+ Your job is to help callers book appointments.
97
+
98
+ ## Capabilities
99
+ - Book new appointments
100
+ - Check existing appointments
101
+ - Reschedule appointments
102
+ - Answer questions about services
103
+
104
+ ## Conversation Flow
105
+ 1. Greet the caller warmly
106
+ 2. Ask how you can help
107
+ 3. Collect necessary information
108
+ 4. Confirm the action
109
+ 5. End the call politely
110
+
111
+ ## Important Rules
112
+ - Always confirm before booking
113
+ - Validate dates and times
114
+ - Collect caller's phone for confirmation
115
+ - Be concise but friendly`
116
+ },
117
+ voice: {
118
+ provider: "11labs",
119
+ voiceId: "21m00Tcm4TlvDq8ikWAM", // Rachel
120
+ stability: 0.5,
121
+ similarityBoost: 0.75
122
+ },
123
+ firstMessage: "Hello! Thanks for calling. How can I help you today?",
124
+ endCallMessage: "Thank you for calling. Have a great day!",
125
+ transcriber: {
126
+ provider: "deepgram",
127
+ model: "nova-2",
128
+ language: "en"
129
+ },
130
+ serverUrl: "https://your-app.com/api/vapi-webhook"
131
+ };
132
+ ```
133
+
134
+ ### Create via VAPI
135
+ > Use VAPI MCP tools (available via settings.json) or direct VAPI API via curl/WebFetch.
136
+ > Example: `curl -X POST https://api.vapi.ai/assistant -H "Authorization: Bearer $VAPI_API_KEY" -d '<config>'`
137
+
138
+ ## Stage 3: Setup Supabase Backend
139
+
140
+ ### Database Schema
141
+ ```sql
142
+ -- Appointments table
143
+ CREATE TABLE appointments (
144
+ id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
145
+ customer_phone TEXT NOT NULL,
146
+ customer_name TEXT,
147
+ service_type TEXT NOT NULL,
148
+ appointment_date DATE NOT NULL,
149
+ appointment_time TIME NOT NULL,
150
+ status TEXT DEFAULT 'scheduled' CHECK (status IN ('scheduled', 'confirmed', 'cancelled', 'completed')),
151
+ notes TEXT,
152
+ created_at TIMESTAMPTZ DEFAULT NOW(),
153
+ updated_at TIMESTAMPTZ DEFAULT NOW()
154
+ );
155
+
156
+ -- Call logs
157
+ CREATE TABLE call_logs (
158
+ id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
159
+ call_id TEXT UNIQUE NOT NULL,
160
+ phone_number TEXT NOT NULL,
161
+ duration_seconds INTEGER,
162
+ transcript TEXT,
163
+ outcome TEXT,
164
+ created_at TIMESTAMPTZ DEFAULT NOW()
165
+ );
166
+
167
+ -- Agent state (for context between calls)
168
+ CREATE TABLE agent_state (
169
+ phone_number TEXT PRIMARY KEY,
170
+ last_call_id TEXT,
171
+ context JSONB DEFAULT '{}',
172
+ updated_at TIMESTAMPTZ DEFAULT NOW()
173
+ );
174
+
175
+ -- Enable RLS
176
+ ALTER TABLE appointments ENABLE ROW LEVEL SECURITY;
177
+ ALTER TABLE call_logs ENABLE ROW LEVEL SECURITY;
178
+ ALTER TABLE agent_state ENABLE ROW LEVEL SECURITY;
179
+
180
+ -- RLS Policies: service role only (called from edge functions)
181
+ CREATE POLICY "Service role full access" ON appointments
182
+ FOR ALL USING (auth.role() = 'service_role');
183
+
184
+ CREATE POLICY "Service role full access" ON call_logs
185
+ FOR ALL USING (auth.role() = 'service_role');
186
+
187
+ CREATE POLICY "Service role full access" ON agent_state
188
+ FOR ALL USING (auth.role() = 'service_role');
189
+ ```
190
+
191
+ ### API Functions
192
+ ```typescript
193
+ // supabase/functions/book-appointment/index.ts
194
+ import { z } from "https://deno.land/x/zod/mod.ts"
195
+
196
+ const BookingSchema = z.object({
197
+ phone: z.string().min(10),
198
+ date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
199
+ time: z.string().regex(/^\d{2}:\d{2}$/),
200
+ service: z.string().min(1),
201
+ })
202
+
203
+ serve(async (req) => {
204
+ try {
205
+ const raw = await req.json();
206
+ const { phone, date, time, service } = BookingSchema.parse(raw);
207
+
208
+ const supabase = createClient(
209
+ Deno.env.get('SUPABASE_URL')!,
210
+ Deno.env.get('SUPABASE_SERVICE_ROLE_KEY')!
211
+ );
212
+
213
+ // Check availability
214
+ const { data: existing } = await supabase
215
+ .from('appointments')
216
+ .select('id')
217
+ .eq('appointment_date', date)
218
+ .eq('appointment_time', time)
219
+ .single();
220
+
221
+ if (existing) {
222
+ return new Response(JSON.stringify({
223
+ success: false,
224
+ message: "That time slot is already booked."
225
+ }));
226
+ }
227
+
228
+ // Book appointment
229
+ const { data, error } = await supabase
230
+ .from('appointments')
231
+ .insert({
232
+ customer_phone: phone,
233
+ appointment_date: date,
234
+ appointment_time: time,
235
+ service_type: service
236
+ })
237
+ .select()
238
+ .single();
239
+
240
+ return new Response(JSON.stringify({
241
+ success: true,
242
+ appointment: data,
243
+ message: `Appointment booked for ${date} at ${time}`
244
+ }));
245
+ } catch (error) {
246
+ console.error("Booking error:", error);
247
+ return new Response(JSON.stringify({
248
+ success: false,
249
+ message: "Failed to process booking request"
250
+ }), { status: 500 });
251
+ }
252
+ });
253
+ ```
254
+
255
+ ## Stage 4: Configure Webhooks
256
+
257
+ ### VAPI Webhook Handler
258
+ ```typescript
259
+ // supabase/functions/vapi-webhook/index.ts
260
+ serve(async (req) => {
261
+ try {
262
+ // Verify VAPI webhook signature
263
+ const signature = req.headers.get('x-vapi-signature');
264
+ const body = await req.text();
265
+
266
+ if (!verifyVapiSignature(body, signature, Deno.env.get('VAPI_WEBHOOK_SECRET')!)) {
267
+ return new Response('Unauthorized', { status: 401 });
268
+ }
269
+
270
+ const event = JSON.parse(body);
271
+ const supabase = createClient(/* ... */);
272
+
273
+ switch (event.message.type) {
274
+ case 'function-call':
275
+ // Handle tool calls
276
+ const { name, parameters } = event.message.functionCall;
277
+
278
+ switch (name) {
279
+ case 'book_appointment':
280
+ const result = await bookAppointment(parameters);
281
+ return new Response(JSON.stringify({ result }));
282
+
283
+ case 'check_availability':
284
+ const slots = await checkAvailability(parameters);
285
+ return new Response(JSON.stringify({ result: slots }));
286
+
287
+ case 'get_customer_appointments':
288
+ const appointments = await getAppointments(parameters.phone);
289
+ return new Response(JSON.stringify({ result: appointments }));
290
+ }
291
+ break;
292
+
293
+ case 'end-of-call-report':
294
+ // Log call
295
+ await supabase.from('call_logs').insert({
296
+ call_id: event.call.id,
297
+ phone_number: event.call.customer.number,
298
+ duration_seconds: event.call.duration,
299
+ transcript: event.transcript,
300
+ outcome: event.call.endedReason
301
+ });
302
+ break;
303
+
304
+ case 'status-update':
305
+ console.log('Call status:', event.status);
306
+ break;
307
+ }
308
+
309
+ return new Response('OK');
310
+ } catch (error) {
311
+ console.error("Webhook error:", error);
312
+ return new Response(JSON.stringify({ error: "Internal server error" }), {
313
+ status: 500,
314
+ headers: { "Content-Type": "application/json" },
315
+ });
316
+ }
317
+ });
318
+ ```
319
+
320
+ ### Tool Definitions
321
+ ```typescript
322
+ const tools = [
323
+ {
324
+ type: "function",
325
+ function: {
326
+ name: "book_appointment",
327
+ description: "Book a new appointment for the caller",
328
+ parameters: {
329
+ type: "object",
330
+ properties: {
331
+ date: { type: "string", description: "Date in YYYY-MM-DD format" },
332
+ time: { type: "string", description: "Time in HH:MM format" },
333
+ service: { type: "string", description: "Type of service" }
334
+ },
335
+ required: ["date", "time", "service"]
336
+ }
337
+ }
338
+ },
339
+ {
340
+ type: "function",
341
+ function: {
342
+ name: "check_availability",
343
+ description: "Check available appointment slots",
344
+ parameters: {
345
+ type: "object",
346
+ properties: {
347
+ date: { type: "string", description: "Date to check" }
348
+ },
349
+ required: ["date"]
350
+ }
351
+ }
352
+ }
353
+ ];
354
+ ```
355
+
356
+ ## Stage 5: Deploy & Test
357
+
358
+ ### Deploy Steps
359
+ ```bash
360
+ # Deploy Supabase functions
361
+ supabase functions deploy book-appointment
362
+ supabase functions deploy vapi-webhook
363
+
364
+ # Update VAPI assistant with webhook URL
365
+ # Use VAPI dashboard or API
366
+
367
+ # Test with a call
368
+ vapi call --assistant-id your-assistant-id --to +1234567890
369
+ ```
370
+
371
+ ### Test Scenarios
372
+ 1. **Happy path**: Book appointment successfully
373
+ 2. **Conflict**: Time slot unavailable
374
+ 3. **Edge case**: Invalid date format
375
+ 4. **Error handling**: Database connection fails
376
+ 5. **Context persistence**: Caller calls back
377
+
378
+ ## Voice Selection (ElevenLabs)
379
+
380
+ | Use Case | Voice | Why |
381
+ |----------|-------|-----|
382
+ | Professional | Rachel | Calm, clear, authoritative |
383
+ | Friendly | Bella | Warm, approachable |
384
+ | Energetic | Elli | Upbeat, engaging |
385
+ | Corporate | Adam | Professional male |
386
+
387
+ ## Best Practices
388
+
389
+ 1. **Keep responses short** - 1-2 sentences max
390
+ 2. **Confirm important info** - Repeat back dates/times
391
+ 3. **Handle interruptions** - Allow user to interrupt
392
+ 4. **Provide escape routes** - "Say 'operator' for help"
393
+ 5. **Log everything** - For debugging and improvement
394
+ 6. **Test extensively** - Real phone calls, various accents
395
+
396
+ ## Integration with Other Skills
397
+
398
+ - **voice-agent** - This skill (VAPI patterns, conversation flow, webhooks)
399
+ - **supabase** - For database operations
400
+ - **docs-lookup** - For VAPI/ElevenLabs/Deepgram API docs
401
+
402
+ ## Trigger Phrases
403
+
404
+ - "build voice agent"
405
+ - "create voice assistant"
406
+ - "voice AI for"
407
+ - "phone bot for"
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: zoho-workflow
3
+ description: Zoho Invoice and Mail operations - create invoices, send emails, manage contacts. Use when Fawzi mentions invoicing, email, or Zoho.
4
+ tags: [zoho, invoice, email, billing, crm]
5
+ ---
6
+
7
+ # Zoho Workflow
8
+
9
+
10
+ ## Zoho Invoice
11
+
12
+ - Create, edit, send, and void invoices
13
+ - List and search invoices by client, status, date
14
+ - Manage items, taxes, contacts, and expenses
15
+ - Mark invoices as sent/paid, send payment reminders
16
+ - Generate invoice PDFs and email them to clients
17
+ - Create recurring invoices and credit notes
18
+ - When Fawzi says "invoice [client]" — create the full invoice, don't just explain how
19
+ - Default sender org: Qualia Solutions
20
+
21
+ ## Zoho Mail
22
+
23
+ - Read inbox, sent, drafts, and folder contents
24
+ - Send emails and reply to threads
25
+ - Move, label, and organize messages
26
+ - Search emails by sender, subject, date
27
+ - When Fawzi says "email [someone]" or "check inbox" — do it directly
28
+ - Use Fawzi's primary Zoho Mail account
29
+
30
+ ## Email Formatting Rules (MANDATORY)
31
+
32
+ - Always append Fawzi's signature at the bottom of every email
33
+ - Read signature HTML from `~/.claude/knowledge/email-signature.html`
34
+ - Never use dashes (---) or horizontal separators
35
+ - Never use emojis
36
+ - Professional, direct tone
37
+ - Keep it concise and action-oriented
38
+
39
+ ## General Rules
40
+
41
+ - Always act, don't just describe. Execute operations directly.
42
+ - Fetch the organization ID first if needed (use the list/get org tools)
43
+ - If a tool call fails, debug it — check params, retry with fixes
44
+
45
+ ## Trigger Phrases
46
+
47
+ - "invoice [client]" → Create and send invoice
48
+ - "email [someone]" → Compose and send email
49
+ - "check inbox" → Read inbox
50
+ - "send reminder" → Payment reminder
51
+ - "create contact" → New Zoho contact
@@ -0,0 +1,117 @@
1
+ #!/bin/bash
2
+ # Qualia statusline — teal-branded, compact, informative
3
+ # Layout: ◆ dir branch [status] │ phase │ model ━━━━ 23%
4
+
5
+ input=$(cat)
6
+
7
+ USED_PCT=$(echo "$input" | jq -r '.context_window.used_percentage // empty')
8
+ MODEL=$(echo "$input" | jq -r '.model.display_name')
9
+ CWD=$(echo "$input" | jq -r '.workspace.current_dir')
10
+
11
+ [ -z "$USED_PCT" ] && exit 0
12
+
13
+ USED_INT=$(printf '%.0f' "$USED_PCT")
14
+
15
+ # Directory shortening (last 2 segments max)
16
+ DIR="$CWD"
17
+ DIR="${DIR/#$HOME/\~}"
18
+ DEPTH=$(echo "$DIR" | tr -cd '/' | wc -c)
19
+ if [ "$DEPTH" -gt 2 ]; then
20
+ DIR=$(echo "$DIR" | rev | cut -d'/' -f1-2 | rev)
21
+ DIR="…/$DIR"
22
+ fi
23
+
24
+ # ── Colors ──
25
+ T='\033[38;2;0;188;175m' # teal
26
+ TB='\033[38;2;45;226;210m' # teal bright
27
+ TD='\033[38;2;0;120;112m' # teal dim
28
+ W='\033[38;2;220;225;230m' # white
29
+ G='\033[38;2;70;78;88m' # gray
30
+ GR='\033[38;2;52;211;153m' # green
31
+ Y='\033[38;2;234;179;8m' # yellow
32
+ R='\033[38;2;239;68;68m' # red
33
+ P='\033[38;2;189;147;249m' # purple
34
+ X='\033[0m' # reset
35
+
36
+ # Context bar color
37
+ if [ "$USED_INT" -ge 70 ]; then CB="$R"
38
+ elif [ "$USED_INT" -ge 50 ]; then CB="$Y"
39
+ else CB="$T"; fi
40
+
41
+ # ── Project + phase detection ──
42
+ PROJECT=""
43
+ PHASE=""
44
+
45
+ if [ -f "$CWD/.planning/STATE.md" ]; then
46
+ PROJECT=$(grep -m1 "^Project:" "$CWD/.planning/STATE.md" 2>/dev/null | sed 's/^Project: *//')
47
+ # Get phase number only (e.g. "3 of 6") — not the full description
48
+ PHASE_RAW=$(grep -m1 "^Phase:" "$CWD/.planning/STATE.md" 2>/dev/null | sed 's/^Phase: *//')
49
+ if [ -n "$PHASE_RAW" ]; then
50
+ # Extract "N of M" pattern or just take first 12 chars
51
+ PHASE_SHORT=$(echo "$PHASE_RAW" | grep -oP '^\d+ of \d+' 2>/dev/null)
52
+ [ -z "$PHASE_SHORT" ] && PHASE_SHORT=$(echo "$PHASE_RAW" | head -c 12)
53
+ PHASE="$PHASE_SHORT"
54
+ fi
55
+ fi
56
+
57
+ [ -z "$PROJECT" ] && [ -f "$CWD/package.json" ] && PROJECT=$(node -e "try{console.log(require('$CWD/package.json').name||'')}catch(e){}" 2>/dev/null)
58
+
59
+ # Git branch
60
+ BRANCH=$(git -C "$CWD" --no-optional-locks branch --show-current 2>/dev/null)
61
+ GIT_STATUS=""
62
+ if [ -n "$BRANCH" ]; then
63
+ GIT_RAW=$(git -C "$CWD" --no-optional-locks status --porcelain 2>/dev/null | head -20)
64
+ if [ -n "$GIT_RAW" ]; then
65
+ M=$(echo "$GIT_RAW" | grep -c '^ M\|^MM\|^AM')
66
+ S=$(echo "$GIT_RAW" | grep -c '^[MARCD] ')
67
+ U=$(echo "$GIT_RAW" | grep -c '^??')
68
+ [ "$M" -gt 0 ] && GIT_STATUS+="!${M}"
69
+ [ "$S" -gt 0 ] && GIT_STATUS+="+${S}"
70
+ [ "$U" -gt 0 ] && GIT_STATUS+="?${U}"
71
+ fi
72
+ fi
73
+
74
+ # ── Context bar ──
75
+ BAR_W=10
76
+ FILLED=$(( USED_INT * BAR_W / 100 ))
77
+ [ "$FILLED" -gt "$BAR_W" ] && FILLED=$BAR_W
78
+ EMPTY=$(( BAR_W - FILLED ))
79
+ BAR=""; for ((i=0; i<FILLED; i++)); do BAR+="━"; done
80
+ EBAR=""; for ((i=0; i<EMPTY; i++)); do EBAR+="─"; done
81
+
82
+ # ── Build statusline ──
83
+ OUT=""
84
+
85
+ # ◆ brand mark
86
+ OUT+="${TB}◆${X} "
87
+
88
+ # Directory (teal)
89
+ OUT+="${T}${DIR}${X}"
90
+
91
+ # Git branch (purple, compact)
92
+ if [ -n "$BRANCH" ]; then
93
+ OUT+=" ${P}${BRANCH}${X}"
94
+ [ -n "$GIT_STATUS" ] && OUT+="${Y}[${GIT_STATUS}]${X}"
95
+ fi
96
+
97
+ # Separator
98
+ OUT+=" ${G}│${X} "
99
+
100
+ # Qualia mode + phase (teal, the important bit)
101
+ if [ -n "$PROJECT" ]; then
102
+ OUT+="${TB}${PROJECT}${X}"
103
+ [ -n "$PHASE" ] && OUT+=" ${TD}p${PHASE}${X}"
104
+ elif [ -n "$PHASE" ]; then
105
+ OUT+="${T}p${PHASE}${X}"
106
+ fi
107
+
108
+ # If neither project nor phase, show "ad-hoc"
109
+ [ -z "$PROJECT" ] && [ -z "$PHASE" ] && OUT+="${TD}ad-hoc${X}"
110
+
111
+ # Separator + model (compact)
112
+ OUT+=" ${G}│${X} ${G}${MODEL}${X}"
113
+
114
+ # Context bar
115
+ OUT+=" ${CB}${BAR}${G}${EBAR}${X} ${CB}${USED_INT}%%${X}"
116
+
117
+ printf "$OUT"
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "qualia-framework",
3
+ "version": "2.1.0",
4
+ "description": "Qualia Solutions — Claude Code Framework",
5
+ "bin": {
6
+ "qualia-framework": "./bin/cli.js"
7
+ },
8
+ "files": [
9
+ "bin/",
10
+ "framework/",
11
+ "profiles/",
12
+ "templates/"
13
+ ],
14
+ "engines": {
15
+ "node": ">=18.0.0"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/Qualiasolutions/qualia-framework.git"
20
+ },
21
+ "keywords": ["claude-code", "qualia", "framework", "ai-dev"],
22
+ "author": "Qualia Solutions",
23
+ "license": "UNLICENSED"
24
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "code": "QS-FAWZI-2024",
3
+ "name": "Fawzi",
4
+ "fullName": "Fawzi Goussous",
5
+ "role": "OWNER",
6
+ "since": "2024",
7
+ "location": "Nicosia, Cyprus",
8
+ "type": "founder",
9
+ "language": "ar-en",
10
+ "permissions": {
11
+ "canDeploy": true,
12
+ "canModifyFramework": true,
13
+ "canAccessAllProjects": true,
14
+ "canApproveWork": true
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "code": "QS-HASAN-2026",
3
+ "name": "Hasan",
4
+ "fullName": "Hasan",
5
+ "role": "DEVELOPER",
6
+ "since": "March 2026",
7
+ "location": "Cyprus",
8
+ "type": "part-time",
9
+ "language": "en",
10
+ "permissions": {
11
+ "canDeploy": false,
12
+ "canModifyFramework": false,
13
+ "canAccessAllProjects": false,
14
+ "canApproveWork": false
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "code": "QS-MOAYAD-2025",
3
+ "name": "Moayad",
4
+ "fullName": "Moayad",
5
+ "role": "DEVELOPER",
6
+ "since": "December 2025",
7
+ "location": "Jordan",
8
+ "type": "full-time",
9
+ "language": "ar-en",
10
+ "permissions": {
11
+ "canDeploy": true,
12
+ "canModifyFramework": false,
13
+ "canAccessAllProjects": true,
14
+ "canApproveWork": false
15
+ }
16
+ }
@@ -0,0 +1,52 @@
1
+ # CLAUDE.md — Qualia Solutions
2
+
3
+ ## Identity
4
+ **Fawzi Goussous** — Founder, Qualia Solutions. Nicosia, Cyprus.
5
+
6
+ - Stack: Next.js 16+, React 19, TypeScript, Supabase, Vercel, VAPI, ElevenLabs, Telnyx, Retell AI, OpenRouter
7
+ - Partner: Jay | Team: Moayad (full-time, Jordan), Ahasan (part-time, Cyprus)
8
+
9
+ ## Role: OWNER
10
+
11
+ Full authority over all projects, deployments, architecture, and client decisions.
12
+ - Deploy directly to production
13
+ - Make architectural decisions unilaterally
14
+ - Access all Supabase projects and service role keys
15
+ - Modify the Qualia framework (CLAUDE.md, skills, hooks)
16
+
17
+ ## Rules
18
+ - Read before Write/Edit — no exceptions
19
+ - Feature branches only — never commit to main/master
20
+ - MVP first. Build only what's asked. No over-engineering.
21
+ - Root cause on failures — no band-aids
22
+ - `npx tsc --noEmit` after multi-file TS changes
23
+ - Glob/Grep directly — no Task(Explore) unless 5+ rounds needed
24
+ - For non-trivial work (multi-file changes, architectural decisions, unfamiliar codebases), confirm understanding before coding — quick tasks are exempt
25
+ - See `rules/security.md` for auth, RLS, Zod, secrets rules
26
+ - See `rules/frontend.md` for design standards
27
+ - See `rules/deployment.md` for deploy checklist
28
+
29
+ ## Collaboration
30
+ Collaborator, not executor. Speak up about bugs, simpler approaches, bad architecture.
31
+ Be honest. Default to action. Never speculate on unread code. Say when blocked.
32
+ - Direct, action-oriented, no fluff. Code > theory.
33
+ - Arabic or English — match whatever language is used
34
+
35
+ ## Workflow
36
+ - **MANDATORY FIRST ACTION**: On every session start, invoke the `qualia-start` skill before doing anything else. This is non-negotiable — do not wait for user input, do not skip it, do not just acknowledge the hook message. Actually invoke the skill using the Skill tool.
37
+ - Subagents (Sonnet) for research. Opus for complex reasoning.
38
+ - `/compact` at 60%. `/clear` between tasks. `/learn` after mistakes.
39
+
40
+ ## Qualia Mode (always active)
41
+ These behaviors apply to ALL interactions:
42
+ - **Frontend guard:** Read .planning/DESIGN.md before any frontend file changes
43
+ - **Deploy guard:** Check .planning/REVIEW.md freshness before any deploy command (run /qualia-review to generate)
44
+ - **Intent verification:** Confirm before modifying 3+ files in one response
45
+ - **Task-type detection:** Auto-load relevant skill patterns based on what's being done
46
+ - **Quality defaults:** Security rules, tsc checks, RLS consideration — always enforced
47
+
48
+ ## Compaction — ALWAYS preserve:
49
+ Project path/name/ref, branch, modified files, decisions, test results, in-progress work, errors, Qualia phase/milestone state, Qualia mode active/inactive state, session digest context.
50
+
51
+ ## Learned Patterns & Gotchas
52
+ See ~/.claude/knowledge/learned-patterns.md for full rules and project gotchas.