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,604 @@
1
+ # Deployment Reference
2
+
3
+ Infrastructure provisioning and deployment instructions for all supported platforms.
4
+
5
+ ## Deployment Decision Matrix
6
+
7
+ | Criteria | Vercel/Netlify | Railway/Render | AWS | GCP | Azure |
8
+ |----------|----------------|----------------|-----|-----|-------|
9
+ | Static/JAMstack | Best | Good | Overkill | Overkill | Overkill |
10
+ | Simple full-stack | Good | Best | Overkill | Overkill | Overkill |
11
+ | Scale to millions | No | Limited | Best | Best | Best |
12
+ | Enterprise compliance | Limited | Limited | Best | Good | Best |
13
+ | Cost at scale | Expensive | Moderate | Cheapest | Cheap | Moderate |
14
+ | Setup complexity | Trivial | Easy | Complex | Complex | Complex |
15
+
16
+ ## Quick Start Commands
17
+
18
+ ### Vercel
19
+ ```bash
20
+ # Install CLI
21
+ npm i -g vercel
22
+
23
+ # Deploy (auto-detects framework)
24
+ vercel --prod
25
+
26
+ # Environment variables
27
+ vercel env add VARIABLE_NAME production
28
+ ```
29
+
30
+ ### Netlify
31
+ ```bash
32
+ # Install CLI
33
+ npm i -g netlify-cli
34
+
35
+ # Deploy
36
+ netlify deploy --prod
37
+
38
+ # Environment variables
39
+ netlify env:set VARIABLE_NAME value
40
+ ```
41
+
42
+ ### Railway
43
+ ```bash
44
+ # Install CLI
45
+ npm i -g @railway/cli
46
+
47
+ # Login and deploy
48
+ railway login
49
+ railway init
50
+ railway up
51
+
52
+ # Environment variables
53
+ railway variables set VARIABLE_NAME=value
54
+ ```
55
+
56
+ ### Render
57
+ ```yaml
58
+ # render.yaml (Infrastructure as Code)
59
+ services:
60
+ - type: web
61
+ name: api
62
+ env: node
63
+ buildCommand: npm install && npm run build
64
+ startCommand: npm start
65
+ envVars:
66
+ - key: NODE_ENV
67
+ value: production
68
+ - key: DATABASE_URL
69
+ fromDatabase:
70
+ name: postgres
71
+ property: connectionString
72
+
73
+ databases:
74
+ - name: postgres
75
+ plan: starter
76
+ ```
77
+
78
+ ---
79
+
80
+ ## AWS Deployment
81
+
82
+ ### Architecture Template
83
+ ```
84
+ ┌─────────────────────────────────────────────────────────┐
85
+ │ CloudFront │
86
+ └─────────────────────────┬───────────────────────────────┘
87
+
88
+ ┌───────────────┴───────────────┐
89
+ │ │
90
+ ┌─────▼─────┐ ┌─────▼─────┐
91
+ │ S3 │ │ ALB │
92
+ │ (static) │ │ │
93
+ └───────────┘ └─────┬─────┘
94
+
95
+ ┌─────▼─────┐
96
+ │ ECS │
97
+ │ Fargate │
98
+ └─────┬─────┘
99
+
100
+ ┌───────────┴───────────┐
101
+ │ │
102
+ ┌─────▼─────┐ ┌─────▼─────┐
103
+ │ RDS │ │ ElastiCache│
104
+ │ Postgres │ │ Redis │
105
+ └───────────┘ └───────────┘
106
+ ```
107
+
108
+ ### Terraform Configuration
109
+ ```hcl
110
+ # main.tf
111
+ terraform {
112
+ required_providers {
113
+ aws = {
114
+ source = "hashicorp/aws"
115
+ version = "~> 5.0"
116
+ }
117
+ }
118
+ backend "s3" {
119
+ bucket = "terraform-state-${var.project_name}"
120
+ key = "state.tfstate"
121
+ region = "us-east-1"
122
+ }
123
+ }
124
+
125
+ provider "aws" {
126
+ region = var.aws_region
127
+ }
128
+
129
+ # VPC
130
+ module "vpc" {
131
+ source = "terraform-aws-modules/vpc/aws"
132
+ version = "5.0.0"
133
+
134
+ name = "${var.project_name}-vpc"
135
+ cidr = "10.0.0.0/16"
136
+
137
+ azs = ["${var.aws_region}a", "${var.aws_region}b"]
138
+ private_subnets = ["10.0.1.0/24", "10.0.2.0/24"]
139
+ public_subnets = ["10.0.101.0/24", "10.0.102.0/24"]
140
+
141
+ enable_nat_gateway = true
142
+ single_nat_gateway = var.environment != "production"
143
+ }
144
+
145
+ # ECS Cluster
146
+ resource "aws_ecs_cluster" "main" {
147
+ name = "${var.project_name}-cluster"
148
+
149
+ setting {
150
+ name = "containerInsights"
151
+ value = "enabled"
152
+ }
153
+ }
154
+
155
+ # RDS
156
+ module "rds" {
157
+ source = "terraform-aws-modules/rds/aws"
158
+ version = "6.0.0"
159
+
160
+ identifier = "${var.project_name}-db"
161
+
162
+ engine = "postgres"
163
+ engine_version = "15"
164
+ family = "postgres15"
165
+ major_engine_version = "15"
166
+ instance_class = var.environment == "production" ? "db.t3.medium" : "db.t3.micro"
167
+
168
+ allocated_storage = 20
169
+ storage_encrypted = true
170
+
171
+ db_name = var.db_name
172
+ username = var.db_username
173
+ port = 5432
174
+
175
+ vpc_security_group_ids = [aws_security_group.rds.id]
176
+ subnet_ids = module.vpc.private_subnets
177
+
178
+ backup_retention_period = var.environment == "production" ? 7 : 1
179
+ deletion_protection = var.environment == "production"
180
+ }
181
+ ```
182
+
183
+ ### ECS Task Definition
184
+ ```json
185
+ {
186
+ "family": "app",
187
+ "networkMode": "awsvpc",
188
+ "requiresCompatibilities": ["FARGATE"],
189
+ "cpu": "256",
190
+ "memory": "512",
191
+ "containerDefinitions": [
192
+ {
193
+ "name": "app",
194
+ "image": "${ECR_REPO}:${TAG}",
195
+ "portMappings": [
196
+ {
197
+ "containerPort": 3000,
198
+ "protocol": "tcp"
199
+ }
200
+ ],
201
+ "environment": [
202
+ {"name": "NODE_ENV", "value": "production"}
203
+ ],
204
+ "secrets": [
205
+ {
206
+ "name": "DATABASE_URL",
207
+ "valueFrom": "arn:aws:secretsmanager:region:account:secret:db-url"
208
+ }
209
+ ],
210
+ "logConfiguration": {
211
+ "logDriver": "awslogs",
212
+ "options": {
213
+ "awslogs-group": "/ecs/app",
214
+ "awslogs-region": "us-east-1",
215
+ "awslogs-stream-prefix": "ecs"
216
+ }
217
+ },
218
+ "healthCheck": {
219
+ "command": ["CMD-SHELL", "curl -f http://localhost:3000/health || exit 1"],
220
+ "interval": 30,
221
+ "timeout": 5,
222
+ "retries": 3
223
+ }
224
+ }
225
+ ]
226
+ }
227
+ ```
228
+
229
+ ### GitHub Actions CI/CD
230
+ ```yaml
231
+ name: Deploy to AWS
232
+
233
+ on:
234
+ push:
235
+ branches: [main]
236
+
237
+ env:
238
+ AWS_REGION: us-east-1
239
+ ECR_REPOSITORY: app
240
+ ECS_SERVICE: app-service
241
+ ECS_CLUSTER: app-cluster
242
+
243
+ jobs:
244
+ deploy:
245
+ runs-on: ubuntu-latest
246
+ steps:
247
+ - uses: actions/checkout@v4
248
+
249
+ - name: Configure AWS credentials
250
+ uses: aws-actions/configure-aws-credentials@v4
251
+ with:
252
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
253
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
254
+ aws-region: ${{ env.AWS_REGION }}
255
+
256
+ - name: Login to Amazon ECR
257
+ id: login-ecr
258
+ uses: aws-actions/amazon-ecr-login@v2
259
+
260
+ - name: Build, tag, and push image
261
+ id: build-image
262
+ env:
263
+ ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
264
+ IMAGE_TAG: ${{ github.sha }}
265
+ run: |
266
+ docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
267
+ docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
268
+ echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
269
+
270
+ - name: Deploy to ECS
271
+ uses: aws-actions/amazon-ecs-deploy-task-definition@v1
272
+ with:
273
+ task-definition: task-definition.json
274
+ service: ${{ env.ECS_SERVICE }}
275
+ cluster: ${{ env.ECS_CLUSTER }}
276
+ wait-for-service-stability: true
277
+ ```
278
+
279
+ ---
280
+
281
+ ## GCP Deployment
282
+
283
+ ### Cloud Run (Recommended for most cases)
284
+ ```bash
285
+ # Build and deploy
286
+ gcloud builds submit --tag gcr.io/PROJECT_ID/app
287
+ gcloud run deploy app \
288
+ --image gcr.io/PROJECT_ID/app \
289
+ --platform managed \
290
+ --region us-central1 \
291
+ --allow-unauthenticated \
292
+ --set-env-vars="NODE_ENV=production" \
293
+ --set-secrets="DATABASE_URL=db-url:latest"
294
+ ```
295
+
296
+ ### Terraform for GCP
297
+ ```hcl
298
+ provider "google" {
299
+ project = var.project_id
300
+ region = var.region
301
+ }
302
+
303
+ # Cloud Run Service
304
+ resource "google_cloud_run_service" "app" {
305
+ name = "app"
306
+ location = var.region
307
+
308
+ template {
309
+ spec {
310
+ containers {
311
+ image = "gcr.io/${var.project_id}/app:latest"
312
+
313
+ ports {
314
+ container_port = 3000
315
+ }
316
+
317
+ env {
318
+ name = "NODE_ENV"
319
+ value = "production"
320
+ }
321
+
322
+ env {
323
+ name = "DATABASE_URL"
324
+ value_from {
325
+ secret_key_ref {
326
+ name = google_secret_manager_secret.db_url.secret_id
327
+ key = "latest"
328
+ }
329
+ }
330
+ }
331
+
332
+ resources {
333
+ limits = {
334
+ cpu = "1000m"
335
+ memory = "512Mi"
336
+ }
337
+ }
338
+ }
339
+ }
340
+
341
+ metadata {
342
+ annotations = {
343
+ "autoscaling.knative.dev/maxScale" = "10"
344
+ "run.googleapis.com/cloudsql-instances" = google_sql_database_instance.main.connection_name
345
+ }
346
+ }
347
+ }
348
+
349
+ traffic {
350
+ percent = 100
351
+ latest_revision = true
352
+ }
353
+ }
354
+
355
+ # Cloud SQL
356
+ resource "google_sql_database_instance" "main" {
357
+ name = "app-db"
358
+ database_version = "POSTGRES_15"
359
+ region = var.region
360
+
361
+ settings {
362
+ tier = "db-f1-micro"
363
+
364
+ backup_configuration {
365
+ enabled = true
366
+ }
367
+ }
368
+
369
+ deletion_protection = var.environment == "production"
370
+ }
371
+ ```
372
+
373
+ ---
374
+
375
+ ## Azure Deployment
376
+
377
+ ### Azure Container Apps
378
+ ```bash
379
+ # Create resource group
380
+ az group create --name app-rg --location eastus
381
+
382
+ # Create Container Apps environment
383
+ az containerapp env create \
384
+ --name app-env \
385
+ --resource-group app-rg \
386
+ --location eastus
387
+
388
+ # Deploy container
389
+ az containerapp create \
390
+ --name app \
391
+ --resource-group app-rg \
392
+ --environment app-env \
393
+ --image myregistry.azurecr.io/app:latest \
394
+ --target-port 3000 \
395
+ --ingress external \
396
+ --min-replicas 1 \
397
+ --max-replicas 10 \
398
+ --env-vars "NODE_ENV=production"
399
+ ```
400
+
401
+ ---
402
+
403
+ ## Kubernetes Deployment
404
+
405
+ ### Manifests
406
+ ```yaml
407
+ # deployment.yaml
408
+ apiVersion: apps/v1
409
+ kind: Deployment
410
+ metadata:
411
+ name: app
412
+ labels:
413
+ app: app
414
+ spec:
415
+ replicas: 3
416
+ selector:
417
+ matchLabels:
418
+ app: app
419
+ template:
420
+ metadata:
421
+ labels:
422
+ app: app
423
+ spec:
424
+ containers:
425
+ - name: app
426
+ image: app:latest
427
+ ports:
428
+ - containerPort: 3000
429
+ env:
430
+ - name: NODE_ENV
431
+ value: production
432
+ - name: DATABASE_URL
433
+ valueFrom:
434
+ secretKeyRef:
435
+ name: app-secrets
436
+ key: database-url
437
+ resources:
438
+ requests:
439
+ memory: "128Mi"
440
+ cpu: "100m"
441
+ limits:
442
+ memory: "512Mi"
443
+ cpu: "500m"
444
+ livenessProbe:
445
+ httpGet:
446
+ path: /health
447
+ port: 3000
448
+ initialDelaySeconds: 10
449
+ periodSeconds: 10
450
+ readinessProbe:
451
+ httpGet:
452
+ path: /ready
453
+ port: 3000
454
+ initialDelaySeconds: 5
455
+ periodSeconds: 5
456
+ ---
457
+ # service.yaml
458
+ apiVersion: v1
459
+ kind: Service
460
+ metadata:
461
+ name: app
462
+ spec:
463
+ selector:
464
+ app: app
465
+ ports:
466
+ - port: 80
467
+ targetPort: 3000
468
+ type: ClusterIP
469
+ ---
470
+ # ingress.yaml
471
+ apiVersion: networking.k8s.io/v1
472
+ kind: Ingress
473
+ metadata:
474
+ name: app
475
+ annotations:
476
+ kubernetes.io/ingress.class: nginx
477
+ cert-manager.io/cluster-issuer: letsencrypt-prod
478
+ spec:
479
+ tls:
480
+ - hosts:
481
+ - app.example.com
482
+ secretName: app-tls
483
+ rules:
484
+ - host: app.example.com
485
+ http:
486
+ paths:
487
+ - path: /
488
+ pathType: Prefix
489
+ backend:
490
+ service:
491
+ name: app
492
+ port:
493
+ number: 80
494
+ ```
495
+
496
+ ### Helm Chart Structure
497
+ ```
498
+ chart/
499
+ ├── Chart.yaml
500
+ ├── values.yaml
501
+ ├── values-staging.yaml
502
+ ├── values-production.yaml
503
+ └── templates/
504
+ ├── deployment.yaml
505
+ ├── service.yaml
506
+ ├── ingress.yaml
507
+ ├── configmap.yaml
508
+ ├── secret.yaml
509
+ └── hpa.yaml
510
+ ```
511
+
512
+ ---
513
+
514
+ ## Blue-Green Deployment
515
+
516
+ ### Strategy
517
+ ```
518
+ 1. Deploy new version to "green" environment
519
+ 2. Run smoke tests against green
520
+ 3. Switch load balancer to green
521
+ 4. Monitor for 15 minutes
522
+ 5. If healthy: decommission blue
523
+ 6. If errors: switch back to blue (rollback)
524
+ ```
525
+
526
+ ### Implementation (AWS ALB)
527
+ ```bash
528
+ # Deploy green
529
+ aws ecs update-service --cluster app --service app-green --task-definition app:NEW_VERSION
530
+
531
+ # Wait for stability
532
+ aws ecs wait services-stable --cluster app --services app-green
533
+
534
+ # Run smoke tests
535
+ curl -f https://green.app.example.com/health
536
+
537
+ # Switch traffic (update target group weights)
538
+ aws elbv2 modify-listener-rule \
539
+ --rule-arn $RULE_ARN \
540
+ --actions '[{"Type":"forward","TargetGroupArn":"'$GREEN_TG'","Weight":100}]'
541
+ ```
542
+
543
+ ---
544
+
545
+ ## Rollback Procedures
546
+
547
+ ### Immediate Rollback
548
+ ```bash
549
+ # AWS ECS
550
+ aws ecs update-service --cluster app --service app --task-definition app:PREVIOUS_VERSION
551
+
552
+ # Kubernetes
553
+ kubectl rollout undo deployment/app
554
+
555
+ # Vercel
556
+ vercel rollback
557
+ ```
558
+
559
+ ### Automated Rollback Triggers
560
+ Monitor these metrics post-deploy:
561
+ - Error rate > 1% for 5 minutes
562
+ - p99 latency > 500ms for 5 minutes
563
+ - Health check failures > 3 consecutive
564
+ - Memory usage > 90% for 10 minutes
565
+
566
+ If any trigger fires, execute automatic rollback.
567
+
568
+ ---
569
+
570
+ ## Secrets Management
571
+
572
+ ### AWS Secrets Manager
573
+ ```bash
574
+ # Create secret
575
+ aws secretsmanager create-secret \
576
+ --name app/database-url \
577
+ --secret-string "postgresql://..."
578
+
579
+ # Reference in ECS task
580
+ "secrets": [
581
+ {
582
+ "name": "DATABASE_URL",
583
+ "valueFrom": "arn:aws:secretsmanager:region:account:secret:app/database-url"
584
+ }
585
+ ]
586
+ ```
587
+
588
+ ### HashiCorp Vault
589
+ ```bash
590
+ # Store secret
591
+ vault kv put secret/app database-url="postgresql://..."
592
+
593
+ # Read in application
594
+ vault kv get -field=database-url secret/app
595
+ ```
596
+
597
+ ### Environment-Specific
598
+ ```
599
+ .env.development # Local development
600
+ .env.staging # Staging environment
601
+ .env.production # Production (never commit)
602
+ ```
603
+
604
+ All production secrets must be in a secrets manager, never in code or environment files.