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,218 @@
1
+ # GitHub Integration (v4.1.0)
2
+
3
+ **When:** Importing issues from GitHub, creating PRs, syncing task status
4
+
5
+ > **Requires:** `gh` CLI authenticated (`gh auth status`)
6
+
7
+ ---
8
+
9
+ ## Quick Reference
10
+
11
+ | Action | Command | Result |
12
+ |--------|---------|--------|
13
+ | Import issues as tasks | `LOKI_GITHUB_IMPORT=true` | Fetches open issues, creates pending tasks |
14
+ | Create PR on completion | `LOKI_GITHUB_PR=true` | Auto-creates PR with task summaries |
15
+ | Sync status back | `LOKI_GITHUB_SYNC=true` | Comments progress on source issues |
16
+ | Import from URL | `LOKI_GITHUB_REPO=owner/repo` | Specify repo if not auto-detected |
17
+
18
+ ---
19
+
20
+ ## Environment Variables
21
+
22
+ ```bash
23
+ # Enable GitHub integration features
24
+ LOKI_GITHUB_IMPORT=true # Import open issues as tasks
25
+ LOKI_GITHUB_PR=true # Create PR when feature complete
26
+ LOKI_GITHUB_SYNC=true # Sync status back to issues
27
+ LOKI_GITHUB_REPO=owner/repo # Override auto-detected repo
28
+ LOKI_GITHUB_LABELS=bug,task # Filter issues by labels (comma-separated)
29
+ LOKI_GITHUB_MILESTONE=v1.0 # Filter issues by milestone
30
+ LOKI_GITHUB_ASSIGNEE=@me # Filter issues by assignee
31
+ LOKI_GITHUB_LIMIT=100 # Max issues to import (default: 100)
32
+ LOKI_GITHUB_PR_LABEL=automated # Label for PRs (optional, avoids error if missing)
33
+ ```
34
+
35
+ ---
36
+
37
+ ## Issue Import Workflow
38
+
39
+ ### 1. Check gh CLI Authentication
40
+
41
+ ```bash
42
+ # Verify gh is authenticated
43
+ gh auth status
44
+
45
+ # If not authenticated:
46
+ gh auth login
47
+ ```
48
+
49
+ ### 2. Import Open Issues
50
+
51
+ Issues are converted to tasks in `.loki/queue/pending.json`:
52
+
53
+ ```json
54
+ {
55
+ "tasks": [
56
+ {
57
+ "id": "github-123",
58
+ "title": "Fix login bug",
59
+ "description": "Issue #123: Users cannot login with SSO",
60
+ "source": "github",
61
+ "github_issue": 123,
62
+ "github_url": "https://github.com/owner/repo/issues/123",
63
+ "labels": ["bug", "priority:high"],
64
+ "status": "pending",
65
+ "created_at": "2026-01-21T10:00:00Z"
66
+ }
67
+ ]
68
+ }
69
+ ```
70
+
71
+ ### 3. Priority Mapping
72
+
73
+ | GitHub Label | Loki Priority |
74
+ |--------------|---------------|
75
+ | `priority:critical`, `P0` | Critical |
76
+ | `priority:high`, `P1` | High |
77
+ | `priority:medium`, `P2` | Medium |
78
+ | `priority:low`, `P3` | Low |
79
+ | (no priority label) | Normal |
80
+
81
+ ---
82
+
83
+ ## PR Creation Workflow
84
+
85
+ When a feature branch is complete:
86
+
87
+ ```bash
88
+ # Automatic PR creation (label is optional via LOKI_GITHUB_PR_LABEL)
89
+ gh pr create \
90
+ --title "[Loki Mode] $FEATURE_NAME" \
91
+ --body-file .loki/reports/pr-body.md
92
+ ```
93
+
94
+ ### PR Body Template
95
+
96
+ ```markdown
97
+ ## Summary
98
+
99
+ Automated implementation by Loki Mode v4.1.0
100
+
101
+ ### Tasks Completed
102
+ - [x] Task 1: Description
103
+ - [x] Task 2: Description
104
+
105
+ ### Quality Gates
106
+ - Static Analysis: PASS
107
+ - Unit Tests: PASS (85% coverage)
108
+ - Code Review: PASS (3/3 reviewers)
109
+
110
+ ### Related Issues
111
+ Closes #123, #124
112
+
113
+ ### Test Plan
114
+ 1. Run `npm test` - verify all tests pass
115
+ 2. Review changes in `src/` directory
116
+ 3. Test login flow manually
117
+ ```
118
+
119
+ ---
120
+
121
+ ## Status Sync Workflow
122
+
123
+ When task status changes, comment on source issue:
124
+
125
+ ```bash
126
+ # Add progress comment
127
+ gh issue comment 123 --body "Loki Mode: Task in progress - implementing solution..."
128
+
129
+ # Mark complete
130
+ gh issue comment 123 --body "Loki Mode: Implementation complete. PR #456 created."
131
+
132
+ # Close issue with PR
133
+ gh issue close 123 --reason "completed" --comment "Fixed via #456"
134
+ ```
135
+
136
+ ---
137
+
138
+ ## Usage Examples
139
+
140
+ ### Import Issues and Create PR
141
+
142
+ ```bash
143
+ # Import issues with "enhancement" label and create PR when done
144
+ LOKI_GITHUB_IMPORT=true \
145
+ LOKI_GITHUB_PR=true \
146
+ LOKI_GITHUB_LABELS=enhancement \
147
+ ./autonomy/run.sh
148
+ ```
149
+
150
+ ### Sync with Specific Repo
151
+
152
+ ```bash
153
+ # Work on issues from a different repo
154
+ LOKI_GITHUB_REPO=org/other-repo \
155
+ LOKI_GITHUB_IMPORT=true \
156
+ ./autonomy/run.sh
157
+ ```
158
+
159
+ ### Filter by Milestone
160
+
161
+ ```bash
162
+ # Only import issues for v2.0 milestone
163
+ LOKI_GITHUB_MILESTONE=v2.0 \
164
+ LOKI_GITHUB_IMPORT=true \
165
+ ./autonomy/run.sh
166
+ ```
167
+
168
+ ---
169
+
170
+ ## Integration with Dashboard
171
+
172
+ The dashboard shows GitHub-sourced tasks with:
173
+ - GitHub icon badge
174
+ - Direct link to issue
175
+ - Sync status indicator
176
+ - "Import from GitHub" button (calls `gh issue list`)
177
+
178
+ ---
179
+
180
+ ## Error Handling
181
+
182
+ | Error | Solution |
183
+ |-------|----------|
184
+ | `gh: command not found` | Install: `brew install gh` |
185
+ | `not authenticated` | Run: `gh auth login` |
186
+ | `no repository found` | Set: `LOKI_GITHUB_REPO=owner/repo` |
187
+ | `rate limit exceeded` | Wait or use PAT with higher limit |
188
+
189
+ ---
190
+
191
+ ## gh CLI Quick Reference
192
+
193
+ ```bash
194
+ # List issues
195
+ gh issue list --label "bug" --limit 20
196
+
197
+ # View issue details
198
+ gh issue view 123
199
+
200
+ # Create PR
201
+ gh pr create --title "Title" --body "Body"
202
+
203
+ # Check PR status
204
+ gh pr status
205
+
206
+ # Merge PR
207
+ gh pr merge 456 --squash --delete-branch
208
+
209
+ # Check auth
210
+ gh auth status
211
+
212
+ # Switch repo context
213
+ gh repo set-default owner/repo
214
+ ```
215
+
216
+ ---
217
+
218
+ **v4.1.0 | GitHub Integration | ~100 lines**
@@ -0,0 +1,125 @@
1
+ # Model Selection & Task Tool
2
+
3
+ ## Model Selection by SDLC Phase
4
+
5
+ | Model | SDLC Phases | Examples |
6
+ |-------|-------------|----------|
7
+ | **Opus 4.5** | Bootstrap, Discovery, Architecture | PRD analysis, system design, technology selection, API contracts |
8
+ | **Sonnet 4.5** | Development, QA, Deployment | Feature implementation, complex bugs, integration/E2E tests, code review, deployment |
9
+ | **Haiku 4.5** | All other operations (parallel) | Unit tests, docs, bash commands, linting, monitoring |
10
+
11
+ ## Task Tool Examples
12
+
13
+ ```python
14
+ # Opus for Bootstrap, Discovery, Architecture (planning ONLY)
15
+ Task(subagent_type="Plan", model="opus", description="Design system architecture", prompt="...")
16
+ Task(subagent_type="Plan", model="opus", description="Analyze PRD requirements", prompt="...")
17
+
18
+ # Sonnet for Development, QA, and Deployment
19
+ Task(subagent_type="general-purpose", model="sonnet", description="Implement API endpoint", prompt="...")
20
+ Task(subagent_type="general-purpose", model="sonnet", description="Write integration tests", prompt="...")
21
+ Task(subagent_type="general-purpose", model="sonnet", description="Deploy to production", prompt="...")
22
+
23
+ # Haiku for everything else (PREFER for parallelization)
24
+ Task(subagent_type="general-purpose", model="haiku", description="Run unit tests", prompt="...")
25
+ Task(subagent_type="general-purpose", model="haiku", description="Check service health", prompt="...")
26
+ ```
27
+
28
+ ## Task Categories
29
+
30
+ **Opus (Bootstrap -> Architecture - Planning ONLY):**
31
+ - Bootstrap: Project setup, dependency analysis, environment configuration
32
+ - Discovery: PRD analysis, requirement extraction, gap identification
33
+ - Architecture: System design, technology selection, schema design, API contracts
34
+
35
+ **Sonnet (Development -> Deployment):**
36
+ - Development: Feature implementation, API endpoints, complex bug fixes, database migrations
37
+ - QA: Integration tests, E2E tests, security scanning, performance testing, code review
38
+ - Deployment: Release automation, infrastructure provisioning, monitoring setup
39
+
40
+ **Haiku (Operations - Use Extensively in Parallel):**
41
+ - Writing/running unit tests
42
+ - Generating documentation
43
+ - Running bash commands (npm install, git operations)
44
+ - Simple bug fixes (typos, imports, formatting)
45
+ - File operations, linting, static analysis
46
+ - Monitoring, health checks, log analysis
47
+
48
+ ## Parallelization Strategy
49
+
50
+ ```python
51
+ # Launch 10+ Haiku agents in parallel for unit test suite
52
+ for test_file in test_files:
53
+ Task(subagent_type="general-purpose", model="haiku",
54
+ description=f"Run unit tests: {test_file}",
55
+ run_in_background=True)
56
+ ```
57
+
58
+ ## Extended Thinking Mode
59
+
60
+ **Use thinking prefixes for complex planning:**
61
+
62
+ | Prefix | When to Use | Example |
63
+ |--------|-------------|---------|
64
+ | `"think"` | Standard planning | Architecture outlines, feature scoping |
65
+ | `"think hard"` | Complex decisions | System design, trade-off analysis |
66
+ | `"ultrathink"` | Critical/ambiguous | Multi-service architecture, security design |
67
+
68
+ ```python
69
+ Task(
70
+ subagent_type="Plan",
71
+ model="opus",
72
+ description="Design auth architecture",
73
+ prompt="think hard about the authentication architecture. Consider OAuth vs JWT..."
74
+ )
75
+ ```
76
+
77
+ **When to use:** Discovery, Architecture, Critical decisions
78
+ **When NOT to use:** Haiku tasks, repetitive work, obvious implementations
79
+
80
+ ## Prompt Repetition for Haiku
81
+
82
+ **For Haiku on structured tasks, repeat prompts 2x to improve accuracy 4-5x.**
83
+
84
+ ```python
85
+ base_prompt = "Run unit tests in tests/ directory and report results"
86
+ repeated_prompt = f"{base_prompt}\n\n{base_prompt}" # 2x repetition
87
+ Task(model="haiku", description="Run unit tests", prompt=repeated_prompt)
88
+ ```
89
+
90
+ **Research:** Accuracy improves from 21.33% to 97.33% (arXiv 2512.14982v1)
91
+
92
+ **When to apply:** Unit tests, linting, parsing, list operations
93
+ **When NOT to apply:** Opus/Sonnet, creative tasks, complex reasoning
94
+
95
+ ## Advanced Parameters
96
+
97
+ **Background Agents:**
98
+ ```python
99
+ Task(description="Long analysis task", run_in_background=True, prompt="...")
100
+ # Returns immediately with output_file path
101
+ ```
102
+
103
+ **Agent Resumption:**
104
+ ```python
105
+ result = Task(description="Complex refactor", prompt="...")
106
+ # Later: resume with agent_id
107
+ Task(resume="agent-abc123", prompt="Continue from where you left off")
108
+ ```
109
+
110
+ ## Confidence-Based Routing
111
+
112
+ | Confidence | Tier | Behavior |
113
+ |------------|------|----------|
114
+ | >= 0.95 | Auto-Approve | Direct execution, no review |
115
+ | 0.70-0.95 | Direct + Review | Execute then validate |
116
+ | 0.40-0.70 | Supervisor Mode | Full coordination with review |
117
+ | < 0.40 | Human Escalation | Too uncertain |
118
+
119
+ ```python
120
+ # Simple tasks -> Direct dispatch to Haiku
121
+ Task(model="haiku", description="Fix import in utils.py", prompt="...")
122
+
123
+ # Complex tasks -> Supervisor orchestration
124
+ Task(description="Implement user authentication with OAuth", prompt="...")
125
+ ```