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,243 @@
1
+ # Agent Types Reference
2
+
3
+ Complete definitions and capabilities for all 37 specialized agent types.
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ Loki Mode has 37 predefined agent types organized into 7 specialized swarms. The orchestrator spawns only the agents needed for your project - a simple app might use 5-10 agents, while a complex startup could spawn 100+ agents working in parallel.
10
+
11
+ ---
12
+
13
+ ## Engineering Swarm (8 types)
14
+
15
+ | Agent | Capabilities |
16
+ |-------|-------------|
17
+ | `eng-frontend` | React/Vue/Svelte, TypeScript, Tailwind, accessibility, responsive design, state management |
18
+ | `eng-backend` | Node/Python/Go, REST/GraphQL, auth, business logic, middleware, validation |
19
+ | `eng-database` | PostgreSQL/MySQL/MongoDB, migrations, query optimization, indexing, backups |
20
+ | `eng-mobile` | React Native/Flutter/Swift/Kotlin, offline-first, push notifications, app store prep |
21
+ | `eng-api` | OpenAPI specs, SDK generation, versioning, webhooks, rate limiting, documentation |
22
+ | `eng-qa` | Unit/integration/E2E tests, coverage, automation, test data management |
23
+ | `eng-perf` | Profiling, benchmarking, optimization, caching, load testing, memory analysis |
24
+ | `eng-infra` | Docker, K8s manifests, IaC review, networking, security hardening |
25
+
26
+ ---
27
+
28
+ ## Operations Swarm (8 types)
29
+
30
+ | Agent | Capabilities |
31
+ |-------|-------------|
32
+ | `ops-devops` | CI/CD pipelines, GitHub Actions, GitLab CI, Jenkins, build optimization |
33
+ | `ops-sre` | Reliability, SLOs/SLIs, capacity planning, on-call, runbooks |
34
+ | `ops-security` | SAST/DAST, pen testing, vulnerability management, security reviews |
35
+ | `ops-monitor` | Observability, Datadog/Grafana, alerting, dashboards, log aggregation |
36
+ | `ops-incident` | Incident response, runbooks, RCA, post-mortems, communication |
37
+ | `ops-release` | Versioning, changelogs, blue-green, canary, rollbacks, feature flags |
38
+ | `ops-cost` | Cloud cost optimization, right-sizing, FinOps, reserved instances |
39
+ | `ops-compliance` | SOC2, GDPR, HIPAA, PCI-DSS, audit preparation, policy enforcement |
40
+
41
+ ---
42
+
43
+ ## Business Swarm (8 types)
44
+
45
+ | Agent | Capabilities |
46
+ |-------|-------------|
47
+ | `biz-marketing` | Landing pages, SEO, content, email campaigns, social media |
48
+ | `biz-sales` | CRM setup, outreach, demos, proposals, pipeline management |
49
+ | `biz-finance` | Billing (Stripe), invoicing, metrics, runway, pricing strategy |
50
+ | `biz-legal` | ToS, privacy policy, contracts, IP protection, compliance docs |
51
+ | `biz-support` | Help docs, FAQs, ticket system, chatbot, knowledge base |
52
+ | `biz-hr` | Job posts, recruiting, onboarding, culture docs, team structure |
53
+ | `biz-investor` | Pitch decks, investor updates, data room, cap table management |
54
+ | `biz-partnerships` | BD outreach, integration partnerships, co-marketing, API partnerships |
55
+
56
+ ---
57
+
58
+ ## Data Swarm (3 types)
59
+
60
+ | Agent | Capabilities |
61
+ |-------|-------------|
62
+ | `data-ml` | Model training, MLOps, feature engineering, inference, model monitoring |
63
+ | `data-eng` | ETL pipelines, data warehousing, dbt, Airflow, data quality |
64
+ | `data-analytics` | Product analytics, A/B tests, dashboards, insights, reporting |
65
+
66
+ ---
67
+
68
+ ## Product Swarm (3 types)
69
+
70
+ | Agent | Capabilities |
71
+ |-------|-------------|
72
+ | `prod-pm` | Backlog grooming, prioritization, roadmap, specs, stakeholder management |
73
+ | `prod-design` | Design system, Figma, UX patterns, prototypes, user research |
74
+ | `prod-techwriter` | API docs, guides, tutorials, release notes, developer experience |
75
+
76
+ ---
77
+
78
+ ## Growth Swarm (4 types)
79
+
80
+ | Agent | Capabilities |
81
+ |-------|-------------|
82
+ | `growth-hacker` | Growth experiments, viral loops, referral programs, acquisition |
83
+ | `growth-community` | Community building, Discord/Slack, ambassador programs, events |
84
+ | `growth-success` | Customer success, health scoring, churn prevention, expansion |
85
+ | `growth-lifecycle` | Email lifecycle, in-app messaging, re-engagement, onboarding |
86
+
87
+ ---
88
+
89
+ ## Review Swarm (3 types)
90
+
91
+ | Agent | Capabilities |
92
+ |-------|-------------|
93
+ | `review-code` | Code quality, design patterns, SOLID, maintainability, best practices |
94
+ | `review-business` | Requirements alignment, business logic, edge cases, UX flows |
95
+ | `review-security` | Vulnerabilities, auth/authz, OWASP Top 10, data protection |
96
+
97
+ ---
98
+
99
+ ## Orchestration Swarm (4 types)
100
+
101
+ > **Source:** [Cursor Scaling Learnings](./cursor-learnings.md) - patterns proven at 100+ agent scale
102
+
103
+ | Agent | Capabilities |
104
+ |-------|-------------|
105
+ | `orch-planner` | Task decomposition, dependency analysis, work distribution, sub-planner spawning |
106
+ | `orch-sub-planner` | Domain-specific planning (frontend, backend, testing), recursive task breakdown |
107
+ | `orch-judge` | Cycle continuation decisions, goal completion assessment, escalation triggers |
108
+ | `orch-coordinator` | Cross-stream coordination, merge decisions, conflict resolution |
109
+
110
+ ### Recursive Sub-Planner Pattern
111
+
112
+ ```
113
+ Main Planner (orch-planner)
114
+ |
115
+ +-- Sub-Planner Frontend (orch-sub-planner)
116
+ | +-- eng-frontend (Component A)
117
+ | +-- eng-frontend (Component B)
118
+ |
119
+ +-- Sub-Planner Backend (orch-sub-planner)
120
+ | +-- eng-backend (API)
121
+ | +-- eng-database (Schema)
122
+ |
123
+ +-- Sub-Planner Testing (orch-sub-planner)
124
+ +-- eng-qa (Unit tests)
125
+ +-- eng-qa (E2E tests)
126
+ ```
127
+
128
+ **Benefits:**
129
+ - Planning scales horizontally (not bottlenecked on single planner)
130
+ - Each sub-planner has focused domain context
131
+ - Enables true parallel planning
132
+
133
+ ### Judge Agent Protocol
134
+
135
+ ```yaml
136
+ judge_agent:
137
+ trigger: After milestone OR every N iterations
138
+ inputs:
139
+ - current_state: ".loki/state/orchestrator.json"
140
+ - original_goal: "PRD requirements"
141
+ - recent_progress: "Last 10 completed tasks"
142
+ - resource_consumption: "Tokens, time, iterations"
143
+ outputs:
144
+ - CONTINUE: "More work needed toward goal"
145
+ - COMPLETE: "Goal achieved, finalize"
146
+ - ESCALATE: "Human intervention required"
147
+ - PIVOT: "Change approach, current path blocked"
148
+ model: haiku # Fast decision, low cost
149
+ ```
150
+
151
+ ---
152
+
153
+ ## Agent Execution Model
154
+
155
+ **Claude Code does NOT support background processes.** Agents execute via:
156
+
157
+ 1. **Role Switching (Recommended):** Orchestrator maintains agent queue, switches roles per task
158
+ 2. **Sequential:** Execute agents one at a time (simple, reliable)
159
+ 3. **Parallel via tmux:** Multiple Claude Code sessions (complex, faster)
160
+
161
+ ```bash
162
+ # Option 1: Sequential (simple, reliable)
163
+ for agent in frontend backend database; do
164
+ claude -p "Act as $agent agent..." --dangerously-skip-permissions
165
+ done
166
+
167
+ # Option 2: Parallel via tmux (complex, faster)
168
+ tmux new-session -d -s loki-pool
169
+ for i in {1..5}; do
170
+ tmux new-window -t loki-pool -n "agent-$i" \
171
+ "claude --dangerously-skip-permissions -p '$(cat .loki/prompts/agent-$i.md)'"
172
+ done
173
+
174
+ # Option 3: Role switching (recommended)
175
+ # Orchestrator maintains agent queue, switches roles per task
176
+ ```
177
+
178
+ ---
179
+
180
+ ## Model Selection by Agent Type
181
+
182
+ | Task Type | Model | Reason |
183
+ |-----------|-------|--------|
184
+ | Planning/Architecture | Opus | Deep reasoning for design decisions |
185
+ | Implementation | Sonnet | Development workload |
186
+ | Code Review | Sonnet | Balanced quality/cost |
187
+ | Security Review | Sonnet | Balanced quality/cost |
188
+ | Business Logic Review | Sonnet | Balanced quality/cost |
189
+ | Documentation | Sonnet | Straightforward writing |
190
+ | Unit tests/Quick fixes | Haiku | Fast iteration |
191
+
192
+ ---
193
+
194
+ ## Agent Lifecycle
195
+
196
+ ```
197
+ SPAWN -> INITIALIZE -> POLL_QUEUE -> CLAIM_TASK -> EXECUTE -> REPORT -> POLL_QUEUE
198
+ | | | |
199
+ | circuit open? timeout? success?
200
+ | | | |
201
+ v v v v
202
+ Create state WAIT_BACKOFF RELEASE UPDATE_STATE
203
+ | + RETRY |
204
+ exponential |
205
+ backoff v
206
+ NO_TASKS --> IDLE (5min)
207
+ |
208
+ idle > 30min?
209
+ |
210
+ v
211
+ TERMINATE
212
+ ```
213
+
214
+ ---
215
+
216
+ ## Dynamic Scaling Rules
217
+
218
+ | Condition | Action | Cooldown |
219
+ |-----------|--------|----------|
220
+ | Queue depth > 20 | Spawn 2 agents of bottleneck type | 5min |
221
+ | Queue depth > 50 | Spawn 5 agents, alert orchestrator | 2min |
222
+ | Agent idle > 30min | Terminate agent | - |
223
+ | Agent failed 3x consecutive | Terminate, open circuit breaker | 5min |
224
+ | Critical task waiting > 10min | Spawn priority agent | 1min |
225
+ | Circuit breaker half-open | Spawn 1 test agent | - |
226
+ | All agents of type failed | HALT, request human intervention | - |
227
+
228
+ ---
229
+
230
+ ## Agent Context Preservation
231
+
232
+ ### Lineage Rules
233
+ 1. **Immutable Inheritance:** Agents CANNOT modify inherited context
234
+ 2. **Decision Logging:** All decisions MUST be logged to agent context file
235
+ 3. **Lineage Reference:** All commits MUST reference parent agent ID
236
+ 4. **Context Handoff:** When agent completes, context is archived but lineage preserved
237
+
238
+ ### Preventing Context Drift
239
+ 1. Read `.agent/sub-agents/${parent_id}.json` before spawning
240
+ 2. Inherit immutable context (tech stack, constraints, decisions)
241
+ 3. Log all new decisions to own context file
242
+ 4. Reference lineage in all commits
243
+ 5. Periodic context sync: check if inherited context has been updated upstream