loki-mode 4.2.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 (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +691 -0
  3. package/SKILL.md +191 -0
  4. package/VERSION +1 -0
  5. package/autonomy/.loki/dashboard/index.html +2634 -0
  6. package/autonomy/CONSTITUTION.md +508 -0
  7. package/autonomy/README.md +201 -0
  8. package/autonomy/config.example.yaml +152 -0
  9. package/autonomy/loki +526 -0
  10. package/autonomy/run.sh +3636 -0
  11. package/bin/loki-mode.js +26 -0
  12. package/bin/postinstall.js +60 -0
  13. package/docs/ACKNOWLEDGEMENTS.md +234 -0
  14. package/docs/COMPARISON.md +325 -0
  15. package/docs/COMPETITIVE-ANALYSIS.md +333 -0
  16. package/docs/INSTALLATION.md +547 -0
  17. package/docs/auto-claude-comparison.md +276 -0
  18. package/docs/cursor-comparison.md +225 -0
  19. package/docs/dashboard-guide.md +355 -0
  20. package/docs/screenshots/README.md +149 -0
  21. package/docs/screenshots/dashboard-agents.png +0 -0
  22. package/docs/screenshots/dashboard-tasks.png +0 -0
  23. package/docs/thick2thin.md +173 -0
  24. package/package.json +48 -0
  25. package/references/advanced-patterns.md +453 -0
  26. package/references/agent-types.md +243 -0
  27. package/references/agents.md +1043 -0
  28. package/references/business-ops.md +550 -0
  29. package/references/competitive-analysis.md +216 -0
  30. package/references/confidence-routing.md +371 -0
  31. package/references/core-workflow.md +275 -0
  32. package/references/cursor-learnings.md +207 -0
  33. package/references/deployment.md +604 -0
  34. package/references/lab-research-patterns.md +534 -0
  35. package/references/mcp-integration.md +186 -0
  36. package/references/memory-system.md +467 -0
  37. package/references/openai-patterns.md +647 -0
  38. package/references/production-patterns.md +568 -0
  39. package/references/prompt-repetition.md +192 -0
  40. package/references/quality-control.md +437 -0
  41. package/references/sdlc-phases.md +410 -0
  42. package/references/task-queue.md +361 -0
  43. package/references/tool-orchestration.md +691 -0
  44. package/skills/00-index.md +120 -0
  45. package/skills/agents.md +249 -0
  46. package/skills/artifacts.md +174 -0
  47. package/skills/github-integration.md +218 -0
  48. package/skills/model-selection.md +125 -0
  49. package/skills/parallel-workflows.md +526 -0
  50. package/skills/patterns-advanced.md +188 -0
  51. package/skills/production.md +292 -0
  52. package/skills/quality-gates.md +180 -0
  53. package/skills/testing.md +149 -0
  54. package/skills/troubleshooting.md +109 -0
@@ -0,0 +1,410 @@
1
+ # SDLC Phases Reference
2
+
3
+ All phases with detailed workflows and testing procedures.
4
+
5
+ ---
6
+
7
+ ## Phase Overview
8
+
9
+ ```
10
+ Bootstrap -> Discovery -> Architecture -> Infrastructure
11
+ | | | |
12
+ (Setup) (Analyze PRD) (Design) (Cloud/DB Setup)
13
+ |
14
+ Development <- QA <- Deployment <- Business Ops <- Growth Loop
15
+ | | | | |
16
+ (Build) (Test) (Release) (Monitor) (Iterate)
17
+ ```
18
+
19
+ ---
20
+
21
+ ## Phase 0: Bootstrap
22
+
23
+ **Purpose:** Initialize Loki Mode environment
24
+
25
+ ### Actions:
26
+ 1. Create `.loki/` directory structure
27
+ 2. Initialize orchestrator state in `.loki/state/orchestrator.json`
28
+ 3. Validate PRD exists and is readable
29
+ 4. Spawn initial agent pool (3-5 agents)
30
+ 5. Create CONTINUITY.md
31
+
32
+ ### Directory Structure Created:
33
+ ```
34
+ .loki/
35
+ +-- CONTINUITY.md
36
+ +-- state/
37
+ | +-- orchestrator.json
38
+ | +-- agents/
39
+ | +-- circuit-breakers/
40
+ +-- queue/
41
+ | +-- pending.json
42
+ | +-- in-progress.json
43
+ | +-- completed.json
44
+ | +-- dead-letter.json
45
+ +-- specs/
46
+ +-- memory/
47
+ +-- artifacts/
48
+ ```
49
+
50
+ ---
51
+
52
+ ## Phase 1: Discovery
53
+
54
+ **Purpose:** Understand requirements and market context
55
+
56
+ ### Actions:
57
+ 1. Parse PRD, extract requirements
58
+ 2. Spawn `biz-analytics` agent for competitive research
59
+ 3. Web search competitors, extract features, reviews
60
+ 4. Identify market gaps and opportunities
61
+ 5. Generate task backlog with priorities and dependencies
62
+
63
+ ### Output:
64
+ - Requirements document
65
+ - Competitive analysis
66
+ - Initial task backlog in `.loki/queue/pending.json`
67
+
68
+ ---
69
+
70
+ ## Phase 2: Architecture
71
+
72
+ **Purpose:** Design system architecture and generate specs
73
+
74
+ ### SPEC-FIRST WORKFLOW
75
+
76
+ **Step 1: Extract API Requirements from PRD**
77
+ - Parse PRD for user stories and functionality
78
+ - Map to REST/GraphQL operations
79
+ - Document data models and relationships
80
+
81
+ **Step 2: Generate OpenAPI 3.1 Specification**
82
+
83
+ ```yaml
84
+ openapi: 3.1.0
85
+ info:
86
+ title: Product API
87
+ version: 1.0.0
88
+ paths:
89
+ /auth/login:
90
+ post:
91
+ summary: Authenticate user and return JWT
92
+ requestBody:
93
+ required: true
94
+ content:
95
+ application/json:
96
+ schema:
97
+ type: object
98
+ required: [email, password]
99
+ properties:
100
+ email: { type: string, format: email }
101
+ password: { type: string, minLength: 8 }
102
+ responses:
103
+ 200:
104
+ description: Success
105
+ content:
106
+ application/json:
107
+ schema:
108
+ type: object
109
+ properties:
110
+ token: { type: string }
111
+ expiresAt: { type: string, format: date-time }
112
+ 401:
113
+ description: Invalid credentials
114
+ ```
115
+
116
+ **Step 3: Validate Spec**
117
+ ```bash
118
+ npm install -g @stoplight/spectral-cli
119
+ spectral lint .loki/specs/openapi.yaml
120
+ swagger-cli validate .loki/specs/openapi.yaml
121
+ ```
122
+
123
+ **Step 4: Generate Artifacts from Spec**
124
+ ```bash
125
+ # TypeScript types
126
+ npx openapi-typescript .loki/specs/openapi.yaml --output src/types/api.ts
127
+
128
+ # Client SDK
129
+ npx openapi-generator-cli generate \
130
+ -i .loki/specs/openapi.yaml \
131
+ -g typescript-axios \
132
+ -o src/clients/api
133
+
134
+ # Server stubs
135
+ npx openapi-generator-cli generate \
136
+ -i .loki/specs/openapi.yaml \
137
+ -g nodejs-express-server \
138
+ -o backend/generated
139
+
140
+ # Documentation
141
+ npx redoc-cli bundle .loki/specs/openapi.yaml -o docs/api.html
142
+ ```
143
+
144
+ **Step 5: Select Tech Stack**
145
+ - Spawn `eng-backend` + `eng-frontend` architects
146
+ - Both agents review spec and propose stack
147
+ - Consensus required (both must agree)
148
+ - Self-reflection checkpoint with evidence
149
+
150
+ **Step 6: Create Project Scaffolding**
151
+ - Initialize project with tech stack
152
+ - Install dependencies
153
+ - Configure linters
154
+ - Setup contract testing framework
155
+
156
+ ---
157
+
158
+ ## Phase 3: Infrastructure
159
+
160
+ **Purpose:** Provision cloud resources and CI/CD
161
+
162
+ ### Actions:
163
+ 1. Spawn `ops-devops` agent
164
+ 2. Provision cloud resources (see `references/deployment.md`)
165
+ 3. Set up CI/CD pipelines
166
+ 4. Configure monitoring and alerting
167
+ 5. Create staging and production environments
168
+
169
+ ### CI/CD Pipeline:
170
+ ```yaml
171
+ name: CI/CD Pipeline
172
+ on: [push, pull_request]
173
+ jobs:
174
+ test:
175
+ - Lint
176
+ - Type check
177
+ - Unit tests
178
+ - Contract tests
179
+ - Security scan
180
+ deploy-staging:
181
+ needs: test
182
+ - Deploy to staging
183
+ - Smoke tests
184
+ deploy-production:
185
+ needs: deploy-staging
186
+ - Blue-green deploy
187
+ - Health checks
188
+ - Auto-rollback on errors
189
+ ```
190
+
191
+ ---
192
+
193
+ ## Phase 4: Development
194
+
195
+ **Purpose:** Implement features with quality gates
196
+
197
+ ### Workflow Per Task:
198
+
199
+ ```
200
+ 1. Dispatch implementation subagent (Task tool, model: sonnet)
201
+ 2. Subagent implements with TDD, commits, reports back
202
+ 3. Dispatch 3 reviewers IN PARALLEL (single message, 3 Task calls):
203
+ - code-reviewer (sonnet)
204
+ - business-logic-reviewer (sonnet)
205
+ - security-reviewer (sonnet)
206
+ 4. Aggregate findings by severity
207
+ 5. IF Critical/High/Medium found:
208
+ - Dispatch fix subagent
209
+ - Re-run ALL 3 reviewers
210
+ - Loop until all PASS
211
+ 6. Add TODO comments for Low issues
212
+ 7. Add FIXME comments for Cosmetic issues
213
+ 8. Mark task complete with git checkpoint
214
+ ```
215
+
216
+ ### Implementation Rules:
217
+ - Agents implement ONLY what's in the spec
218
+ - Must validate against openapi.yaml schema
219
+ - Must return responses matching spec
220
+ - Performance targets from spec x-performance extension
221
+
222
+ ---
223
+
224
+ ## Phase 5: Quality Assurance
225
+
226
+ **Purpose:** Comprehensive testing and security audit
227
+
228
+ ### Testing Phases:
229
+
230
+ **UNIT Phase:**
231
+ ```bash
232
+ npm run test:unit
233
+ # or
234
+ pytest tests/unit/
235
+ ```
236
+ - Coverage: >80% required
237
+ - All tests must pass
238
+
239
+ **INTEGRATION Phase:**
240
+ ```bash
241
+ npm run test:integration
242
+ ```
243
+ - Test API endpoints against actual database
244
+ - Test external service integrations
245
+ - Verify data flows end-to-end
246
+
247
+ **E2E Phase:**
248
+ ```bash
249
+ npx playwright test
250
+ # or
251
+ npx cypress run
252
+ ```
253
+ - Test complete user flows
254
+ - Cross-browser testing
255
+ - Mobile responsive testing
256
+
257
+ **CONTRACT Phase:**
258
+ ```bash
259
+ npm run test:contract
260
+ ```
261
+ - Validate implementation matches OpenAPI spec
262
+ - Test request/response schemas
263
+ - Breaking change detection
264
+
265
+ **SECURITY Phase:**
266
+ ```bash
267
+ npm audit
268
+ npx snyk test
269
+ semgrep --config=auto .
270
+ ```
271
+ - OWASP Top 10 checks
272
+ - Dependency vulnerabilities
273
+ - Static analysis
274
+
275
+ **PERFORMANCE Phase:**
276
+ ```bash
277
+ npx k6 run tests/load.js
278
+ npx lighthouse http://localhost:3000
279
+ ```
280
+ - Load testing: 100 concurrent users for 1 minute
281
+ - Stress testing: 500 concurrent users for 30 seconds
282
+ - P95 response time < 500ms required
283
+
284
+ **ACCESSIBILITY Phase:**
285
+ ```bash
286
+ npx axe http://localhost:3000
287
+ ```
288
+ - WCAG 2.1 AA compliance
289
+ - Alt text, ARIA labels, color contrast
290
+ - Keyboard navigation, focus indicators
291
+
292
+ **REGRESSION Phase:**
293
+ - Compare behavior against previous version
294
+ - Verify no features broken by recent changes
295
+ - Test backward compatibility of APIs
296
+
297
+ **UAT Phase:**
298
+ - Create acceptance tests from PRD
299
+ - Walk through complete user journeys
300
+ - Verify business logic matches PRD
301
+ - Document any UX friction points
302
+
303
+ ---
304
+
305
+ ## Phase 6: Deployment
306
+
307
+ **Purpose:** Release to production
308
+
309
+ ### Actions:
310
+ 1. Spawn `ops-release` agent
311
+ 2. Generate semantic version, changelog
312
+ 3. Create release branch, tag
313
+ 4. Deploy to staging, run smoke tests
314
+ 5. Blue-green deploy to production
315
+ 6. Monitor for 30min, auto-rollback if errors spike
316
+
317
+ ### Deployment Strategies:
318
+
319
+ **Blue-Green:**
320
+ ```
321
+ 1. Deploy new version to "green" environment
322
+ 2. Run smoke tests
323
+ 3. Switch traffic from "blue" to "green"
324
+ 4. Keep "blue" as rollback target
325
+ ```
326
+
327
+ **Canary:**
328
+ ```
329
+ 1. Deploy to 5% of traffic
330
+ 2. Monitor error rates
331
+ 3. Gradually increase to 25%, 50%, 100%
332
+ 4. Rollback if errors exceed threshold
333
+ ```
334
+
335
+ ---
336
+
337
+ ## Phase 7: Business Operations
338
+
339
+ **Purpose:** Non-technical business setup
340
+
341
+ ### Actions:
342
+ 1. `biz-marketing`: Create landing page, SEO, content
343
+ 2. `biz-sales`: Set up CRM, outreach templates
344
+ 3. `biz-finance`: Configure billing (Stripe), invoicing
345
+ 4. `biz-support`: Create help docs, chatbot
346
+ 5. `biz-legal`: Generate ToS, privacy policy
347
+
348
+ ---
349
+
350
+ ## Phase 8: Growth Loop
351
+
352
+ **Purpose:** Continuous improvement
353
+
354
+ ### Cycle:
355
+ ```
356
+ MONITOR -> ANALYZE -> OPTIMIZE -> DEPLOY -> MONITOR
357
+ |
358
+ Customer feedback -> Feature requests -> Backlog
359
+ |
360
+ A/B tests -> Winner -> Permanent deploy
361
+ |
362
+ Incidents -> RCA -> Prevention -> Deploy fix
363
+ ```
364
+
365
+ ### Never "Done":
366
+ - Run performance optimizations
367
+ - Add missing test coverage
368
+ - Improve documentation
369
+ - Refactor code smells
370
+ - Update dependencies
371
+ - Enhance user experience
372
+ - Implement A/B test learnings
373
+
374
+ ---
375
+
376
+ ## Final Review (Before Any Deployment)
377
+
378
+ ```
379
+ 1. Dispatch 3 reviewers reviewing ENTIRE implementation:
380
+ - code-reviewer: Full codebase quality
381
+ - business-logic-reviewer: All requirements met
382
+ - security-reviewer: Full security audit
383
+
384
+ 2. Aggregate findings across all files
385
+ 3. Fix Critical/High/Medium issues
386
+ 4. Re-run all 3 reviewers until all PASS
387
+ 5. Generate final report in .loki/artifacts/reports/final-review.md
388
+ 6. Proceed to deployment only after all PASS
389
+ ```
390
+
391
+ ---
392
+
393
+ ## Quality Gates Summary
394
+
395
+ | Gate | Agent | Pass Criteria |
396
+ |------|-------|---------------|
397
+ | Unit Tests | eng-qa | 100% pass |
398
+ | Integration Tests | eng-qa | 100% pass |
399
+ | E2E Tests | eng-qa | 100% pass |
400
+ | Coverage | eng-qa | > 80% |
401
+ | Linting | eng-qa | 0 errors |
402
+ | Type Check | eng-qa | 0 errors |
403
+ | Security Scan | ops-security | 0 high/critical |
404
+ | Dependency Audit | ops-security | 0 vulnerabilities |
405
+ | Performance | eng-qa | p99 < 200ms |
406
+ | Accessibility | eng-frontend | WCAG 2.1 AA |
407
+ | Load Test | ops-devops | Handles 10x expected traffic |
408
+ | Chaos Test | ops-devops | Recovers from failures |
409
+ | Cost Estimate | ops-cost | Within budget |
410
+ | Legal Review | biz-legal | Compliant |